zwischenstand

This commit is contained in:
2025-10-02 09:03:39 +00:00
parent 099530b7c8
commit f3dc0dc9bd
52 changed files with 994 additions and 5602 deletions

View File

@@ -1,249 +1,19 @@
import configClient from "../../api/hooks/config-client"
import * as sentry from "./sentry"
const protocol = typeof window !== "undefined" ? window.location.protocol : "https:"
export const baseDomain = typeof window !== "undefined" ? window.location.hostname : "kontextwerk.de"
export const baseURL = `${protocol}//${baseDomain}`
export const apiBaseURL = "/api/"
export const sentryDSN = "https://2ec76e3f86078b8020f23269f207e7b3@sentry.basehosts.de/5"
export const sentryTracingOrigins = [
"localhost",
"bkdf-tibi-2024.code.testversion.online",
"www.binkrassdufass.de",
"binkrassdufass.de",
/^\//,
/binkrassdufass/,
/bkdf-tibi-2024/,
/bkdf/,
]
export const sentryEnvironment: string = "local"
export const release = configClient.release
console.log("Release: ", release)
export const websiteName = "Kontextwerk"
export const companyName = "Kontextwerk GmbH"
export const email = "hello@kontextwerk.de"
export const streetAddress = "Gertrudenstraße 3"
export const localityAddress = "Hamburg"
export const regionAddress = "Hamburg"
export const zipCode = "20095"
export const countryAddress = "DE"
// need to execute early for fetch wrapping
sentry.init(sentryDSN, sentryTracingOrigins, sentryEnvironment, release)
const createCartRedirectUrl = () => {
const localCache: CheckoutCache = {
activeCartId: null,
data: null,
}
return async (cartId: string): Promise<StorefrontCheckoutResponse> => {
if (localCache.activeCartId !== cartId || !localCache.data) {
const response = await fetch(
`${bigcommerceBaseURL}/stores/${bigcommerceStoreHash}/v3/carts/${cartId}/redirect_urls`,
{
method: "POST",
headers: {
accept: "application/json",
"content-type": "application/json",
"x-auth-token": storefrontToken,
},
}
)
const data = (await response.json()) as StorefrontCheckoutResponse
localCache.activeCartId = cartId
localCache.data = data
return data
}
return localCache.data
}
}
const domain = "www.binkrassdufass.de"
const storefrontTokens = {
lokal: "eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJjaWQiOlsxXSwiY29ycyI6WyJodHRwczovL2Jpbi1rcmFzc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ytWpzKCy5SwJ53jJZZzy6aBbz1MyUavpY9SGw",
}
function getStorefrontToken() {
if (typeof window !== "undefined") {
if (document.location.hostname.includes("dev.tibicms.de")) {
return storefrontTokens.tibiAdminLive
} else if (document.location.hostname.includes("bkdf-tibi-2024-tibiadmin-dev")) {
return storefrontTokens.tibiAdminLokal
} else if (document.location.hostname.includes("bkdf-tibi-2024")) {
return storefrontTokens.lokal
} else if (document.location.hostname.includes("binkrassdufass.de")) {
if (document.location.hostname.includes("www")) {
return storefrontTokens.wwwLive
}
return storefrontTokens.live
} else {
return storefrontTokens.wwwLive
}
} else {
return storefrontTokens.wwwLive
}
}
export const apiBaseURL = "/api/",
baseDomain = typeof window !== "undefined" ? document?.location?.hostname : domain,
baseURL = "https://" + baseDomain,
bigcommerceBaseURL = "https://store-punbvyqteo.mybigcommerce.com",
bigcommerceStoreHash = "punbvyqteo",
bigcommerceChannelId = 1578456, // oder 1 kp testen was geht und was nicht
bigcommerceSiteId = 1001,
storefrontToken = getStorefrontToken(),
websiteName = "BinKrassDuFass",
companyName = "Robin Grenzdörfer",
streetAddress = "Eugen Richter Straße 3",
localityAddress = "Erfurt",
zipCode = "99085",
regionAddress = "Thüringen",
countryAddress = "Germany",
email = "info@binkrassdufass.de",
minimumForFreeShipping = 100,
memoizedCartRedirectUrl = createCartRedirectUrl(),
defaultSort: SortFilterItem = {
title: "Relevance",
slug: null,
sortKey: "RELEVANCE",
reverse: false,
},
sorting: SortFilterItem[] = [
defaultSort,
{ title: "Trending", slug: "trending-desc", sortKey: "BEST_SELLING", reverse: false }, // asc
{ title: "Latest arrivals", slug: "latest-desc", sortKey: "CREATED_AT", reverse: true },
{ title: "Price: Low to high", slug: "price-asc", sortKey: "PRICE", reverse: false }, // asc
{ title: "Price: High to low", slug: "price-desc", sortKey: "PRICE", reverse: true },
],
TAGS = {
collections: "collections",
products: "products",
cart: "cart",
},
HIDDEN_PRODUCT_TAG = "nextjs-frontend-hidden",
DEFAULT_OPTION = "Default Title"
export enum BigCommerceSortKeys {
A_TO_Z = "A_TO_Z",
BEST_REVIEWED = "BEST_REVIEWED",
BEST_SELLING = "BEST_SELLING",
RELEVANCE = "RELEVANCE",
FEATURED = "FEATURED",
HIGHEST_PRICE = "HIGHEST_PRICE",
LOWEST_PRICE = "LOWEST_PRICE",
NEWEST = "NEWEST",
Z_TO_A = "Z_TO_A",
}
export enum BKDFSortKeys {
RELEVANCE = "RELEVANCE",
BEST_SELLING = "BEST_SELLING",
CREATED_AT = "CREATED_AT",
PRICE = "PRICE",
}
export enum BKDFToBigCommerceSortKeys {
RELEVANCE = "RELEVANCE",
BEST_SELLING = "BEST_SELLING",
CREATED_AT = "NEWEST",
PRICE = "LOWEST_PRICE",
PRICE_ON_REVERSE = "HIGHEST_PRICE",
}
// need to execute early for fetch wrapping
//
interface StorefrontCheckoutResponse {
data?: {
cart_url: string
checkout_url: string
embedded_checkout_url: string
}
status: number
}
type CheckoutCache = {
activeCartId: string | null
data: StorefrontCheckoutResponse | null
}
export const icons = {
shoppingBag:
"M12 3C11.4033 3 10.831 3.23705 10.409 3.65901C9.98709 4.08097 9.75003 4.65326 9.75003 5.25V5.51C10.307 5.5 10.918 5.5 11.59 5.5H12.411C13.081 5.5 13.693 5.5 14.251 5.51V5.25C14.251 4.95444 14.1928 4.66178 14.0797 4.38873C13.9665 4.11568 13.8007 3.8676 13.5917 3.65866C13.3826 3.44971 13.1345 3.284 12.8614 3.17098C12.5883 3.05797 12.2956 2.99987 12 3ZM15.75 5.578V5.25C15.75 4.25544 15.3549 3.30161 14.6517 2.59835C13.9484 1.89509 12.9946 1.5 12 1.5C11.0055 1.5 10.0516 1.89509 9.34838 2.59835C8.64512 3.30161 8.25003 4.25544 8.25003 5.25V5.578C8.10703 5.59 7.97003 5.604 7.83603 5.621C6.82603 5.746 5.99403 6.008 5.28603 6.595C4.57903 7.182 4.16803 7.952 3.85903 8.922C3.55903 9.862 3.33303 11.069 3.04903 12.588L3.02803 12.698C2.62603 14.841 2.31003 16.53 2.25103 17.861C2.19103 19.226 2.39503 20.356 3.16503 21.283C3.93503 22.211 5.00803 22.619 6.36003 22.812C7.68003 23 9.39703 23 11.578 23H12.423C14.603 23 16.321 23 17.64 22.812C18.992 22.619 20.066 22.211 20.836 21.283C21.606 20.356 21.808 19.226 21.749 17.861C21.691 16.53 21.374 14.841 20.972 12.698L20.952 12.588C20.667 11.069 20.44 9.861 20.142 8.922C19.832 7.952 19.422 7.182 18.714 6.595C18.007 6.008 17.174 5.745 16.164 5.621C16.0263 5.60411 15.8883 5.58977 15.75 5.578ZM8.02003 7.11C7.16503 7.215 6.64803 7.414 6.24403 7.75C5.84103 8.084 5.55003 8.555 5.28803 9.377C5.02103 10.217 4.81003 11.335 4.51403 12.914C4.09803 15.131 3.80303 16.714 3.75003 17.927C3.69803 19.117 3.89003 19.807 4.31903 20.326C4.74903 20.843 5.39203 21.158 6.57203 21.326C7.77203 21.498 9.38403 21.5 11.64 21.5H12.36C14.617 21.5 16.227 21.498 17.428 21.327C18.608 21.158 19.251 20.843 19.681 20.326C20.111 19.808 20.302 19.118 20.251 17.926C20.197 16.715 19.902 15.131 19.486 12.914C19.19 11.334 18.98 10.218 18.712 9.377C18.45 8.555 18.16 8.084 17.756 7.749C17.352 7.414 16.836 7.215 15.98 7.109C15.104 7.001 13.967 7 12.36 7H11.64C10.033 7 8.89603 7.001 8.02003 7.11ZM9.12303 10.51C9.22022 10.5261 9.31328 10.5613 9.39689 10.6134C9.4805 10.6655 9.55302 10.7335 9.61032 10.8137C9.66762 10.8938 9.70856 10.9845 9.73082 11.0804C9.75308 11.1764 9.75621 11.2758 9.74003 11.373L8.74003 17.373C8.72388 17.4702 8.68875 17.5632 8.63663 17.6468C8.58452 17.7304 8.51646 17.8029 8.43632 17.8602C8.35618 17.9175 8.26554 17.9585 8.16958 17.9807C8.07362 18.003 7.97421 18.0062 7.87703 17.99C7.77986 17.9738 7.68681 17.9387 7.60321 17.8866C7.51961 17.8345 7.44709 17.7664 7.3898 17.6863C7.33251 17.6061 7.29156 17.5155 7.26929 17.4195C7.24703 17.3236 7.24388 17.2242 7.26003 17.127L8.26003 11.127C8.27617 11.0298 8.31129 10.9368 8.3634 10.8531C8.4155 10.7695 8.48357 10.697 8.56371 10.6397C8.64385 10.5824 8.7345 10.5415 8.83047 10.5192C8.92644 10.497 9.02585 10.4938 9.12303 10.51ZM14.877 10.51C14.9742 10.4938 15.0736 10.497 15.1696 10.5192C15.2656 10.5415 15.3562 10.5824 15.4364 10.6397C15.5165 10.697 15.5846 10.7695 15.6367 10.8531C15.6888 10.9368 15.7239 11.0298 15.74 11.127L16.74 17.127C16.7727 17.3233 16.726 17.5244 16.6103 17.6863C16.4946 17.8481 16.3193 17.9574 16.123 17.99C15.9268 18.0226 15.7256 17.9759 15.5637 17.8602C15.4019 17.7445 15.2927 17.5693 15.26 17.373L14.26 11.373C14.2439 11.2758 14.247 11.1764 14.2692 11.0804C14.2915 10.9845 14.3325 10.8938 14.3897 10.8137C14.447 10.7335 14.5196 10.6655 14.6032 10.6134C14.6868 10.5613 14.7798 10.5261 14.877 10.51Z",
chevronDown:
"M4.42999 8.512C4.49412 8.43717 4.57236 8.37572 4.66025 8.33115C4.74814 8.28658 4.84395 8.25977 4.94221 8.25225C5.04046 8.24473 5.13924 8.25664 5.23289 8.28731C5.32653 8.31798 5.41322 8.36681 5.48799 8.431L12 14.012L18.512 8.431C18.6638 8.30912 18.8571 8.25107 19.0509 8.2691C19.2448 8.28713 19.424 8.37984 19.5508 8.52762C19.6775 8.6754 19.7418 8.86668 19.7301 9.06101C19.7184 9.25535 19.6316 9.43751 19.488 9.569L12.488 15.569C12.3521 15.6855 12.179 15.7495 12 15.7495C11.821 15.7495 11.6479 15.6855 11.512 15.569L4.51199 9.569C4.36118 9.43951 4.26793 9.25545 4.25274 9.05726C4.23756 8.85907 4.30167 8.66295 4.43099 8.512",
}
export const emailRegex =
/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/
export const phoneRegex = /^(\+\d{1,2}\s)?\(?\d{3}\)?[\s.-]\d{3}[\s.-]\d{4}$/
export const germanyStates = [
{
name: "Baden-Württemberg",
code: "DE-BW",
},
{
name: "Bayern",
code: "DE-BY",
},
{
name: "Berlin",
code: "DE-BE",
},
{
name: "Brandenburg",
code: "DE-BB",
},
{
name: "Bremen",
code: "DE-HB",
},
{
name: "Hamburg",
code: "DE-HH",
},
{
name: "Hessen",
code: "DE-HE",
},
{
name: "Mecklenburg-Vorpommern",
code: "DE-MV",
},
{
name: "Niedersachsen",
code: "DE-NI",
},
{
name: "Nordrhein-Westfalen",
code: "DE-NW",
},
{
name: "Rheinland-Pfalz",
code: "DE-RP",
},
{
name: "Saarland",
code: "DE-SL",
},
{
name: "Sachsen",
code: "DE-SN",
},
{
name: "Sachsen-Anhalt",
code: "DE-ST",
},
{
name: "Schleswig-Holstein",
code: "DE-SH",
},
{
name: "Thüringen",
code: "DE-TH",
},
]
export const socialIcons = {
facebook: "https://www.facebook.com/binkrassdufass",
instagram: "https://www.instagram.com/binkrassdufass",
tiktok: "https://www.tiktok.com/@binkrassdufass",
youtube: "https://www.youtube.com/@binkrassdufass",
instagram: "https://www.instagram.com/kontextwerk",
linkedin: "https://www.linkedin.com/company/kontextwerk",
youtube: "https://www.youtube.com/@kontextwerk",
}