@zenky/storefront-vue 0.10.9 → 0.10.11

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +162 -0
  2. package/README.md +1 -1
  3. package/dist/auth/index.d.ts +14 -0
  4. package/dist/auth/index.js +4 -0
  5. package/dist/auth/index.js.map +1 -0
  6. package/dist/cart/index.d.ts +3 -28
  7. package/dist/cart/index.js +9 -7
  8. package/dist/catalog/index.d.ts +5 -3
  9. package/dist/catalog/index.js +2 -2
  10. package/dist/catalogEntity-DgrPsJpf.d.ts +44 -0
  11. package/dist/{chunk-AVES4WJZ.js → chunk-5CNL24PI.js} +11 -108
  12. package/dist/chunk-5CNL24PI.js.map +1 -0
  13. package/dist/{chunk-RF4ML3Q3.js → chunk-6FVXAF7L.js} +5 -4
  14. package/dist/chunk-6FVXAF7L.js.map +1 -0
  15. package/dist/chunk-AK4276ND.js +67 -0
  16. package/dist/chunk-AK4276ND.js.map +1 -0
  17. package/dist/{chunk-KFCO46RB.js → chunk-FS2UNPTY.js} +2 -2
  18. package/dist/chunk-FS2UNPTY.js.map +1 -0
  19. package/dist/chunk-IOYYCA75.js +52 -0
  20. package/dist/chunk-IOYYCA75.js.map +1 -0
  21. package/dist/chunk-KX7KXN3W.js +529 -0
  22. package/dist/chunk-KX7KXN3W.js.map +1 -0
  23. package/dist/{chunk-6QCFHSLX.js → chunk-NSOIL7PW.js} +2 -2
  24. package/dist/chunk-NSOIL7PW.js.map +1 -0
  25. package/dist/{chunk-RK5CGOM7.js → chunk-OBNMXLJO.js} +19 -3
  26. package/dist/chunk-OBNMXLJO.js.map +1 -0
  27. package/dist/{chunk-GXDTRTUT.js → chunk-RURXGVWW.js} +35 -6
  28. package/dist/chunk-RURXGVWW.js.map +1 -0
  29. package/dist/{chunk-XULHV6SS.js → chunk-TE2QPH74.js} +3 -3
  30. package/dist/{chunk-XULHV6SS.js.map → chunk-TE2QPH74.js.map} +1 -1
  31. package/dist/chunk-TE42OCFK.js +102 -0
  32. package/dist/chunk-TE42OCFK.js.map +1 -0
  33. package/dist/{chunk-GILJFP55.js → chunk-VTZYJ6OZ.js} +2 -2
  34. package/dist/chunk-VTZYJ6OZ.js.map +1 -0
  35. package/dist/{chunk-46FNHMWC.js → chunk-W43D7JYV.js} +5 -4
  36. package/dist/chunk-W43D7JYV.js.map +1 -0
  37. package/dist/{chunk-QZ3S3NN3.js → chunk-WTZXTBF6.js} +3 -47
  38. package/dist/chunk-WTZXTBF6.js.map +1 -0
  39. package/dist/index.d.ts +6 -3
  40. package/dist/index.js +16 -13
  41. package/dist/ports/index.d.ts +1 -1
  42. package/dist/ports/index.js +1 -1
  43. package/dist/products/index.d.ts +4 -3
  44. package/dist/products/index.js +4 -3
  45. package/dist/promotions/index.js +4 -3
  46. package/dist/seo/index.d.ts +5 -7
  47. package/dist/seo/index.js +16 -9
  48. package/dist/seo/index.js.map +1 -1
  49. package/dist/stores/index.d.ts +60 -4
  50. package/dist/stores/index.js +7 -4
  51. package/dist/types-CXm2F6Hz.d.ts +55 -0
  52. package/dist/useCheckoutSubmit-Be-lQd60.d.ts +30 -0
  53. package/dist/utils/index.d.ts +6 -1
  54. package/dist/utils/index.js +1 -1
  55. package/docs/architecture.md +81 -4
  56. package/package.json +7 -3
  57. package/dist/chunk-46FNHMWC.js.map +0 -1
  58. package/dist/chunk-6QCFHSLX.js.map +0 -1
  59. package/dist/chunk-AVES4WJZ.js.map +0 -1
  60. package/dist/chunk-FXKG5TFQ.js +0 -38
  61. package/dist/chunk-FXKG5TFQ.js.map +0 -1
  62. package/dist/chunk-GILJFP55.js.map +0 -1
  63. package/dist/chunk-GXDTRTUT.js.map +0 -1
  64. package/dist/chunk-KFCO46RB.js.map +0 -1
  65. package/dist/chunk-QZ3S3NN3.js.map +0 -1
  66. package/dist/chunk-RF4ML3Q3.js.map +0 -1
  67. package/dist/chunk-RK5CGOM7.js.map +0 -1
@@ -39,50 +39,6 @@ function useRuntime() {
39
39
  }
40
40
  return runtime;
41
41
  }
42
- var useStoreProfileStore = defineStore("zenky-store-profile", () => {
43
- const store = ref(null);
44
- const city = ref(null);
45
- const stock = ref(null);
46
- const categories = ref([]);
47
- const website = ref(null);
48
- function initStore(newStore, newCity, newStock) {
49
- store.value = newStore;
50
- city.value = newCity;
51
- stock.value = newStock;
52
- }
53
- function setStock(newStock) {
54
- stock.value = newStock;
55
- }
56
- function setCategories(newCategories) {
57
- categories.value = newCategories;
58
- }
59
- function initWebsite(newWebsite) {
60
- website.value = newWebsite;
61
- }
62
- const isReady = computed(() => store.value !== null && city.value !== null);
63
- const hasStock = computed(() => stock.value !== null);
64
- const currency = computed(() => store.value?.settings?.currency ?? "RUB");
65
- const squareLogoUrl = computed(() => {
66
- const logo = store.value?.square_logo ?? store.value?.logo;
67
- if (!logo) return null;
68
- return logo.hd?.url ?? logo.xlarge?.url ?? logo.large?.url ?? logo.medium?.url ?? logo.placeholder?.url ?? null;
69
- });
70
- return {
71
- store,
72
- city,
73
- stock,
74
- categories,
75
- website,
76
- initStore,
77
- setStock,
78
- setCategories,
79
- initWebsite,
80
- isReady,
81
- hasStock,
82
- currency,
83
- squareLogoUrl
84
- };
85
- });
86
42
  var AUTH_TOKEN_KEY = "zenky_auth_token";
87
43
  var AUTH_PHONE_KEY = "zenky_auth_phone";
88
44
  var YEAR_SECONDS = 60 * 60 * 24 * 365;
@@ -134,6 +90,6 @@ var useAuthStore = defineStore("zenky-auth", () => {
134
90
  };
135
91
  });
136
92
 
137
- export { createStorefront, provideStorefront, useAuthStore, useRuntime, useStoreProfileStore };
138
- //# sourceMappingURL=chunk-QZ3S3NN3.js.map
139
- //# sourceMappingURL=chunk-QZ3S3NN3.js.map
93
+ export { createStorefront, provideStorefront, useAuthStore, useRuntime };
94
+ //# sourceMappingURL=chunk-WTZXTBF6.js.map
95
+ //# sourceMappingURL=chunk-WTZXTBF6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ports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A;AACd,IAAA,KAAA,CAAM,KAAA,GAAQ,IAAA;AACd,IAAA,OAAA,CAAQ,OAAO,cAAc,CAAA;AAC7B,IAAA,OAAA,CAAQ,OAAO,cAAc,CAAA;AAAA,EACjC;AAEA,EAAA,SAAS,cAAA,GAAuB;AAC5B,IAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,GAAA,CAAI,cAAc,CAAA,IAAK,IAAA;AAClD,IAAA,KAAA,CAAM,KAAA,GAAQ,UAAA;AAEd,IAAA,KAAA,CAAM,KAAA,GAAQ,OAAA,CAAQ,GAAA,CAAI,cAAc,CAAA,IAAK,IAAA;AAAA,EACjD;AAEA,EAAA,OAAO;AAAA,IACH,KAAA;AAAA,IACA,KAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACJ;AACJ,CAAC","file":"chunk-WTZXTBF6.js","sourcesContent":["import { inject, provide, type App, type InjectionKey, type Plugin } from 'vue'\n\nimport type { StorefrontRuntime } from './index'\n\n// Composition root. The consumer assembles the runtime (adapters) once and installs\n// the plugin; domain composables read it via useRuntime() instead of calling Nuxt directly.\n\nconst RUNTIME_KEY = Symbol.for('zenky.storefront.runtime') as InjectionKey<StorefrontRuntime>\n\ntype RequiredPort = {\n [K in keyof StorefrontRuntime]-?: undefined extends StorefrontRuntime[K] ? never : K\n}[keyof StorefrontRuntime]\n\nconst REQUIRED_PORTS = [\n 'sdk',\n 'storage',\n 'notifier',\n 'activity',\n 'messages',\n] as const satisfies readonly RequiredPort[]\n\ntype ListedPort = (typeof REQUIRED_PORTS)[number]\ntype UnlistedRequiredPort = Exclude<RequiredPort, ListedPort>\n\nconst _allRequiredPortsListed: UnlistedRequiredPort extends never ? true : never = true\nvoid _allRequiredPortsListed\n\nfunction assertRequiredPorts(runtime: StorefrontRuntime): void {\n const missing = REQUIRED_PORTS.filter((port) => runtime[port] == null)\n if (missing.length > 0) {\n throw new Error(\n `[@zenky/storefront-vue] Runtime is missing required ports: ${missing.join(', ')}. ` +\n 'See the Runtime Ports table in the README.'\n )\n }\n}\n\n/** Vue plugin: app.use(createStorefront(runtime)). */\nexport function createStorefront(runtime: StorefrontRuntime): Plugin {\n assertRequiredPorts(runtime)\n\n return {\n install(app: App) {\n app.provide(RUNTIME_KEY, runtime)\n },\n }\n}\n\n/** Alternative to the plugin — calls provide() inside setup (e.g. for an isolated widget). */\nexport function provideStorefront(runtime: StorefrontRuntime): void {\n assertRequiredPorts(runtime)\n provide(RUNTIME_KEY, runtime)\n}\n\n/** Gives any core composable or store access to the runtime. */\nexport function useRuntime(): StorefrontRuntime {\n const runtime = inject(RUNTIME_KEY)\n if (!runtime) {\n throw new Error(\n '[@zenky/storefront-vue] Runtime was not provided. ' +\n 'Install the plugin with app.use(createStorefront(runtime)).'\n )\n }\n return runtime\n}\n","import { defineStore } from 'pinia'\nimport { computed, ref, type ComputedRef, type Ref } from 'vue'\n\nimport { useRuntime } from '../ports/runtime'\n\n// Keys match the old CookieKey.AuthToken/AuthPhone — so users don't get logged out.\nconst AUTH_TOKEN_KEY = 'zenky_auth_token'\nconst AUTH_PHONE_KEY = 'zenky_auth_phone'\nconst YEAR_SECONDS = 60 * 60 * 24 * 365\n\n// Named return type (the dts rule).\nexport interface AuthStore {\n token: Ref<string | null>\n phone: Ref<string | null>\n countryCode: Ref<string>\n isAuthenticated: ComputedRef<boolean>\n apiToken: ComputedRef<string | undefined>\n initials: ComputedRef<string>\n setToken: (token: string, phone?: string, countryCode?: string) => void\n clearToken: () => void\n initFromCookie: () => void\n}\n\nexport const useAuthStore = defineStore('zenky-auth', (): AuthStore => {\n // The token is only stored and exposed here — it is never written into the SDK.\n // The consumer passes it as a parameter on every call: mutating a shared client\n // during SSR would leak one user's Bearer token into another user's requests.\n const { storage } = useRuntime()\n\n const token = ref<string | null>(null)\n const phone = ref<string | null>(null)\n const countryCode = ref('RU')\n\n const isAuthenticated = computed(() => token.value !== null && token.value !== '')\n\n // The only place that decides which token goes to the SDK. Consumers read this\n // instead of `token` directly: undefined instead of an empty string, otherwise\n // an empty Bearer '' would be sent.\n const apiToken = computed(() =>\n isAuthenticated.value ? (token.value ?? undefined) : undefined\n )\n\n const initials = computed(() => {\n if (!phone.value) return '?'\n return phone.value.replace(/\\D/g, '').slice(-4)\n })\n\n function setToken(nextToken: string, nextPhone?: string, nextCountryCode?: string): void {\n token.value = nextToken\n storage.set(AUTH_TOKEN_KEY, nextToken, { maxAge: YEAR_SECONDS })\n\n if (nextPhone) {\n phone.value = nextPhone\n storage.set(AUTH_PHONE_KEY, nextPhone, { maxAge: YEAR_SECONDS })\n }\n\n if (nextCountryCode) {\n countryCode.value = nextCountryCode\n }\n }\n\n function clearToken(): void {\n token.value = null\n phone.value = null\n storage.remove(AUTH_TOKEN_KEY)\n storage.remove(AUTH_PHONE_KEY)\n }\n\n function initFromCookie(): void {\n const savedToken = storage.get(AUTH_TOKEN_KEY) || null\n token.value = savedToken\n\n phone.value = storage.get(AUTH_PHONE_KEY) || null\n }\n\n return {\n token,\n phone,\n countryCode,\n isAuthenticated,\n apiToken,\n initials,\n setToken,\n clearToken,\n initFromCookie,\n }\n})\n"]}
package/dist/index.d.ts CHANGED
@@ -3,16 +3,19 @@ export { ActivityReporter, CatalogReloader, CommerceAddedToCartPayload, Commerce
3
3
  import { Plugin } from 'vue';
4
4
  export { Major, Minor, asMajor, asMinor, formatPrice, majorToMinor, minorToMajor, minorToMajorString } from './money/index.js';
5
5
  export { FontConfig, PrimaryShades, ThemeColorConfig, ThemeData, buildCssVariableMap, generatePrimaryShades, generateShades, useTheme } from './theme/index.js';
6
- export { DayScheduleInfo, OperationChain, SocialLink, TodayScheduleInfo, buildQrCodeUrl, createDebounce, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors, getEmailLink, getPhoneTelLink, getSocialLinks, getTodayInfo, getWebsiteLink, getWeeklySchedule, pluralize, toDateInputValue, todayInTimezone } from './utils/index.js';
6
+ export { DayScheduleInfo, OperationChain, ScheduleRow, SocialLink, TodayScheduleInfo, buildQrCodeUrl, createDebounce, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors, getEmailLink, getPhoneTelLink, getSocialLinks, getTodayInfo, getWebsiteLink, getWeeklySchedule, groupScheduleDays, pluralize, toDateInputValue, todayInTimezone } from './utils/index.js';
7
7
  export { CatalogProductMatch, CategoryWithProducts, OrderCredentials, ProductListParams, ProductVariantOptionListItem, ResolvedPrice, UseProductDetailApi, UseProductListApi, canAddDirectly, findProductInCatalog, formatWeight, getProductWeight, getVariantWeight, resolveVariantPrice, toGrams, usePriceRecalculation, useProductDetail, useProductList, useProductPricing, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts } from './products/index.js';
8
8
  export { GroupedProducts, SubcategoryGroup, collectDescendantIds, findCategoryById, findCategoryByShortId, findRootAncestor, getCategoryPath, getCity, getRemoteCatalog, getStock, groupProductsBySubcategory, useCollections } from './catalog/index.js';
9
- export { AttachedCustomerCache, BonusesReconciliation, BonusesReconciliationDeps, CASH_DENOMINATIONS_MAJOR, CachedCustomerView, CartCredentials, CartDependencies, CartErrorScope, CartInitialization, CartItemRequest, CartLineKeyParams, CartMutationComposable, CartOperations, CartQuantities, CartRecalculation, CartRecalculationDeps, CartStockWatcher, CashChangePresetsOptions, CheckoutFlowFlags, CheckoutSubmitComposable, CustomerAttachComposable, DEFAULT_ROUND_STEPS_MAJOR, MainPaymentRequestParams, MutationKind, MutationOptions, ORDER_EVENTS, ORDER_WITH, OrderBonusesComposable, OrderBonusesDeps, OrderCredentialsLike, OrderDelivery, OrderDeliveryDeps, OrderPromocodeComposable, OrderPromocodeDeps, OrderSettingsComposable, OrderTotal, PaymentSelection, PaymentSelectionComposable, RecaptchaPayloadProvider, RestrictedAddToCart, RestrictionGate, RestrictionGateProduct, RetryOptions, StorefrontCart, buildCartLineKey, buildCashChangePresets, buildMainPaymentRequest, getCartErrorCode, getCartErrorHttpCode, getCartErrorMessage, getCashDenominationsMinor, getDefaultRoundStepsMinor, getValidationErrors, logCartError, normalizeAddress, useBonusesReconciliation, useCartAddressSync, useCartCredentials, useCartCustomerAttachment, useCartDeliveryAttachment, useCartInitialization, useCartMutation, useCartOperations, useCartQuantities, useCartRecalculation, useCartStockWatcher, useCheckoutFlow, useCheckoutSubmit, useCustomerAttach, useOnlinePaymentRetry, useOrderBonuses, useOrderChannel, useOrderDelivery, useOrderPromocode, useOrderSettings, useOrderTotal, usePaymentSelection, useRestrictedAddToCart, useRestrictionGate, useStorefrontCart, useVisibleCartVariants, variantLineKey } from './cart/index.js';
9
+ export { C as CatalogEntity, S as StaticCatalogItem, a as StaticRemoteCatalog, c as catalogItemEntity, i as isRenderableCatalogItem } from './catalogEntity-DgrPsJpf.js';
10
+ export { AttachedCustomerCache, BonusesReconciliation, BonusesReconciliationDeps, CASH_DENOMINATIONS_MAJOR, CachedCustomerView, CartCredentials, CartDependencies, CartErrorScope, CartInitialization, CartItemRequest, CartLineKeyParams, CartMutationComposable, CartOperations, CartQuantities, CartRecalculation, CartRecalculationDeps, CartStockWatcher, CashChangePresetsOptions, CheckoutFlowFlags, CustomerAttachComposable, DEFAULT_ROUND_STEPS_MAJOR, MainPaymentRequestParams, MutationKind, MutationOptions, ORDER_EVENTS, ORDER_WITH, OrderBonusesComposable, OrderBonusesDeps, OrderCredentialsLike, OrderDelivery, OrderDeliveryDeps, OrderPromocodeComposable, OrderPromocodeDeps, OrderSettingsComposable, OrderTotal, PaymentSelection, PaymentSelectionComposable, RestrictedAddToCart, RestrictionGate, RestrictionGateProduct, RetryOptions, StorefrontCart, buildCartLineKey, buildCashChangePresets, buildMainPaymentRequest, getCartErrorCode, getCartErrorHttpCode, getCartErrorMessage, getCashDenominationsMinor, getDefaultRoundStepsMinor, getValidationErrors, logCartError, normalizeAddress, useBonusesReconciliation, useCartAddressSync, useCartCredentials, useCartCustomerAttachment, useCartDeliveryAttachment, useCartInitialization, useCartMutation, useCartOperations, useCartQuantities, useCartRecalculation, useCartStockWatcher, useCheckoutFlow, useCustomerAttach, useOnlinePaymentRetry, useOrderBonuses, useOrderChannel, useOrderDelivery, useOrderPromocode, useOrderSettings, useOrderTotal, usePaymentSelection, useRestrictedAddToCart, useRestrictionGate, useStorefrontCart, useVisibleCartVariants, variantLineKey } from './cart/index.js';
11
+ export { C as CheckoutSubmitComposable, R as RecaptchaPayloadProvider, u as useCheckoutSubmit } from './useCheckoutSubmit-Be-lQd60.js';
10
12
  export { RawSnippetItem, Snippet, SnippetGroup, SnippetLanguage, SnippetPosition, normalizeSnippets } from './snippets/index.js';
11
13
  export { SettingValue, Website, WebsitePage, WebsitePageListItem, WebsitePageSeo, WebsitePageType, WebsiteSettingsValues } from './website-settings/index.js';
12
- export { AppliedBonusesIntent, AuthStore, CartStore, MinPriceViolation, OrderSettingsStore, PromotionsStore, RewardSelection, RewardSelectionContext, StoreProfileStore, useAuthStore, useCartStore, useCatalogStore, useOrderSettingsStore, useProductsStore, usePromotionsStore, useStore, useStoreProfileStore, useStorefrontProfile } from './stores/index.js';
14
+ export { AppliedBonusesIntent, AuthFlowStore, AuthStore, CartStore, MinPriceViolation, OrderSettingsStore, PromotionsStore, RESEND_TIMER_SECONDS, RewardSelection, RewardSelectionContext, StoreProfileStore, useAuthFlowStore, useAuthStore, useCartStore, useCatalogStore, useOrderSettingsStore, useProductsStore, usePromotionsStore, useStore, useStoreProfileStore, useStorefrontProfile } from './stores/index.js';
13
15
  import '@zenky/integrations-sdk';
14
16
  import '@zenky/storefront-api';
15
17
  import 'pinia';
18
+ import './types-CXm2F6Hz.js';
16
19
 
17
20
  /** Vue plugin: app.use(createStorefront(runtime)). */
18
21
  declare function createStorefront(runtime: StorefrontRuntime): Plugin;
package/dist/index.js CHANGED
@@ -1,19 +1,22 @@
1
+ export { canAddDirectly, findProductInCatalog, formatWeight, getProductWeight, getVariantWeight, resolveVariantPrice, toGrams, usePriceRecalculation, useProductDetail, useProductList, useProductPricing, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts } from './chunk-6FVXAF7L.js';
1
2
  export { normalizeSnippets } from './chunk-GLQXTMVW.js';
2
- export { useProductsStore, useStore, useStorefrontProfile } from './chunk-FXKG5TFQ.js';
3
+ export { RESEND_TIMER_SECONDS, useAuthFlowStore, useProductsStore, useStore, useStorefrontProfile } from './chunk-KX7KXN3W.js';
3
4
  export { buildCssVariableMap, generatePrimaryShades, generateShades, useTheme } from './chunk-BUNI6MGH.js';
4
- export { buildQrCodeUrl, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors, getEmailLink, getPhoneTelLink, getSocialLinks, getTodayInfo, getWebsiteLink, getWeeklySchedule, pluralize, toDateInputValue, todayInTimezone } from './chunk-GXDTRTUT.js';
5
- import './chunk-EMGQXBU3.js';
6
- export { CASH_DENOMINATIONS_MAJOR, DEFAULT_ROUND_STEPS_MAJOR, ORDER_EVENTS, ORDER_WITH, buildCartLineKey, buildCashChangePresets, buildMainPaymentRequest, getCartErrorCode, getCartErrorHttpCode, getCartErrorMessage, getCashDenominationsMinor, getDefaultRoundStepsMinor, getValidationErrors, logCartError, 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 } from './chunk-AVES4WJZ.js';
7
- export { useCartCredentials } from './chunk-46FNHMWC.js';
8
- export { useCartStore, useOrderSettingsStore, usePromotionsStore } from './chunk-XULHV6SS.js';
9
- export { collectDescendantIds, findCategoryById, findCategoryByShortId, findRootAncestor, getCategoryPath, groupProductsBySubcategory, useCollections } from './chunk-RK5CGOM7.js';
10
- export { getCity, getRemoteCatalog, getStock } from './chunk-KFCO46RB.js';
11
- export { asMajor, asMinor, formatPrice, majorToMinor, minorToMajor, minorToMajorString } from './chunk-2Y6QTHXI.js';
12
- export { KEY_MESSAGE_FORMATTER, NOOP_ACTIVITY_REPORTER, NOOP_NOTIFIER, NOOP_RUM, createMemoryStorage, err, ok } from './chunk-GILJFP55.js';
13
- export { canAddDirectly, findProductInCatalog, formatWeight, getProductWeight, getVariantWeight, resolveVariantPrice, toGrams, usePriceRecalculation, useProductDetail, useProductList, useProductPricing, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts } from './chunk-RF4ML3Q3.js';
5
+ export { buildQrCodeUrl, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors, getEmailLink, getPhoneTelLink, getSocialLinks, getTodayInfo, getWebsiteLink, getWeeklySchedule, groupScheduleDays, pluralize, toDateInputValue, todayInTimezone } from './chunk-RURXGVWW.js';
14
6
  export { createDebounce } from './chunk-XUGXLJZB.js';
7
+ import './chunk-EMGQXBU3.js';
8
+ import './chunk-AK4276ND.js';
9
+ 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 } from './chunk-5CNL24PI.js';
10
+ export { useCartCredentials } from './chunk-W43D7JYV.js';
15
11
  import './chunk-5QCUH3FF.js';
16
- export { useCatalogStore } from './chunk-6QCFHSLX.js';
17
- export { createStorefront, provideStorefront, useAuthStore, useRuntime, useStoreProfileStore } from './chunk-QZ3S3NN3.js';
12
+ export { getCartErrorCode, getCartErrorHttpCode, getCartErrorMessage, getValidationErrors, logCartError } from './chunk-TE42OCFK.js';
13
+ export { useCartStore, useOrderSettingsStore, usePromotionsStore } from './chunk-TE2QPH74.js';
14
+ export { useCatalogStore } from './chunk-NSOIL7PW.js';
15
+ export { createStorefront, provideStorefront, useAuthStore, useRuntime } from './chunk-WTZXTBF6.js';
16
+ export { useStoreProfileStore } from './chunk-IOYYCA75.js';
17
+ export { catalogItemEntity, collectDescendantIds, findCategoryById, findCategoryByShortId, findRootAncestor, getCategoryPath, groupProductsBySubcategory, isRenderableCatalogItem, useCollections } from './chunk-OBNMXLJO.js';
18
+ export { getCity, getRemoteCatalog, getStock } from './chunk-FS2UNPTY.js';
19
+ export { asMajor, asMinor, formatPrice, majorToMinor, minorToMajor, minorToMajorString } from './chunk-2Y6QTHXI.js';
20
+ export { KEY_MESSAGE_FORMATTER, NOOP_ACTIVITY_REPORTER, NOOP_NOTIFIER, NOOP_RUM, createMemoryStorage, err, ok } from './chunk-VTZYJ6OZ.js';
18
21
  //# sourceMappingURL=index.js.map
19
22
  //# sourceMappingURL=index.js.map
@@ -32,7 +32,7 @@ interface Notifier {
32
32
  }): void;
33
33
  }
34
34
  /** Stable message identifiers emitted by domain logic. Text and locale belong to the consumer. */
35
- type StorefrontMessageKey = 'cart.added.title' | 'cart.bonuses.changed.description' | 'cart.bonuses.changed.title' | 'cart.customer.saveFailed' | 'cart.customer.updateAfterLoginFailed' | 'cart.customer.updated' | 'cart.customer.updatedWithName' | 'cart.payment.updateFailed' | 'cart.promocode.applyFailed' | 'cart.promocode.removeFailed' | 'cart.stock.catalogReloadFailed' | 'cart.stock.checkFailed' | 'cart.stock.itemsRemoved' | 'cart.stock.pricesUpdated' | 'cart.updateFailed';
35
+ type StorefrontMessageKey = 'auth.checkPhoneFailed' | 'auth.dispatchResetFailed' | 'auth.invalidCode' | 'auth.invalidPassword' | 'auth.otpUnavailable' | 'auth.registerFailed' | 'auth.resendCodeFailed' | 'auth.resetPasswordFailed' | 'cart.added.title' | 'cart.bonuses.changed.description' | 'cart.bonuses.changed.title' | 'cart.customer.saveFailed' | 'cart.customer.updateAfterLoginFailed' | 'cart.customer.updated' | 'cart.customer.updatedWithName' | 'cart.payment.updateFailed' | 'cart.promocode.applyFailed' | 'cart.promocode.removeFailed' | 'cart.stock.catalogReloadFailed' | 'cart.stock.checkFailed' | 'cart.stock.itemsRemoved' | 'cart.stock.pricesUpdated' | 'cart.updateFailed';
36
36
  type StorefrontMessageParams = Readonly<Record<string, string | number | boolean | null | undefined>>;
37
37
  /** Converts domain message identifiers into consumer-owned, localized UI copy. */
38
38
  interface MessageFormatter {
@@ -1,3 +1,3 @@
1
- export { KEY_MESSAGE_FORMATTER, NOOP_ACTIVITY_REPORTER, NOOP_NOTIFIER, NOOP_RUM, createMemoryStorage, err, ok } from '../chunk-GILJFP55.js';
1
+ export { KEY_MESSAGE_FORMATTER, NOOP_ACTIVITY_REPORTER, NOOP_NOTIFIER, NOOP_RUM, createMemoryStorage, err, ok } from '../chunk-VTZYJ6OZ.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,6 @@
1
- import { UnitType, Product, ProductVariant, NestedCategory, ProductModifiersRequest, Discount, ProductVariantOptionValue, CatalogItem, PaginatedResponse } from '@zenky/storefront-api';
1
+ import { UnitType, Product, ProductVariant, NestedCategory, ProductModifiersRequest, Discount, ProductVariantOptionValue, PaginatedResponse } from '@zenky/storefront-api';
2
2
  import { ComputedRef, Ref } from 'vue';
3
+ import { S as StaticCatalogItem } from '../catalogEntity-DgrPsJpf.js';
3
4
 
4
5
  declare function getVariantWeight(variant: ProductVariant | null | undefined): number | null;
5
6
  declare function getProductWeight(product: Product): number | null;
@@ -97,9 +98,9 @@ declare function useRelatedProducts(): UseRelatedProductsApi;
97
98
 
98
99
  interface CatalogProductMatch {
99
100
  product: Product;
100
- catalogItem: CatalogItem;
101
+ catalogItem: StaticCatalogItem;
101
102
  }
102
- declare function findProductInCatalog(catalog: CatalogItem[], shortId: string): CatalogProductMatch | null;
103
+ declare function findProductInCatalog(catalog: StaticCatalogItem[], shortId: string): CatalogProductMatch | null;
103
104
 
104
105
  interface UseProductDetailApi {
105
106
  /** Synchronous search against the already-loaded static catalog. */
@@ -1,7 +1,8 @@
1
- export { canAddDirectly, findProductInCatalog, formatWeight, getProductWeight, getVariantWeight, resolveVariantPrice, toGrams, usePriceRecalculation, useProductDetail, useProductList, useProductPricing, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts } from '../chunk-RF4ML3Q3.js';
1
+ export { canAddDirectly, findProductInCatalog, formatWeight, getProductWeight, getVariantWeight, resolveVariantPrice, toGrams, usePriceRecalculation, useProductDetail, useProductList, useProductPricing, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts } from '../chunk-6FVXAF7L.js';
2
2
  import '../chunk-XUGXLJZB.js';
3
3
  import '../chunk-5QCUH3FF.js';
4
- import '../chunk-6QCFHSLX.js';
5
- import '../chunk-QZ3S3NN3.js';
4
+ import '../chunk-NSOIL7PW.js';
5
+ import '../chunk-WTZXTBF6.js';
6
+ import '../chunk-IOYYCA75.js';
6
7
  //# sourceMappingURL=index.js.map
7
8
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,6 @@
1
- export { usePromotionsChecker } from '../chunk-46FNHMWC.js';
2
- import '../chunk-XULHV6SS.js';
3
- import '../chunk-QZ3S3NN3.js';
1
+ export { usePromotionsChecker } from '../chunk-W43D7JYV.js';
2
+ import '../chunk-TE2QPH74.js';
3
+ import '../chunk-WTZXTBF6.js';
4
+ import '../chunk-IOYYCA75.js';
4
5
  //# sourceMappingURL=index.js.map
5
6
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { Media, Store, Product, NestedCategory, Article, OfferArticle, Seo, SeoMetaTag } from '@zenky/storefront-api';
1
+ import { Media, Store, Product, NestedCategory, ProductsCollection, Article, OfferArticle, Seo, SeoMetaTag } from '@zenky/storefront-api';
2
2
 
3
3
  /**
4
4
  * Shared SEO types used across storefront composables.
@@ -42,12 +42,10 @@ declare function resolveSiteOrigin(storeDomain: string | null | undefined, fallb
42
42
  */
43
43
  declare function buildProductSchema(product: Product, currency: string): Record<string, unknown>[];
44
44
 
45
- /**
46
- * JSON-LD for a category page: BreadcrumbList + ItemList (first 10 products).
47
- * Returns an array of 0-2 JSON-LD objects.
48
- * Spec: https://schema.org/ItemList · https://schema.org/BreadcrumbList
49
- */
45
+ /** JSON-LD for a category page. */
50
46
  declare function buildCategorySchemas(category: NestedCategory, products: Product[], breadcrumbs: BreadcrumbItem[], origin: string): Record<string, unknown>[];
47
+ /** JSON-LD for a products collection page. */
48
+ declare function buildCollectionSchemas(collection: ProductsCollection, products: Product[], breadcrumbs: BreadcrumbItem[], origin: string): Record<string, unknown>[];
51
49
 
52
50
  /**
53
51
  * JSON-LD schema.org/Article for the offer page's editorial copy.
@@ -84,4 +82,4 @@ declare function mapSeoMetaTags(tags: SeoMetaTag[]): Record<string, string>[];
84
82
  /** Meta tags from a `Seo` entity (description + `Seo.meta` mapping). The consumer resolves the title. */
85
83
  declare function buildEntitySeoMeta(seo: Seo | null | undefined): Record<string, string>[];
86
84
 
87
- export { type BreadcrumbItem, type OgTagsInput, buildBlogPostSchema, buildCategorySchemas, buildEntitySeoMeta, buildOfferArticleSchema, buildOgTags, buildOrganizationSchema, buildProductSchema, mapSeoMetaTags, prepareOgDescription, resolveMediaUrl, resolveSiteOrigin, resolveStoreLogoUrl, stripHtml };
85
+ export { type BreadcrumbItem, type OgTagsInput, buildBlogPostSchema, buildCategorySchemas, buildCollectionSchemas, buildEntitySeoMeta, buildOfferArticleSchema, buildOgTags, buildOrganizationSchema, buildProductSchema, mapSeoMetaTags, prepareOgDescription, resolveMediaUrl, resolveSiteOrigin, resolveStoreLogoUrl, stripHtml };
package/dist/seo/index.js CHANGED
@@ -1,10 +1,11 @@
1
- import { getSocialLinks } from '../chunk-GXDTRTUT.js';
2
- import { minorToMajorString } from '../chunk-2Y6QTHXI.js';
3
- import { resolveVariantPrice } from '../chunk-RF4ML3Q3.js';
1
+ import { resolveVariantPrice } from '../chunk-6FVXAF7L.js';
2
+ import { getSocialLinks } from '../chunk-RURXGVWW.js';
4
3
  import '../chunk-XUGXLJZB.js';
5
4
  import '../chunk-5QCUH3FF.js';
6
- import '../chunk-6QCFHSLX.js';
7
- import '../chunk-QZ3S3NN3.js';
5
+ import '../chunk-NSOIL7PW.js';
6
+ import '../chunk-WTZXTBF6.js';
7
+ import '../chunk-IOYYCA75.js';
8
+ import { minorToMajorString } from '../chunk-2Y6QTHXI.js';
8
9
  import { ContactType } from '@zenky/storefront-api';
9
10
 
10
11
  // src/seo/utils.ts
@@ -77,8 +78,8 @@ function buildProductSchema(product, currency) {
77
78
  return [schema];
78
79
  }
79
80
 
80
- // src/seo/categorySchema.ts
81
- function buildCategorySchemas(category, products, breadcrumbs, origin) {
81
+ // src/seo/listingSchema.ts
82
+ function buildListingSchemas(name, products, breadcrumbs, origin) {
82
83
  const schemas = [];
83
84
  if (breadcrumbs.length) {
84
85
  schemas.push({
@@ -97,7 +98,7 @@ function buildCategorySchemas(category, products, breadcrumbs, origin) {
97
98
  schemas.push({
98
99
  "@context": "https://schema.org",
99
100
  "@type": "ItemList",
100
- name: category.name,
101
+ name,
101
102
  numberOfItems: items.length,
102
103
  itemListElement: items.map((product, index) => {
103
104
  const url = `${origin}/products/${product.short_id}/${product.slug || product.short_id}`;
@@ -116,6 +117,12 @@ function buildCategorySchemas(category, products, breadcrumbs, origin) {
116
117
  }
117
118
  return schemas;
118
119
  }
120
+ function buildCategorySchemas(category, products, breadcrumbs, origin) {
121
+ return buildListingSchemas(category.name, products, breadcrumbs, origin);
122
+ }
123
+ function buildCollectionSchemas(collection, products, breadcrumbs, origin) {
124
+ return buildListingSchemas(collection.name, products, breadcrumbs, origin);
125
+ }
119
126
 
120
127
  // src/seo/articleSchema.ts
121
128
  function articleSchema(type, opts) {
@@ -275,6 +282,6 @@ function buildEntitySeoMeta(seo) {
275
282
  return tags;
276
283
  }
277
284
 
278
- export { buildBlogPostSchema, buildCategorySchemas, buildEntitySeoMeta, buildOfferArticleSchema, buildOgTags, buildOrganizationSchema, buildProductSchema, mapSeoMetaTags, prepareOgDescription, resolveMediaUrl, resolveSiteOrigin, resolveStoreLogoUrl, stripHtml };
285
+ export { buildBlogPostSchema, buildCategorySchemas, buildCollectionSchemas, buildEntitySeoMeta, buildOfferArticleSchema, buildOgTags, buildOrganizationSchema, buildProductSchema, mapSeoMetaTags, prepareOgDescription, resolveMediaUrl, resolveSiteOrigin, resolveStoreLogoUrl, stripHtml };
279
286
  //# sourceMappingURL=index.js.map
280
287
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/seo/utils.ts","../../src/seo/siteOrigin.ts","../../src/seo/productSchema.ts","../../src/seo/categorySchema.ts","../../src/seo/articleSchema.ts","../../src/seo/organizationSchema.ts","../../src/seo/ogTags.ts","../../src/seo/entitySeo.ts"],"names":[],"mappings":";;;;;;;;;;AAKO,SAAS,gBAAgB,KAAA,EAA6B;AACzD,EAAA,OACI,KAAA,CAAM,EAAA,EAAI,GAAA,IACV,KAAA,CAAM,QAAQ,GAAA,IACd,KAAA,CAAM,KAAA,EAAO,GAAA,IACb,KAAA,CAAM,MAAA,EAAQ,GAAA,IACd,KAAA,CA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A,CAAK,IAAA,CAAK,EAAE,QAAA,EAAU,SAAA,EAAW,SAAS,KAAA,CAAM,IAAA,IAAQ,WAAW,CAAA;AAEnE,EAAA,IAAI,MAAM,GAAA,EAAK;AACX,IAAA,IAAA,CAAK,KAAK,EAAE,QAAA,EAAU,UAAU,OAAA,EAAS,KAAA,CAAM,KAAK,CAAA;AAAA,EACxD;AAEA,EAAA,OAAO,IAAA;AACX;;;AChCO,SAAS,eAAe,IAAA,EAA8C;AACzE,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,CAAC,GAAA,KAAQ;AACrB,IAAA,MAAM,KAAA,GAAgC;AAAA,MAClC,CAAC,GAAA,CAAI,IAAA,CAAK,SAAS,GAAG,IAAI,IAAA,CAAK,KAAA;AAAA,MAC/B,CAAC,GAAA,CAAI,KAAA,CAAM,SAAS,GAAG,IAAI,KAAA,CAAM;AAAA,KACrC;AAEA,IAAA,KAAA,MAAW,UAAA,IAAc,IAAI,UAAA,EAAY;AACrC,MAAA,KAAA,CAAM,UAAA,CAAW,SAAS,CAAA,GAAI,UAAA,CAAW,KAAA;AAAA,IAC7C;AAEA,IAAA,OAAO,KAAA;AAAA,EACX,CAAC,CAAA;AACL;AAGO,SAAS,mBAAmB,GAAA,EAAuD;AACtF,EAAA,MAAM,OAAiC,EAAC;AAExC,EAAA,IAAI,KAAK,WAAA,EAAa;AAClB,IAAA,IAAA,CAAK,KAAK,EAAE,IAAA,EAAM,eAAe,OAAA,EAAS,GAAA,CAAI,aAAa,CAAA;AAAA,EAC/D;AAEA,EAAA,IAAI,GAAA,EAAK,MAAM,MAAA,EAAQ;AACnB,IAAA,IAAA,CAAK,IAAA,CAAK,GAAG,cAAA,CAAe,GAAA,CAAI,IAAI,CAAC,CAAA;AAAA,EACzC;AAEA,EAAA,OAAO,IAAA;AACX","file":"index.js","sourcesContent":["import type { Media, Store } from '@zenky/storefront-api'\n\n/**\n * Resolves the best available URL from a Media object.\n */\nexport function resolveMediaUrl(media: Media): string | null {\n return (\n media.hd?.url ||\n media.xlarge?.url ||\n media.large?.url ||\n media.medium?.url ||\n media.placeholder?.url ||\n null\n )\n}\n\n/**\n * Resolves store logo URL, preferring square logo over rectangular.\n * Tries all available size variants so CDN assets with only hd/xlarge are found too.\n */\nexport function resolveStoreLogoUrl(store: Store | null | undefined): string | null {\n if (!store) return null\n if (store.square_logo) {\n const url = resolveMediaUrl(store.square_logo)\n if (url) return url\n }\n if (store.logo) {\n return resolveMediaUrl(store.logo)\n }\n return null\n}\n\n/**\n * Strips HTML tags from a string.\n */\nexport function stripHtml(html: string): string {\n return html.replace(/<[^>]*>/g, '').trim()\n}\n\n/**\n * Prepares a string for use as og:description or meta description:\n * strips HTML tags and truncates to maxLength (default 160).\n */\nexport function prepareOgDescription(\n text: string | null | undefined,\n maxLength = 160\n): string | null {\n if (!text) return null\n const plain = stripHtml(text)\n if (!plain) return null\n return plain.length > maxLength ? `${plain.slice(0, maxLength - 3)}...` : plain\n}\n","/**\n * Canonical public origin of the site, from `store.domain`. The fallback (request host)\n * is supplied by the consumer — the core doesn't know about `useRequestURL`.\n */\nexport function resolveSiteOrigin(\n storeDomain: string | null | undefined,\n fallbackOrigin: string\n): string {\n const domain = storeDomain?.trim()\n if (domain) {\n const host = domain.replace(/^https?:\\/\\//, '').replace(/\\/+$/, '')\n return `https://${host}`\n }\n return fallbackOrigin\n}\n","import type { Product, ProductVariant } from '@zenky/storefront-api'\n\nimport { minorToMajorString } from '../money'\nimport { resolveVariantPrice } from '../products'\nimport { resolveMediaUrl } from './utils'\n\nfunction isProductInStock(variants: ProductVariant[]): boolean {\n if (!variants.length) return false\n return variants.some((variant) => {\n const remainders = variant.remainders\n if (!remainders?.length) return true\n return remainders.some((remainder) => remainder.quantity > 0)\n })\n}\n\n/**\n * JSON-LD schema.org/Product. Google uses it for Rich Results (price, availability,\n * rating in search listings).\n * Returns an array of 0 or 1 objects — the consumer wraps it in a `<script ld+json>` tag.\n * Spec: https://schema.org/Product\n */\nexport function buildProductSchema(product: Product, currency: string): Record<string, unknown>[] {\n const variants = product.variants ?? []\n\n const firstVariant = variants[0]\n let offerBlock: Record<string, unknown> | undefined\n\n if (firstVariant) {\n const resolved = resolveVariantPrice(firstVariant)\n\n offerBlock = {\n '@type': 'Offer',\n price: minorToMajorString(resolved.price, currency),\n priceCurrency: currency,\n availability: isProductInStock(variants)\n ? 'https://schema.org/InStock'\n : 'https://schema.org/OutOfStock',\n ...(firstVariant.sku ? { sku: firstVariant.sku } : {}),\n }\n }\n\n const images = (product.images ?? []).map(resolveMediaUrl).filter((url): url is string => !!url)\n\n const schema: Record<string, unknown> = {\n '@context': 'https://schema.org',\n '@type': 'Product',\n name: product.name,\n }\n\n if (product.description) schema.description = product.description\n if (images.length) schema.image = images\n if (offerBlock) schema.offers = offerBlock\n\n return [schema]\n}\n","import type { NestedCategory, Product } from '@zenky/storefront-api'\n\nimport { resolveMediaUrl } from './utils'\nimport type { BreadcrumbItem } from './types'\n\n/**\n * JSON-LD for a category page: BreadcrumbList + ItemList (first 10 products).\n * Returns an array of 0-2 JSON-LD objects.\n * Spec: https://schema.org/ItemList · https://schema.org/BreadcrumbList\n */\nexport function buildCategorySchemas(\n category: NestedCategory,\n products: Product[],\n breadcrumbs: BreadcrumbItem[],\n origin: string\n): Record<string, unknown>[] {\n const schemas: Record<string, unknown>[] = []\n\n if (breadcrumbs.length) {\n schemas.push({\n '@context': 'https://schema.org',\n '@type': 'BreadcrumbList',\n itemListElement: breadcrumbs.map((crumb, index) => ({\n '@type': 'ListItem',\n position: index + 1,\n name: crumb.label,\n ...(crumb.to ? { item: `${origin}${crumb.to}` } : {}),\n })),\n })\n }\n\n const items = products.slice(0, 10)\n if (items.length) {\n schemas.push({\n '@context': 'https://schema.org',\n '@type': 'ItemList',\n name: category.name,\n numberOfItems: items.length,\n itemListElement: items.map((product, index) => {\n const url = `${origin}/products/${product.short_id}/${product.slug || product.short_id}`\n const firstImage = product.images?.[0]\n const image = firstImage ? resolveMediaUrl(firstImage) : null\n\n const item: Record<string, unknown> = {\n '@type': 'ListItem',\n position: index + 1,\n url,\n name: product.name,\n }\n\n if (image) item.image = image\n\n return item\n }),\n })\n }\n\n return schemas\n}\n","import type { Article, Media, OfferArticle } from '@zenky/storefront-api'\n\nimport { prepareOgDescription, resolveMediaUrl } from './utils'\n\nfunction articleSchema(\n type: 'Article' | 'BlogPosting',\n opts: {\n title: string | null | undefined\n intro: string | null | undefined\n cover: Media | null | undefined\n storeName: string\n origin: string\n }\n): Record<string, unknown> {\n const schema: Record<string, unknown> = {\n '@context': 'https://schema.org',\n '@type': type,\n headline: opts.title ?? '',\n author: {\n '@type': 'Organization',\n name: opts.storeName,\n url: opts.origin,\n },\n }\n\n const description = prepareOgDescription(opts.intro)\n if (description) schema.description = description\n\n const image = opts.cover ? resolveMediaUrl(opts.cover) : null\n if (image) schema.image = image\n\n return schema\n}\n\n/**\n * JSON-LD schema.org/Article for the offer page's editorial copy.\n * Spec: https://schema.org/Article\n */\nexport function buildOfferArticleSchema(\n article: OfferArticle,\n storeName: string,\n origin: string\n): Record<string, unknown>[] {\n if (!article.title) return []\n\n return [\n articleSchema('Article', {\n title: article.title,\n intro: article.intro,\n cover: article.cover,\n storeName,\n origin,\n }),\n ]\n}\n\n/**\n * JSON-LD schema.org/BlogPosting for a blog article — enables Google Rich Results.\n * Spec: https://schema.org/BlogPosting\n */\nexport function buildBlogPostSchema(\n article: Article,\n storeName: string,\n origin: string\n): Record<string, unknown>[] {\n const schema = articleSchema('BlogPosting', {\n title: article.title,\n intro: article.intro,\n cover: article.cover,\n storeName,\n origin,\n })\n\n if (article.updated_at) {\n schema.dateModified = article.updated_at\n // No separate datePublished field is available — reuse updated_at.\n schema.datePublished = article.updated_at\n }\n\n return [schema]\n}\n","import { ContactType } from '@zenky/storefront-api'\n\nimport type { Schedule, Store } from '@zenky/storefront-api'\n\nimport { getSocialLinks } from '../utils'\n\n/** Schedule.days key → schema.org DayOfWeek. */\nconst SCHEMA_DAY: Record<string, string> = {\n monday: 'Monday',\n tuesday: 'Tuesday',\n wednesday: 'Wednesday',\n thursday: 'Thursday',\n friday: 'Friday',\n saturday: 'Saturday',\n sunday: 'Sunday',\n}\n\n/**\n * Schedule (per-day `hours` string like \"10:00-22:00\") → array of schema.org/OpeningHoursSpecification.\n * Days without a recognizable interval (day off / 24 hours / empty) are skipped.\n */\nfunction buildOpeningHours(schedule: Schedule | null | undefined): Record<string, unknown>[] {\n if (!schedule) return []\n\n const result: Record<string, unknown>[] = []\n for (const key of Object.keys(SCHEMA_DAY)) {\n const day = schedule.days[key as keyof typeof schedule.days]\n const match = day?.hours?.match(/(\\d{1,2}:\\d{2}).*?(\\d{1,2}:\\d{2})/)\n if (!match) continue\n\n result.push({\n '@type': 'OpeningHoursSpecification',\n dayOfWeek: SCHEMA_DAY[key],\n opens: match[1],\n closes: match[2],\n })\n }\n\n return result\n}\n\n/**\n * JSON-LD schema.org/Organization (or LocalBusiness if there's a physical location)\n * for the homepage. Feeds Google's Knowledge Panel. All data comes from the\n * already-loaded profile.\n * Spec: https://schema.org/Organization · https://schema.org/LocalBusiness\n */\nexport function buildOrganizationSchema(store: Store, origin: string): Record<string, unknown>[] {\n const logoUrl =\n store.square_logo?.medium?.url ||\n store.square_logo?.large?.url ||\n store.logo?.medium?.url ||\n store.logo?.large?.url ||\n null\n\n const phones = (store.phones ?? []).map((p) => p.number).filter((n): n is string => !!n)\n const email = store.links?.find((c) => c.type === ContactType.Email)?.value ?? null\n const socialLinks = getSocialLinks(store.links ?? []).map((l) => l.url)\n\n const city = (store.cities ?? []).find((c) => c.is_default) ?? store.cities?.[0] ?? null\n const stock = city?.stocks?.find((st) => st.address) ?? city?.stocks?.[0] ?? null\n\n const streetAddress = stock?.address ?? null\n const geo = stock?.coordinates ?? city?.coordinates ?? null\n const openingHours = buildOpeningHours(stock?.schedule ?? city?.schedule)\n\n const isLocalBusiness = Boolean(streetAddress || geo || openingHours.length)\n\n const schema: Record<string, unknown> = {\n '@context': 'https://schema.org',\n '@type': isLocalBusiness ? 'LocalBusiness' : 'Organization',\n name: store.name,\n url: origin,\n }\n\n if (logoUrl) {\n schema.logo = logoUrl\n schema.image = logoUrl\n }\n\n if (phones.length) schema.telephone = phones.length === 1 ? phones[0] : phones\n if (email) schema.email = email\n if (socialLinks.length) schema.sameAs = socialLinks\n\n if (streetAddress || city?.name) {\n schema.address = {\n '@type': 'PostalAddress',\n ...(streetAddress ? { streetAddress } : {}),\n ...(city?.name ? { addressLocality: city.name } : {}),\n addressCountry: 'RU',\n }\n }\n\n if (geo) {\n schema.geo = {\n '@type': 'GeoCoordinates',\n latitude: geo.latitude,\n longitude: geo.longitude,\n }\n }\n\n if (openingHours.length) schema.openingHoursSpecification = openingHours\n\n return [schema]\n}\n","/** Already-resolved OG/Twitter tag values (with the consumer's defaults applied). */\nexport interface OgTagsInput {\n title: string | null\n description?: string | null\n image?: string | null\n type?: string\n url?: string | null\n}\n\n/** Framework-neutral OG + Twitter meta records. The consumer controls head priority. */\nexport function buildOgTags(input: OgTagsInput): Record<string, string>[] {\n const tags: Record<string, string>[] = []\n\n if (input.title) {\n tags.push({ property: 'og:title', content: input.title })\n tags.push({ name: 'twitter:title', content: input.title })\n }\n\n if (input.description) {\n tags.push({ property: 'og:description', content: input.description })\n tags.push({ name: 'twitter:description', content: input.description })\n }\n\n if (input.image) {\n tags.push({ property: 'og:image', content: input.image })\n tags.push({ name: 'twitter:image', content: input.image })\n }\n\n tags.push({ property: 'og:type', content: input.type ?? 'website' })\n\n if (input.url) {\n tags.push({ property: 'og:url', content: input.url })\n }\n\n return tags\n}\n","import type { Seo, SeoMetaTag } from '@zenky/storefront-api'\n\n/** SDK `Seo.meta` tags mapped to framework-neutral head meta records. */\nexport function mapSeoMetaTags(tags: SeoMetaTag[]): Record<string, string>[] {\n return tags.map((tag) => {\n const attrs: Record<string, string> = {\n [tag.name.attribute]: tag.name.value,\n [tag.value.attribute]: tag.value.value,\n }\n\n for (const additional of tag.additional) {\n attrs[additional.attribute] = additional.value\n }\n\n return attrs\n })\n}\n\n/** Meta tags from a `Seo` entity (description + `Seo.meta` mapping). The consumer resolves the title. */\nexport function buildEntitySeoMeta(seo: Seo | null | undefined): Record<string, string>[] {\n const tags: Record<string, string>[] = []\n\n if (seo?.description) {\n tags.push({ name: 'description', content: seo.description })\n }\n\n if (seo?.meta?.length) {\n tags.push(...mapSeoMetaTags(seo.meta))\n }\n\n return tags\n}\n"]}
1
+ {"version":3,"sources":["../../src/seo/utils.ts","../../src/seo/siteOrigin.ts","../../src/seo/productSchema.ts","../../src/seo/listingSchema.ts","../../src/seo/articleSchema.ts","../../src/seo/organizationSchema.ts","../../src/seo/ogTags.ts","../../src/seo/entitySeo.ts"],"names":[],"mappings":";;;;;;;;;;;AAKO,SAAS,gBAAgB,KAAA,EAA6B;AACzD,EAAA,OACI,KAAA,CAAM,EAAA,EAAI,GAAA,IACV,KAAA,CAAM,QAAQ,GAAA,IACd,KAAA,CAAM,KAAA,EAAO,GAAA,IACb,KAAA,CAAM,MAAA,EAAQ,GAAA,IACd,KAAA,CAAM,aAAa,GAAA,IACnB,IAAA;AAER;AAMO,SAAS,oBAAoB,KAAA,EAAgD;AAChF,EAAA,IAAI,CAAC,OAAO,OAAO,IAAA;AACnB,EAAA,IAAI,MAAM,WAAA,EAAa;AACnB,IAAA,MAAM,GAAA,GAAM,eAAA,CAAgB,KAAA,CAAM,WAAW,CAAA;AAC7C,IAAA,IAAI,KAAK,OAAO,GAAA;AAAA,EACpB;AACA,EAAA,IAAI,MAAM,IAAA,EAAM;AACZ,IAAA,OAAO,eAAA,CAAgB,MAAM,IAAI,CAAA;AAAA,EACrC;AACA,EAAA,OAAO,IAAA;AACX;AAKO,SAAS,UAAU,IAAA,EAAsB;AAC5C,EAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,UAAA,EAAY,EAAE,EAAE,IAAA,EAAK;AAC7C;AAMO,SAAS,oBAAA,CACZ,IAAA,EACA,SAAA,GAAY,GAAA,EACC;AACb,EAAA,IAAI,C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S,eAAe,IAAA,EAA8C;AACzE,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,CAAC,GAAA,KAAQ;AACrB,IAAA,MAAM,KAAA,GAAgC;AAAA,MAClC,CAAC,GAAA,CAAI,IAAA,CAAK,SAAS,GAAG,IAAI,IAAA,CAAK,KAAA;AAAA,MAC/B,CAAC,GAAA,CAAI,KAAA,CAAM,SAAS,GAAG,IAAI,KAAA,CAAM;AAAA,KACrC;AAEA,IAAA,KAAA,MAAW,UAAA,IAAc,IAAI,UAAA,EAAY;AACrC,MAAA,KAAA,CAAM,UAAA,CAAW,SAAS,CAAA,GAAI,UAAA,CAAW,KAAA;AAAA,IAC7C;AAEA,IAAA,OAAO,KAAA;AAAA,EACX,CAAC,CAAA;AACL;AAGO,SAAS,mBAAmB,GAAA,EAAuD;AACtF,EAAA,MAAM,OAAiC,EAAC;AAExC,EAAA,IAAI,KAAK,WAAA,EAAa;AAClB,IAAA,IAAA,CAAK,KAAK,EAAE,IAAA,EAAM,eAAe,OAAA,EAAS,GAAA,CAAI,aAAa,CAAA;AAAA,EAC/D;AAEA,EAAA,IAAI,GAAA,EAAK,MAAM,MAAA,EAAQ;AACnB,IAAA,IAAA,CAAK,IAAA,CAAK,GAAG,cAAA,CAAe,GAAA,CAAI,IAAI,CAAC,CAAA;AAAA,EACzC;AAEA,EAAA,OAAO,IAAA;AACX","file":"index.js","sourcesContent":["import type { Media, Store } from '@zenky/storefront-api'\n\n/**\n * Resolves the best available URL from a Media object.\n */\nexport function resolveMediaUrl(media: Media): string | null {\n return (\n media.hd?.url ||\n media.xlarge?.url ||\n media.large?.url ||\n media.medium?.url ||\n media.placeholder?.url ||\n null\n )\n}\n\n/**\n * Resolves store logo URL, preferring square logo over rectangular.\n * Tries all available size variants so CDN assets with only hd/xlarge are found too.\n */\nexport function resolveStoreLogoUrl(store: Store | null | undefined): string | null {\n if (!store) return null\n if (store.square_logo) {\n const url = resolveMediaUrl(store.square_logo)\n if (url) return url\n }\n if (store.logo) {\n return resolveMediaUrl(store.logo)\n }\n return null\n}\n\n/**\n * Strips HTML tags from a string.\n */\nexport function stripHtml(html: string): string {\n return html.replace(/<[^>]*>/g, '').trim()\n}\n\n/**\n * Prepares a string for use as og:description or meta description:\n * strips HTML tags and truncates to maxLength (default 160).\n */\nexport function prepareOgDescription(\n text: string | null | undefined,\n maxLength = 160\n): string | null {\n if (!text) return null\n const plain = stripHtml(text)\n if (!plain) return null\n return plain.length > maxLength ? `${plain.slice(0, maxLength - 3)}...` : plain\n}\n","/**\n * Canonical public origin of the site, from `store.domain`. The fallback (request host)\n * is supplied by the consumer — the core doesn't know about `useRequestURL`.\n */\nexport function resolveSiteOrigin(\n storeDomain: string | null | undefined,\n fallbackOrigin: string\n): string {\n const domain = storeDomain?.trim()\n if (domain) {\n const host = domain.replace(/^https?:\\/\\//, '').replace(/\\/+$/, '')\n return `https://${host}`\n }\n return fallbackOrigin\n}\n","import type { Product, ProductVariant } from '@zenky/storefront-api'\n\nimport { minorToMajorString } from '../money'\nimport { resolveVariantPrice } from '../products'\nimport { resolveMediaUrl } from './utils'\n\nfunction isProductInStock(variants: ProductVariant[]): boolean {\n if (!variants.length) return false\n return variants.some((variant) => {\n const remainders = variant.remainders\n if (!remainders?.length) return true\n return remainders.some((remainder) => remainder.quantity > 0)\n })\n}\n\n/**\n * JSON-LD schema.org/Product. Google uses it for Rich Results (price, availability,\n * rating in search listings).\n * Returns an array of 0 or 1 objects — the consumer wraps it in a `<script ld+json>` tag.\n * Spec: https://schema.org/Product\n */\nexport function buildProductSchema(product: Product, currency: string): Record<string, unknown>[] {\n const variants = product.variants ?? []\n\n const firstVariant = variants[0]\n let offerBlock: Record<string, unknown> | undefined\n\n if (firstVariant) {\n const resolved = resolveVariantPrice(firstVariant)\n\n offerBlock = {\n '@type': 'Offer',\n price: minorToMajorString(resolved.price, currency),\n priceCurrency: currency,\n availability: isProductInStock(variants)\n ? 'https://schema.org/InStock'\n : 'https://schema.org/OutOfStock',\n ...(firstVariant.sku ? { sku: firstVariant.sku } : {}),\n }\n }\n\n const images = (product.images ?? []).map(resolveMediaUrl).filter((url): url is string => !!url)\n\n const schema: Record<string, unknown> = {\n '@context': 'https://schema.org',\n '@type': 'Product',\n name: product.name,\n }\n\n if (product.description) schema.description = product.description\n if (images.length) schema.image = images\n if (offerBlock) schema.offers = offerBlock\n\n return [schema]\n}\n","import type { NestedCategory, Product, ProductsCollection } from '@zenky/storefront-api'\n\nimport { resolveMediaUrl } from './utils'\nimport type { BreadcrumbItem } from './types'\n\n/**\n * JSON-LD for a product listing page: BreadcrumbList + ItemList (first 10 products).\n * Returns an array of 0-2 JSON-LD objects. Category and collection pages differ only\n * in the list name, so both go through here.\n * Spec: https://schema.org/ItemList · https://schema.org/BreadcrumbList\n */\nfunction buildListingSchemas(\n name: string | null,\n products: Product[],\n breadcrumbs: BreadcrumbItem[],\n origin: string\n): Record<string, unknown>[] {\n const schemas: Record<string, unknown>[] = []\n\n if (breadcrumbs.length) {\n schemas.push({\n '@context': 'https://schema.org',\n '@type': 'BreadcrumbList',\n itemListElement: breadcrumbs.map((crumb, index) => ({\n '@type': 'ListItem',\n position: index + 1,\n name: crumb.label,\n ...(crumb.to ? { item: `${origin}${crumb.to}` } : {}),\n })),\n })\n }\n\n const items = products.slice(0, 10)\n if (items.length) {\n schemas.push({\n '@context': 'https://schema.org',\n '@type': 'ItemList',\n name,\n numberOfItems: items.length,\n itemListElement: items.map((product, index) => {\n const url = `${origin}/products/${product.short_id}/${product.slug || product.short_id}`\n const firstImage = product.images?.[0]\n const image = firstImage ? resolveMediaUrl(firstImage) : null\n\n const item: Record<string, unknown> = {\n '@type': 'ListItem',\n position: index + 1,\n url,\n name: product.name,\n }\n\n if (image) item.image = image\n\n return item\n }),\n })\n }\n\n return schemas\n}\n\n/** JSON-LD for a category page. */\nexport function buildCategorySchemas(\n category: NestedCategory,\n products: Product[],\n breadcrumbs: BreadcrumbItem[],\n origin: string\n): Record<string, unknown>[] {\n return buildListingSchemas(category.name, products, breadcrumbs, origin)\n}\n\n/** JSON-LD for a products collection page. */\nexport function buildCollectionSchemas(\n collection: ProductsCollection,\n products: Product[],\n breadcrumbs: BreadcrumbItem[],\n origin: string\n): Record<string, unknown>[] {\n return buildListingSchemas(collection.name, products, breadcrumbs, origin)\n}\n","import type { Article, Media, OfferArticle } from '@zenky/storefront-api'\n\nimport { prepareOgDescription, resolveMediaUrl } from './utils'\n\nfunction articleSchema(\n type: 'Article' | 'BlogPosting',\n opts: {\n title: string | null | undefined\n intro: string | null | undefined\n cover: Media | null | undefined\n storeName: string\n origin: string\n }\n): Record<string, unknown> {\n const schema: Record<string, unknown> = {\n '@context': 'https://schema.org',\n '@type': type,\n headline: opts.title ?? '',\n author: {\n '@type': 'Organization',\n name: opts.storeName,\n url: opts.origin,\n },\n }\n\n const description = prepareOgDescription(opts.intro)\n if (description) schema.description = description\n\n const image = opts.cover ? resolveMediaUrl(opts.cover) : null\n if (image) schema.image = image\n\n return schema\n}\n\n/**\n * JSON-LD schema.org/Article for the offer page's editorial copy.\n * Spec: https://schema.org/Article\n */\nexport function buildOfferArticleSchema(\n article: OfferArticle,\n storeName: string,\n origin: string\n): Record<string, unknown>[] {\n if (!article.title) return []\n\n return [\n articleSchema('Article', {\n title: article.title,\n intro: article.intro,\n cover: article.cover,\n storeName,\n origin,\n }),\n ]\n}\n\n/**\n * JSON-LD schema.org/BlogPosting for a blog article — enables Google Rich Results.\n * Spec: https://schema.org/BlogPosting\n */\nexport function buildBlogPostSchema(\n article: Article,\n storeName: string,\n origin: string\n): Record<string, unknown>[] {\n const schema = articleSchema('BlogPosting', {\n title: article.title,\n intro: article.intro,\n cover: article.cover,\n storeName,\n origin,\n })\n\n if (article.updated_at) {\n schema.dateModified = article.updated_at\n // No separate datePublished field is available — reuse updated_at.\n schema.datePublished = article.updated_at\n }\n\n return [schema]\n}\n","import { ContactType } from '@zenky/storefront-api'\n\nimport type { Schedule, Store } from '@zenky/storefront-api'\n\nimport { getSocialLinks } from '../utils'\n\n/** Schedule.days key → schema.org DayOfWeek. */\nconst SCHEMA_DAY: Record<string, string> = {\n monday: 'Monday',\n tuesday: 'Tuesday',\n wednesday: 'Wednesday',\n thursday: 'Thursday',\n friday: 'Friday',\n saturday: 'Saturday',\n sunday: 'Sunday',\n}\n\n/**\n * Schedule (per-day `hours` string like \"10:00-22:00\") → array of schema.org/OpeningHoursSpecification.\n * Days without a recognizable interval (day off / 24 hours / empty) are skipped.\n */\nfunction buildOpeningHours(schedule: Schedule | null | undefined): Record<string, unknown>[] {\n if (!schedule) return []\n\n const result: Record<string, unknown>[] = []\n for (const key of Object.keys(SCHEMA_DAY)) {\n const day = schedule.days[key as keyof typeof schedule.days]\n const match = day?.hours?.match(/(\\d{1,2}:\\d{2}).*?(\\d{1,2}:\\d{2})/)\n if (!match) continue\n\n result.push({\n '@type': 'OpeningHoursSpecification',\n dayOfWeek: SCHEMA_DAY[key],\n opens: match[1],\n closes: match[2],\n })\n }\n\n return result\n}\n\n/**\n * JSON-LD schema.org/Organization (or LocalBusiness if there's a physical location)\n * for the homepage. Feeds Google's Knowledge Panel. All data comes from the\n * already-loaded profile.\n * Spec: https://schema.org/Organization · https://schema.org/LocalBusiness\n */\nexport function buildOrganizationSchema(store: Store, origin: string): Record<string, unknown>[] {\n const logoUrl =\n store.square_logo?.medium?.url ||\n store.square_logo?.large?.url ||\n store.logo?.medium?.url ||\n store.logo?.large?.url ||\n null\n\n const phones = (store.phones ?? []).map((p) => p.number).filter((n): n is string => !!n)\n const email = store.links?.find((c) => c.type === ContactType.Email)?.value ?? null\n const socialLinks = getSocialLinks(store.links ?? []).map((l) => l.url)\n\n const city = (store.cities ?? []).find((c) => c.is_default) ?? store.cities?.[0] ?? null\n const stock = city?.stocks?.find((st) => st.address) ?? city?.stocks?.[0] ?? null\n\n const streetAddress = stock?.address ?? null\n const geo = stock?.coordinates ?? city?.coordinates ?? null\n const openingHours = buildOpeningHours(stock?.schedule ?? city?.schedule)\n\n const isLocalBusiness = Boolean(streetAddress || geo || openingHours.length)\n\n const schema: Record<string, unknown> = {\n '@context': 'https://schema.org',\n '@type': isLocalBusiness ? 'LocalBusiness' : 'Organization',\n name: store.name,\n url: origin,\n }\n\n if (logoUrl) {\n schema.logo = logoUrl\n schema.image = logoUrl\n }\n\n if (phones.length) schema.telephone = phones.length === 1 ? phones[0] : phones\n if (email) schema.email = email\n if (socialLinks.length) schema.sameAs = socialLinks\n\n if (streetAddress || city?.name) {\n schema.address = {\n '@type': 'PostalAddress',\n ...(streetAddress ? { streetAddress } : {}),\n ...(city?.name ? { addressLocality: city.name } : {}),\n addressCountry: 'RU',\n }\n }\n\n if (geo) {\n schema.geo = {\n '@type': 'GeoCoordinates',\n latitude: geo.latitude,\n longitude: geo.longitude,\n }\n }\n\n if (openingHours.length) schema.openingHoursSpecification = openingHours\n\n return [schema]\n}\n","/** Already-resolved OG/Twitter tag values (with the consumer's defaults applied). */\nexport interface OgTagsInput {\n title: string | null\n description?: string | null\n image?: string | null\n type?: string\n url?: string | null\n}\n\n/** Framework-neutral OG + Twitter meta records. The consumer controls head priority. */\nexport function buildOgTags(input: OgTagsInput): Record<string, string>[] {\n const tags: Record<string, string>[] = []\n\n if (input.title) {\n tags.push({ property: 'og:title', content: input.title })\n tags.push({ name: 'twitter:title', content: input.title })\n }\n\n if (input.description) {\n tags.push({ property: 'og:description', content: input.description })\n tags.push({ name: 'twitter:description', content: input.description })\n }\n\n if (input.image) {\n tags.push({ property: 'og:image', content: input.image })\n tags.push({ name: 'twitter:image', content: input.image })\n }\n\n tags.push({ property: 'og:type', content: input.type ?? 'website' })\n\n if (input.url) {\n tags.push({ property: 'og:url', content: input.url })\n }\n\n return tags\n}\n","import type { Seo, SeoMetaTag } from '@zenky/storefront-api'\n\n/** SDK `Seo.meta` tags mapped to framework-neutral head meta records. */\nexport function mapSeoMetaTags(tags: SeoMetaTag[]): Record<string, string>[] {\n return tags.map((tag) => {\n const attrs: Record<string, string> = {\n [tag.name.attribute]: tag.name.value,\n [tag.value.attribute]: tag.value.value,\n }\n\n for (const additional of tag.additional) {\n attrs[additional.attribute] = additional.value\n }\n\n return attrs\n })\n}\n\n/** Meta tags from a `Seo` entity (description + `Seo.meta` mapping). The consumer resolves the title. */\nexport function buildEntitySeoMeta(seo: Seo | null | undefined): Record<string, string>[] {\n const tags: Record<string, string>[] = []\n\n if (seo?.description) {\n tags.push({ name: 'description', content: seo.description })\n }\n\n if (seo?.meta?.length) {\n tags.push(...mapSeoMetaTags(seo.meta))\n }\n\n return tags\n}\n"]}
@@ -1,18 +1,21 @@
1
1
  import * as pinia from 'pinia';
2
2
  import * as vue from 'vue';
3
3
  import { Ref, ComputedRef } from 'vue';
4
+ import { S as StaticCatalogItem } from '../catalogEntity-DgrPsJpf.js';
4
5
  import * as _zenky_storefront_api from '@zenky/storefront-api';
5
- import { CatalogItem, Product, Store, City, Stock, NestedCategory, DeliveryMethod, Order, OrderDeliveryMethod, OrderSettings, OrderCheckoutTotal, PaymentMethod, OrderPaymentTransaction, OrderProductVariant, OrderPaymentMethod } from '@zenky/storefront-api';
6
+ import { Product, Store, City, Stock, NestedCategory, DeliveryMethod, Order, OrderDeliveryMethod, OrderSettings, OrderCheckoutTotal, PaymentMethod, OrderPaymentTransaction, OrderProductVariant, OrderPaymentMethod } from '@zenky/storefront-api';
6
7
  import { Website } from '../website-settings/index.js';
8
+ import { a as AuthStep, f as CodeContext, g as ConfirmationChannel, e as ChannelIntent, S as SelectableConfirmationChannel } from '../types-CXm2F6Hz.js';
9
+ import { R as RecaptchaPayloadProvider } from '../useCheckoutSubmit-Be-lQd60.js';
7
10
  import '@zenky/integrations-sdk';
8
11
  import '../snippets/index.js';
9
12
 
10
13
  interface CatalogStore {
11
- catalog: Ref<CatalogItem[]>;
14
+ catalog: Ref<StaticCatalogItem[]>;
12
15
  currentHash: Ref<string | null>;
13
16
  reloading: Ref<boolean>;
14
17
  loadError: Ref<boolean>;
15
- initCatalog: (items: CatalogItem[], hash?: string | null) => void;
18
+ initCatalog: (items: StaticCatalogItem[], hash?: string | null) => void;
16
19
  setLoadError: () => void;
17
20
  setReloading: (value: boolean) => void;
18
21
  hasCatalog: ComputedRef<boolean>;
@@ -56,6 +59,59 @@ interface AuthStore {
56
59
  }
57
60
  declare const useAuthStore: pinia.StoreDefinition<"zenky-auth", Pick<AuthStore, "token" | "phone" | "countryCode">, Pick<AuthStore, "isAuthenticated" | "apiToken" | "initials">, Pick<AuthStore, "setToken" | "clearToken" | "initFromCookie">>;
58
61
 
62
+ declare const RESEND_TIMER_SECONDS = 60;
63
+
64
+ interface AuthFlowStore {
65
+ currentStep: Ref<AuthStep>;
66
+ phone: Ref<string>;
67
+ countryCode: Ref<string>;
68
+ loading: Ref<boolean>;
69
+ error: Ref<string | null>;
70
+ fieldErrors: Ref<Record<string, string[]>>;
71
+ codeContext: Ref<CodeContext>;
72
+ confirmationMethod: Ref<ConfirmationChannel | null>;
73
+ /** Какой flow привёл на AUTH_STEP.Channel — публичное, часть $state (SSR-гидратируется). */
74
+ channelIntent: Ref<ChannelIntent | null>;
75
+ /**
76
+ * Канал, на котором последний раз получили `auth.otp_request.failed`. UI может
77
+ * скрыть/задизейблить эту кнопку на повторном показе Channel — бэк уже отказал,
78
+ * выбор того же канала снова даст ту же ошибку.
79
+ */
80
+ lastFailedChannel: Ref<SelectableConfirmationChannel | null>;
81
+ resetCode: Ref<string>;
82
+ registerCode: Ref<string>;
83
+ resendTimerEndsAt: Ref<number>;
84
+ pendingPassword: Ref<string>;
85
+ availableChannels: ComputedRef<SelectableConfirmationChannel[]>;
86
+ checkPhone: (getRecaptchaPayload: RecaptchaPayloadProvider) => Promise<void>;
87
+ /**
88
+ * @returns true — токен получен, флоу завершён. false — либо ошибка (см. `error`),
89
+ * либо телефон зарегистрирован, но не подтверждён: код уже отправлен и `currentStep`
90
+ * ушёл на Code/Channel — в этом случае `error` пустой, это не сбой.
91
+ */
92
+ login: (password: string, getRecaptchaPayload: RecaptchaPayloadProvider) => Promise<boolean>;
93
+ /** @returns true — токен получен (сразу или через login-fallback при 0 каналах), false — код отправлен / ошибка / шаг выбора канала */
94
+ register: (password: string, getRecaptchaPayload: RecaptchaPayloadProvider) => Promise<boolean>;
95
+ confirmRegistration: (code: string, password?: string) => Promise<boolean>;
96
+ resendCode: (getRecaptchaPayload: RecaptchaPayloadProvider) => Promise<number>;
97
+ dispatchReset: (getRecaptchaPayload: RecaptchaPayloadProvider) => Promise<void>;
98
+ resetPassword: (code: string, password: string) => Promise<boolean>;
99
+ selectChannel: (channel: SelectableConfirmationChannel, getRecaptchaPayload: RecaptchaPayloadProvider) => Promise<boolean>;
100
+ /** Сбрасывает выбранный канал перед ручным resend — иначе гейт сработает только один раз. */
101
+ changeChannel: () => void;
102
+ goToChannelBack: () => void;
103
+ goToReset: () => void;
104
+ goToPhone: () => void;
105
+ goToMethod: () => void;
106
+ goToLogin: () => void;
107
+ goToNewPassword: (code: string) => void;
108
+ goToResetCode: () => void;
109
+ goToRegisterPassword: (code: string) => void;
110
+ goToRegisterCode: () => void;
111
+ reset: () => void;
112
+ }
113
+ declare const useAuthFlowStore: pinia.StoreDefinition<"zenky-auth-flow", Pick<AuthFlowStore, "error" | "phone" | "countryCode" | "loading" | "currentStep" | "fieldErrors" | "codeContext" | "confirmationMethod" | "channelIntent" | "lastFailedChannel" | "resetCode" | "registerCode" | "resendTimerEndsAt" | "pendingPassword">, Pick<AuthFlowStore, "availableChannels">, Pick<AuthFlowStore, "login" | "register" | "reset" | "checkPhone" | "confirmRegistration" | "resendCode" | "dispatchReset" | "resetPassword" | "selectChannel" | "changeChannel" | "goToChannelBack" | "goToReset" | "goToPhone" | "goToMethod" | "goToLogin" | "goToNewPassword" | "goToResetCode" | "goToRegisterPassword" | "goToRegisterCode">>;
114
+
59
115
  interface OrderSettingsStore {
60
116
  deliveryMethod: Ref<DeliveryMethod>;
61
117
  onPremiseTable: Ref<string | null>;
@@ -193,4 +249,4 @@ declare function useStorefrontProfile(): {
193
249
  hasStock: vue.ComputedRef<boolean>;
194
250
  };
195
251
 
196
- export { type AppliedBonusesIntent, type AuthStore, type CartStore, type MinPriceViolation, type OrderSettingsStore, type PromotionsStore, type RewardSelection, type RewardSelectionContext, type StoreProfileStore, useAuthStore, useCartStore, useCatalogStore, useOrderSettingsStore, useProductsStore, usePromotionsStore, useStore, useStoreProfileStore, useStorefrontProfile };
252
+ export { type AppliedBonusesIntent, type AuthFlowStore, type AuthStore, type CartStore, type MinPriceViolation, type OrderSettingsStore, type PromotionsStore, RESEND_TIMER_SECONDS, type RewardSelection, type RewardSelectionContext, type StoreProfileStore, useAuthFlowStore, useAuthStore, useCartStore, useCatalogStore, useOrderSettingsStore, useProductsStore, usePromotionsStore, useStore, useStoreProfileStore, useStorefrontProfile };
@@ -1,6 +1,9 @@
1
- export { useProductsStore, useStore, useStorefrontProfile } from '../chunk-FXKG5TFQ.js';
2
- export { useCartStore, useOrderSettingsStore, usePromotionsStore } from '../chunk-XULHV6SS.js';
3
- export { useCatalogStore } from '../chunk-6QCFHSLX.js';
4
- export { useAuthStore, useStoreProfileStore } from '../chunk-QZ3S3NN3.js';
1
+ export { RESEND_TIMER_SECONDS, useAuthFlowStore, useProductsStore, useStore, useStorefrontProfile } from '../chunk-KX7KXN3W.js';
2
+ import '../chunk-AK4276ND.js';
3
+ import '../chunk-TE42OCFK.js';
4
+ export { useCartStore, useOrderSettingsStore, usePromotionsStore } from '../chunk-TE2QPH74.js';
5
+ export { useCatalogStore } from '../chunk-NSOIL7PW.js';
6
+ export { useAuthStore } from '../chunk-WTZXTBF6.js';
7
+ export { useStoreProfileStore } from '../chunk-IOYYCA75.js';
5
8
  //# sourceMappingURL=index.js.map
6
9
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,55 @@
1
+ import { ConfirmationMethod, RequestedConfirmationMethod } from '@zenky/storefront-api';
2
+
3
+ declare const AUTH_STEP: {
4
+ readonly Method: "method";
5
+ readonly Phone: "phone";
6
+ readonly Channel: "channel";
7
+ readonly Login: "login";
8
+ readonly Register: "register";
9
+ readonly Code: "code";
10
+ readonly RegisterPassword: "register_password";
11
+ readonly Reset: "reset";
12
+ readonly NewPassword: "new_password";
13
+ };
14
+ type AuthStep = (typeof AUTH_STEP)[keyof typeof AUTH_STEP];
15
+ declare const CODE_CONTEXT: {
16
+ readonly Register: "register";
17
+ readonly Reset: "reset";
18
+ };
19
+ type CodeContext = (typeof CODE_CONTEXT)[keyof typeof CODE_CONTEXT];
20
+ /**
21
+ * Какой flow привёл на шаг выбора канала (AUTH_STEP.Channel) — нужно чтобы
22
+ * selectChannel() знал, что вызвать повторно, а goToChannelBack() — куда вернуться.
23
+ */
24
+ declare const CHANNEL_INTENT: {
25
+ readonly Register: "register";
26
+ readonly Resend: "resend";
27
+ readonly DispatchReset: "dispatch_reset";
28
+ };
29
+ type ChannelIntent = (typeof CHANNEL_INTENT)[keyof typeof CHANNEL_INTENT];
30
+ declare const CONFIRMATION_CHANNEL: {
31
+ readonly Sms: "sms";
32
+ readonly Call: "call";
33
+ readonly Telegram: "telegram";
34
+ readonly WhatsApp: "whatsapp";
35
+ };
36
+ type ConfirmationChannel = (typeof CONFIRMATION_CHANNEL)[keyof typeof CONFIRMATION_CHANNEL];
37
+ /**
38
+ * `Call` — легаси, response-only (сообщает, что код это последние 4 цифры входящего
39
+ * звонка); никогда не показывается как кнопка и не может быть явно выбран. Всё, что
40
+ * реально можно выбрать/передать в `selectChannel` — этот более узкий тип.
41
+ */
42
+ type SelectableConfirmationChannel = Exclude<ConfirmationChannel, typeof CONFIRMATION_CHANNEL.Call>;
43
+ /** Порядок показа в модалке выбора: Telegram, WhatsApp, SMS — всегда последним. */
44
+ declare const CONFIRMATION_CHANNEL_ORDER: readonly SelectableConfirmationChannel[];
45
+ declare function toConfirmationChannel(method: ConfirmationMethod | string | null | undefined): ConfirmationChannel;
46
+ /**
47
+ * `ConfirmationChannel` шире, чем `RequestedConfirmationMethod` (включает `call` —
48
+ * легаси-значение, которое можно получить в ответе, но нельзя запросить явно). Рантайм-
49
+ * инвариант: сюда `call` попасть не может — `availableChannels` строится из
50
+ * `CONFIRMATION_CHANNEL_ORDER` (Telegram/WhatsApp/Sms, без Call), а канал выбирается
51
+ * только из этого списка.
52
+ */
53
+ declare function toRequestedMethod(channel: ConfirmationChannel | null | undefined): RequestedConfirmationMethod | undefined;
54
+
55
+ export { AUTH_STEP as A, CHANNEL_INTENT as C, type SelectableConfirmationChannel as S, type AuthStep as a, CODE_CONTEXT as b, CONFIRMATION_CHANNEL as c, CONFIRMATION_CHANNEL_ORDER as d, type ChannelIntent as e, type CodeContext as f, type ConfirmationChannel as g, toRequestedMethod as h, toConfirmationChannel as t };