@zenky/storefront-vue 0.10.18 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +107 -0
- package/dist/cart/index.js +6 -6
- package/dist/chunk-6HOKVW4M.js +134 -0
- package/dist/chunk-6HOKVW4M.js.map +1 -0
- package/dist/{chunk-LABBB43Q.js → chunk-CQDOEP6T.js} +163 -128
- package/dist/chunk-CQDOEP6T.js.map +1 -0
- package/dist/{chunk-6BXHWR5E.js → chunk-IEHN2WNU.js} +46 -13
- package/dist/chunk-IEHN2WNU.js.map +1 -0
- package/dist/chunk-JY3UJRMF.js +59 -0
- package/dist/chunk-JY3UJRMF.js.map +1 -0
- package/dist/{chunk-YTYCSTHP.js → chunk-PBBVWWMI.js} +3 -3
- package/dist/{chunk-YTYCSTHP.js.map → chunk-PBBVWWMI.js.map} +1 -1
- package/dist/{chunk-2DUKIVKC.js → chunk-QFKA2R6D.js} +3 -3
- package/dist/{chunk-2DUKIVKC.js.map → chunk-QFKA2R6D.js.map} +1 -1
- package/dist/{chunk-T52G6JN7.js → chunk-TXR76IDL.js} +16 -3
- package/dist/chunk-TXR76IDL.js.map +1 -0
- package/dist/{chunk-RURXGVWW.js → chunk-UJKWKD3W.js} +4 -56
- package/dist/chunk-UJKWKD3W.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +13 -11
- package/dist/products/index.d.ts +42 -2
- package/dist/products/index.js +3 -2
- package/dist/promotions/index.js +2 -2
- package/dist/seo/index.d.ts +44 -16
- package/dist/seo/index.js +338 -104
- package/dist/seo/index.js.map +1 -1
- package/dist/stores/index.d.ts +3 -2
- package/dist/stores/index.js +3 -3
- package/dist/utils/index.js +2 -1
- package/docs/architecture.md +5 -3
- package/docs/consumer-setup.md +1 -1
- package/package.json +3 -3
- package/dist/chunk-6BXHWR5E.js.map +0 -1
- package/dist/chunk-LABBB43Q.js.map +0 -1
- package/dist/chunk-RURXGVWW.js.map +0 -1
- package/dist/chunk-T52G6JN7.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/products/useProductsByCategory.ts","../src/products/useProductVariantModifiers.ts","../src/products/useProductVariant.ts","../src/products/usePriceRecalculation.ts","../src/products/useProductVariantSelector.ts","../src/products/useRelatedProducts.ts","../src/products/findProductInCatalog.ts","../src/products/useProductDetail.ts","../src/products/useProductList.ts","../src/utils/color.ts","../src/products/badges.ts"],"names":["computed","ref","watch","channel"],"mappings":";;;;;;;;AAYO,SAAS,qBAAA,CACZ,UACA,UAAA,EAGF;AACE,EAAA,MAAM,OAAA,GAAU,SAAiC,MAAM;AACnD,IAAA,IAAI,CAAC,UAAA,CAAW,KAAA,CAAM,UAAU,CAAC,QAAA,CAAS,MAAM,MAAA,EAAQ;AACpD,MAAA,OAAO,EAAC;AAAA,IACZ;AAEA,IAAA,MAAM,kBAAA,uBAAyB,GAAA,EAAuB;AAEtD,IAAA,KAAA,MAAW,OAAA,IAAW,SAAS,KAAA,EAAO;AAClC,MAAA,KAAA,MAAW,QAAA,IAAY,QAAQ,UAAA,EAAY;AACvC,QAAA,MAAM,WAAW,kBAAA,CAAmB,GAAA,CAAI,QAAA,CAAS,EAAE,KAAK,EAAC;AACzD,QAAA,QAAA,CAAS,KAAK,OAAO,CAAA;AACrB,QAAA,kBAAA,CAAmB,GAAA,CAAI,QAAA,CAAS,EAAA,EAAI,QAAQ,CAAA;AAAA,MAChD;AAAA,IACJ;AAEA,IAAA,OAAO,iBAAA,CAAkB,UAAA,CAAW,KAAK,CAAA,CACpC,OAAO,CAAC,QAAA,KAAa,kBAAA,CAAmB,GAAA,CAAI,SAAS,EAAE,CAAC,CAAA,CACxD,GAAA,CAAI,CAAC,QAAA,MAAc;AAAA,MAChB,IAAI,QAAA,CAAS,EAAA;AAAA,MACb,SAAS,QAAA,CAAS,QAAA;AAAA,MAClB,MAAM,QAAA,CAAS,IAAA;AAAA,MACf,MAAM,QAAA,CA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AAmB,MAAA,CAAO,MAAA,CAAO,UAAU,CAAA;AAEjD,EAAA,IAAI,IAAA,CAAK,GAAA,CAAI,UAAA,GAAa,gBAAgB,IAAI,kBAAA,EAAoB;AAC9D,IAAA,OAAO,UAAA,GAAa,gBAAA,GAAmB,MAAA,CAAO,IAAA,GAAO,MAAA,CAAO,UAAA;AAAA,EAChE;AAEA,EAAA,OAAO,SAAA,CAAU,MAAA,CAAO,IAAI,CAAA,IAAK,SAAA,CAAU,OAAO,UAAU,CAAA,GAAI,MAAA,CAAO,IAAA,GAAO,MAAA,CAAO,UAAA;AACzF;AAQO,SAAS,sBAAsB,MAAA,EAAgD;AAClF,EAAA,MAAM,IAAA,GAAO,WAAW,MAAM,CAAA;AAC9B,EAAA,MAAM,KAAK,aAAA,CAAc,KAAA,EAAO,IAAI,CAAA,IAAK,yBAAyB,KAAA,GAAQ,KAAA;AAE1E,EAAA,OAAO;AAAA,IACH,IAAA;AAAA,IACA,OAAA,EAAS,cAAA;AAAA,MACL,SAAA,CAAU,MAAM,SAAA,EAAW;AAAA,QACvB,cAAA,EAAgB,yBAAA;AAAA,QAChB,YAAA,EAAc;AAAA,OACjB,CAAA;AAAA,MACD,EAAA;AAAA,MACA;AAAA,KACJ;AAAA,IACA,EAAA;AAAA,IACA,IAAA,EAAM,cAAA,CAAe,IAAA,EAAM,KAAA,EAAO,iBAAiB,CAAA;AAAA,IACnD,KAAA,EAAO,MAAA,CAAO,IAAA,EAAM,WAAW;AAAA,GACnC;AACJ;AAEO,SAAS,mBAAA,CACZ,QACA,UAAA,EACkB;AAClB,EAAA,OAAO,MAAA,CAAO,MAAA;AAAA,IAAO,CAAC,UAClB,qBAAA,CAAsB,KAAK,MAAM,cAAA,GAC3B,UAAA,CAAW,aACX,UAAA,CAAW;AAAA,GACrB;AACJ","file":"chunk-CQDOEP6T.js","sourcesContent":["import { computed, type ComputedRef } from 'vue'\n\nimport type { NestedCategory, Product } from '@zenky/storefront-api'\n\nexport interface CategoryWithProducts {\n id: string\n shortId: string\n slug: string | null\n name: string | null\n products: Product[]\n}\n\nexport function useProductsByCategory(\n products: ComputedRef<Product[]>,\n categories: ComputedRef<NestedCategory[]>\n): {\n grouped: ComputedRef<CategoryWithProducts[]>\n} {\n const grouped = computed<CategoryWithProducts[]>(() => {\n if (!categories.value.length || !products.value.length) {\n return []\n }\n\n const productsByCategory = new Map<string, Product[]>()\n\n for (const product of products.value) {\n for (const category of product.categories) {\n const existing = productsByCategory.get(category.id) ?? []\n existing.push(product)\n productsByCategory.set(category.id, existing)\n }\n }\n\n return flattenCategories(categories.value)\n .filter((category) => productsByCategory.has(category.id))\n .map((category) => ({\n id: category.id,\n shortId: category.short_id,\n slug: category.slug,\n name: category.name,\n products: productsByCategory.get(category.id) ?? [],\n }))\n })\n\n return { grouped }\n}\n\nfunction flattenCategories(categories: NestedCategory[]): NestedCategory[] {\n const result: NestedCategory[] = []\n\n for (const category of categories) {\n result.push(category)\n\n if (category.children?.length) {\n result.push(...flattenCategories(category.children))\n }\n }\n\n return result\n}\n","import { computed, ref, watch, type ComputedRef, type Ref } from 'vue'\n\nimport type { ProductModifiersRequest, ProductVariant } from '@zenky/storefront-api'\n\nfunction getInitialModifiersModel(variant: ProductVariant | null): ProductModifiersRequest[] {\n if (!variant?.default_modifiers?.modifiers.length) {\n return []\n }\n\n return variant.default_modifiers.modifiers.map((modifier) => ({\n modifier_id: modifier.modifier_id,\n modifiers_group_id: modifier.modifiers_group_id,\n quantity: modifier.quantity,\n }))\n}\n\nexport function useProductVariantModifiers(variant: ComputedRef<ProductVariant | null>): {\n modifiersModel: Ref<ProductModifiersRequest[]>\n selectedModifiersHash: Ref<string | null>\n hasAnyModifier: ComputedRef<boolean>\n} {\n const modifiersModel: Ref<ProductModifiersRequest[]> = ref([\n ...getInitialModifiersModel(variant.value),\n ])\n const selectedModifiersHash: Ref<string | null> = ref(null)\n const hasAnyModifier = computed<boolean>(() => modifiersModel.value.length > 0)\n\n watch(variant, () => {\n const newDefaults = getInitialModifiersModel(variant.value)\n\n // Keep standalone modifiers (no group) — they belong to the product, not the variant.\n // Group modifiers reset to the new variant's defaults.\n const userStandalone = modifiersModel.value.filter((m) => !m.modifiers_group_id)\n const defaultStandaloneIds = new Set(\n newDefaults.filter((d) => !d.modifiers_group_id).map((d) => d.modifier_id)\n )\n const preservedStandalone = userStandalone.filter(\n (m) => !defaultStandaloneIds.has(m.modifier_id)\n )\n\n modifiersModel.value = [...preservedStandalone, ...newDefaults]\n })\n\n return { modifiersModel, selectedModifiersHash, hasAnyModifier }\n}\n","import { computed, ref, watch, type ComputedRef, type Ref } from 'vue'\n\nimport type {\n Product,\n ProductVariant,\n ProductVariantOption,\n ProductVariantOptionValue,\n} from '@zenky/storefront-api'\n\nexport interface ProductVariantOptionListItem {\n id: string\n name: string | null\n values: ProductVariantOptionValue[]\n}\n\nfunction getDefaultOptionsModel(product: Product): Record<string, string> {\n const model: Record<string, string> = {}\n\n if (!product.variants?.length) {\n return model\n }\n\n const firstVariantOptions = product.variants.find(\n (variant: ProductVariant) => variant.options?.length\n )?.options\n\n if (!firstVariantOptions) {\n return model\n }\n\n firstVariantOptions.forEach((option: ProductVariantOption) => {\n model[option.id] = option.value.id\n })\n\n return model\n}\n\nfunction getProductVariantOptionsList(product: Product): ProductVariantOptionListItem[] {\n const list: ProductVariantOptionListItem[] = []\n\n if (!product.variants?.length) {\n return list\n }\n\n product.variants.forEach((variant: ProductVariant) => {\n if (!variant.options?.length) {\n return\n }\n\n variant.options.forEach((option: ProductVariantOption) => {\n let index = list.findIndex(\n (item: ProductVariantOptionListItem) => item.id === option.id\n )\n\n if (index === -1) {\n index = list.push({\n id: option.id,\n name: option.name,\n values: [],\n })\n\n index--\n }\n\n const valueIndex = list[index]!.values.findIndex(\n (value: ProductVariantOptionValue) => value.id === option.value.id\n )\n\n if (valueIndex === -1) {\n list[index]!.values.push(option.value)\n }\n })\n })\n\n return list\n}\n\nfunction computeDisabledValues(\n variants: ProductVariant[],\n optionsList: ProductVariantOptionListItem[],\n optionsModel: Record<string, string>\n): Record<string, Set<string>> {\n if (!variants.length) return {}\n\n const result: Record<string, Set<string>> = {}\n\n for (const option of optionsList) {\n const disabled = new Set<string>()\n\n for (const value of option.values) {\n const hasMatch = variants.some((variant) => {\n if (!variant.options?.length) return false\n\n const variantMap: Record<string, string> = {}\n for (const opt of variant.options) {\n variantMap[opt.id] = opt.value.id\n }\n\n // Variant must have this specific value for this option\n if (variantMap[option.id] !== value.id) return false\n\n // Variant must match all OTHER currently-selected values\n for (const [otherId, selectedId] of Object.entries(optionsModel)) {\n if (otherId === option.id) continue\n if (variantMap[otherId] !== selectedId) return false\n }\n\n return true\n })\n\n if (!hasMatch) {\n disabled.add(value.id)\n }\n }\n\n result[option.id] = disabled\n }\n\n return result\n}\n\nexport function useProductVariant(product: ComputedRef<Product>): {\n optionsModel: Ref<Record<string, string>>\n optionsList: Ref<ProductVariantOptionListItem[]>\n selectedVariant: ComputedRef<ProductVariant | null>\n disabledValues: ComputedRef<Record<string, Set<string>>>\n} {\n const optionsModel = ref({ ...getDefaultOptionsModel(product.value) })\n const optionsList = ref([...getProductVariantOptionsList(product.value)])\n\n const selectedVariant = computed<ProductVariant | null>(() => {\n if (!product.value.variants?.length) {\n return null\n } else if (product.value.variants.length === 1 || !Object.keys(optionsModel.value).length) {\n return product.value.variants[0] ?? null\n }\n\n return (\n product.value.variants.find((variant: ProductVariant) => {\n if (!variant.options?.length) {\n return false\n }\n\n return variant.options.every(\n (option: ProductVariantOption) =>\n optionsModel.value[option.id] === option.value.id\n )\n }) ?? null\n )\n })\n\n const disabledValues = computed<Record<string, Set<string>>>(() =>\n computeDisabledValues(product.value.variants ?? [], optionsList.value, optionsModel.value)\n )\n\n watch(product, () => {\n optionsModel.value = { ...getDefaultOptionsModel(product.value) }\n optionsList.value = [...getProductVariantOptionsList(product.value)]\n })\n\n return { optionsModel, optionsList, selectedVariant, disabledValues }\n}\n","import { computed, ref, watch, type ComputedRef, type Ref } from 'vue'\n\nimport type { Product, ProductModifiersRequest, ProductVariant } from '@zenky/storefront-api'\n\nimport { useRuntime } from '../ports/runtime'\nimport { useStoreProfileStore } from '../stores/store-profile'\nimport { createDebounce } from '../utils/debounce'\nimport { resolveVariantPrice } from './useProductPricing'\n\ninterface PriceRecalculationOptions {\n product: ComputedRef<Product>\n selectedVariant: ComputedRef<ProductVariant | null>\n modifiersModel: Ref<ProductModifiersRequest[]>\n requiredModifiersGroupIsMissing: ComputedRef<boolean>\n selectedModifiersHash: Ref<string | null>\n}\n\nexport function usePriceRecalculation({\n product,\n selectedVariant,\n modifiersModel,\n requiredModifiersGroupIsMissing,\n selectedModifiersHash,\n}: PriceRecalculationOptions): {\n price: ComputedRef<number>\n originalPrice: ComputedRef<number | null>\n priceWasModified: ComputedRef<boolean>\n priceIsRecalculating: Ref<boolean>\n} {\n // Get the SDK from the runtime (DI port), not from the Nuxt-specific useStorefrontApi().\n const sdk = useRuntime().sdk\n const profileStore = useStoreProfileStore()\n\n // -------------------------------------------------------------------------\n // Computed: stock-aware variant pricing\n // -------------------------------------------------------------------------\n\n const currentStockId = computed(() => profileStore.stock?.id ?? null)\n\n const resolvedVariant = computed(() => {\n if (!selectedVariant.value) return null\n\n return resolveVariantPrice(selectedVariant.value, currentStockId.value)\n })\n\n // -------------------------------------------------------------------------\n // Computed: modifier price helpers\n // -------------------------------------------------------------------------\n\n const modifierPriceMap = computed<Map<string, number>>(() => {\n const map = new Map<string, number>()\n\n for (const item of product.value.modifiers ?? []) {\n if (item.modifier.price) {\n map.set(item.modifier.id, item.modifier.price)\n }\n }\n\n for (const group of product.value.modifiers_groups ?? []) {\n for (const item of group.group.modifiers ?? []) {\n if (item.modifier.price) {\n map.set(item.modifier.id, item.modifier.price)\n }\n }\n }\n\n return map\n })\n\n // Sum of selected modifier prices (includes defaults — they're already in modifiersModel)\n const selectedModifierTotal = computed<number>(() =>\n modifiersModel.value.reduce(\n (sum, req) => sum + (modifierPriceMap.value.get(req.modifier_id) ?? 0) * req.quantity,\n 0\n )\n )\n\n // -------------------------------------------------------------------------\n // Computed: optimistic price (instant, without hitting the API)\n // -------------------------------------------------------------------------\n\n // variant.price is the variant's base price (stock-specific or fallback);\n // it does NOT include modifiers. selectedModifierTotal adds all selected\n // modifiers (default + required + custom).\n const optimisticPrice = computed<number>(() => {\n if (!resolvedVariant.value) return 0\n\n return resolvedVariant.value.price + selectedModifierTotal.value\n })\n\n const optimisticOriginalPrice = computed<number | null>(() => {\n if (!resolvedVariant.value) return null\n\n const r = resolvedVariant.value\n\n if (r.originalPrice && r.originalPrice > r.price) return r.originalPrice\n if (r.discount && r.discount.difference > 0) return r.price + r.discount.difference\n\n return null\n })\n\n // -------------------------------------------------------------------------\n // API-confirmed price (overrides the optimistic price once the response arrives)\n // -------------------------------------------------------------------------\n\n const apiPrice = ref<number | null>(null)\n const apiOriginalPrice = ref<number | null>(null)\n const priceIsRecalculating = ref(false)\n let requestId = 0\n\n // -------------------------------------------------------------------------\n // Final displayed price: API > optimistic\n // -------------------------------------------------------------------------\n\n const price = computed<number>(() => apiPrice.value ?? optimisticPrice.value)\n const originalPrice = computed<number | null>(\n () => apiOriginalPrice.value ?? optimisticOriginalPrice.value\n )\n const priceWasModified = computed<boolean>(() => apiPrice.value !== null)\n\n // -------------------------------------------------------------------------\n // API recalculation (confirms / corrects the optimistic price)\n // -------------------------------------------------------------------------\n\n async function recalculatePrice(): Promise<void> {\n if (requiredModifiersGroupIsMissing.value) return\n if (!modifiersModel.value.length || !selectedVariant.value) return\n\n const currentRequestId = ++requestId\n priceIsRecalculating.value = true\n\n try {\n const response = await sdk.products.getProductVariantPrice(\n profileStore.store!.id,\n product.value.id,\n selectedVariant.value.id,\n {\n modifiers: modifiersModel.value,\n // exactOptionalPropertyTypes: only include stock_id when it's set\n ...(currentStockId.value ? { stock_id: currentStockId.value } : {}),\n }\n )\n\n if (currentRequestId !== requestId) return\n\n apiPrice.value = response.price\n apiOriginalPrice.value = response.original_price\n selectedModifiersHash.value = response.modifiers_hash\n } catch (e) {\n console.error('[usePriceRecalculation] price recalculation failed', e)\n } finally {\n if (currentRequestId === requestId) {\n priceIsRecalculating.value = false\n }\n }\n }\n\n const debouncedRecalculate = createDebounce(() => recalculatePrice(), 300)\n\n // -------------------------------------------------------------------------\n // Watcher: reset the API price + recalculate when the variant/modifiers change\n // -------------------------------------------------------------------------\n\n watch(selectedVariant, () => {\n apiPrice.value = null\n apiOriginalPrice.value = null\n requestId++\n selectedModifiersHash.value = selectedVariant.value?.default_modifiers?.hash ?? null\n })\n\n watch(\n modifiersModel,\n () => {\n apiPrice.value = null\n apiOriginalPrice.value = null\n requestId++\n\n if (modifiersModel.value.length && selectedVariant.value) {\n debouncedRecalculate()\n } else {\n selectedModifiersHash.value = selectedVariant.value?.default_modifiers?.hash ?? null\n }\n },\n { deep: true }\n )\n\n return { price, originalPrice, priceWasModified, priceIsRecalculating }\n}\n","import { computed, watch, type ComputedRef, type Ref } from 'vue'\n\nimport type { Product, ProductModifiersRequest, ProductVariant } from '@zenky/storefront-api'\n\nimport { usePriceRecalculation } from './usePriceRecalculation'\nimport { useProductVariant, type ProductVariantOptionListItem } from './useProductVariant'\nimport { useProductVariantModifiers } from './useProductVariantModifiers'\n\n// The SDK's min_quantity field is optional (number | null); normalize it to a positive quantity.\nfunction resolveQuantity(minQuantity: number | null): number {\n return minQuantity && minQuantity > 0 ? minQuantity : 1\n}\n\nexport function useProductVariantSelector(product: ComputedRef<Product>): {\n optionsModel: Ref<Record<string, string>>\n optionsList: Ref<ProductVariantOptionListItem[]>\n disabledValues: ComputedRef<Record<string, Set<string>>>\n modifiersModel: Ref<ProductModifiersRequest[]>\n selectedVariant: ComputedRef<ProductVariant | null>\n price: ComputedRef<number>\n originalPrice: ComputedRef<number | null>\n priceWasModified: ComputedRef<boolean>\n priceIsRecalculating: Ref<boolean>\n selectedModifiersHash: Ref<string | null>\n requiredModifiersGroupIsMissing: ComputedRef<boolean>\n} {\n const { optionsModel, optionsList, selectedVariant, disabledValues } =\n useProductVariant(product)\n const { modifiersModel, selectedModifiersHash } = useProductVariantModifiers(selectedVariant)\n\n // Required modifiers must always be present in the model.\n // 1) modEntry.is_required — an individually required modifier\n // 2) groupEntry.is_required — a required group: if it has no is_required modifiers,\n // auto-select the cheapest one (mirrors minRequiredModifiersCost in useProductPricing)\n const requiredModifierEntries = computed<ProductModifiersRequest[]>(() => {\n const result: ProductModifiersRequest[] = []\n\n for (const groupEntry of product.value.modifiers_groups ?? []) {\n const group = groupEntry.group\n const hasIndividualRequired = group.modifiers.some((m) => m.is_required)\n\n // 1. Individually required modifiers\n for (const modEntry of group.modifiers) {\n if (modEntry.is_required) {\n result.push({\n modifier_id: modEntry.modifier.id,\n modifiers_group_id: group.id,\n quantity: resolveQuantity(modEntry.min_quantity),\n })\n }\n }\n\n // 2. A required group with no is_required modifiers →\n // the user must pick at least one; take the cheapest\n if (groupEntry.is_required && !hasIndividualRequired) {\n const sorted = [...group.modifiers].sort(\n (a, b) => (a.modifier.price ?? 0) - (b.modifier.price ?? 0)\n )\n const cheapest = sorted[0]\n\n if (cheapest) {\n result.push({\n modifier_id: cheapest.modifier.id,\n modifiers_group_id: group.id,\n quantity: resolveQuantity(cheapest.min_quantity),\n })\n }\n }\n }\n\n return result\n })\n\n // Adds required modifiers to the model (for both UI and API).\n // Single mutation — avoids extra reactive recalculations.\n function seedRequiredModifiers(): void {\n const missing = requiredModifierEntries.value.filter(\n (req) => !modifiersModel.value.some((m) => m.modifier_id === req.modifier_id)\n )\n\n if (missing.length) {\n modifiersModel.value = [...modifiersModel.value, ...missing]\n }\n }\n\n // Synchronous initialization — runs before any watchers are registered in\n // usePriceRecalculation, so the first render already sees the correct price.\n seedRequiredModifiers()\n\n // On variant change: the useProductVariantModifiers watcher resets the model to defaults,\n // then we add the required ones back. Both watchers use flush: 'pre' — they run in\n // registration order, before the render.\n watch(selectedVariant, seedRequiredModifiers)\n\n const requiredModifiersGroupIsMissing = computed<boolean>(() => {\n const requiredGroups = (product.value.modifiers_groups ?? [])\n .filter((group) => group.is_required)\n .map((group) => group.group.id)\n\n if (!requiredGroups.length) return false\n\n return requiredGroups.some(\n (groupId) =>\n !modifiersModel.value.find(\n (m) => m.modifiers_group_id === groupId && m.quantity > 0\n )\n )\n })\n\n const { price, originalPrice, priceWasModified, priceIsRecalculating } = usePriceRecalculation({\n product,\n selectedVariant,\n modifiersModel,\n requiredModifiersGroupIsMissing,\n selectedModifiersHash,\n })\n\n return {\n optionsModel,\n optionsList,\n disabledValues,\n modifiersModel,\n selectedVariant,\n price,\n originalPrice,\n priceWasModified,\n priceIsRecalculating,\n selectedModifiersHash,\n requiredModifiersGroupIsMissing,\n }\n}\n","// Requests for recommended products. The SDK has no typed related.products.list\n// method, so this goes through the public sdk.client.request instead.\nimport type { Product } from '@zenky/storefront-api'\n\nimport { useRuntime } from '../ports/runtime'\nimport { createRuntimeState } from '../ports/runtimeState'\nimport { useAuthStore } from '../stores/auth'\nimport { useStoreProfileStore } from '../stores/store-profile'\n\nexport interface OrderCredentials {\n id: string\n token: string\n}\n\ninterface UseRelatedProductsApi {\n fetchForProduct: (\n productId: string,\n orderCredentials: OrderCredentials | null,\n signal?: AbortSignal\n ) => Promise<Product[]>\n fetchForOrder: (orderId: string, orderToken: string, signal?: AbortSignal) => Promise<Product[]>\n}\n\n/**\n * A single variant and no modifiers — such a product can be added to the cart\n * directly with one click from a recommendation, without opening the product card.\n */\nexport function canAddDirectly(product: Product): boolean {\n const variantsCount = product.variants?.length ?? 0\n const hasModifiers = (product.modifiers?.length ?? 0) > 0\n const hasModifierGroups = (product.modifiers_groups?.length ?? 0) > 0\n return variantsCount === 1 && !hasModifiers && !hasModifierGroups\n}\n\n// Without `variants.prices` prices come back as 0 (prices live on variants). Without\n// modifiers/groups, canAddDirectly breaks — it treats the product as \"direct add\"\n// even though it has modifiers.\nconst RELATED_PRODUCT_INCLUDES = 'variants.prices,modifiers,modifiers_groups'\n\ninterface RelatedProductsState {\n productInFlight: Map<string, Promise<Product[]>>\n}\n\nconst getRelatedProductsState = createRuntimeState<RelatedProductsState>(() => ({\n productInFlight: new Map<string, Promise<Product[]>>(),\n}))\n\nexport function useRelatedProducts(): UseRelatedProductsApi {\n const runtime = useRuntime()\n const { sdk } = runtime\n const { productInFlight } = getRelatedProductsState(runtime)\n const profileStore = useStoreProfileStore()\n const authStore = useAuthStore()\n\n function getStoreId(): string {\n const id = profileStore.store?.id\n if (!id) throw new Error('Store is not initialized')\n return id\n }\n\n async function fetchForProduct(\n productId: string,\n orderCredentials: OrderCredentials | null,\n signal?: AbortSignal\n ): Promise<Product[]> {\n if (signal?.aborted) return []\n\n const key = orderCredentials ? `${productId}:${orderCredentials.id}` : productId\n\n let promise = productInFlight.get(key)\n if (!promise) {\n promise = (async (): Promise<Product[]> => {\n try {\n const storeId = getStoreId()\n const query: Record<string, string> = { with: RELATED_PRODUCT_INCLUDES }\n if (orderCredentials) {\n query.order_id = orderCredentials.id\n query.order_token = orderCredentials.token\n }\n const url = sdk.client.getStoreUrl(\n storeId,\n `/products/${productId}/related/products`,\n query\n )\n const response = await sdk.client.request(\n 'GET',\n url,\n undefined,\n authStore.token\n )\n return (response?.data as Product[] | undefined) ?? []\n } catch (e: unknown) {\n // Per spec: on error or empty response, show nothing to the customer —\n // the block just doesn't appear. The log is for developers.\n console.warn('[recommendations:product] fetch failed', e)\n return []\n }\n })().finally(() => productInFlight.delete(key))\n productInFlight.set(key, promise)\n }\n\n const result = await promise\n return signal?.aborted ? [] : result\n }\n\n async function fetchForOrder(\n orderId: string,\n orderToken: string,\n signal?: AbortSignal\n ): Promise<Product[]> {\n if (signal?.aborted) return []\n\n try {\n const storeId = getStoreId()\n const url = sdk.client.getStoreUrl(storeId, `/orders/${orderId}/related/products`, {\n token: orderToken,\n with: RELATED_PRODUCT_INCLUDES,\n })\n const response = await sdk.client.request('GET', url, undefined, authStore.token)\n if (signal?.aborted) return []\n return (response?.data as Product[] | undefined) ?? []\n } catch (e: unknown) {\n console.warn('[recommendations:order] fetch failed', e)\n return []\n }\n }\n\n return { fetchForProduct, fetchForOrder }\n}\n","import type { Product } from '@zenky/storefront-api'\n\nimport type { StaticCatalogItem } from '../catalog/catalogEntity'\n\nexport interface CatalogProductMatch {\n product: Product\n catalogItem: StaticCatalogItem\n}\n\nexport function findProductInCatalog(\n catalog: StaticCatalogItem[],\n shortId: string\n): CatalogProductMatch | null {\n for (const item of catalog) {\n if (!item.products.length) continue\n\n const found = item.products.find((p) => p.short_id === shortId)\n if (found) return { product: found, catalogItem: item }\n }\n\n return null\n}\n","import { useRuntime } from '../ports/runtime'\nimport { useCatalogStore } from '../stores/catalog'\nimport { useStoreProfileStore } from '../stores/store-profile'\nimport { findProductInCatalog, type CatalogProductMatch } from './findProductInCatalog'\n\nimport type { Product } from '@zenky/storefront-api'\n\n// images — cover and OG image; variants.options — without it the variant selector\n// collapses to the first variant; variants.prices — the variant's own price, not 0;\n// custom_fields — extra product attributes.\nconst PRODUCT_DETAIL_INCLUDES =\n 'images,variants.prices,variants.options,categories,modifiers,modifiers.cover,modifiers_groups,modifiers_groups.cover,custom_fields'\n\nexport interface UseProductDetailApi {\n /** Synchronous search against the already-loaded static catalog. */\n findInCatalog: (shortId: string) => CatalogProductMatch | null\n /** API fallback for when the product isn't in the catalog. */\n fetchProduct: (shortId: string) => Promise<Product | null>\n}\n\nexport function useProductDetail(): UseProductDetailApi {\n const { sdk } = useRuntime()\n const catalogStore = useCatalogStore()\n const profileStore = useStoreProfileStore()\n\n function findInCatalog(shortId: string): CatalogProductMatch | null {\n return findProductInCatalog(catalogStore.catalog, shortId)\n }\n\n async function fetchProduct(shortId: string): Promise<Product | null> {\n const storeId = profileStore.store?.id\n if (!storeId) return null\n\n try {\n return await sdk.products.getProduct(storeId, shortId, {\n with: PRODUCT_DETAIL_INCLUDES,\n })\n } catch (e) {\n console.error('[product-detail] getProduct failed', e)\n return null\n }\n }\n\n return { findInCatalog, fetchProduct }\n}\n","import { useRuntime } from '../ports/runtime'\nimport { useCartStore } from '../stores/cart'\nimport { useStoreProfileStore } from '../stores/store-profile'\n\nimport type { PaginatedResponse, Product } from '@zenky/storefront-api'\n\n// images — cover image; variants.prices — price per stock (see resolveVariantPrice);\n// modifiers/modifiers_groups — the card shows \"from X ₽\" when these are present.\nconst PRODUCT_LIST_INCLUDES =\n 'images,variants.prices,variants.options,modifiers,modifiers.cover,modifiers_groups,modifiers_groups.cover'\n\nexport interface ProductListParams {\n categoryId?: string\n collectionId?: string\n orderBy?: string\n page?: number\n count?: number\n}\n\nexport interface UseProductListApi {\n fetchProducts: (params: ProductListParams) => Promise<PaginatedResponse<Product>>\n}\n\nfunction emptyPage(page: number, count: number): PaginatedResponse<Product> {\n return {\n items: [],\n pagination: {\n total: 0,\n count: 0,\n per_page: count,\n current_page: page,\n total_pages: 0,\n links: {},\n has_previous_page: false,\n has_next_page: false,\n elements: [],\n },\n }\n}\n\nexport function useProductList(): UseProductListApi {\n const { sdk } = useRuntime()\n const profileStore = useStoreProfileStore()\n const cartStore = useCartStore()\n\n async function fetchProducts(params: ProductListParams): Promise<PaginatedResponse<Product>> {\n const storeId = profileStore.store?.id\n const stockId = cartStore.order?.stock?.id\n const cityId = stockId ? undefined : profileStore.city?.id\n\n if (!storeId || (!stockId && !cityId)) {\n return emptyPage(params.page ?? 1, params.count ?? 0)\n }\n\n return sdk.products.getProducts(storeId, {\n category_id: params.categoryId,\n collection_id: params.collectionId,\n with: PRODUCT_LIST_INCLUDES,\n order_by: params.orderBy,\n page: params.page,\n count: params.count,\n stock_id: stockId,\n city_id: cityId,\n })\n }\n\n return { fetchProducts }\n}\n","/**\n * Internal color math for derived badge palettes. Not part of the public API: only the\n * helpers built on top of it (see `products/badges.ts`) are exported from the package.\n */\n\nexport type Rgb = [number, number, number]\n\nexport interface HueRotationOptions {\n lightnessBoost?: number\n maxLightness?: number\n}\n\nexport const WHITE = '#ffffff'\nexport const BLACK = '#000000'\n\nconst CONTRAST_STEPS = 14\nconst CONTRAST_STEP_WEIGHT = 0.1\n\nexport function parseHex(hex: string): Rgb {\n const digits = hex.slice(1)\n const full =\n digits.length <= 4\n ? digits\n .split('')\n .map((char) => char + char)\n .join('')\n : digits\n\n return [0, 2, 4].map((offset) => parseInt(full.slice(offset, offset + 2), 16)) as Rgb\n}\n\nexport function toHex([r, g, b]: Rgb): string {\n return `#${[r, g, b]\n .map((channel) =>\n Math.round(Math.max(0, Math.min(255, channel)))\n .toString(16)\n .padStart(2, '0')\n )\n .join('')}`\n}\n\nexport function luminance(hex: string): number {\n const [r, g, b] = parseHex(hex).map((channel) => {\n const value = channel / 255\n\n return value <= 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4\n }) as Rgb\n\n return 0.2126 * r + 0.7152 * g + 0.0722 * b\n}\n\nexport function contrastRatio(a: string, b: string): number {\n const first = luminance(a)\n const second = luminance(b)\n\n return (Math.max(first, second) + 0.05) / (Math.min(first, second) + 0.05)\n}\n\nexport function chroma(hex: string): number {\n const channels = parseHex(hex).map((channel) => channel / 255)\n\n return Math.max(...channels) - Math.min(...channels)\n}\n\n/** Linear RGB mix: `weightOfTo` 0 returns `from`, 1 returns `to`. */\nexport function mixColors(from: string, to: string, weightOfTo: number): string {\n const a = parseHex(from)\n const b = parseHex(to)\n\n return toHex(a.map((channel, index) => channel + (b[index]! - channel) * weightOfTo) as Rgb)\n}\n\nexport function toRgba(hex: string, alpha: number): string {\n const [r, g, b] = parseHex(hex)\n\n return `rgba(${r}, ${g}, ${b}, ${alpha})`\n}\n\n/** Rotates the hue in HSL space; `lightnessBoost` is added to lightness and capped by `maxLightness`. */\nexport function rotateHue(\n hex: string,\n degrees: number,\n { lightnessBoost = 0, maxLightness = 1 }: HueRotationOptions = {}\n): string {\n const [r, g, b] = parseHex(hex).map((channel) => channel / 255) as Rgb\n const max = Math.max(r, g, b)\n const min = Math.min(r, g, b)\n const delta = max - min\n const lightness = (max + min) / 2\n let hue = 0\n let saturation = 0\n\n if (delta) {\n saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min)\n\n if (max === r) hue = (g - b) / delta + (g < b ? 6 : 0)\n else if (max === g) hue = (b - r) / delta + 2\n else hue = (r - g) / delta + 4\n\n hue *= 60\n }\n\n const rotatedHue = (((hue + degrees) % 360) + 360) % 360\n const rotatedLightness = Math.min(lightness + lightnessBoost, maxLightness)\n const spread = ((1 - Math.abs(2 * rotatedLightness - 1)) * saturation) / 2\n const channel = (offset: number): number => {\n const position = (offset + rotatedHue / 30) % 12\n const value =\n rotatedLightness - spread * Math.max(-1, Math.min(position - 3, 9 - position, 1))\n\n return value * 255\n }\n\n return toHex([channel(0), channel(8), channel(4)])\n}\n\n/** Moves `color` toward black or white (whichever contrasts with `against`) until `minimum` is met. */\nexport function ensureContrast(color: string, against: string, minimum: number): string {\n const target = luminance(against) > 0.5 ? BLACK : WHITE\n let result = color\n\n for (let step = 0; step < CONTRAST_STEPS && contrastRatio(result, against) < minimum; step++) {\n result = mixColors(result, target, CONTRAST_STEP_WEIGHT)\n }\n\n return result\n}\n","import type { ProductBadge, ProductBadgeColors } from '@zenky/storefront-api'\n\nimport {\n BLACK,\n WHITE,\n chroma,\n contrastRatio,\n ensureContrast,\n luminance,\n rotateHue,\n toRgba,\n} from '../utils/color'\n\n/** A merchant badge validated and normalized for rendering. */\nexport interface ProductBadgeView {\n id: string\n label: string | null\n emoji: string | null\n imageUrl: string | null\n colors: ProductBadgeColors | null\n}\n\n/** `image-square`: an image without a label, drawn as a square with no background. */\nexport type ProductBadgeLayout = 'text' | 'image-square'\n\n/** Colors derived from a badge's own text/background pair, for styles other than solid. */\nexport interface ProductBadgeAccent {\n base: string\n shifted: string\n on: string\n text: string\n glass: string\n}\n\nexport interface ProductBadgeVisibility {\n showText: boolean\n showImages: boolean\n}\n\nconst ON_ACCENT_CONTRAST_MIN = 3\nconst TEXT_CONTRAST_MIN = 4.5\nconst NEUTRAL_CHROMA_GAP = 0.08\nconst HUE_SHIFT = 38\nconst HUE_SHIFT_LIGHTNESS_BOOST = 0.06\nconst HUE_SHIFT_MAX_LIGHTNESS = 0.7\nconst GLASS_ALPHA = 0.35\n\nconst HEX_COLOR = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i\nconst HTTP_URL = /^https?:\\/\\//i\n\nfunction cleanText(value: unknown): string | null {\n if (typeof value !== 'string') return null\n\n const text = value.trim()\n\n return text || null\n}\n\nfunction dropAlpha(hex: string): string {\n if (hex.length === 5) return hex.slice(0, 4)\n if (hex.length === 9) return hex.slice(0, 7)\n\n return hex\n}\n\nfunction toColors(badge: ProductBadge): ProductBadgeColors | null {\n const background = cleanText(badge.colors?.background)\n const text = cleanText(badge.colors?.text)\n\n if (!background || !text || !HEX_COLOR.test(background) || !HEX_COLOR.test(text)) {\n return null\n }\n\n return { background: dropAlpha(background), text: dropAlpha(text) }\n}\n\nfunction toView(badge: ProductBadge): ProductBadgeView | null {\n const label = cleanText(badge.label)\n const iconValue = cleanText(badge.icon?.value)\n const emoji = badge.icon?.type === 'emoji' ? iconValue : null\n const imageUrl =\n badge.icon?.type === 'image' && iconValue && HTTP_URL.test(iconValue) ? iconValue : null\n\n if (!label && !emoji && !imageUrl) return null\n\n return { id: badge.id, label, emoji, imageUrl, colors: toColors(badge) }\n}\n\n/**\n * Validates the backend `Product.badges` list: drops badges with nothing to show, repeated\n * ids and unusable icons, accepts only hex colors (alpha is ignored) and http(s) image urls.\n * `colors` is `null` when either color is missing or invalid, so the consumer can fall back\n * to its own theme.\n */\nexport function toProductBadgeViews(badges: ProductBadge[] | null | undefined): ProductBadgeView[] {\n if (!Array.isArray(badges)) return []\n\n const result: ProductBadgeView[] = []\n const seen = new Set<string>()\n\n for (const badge of badges) {\n if (!badge || typeof badge.id !== 'string' || !badge.id || seen.has(badge.id)) continue\n\n const view = toView(badge)\n if (!view) continue\n\n seen.add(badge.id)\n result.push(view)\n }\n\n return result\n}\n\nexport function getProductBadgeLayout(badge: ProductBadgeView): ProductBadgeLayout {\n return !badge.label && badge.imageUrl ? 'image-square' : 'text'\n}\n\nfunction pickAccent(colors: ProductBadgeColors): string {\n const textChroma = chroma(colors.text)\n const backgroundChroma = chroma(colors.background)\n\n if (Math.abs(textChroma - backgroundChroma) > NEUTRAL_CHROMA_GAP) {\n return textChroma > backgroundChroma ? colors.text : colors.background\n }\n\n return luminance(colors.text) <= luminance(colors.background) ? colors.text : colors.background\n}\n\n/**\n * Derives a palette from the badge's own colors: the more chromatic of text/background\n * becomes the accent (darker one when both are neutral), `on` is white or black, whichever\n * stays readable on it, `shifted` is the hue-rotated gradient end and `glass` is a\n * translucent fill. Pure JS math, no CSS color functions, so it works for any hex input.\n */\nexport function getProductBadgeAccent(colors: ProductBadgeColors): ProductBadgeAccent {\n const base = pickAccent(colors)\n const on = contrastRatio(WHITE, base) >= ON_ACCENT_CONTRAST_MIN ? WHITE : BLACK\n\n return {\n base,\n shifted: ensureContrast(\n rotateHue(base, HUE_SHIFT, {\n lightnessBoost: HUE_SHIFT_LIGHTNESS_BOOST,\n maxLightness: HUE_SHIFT_MAX_LIGHTNESS,\n }),\n on,\n ON_ACCENT_CONTRAST_MIN\n ),\n on,\n text: ensureContrast(base, WHITE, TEXT_CONTRAST_MIN),\n glass: toRgba(base, GLASS_ALPHA),\n }\n}\n\nexport function filterProductBadges(\n badges: ProductBadgeView[],\n visibility: ProductBadgeVisibility\n): ProductBadgeView[] {\n return badges.filter((badge) =>\n getProductBadgeLayout(badge) === 'image-square'\n ? visibility.showImages\n : visibility.showText\n )\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useCartCredentials, usePromotionsChecker } from './chunk-
|
|
2
|
-
import { createRuntimeState } from './chunk-5QCUH3FF.js';
|
|
1
|
+
import { useCartCredentials, usePromotionsChecker } from './chunk-QFKA2R6D.js';
|
|
3
2
|
import { logCartError, getCartErrorHttpCode, getCartErrorCode, getCartErrorMessage } from './chunk-TE42OCFK.js';
|
|
4
3
|
import { usePromotionsStore } from './chunk-544USTPB.js';
|
|
5
|
-
import { useCatalogStore } from './chunk-4JCJHAL3.js';
|
|
6
|
-
import { useRuntime, useCartStore, useAuthStore, useOrderSettingsStore } from './chunk-T52G6JN7.js';
|
|
7
4
|
import { toRequestedMethod } from './chunk-TIQ7AJLY.js';
|
|
8
|
-
import { useStoreProfileStore } from './chunk-IOYYCA75.js';
|
|
9
5
|
import { getRemoteCatalog } from './chunk-FS2UNPTY.js';
|
|
10
6
|
import { minorToMajor, majorToMinor } from './chunk-2Y6QTHXI.js';
|
|
7
|
+
import { createRuntimeState } from './chunk-5QCUH3FF.js';
|
|
8
|
+
import { useCatalogStore } from './chunk-4JCJHAL3.js';
|
|
9
|
+
import { useRuntime, useCartStore, useAuthStore, useOrderSettingsStore } from './chunk-TXR76IDL.js';
|
|
10
|
+
import { useStoreProfileStore } from './chunk-IOYYCA75.js';
|
|
11
11
|
import { PaymentMethod, OrderAuthenticationMethod, DeliveryMethod, OrderCartCheckerResultAction, RecaptchaAction } from '@zenky/storefront-api';
|
|
12
12
|
import { ref, computed, watch, watchEffect, getCurrentScope, onScopeDispose, toValue } from 'vue';
|
|
13
13
|
import { storeToRefs } from 'pinia';
|
|
@@ -340,6 +340,7 @@ var ORDER_INCLUDES = [
|
|
|
340
340
|
"payments",
|
|
341
341
|
"progress",
|
|
342
342
|
"promocode",
|
|
343
|
+
"packages",
|
|
343
344
|
"variants.variant.options",
|
|
344
345
|
"variants.product.images",
|
|
345
346
|
"variants.product.categories",
|
|
@@ -1339,17 +1340,43 @@ var BATCH_DELAY = 250;
|
|
|
1339
1340
|
var CART_LINE_KIND_PREFIX = "cart-line-";
|
|
1340
1341
|
var getOperationsState = createRuntimeState(() => ({
|
|
1341
1342
|
batches: /* @__PURE__ */ new Map(),
|
|
1342
|
-
inflight: /* @__PURE__ */ new Set()
|
|
1343
|
+
inflight: /* @__PURE__ */ new Set(),
|
|
1344
|
+
packagesSeq: 0
|
|
1343
1345
|
}));
|
|
1344
1346
|
function useCartOperations(credentials, initialization, sdk, deps) {
|
|
1345
1347
|
const { notifier, activity } = deps;
|
|
1346
1348
|
const runtime = useRuntime();
|
|
1347
1349
|
const { events, rum, commerceEvents, messages } = runtime;
|
|
1348
|
-
const
|
|
1350
|
+
const state = getOperationsState(runtime);
|
|
1351
|
+
const { batches, inflight } = state;
|
|
1349
1352
|
const cartStore = useCartStore();
|
|
1350
1353
|
const profileStore = useStoreProfileStore();
|
|
1351
1354
|
const { run: runMutation, bumpKindsWithPrefix } = useCartMutation();
|
|
1352
1355
|
const { recalculateAfterOrderChange } = useCartRecalculation({ notifier, activity });
|
|
1356
|
+
async function syncPackages(isStale) {
|
|
1357
|
+
const mySeq = ++state.packagesSeq;
|
|
1358
|
+
const packagingPrice = cartStore.checkoutTotal?.packaging_price ?? 0;
|
|
1359
|
+
const hasPackages = (cartStore.order?.packages?.length ?? 0) > 0;
|
|
1360
|
+
if (packagingPrice <= 0) {
|
|
1361
|
+
if (hasPackages && !isStale()) cartStore.setOrderPackages([], 0);
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
try {
|
|
1365
|
+
const fresh = await sdk.orders.getOrder(
|
|
1366
|
+
credentials.getStoreId(),
|
|
1367
|
+
credentials.getCredentials(),
|
|
1368
|
+
{ with: "packages" }
|
|
1369
|
+
);
|
|
1370
|
+
if (isStale() || mySeq !== state.packagesSeq) return;
|
|
1371
|
+
if (fresh.id !== cartStore.order?.id) return;
|
|
1372
|
+
cartStore.setOrderPackages(fresh.packages ?? [], fresh.packaging_price ?? null);
|
|
1373
|
+
} catch (e) {
|
|
1374
|
+
logCartError(
|
|
1375
|
+
{ scope: "cart-packages", context: { orderId: cartStore.credentials?.id } },
|
|
1376
|
+
e
|
|
1377
|
+
);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1353
1380
|
function flushBatch(lineKey) {
|
|
1354
1381
|
if (inflight.has(lineKey)) return;
|
|
1355
1382
|
const batch = batches.get(lineKey);
|
|
@@ -1362,6 +1389,7 @@ function useCartOperations(credentials, initialization, sdk, deps) {
|
|
|
1362
1389
|
inflight.add(lineKey);
|
|
1363
1390
|
const sentDelta = batch.delta;
|
|
1364
1391
|
const isAdd = sentDelta > 0;
|
|
1392
|
+
const isPromotionLine = Boolean(batch.promotionId);
|
|
1365
1393
|
const qty = Math.abs(sentDelta);
|
|
1366
1394
|
const { variantId, productId, productName, variantLabel } = batch;
|
|
1367
1395
|
const execute = async () => {
|
|
@@ -1382,6 +1410,10 @@ function useCartOperations(credentials, initialization, sdk, deps) {
|
|
|
1382
1410
|
product_variant_id: variantId,
|
|
1383
1411
|
quantity: qty,
|
|
1384
1412
|
modifiers: batch.modifiers,
|
|
1413
|
+
...batch.promotionId ? {
|
|
1414
|
+
promotion_id: batch.promotionId,
|
|
1415
|
+
promotion_reward_id: batch.promotionRewardId
|
|
1416
|
+
} : {},
|
|
1385
1417
|
...batch.recommendationsBlock ? { recommendations_block: batch.recommendationsBlock } : {}
|
|
1386
1418
|
}
|
|
1387
1419
|
);
|
|
@@ -1414,7 +1446,7 @@ function useCartOperations(credentials, initialization, sdk, deps) {
|
|
|
1414
1446
|
optimisticCorrected = true;
|
|
1415
1447
|
const integrations = events?.get() ?? null;
|
|
1416
1448
|
const orderVariant = cartStore.order?.variants?.find((v) => variantLineKey(v) === lineKey) ?? null;
|
|
1417
|
-
if (isAdd) {
|
|
1449
|
+
if (isAdd && !isPromotionLine) {
|
|
1418
1450
|
if (!wasInCartBefore) {
|
|
1419
1451
|
integrations?.productAddedToCart({
|
|
1420
1452
|
order: cartStore.order,
|
|
@@ -1426,7 +1458,7 @@ function useCartOperations(credentials, initialization, sdk, deps) {
|
|
|
1426
1458
|
orderVariant
|
|
1427
1459
|
});
|
|
1428
1460
|
}
|
|
1429
|
-
} else {
|
|
1461
|
+
} else if (!isAdd) {
|
|
1430
1462
|
const isNowInCart = cartStore.order?.variants?.some((v) => variantLineKey(v) === lineKey) ?? false;
|
|
1431
1463
|
if (!isNowInCart) {
|
|
1432
1464
|
const product = variantBeforeChange?.product ?? null;
|
|
@@ -1443,7 +1475,7 @@ function useCartOperations(credentials, initialization, sdk, deps) {
|
|
|
1443
1475
|
}
|
|
1444
1476
|
const commerceOrderId = cartStore.credentials?.id;
|
|
1445
1477
|
if (commerceOrderId && commerceEvents) {
|
|
1446
|
-
if (isAdd) {
|
|
1478
|
+
if (isAdd && !isPromotionLine) {
|
|
1447
1479
|
const currency = profileStore.currency;
|
|
1448
1480
|
const cartTotal = cartStore.order?.total_price;
|
|
1449
1481
|
commerceEvents.trackAddedToCart(commerceOrderId, {
|
|
@@ -1454,7 +1486,7 @@ function useCartOperations(credentials, initialization, sdk, deps) {
|
|
|
1454
1486
|
totalPrice: cartTotal != null ? minorToMajor(cartTotal, currency) : void 0,
|
|
1455
1487
|
recommendationsBlock: batch.recommendationsBlock
|
|
1456
1488
|
});
|
|
1457
|
-
} else {
|
|
1489
|
+
} else if (!isAdd) {
|
|
1458
1490
|
commerceEvents.trackRemovedFromCart(commerceOrderId, {
|
|
1459
1491
|
productId,
|
|
1460
1492
|
productVariantId: variantId,
|
|
@@ -1463,6 +1495,7 @@ function useCartOperations(credentials, initialization, sdk, deps) {
|
|
|
1463
1495
|
}
|
|
1464
1496
|
}
|
|
1465
1497
|
await recalculateAfterOrderChange();
|
|
1498
|
+
await syncPackages(isStale);
|
|
1466
1499
|
if (isAdd && productName) {
|
|
1467
1500
|
const parts = [productName, variantLabel].filter(Boolean);
|
|
1468
1501
|
notifier.message(messages.format("cart.added.title"), {
|
|
@@ -1950,5 +1983,5 @@ function useVisibleCartVariants() {
|
|
|
1950
1983
|
}
|
|
1951
1984
|
|
|
1952
1985
|
export { CASH_DENOMINATIONS_MAJOR, DEFAULT_ROUND_STEPS_MAJOR, ORDER_EVENTS, ORDER_WITH, buildCartLineKey, buildCashChangePresets, buildMainPaymentRequest, getCashDenominationsMinor, getDefaultRoundStepsMinor, normalizeAddress, useBonusesReconciliation, useCartAddressSync, useCartCustomerAttachment, useCartDeliveryAttachment, useCartInitialization, useCartMutation, useCartOperations, useCartQuantities, useCartRecalculation, useCartStockWatcher, useCheckoutFlow, useCheckoutSubmit, useCustomerAttach, useOnlinePaymentRetry, useOrderBonuses, useOrderChannel, useOrderDelivery, useOrderPromocode, useOrderSettings, useOrderTotal, usePaymentSelection, useRestrictedAddToCart, useRestrictionGate, useStorefrontCart, useVisibleCartVariants, variantLineKey };
|
|
1953
|
-
//# sourceMappingURL=chunk-
|
|
1954
|
-
//# sourceMappingURL=chunk-
|
|
1986
|
+
//# sourceMappingURL=chunk-IEHN2WNU.js.map
|
|
1987
|
+
//# sourceMappingURL=chunk-IEHN2WNU.js.map
|