@zenky/storefront-vue 0.10.8 → 0.10.10

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 (76) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +4 -18
  3. package/dist/cart/index.d.ts +167 -160
  4. package/dist/cart/index.js +7 -7
  5. package/dist/catalog/index.d.ts +23 -24
  6. package/dist/catalog/index.js +2 -2
  7. package/dist/catalogEntity-DgrPsJpf.d.ts +44 -0
  8. package/dist/{chunk-RO25KNM5.js → chunk-2Y6QTHXI.js} +2 -2
  9. package/dist/chunk-2Y6QTHXI.js.map +1 -0
  10. package/dist/{chunk-3FDM6T7F.js → chunk-32SLDGE5.js} +8 -6
  11. package/dist/chunk-32SLDGE5.js.map +1 -0
  12. package/dist/{chunk-5YD4AIY2.js → chunk-46FNHMWC.js} +4 -4
  13. package/dist/chunk-46FNHMWC.js.map +1 -0
  14. package/dist/{chunk-2SMSLZ6G.js → chunk-4UMDIBW5.js} +15 -11
  15. package/dist/chunk-4UMDIBW5.js.map +1 -0
  16. package/dist/{chunk-4IFPVEO7.js → chunk-BUNI6MGH.js} +3 -3
  17. package/dist/chunk-BUNI6MGH.js.map +1 -0
  18. package/dist/{chunk-E3G7NGCH.js → chunk-FS2UNPTY.js} +2 -2
  19. package/dist/chunk-FS2UNPTY.js.map +1 -0
  20. package/dist/{chunk-PTMSPB34.js → chunk-FXKG5TFQ.js} +3 -3
  21. package/dist/chunk-FXKG5TFQ.js.map +1 -0
  22. package/dist/{chunk-MOG6UMFM.js → chunk-GILJFP55.js} +2 -2
  23. package/dist/chunk-GILJFP55.js.map +1 -0
  24. package/dist/{chunk-2CI4RW7V.js → chunk-GLQXTMVW.js} +2 -2
  25. package/dist/{chunk-2CI4RW7V.js.map → chunk-GLQXTMVW.js.map} +1 -1
  26. package/dist/{chunk-MZ66ARDL.js → chunk-GXDTRTUT.js} +2 -2
  27. package/dist/chunk-GXDTRTUT.js.map +1 -0
  28. package/dist/{chunk-Z3IW4ODZ.js → chunk-NSOIL7PW.js} +2 -2
  29. package/dist/chunk-NSOIL7PW.js.map +1 -0
  30. package/dist/{chunk-NG7RUIWW.js → chunk-OBNMXLJO.js} +19 -3
  31. package/dist/chunk-OBNMXLJO.js.map +1 -0
  32. package/dist/{chunk-VFMVQR6Y.js → chunk-QZ3S3NN3.js} +5 -3
  33. package/dist/chunk-QZ3S3NN3.js.map +1 -0
  34. package/dist/{chunk-Z247QRDJ.js → chunk-XULHV6SS.js} +3 -3
  35. package/dist/chunk-XULHV6SS.js.map +1 -0
  36. package/dist/index.d.ts +4 -3
  37. package/dist/index.js +14 -14
  38. package/dist/money/index.d.ts +8 -8
  39. package/dist/money/index.js +1 -1
  40. package/dist/order/index.d.ts +3 -3
  41. package/dist/order/index.js.map +1 -1
  42. package/dist/pagination/index.d.ts +29 -37
  43. package/dist/pagination/index.js.map +1 -1
  44. package/dist/ports/index.d.ts +23 -22
  45. package/dist/ports/index.js +1 -1
  46. package/dist/products/index.d.ts +10 -10
  47. package/dist/products/index.js +3 -3
  48. package/dist/promotions/index.d.ts +5 -5
  49. package/dist/promotions/index.js +3 -3
  50. package/dist/seo/index.d.ts +17 -17
  51. package/dist/seo/index.js +15 -9
  52. package/dist/seo/index.js.map +1 -1
  53. package/dist/snippets/index.js +1 -1
  54. package/dist/stores/index.d.ts +8 -8
  55. package/dist/stores/index.js +4 -4
  56. package/dist/theme/index.d.ts +3 -3
  57. package/dist/theme/index.js +1 -1
  58. package/dist/utils/index.d.ts +16 -16
  59. package/dist/utils/index.js +1 -1
  60. package/docs/architecture.md +85 -0
  61. package/docs/consumer-setup.md +13 -54
  62. package/docs/ports.md +12 -13
  63. package/package.json +1 -1
  64. package/dist/chunk-2SMSLZ6G.js.map +0 -1
  65. package/dist/chunk-3FDM6T7F.js.map +0 -1
  66. package/dist/chunk-4IFPVEO7.js.map +0 -1
  67. package/dist/chunk-5YD4AIY2.js.map +0 -1
  68. package/dist/chunk-E3G7NGCH.js.map +0 -1
  69. package/dist/chunk-MOG6UMFM.js.map +0 -1
  70. package/dist/chunk-MZ66ARDL.js.map +0 -1
  71. package/dist/chunk-NG7RUIWW.js.map +0 -1
  72. package/dist/chunk-PTMSPB34.js.map +0 -1
  73. package/dist/chunk-RO25KNM5.js.map +0 -1
  74. package/dist/chunk-VFMVQR6Y.js.map +0 -1
  75. package/dist/chunk-Z247QRDJ.js.map +0 -1
  76. package/dist/chunk-Z3IW4ODZ.js.map +0 -1
@@ -40,5 +40,5 @@ function createMemoryStorage() {
40
40
  }
41
41
 
42
42
  export { KEY_MESSAGE_FORMATTER, NOOP_ACTIVITY_REPORTER, NOOP_NOTIFIER, NOOP_RUM, createMemoryStorage, err, ok };
43
- //# sourceMappingURL=chunk-MOG6UMFM.js.map
44
- //# sourceMappingURL=chunk-MOG6UMFM.js.map
43
+ //# sourceMappingURL=chunk-GILJFP55.js.map
44
+ //# sourceMappingURL=chunk-GILJFP55.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ports/index.ts"],"names":[],"mappings":";AAyIO,IAAM,KAAK,CAAI,KAAA,MAAgC,EAAE,EAAA,EAAI,MAAM,KAAA,EAAM;AACjE,IAAM,MAAM,CAAI,KAAA,MAAgC,EAAE,EAAA,EAAI,OAAO,KAAA,EAAM;AA2BnE,IAAM,aAAA,GAA0B;AAAA,EACnC,OAAO,MAAM;AAAA,EAAC,CAAA;AAAA,EACd,SAAS,MAAM;AAAA,EAAC,CAAA;AAAA,EAChB,SAAS,MAAM;AAAA,EAAC,CAAA;AAAA,EAChB,SAAS,MAAM;AAAA,EAAC;AACpB;AAGO,IAAM,qBAAA,GAA0C;AAAA,EACnD,MAAA,EAAQ,CAAC,GAAA,KAAQ;AACrB;AAEO,IAAM,sBAAA,GAA2C;AAAA,EACpD,OAAO,MAAM;AAAA,EAAC,CAAA;AAAA,EACd,KAAK,MAAM;AAAA,EAAC;AAChB;AAEO,IAAM,QAAA,GAAwB;AAAA,EACjC,MAAM,MAAM;AAAA,EAAC,CAAA;AAAA,EACb,SAAS,MAAM;AAAA,EAAC;AACpB;AAGO,SAAS,mBAAA,GAAsC;AAClD,EAAA,MAAM,GAAA,uBAAU,GAAA,EAAoB;AACpC,EAAA,OAAO;AAAA,IACH,KAAK,CAAC,GAAA,KAAQ,GAAA,CAAI,GAAA,CAAI,GAAG,CAAA,IAAK,IAAA;AAAA,IAC9B,GAAA,EAAK,CAAC,GAAA,EAAK,KAAA,KAAU;AACjB,MAAA,GAAA,CAAI,GAAA,CAAI,KAAK,KAAK,CAAA;AAAA,IACtB,CAAA;AAAA,IACA,MAAA,EAAQ,CAAC,GAAA,KAAQ;AACb,MAAA,GAAA,CAAI,OAAO,GAAG,CAAA;AAAA,IAClB;AAAA,GACJ;AACJ","file":"chunk-GILJFP55.js","sourcesContent":["// Ports — interfaces describing what the core needs from the consumer's runtime.\n// Each frontend (Nuxt / QR menu / template) brings its own adapters.\n// The core does NOT know about useCookie, useRuntimeConfig, vue-router, etc.\n\nimport type { Ref } from 'vue'\n\nimport type { ZenkyIntegrationsSDK } from '@zenky/integrations-sdk'\nimport type { RecommendationsBlock, RemoteCatalog, ZenkyStorefront } from '@zenky/storefront-api'\n\nexport interface StorageOptions {\n /** Time-to-live, in seconds. */\n maxAge?: number\n sameSite?: 'strict' | 'lax' | 'none'\n secure?: boolean\n path?: string\n}\n\n/** Persistent key-value storage (cookies / localStorage / memory). */\nexport interface StorageAdapter {\n get(key: string): string | null\n set(key: string, value: string, options?: StorageOptions): void\n remove(key: string, options?: StorageOptions): void\n}\n\n/** Runtime config. The core doesn't need to know where these values come from. */\nexport interface StorefrontConfig {\n baseUrl: string\n baseAuthUrl: string\n /** Optional sales channel, used for creatives and channels. */\n salesChannelId?: string\n}\n\n/** User-facing notifications (toasts). Implemented on the consumer's side. */\nexport interface Notifier {\n error(message: string): void\n success(message: string): void\n warning(message: string): void\n message(title: string, options?: { description?: string }): void\n}\n\n/** Stable message identifiers emitted by domain logic. Text and locale belong to the consumer. */\nexport type StorefrontMessageKey =\n | 'cart.added.title'\n | 'cart.bonuses.changed.description'\n | 'cart.bonuses.changed.title'\n | 'cart.customer.saveFailed'\n | 'cart.customer.updateAfterLoginFailed'\n | 'cart.customer.updated'\n | 'cart.customer.updatedWithName'\n | 'cart.payment.updateFailed'\n | 'cart.promocode.applyFailed'\n | 'cart.promocode.removeFailed'\n | 'cart.stock.catalogReloadFailed'\n | 'cart.stock.checkFailed'\n | 'cart.stock.itemsRemoved'\n | 'cart.stock.pricesUpdated'\n | 'cart.updateFailed'\n\nexport type StorefrontMessageParams = Readonly<\n Record<string, string | number | boolean | null | undefined>\n>\n\n/** Converts domain message identifiers into consumer-owned, localized UI copy. */\nexport interface MessageFormatter {\n format(key: StorefrontMessageKey, params?: StorefrontMessageParams): string\n}\n\n/** Activity reporter (busy indicators, long-running operations). */\nexport interface ActivityReporter {\n begin(kind: string): void\n end(kind: string): void\n}\n\n/** Realtime channel: subscribes to events (WebSocket). The core doesn't know about Pusher or any specific transport. */\nexport interface RealtimeChannel {\n bind(event: string, handler: (data?: unknown) => void): void\n}\n\nexport interface RealtimeAdapter {\n subscribe(channelName: string): RealtimeChannel | null\n unsubscribe(channelName: string): void\n isReady: Ref<boolean>\n}\n\nexport interface RealtimePort {\n get(): RealtimeAdapter | null\n}\n\nexport interface EventsPort {\n get(): ZenkyIntegrationsSDK | null\n}\n\n/** Reloads the catalog when the stock changes. The transport (fetch) is implemented on the consumer's side. */\nexport interface CatalogReloader {\n reload(storeId: string, remoteCatalog: RemoteCatalog): Promise<void>\n}\n\n/** RUM performance reporter (performance marks). Implemented by the consumer. */\nexport interface RumReporter {\n mark(name: string): void\n measure(metric: string, startMark: string): void\n}\n\n/** Commerce event identifiers (session/anonymous) — included in the checkout request. */\nexport interface CommerceEventIdentity {\n session_id?: string\n anonymous_id?: string\n}\n\nexport interface CommerceAddedToCartPayload {\n productId: string\n productVariantId: string\n quantity?: number\n unitPrice?: number\n totalPrice?: number\n recommendationsBlock?: RecommendationsBlock\n}\n\nexport interface CommerceRemovedFromCartPayload {\n productId: string\n productVariantId: string\n quantity?: number\n}\n\n/** Commerce event tracking. Implementation, queueing, and transport are handled by the consumer. */\nexport interface CommerceEventsPort {\n trackAddedToCart(orderId: string, payload: CommerceAddedToCartPayload): void\n trackRemovedFromCart(orderId: string, payload: CommerceRemovedFromCartPayload): void\n getIdentity(): CommerceEventIdentity\n}\n\n/**\n * Railway-style result: the compiler won't allow reading `.value` until the\n * consumer has checked `.ok`. Replaces throw at the public boundary.\n */\nexport type Result<T = void, E = unknown> = { ok: true; value: T } | { ok: false; error: E }\n\nexport const ok = <T>(value: T): Result<T, never> => ({ ok: true, value })\nexport const err = <E>(error: E): Result<never, E> => ({ ok: false, error })\n\n/** The full runtime that the consumer assembles and passes to createStorefront(). */\nexport interface StorefrontRuntime {\n /** Zenky SDK client. The consumer creates a single instance and provides it here. */\n sdk: ZenkyStorefront\n storage: StorageAdapter\n /** Reserved consumer configuration. The current core does not read this port. */\n config?: StorefrontConfig\n notifier: Notifier\n /** Localized user-facing copy. The core emits only stable message identifiers. */\n messages: MessageFormatter\n activity: ActivityReporter\n /** Lazy provider for the analytics integration, which may become available after setup. */\n events?: EventsPort | null\n /** Lazy provider for the realtime transport (WebSocket). */\n realtime?: RealtimePort | null\n /** Reloads the catalog when the stock changes. If absent, the reload step is skipped. */\n catalogReloader?: CatalogReloader | null\n /** RUM metrics. If absent, instrumentation is skipped. */\n rum?: RumReporter | null\n /** Commerce event tracking. If absent, tracking is skipped. */\n commerceEvents?: CommerceEventsPort | null\n}\n\n// --- NOOP / in-memory stubs (SSR, tests, defaults) ---\n\nexport const NOOP_NOTIFIER: Notifier = {\n error: () => {},\n success: () => {},\n warning: () => {},\n message: () => {},\n}\n\n/** Useful in headless tests where displaying a localized message is not required. */\nexport const KEY_MESSAGE_FORMATTER: MessageFormatter = {\n format: (key) => key,\n}\n\nexport const NOOP_ACTIVITY_REPORTER: ActivityReporter = {\n begin: () => {},\n end: () => {},\n}\n\nexport const NOOP_RUM: RumReporter = {\n mark: () => {},\n measure: () => {},\n}\n\n/** In-memory storage for SSR/tests, without side effects on real cookies. */\nexport function createMemoryStorage(): StorageAdapter {\n const map = new Map<string, string>()\n return {\n get: (key) => map.get(key) ?? null,\n set: (key, value) => {\n map.set(key, value)\n },\n remove: (key) => {\n map.delete(key)\n },\n }\n}\n"]}
@@ -17,5 +17,5 @@ function normalizeSnippets(groups) {
17
17
  }
18
18
 
19
19
  export { normalizeSnippets };
20
- //# sourceMappingURL=chunk-2CI4RW7V.js.map
21
- //# sourceMappingURL=chunk-2CI4RW7V.js.map
20
+ //# sourceMappingURL=chunk-GLQXTMVW.js.map
21
+ //# sourceMappingURL=chunk-GLQXTMVW.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/snippets/snippets.ts"],"names":[],"mappings":";AAwBO,SAAS,kBAAkB,MAAA,EAAsD;AACpF,EAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,SAAU,EAAC;AAEpC,EAAA,OAAO,MAAA,CAAO,OAAA;AAAA,IAAQ,CAAC,OAAO,UAAA,KAAA,CACzB,KAAA,CAAM,YAAY,EAAC,EACf,OAAO,CAAC,IAAA,KAAS,CAAC,CAAC,IAAA,CAAK,SAAS,IAAA,EAAM,EACvC,GAAA,CAAI,CAAC,MAAM,SAAA,KAAuB;AAC/B,MAAA,MAAM,OAAA,GAAmB;AAAA,QACrB,IAAI,CAAA,EAAG,KAAA,CAAM,MAAM,CAAA,CAAA,EAAI,UAAU,IAAI,SAAS,CAAA,CAAA;AAAA,QAC9C,UAAU,KAAA,CAAM,MAAA;AAAA,QAChB,UAAU,IAAA,CAAK,QAAA;AAAA,QACf,MAAM,IAAA,CAAK,OAAA;AAAA,QACX,OAAA,EAAS,KAAK,OAAA,IAAW;AAAA,OAC7B;AAEA,MAAA,IAAI,IAAA,CAAK,IAAA,KAAS,MAAA,EAAW,OAAA,CAAQ,OAAO,IAAA,CAAK,IAAA;AACjD,MAAA,OAAO,OAAA;AAAA,IACX,CAAC;AAAA,GACT;AACJ","file":"chunk-2CI4RW7V.js","sourcesContent":["export type SnippetPosition = 'head_start' | 'head_end' | 'body_start' | 'body_end'\nexport type SnippetLanguage = 'html' | 'css' | 'javascript'\n\nexport interface Snippet {\n id: string\n name?: string\n position: SnippetPosition\n language: SnippetLanguage\n code: string\n enabled: boolean\n}\n\nexport interface RawSnippetItem {\n language: SnippetLanguage\n content: string\n enabled?: boolean\n name?: string\n}\n\nexport interface SnippetGroup {\n region: SnippetPosition\n snippets: RawSnippetItem[]\n}\n\nexport function normalizeSnippets(groups: SnippetGroup[] | null | undefined): Snippet[] {\n if (!Array.isArray(groups)) return []\n\n return groups.flatMap((group, groupIndex) =>\n (group.snippets ?? [])\n .filter((item) => !!item.content?.trim())\n .map((item, itemIndex): Snippet => {\n const snippet: Snippet = {\n id: `${group.region}-${groupIndex}-${itemIndex}`,\n position: group.region,\n language: item.language,\n code: item.content,\n enabled: item.enabled ?? true,\n }\n // exactOptionalPropertyTypes: name задаём только если оно есть\n if (item.name !== undefined) snippet.name = item.name\n return snippet\n })\n )\n}\n"]}
1
+ {"version":3,"sources":["../src/snippets/snippets.ts"],"names":[],"mappings":";AAwBO,SAAS,kBAAkB,MAAA,EAAsD;AACpF,EAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,SAAU,EAAC;AAEpC,EAAA,OAAO,MAAA,CAAO,OAAA;AAAA,IAAQ,CAAC,OAAO,UAAA,KAAA,CACzB,KAAA,CAAM,YAAY,EAAC,EACf,OAAO,CAAC,IAAA,KAAS,CAAC,CAAC,IAAA,CAAK,SAAS,IAAA,EAAM,EACvC,GAAA,CAAI,CAAC,MAAM,SAAA,KAAuB;AAC/B,MAAA,MAAM,OAAA,GAAmB;AAAA,QACrB,IAAI,CAAA,EAAG,KAAA,CAAM,MAAM,CAAA,CAAA,EAAI,UAAU,IAAI,SAAS,CAAA,CAAA;AAAA,QAC9C,UAAU,KAAA,CAAM,MAAA;AAAA,QAChB,UAAU,IAAA,CAAK,QAAA;AAAA,QACf,MAAM,IAAA,CAAK,OAAA;AAAA,QACX,OAAA,EAAS,KAAK,OAAA,IAAW;AAAA,OAC7B;AAEA,MAAA,IAAI,IAAA,CAAK,IAAA,KAAS,MAAA,EAAW,OAAA,CAAQ,OAAO,IAAA,CAAK,IAAA;AACjD,MAAA,OAAO,OAAA;AAAA,IACX,CAAC;AAAA,GACT;AACJ","file":"chunk-GLQXTMVW.js","sourcesContent":["export type SnippetPosition = 'head_start' | 'head_end' | 'body_start' | 'body_end'\nexport type SnippetLanguage = 'html' | 'css' | 'javascript'\n\nexport interface Snippet {\n id: string\n name?: string\n position: SnippetPosition\n language: SnippetLanguage\n code: string\n enabled: boolean\n}\n\nexport interface RawSnippetItem {\n language: SnippetLanguage\n content: string\n enabled?: boolean\n name?: string\n}\n\nexport interface SnippetGroup {\n region: SnippetPosition\n snippets: RawSnippetItem[]\n}\n\nexport function normalizeSnippets(groups: SnippetGroup[] | null | undefined): Snippet[] {\n if (!Array.isArray(groups)) return []\n\n return groups.flatMap((group, groupIndex) =>\n (group.snippets ?? [])\n .filter((item) => !!item.content?.trim())\n .map((item, itemIndex): Snippet => {\n const snippet: Snippet = {\n id: `${group.region}-${groupIndex}-${itemIndex}`,\n position: group.region,\n language: item.language,\n code: item.content,\n enabled: item.enabled ?? true,\n }\n // exactOptionalPropertyTypes: only set name when it's actually present\n if (item.name !== undefined) snippet.name = item.name\n return snippet\n })\n )\n}\n"]}
@@ -240,5 +240,5 @@ function formatAddressCityLast(raw) {
240
240
  }
241
241
 
242
242
  export { buildQrCodeUrl, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors, getEmailLink, getPhoneTelLink, getSocialLinks, getTodayInfo, getWebsiteLink, getWeeklySchedule, pluralize, toDateInputValue, todayInTimezone };
243
- //# sourceMappingURL=chunk-MZ66ARDL.js.map
244
- //# sourceMappingURL=chunk-MZ66ARDL.js.map
243
+ //# sourceMappingURL=chunk-GXDTRTUT.js.map
244
+ //# sourceMappingURL=chunk-GXDTRTUT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/createOperationChain.ts","../src/utils/phone.ts","../src/utils/contacts.ts","../src/utils/schedule.ts","../src/utils/qr.ts","../src/utils/date.ts","../src/utils/pluralize.ts","../src/utils/errors.ts","../src/utils/address.ts"],"names":[],"mappings":";;;AASO,SAAS,oBAAA,GAAuC;AACnD,EAAA,MAAM,MAAA,uBAAa,GAAA,EAA2B;AAE9C,EAAA,eAAe,OAAA,CAAQ,KAAa,EAAA,EAAwC;AACxE,IAAA,MAAM,OAAO,MAAA,CAAO,GAAA,CAAI,GAAG,CAAA,IAAK,QAAQ,OAAA,EAAQ;AAEhD,IAAA,MAAM,OAAA,GAAU,IAAA,CAAK,IAAA,CAAK,EAAE,CAAA;AAG5B,IAAA,MAAM,IAAA,GAAO,OAAA,CAAQ,KAAA,CAAM,MAAM;AAAA,IAAC,CAAC,CAAA;AACnC,IAAA,MAAA,CAAO,GAAA,CAAI,KAAK,IAAI,CAAA;AAGpB,IAAA,IAAA,CAAK,QAAQ,MAAM;AACf,MAAA,IAAI,MAAA,CAAO,GAAA,CAAI,GAAG,CAAA,KAAM,IAAA,EAAM;AAC1B,QAAA,MAAA,CAAO,OAAO,GAAG,CAAA;AAAA,MACrB;AAAA,IACJ,CAAC,CAAA;AAED,IAAA,OAAO,OAAA;AAAA,EACX;AAEA,EAAA,OAAO;AAAA,IACH,OAAA;AAAA,IACA,IAAI,IAAA,GAAO;AACP,MAAA,OAAO,MAAA,CAAO,IAAA;AAAA,IAClB;AAAA,GACJ;AACJ;;;ACnCO,SAAS,oBAAoB,KAAA,EAAgD;AAChF,EAAA,IAAI,CAAC,OAAO,OAAO,IAAA;AAEnB,EAAA,OAAO,KAAA,CAAM,YAAY,KAAA,CAAM,MAAA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U,EAAA,EAAI,OAAO,IAAA;AACzC,EAAA,IAAI,KAAA,KAAU,GAAG,OAAO,GAAA;AACxB,EAAA,IAAI,KAAA,IAAS,CAAA,IAAK,KAAA,IAAS,CAAA,EAAG,OAAO,GAAA;AAErC,EAAA,OAAO,IAAA;AACX;ACfO,SAAS,kBAAA,CAAmB,GAAY,QAAA,EAA0B;AACrE,EAAA,IAAI,CAAA,YAAa,UAAA,IAAc,CAAA,CAAE,GAAA,EAAK,OAAA,EAAS;AAC3C,IAAA,OAAO,EAAE,GAAA,CAAI,OAAA;AAAA,EACjB;AAEA,EAAA,OAAO,QAAA;AACX;AAGO,SAAS,kBAAkB,CAAA,EAA6C;AAC3E,EAAA,IAAI,CAAA,YAAa,UAAA,IAAc,CAAA,CAAE,GAAA,EAAK,MAAM,MAAA,EAAQ;AAChD,IAAA,OAAO,CAAA,CAAE,IAAI,IAAA,CAAK,MAAA;AAAA,EACtB;AAEA,EAAA,OAAO,IAAA;AACX;;;ACdO,SAAS,sBAAsB,GAAA,EAAqB;AACvD,EAAA,MAAM,KAAA,GAAQ,GAAA,CAAI,KAAA,CAAM,sBAAsB,CAAA;AAE9C,EAAA,OAAO,KAAA,GAAQ,GAAG,KAAA,CAAM,CAAC,CAAC,CAAA,EAAA,EAAK,KAAA,CAAM,CAAC,CAAC,CAAA,CAAA,GAAK,GAAA;AAChD","file":"chunk-GXDTRTUT.js","sourcesContent":["// Serializes async operations by key: for each key, the next operation\n// only starts after the previous one finishes. Prevents races when\n// concurrent calls target the same resource.\n\nexport interface OperationChain {\n execute: (key: string, fn: () => Promise<void>) => Promise<void>\n readonly size: number\n}\n\nexport function createOperationChain(): OperationChain {\n const chains = new Map<string, Promise<void>>()\n\n async function execute(key: string, fn: () => Promise<void>): Promise<void> {\n const prev = chains.get(key) ?? Promise.resolve()\n\n const current = prev.then(fn)\n\n // Prevents an unhandled rejection from propagating through the chain\n const safe = current.catch(() => {})\n chains.set(key, safe)\n\n // Drop the entry once nothing else chained onto it after it settled\n safe.finally(() => {\n if (chains.get(key) === safe) {\n chains.delete(key)\n }\n })\n\n return current\n }\n\n return {\n execute,\n get size() {\n return chains.size\n },\n }\n}\n","import type { Phone } from '@zenky/storefront-api'\n\nexport function formatPhoneNational(phone: Phone | null | undefined): string | null {\n if (!phone) return null\n\n return phone.national || phone.number\n}\n\nexport function getPhoneTelLink(phone: Phone | null | undefined): string | null {\n if (!phone) return null\n\n return `tel:${phone.number}`\n}\n\n/**\n * Loose-spaced phone format: `+7 (999) 999-99-99` → `+7 999 999 99 99`.\n * Parens and dashes become spaces, repeated spaces collapse to one.\n */\nexport function formatPhoneSpaced(formatted: string | null | undefined): string {\n if (!formatted) return ''\n\n return formatted.replace(/[()-]/g, ' ').replace(/\\s+/g, ' ').trim()\n}\n","import { ContactType } from '@zenky/storefront-api'\n\nimport type { Contact } from '@zenky/storefront-api'\n\nexport interface SocialLink {\n type: ContactType\n url: string\n label: string\n}\n\nconst SOCIAL_TYPES = new Set<ContactType>([\n ContactType.Vk,\n ContactType.Instagram,\n ContactType.Facebook,\n ContactType.Twitter,\n ContactType.Ok,\n ContactType.Tiktok,\n ContactType.Telegram,\n ContactType.Max,\n])\n\nconst SOCIAL_LABELS: Record<string, string> = {\n [ContactType.Vk]: 'ВКонтакте',\n [ContactType.Instagram]: 'Instagram',\n [ContactType.Facebook]: 'Facebook',\n [ContactType.Twitter]: 'Twitter',\n [ContactType.Ok]: 'Одноклассники',\n [ContactType.Tiktok]: 'TikTok',\n [ContactType.Telegram]: 'Telegram',\n [ContactType.Max]: 'Max',\n} as const\n\nfunction buildSocialUrl(type: ContactType, value: string): string {\n if (value.startsWith('http://') || value.startsWith('https://')) {\n return value\n }\n\n const bases: Partial<Record<ContactType, string>> = {\n [ContactType.Vk]: 'https://vk.com/',\n [ContactType.Instagram]: 'https://instagram.com/',\n [ContactType.Facebook]: 'https://facebook.com/',\n [ContactType.Twitter]: 'https://x.com/',\n [ContactType.Ok]: 'https://ok.ru/',\n [ContactType.Tiktok]: 'https://tiktok.com/@',\n [ContactType.Telegram]: 'https://t.me/',\n [ContactType.Max]: 'https://max.ru/',\n }\n\n const base = bases[type]\n\n return base ? `${base}${value}` : value\n}\n\nexport function getSocialLinks(contacts: Contact[]): SocialLink[] {\n return contacts\n .filter((contact) => SOCIAL_TYPES.has(contact.type))\n .map((contact) => ({\n type: contact.type,\n url: buildSocialUrl(contact.type, contact.value),\n label: SOCIAL_LABELS[contact.type] ?? contact.type,\n }))\n}\n\nexport function getEmailLink(contacts: Contact[]): string | null {\n const email = contacts.find((c) => c.type === ContactType.Email)\n\n return email?.value ?? null\n}\n\nexport function getWebsiteLink(contacts: Contact[]): string | null {\n const website = contacts.find((c) => c.type === ContactType.Website)\n\n return website?.value ?? null\n}\n","import type { Schedule } from '@zenky/storefront-api'\n\nexport interface DayScheduleInfo {\n dayKey: string\n name: string\n hours: string | null\n}\n\nexport interface TodayScheduleInfo {\n isOpenNow: boolean\n todayHours: string | null\n openingAt: string | null\n closingAt: string | null\n}\n\n// API day key → JS day index (0=Sun, 1=Mon, ..., 6=Sat)\nconst DAY_TO_JS_INDEX: Record<string, number> = {\n sunday: 0,\n monday: 1,\n tuesday: 2,\n wednesday: 3,\n thursday: 4,\n friday: 5,\n saturday: 6,\n} as const\n\nconst DAY_ORDER = [\n 'monday',\n 'tuesday',\n 'wednesday',\n 'thursday',\n 'friday',\n 'saturday',\n 'sunday',\n] as const\n\n// Reference date: January 2, 2000 is a Sunday (JS index 0).\n// For dayIndex=0 (Sun) add 0, for 1 (Mon) add 1, and so on.\nfunction getDayName(dayKey: string, locale: string): string {\n const index = DAY_TO_JS_INDEX[dayKey]\n\n if (index === undefined) {\n return dayKey\n }\n\n const date = new Date(2000, 0, 2 + index)\n\n return new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(date)\n}\n\ninterface StatusLabels {\n open: string\n closed: string\n}\n\nconst DEFAULT_STATUS_LABELS: StatusLabels = { open: 'Открыто', closed: 'Закрыто' }\n\nconst STATUS_LABELS: Record<string, StatusLabels> = {\n 'ru-RU': DEFAULT_STATUS_LABELS,\n 'en-US': { open: 'Open', closed: 'Closed' },\n}\n\nexport function getTodayInfo(schedule: Schedule | null | undefined): TodayScheduleInfo | null {\n if (!schedule) return null\n\n const todayDay = schedule.days[schedule.day_id as keyof typeof schedule.days]\n\n return {\n isOpenNow: schedule.is_open_now,\n todayHours: todayDay?.hours ?? null,\n openingAt: schedule.opening_at,\n closingAt: schedule.closing_at,\n }\n}\n\nexport function getWeeklySchedule(\n schedule: Schedule | null | undefined,\n locale = 'ru-RU'\n): DayScheduleInfo[] {\n if (!schedule) return []\n\n return DAY_ORDER.map((dayKey) => ({\n dayKey,\n name: getDayName(dayKey, locale),\n hours: schedule.days[dayKey]?.hours ?? null,\n }))\n}\n\nexport function formatScheduleStatus(\n schedule: Schedule | null | undefined,\n locale = 'ru-RU'\n): string | null {\n if (!schedule) return null\n\n const labels = STATUS_LABELS[locale] ?? DEFAULT_STATUS_LABELS\n\n return schedule.is_open_now ? labels.open : labels.closed\n}\n","/**\n * Builds a QR code image URL through the Zenky media API.\n *\n * The content is base64-encoded and passed in the `content` query param.\n * This implementation doesn't depend on `window`, `btoa`, or Node's `Buffer`,\n * so the same code works in the browser, Node SSR, and edge runtimes.\n */\nexport function buildQrCodeUrl(target: string, apiBaseUrl: string, size = 200): string {\n if (!target) return ''\n\n const utf8 = encodeBase64(new TextEncoder().encode(target))\n\n return `${apiBaseUrl}/media/qrcode?content=${utf8}&input=base64&size=${size}`\n}\n\nconst BASE64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n\nfunction encodeBase64(bytes: Uint8Array): string {\n let output = ''\n\n for (let index = 0; index < bytes.length; index += 3) {\n const first = bytes[index] ?? 0\n const second = bytes[index + 1]\n const third = bytes[index + 2]\n const group = (first << 16) | ((second ?? 0) << 8) | (third ?? 0)\n\n output += BASE64_ALPHABET[(group >> 18) & 63]\n output += BASE64_ALPHABET[(group >> 12) & 63]\n output += second === undefined ? '=' : BASE64_ALPHABET[(group >> 6) & 63]\n output += third === undefined ? '=' : BASE64_ALPHABET[group & 63]\n }\n\n return output\n}\n","export function formatDate(date: string): string {\n return new Date(date).toLocaleDateString('ru-RU', {\n day: 'numeric',\n month: 'long',\n year: 'numeric',\n })\n}\n\nexport function formatDateTime(date: string): string {\n const d = new Date(date)\n const datePart = d.toLocaleDateString('ru-RU', {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric',\n })\n const timePart = d.toLocaleTimeString('ru-RU', {\n hour: '2-digit',\n minute: '2-digit',\n })\n return `${datePart} ${timePart}`\n}\n\n/**\n * Extracts YYYY-MM-DD from an ISO string (e.g. \"1998-06-02T03:00:00+03:00\" → \"1998-06-02\").\n * For use in `<input type=\"date\">`.\n */\nexport function toDateInputValue(value: string | null): string {\n if (!value) return ''\n return value.slice(0, 10)\n}\n\n/**\n * Today's date in the given timezone, as YYYY-MM-DD.\n * Falls back to the browser's local timezone if `timezone` is invalid or omitted.\n *\n * Use this to match \"today\" against a backend date that's relative to the\n * store's timezone, not the user's.\n */\nexport function todayInTimezone(timezone?: string | null): string {\n const now = new Date()\n\n const options: Intl.DateTimeFormatOptions = {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n }\n\n // Only set timeZone when it's given: under exactOptionalPropertyTypes,\n // an optional property can't be assigned undefined.\n if (timezone) {\n options.timeZone = timezone\n }\n\n try {\n return new Intl.DateTimeFormat('en-CA', options).format(now)\n } catch {\n // Invalid timezone — fall back to the local one\n return new Intl.DateTimeFormat('en-CA').format(now)\n }\n}\n","/**\n * Noun declension by count, for Russian grammar (one/few/many forms).\n *\n * @example\n * pluralize(1, 'позиция', 'позиции', 'позиций') // 'позиция'\n * pluralize(3, 'позиция', 'позиции', 'позиций') // 'позиции'\n * pluralize(5, 'позиция', 'позиции', 'позиций') // 'позиций'\n */\nexport function pluralize(count: number, one: string, few: string, many: string): string {\n const abs = Math.abs(count)\n const mod10 = abs % 10\n const mod100 = abs % 100\n\n if (mod100 >= 11 && mod100 <= 19) return many\n if (mod10 === 1) return one\n if (mod10 >= 2 && mod10 <= 4) return few\n\n return many\n}\n","import { ZenkyError } from '@zenky/storefront-api'\n\n/** The message from a ZenkyError, or a fallback. */\nexport function getApiErrorMessage(e: unknown, fallback: string): string {\n if (e instanceof ZenkyError && e.err?.message) {\n return e.err.message\n }\n\n return fallback\n}\n\n/** Field-level errors from an API response's `meta.errors` (422 validation). */\nexport function getApiFieldErrors(e: unknown): Record<string, string[]> | null {\n if (e instanceof ZenkyError && e.err?.meta?.errors) {\n return e.err.meta.errors as Record<string, string[]>\n }\n\n return null\n}\n","/**\n * Moves the city to the end of an address string.\n * \"г Улан-Удэ, ул Ленина, д 29\" → \"ул Ленина, д 29, г Улан-Удэ\"\n */\nexport function formatAddressCityLast(raw: string): string {\n const match = raw.match(/^(г\\s[^,]+),\\s*(.+)$/)\n\n return match ? `${match[2]}, ${match[1]}` : raw\n}\n"]}
@@ -32,5 +32,5 @@ var useCatalogStore = defineStore("zenky-catalog", () => {
32
32
  });
33
33
 
34
34
  export { useCatalogStore };
35
- //# sourceMappingURL=chunk-Z3IW4ODZ.js.map
36
- //# sourceMappingURL=chunk-Z3IW4ODZ.js.map
35
+ //# sourceMappingURL=chunk-NSOIL7PW.js.map
36
+ //# sourceMappingURL=chunk-NSOIL7PW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/stores/catalog.ts"],"names":[],"mappings":";;;;AAsBO,IAAM,eAAA,GAAkB,WAAA,CAAY,eAAA,EAAiB,MAAoB;AAC5E,EAAA,MAAM,OAAA,GAAU,GAAA,CAAyB,EAAE,CAAA;AAC3C,EAAA,MAAM,WAAA,GAAc,IAAmB,IAAI,CAAA;AAC3C,EAAA,MAAM,SAAA,GAAY,IAAI,KAAK,CAAA;AAC3B,EAAA,MAAM,SAAA,GAAY,IAAI,KAAK,CAAA;AAE3B,EAAA,SAAS,WAAA,CAAY,OAA4B,IAAA,EAA4B;AACzE,IAAA,OAAA,CAAQ,KAAA,GAAQ,KAAA;AAChB,IAAA,WAAA,CAAY,QAAQ,IAAA,IAAQ,IAAA;AAC5B,IAAA,SAAA,CAAU,KAAA,GAAQ,KAAA;AAAA,EACtB;AAEA,EAAA,SAAS,YAAA,GAAqB;AAC1B,IAAA,SAAA,CAAU,KAAA,GAAQ,IAAA;AAAA,EACtB;AAEA,EAAA,SAAS,aAAa,KAAA,EAAsB;AACxC,IAAA,SAAA,CAAU,KAAA,GAAQ,KAAA;AAAA,EACtB;AAEA,EAAA,MAAM,aAAa,QAAA,CAAS,MAAM,OAAA,CAAQ,KAAA,CAAM,SAAS,CAAC,CAAA;AAE1D,EAAA,OAAO;AAAA,IACH,OAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA,GACJ;AACJ,CAAC","file":"chunk-NSOIL7PW.js","sourcesContent":["import { defineStore } from 'pinia'\nimport { computed, ref, type ComputedRef, type Ref } from 'vue'\n\nimport type { StaticCatalogItem } from '../catalog/catalogEntity'\n\n// Explicit return type (not inferred): otherwise Pinia's inference structurally\n// expands the SDK types in the .d.ts and bloats it. This also satisfies the\n// \"explicit return types\" rule.\nexport interface CatalogStore {\n catalog: Ref<StaticCatalogItem[]>\n currentHash: Ref<string | null>\n reloading: Ref<boolean>\n loadError: Ref<boolean>\n initCatalog: (items: StaticCatalogItem[], hash?: string | null) => void\n setLoadError: () => void\n setReloading: (value: boolean) => void\n hasCatalog: ComputedRef<boolean>\n}\n\n// Setup store (doc 05): id prefixed with zenky-* to avoid colliding with the\n// consumer's own stores. A plain state container — API calls and cookies live in\n// the composables/bootstrap layer, which calls these actions.\nexport const useCatalogStore = defineStore('zenky-catalog', (): CatalogStore => {\n const catalog = ref<StaticCatalogItem[]>([])\n const currentHash = ref<string | null>(null)\n const reloading = ref(false)\n const loadError = ref(false)\n\n function initCatalog(items: StaticCatalogItem[], hash?: string | null): void {\n catalog.value = items\n currentHash.value = hash ?? null\n loadError.value = false\n }\n\n function setLoadError(): void {\n loadError.value = true\n }\n\n function setReloading(value: boolean): void {\n reloading.value = value\n }\n\n const hasCatalog = computed(() => catalog.value.length > 0)\n\n return {\n catalog,\n currentHash,\n reloading,\n loadError,\n initCatalog,\n setLoadError,\n setReloading,\n hasCatalog,\n }\n})\n"]}
@@ -78,6 +78,22 @@ function groupProductsBySubcategory(rootCategory, products) {
78
78
  return { rootDirect, groups };
79
79
  }
80
80
 
81
+ // src/catalog/catalogEntity.ts
82
+ function catalogItemEntity(item) {
83
+ const collection = item.products_collection ?? item.collection ?? null;
84
+ if (collection?.id) {
85
+ return { kind: "collection", id: collection.id, name: collection.name ?? "", collection };
86
+ }
87
+ const category = item.category ?? null;
88
+ if (category?.id) {
89
+ return { kind: "category", id: category.id, name: category.name ?? "", category };
90
+ }
91
+ return null;
92
+ }
93
+ function isRenderableCatalogItem(item) {
94
+ return catalogItemEntity(item) !== null && (item.products?.length ?? 0) > 0;
95
+ }
96
+
81
97
  // src/catalog/useCollections.ts
82
98
  function useCollections(sdk) {
83
99
  async function loadCollections(storeId, request) {
@@ -87,6 +103,6 @@ function useCollections(sdk) {
87
103
  return { loadCollections };
88
104
  }
89
105
 
90
- export { collectDescendantIds, findCategoryById, findCategoryByShortId, findRootAncestor, getCategoryPath, groupProductsBySubcategory, useCollections };
91
- //# sourceMappingURL=chunk-NG7RUIWW.js.map
92
- //# sourceMappingURL=chunk-NG7RUIWW.js.map
106
+ export { catalogItemEntity, collectDescendantIds, findCategoryById, findCategoryByShortId, findRootAncestor, getCategoryPath, groupProductsBySubcategory, isRenderableCatalogItem, useCollections };
107
+ //# sourceMappingURL=chunk-OBNMXLJO.js.map
108
+ //# sourceMappingURL=chunk-OBNMXLJO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/catalog/findCategory.ts","../src/catalog/groupBySubcategory.ts","../src/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Y,MAAA,EAAO;AAChC;;;AChCO,SAAS,kBAAkB,IAAA,EAA+C;AAG7E,EAAA,MAAM,UAAA,GAAa,IAAA,CAAK,mBAAA,IAAuB,IAAA,CAAK,UAAA,IAAc,IAAA;AAClE,EAAA,IAAI,YAAY,EAAA,EAAI;AAChB,IAAA,OAAO,EAAE,IAAA,EAAM,YAAA,EAAc,EAAA,EAAI,UAAA,CAAW,IAAI,IAAA,EAAM,UAAA,CAAW,IAAA,IAAQ,EAAA,EAAI,UAAA,EAAW;AAAA,EAC5F;AAEA,EAAA,MAAM,QAAA,GAAW,KAAK,QAAA,IAAY,IAAA;AAClC,EAAA,IAAI,UAAU,EAAA,EAAI;AACd,IAAA,OAAO,EAAE,IAAA,EAAM,UAAA,EAAY,EAAA,EAAI,QAAA,CAAS,IAAI,IAAA,EAAM,QAAA,CAAS,IAAA,IAAQ,EAAA,EAAI,QAAA,EAAS;AAAA,EACpF;AAEA,EAAA,OAAO,IAAA;AACX;AAGO,SAAS,wBAAwB,IAAA,EAAkC;AACtE,EAAA,OAAO,kBAAkB,IAAI,CAAA,KAAM,SAAS,IAAA,CAAK,QAAA,EAAU,UAAU,CAAA,IAAK,CAAA;AAC9E;;;AC9CO,SAAS,eAAe,GAAA,EAK7B;AACE,EAAA,eAAe,eAAA,CACX,SACA,OAAA,EAC6B;AAC7B,IAAA,MAAM,WAAW,MAAM,GAAA,CAAI,WAAA,CAAY,cAAA,CAAe,SAAS,OAAO,CAAA;AACtE,IAAA,OAAO,QAAA,CAAS,KAAA;AAAA,EACpB;AAEA,EAAA,OAAO,EAAE,eAAA,EAAgB;AAC7B","file":"chunk-OBNMXLJO.js","sourcesContent":["import type { NestedCategory } from '@zenky/storefront-api'\n\n/**\n * Recursively searches the category tree by `short_id`.\n *\n * `NestedCategory[]` is a tree: root categories at the top level, nested ones\n * inside `children[]`. A plain `tree.find()` only reaches root categories, so\n * nested ones (e.g. \"Jackets\" inside \"Men\" inside \"Clothing\") need a recursive walk.\n *\n * Returns the first match (DFS pre-order).\n */\nexport function findCategoryByShortId(\n tree: NestedCategory[],\n shortId: string\n): NestedCategory | null {\n for (const cat of tree) {\n if (cat.short_id === shortId) return cat\n if (cat.children && cat.children.length > 0) {\n const found = findCategoryByShortId(cat.children, shortId)\n if (found) return found\n }\n }\n return null\n}\n\n/**\n * Finds a category's root ancestor by `parent_id`.\n *\n * For nested \"Jackets\" (parent: \"Men\"), returns \"Clothing\" (the root of the branch).\n * For root \"Clothing\", returns itself.\n *\n * Used in `CategoryTabs` to highlight the root tab when the user is on a nested category.\n */\nexport function findRootAncestor(\n tree: NestedCategory[],\n category: NestedCategory\n): NestedCategory | null {\n if (!category.parent_id) {\n // Already root — return the tree's own node if present, else the argument itself\n return tree.find((c) => c.id === category.id) ?? category\n }\n\n const parent = findCategoryById(tree, category.parent_id)\n if (!parent) return null\n return findRootAncestor(tree, parent)\n}\n\n/** Recursive search by `id` (not `short_id`). Used by findRootAncestor. */\nexport function findCategoryById(tree: NestedCategory[], id: string): NestedCategory | null {\n for (const cat of tree) {\n if (cat.id === id) return cat\n if (cat.children && cat.children.length > 0) {\n const found = findCategoryById(cat.children, id)\n if (found) return found\n }\n }\n return null\n}\n\n/**\n * Returns the path from the root category down to the target (inclusive).\n *\n * Example for \"Jackets\" in the branch \"Clothing → Men → Jackets\":\n * → [Clothing, Men, Jackets]\n *\n * Used to build breadcrumbs.\n */\nexport function getCategoryPath(tree: NestedCategory[], target: NestedCategory): NestedCategory[] {\n const path: NestedCategory[] = []\n let current: NestedCategory | null = target\n\n while (current) {\n path.unshift(current)\n if (!current.parent_id) break\n current = findCategoryById(tree, current.parent_id)\n }\n\n return path\n}\n","import type { NestedCategory, Product } from '@zenky/storefront-api'\n\nexport interface SubcategoryGroup {\n category: NestedCategory\n products: Product[]\n}\n\nexport interface GroupedProducts {\n rootDirect: Product[]\n groups: SubcategoryGroup[]\n}\n\nexport function collectDescendantIds(category: NestedCategory): string[] {\n const ids = [category.id]\n for (const child of category.children ?? []) ids.push(...collectDescendantIds(child))\n return ids\n}\n\nfunction productCategoryIds(product: Product): string[] {\n const categories = (product as unknown as { categories?: Array<{ id: string }> }).categories\n return categories?.map((c) => c.id) ?? []\n}\n\n/**\n * Products of the subtree in tree order (DFS): the category's own products first\n * (in catalog order), then child categories' products recursively.\n * Duplicates (a product in multiple categories) are dropped, keeping the first occurrence.\n */\nfunction collectSubtreeProducts(\n category: NestedCategory,\n products: Product[],\n order: Map<string, number>\n): Product[] {\n const seen = new Set<string>()\n const out: Product[] = []\n\n const pushUnique = (list: Product[]): void => {\n for (const p of list) {\n if (!seen.has(p.id)) {\n seen.add(p.id)\n out.push(p)\n }\n }\n }\n\n pushUnique(\n products\n .filter((p) => productCategoryIds(p).includes(category.id))\n .sort((a, b) => (order.get(a.id) ?? 0) - (order.get(b.id) ?? 0))\n )\n for (const child of category.children ?? []) {\n pushUnique(collectSubtreeProducts(child, products, order))\n }\n\n return out\n}\n\nexport function groupProductsBySubcategory(\n rootCategory: NestedCategory,\n products: Product[]\n): GroupedProducts {\n const order = new Map(products.map((p, i) => [p.id, i]))\n\n const rootDirect = products.filter((p) => productCategoryIds(p).includes(rootCategory.id))\n\n const groups: SubcategoryGroup[] = []\n for (const child of rootCategory.children ?? []) {\n const groupProducts = collectSubtreeProducts(child, products, order)\n if (groupProducts.length > 0) groups.push({ category: child, products: groupProducts })\n }\n\n return { rootDirect, groups }\n}\n","import type {\n CatalogItem,\n Category,\n ProductsCollection,\n RemoteCatalog,\n} from '@zenky/storefront-api'\n\n/**\n * Static catalog item. `@zenky/storefront-api@1.0.2` predates manual catalogs: it\n * spells the collection `collection` and types `type` as `'category' | 'collection'`,\n * while the payload uses `products_collection`. Both spellings are declared here, and\n * the fields are re-declared rather than inherited so a later SDK release that adds\n * them cannot conflict with this narrowing.\n */\nexport interface StaticCatalogItem\n extends Omit<CatalogItem, 'type' | 'collection' | 'products_collection'> {\n type: 'category' | 'collection' | 'products_collection'\n collection?: ProductsCollection | null\n products_collection?: ProductsCollection | null\n}\n\n/**\n * Store profile catalog entry. `catalog_id` is filled for manual catalogs only, and\n * is optional because the SDK type omits it — test it with `!= null`, since `undefined`\n * means \"SDK-typed value\", not \"automatic catalog\".\n */\nexport interface StaticRemoteCatalog extends Omit<RemoteCatalog, 'catalog_id'> {\n catalog_id?: string | null\n}\n\n/** What a catalog section represents; `id` and `name` are lifted so callers needn't branch. */\nexport type CatalogEntity =\n | { kind: 'category'; id: string; name: string; category: Category }\n | { kind: 'collection'; id: string; name: string; collection: ProductsCollection }\n\n/**\n * Resolve what a catalog section is about, or null for a malformed item. Keyed off\n * which entity object is present, not off `type`: the payload and the SDK type\n * disagree on the discriminator's value, but presence holds under both.\n */\nexport function catalogItemEntity(item: StaticCatalogItem): CatalogEntity | null {\n // An id is part of being well-formed: consumers key sections on it, and two\n // sections sharing a blank id would collapse onto one key.\n const collection = item.products_collection ?? item.collection ?? null\n if (collection?.id) {\n return { kind: 'collection', id: collection.id, name: collection.name ?? '', collection }\n }\n\n const category = item.category ?? null\n if (category?.id) {\n return { kind: 'category', id: category.id, name: category.name ?? '', category }\n }\n\n return null\n}\n\n/** Sections worth rendering: a known entity and at least one product. */\nexport function isRenderableCatalogItem(item: StaticCatalogItem): boolean {\n return catalogItemEntity(item) !== null && (item.products?.length ?? 0) > 0\n}\n","import type {\n CollectionsListRequest,\n ProductsCollection,\n ZenkyStorefront,\n} from '@zenky/storefront-api'\n\n/**\n * Pure composable — the SDK is passed in as a parameter (DI), no Nuxt needed.\n *\n * NOTE: the storefront API has no single `getCollection(id)`; use\n * `GET /products?collection_id=...` to get a collection's products.\n * To get a collection's metadata, look it up in the list via `loadCollections`.\n */\nexport function useCollections(sdk: ZenkyStorefront): {\n loadCollections: (\n storeId: string,\n request?: CollectionsListRequest\n ) => Promise<ProductsCollection[]>\n} {\n async function loadCollections(\n storeId: string,\n request?: CollectionsListRequest\n ): Promise<ProductsCollection[]> {\n const response = await sdk.collections.getCollections(storeId, request)\n return response.items\n }\n\n return { loadCollections }\n}\n"]}
@@ -92,7 +92,9 @@ var useAuthStore = defineStore("zenky-auth", () => {
92
92
  const phone = ref(null);
93
93
  const countryCode = ref("RU");
94
94
  const isAuthenticated = computed(() => token.value !== null && token.value !== "");
95
- const apiToken = computed(() => isAuthenticated.value ? token.value ?? void 0 : void 0);
95
+ const apiToken = computed(
96
+ () => isAuthenticated.value ? token.value ?? void 0 : void 0
97
+ );
96
98
  const initials = computed(() => {
97
99
  if (!phone.value) return "?";
98
100
  return phone.value.replace(/\D/g, "").slice(-4);
@@ -133,5 +135,5 @@ var useAuthStore = defineStore("zenky-auth", () => {
133
135
  });
134
136
 
135
137
  export { createStorefront, provideStorefront, useAuthStore, useRuntime, useStoreProfileStore };
136
- //# sourceMappingURL=chunk-VFMVQR6Y.js.map
137
- //# sourceMappingURL=chunk-VFMVQR6Y.js.map
138
+ //# sourceMappingURL=chunk-QZ3S3NN3.js.map
139
+ //# sourceMappingURL=chunk-QZ3S3NN3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ports/runtime.ts","../src/stores/store-profile.ts","../src/stores/auth.ts"],"names":["defineStore","ref","computed"],"mappings":";;;;AAOA,IAAM,WAAA,mBAAc,MAAA,CAAO,GAAA,CAAI,0BAA0B,CAAA;AAMzD,IAAM,cAAA,GAAiB;AAAA,EACnB,KAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA;AACJ,CAAA;AAQA,SAAS,oBAAoB,OAAA,EAAkC;AAC3D,EAAA,MAAM,OAAA,GAAU,eAAe,MAAA,CAAO,CAAC,SAAS,OAAA,CAAQ,IAAI,KAAK,IAAI,CAAA;AACrE,EAAA,IAAI,OAAA,CAAQ,SAAS,CAAA,EAAG;AACpB,IAAA,MAAM,IAAI,KAAA;AAAA,MACN,CAAA,2DAAA,EAA8D,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAC,CAAA,4CAAA;AAAA,KAEpF;AAAA,EACJ;AACJ;AAGO,SA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AA,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-QZ3S3NN3.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 type { City, NestedCategory, Stock, Store } from '@zenky/storefront-api'\n\nimport type { Website } from '../website-settings'\n\n// Named return type (the dts rule) — otherwise Pinia's inference would expand the SDK types in the .d.ts.\nexport interface StoreProfileStore {\n store: Ref<Store | null>\n city: Ref<City | null>\n stock: Ref<Stock | null>\n categories: Ref<NestedCategory[]>\n website: Ref<Website | null>\n initStore: (store: Store, city: City, stock: Stock | null) => void\n setStock: (stock: Stock | null) => void\n setCategories: (categories: NestedCategory[]) => void\n initWebsite: (website: Website | null) => void\n isReady: ComputedRef<boolean>\n hasStock: ComputedRef<boolean>\n currency: ComputedRef<string>\n squareLogoUrl: ComputedRef<string | null>\n}\n\nexport const useStoreProfileStore = defineStore('zenky-store-profile', (): StoreProfileStore => {\n const store = ref<Store | null>(null)\n const city = ref<City | null>(null)\n const stock = ref<Stock | null>(null)\n const categories = ref<NestedCategory[]>([])\n const website = ref<Website | null>(null)\n\n function initStore(newStore: Store, newCity: City, newStock: Stock | null): void {\n store.value = newStore\n city.value = newCity\n stock.value = newStock\n }\n\n function setStock(newStock: Stock | null): void {\n stock.value = newStock\n }\n\n function setCategories(newCategories: NestedCategory[]): void {\n categories.value = newCategories\n }\n\n function initWebsite(newWebsite: Website | null): void {\n website.value = newWebsite\n }\n\n const isReady = computed(() => store.value !== null && city.value !== null)\n const hasStock = computed(() => stock.value !== null)\n const currency = computed<string>(() => store.value?.settings?.currency ?? 'RUB')\n\n const squareLogoUrl = computed<string | null>(() => {\n const logo = store.value?.square_logo ?? store.value?.logo\n if (!logo) return null\n\n return (\n logo.hd?.url ??\n logo.xlarge?.url ??\n logo.large?.url ??\n logo.medium?.url ??\n logo.placeholder?.url ??\n null\n )\n })\n\n return {\n store,\n city,\n stock,\n categories,\n website,\n initStore,\n setStock,\n setCategories,\n initWebsite,\n isReady,\n hasStock,\n currency,\n squareLogoUrl,\n }\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"]}
@@ -1,4 +1,4 @@
1
- import { useRuntime } from './chunk-VFMVQR6Y.js';
1
+ import { useRuntime } from './chunk-QZ3S3NN3.js';
2
2
  import { DeliveryMethod, PaymentMethod } from '@zenky/storefront-api';
3
3
  import { defineStore } from 'pinia';
4
4
  import { ref, computed } from 'vue';
@@ -426,5 +426,5 @@ var usePromotionsStore = defineStore("zenky-promotions", () => {
426
426
  });
427
427
 
428
428
  export { useCartStore, useOrderSettingsStore, usePromotionsStore };
429
- //# sourceMappingURL=chunk-Z247QRDJ.js.map
430
- //# sourceMappingURL=chunk-Z247QRDJ.js.map
429
+ //# sourceMappingURL=chunk-XULHV6SS.js.map
430
+ //# sourceMappingURL=chunk-XULHV6SS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/stores/order-settings.ts","../src/stores/cart.ts","../src/stores/promotions.ts"],"names":["defineStore","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CAAA,KAAM,CAAA,CAAE,OAAA,KAAY,IAAI,CAAC,CAAA;AAEnF,EAAA,OAAO;AAAA,IACH,OAAA;AAAA,IACA,QAAA;AAAA,IACA,iBAAA;AAAA,IACA,uBAAA;AAAA,IACA,YAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA;AAAA,IACA,eAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,GACJ;AACJ,CAAC","file":"chunk-XULHV6SS.js","sourcesContent":["import { DeliveryMethod } from '@zenky/storefront-api'\nimport { defineStore } from 'pinia'\nimport { computed, ref, type ComputedRef, type Ref } from 'vue'\n\nimport type { City, Stock } from '@zenky/storefront-api'\n\nimport { useRuntime } from '../ports/runtime'\n\n// Keys match the old CookieKey.* — so saved settings aren't lost.\nconst KEY_DELIVERY_METHOD = 'zenky_delivery_method'\nconst KEY_ON_PREMISE_TABLE = 'zenky_on_premise_table'\nconst KEY_SELECTED_STOCK_ID = 'zenky_selected_stock_id'\nconst KEY_SELECTED_ADDRESS = 'zenky_selected_address'\nconst KEY_SELECTED_ADDRESS_ID = 'zenky_selected_address_id'\nconst KEY_SELECTED_ADDRESS_NAME = 'zenky_selected_address_name'\n\nconst VALID_DELIVERY_METHODS = new Set<string>(Object.values(DeliveryMethod))\n\nexport interface OrderSettingsStore {\n deliveryMethod: Ref<DeliveryMethod>\n onPremiseTable: Ref<string | null>\n selectedStock: Ref<Stock | null>\n selectedAddress: Ref<string | null>\n selectedAddressId: Ref<string | null>\n selectedAddressName: Ref<string | null>\n setDeliveryMethod: (method: DeliveryMethod) => void\n setOnPremiseTable: (table: string | null) => void\n setSelectedStock: (stock: Stock | null) => void\n setSelectedAddress: (\n address: string | null,\n addressId?: string | null,\n addressName?: string | null\n ) => void\n validateDeliveryMethod: (availableMethods: DeliveryMethod[]) => void\n restoreFromCookies: (city: City) => void\n isDelivery: ComputedRef<boolean>\n isPickup: ComputedRef<boolean>\n isOnPremise: ComputedRef<boolean>\n needsAddress: ComputedRef<boolean>\n needsStock: ComputedRef<boolean>\n needsTable: ComputedRef<boolean>\n}\n\nexport const useOrderSettingsStore = defineStore('zenky-order-settings', (): OrderSettingsStore => {\n const { storage } = useRuntime()\n\n const deliveryMethod = ref<DeliveryMethod>(DeliveryMethod.Delivery)\n const onPremiseTable = ref<string | null>(null)\n const selectedStock = ref<Stock | null>(null)\n const selectedAddress = ref<string | null>(null)\n const selectedAddressId = ref<string | null>(null)\n const selectedAddressName = ref<string | null>(null)\n\n function setDeliveryMethod(method: DeliveryMethod): void {\n deliveryMethod.value = method\n storage.set(KEY_DELIVERY_METHOD, method)\n }\n\n function setOnPremiseTable(table: string | null): void {\n onPremiseTable.value = table\n if (table) storage.set(KEY_ON_PREMISE_TABLE, table)\n else storage.remove(KEY_ON_PREMISE_TABLE)\n }\n\n function setSelectedStock(stock: Stock | null): void {\n selectedStock.value = stock\n if (stock) storage.set(KEY_SELECTED_STOCK_ID, stock.id)\n else storage.remove(KEY_SELECTED_STOCK_ID)\n }\n\n function setSelectedAddress(\n address: string | null,\n addressId?: string | null,\n addressName?: string | null\n ): void {\n selectedAddress.value = address\n selectedAddressId.value = addressId ?? null\n selectedAddressName.value = addressName ?? null\n writeOrRemove(KEY_SELECTED_ADDRESS, address)\n writeOrRemove(KEY_SELECTED_ADDRESS_ID, addressId ?? null)\n writeOrRemove(KEY_SELECTED_ADDRESS_NAME, addressName ?? null)\n }\n\n function writeOrRemove(key: string, value: string | null): void {\n if (value) storage.set(key, value)\n else storage.remove(key)\n }\n\n function validateDeliveryMethod(availableMethods: DeliveryMethod[]): void {\n const first = availableMethods[0]\n if (!first) return\n\n if (!availableMethods.includes(deliveryMethod.value)) {\n deliveryMethod.value = first\n storage.set(KEY_DELIVERY_METHOD, first)\n }\n }\n\n /** Call only after the city has loaded. */\n function restoreFromCookies(city: City): void {\n const savedMethod = storage.get(KEY_DELIVERY_METHOD)\n if (savedMethod && VALID_DELIVERY_METHODS.has(savedMethod)) {\n deliveryMethod.value = savedMethod as DeliveryMethod\n }\n\n const savedStockId = storage.get(KEY_SELECTED_STOCK_ID)\n const stocks = city.stocks ?? []\n if (savedStockId && stocks.length) {\n const stock = stocks.find((s) => s.id === savedStockId) ?? null\n selectedStock.value = stock\n if (!stock) storage.remove(KEY_SELECTED_STOCK_ID)\n }\n\n const savedAddress = storage.get(KEY_SELECTED_ADDRESS)\n if (savedAddress) selectedAddress.value = savedAddress\n\n const savedAddressId = storage.get(KEY_SELECTED_ADDRESS_ID)\n if (savedAddressId) selectedAddressId.value = savedAddressId\n\n const savedAddressName = storage.get(KEY_SELECTED_ADDRESS_NAME)\n if (savedAddressName) selectedAddressName.value = savedAddressName\n\n const savedTable = storage.get(KEY_ON_PREMISE_TABLE)\n if (savedTable) onPremiseTable.value = savedTable\n }\n\n const isDelivery = computed(() => deliveryMethod.value === DeliveryMethod.Delivery)\n const isPickup = computed(() => deliveryMethod.value === DeliveryMethod.Pickup)\n const isOnPremise = computed(() => deliveryMethod.value === DeliveryMethod.OnPremise)\n const needsAddress = computed(() => deliveryMethod.value === DeliveryMethod.Delivery)\n const needsStock = computed(\n () =>\n deliveryMethod.value === DeliveryMethod.Pickup ||\n deliveryMethod.value === DeliveryMethod.OnPremise\n )\n const needsTable = computed(() => deliveryMethod.value === DeliveryMethod.OnPremise)\n\n return {\n deliveryMethod,\n onPremiseTable,\n selectedStock,\n selectedAddress,\n selectedAddressId,\n selectedAddressName,\n setDeliveryMethod,\n setOnPremiseTable,\n setSelectedStock,\n setSelectedAddress,\n validateDeliveryMethod,\n restoreFromCookies,\n isDelivery,\n isPickup,\n isOnPremise,\n needsAddress,\n needsStock,\n needsTable,\n }\n})\n","import { PaymentMethod } from '@zenky/storefront-api'\nimport { defineStore } from 'pinia'\nimport { computed, ref, type ComputedRef, type Ref } from 'vue'\n\nimport type {\n DeliveryMethod,\n Order,\n OrderCheckoutTotal,\n OrderDeliveryMethod,\n OrderPaymentMethod,\n OrderPaymentTransaction,\n OrderProductVariant,\n OrderSettings,\n} from '@zenky/storefront-api'\n\nimport { useRuntime } from '../ports/runtime'\nimport { useOrderSettingsStore } from './order-settings'\n\n// Keys match the old CookieKey.* — so saved values aren't lost.\nconst KEY_COMMENT = 'zenky_order_comment'\nconst KEY_PERSONS_COUNT = 'zenky_order_persons_count'\n\nexport interface CartCredentials {\n id: string\n token: string\n}\n\n/** Bonus intent (business state) — used for headless reconciliation. */\nexport interface AppliedBonusesIntent {\n enabled: boolean\n /** null means \"redeem the maximum available\". */\n desiredAmountMinor: number | null\n /** PIN flow: bonuses were reset and need to be reconfirmed. */\n requiresConfirmation: boolean\n}\n\nexport interface MinPriceViolation {\n remaining: number\n progress: number\n minPrice: number\n}\n\nfunction emptyBonusesIntent(): AppliedBonusesIntent {\n return { enabled: false, desiredAmountMinor: null, requiresConfirmation: false }\n}\n\nfunction parsePersonsCount(raw: string | null): number {\n const parsed = raw ? Number.parseInt(raw, 10) : NaN\n return Number.isFinite(parsed) && parsed > 0 ? parsed : 0\n}\n\nexport interface CartStore {\n order: Ref<Order | null>\n credentials: Ref<CartCredentials | null>\n loading: Ref<boolean>\n initializing: Ref<boolean>\n optimisticAdjustments: Ref<Record<string, number>>\n lineOptimistic: Ref<Record<string, number>>\n deliveryMethods: Ref<OrderDeliveryMethod[]>\n orderSettings: Ref<OrderSettings | null>\n comment: Ref<string>\n personsCount: Ref<number>\n checkoutTotal: Ref<OrderCheckoutTotal | null>\n selectedPaymentMethod: Ref<PaymentMethod | null>\n selectedPaymentBill: Ref<number | null>\n selectedCardTokenId: Ref<string | null>\n selectedSaveCard: Ref<boolean>\n bonusesIntent: Ref<AppliedBonusesIntent>\n deliveryTimeIntent: Ref<string | null>\n minPriceViolation: Ref<MinPriceViolation | null>\n setOrder: (order: Order) => void\n patchOrder: (partial: Order) => void\n setCredentials: (credentials: CartCredentials) => void\n setLoading: (value: boolean) => void\n setInitializing: (value: boolean) => void\n adjustOptimistic: (productId: string, delta: number) => void\n clearOptimistic: (productId: string) => void\n adjustLineOptimistic: (lineKey: string, delta: number) => void\n setDeliveryMethods: (methods: OrderDeliveryMethod[]) => void\n setOrderSettings: (settings: OrderSettings) => void\n setComment: (value: string) => void\n setPersonsCount: (value: number) => void\n setSelectedPaymentMethod: (method: PaymentMethod | null) => void\n setSelectedPaymentBill: (bill: number | null) => void\n setSelectedCardTokenId: (id: string | null) => void\n setSelectedSaveCard: (value: boolean) => void\n setBonusesIntentEnabled: (value: boolean) => void\n setDesiredBonusesAmount: (value: number | null) => void\n setBonusesRequiresConfirmation: (value: boolean) => void\n clearBonusesIntent: () => void\n setDeliveryTimeIntent: (value: string | null) => void\n restorePaymentSelection: (payments: OrderPaymentTransaction[]) => void\n validatePaymentSelection: () => void\n setOrderPaymentsState: (payments: OrderPaymentTransaction[]) => void\n setCheckoutTotal: (value: OrderCheckoutTotal) => void\n clearCart: () => void\n hasOrder: ComputedRef<boolean>\n hasCredentials: ComputedRef<boolean>\n variants: ComputedRef<OrderProductVariant[]>\n totalPrice: ComputedRef<number>\n itemCount: ComputedRef<number>\n availableDeliveryMethodIds: ComputedRef<DeliveryMethod[]>\n paymentMethods: ComputedRef<OrderPaymentMethod[]>\n hasBonusesApplied: ComputedRef<boolean>\n productQuantities: ComputedRef<Record<string, number>>\n}\n\nexport const useCartStore = defineStore('zenky-cart', (): CartStore => {\n const { storage } = useRuntime()\n const settingsStore = useOrderSettingsStore()\n\n const order = ref<Order | null>(null)\n const credentials = ref<CartCredentials | null>(null)\n const loading = ref(false)\n const initializing = ref(false)\n const optimisticAdjustments = ref<Record<string, number>>({})\n const lineOptimistic = ref<Record<string, number>>({})\n const deliveryMethods = ref<OrderDeliveryMethod[]>([])\n const orderSettings = ref<OrderSettings | null>(null)\n const comment = ref(storage.get(KEY_COMMENT) ?? '')\n const personsCount = ref(parsePersonsCount(storage.get(KEY_PERSONS_COUNT)))\n const checkoutTotal = ref<OrderCheckoutTotal | null>(null)\n const selectedPaymentMethod = ref<PaymentMethod | null>(null)\n const selectedPaymentBill = ref<number | null>(null)\n const selectedCardTokenId = ref<string | null>(null)\n const selectedSaveCard = ref(false)\n const bonusesIntent = ref<AppliedBonusesIntent>(emptyBonusesIntent())\n const deliveryTimeIntent = ref<string | null>(null)\n const minPriceViolation = ref<MinPriceViolation | null>(null)\n\n function restorePaymentSelection(payments: OrderPaymentTransaction[]): void {\n const restored = payments.find((p) => {\n const raw = p.method as unknown\n const id = typeof raw === 'string' ? raw : ((raw as { id?: string } | null)?.id ?? null)\n return id !== PaymentMethod.Bonuses\n })\n if (!restored) return\n\n const raw = restored.method as unknown\n const methodId = (\n typeof raw === 'string' ? raw : ((raw as { id?: PaymentMethod } | null)?.id ?? null)\n ) as PaymentMethod | null\n if (!methodId || selectedPaymentMethod.value === methodId) return\n\n selectedPaymentMethod.value = methodId\n\n const meta = restored.transaction_meta as { bill?: number | null } | null | undefined\n const billMinor = meta?.bill ?? null\n const newBill = billMinor != null && billMinor > 0 ? billMinor : null\n if (selectedPaymentBill.value !== newBill) {\n selectedPaymentBill.value = newBill\n }\n }\n\n function validatePaymentSelection(): void {\n if (!selectedPaymentMethod.value) return\n const methods = orderSettings.value?.payment_methods ?? []\n if (!methods.some((m) => m.id === selectedPaymentMethod.value)) {\n selectedPaymentMethod.value = null\n selectedPaymentBill.value = null\n }\n }\n\n function setOrder(next: Order): void {\n if (!next?.id || !next.token) {\n console.warn('[cart] setOrder ignored — missing id/token', {\n hasId: Boolean(next?.id),\n hasToken: Boolean(next?.token),\n })\n return\n }\n\n order.value = next\n credentials.value = { id: next.id, token: next.token }\n\n if (Array.isArray(next.payments) && next.payments.length > 0) {\n restorePaymentSelection(next.payments as unknown as OrderPaymentTransaction[])\n }\n }\n\n function patchOrder(partial: Order): void {\n if (!partial?.id || !partial.token) {\n console.warn('[cart] patchOrder ignored — missing id/token', {\n hasId: Boolean(partial?.id),\n hasToken: Boolean(partial?.token),\n })\n return\n }\n\n if (!order.value) {\n order.value = partial\n } else {\n const merged: Order = { ...order.value }\n for (const key of Object.keys(partial) as (keyof Order)[]) {\n const value = partial[key]\n if (value !== undefined) {\n ;(merged as unknown as Record<string, unknown>)[key as string] = value\n }\n }\n order.value = merged\n }\n\n credentials.value = { id: partial.id, token: partial.token }\n\n if (Array.isArray(partial.payments) && partial.payments.length > 0) {\n restorePaymentSelection(partial.payments as unknown as OrderPaymentTransaction[])\n }\n }\n\n function setCredentials(next: CartCredentials): void {\n credentials.value = next\n }\n\n function setLoading(value: boolean): void {\n loading.value = value\n }\n\n function setInitializing(value: boolean): void {\n initializing.value = value\n }\n\n function adjustOptimistic(productId: string, delta: number): void {\n const next = (optimisticAdjustments.value[productId] ?? 0) + delta\n if (next === 0) delete optimisticAdjustments.value[productId]\n else optimisticAdjustments.value[productId] = next\n }\n\n function clearOptimistic(productId: string): void {\n delete optimisticAdjustments.value[productId]\n }\n\n function adjustLineOptimistic(lineKey: string, delta: number): void {\n const next = (lineOptimistic.value[lineKey] ?? 0) + delta\n if (next === 0) delete lineOptimistic.value[lineKey]\n else lineOptimistic.value[lineKey] = next\n }\n\n function setDeliveryMethods(methods: OrderDeliveryMethod[]): void {\n deliveryMethods.value = methods\n settingsStore.validateDeliveryMethod(methods.map((m) => m.id))\n }\n\n function setOrderSettings(settings: OrderSettings): void {\n orderSettings.value = settings\n setDeliveryMethods(settings.delivery_methods)\n validatePaymentSelection()\n }\n\n function setComment(value: string): void {\n comment.value = value\n if (value) storage.set(KEY_COMMENT, value)\n else storage.remove(KEY_COMMENT)\n }\n\n function setPersonsCount(value: number): void {\n personsCount.value = value\n if (value > 0) storage.set(KEY_PERSONS_COUNT, String(value))\n else storage.remove(KEY_PERSONS_COUNT)\n }\n\n function setSelectedPaymentMethod(method: PaymentMethod | null): void {\n selectedPaymentMethod.value = method\n }\n\n function setSelectedPaymentBill(bill: number | null): void {\n selectedPaymentBill.value = bill\n }\n\n function setSelectedCardTokenId(id: string | null): void {\n selectedCardTokenId.value = id\n }\n\n function setSelectedSaveCard(value: boolean): void {\n selectedSaveCard.value = value\n }\n\n function setBonusesIntentEnabled(value: boolean): void {\n bonusesIntent.value.enabled = value\n if (!value) {\n bonusesIntent.value.desiredAmountMinor = null\n bonusesIntent.value.requiresConfirmation = false\n }\n }\n\n function setDesiredBonusesAmount(value: number | null): void {\n bonusesIntent.value.desiredAmountMinor = value\n }\n\n function setBonusesRequiresConfirmation(value: boolean): void {\n bonusesIntent.value.requiresConfirmation = value\n }\n\n function clearBonusesIntent(): void {\n bonusesIntent.value = emptyBonusesIntent()\n }\n\n function setDeliveryTimeIntent(value: string | null): void {\n deliveryTimeIntent.value = value\n }\n\n function setOrderPaymentsState(payments: OrderPaymentTransaction[]): void {\n if (order.value) {\n order.value = { ...order.value, payments } as Order\n }\n restorePaymentSelection(payments)\n }\n\n function setCheckoutTotal(value: OrderCheckoutTotal): void {\n checkoutTotal.value = value\n\n const min = value.min_price\n // An empty order (no variants) with a non-zero delivery fee in the total\n // doesn't count as a minimum-price violation.\n const hasItems = (order.value?.variants?.length ?? 0) > 0\n minPriceViolation.value =\n hasItems && min != null && value.total > 0 && value.total < min\n ? {\n remaining: Math.max(0, min - value.total),\n progress: Math.min(1, value.total / min),\n minPrice: min,\n }\n : null\n }\n\n function clearCart(): void {\n order.value = null\n credentials.value = null\n checkoutTotal.value = null\n optimisticAdjustments.value = {}\n lineOptimistic.value = {}\n orderSettings.value = null\n comment.value = ''\n personsCount.value = 0\n storage.remove(KEY_COMMENT)\n storage.remove(KEY_PERSONS_COUNT)\n selectedPaymentMethod.value = null\n selectedPaymentBill.value = null\n selectedCardTokenId.value = null\n selectedSaveCard.value = false\n bonusesIntent.value = emptyBonusesIntent()\n deliveryTimeIntent.value = null\n minPriceViolation.value = null\n }\n\n const hasOrder = computed(() => order.value !== null)\n const hasCredentials = computed(() => credentials.value !== null)\n const variants = computed<OrderProductVariant[]>(() => order.value?.variants ?? [])\n const totalPrice = computed(() => order.value?.total_price ?? 0)\n const itemCount = computed(() => variants.value.reduce((sum, v) => sum + v.quantity, 0))\n const availableDeliveryMethodIds = computed<DeliveryMethod[]>(() =>\n deliveryMethods.value.map((m) => m.id)\n )\n const paymentMethods = computed<OrderPaymentMethod[]>(\n () => orderSettings.value?.payment_methods ?? []\n )\n const hasBonusesApplied = computed(() => {\n const payments = order.value?.payments ?? []\n return (payments as unknown as Array<{ method: unknown }>).some((p) => {\n const raw = p.method\n const id = typeof raw === 'string' ? raw : ((raw as { id?: string } | null)?.id ?? null)\n return id === PaymentMethod.Bonuses\n })\n })\n const productQuantities = computed<Record<string, number>>(() => {\n const map: Record<string, number> = {}\n for (const variant of variants.value) {\n const pid = variant.product_id\n map[pid] = (map[pid] ?? 0) + variant.quantity\n }\n return map\n })\n\n return {\n order,\n credentials,\n loading,\n initializing,\n optimisticAdjustments,\n lineOptimistic,\n deliveryMethods,\n orderSettings,\n comment,\n personsCount,\n checkoutTotal,\n selectedPaymentMethod,\n selectedPaymentBill,\n selectedCardTokenId,\n selectedSaveCard,\n bonusesIntent,\n deliveryTimeIntent,\n minPriceViolation,\n setOrder,\n patchOrder,\n setCredentials,\n setLoading,\n setInitializing,\n adjustOptimistic,\n clearOptimistic,\n adjustLineOptimistic,\n setDeliveryMethods,\n setOrderSettings,\n setComment,\n setPersonsCount,\n setSelectedPaymentMethod,\n setSelectedPaymentBill,\n setSelectedCardTokenId,\n setSelectedSaveCard,\n setBonusesIntentEnabled,\n setDesiredBonusesAmount,\n setBonusesRequiresConfirmation,\n clearBonusesIntent,\n setDeliveryTimeIntent,\n restorePaymentSelection,\n validatePaymentSelection,\n setOrderPaymentsState,\n setCheckoutTotal,\n clearCart,\n hasOrder,\n hasCredentials,\n variants,\n totalPrice,\n itemCount,\n availableDeliveryMethodIds,\n paymentMethods,\n hasBonusesApplied,\n productQuantities,\n }\n})\n","import { defineStore } from 'pinia'\nimport { computed, ref, type ComputedRef, type Ref } from 'vue'\n\nexport interface RewardSelectionContext {\n type: string\n id: string\n}\n\nexport interface RewardSelection {\n offerId: string\n promotionId: string\n rewardId: string\n context: RewardSelectionContext | null\n limit: number\n}\n\nexport interface PromotionsStore {\n rewards: Ref<RewardSelection[]>\n checking: Ref<boolean>\n addOrUpdateReward: (selection: RewardSelection) => void\n removeRewardByPromotion: (promotionId: string) => void\n clearRewards: () => void\n setChecking: (value: boolean) => void\n hasRewards: ComputedRef<boolean>\n totalEmptySlots: ComputedRef<number>\n rewardSelection: ComputedRef<RewardSelection | null>\n needsSelection: ComputedRef<boolean>\n}\n\nexport const usePromotionsStore = defineStore('zenky-promotions', (): PromotionsStore => {\n /** Available rewards (multiple promotions can be active at the same time). */\n const rewards = ref<RewardSelection[]>([])\n const checking = ref(false)\n\n function addOrUpdateReward(selection: RewardSelection): void {\n const index = rewards.value.findIndex((r) => r.promotionId === selection.promotionId)\n if (index >= 0) {\n rewards.value[index] = selection\n } else {\n rewards.value.push(selection)\n }\n }\n\n function removeRewardByPromotion(promotionId: string): void {\n rewards.value = rewards.value.filter((r) => r.promotionId !== promotionId)\n }\n\n function clearRewards(): void {\n rewards.value = []\n }\n\n function setChecking(value: boolean): void {\n checking.value = value\n }\n\n const hasRewards = computed(() => rewards.value.length > 0)\n const totalEmptySlots = computed(() => rewards.value.reduce((sum, r) => sum + r.limit, 0))\n /** Kept for backward compatibility — the first reward. */\n const rewardSelection = computed<RewardSelection | null>(() => rewards.value[0] ?? null)\n const needsSelection = computed(() => rewards.value.some((r) => r.context !== null))\n\n return {\n rewards,\n checking,\n addOrUpdateReward,\n removeRewardByPromotion,\n clearRewards,\n setChecking,\n hasRewards,\n totalEmptySlots,\n rewardSelection,\n needsSelection,\n }\n})\n"]}
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export { FontConfig, PrimaryShades, ThemeColorConfig, ThemeData, buildCssVariabl
6
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';
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 { C as CatalogEntity, S as StaticCatalogItem, a as StaticRemoteCatalog, c as catalogItemEntity, i as isRenderableCatalogItem } from './catalogEntity-DgrPsJpf.js';
9
10
  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';
10
11
  export { RawSnippetItem, Snippet, SnippetGroup, SnippetLanguage, SnippetPosition, normalizeSnippets } from './snippets/index.js';
11
12
  export { SettingValue, Website, WebsitePage, WebsitePageListItem, WebsitePageSeo, WebsitePageType, WebsiteSettingsValues } from './website-settings/index.js';
@@ -14,11 +15,11 @@ import '@zenky/integrations-sdk';
14
15
  import '@zenky/storefront-api';
15
16
  import 'pinia';
16
17
 
17
- /** Vue-плагин: app.use(createStorefront(runtime)). */
18
+ /** Vue plugin: app.use(createStorefront(runtime)). */
18
19
  declare function createStorefront(runtime: StorefrontRuntime): Plugin;
19
- /** Альтернатива плагину — provide внутри setup (напр. в изолированном виджете). */
20
+ /** Alternative to the plugin — calls provide() inside setup (e.g. for an isolated widget). */
20
21
  declare function provideStorefront(runtime: StorefrontRuntime): void;
21
- /** Доступ к рантайму из любого composable/стора ядра. */
22
+ /** Gives any core composable or store access to the runtime. */
22
23
  declare function useRuntime(): StorefrontRuntime;
23
24
 
24
25
  export { StorefrontRuntime, createStorefront, provideStorefront, useRuntime };
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
- export { normalizeSnippets } from './chunk-2CI4RW7V.js';
2
- export { useProductsStore, useStore, useStorefrontProfile } from './chunk-PTMSPB34.js';
3
- export { buildCssVariableMap, generatePrimaryShades, generateShades, useTheme } from './chunk-4IFPVEO7.js';
4
- export { buildQrCodeUrl, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors, getEmailLink, getPhoneTelLink, getSocialLinks, getTodayInfo, getWebsiteLink, getWeeklySchedule, pluralize, toDateInputValue, todayInTimezone } from './chunk-MZ66ARDL.js';
1
+ export { normalizeSnippets } from './chunk-GLQXTMVW.js';
2
+ export { useProductsStore, useStore, useStorefrontProfile } from './chunk-FXKG5TFQ.js';
3
+ export { buildQrCodeUrl, createOperationChain, formatAddressCityLast, formatDate, formatDateTime, formatPhoneNational, formatPhoneSpaced, formatScheduleStatus, getApiErrorMessage, getApiFieldErrors, getEmailLink, getPhoneTelLink, getSocialLinks, getTodayInfo, getWebsiteLink, getWeeklySchedule, pluralize, toDateInputValue, todayInTimezone } from './chunk-GXDTRTUT.js';
4
+ export { buildCssVariableMap, generatePrimaryShades, generateShades, useTheme } from './chunk-BUNI6MGH.js';
5
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-2SMSLZ6G.js';
7
- export { useCartCredentials } from './chunk-5YD4AIY2.js';
8
- export { useCartStore, useOrderSettingsStore, usePromotionsStore } from './chunk-Z247QRDJ.js';
9
- export { collectDescendantIds, findCategoryById, findCategoryByShortId, findRootAncestor, getCategoryPath, groupProductsBySubcategory, useCollections } from './chunk-NG7RUIWW.js';
10
- export { getCity, getRemoteCatalog, getStock } from './chunk-E3G7NGCH.js';
11
- export { asMajor, asMinor, formatPrice, majorToMinor, minorToMajor, minorToMajorString } from './chunk-RO25KNM5.js';
12
- export { KEY_MESSAGE_FORMATTER, NOOP_ACTIVITY_REPORTER, NOOP_NOTIFIER, NOOP_RUM, createMemoryStorage, err, ok } from './chunk-MOG6UMFM.js';
13
- export { canAddDirectly, findProductInCatalog, formatWeight, getProductWeight, getVariantWeight, resolveVariantPrice, toGrams, usePriceRecalculation, useProductDetail, useProductList, useProductPricing, useProductVariant, useProductVariantModifiers, useProductVariantSelector, useProductsByCategory, useRelatedProducts } from './chunk-3FDM6T7F.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-4UMDIBW5.js';
7
+ export { useCartCredentials } from './chunk-46FNHMWC.js';
8
+ export { useCartStore, useOrderSettingsStore, usePromotionsStore } from './chunk-XULHV6SS.js';
9
+ export { catalogItemEntity, collectDescendantIds, findCategoryById, findCategoryByShortId, findRootAncestor, getCategoryPath, groupProductsBySubcategory, isRenderableCatalogItem, useCollections } from './chunk-OBNMXLJO.js';
10
+ export { getCity, getRemoteCatalog, getStock } from './chunk-FS2UNPTY.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-32SLDGE5.js';
14
14
  export { createDebounce } from './chunk-XUGXLJZB.js';
15
15
  import './chunk-5QCUH3FF.js';
16
- export { useCatalogStore } from './chunk-Z3IW4ODZ.js';
17
- export { createStorefront, provideStorefront, useAuthStore, useRuntime, useStoreProfileStore } from './chunk-VFMVQR6Y.js';
16
+ export { useCatalogStore } from './chunk-NSOIL7PW.js';
17
+ export { createStorefront, provideStorefront, useAuthStore, useRuntime, useStoreProfileStore } from './chunk-QZ3S3NN3.js';
18
18
  //# sourceMappingURL=index.js.map
19
19
  //# sourceMappingURL=index.js.map
@@ -1,25 +1,25 @@
1
1
  declare const MINOR: unique symbol;
2
2
  declare const MAJOR: unique symbol;
3
- /** Сумма в минорных единицах (копейки). Так хранит и отдаёт API. */
3
+ /** An amount in minor units (kopecks) — how the API stores and returns it. */
4
4
  type Minor = number & {
5
5
  readonly [MINOR]: true;
6
6
  };
7
- /** Сумма в мажорных единицах (рубли). В таком виде их ждёт часть API. */
7
+ /** An amount in major units (rubles) — the shape some API endpoints expect. */
8
8
  type Major = number & {
9
9
  readonly [MAJOR]: true;
10
10
  };
11
- /** Помечает сырое число с API как Minor (assert без рантайм-стоимости). */
11
+ /** Marks a raw number from the API as Minor — a zero-cost assertion, not a conversion. */
12
12
  declare const asMinor: (value: number) => Minor;
13
- /** Помечает число как Major. */
14
13
  declare const asMajor: (value: number) => Major;
15
- /** Форматирует цену из минорных единиц в читаемый вид (`1 290 ₽`). */
14
+ /** Formats a price from minor units into a readable string (`1 290 ₽`). */
16
15
  declare function formatPrice(value?: number | null, currency?: string, locale?: string): string;
17
- /** Сырая конвертация минор → мажор (копейки → рубли) без форматирования. */
16
+ /** Raw minor-to-major conversion (kopecks → rubles), no formatting. */
18
17
  declare function minorToMajor(value: number, currency?: string): number;
19
- /** Сырая конвертация мажор → минор (рубли → копейки), округление до целого. */
18
+ /** Raw major-to-minor conversion (rubles → kopecks), rounded to a whole number. */
20
19
  declare function majorToMinor(value: number, currency?: string): number;
21
20
  /**
22
- * Минор → мажор строкой. API payments/bonuses ждёт сумму строкой в рублях `"103.50"`.
21
+ * Minor to major, as a string. The payments/bonuses API expects the amount
22
+ * as a ruble string, e.g. `"103.50"`.
23
23
  */
24
24
  declare function minorToMajorString(value: number, currency?: string): string;
25
25
 
@@ -1,3 +1,3 @@
1
- export { asMajor, asMinor, formatPrice, majorToMinor, minorToMajor, minorToMajorString } from '../chunk-RO25KNM5.js';
1
+ export { asMajor, asMinor, formatPrice, majorToMinor, minorToMajor, minorToMajorString } from '../chunk-2Y6QTHXI.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -10,9 +10,9 @@ interface GenerateFreeTimeGroupsOptions {
10
10
  formatDayLabel?: (offset: number, date: Date) => string;
11
11
  }
12
12
  /**
13
- * Слот free-режима с собственной датой доставки. «Ночной хвост» (00:00–02:00) показывается
14
- * в той же вкладке, что и начало бизнес-дня, но его `date` — уже следующие сутки, поэтому
15
- * `deliver_at` строится по `interval.date`, а не по дате вкладки (`group.date`).
13
+ * A free-mode slot with its own delivery date. The "night tail" (00:00–02:00) is shown
14
+ * in the same tab as the start of the business day, but its `date` is already the next
15
+ * day, so `deliver_at` must be built from `interval.date`, not the tab's date (`group.date`).
16
16
  */
17
17
  interface FreeDeliveryInterval extends DeliveryInterval {
18
18
  date: string;