@salla.sa/twilight-theme-engine 1.0.86 → 1.0.88

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 (147) hide show
  1. package/README.md +4 -3
  2. package/bin/twilight-check-manifest.mjs +16 -0
  3. package/dist/{AddToCartForm-5X2WZDWR.js → AddToCartForm-YY7DDANL.js} +4 -4
  4. package/dist/{AddToCartForm-5X2WZDWR.js.map → AddToCartForm-YY7DDANL.js.map} +1 -1
  5. package/dist/{BlogAuthorPage-LO7FSSJR.js → BlogAuthorPage-4IXOEQA4.js} +9 -9
  6. package/dist/{BlogAuthorPage-LO7FSSJR.js.map → BlogAuthorPage-4IXOEQA4.js.map} +1 -1
  7. package/dist/{BlogCategoryPage-KKFQ3PGR.js → BlogCategoryPage-NYB7EMKQ.js} +9 -9
  8. package/dist/{BlogCategoryPage-KKFQ3PGR.js.map → BlogCategoryPage-NYB7EMKQ.js.map} +1 -1
  9. package/dist/{BlogPage-VLF3NSGE.js → BlogPage-B2A47OBZ.js} +8 -8
  10. package/dist/{BlogPage-VLF3NSGE.js.map → BlogPage-B2A47OBZ.js.map} +1 -1
  11. package/dist/{BlogSinglePage-AVK535IW.js → BlogSinglePage-ZSOHP2GJ.js} +8 -8
  12. package/dist/{BlogSinglePage-AVK535IW.js.map → BlogSinglePage-ZSOHP2GJ.js.map} +1 -1
  13. package/dist/{BlogTagPage-F3T4D7RH.js → BlogTagPage-24MZSPCO.js} +9 -9
  14. package/dist/{BlogTagPage-F3T4D7RH.js.map → BlogTagPage-24MZSPCO.js.map} +1 -1
  15. package/dist/{BrandsPage-LVSBZSVC.js → BrandsPage-WJUCPMKH.js} +8 -8
  16. package/dist/{BrandsPage-LVSBZSVC.js.map → BrandsPage-WJUCPMKH.js.map} +1 -1
  17. package/dist/{Breadcrumb-VLFTXRFC.js → Breadcrumb-TMUSQ2XY.js} +8 -8
  18. package/dist/{Breadcrumb-VLFTXRFC.js.map → Breadcrumb-TMUSQ2XY.js.map} +1 -1
  19. package/dist/{CartItem-G3H34GW6.js → CartItem-QH6X7576.js} +8 -8
  20. package/dist/{CartItem-G3H34GW6.js.map → CartItem-QH6X7576.js.map} +1 -1
  21. package/dist/{CartSummary-VH37RPUI.js → CartSummary-MERS5R3X.js} +8 -8
  22. package/dist/{CartSummary-VH37RPUI.js.map → CartSummary-MERS5R3X.js.map} +1 -1
  23. package/dist/{Copyright-HE5ZWINZ.js → Copyright-JPOX7PLQ.js} +4 -4
  24. package/dist/{Copyright-HE5ZWINZ.js.map → Copyright-JPOX7PLQ.js.map} +1 -1
  25. package/dist/{CustomerLayout-LKBLOAVW.js → CustomerLayout-ER5SZO7U.js} +8 -8
  26. package/dist/{CustomerLayout-LKBLOAVW.js.map → CustomerLayout-ER5SZO7U.js.map} +1 -1
  27. package/dist/{Footer-HHXAST72.js → Footer-7O5CQ72M.js} +5 -5
  28. package/dist/{Footer-HHXAST72.js.map → Footer-7O5CQ72M.js.map} +1 -1
  29. package/dist/{Header-GEVZM2YG.js → Header-CH56KO3D.js} +5 -5
  30. package/dist/{Header-GEVZM2YG.js.map → Header-CH56KO3D.js.map} +1 -1
  31. package/dist/{LoyaltyPage-M5CT3CFD.js → LoyaltyPage-S74ZELSW.js} +8 -8
  32. package/dist/{LoyaltyPage-M5CT3CFD.js.map → LoyaltyPage-S74ZELSW.js.map} +1 -1
  33. package/dist/{LoyaltyPointsPage-SDJB52U6.js → LoyaltyPointsPage-TCKZTXSB.js} +3 -3
  34. package/dist/{LoyaltyPointsPage-SDJB52U6.js.map → LoyaltyPointsPage-TCKZTXSB.js.map} +1 -1
  35. package/dist/{MainMenu-I7EYS752.js → MainMenu-3WDXPG2J.js} +4 -4
  36. package/dist/{MainMenu-I7EYS752.js.map → MainMenu-3WDXPG2J.js.map} +1 -1
  37. package/dist/{MasterLayout-QDK4T3NE.js → MasterLayout-EC6LIXFB.js} +8 -8
  38. package/dist/{MasterLayout-QDK4T3NE.js.map → MasterLayout-EC6LIXFB.js.map} +1 -1
  39. package/dist/{MobileMenu-7VTCWAVJ.js → MobileMenu-VIMGPLKV.js} +8 -8
  40. package/dist/{MobileMenu-7VTCWAVJ.js.map → MobileMenu-VIMGPLKV.js.map} +1 -1
  41. package/dist/{NotificationsPage-QCABE6QD.js → NotificationsPage-HYID6XAA.js} +8 -8
  42. package/dist/{NotificationsPage-QCABE6QD.js.map → NotificationsPage-HYID6XAA.js.map} +1 -1
  43. package/dist/{OrderSinglePage-2HVBKBG4.js → OrderSinglePage-5GMYPKA6.js} +8 -8
  44. package/dist/{OrderSinglePage-2HVBKBG4.js.map → OrderSinglePage-5GMYPKA6.js.map} +1 -1
  45. package/dist/{OrdersPage-5MNCPCM3.js → OrdersPage-SKTTDOJ6.js} +8 -8
  46. package/dist/{OrdersPage-5MNCPCM3.js.map → OrdersPage-SKTTDOJ6.js.map} +1 -1
  47. package/dist/{PageSingle-EN5XIM2B.js → PageSingle-RNWFQQEM.js} +4 -4
  48. package/dist/{PageSingle-EN5XIM2B.js.map → PageSingle-RNWFQQEM.js.map} +1 -1
  49. package/dist/{ProductDetails-UEWQPPDZ.js → ProductDetails-OYPJ6MW7.js} +4 -4
  50. package/dist/{ProductDetails-UEWQPPDZ.js.map → ProductDetails-OYPJ6MW7.js.map} +1 -1
  51. package/dist/{ProfilePage-TZSU3GHZ.js → ProfilePage-BQE63RHK.js} +8 -8
  52. package/dist/{ProfilePage-TZSU3GHZ.js.map → ProfilePage-BQE63RHK.js.map} +1 -1
  53. package/dist/{ReviewsPage-WYZ6CHF2.js → ReviewsPage-VEYN7BSR.js} +4 -4
  54. package/dist/{ReviewsPage-WYZ6CHF2.js.map → ReviewsPage-VEYN7BSR.js.map} +1 -1
  55. package/dist/{SeoCartWidget-5JR5RXQM.js → SeoCartWidget-3BVMA4WY.js} +8 -8
  56. package/dist/{SeoCartWidget-5JR5RXQM.js.map → SeoCartWidget-3BVMA4WY.js.map} +1 -1
  57. package/dist/{SettingsPage-DIDRQXMM.js → SettingsPage-QLKKYVGH.js} +8 -8
  58. package/dist/{SettingsPage-DIDRQXMM.js.map → SettingsPage-QLKKYVGH.js.map} +1 -1
  59. package/dist/{StoreClosedNotification-C2G32E34.js → StoreClosedNotification-LQXGW2SB.js} +9 -9
  60. package/dist/{StoreClosedNotification-C2G32E34.js.map → StoreClosedNotification-LQXGW2SB.js.map} +1 -1
  61. package/dist/{TestimonialsPage-XPHFRBZ7.js → TestimonialsPage-OKDDAMJL.js} +4 -4
  62. package/dist/{TestimonialsPage-XPHFRBZ7.js.map → TestimonialsPage-OKDDAMJL.js.map} +1 -1
  63. package/dist/{ThankYouPage-UA6YYFB2.js → ThankYouPage-YWLG6UF7.js} +8 -8
  64. package/dist/{ThankYouPage-UA6YYFB2.js.map → ThankYouPage-YWLG6UF7.js.map} +1 -1
  65. package/dist/{WalletPage-AJVV7LVL.js → WalletPage-UEYRVSWR.js} +8 -8
  66. package/dist/{WalletPage-AJVV7LVL.js.map → WalletPage-UEYRVSWR.js.map} +1 -1
  67. package/dist/{WishlistPage-UW6LJLSW.js → WishlistPage-7257GI3Y.js} +8 -8
  68. package/dist/{WishlistPage-UW6LJLSW.js.map → WishlistPage-7257GI3Y.js.map} +1 -1
  69. package/dist/{chunk-4WVJJ7SN.js → chunk-6VOF5SB4.js} +3 -3
  70. package/dist/{chunk-4WVJJ7SN.js.map → chunk-6VOF5SB4.js.map} +1 -1
  71. package/dist/{chunk-WSDG4ZRI.js → chunk-7JVKUFFT.js} +4 -4
  72. package/dist/{chunk-WSDG4ZRI.js.map → chunk-7JVKUFFT.js.map} +1 -1
  73. package/dist/{chunk-BAYGWTNM.js → chunk-7PQPQEDN.js} +3 -3
  74. package/dist/{chunk-BAYGWTNM.js.map → chunk-7PQPQEDN.js.map} +1 -1
  75. package/dist/{chunk-E26YG3AO.js → chunk-A64SSH6M.js} +4 -4
  76. package/dist/{chunk-E26YG3AO.js.map → chunk-A64SSH6M.js.map} +1 -1
  77. package/dist/chunk-AUC6QMF7.js +14 -0
  78. package/dist/{chunk-QJYUTRAQ.js.map → chunk-AUC6QMF7.js.map} +1 -1
  79. package/dist/{chunk-PWTXR4RR.js → chunk-CTCVO7YU.js} +8 -9
  80. package/dist/chunk-CTCVO7YU.js.map +1 -0
  81. package/dist/{chunk-HQ7WA37L.js → chunk-H42Z4YFB.js} +7 -7
  82. package/dist/{chunk-HQ7WA37L.js.map → chunk-H42Z4YFB.js.map} +1 -1
  83. package/dist/{chunk-CLBFF2CY.js → chunk-NB7KGKLY.js} +3 -3
  84. package/dist/{chunk-CLBFF2CY.js.map → chunk-NB7KGKLY.js.map} +1 -1
  85. package/dist/{chunk-2HCCIHU7.js → chunk-NNNTEVFU.js} +4 -4
  86. package/dist/{chunk-2HCCIHU7.js.map → chunk-NNNTEVFU.js.map} +1 -1
  87. package/dist/{chunk-X54QP332.js → chunk-PKXEZRSJ.js} +5 -5
  88. package/dist/{chunk-X54QP332.js.map → chunk-PKXEZRSJ.js.map} +1 -1
  89. package/dist/{chunk-U55ZJC2X.js → chunk-SYVIMWYW.js} +18 -21
  90. package/dist/chunk-SYVIMWYW.js.map +1 -0
  91. package/dist/{chunk-KP3VYG4F.js → chunk-UKLZQK2J.js} +6 -6
  92. package/dist/{chunk-KP3VYG4F.js.map → chunk-UKLZQK2J.js.map} +1 -1
  93. package/dist/{chunk-DBXH3EMJ.js → chunk-V5OF7CV4.js} +3 -3
  94. package/dist/{chunk-DBXH3EMJ.js.map → chunk-V5OF7CV4.js.map} +1 -1
  95. package/dist/chunk-X5NK4TZH.js +228 -0
  96. package/dist/chunk-X5NK4TZH.js.map +1 -0
  97. package/dist/cli/check-manifest.d.ts +10 -0
  98. package/dist/cli/check-manifest.d.ts.map +1 -0
  99. package/dist/cli/check-manifest.js +44 -0
  100. package/dist/cli/check-manifest.js.map +1 -0
  101. package/dist/components/cart/index.js +1 -1
  102. package/dist/components/common/index.js +2 -2
  103. package/dist/components/drawer/index.js +6 -6
  104. package/dist/components/home/index.js +8 -8
  105. package/dist/components/layout/Footer.d.ts.map +1 -1
  106. package/dist/components/layout/MasterLayout.d.ts.map +1 -1
  107. package/dist/components/layout/index.js +1 -1
  108. package/dist/components/product/index.js +7 -7
  109. package/dist/components/store/index.js +8 -8
  110. package/dist/{document-class-7AXAAWGZ.js → document-class-WMKWZN7O.js} +3 -3
  111. package/dist/{document-class-7AXAAWGZ.js.map → document-class-WMKWZN7O.js.map} +1 -1
  112. package/dist/hooks/index.js +6 -6
  113. package/dist/hooks/useGtm.js +6 -6
  114. package/dist/hooks/useMoney.js +6 -6
  115. package/dist/hooks/useStore.js +6 -6
  116. package/dist/index.js +6 -6
  117. package/dist/{not-found-3EEMQZMU.js → not-found-NAXLRGC2.js} +8 -8
  118. package/dist/{not-found-3EEMQZMU.js.map → not-found-NAXLRGC2.js.map} +1 -1
  119. package/dist/providers/index.js +6 -6
  120. package/dist/routes/account/orders.js +1 -1
  121. package/dist/routes/account.js +6 -6
  122. package/dist/routes/blog.js +5 -5
  123. package/dist/routes/brands.js +1 -1
  124. package/dist/routes/cart.js +10 -10
  125. package/dist/routes/home.js +9 -9
  126. package/dist/routes/loyalty.js +2 -2
  127. package/dist/routes/page.js +1 -1
  128. package/dist/routes/product-listing.js +8 -8
  129. package/dist/routes/product.js +8 -8
  130. package/dist/routes/testimonials.js +2 -2
  131. package/dist/routes/thank-you.js +1 -1
  132. package/dist/skeleton.js +9 -9
  133. package/dist/tanstack.js +3 -3
  134. package/dist/utils/index.js +1 -1
  135. package/dist/vite/index.d.ts +1 -1
  136. package/dist/vite/index.d.ts.map +1 -1
  137. package/dist/vite/index.js +15 -26
  138. package/dist/vite/index.js.map +1 -1
  139. package/dist/vite/plugins/twilight-manifest.d.ts +23 -0
  140. package/dist/vite/plugins/twilight-manifest.d.ts.map +1 -1
  141. package/dist/vite/plugins/twilight-schema.plugin.d.ts.map +1 -1
  142. package/package.json +5 -1
  143. package/tailwind/components/layout/Footer.tsx.txt +20 -19
  144. package/tailwind/components/layout/MasterLayout.tsx.txt +0 -1
  145. package/dist/chunk-PWTXR4RR.js.map +0 -1
  146. package/dist/chunk-QJYUTRAQ.js +0 -14
  147. package/dist/chunk-U55ZJC2X.js.map +0 -1
@@ -47,4 +47,27 @@ export declare function isReactThemeManifest(raw: unknown): boolean;
47
47
  * plugin owns the console.
48
48
  */
49
49
  export declare function describeThemeTypeIssue(raw: unknown, fileLabel?: string): string | null;
50
+ /** One problem found in a `twilight.json`. */
51
+ export interface ManifestIssue {
52
+ /** Where it is, as a path into the file: `settings[3].id`, `components[0].fields[2]`. */
53
+ path: string;
54
+ /** What is wrong and what to do about it. */
55
+ message: string;
56
+ }
57
+ export interface ManifestValidation {
58
+ /** Problems that break the theme or the dashboard. Fix these. */
59
+ errors: ManifestIssue[];
60
+ /** Things that are unusual or not recognised. Check them, they may be intended. */
61
+ warnings: ManifestIssue[];
62
+ }
63
+ /**
64
+ * Check a parsed `twilight.json` for mistakes that are easy to make by hand and hard to see:
65
+ * a missing `type`, a duplicate setting `id`, a dropdown with no options, a boolean whose `value`
66
+ * is not a boolean, a component with no `path`.
67
+ *
68
+ * Pure and dependency-free, so it runs in Node, in a test or in a script. It never throws.
69
+ * It checks the structure the engine and the dev settings widget read. It cannot know everything
70
+ * the Salla dashboard accepts, so anything merely unfamiliar is a warning.
71
+ */
72
+ export declare function validateTwilightManifest(raw: unknown, fileLabel?: string): ManifestValidation;
50
73
  //# sourceMappingURL=twilight-manifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"twilight-manifest.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/twilight-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,0EAA0E;AAC1E,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,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;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI7D;AAED,mEAAmE;AACnE,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,SAAkB,GAAG,MAAM,GAAG,IAAI,CAyB/F;AAID,8CAA8C;AAC9C,MAAM,WAAW,aAAa;IAC5B,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,mFAAmF;IACnF,QAAQ,EAAE,aAAa,EAAE,CAAC;CAC3B;AAqGD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,OAAO,EACZ,SAAS,SAAkB,GAC1B,kBAAkB,CA4JpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"twilight-schema.plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/twilight-schema.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAYnC,wBAAgB,oBAAoB,CAAC,gBAAgB,SAAkB,GAAG,MAAM,CA+E/E"}
1
+ {"version":3,"file":"twilight-schema.plugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/twilight-schema.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAcnC,wBAAgB,oBAAoB,CAAC,gBAAgB,SAAkB,GAAG,MAAM,CAwF/E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-theme-engine",
3
- "version": "1.0.86",
3
+ "version": "1.0.88",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -397,9 +397,13 @@
397
397
  },
398
398
  "files": [
399
399
  "dist",
400
+ "bin",
400
401
  "tailwind",
401
402
  "README.md"
402
403
  ],
404
+ "bin": {
405
+ "twilight-check-manifest": "./bin/twilight-check-manifest.mjs"
406
+ },
403
407
  "scripts": {
404
408
  "build": "tsup && node scripts/add-js-extensions.mjs && rm -f tsconfig.tsbuildinfo && tsc --build && node scripts/generate-dts-stubs.mjs && node scripts/copy-ambient-dts.mjs && node scripts/copy-tailwind-sources.mjs",
405
409
  "dev": "tsup --watch",
@@ -149,9 +149,7 @@ function FooterLinksMenu({
149
149
  }) {
150
150
  if (inSheet) return null;
151
151
 
152
- const menu = (
153
- <SallaMenu source="footer" useReactLink className={className} suppressHydrationWarning />
154
- );
152
+ const menu = <SallaMenu source="footer" className={className} suppressHydrationWarning />;
155
153
  if (!heading) return menu;
156
154
 
157
155
  return (
@@ -164,6 +162,23 @@ function FooterLinksMenu({
164
162
  );
165
163
  }
166
164
 
165
+ /** App-store / Google-Play buttons. Nothing shows -- not even the wrapping
166
+ * div -- when the store has neither link set. */
167
+ function FooterApps({ className }: { className: string }) {
168
+ const { store } = useTwilight();
169
+ const { t } = useTranslation();
170
+ if (!store.apps?.appstore && !store.apps?.googleplay) return null;
171
+
172
+ return (
173
+ <div data-testid="store-footer-apps" className={`store-footer__apps ${className}`}>
174
+ <SallaAppsIcons
175
+ apps={store.apps}
176
+ appsTitle={t('blocks.footer.download_apps', 'Get our apps')}
177
+ />
178
+ </div>
179
+ );
180
+ }
181
+
167
182
  /** The logo link, same shape in both layouts -- only its own spacing differs. */
168
183
  function FooterLogo({ className }: { className: string }) {
169
184
  const { store } = useTwilight();
@@ -200,9 +215,6 @@ function FooterDescription({ className }: { className: string }) {
200
215
  /** Centered layout: logo, description, social, footer menu, trust badges and
201
216
  * app buttons stacked as one centered column. */
202
217
  function FooterCenteredBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {
203
- const { store } = useTwilight();
204
- const { t } = useTranslation();
205
-
206
218
  return (
207
219
  <div className="container mx-auto flex max-w-2xl flex-col items-center gap-6 text-center">
208
220
  <FooterLogo className="" />
@@ -217,12 +229,7 @@ function FooterCenteredBody({ inSheet, isDark }: { inSheet: boolean; isDark: boo
217
229
 
218
230
  <FooterTrust dark={isDark} centered />
219
231
 
220
- <div className="store-footer__apps flex flex-col items-center gap-3">
221
- <SallaAppsIcons
222
- apps={store.apps}
223
- appsTitle={t('blocks.footer.download_apps', 'Get our apps')}
224
- />
225
- </div>
232
+ <FooterApps className="flex flex-col items-center gap-3" />
226
233
  </div>
227
234
  );
228
235
  }
@@ -230,7 +237,6 @@ function FooterCenteredBody({ inSheet, isDark }: { inSheet: boolean; isDark: boo
230
237
  /** Columns layout: brand (logo / description / social / trust) and app
231
238
  * buttons side by side, with the footer menu as its own labeled column. */
232
239
  function FooterColumnsBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {
233
- const { store } = useTwilight();
234
240
  const { t } = useTranslation();
235
241
 
236
242
  return (
@@ -249,12 +255,7 @@ function FooterColumnsBody({ inSheet, isDark }: { inSheet: boolean; isDark: bool
249
255
  dark={isDark}
250
256
  />
251
257
 
252
- <div className="store-footer__apps">
253
- <SallaAppsIcons
254
- apps={store.apps}
255
- appsTitle={t('blocks.footer.download_apps', 'Get our apps')}
256
- />
257
- </div>
258
+ <FooterApps className="" />
258
259
  </div>
259
260
  );
260
261
  }
@@ -44,7 +44,6 @@ export function MasterLayout({ children }: LayoutProps) {
44
44
  <SallaLoginModal
45
45
  isEmailAllowed={store?.settings?.auth?.email_allowed}
46
46
  isMobileAllowed={store?.settings?.auth?.mobile_allowed}
47
- isEmailRequired={store?.settings?.auth?.is_email_required}
48
47
  suppressHydrationWarning
49
48
  />
50
49
  </Suspense>
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/apply-theme.ts","../src/providers/twilight-theme.ts","../src/utils/engine-version.ts","../src/providers/twilight-init.ts","../src/providers/native-safe-area.ts","../src/providers/navigation-setups.ts","../src/providers/DocumentSyncRegistry.ts","../src/hooks/useDate.ts","../src/hooks/useNumber.ts","../src/utils/number.ts","../src/hooks/useMoney.tsx","../src/hooks/useGtm.ts","../src/hooks/useOpeningHours.ts","../src/hooks/usePageConfig.ts","../src/utils/breadcrumb.ts","../src/hooks/useBreadcrumbs.ts","../src/utils/fast-checkout.ts","../src/hooks/registerDefaultHooks.tsx","../src/components/layout/MasterLayout.tsx","../src/components/snippets/AppsSnippets.tsx","../src/components/snippets/SallaSdkScripts.tsx","../src/providers/TwilightProvider.tsx","../src/hooks/useStore.ts"],"names":["color","useEffect","lazy","ARABIC_NUMERALS","useCallback","useMemo","useState","jsx","id","jsxs","Fragment","Suspense","getSalla","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAAS,aAAa,KAAA,EAAkC;AAC7D,EAAA,MAAM,OAA2B,EAAC;AAElC,EAAA,IAAI,KAAA,CAAM,MAAM,IAAA,EAAM;AACpB,IAAA,IAAA,CAAK,IAAA;AAAA,MACH,CAAC,aAAA,EAAe,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA;AAAA,MAC/B,CAAC,cAAA,EAAgB,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA;AAAA,MAChC,CAAC,gBAAA,EAAkB,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA;AAAA,MAClC,CAAC,eAAA,EAAiB,CAAA,EAAG,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA,OAAA,CAAS,CAAA;AAAA,MAC7C,CAAC,aAAA,EAAe,CAAA,EAAG,KAAA,CAAM,IAAA,CAAK,IAAI,CAAA,KAAA,CAAO;AAAA,KAC3C;AAAA,EACF;AAEA,EAAA,MAAM,EAAE,KAAA,EAAAA,MAAAA,EAAM,GAAI,KAAA;AAClB,EAAA,IAAIA,MAA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A,QAAA,oBAAYA,GAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,mBAAkB,CAAA,EAAG,CAAA;AAAA,IAEnF;AAAA,GAAA,EACH,GACF,CAAA,EACF,CAAA;AAEJ;;;ACrTO,SAAS,QAAA,GAA2B;AACzC,EAAA,MAAM,EAAE,KAAA,EAAO,SAAA,EAAW,KAAA,KAAU,WAAA,EAAY;AAEhD,EAAA,MAAM,OAAA,GAAUH,YAAY,YAAY;AACtC,IAAA,IAAI,CAAC,KAAA,EAAO;AACZ,IAAA,IAAI;AACF,MAAA,MAAM,IAAA,GAAO,KAAA,CAAM,MAAA,CAAO,GAAA,EAAI;AAC9B,MAAA,IAAI,IAAA,EAAM,KAAA,IAAS,OAAO,IAAA,CAAK,UAAU,QAAA,EAAU;AACjD,QAAA,SAAA,CAAU,CAAC,UAAU,EAAE,GAAG,MAAM,GAAI,IAAA,CAAK,OAAyB,CAAE,CAAA;AAAA,MACtE;AAAA,IACF,CAAA,CAAA,MAAQ;AAAA,IAER;AAAA,EACF,CAAA,EAAG,CAAC,KAAA,EAAO,SAAS,CAAC,CAAA;AAErB,EAAA,OAAO,EAAE,GAAG,KAAA,EAAO,OAAA,EAAQ;AAC7B","file":"chunk-PWTXR4RR.js","sourcesContent":["import type { Theme } from '../types';\nimport { color as makeColor } from './color';\n\nexport function themeCssVars(theme: Theme): [string, string][] {\n const vars: [string, string][] = [];\n\n if (theme.font?.name) {\n vars.push(\n ['--font-main', theme.font.name],\n ['--font-light', theme.font.name],\n ['--font-regular', theme.font.name],\n ['--font-medium', `${theme.font.name}-Medium`],\n ['--font-bold', `${theme.font.name}-Bold`]\n );\n }\n\n const { color } = theme;\n if (color) {\n vars.push(['--color-text', '#222222']);\n\n if (color.primary) {\n const c = makeColor(color.primary);\n vars.push(\n ['--color-primary', color.primary],\n ['--color-primary-dark', c.darken(0.15)],\n ['--color-primary-light', c.lighten(0.15)],\n ['--color-title', color.primary],\n ['--color-secondary', color.primary]\n );\n }\n\n if (color.reverse_text) {\n vars.push(\n ['--color-primary-reverse', color.reverse_text],\n ['--color-text-reverse', color.reverse_text],\n ['--color-reverse-text', color.reverse_text]\n );\n }\n\n if (color.reverse_primary) {\n vars.push(['--color-reverse-primary', color.reverse_primary]);\n }\n }\n\n vars.push(['--page-height', '100%']);\n return vars;\n}\n\n// What the previous applyTheme set, so a theme without a font or colour (another\n// market's, after a scope change) does not keep the previous one's values.\nlet applied = new Set<string>();\n\nexport function applyTheme(theme: Theme): void {\n if (typeof document === 'undefined') return;\n\n const root = document.documentElement;\n const vars = themeCssVars(theme);\n const next = new Set(vars.map(([prop]) => prop));\n for (const prop of applied) {\n if (!next.has(prop)) root.style.removeProperty(prop);\n }\n for (const [prop, val] of vars) {\n root.style.setProperty(prop, val);\n }\n applied = next;\n}\n","import { createElement, useEffect, type ReactElement } from 'react';\nimport { applyTheme, themeCssVars } from '../utils/apply-theme';\nimport { escapeForInlineScript } from '../utils/inline-script';\nimport { useDocumentClass } from '../hooks/useDocumentClass';\nimport type { Theme } from '../types';\n\nexport function fontToClass(name: string | undefined): string | null {\n if (!name) return null;\n const slug = name\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n return slug ? `font-${slug}` : null;\n}\n\nexport function themeBodyClasses(\n theme: Theme,\n direction: 'rtl' | 'ltr',\n isMobileWebview: boolean\n): string[] {\n return [\n theme.name ? `salla-${theme.name}` : null,\n `color-mode-${theme.color?.is_dark ? 'dark' : 'light'}`,\n direction,\n theme.mode === 'preview' ? 'preview-mode' : null,\n fontToClass(theme.font?.name),\n isMobileWebview ? 'mobile-webview' : null,\n theme.settings?.footer_is_dark ? 'footer-is-dark' : 'footer-is-light',\n theme.settings?.topnav_is_dark ? 'topnav-is-dark' : null,\n theme.settings?.sticky_add_to_cart ? 'is-sticky-product-bar' : null,\n ].filter(Boolean) as string[];\n}\n\n/** Applies the theme's variables and body classes as the body starts parsing, ahead of hydration. */\nexport function themeSyncScript(vars: [string, string][], bodyClasses: string[]): string {\n const json = (value: unknown) => escapeForInlineScript(JSON.stringify(value));\n return (\n `(function(d){var s=d.documentElement.style;${json(vars)}.forEach(function(v){s.setProperty(v[0],v[1])});` +\n `d.body.classList.add.apply(d.body.classList,${json(bodyClasses)})})(document);`\n );\n}\n\nexport function ThemeDocumentSync({\n theme,\n locale,\n direction,\n isMobileWebview,\n}: {\n theme: Theme;\n locale: string;\n direction: 'rtl' | 'ltr';\n isMobileWebview: boolean;\n}): ReactElement {\n const bodyClasses = themeBodyClasses(theme, direction, isMobileWebview);\n\n useDocumentClass({\n html: { lang: locale, dir: direction },\n body: { class: bodyClasses },\n });\n\n useEffect(() => {\n applyTheme(theme);\n }, [theme]);\n\n // React 19 renders script children verbatim; themeSyncScript escapes `<`, so the tag can't close early.\n return createElement(\n 'script',\n { id: 'salla-theme-sync', suppressHydrationWarning: true },\n themeSyncScript(themeCssVars(theme), bodyClasses)\n );\n}\n","/**\n * The engine's own build version, injected by tsup `define` when dist is\n * built. Falls back to 'dev' when the source runs unbundled (vitest, direct\n * src imports in the monorepo).\n *\n * Exposed at runtime as `salla.versions.engine` by `useTwilightInit` so a\n * storefront can always be asked which engine build rendered it.\n */\nexport const ENGINE_VERSION: string =\n typeof __TWILIGHT_ENGINE_VERSION__ !== 'undefined' ? __TWILIGHT_ENGINE_VERSION__ : 'dev';\n","import {\n type Dispatch,\n type SetStateAction,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\nimport type { SallaCurrency, SallaSDK } from '../types/salla-sdk';\nimport { getActiveCurrency } from '../api/client';\nimport { useDevSettingsOverrides } from '../dev/dev-settings-store';\nimport { getTwilightContext } from '../twilight/context';\nimport type { Store, Theme } from '../types';\nimport { syncScopeCookie } from '../utils/cookies';\nimport { ENGINE_VERSION } from '../utils/engine-version';\nimport { type StoreContext, syncSdkLocale, whenSallaLoaded } from '../utils/sdk-helpers';\nimport { getLanguageInfo } from './locale-constants';\n\n// ─── Helpers ──────────────────────────────────────────────────────────────────\n\nfunction getSalla(): SallaSDK | undefined {\n if (typeof window === 'undefined') return undefined;\n return window.salla;\n}\n\n// The SDK's own guest currency default (init-user.js); its cookie.get drops that default.\nconst SDK_GUEST_CURRENCY = 'SAR';\n\n// The SDK starts in `user.language_code` and loads only that language's messages, so it is the\n// page's: `s-lang` and the stored user can name another, and an `/en` page then drew its salla-*\n// components in Arabic, or as raw keys. They answer only when the page names no language.\nfunction userLanguage(sdk: SallaSDK, locale: string, stored?: unknown) {\n return locale || (sdk.cookie?.get?.('s-lang') ?? stored);\n}\n\n// The SDK resolves these itself (init-user.js), but its cookie.get drops the stored fallback.\nfunction withCookieLocale(sdk: SallaSDK, stored: Record<string, unknown>, locale: string) {\n return {\n ...stored,\n language_code: userLanguage(sdk, locale, stored.language_code),\n currency_code: sdk.cookie?.get?.('s-curr') ?? stored.currency_code ?? SDK_GUEST_CURRENCY,\n };\n}\n\n// The API derives currency/country/geo from the SSR worker's IP, so only IP-free guest fields are seeded.\nfunction withSettingsUser(sdk: SallaSDK, settings: StoreContext | undefined, locale: string) {\n if (!settings) return settings;\n const { user: guest, ...rest } = settings;\n const stored = sdk.storage?.get?.('user') as Record<string, unknown> | null | undefined;\n if (stored) return { ...rest, user: withCookieLocale(sdk, stored, locale) };\n const {\n currency_code: _currency,\n country_code: _country,\n default_geo_location: _geo,\n ...visitor\n } = guest ?? { type: 'guest' };\n return {\n ...rest,\n user: {\n ...visitor,\n language_code: userLanguage(sdk, locale, visitor.language_code),\n currency_code: sdk.cookie?.get?.('s-curr') ?? SDK_GUEST_CURRENCY,\n },\n };\n}\n\n// Twig layouts set it; without it the SDK's product cards request `<theme assets>/undefined`.\nconst PLACEHOLDER_IMAGE = 'https://cdn.salla.network/images/placeholder.png';\n\nfunction withPlaceholder<T extends Pick<StoreContext, 'theme'>>(settings: T): T {\n const theme = settings.theme;\n if (!theme || theme.settings?.placeholder) return settings;\n return {\n ...settings,\n theme: { ...theme, settings: { ...theme.settings, placeholder: PLACEHOLDER_IMAGE } },\n };\n}\n\n// The SDK ignores `window.translations` and reuses only its own cache, else it downloads every locale.\nfunction seedSdkTranslations(sdk: SallaSDK, settings: StoreContext | undefined, locale: string) {\n const localeKey = `${locale}.trans`;\n const messages = window.translations?.[localeKey];\n const hash = settings?.theme?.translations_hash ?? settings?.store?.id;\n if (!messages || !Object.keys(messages).length || !hash) return;\n try {\n const cached = sdk.storage.get(`s_translations.${hash}`) as Record<string, unknown> | null;\n if (cached?.[localeKey]) return;\n sdk.storage.set('s_translations', { [hash]: { [localeKey]: messages } });\n } catch {\n // Storage full, disabled or missing: the SDK downloads its own copy, as before.\n }\n}\n\n// ─── Hook ─────────────────────────────────────────────────────────────────────\n\nexport interface UseTwilightInitOptions {\n debug: boolean;\n initialData?: StoreContext | Record<string, unknown>;\n onReady?: (data: { store: Store; theme: Theme }) => void;\n onError?: (error: Error) => void;\n initialLocale: string;\n}\n\nexport interface UseTwilightInitReturn {\n isReady: boolean;\n storeData: Store;\n setStoreData: Dispatch<SetStateAction<Store>>;\n themeData: Theme;\n currency: SallaCurrency | null;\n isMobileWebview: boolean;\n}\n\n// Each SDK init() mounts another copy of its auto widgets (loyalty banners...), so run it once.\nconst initializedSdks = new WeakSet<object>();\nconst EMPTY_STORE = {} as Store;\n\nexport function useTwilightInit({\n debug: _debug,\n initialData,\n onReady,\n onError: _onError,\n initialLocale,\n}: UseTwilightInitOptions): UseTwilightInitReturn {\n const isBrowser = typeof window !== 'undefined';\n const initialLanguage = getLanguageInfo(initialLocale);\n const settingsData = initialData as StoreContext | undefined;\n\n const [isReady, setReady] = useState<boolean>(() => !!settingsData);\n // Settings answered for another market (a scope switch) carry another store scope\n // and theme version; follow them instead of the first page load's. A theme's\n // `_setStore` patch applies on top of the settings it was written against only.\n const settingsStore = (settingsData?.store as Store | undefined) ?? EMPTY_STORE;\n const [storePatch, setStorePatch] = useState<{ base: Store; patch: Partial<Store> } | null>(null);\n const patch = storePatch?.base === settingsStore ? storePatch.patch : null;\n const storeData = useMemo<Store>(\n () => (patch ? { ...settingsStore, ...patch } : settingsStore),\n [settingsStore, patch]\n );\n const setStoreData = useCallback<Dispatch<SetStateAction<Store>>>(\n (action) =>\n setStorePatch((prev) => {\n const prevPatch = prev?.base === settingsStore ? prev.patch : null;\n return {\n base: settingsStore,\n patch: typeof action === 'function' ? action({ ...settingsStore, ...prevPatch }) : action,\n };\n }),\n [settingsStore]\n );\n const settingsTheme = settingsData?.theme as Partial<Theme> | undefined;\n const baseTheme = useMemo<Theme>(() => {\n if (settingsTheme) {\n return {\n ...settingsTheme,\n is_rtl: settingsTheme.is_rtl ?? initialLanguage.dir === 'rtl',\n } as Theme;\n }\n return { is_rtl: initialLanguage.dir === 'rtl' } as Theme;\n }, [settingsTheme, initialLanguage.dir]);\n\n // Dev-mode only: overlay the settings the DevSettingsWidget has enabled onto\n // the real theme so the storefront renders with them live. `import.meta.env.DEV`\n // is statically false in production builds, so this whole branch (and the\n // overrides hook's effect) is dead-code-eliminated from the shipped bundle.\n const devOverrides = useDevSettingsOverrides();\n const themeData = useMemo<Theme>(() => {\n if (import.meta.env.DEV && devOverrides.enabled) {\n const overrides = devOverrides.settings;\n if (overrides && Object.keys(overrides).length > 0) {\n return {\n ...baseTheme,\n settings: { ...(baseTheme.settings ?? {}), ...overrides } as Theme['settings'],\n };\n }\n }\n return baseTheme;\n }, [baseTheme, devOverrides]);\n const [currency] = useState<SallaCurrency | null>(() => {\n const code = getActiveCurrency();\n const active = code ? settingsData?.currencies?.[code] : undefined;\n return active ? { code: active.code, name: active.name, symbol: active.symbol } : null;\n });\n const [isMobileWebview] = useState<boolean>(false); // todo :: add a flage in the store data for mobile\n\n useEffect(() => {\n if (!isBrowser || !themeData) return;\n const sdk = getSalla();\n sdk?.config?.set?.('theme.is_rtl', themeData.is_rtl ?? false);\n window.enable_more_menu = String(themeData.settings?.enable_more_menu ?? true);\n }, [themeData, isBrowser]);\n\n useEffect(() => {\n // Not `if (!sdk) return`: `window.salla` is the head script's stub until the SDK\n // has loaded, and on a cold load hydration runs this first. Returning then left\n // the storefront with an SDK nobody ever initialised — `salla.status` stuck on\n // 'loading', no store config, no cart. Wait for it instead.\n return whenSallaLoaded((sdk) => {\n // Expose which engine build rendered this storefront (salla.versions.engine)\n // for debugging and support tooling. Merged, not assigned, so other Salla\n // packages can register their own versions on the same object.\n const sdkWithVersions = sdk as SallaSDK & { versions?: Record<string, string> };\n sdkWithVersions.versions = { ...sdkWithVersions.versions, engine: ENGINE_VERSION };\n\n if (initialLocale) {\n // Sync UI translations + the SDK's axios accept-language header to the route locale.\n // The header set may be a no-op now if the SDK isn't fully ready; it's re-asserted\n // after onReady below, and on every navigation in rootBeforeLoad.\n syncSdkLocale(initialLocale);\n }\n\n if (typeof sdk.init !== 'function') return;\n\n const ctx = getTwilightContext();\n const pageCtx = ctx.page;\n const userData = withSettingsUser(sdk, settingsData, initialLocale);\n const baseData = userData && withPlaceholder(userData);\n const initData = pageCtx\n ? {\n ...baseData,\n page: {\n ...pageCtx,\n url: pageCtx.url ?? ctx.location.pathname + ctx.location.searchStr,\n },\n }\n : baseData;\n\n if (!initializedSdks.has(sdk)) {\n initializedSdks.add(sdk);\n seedSdkTranslations(sdk, settingsData, initialLocale);\n sdk.init(initData);\n }\n\n const initSdk = async () => {\n try {\n await sdk.onReady();\n } catch {\n // sdk.onReady() may fail during partial initialization\n }\n\n // The SDK loads async; the sync above may have run against a not-yet-ready SDK.\n // Now that it's ready, re-assert so the very first SDK API calls use the route locale.\n syncSdkLocale(initialLocale);\n\n // Mirror the selected branch into the `scope` cookie so the NEXT SSR request keys\n // its settings query on the same scope the client does. rootBeforeLoad also calls\n // this, but only from a client-side navigation: on the initial load TanStack\n // restores the root match's __beforeLoadContext instead of re-running beforeLoad,\n // so a visitor who never navigates would otherwise never write the cookie. Here is\n // the earliest point salla.storage is guaranteed populated.\n syncScopeCookie();\n\n setReady(true);\n document.dispatchEvent(new CustomEvent('theme::ready'));\n\n onReady?.({\n store: storeData,\n theme: themeData,\n });\n };\n\n initSdk();\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- Intentional: SDK init runs once per locale change only\n }, [initialLocale]);\n\n return {\n isReady,\n storeData,\n setStoreData,\n themeData,\n currency,\n isMobileWebview,\n };\n}\n","import { useEffect } from 'react';\nimport { isNativeApp } from '../native-app';\nimport { onSallaEvent, whenSallaReady } from '../utils/sdk-helpers';\n\nconst SAFE_AREA_EVENT = 'mobile::ui.safearea';\nconst CSS_VARS = { top: '--app-safe-area-top', bottom: '--app-safe-area-bottom' } as const;\n\n/**\n * Writes the native app's insets (status bar, home indicator) to `--app-safe-area-top` and\n * `--app-safe-area-bottom` on `<html>`, for a theme's CSS to read. The values come from the\n * `mobile::ui.safearea` payload, so a re-emit updates them live. Nothing is registered\n * outside the app (`isNativeApp()`): there the variables stay unset and a\n * consumer falls back to `0px`. The app is recognised once the SDK is ready, not just\n * loaded: one that identifies itself through its config has not said so before `init`.\n *\n * `TwilightProvider` calls this rather than the navigation setup, which loads lazily and\n * would attach later than a theme's own root-level listener did.\n */\nexport function useNativeSafeArea(): void {\n useEffect(() => {\n let off: (() => void) | undefined;\n const cancel = whenSallaReady(() => {\n if (isNativeApp()) off = onSallaEvent(SAFE_AREA_EVENT, applySafeArea);\n });\n return () => {\n cancel();\n off?.();\n };\n }, []);\n}\n\n/** `{ top, bottom }` in pixels; the legacy payload is the top inset alone, as `{ value }`. */\nfunction applySafeArea(data?: unknown): void {\n const payload = data as { value?: unknown; top?: unknown; bottom?: unknown } | undefined;\n for (const side of ['top', 'bottom'] as const) {\n const px = Number(side === 'top' ? (payload?.top ?? payload?.value) : payload?.bottom);\n if (Number.isFinite(px)) {\n document.documentElement.style.setProperty(CSS_VARS[side], `${px}px`);\n }\n }\n}\n","import { lazy, type LazyExoticComponent, type FC, type ReactNode } from 'react';\n\nexport const navigationSetups: Record<string, LazyExoticComponent<FC<{ children: ReactNode }>>> = {\n tanstack: lazy(() =>\n import('../tanstack/navigation').then((m) => ({ default: m.NavigationSetup }))\n ),\n nextjs: lazy(() => import('../nextjs/navigation').then((m) => ({ default: m.NavigationSetup }))),\n};\n","import { lazy, type FC, type LazyExoticComponent } from 'react';\n\n/**\n * Registry for framework-specific document sync components.\n * Each framework (tanstack, nextjs, etc.) can register its own sync component.\n * Used by TwilightProvider to automatically apply route-based body classes.\n *\n * @example Adding a new framework\n * ```ts\n * import { registerDocumentSync } from '@salla.sa/twilight-theme-engine';\n *\n * registerDocumentSync('my-framework', lazy(() => import('./my-document-sync')));\n * ```\n */\nexport const routeDocumentSyncs: Record<string, LazyExoticComponent<FC>> = {\n tanstack: lazy(() =>\n import('../tanstack/document-class').then((m) => ({\n default: m.TanStackDocumentSync,\n }))\n ),\n // Add other frameworks here:\n // nextjs: lazy(() => import('../nextjs/document-sync').then(m => ({ default: m.NextjsDocumentSync }))),\n};\n\n/**\n * Register a framework-specific document sync component.\n * Convenience function for adding new frameworks to the registry.\n */\nexport function registerDocumentSync(framework: string, component: LazyExoticComponent<FC>): void {\n routeDocumentSyncs[framework] = component;\n}\n","import { useTranslation } from '../providers/I18nProvider';\n\ntype DateFormat = 'full' | 'long' | 'medium' | 'short' | 'time';\n\nexport type DateInput =\n | string\n | number\n | Date\n | { date: string; timezone_type: number; timezone: string }\n | undefined;\n\nfunction normalizeDate(input: DateInput): Date {\n if (!input) return new Date();\n if (input instanceof Date) return input;\n if (typeof input === 'number') return new Date(input);\n if (typeof input === 'object' && 'date' in input) return new Date(input.date);\n return new Date(input);\n}\n\nexport interface UseDateResult {\n format: (date: DateInput, formatType?: DateFormat) => string;\n ago: (date: DateInput) => string;\n now: Date;\n}\n\n/**\n * useDate - Hook for formatting dates\n *\n * @example\n * const { format, ago, now } = useDate();\n * format('2024-03-15') // 'March 15, 2024'\n * format('2024-03-15', 'full') // 'Friday, March 15, 2024'\n * ago(Date.now() - 3600000) // '1 hour ago'\n * now // current Date object\n */\nexport function useDate(): UseDateResult {\n const { locale } = useTranslation();\n\n const format = (date: DateInput, formatType: DateFormat = 'medium'): string => {\n const dateObj = normalizeDate(date);\n\n const formatOptionsMap: Record<DateFormat, Intl.DateTimeFormatOptions> = {\n full: { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' },\n long: { year: 'numeric', month: 'long', day: 'numeric' },\n medium: { year: 'numeric', month: 'long', day: 'numeric' },\n short: { year: 'numeric', month: 'short', day: 'numeric' },\n time: { hour: '2-digit', minute: '2-digit' },\n };\n\n try {\n return new Intl.DateTimeFormat(locale, formatOptionsMap[formatType]).format(dateObj);\n } catch {\n return dateObj.toLocaleDateString(locale);\n }\n };\n\n const ago = (date: DateInput): string => {\n const dateObj = normalizeDate(date);\n const diffInSeconds = Math.floor((Date.now() - dateObj.getTime()) / 1000);\n\n const units: Array<{ unit: Intl.RelativeTimeFormatUnit; threshold: number; divisor: number }> =\n [\n { unit: 'year', threshold: 31536000, divisor: 31536000 },\n { unit: 'month', threshold: 2592000, divisor: 2592000 },\n { unit: 'week', threshold: 604800, divisor: 604800 },\n { unit: 'day', threshold: 86400, divisor: 86400 },\n { unit: 'hour', threshold: 3600, divisor: 3600 },\n { unit: 'minute', threshold: 60, divisor: 60 },\n { unit: 'second', threshold: 1, divisor: 1 },\n ];\n\n for (const { unit, threshold, divisor } of units) {\n if (diffInSeconds >= threshold) {\n const value = Math.floor(diffInSeconds / divisor);\n try {\n return new Intl.RelativeTimeFormat(locale, { numeric: 'auto', style: 'long' }).format(\n -value,\n unit\n );\n } catch {\n return new Intl.RelativeTimeFormat('en', { numeric: 'auto' }).format(-value, unit);\n }\n }\n }\n\n return locale.startsWith('ar') ? 'الآن' : 'just now';\n };\n\n return { format, ago, now: new Date() };\n}\n","import { useTwilight } from '../providers/TwilightProvider';\n\nconst ARABIC_NUMERALS = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];\n\nconst toArabic = (input: number | string): string => {\n const str = String(input);\n return str.replace(/[0-9]/g, (d) => ARABIC_NUMERALS[parseInt(d)]);\n};\n\n/**\n * UseNumberResult - Return type for useNumber hook\n */\nexport interface UseNumberResult {\n /** Format number with store settings */\n format: (number: number | string) => string;\n /** Convert to Arabic numerals */\n toArabic: (input: number | string) => string;\n /** Whether Arabic numerals are enabled */\n useArabicNumerals: boolean;\n}\n\n/**\n * useNumber - Hook for number formatting\n *\n * @returns Object with number formatting utilities\n *\n * @example\n * const { format, toArabic, useArabicNumerals } = useNumber();\n * format(1234) // '١٢٣٤' if arabic numbers enabled, else '1234'\n * toArabic(1234) // '١٢٣٤'\n * useArabicNumerals // boolean from store settings\n */\nexport function useNumber(): UseNumberResult {\n const { store } = useTwilight();\n const useArabicNumerals = store?.settings?.arabic_numbers_enabled ?? false;\n\n const format = (number: number | string): string => {\n return useArabicNumerals ? toArabic(number) : String(number);\n };\n\n return {\n /** Format number with store settings */\n format,\n /** Convert to Arabic numerals */\n toArabic,\n /** Whether Arabic numerals are enabled */\n useArabicNumerals,\n };\n}\n","/**\n * Number formatting utilities\n *\n * For React components, use useNumber hook instead.\n */\n\nconst ARABIC_NUMERALS = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];\n\n/**\n * Convert Western Arabic numerals (0-9) to Arabic-Indic numerals (٠-٩)\n *\n * @example\n * toArabicNumerals('123') // '١٢٣'\n */\nexport function toArabicNumerals(input: number | string): string {\n const str = String(input);\n return str.replace(/[0-9]/g, (d) => ARABIC_NUMERALS[parseInt(d)]);\n}\n\n/**\n * Format number with optional Arabic numerals\n *\n * @example\n * formatNumber(1234, true) // '١٢٣٤'\n * formatNumber(1234, false) // '1234'\n */\nexport function formatNumber(number: number | string, useArabic: boolean): string {\n return useArabic ? toArabicNumerals(number) : String(number);\n}\n","import { useTwilight } from '../providers/TwilightProvider';\nimport { toArabicNumerals } from '../utils/number';\nimport React from 'react';\n\nconst SAR_SYMBOLS = ['SAR', 'ر.س'];\n\n/**\n * Parse a money string to a number.\n *\n * Locale-agnostic by design: normalises both Western (`,.`) and\n * Arabic-Indic (`٬`, `٫`) separators using fixed rules. Do NOT add\n * locale-dependent separator logic here — if per-locale rules are\n * ever needed, refactor back into the hook body where `locale`\n * is available.\n */\nconst parse = (moneyString: string): number => {\n const cleaned = moneyString.replace(/[^\\d.,٬٫]/g, '');\n const normalized = cleaned.replace(/٬/g, '').replace(/٫/g, '.');\n const parts = normalized.split(/[.,]/);\n if (parts.length > 2) {\n return parseFloat(`${parts.slice(0, -1).join('')}.${parts[parts.length - 1]}`);\n }\n return parseFloat(normalized.replace(/,/g, ''));\n};\n\n/**\n * Check if a value is a valid monetary amount.\n *\n * Locale-agnostic: accepts numbers and numeric strings only.\n */\nconst isValid = (value: unknown): boolean => {\n if (typeof value === 'number' && !isNaN(value) && isFinite(value)) return true;\n if (typeof value === 'string') {\n const parsed = parseFloat(value);\n return !isNaN(parsed) && isFinite(parsed);\n }\n return false;\n};\n\n/**\n * UseMoneyResult - Return type for useMoney hook\n */\nexport interface UseMoneyResult {\n /** Format amount with currency */\n format: (\n amount: number | string | undefined,\n options?: { currency?: string; locale?: string; type?: 'product' | 'general' }\n ) => React.ReactNode;\n /** Parse money string to number */\n parse: (moneyString: string) => number;\n /** Check if value is valid monetary amount */\n isValid: (value: unknown) => boolean;\n}\n\n/**\n * useMoney - Hook for formatting monetary values, matching Twilight's `salla.money`\n *\n * @example\n * const { format, parse, isValid } = useMoney();\n * // Render price (SAR shows the icon when the store enables it):\n * <span>{format(100)}</span> // '100' with <i className=\"sicon-sar\" />\n */\nexport function useMoney(): UseMoneyResult {\n const { store, settings, currency: active } = useTwilight();\n const useArabicNumerals = store?.settings?.arabic_numbers_enabled ?? false;\n const useSarSymbol = store?.settings?.use_sar_symbol ?? false;\n\n const format = (\n amount: number | string | undefined,\n options?: { currency?: string; locale?: string; type?: 'product' | 'general' }\n ): React.ReactNode => {\n const currency = options?.currency ?? active?.code ?? 'SAR';\n const type = options?.type ?? 'product';\n\n if (amount == null || amount === '') {\n const showDash = type === 'product' ? store?.settings?.product?.show_price_as_dash : false;\n return showDash ? '-' : '';\n }\n\n if (typeof amount === 'string' && amount === '-') return amount;\n if (isNaN(typeof amount === 'string' ? parseFloat(amount) : amount)) return String(amount);\n\n // Printed as given, like salla.money: \"10.50\" keeps its zero.\n const number = useArabicNumerals ? toArabicNumerals(amount).replace('.', '٫') : String(amount);\n const symbol = settings?.currencies?.[currency]?.symbol ?? currency;\n\n if (useSarSymbol && SAR_SYMBOLS.includes(symbol)) {\n return (\n <>\n {number} <i className=\"sicon-sar\" />\n </>\n );\n }\n return `${number} ${symbol}`;\n };\n\n return { format, parse, isValid };\n}\n","import { useCallback } from 'react';\nimport type { Product, Cart, CartItem } from '../types';\nimport { useTwilight } from '../providers/TwilightProvider';\nimport { useUser } from './useUser';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface UseGtmResult {\n /** Check if GTM is enabled */\n enabled: boolean;\n /** Raw push to dataLayer */\n push: (data: Record<string, unknown>) => void;\n /** Track page view */\n viewPage: (pageType: string) => void;\n /** Track product detail view */\n detail: (product: Product) => void;\n /** Track product impressions (listing) */\n impressions: (products: Product[], list?: string) => void;\n /** Track product click */\n click: (product: Product, list?: string, position?: number) => void;\n /** Track add to cart */\n add: (product: Product, quantity?: number) => void;\n /** Track remove from cart */\n remove: (item: CartItem) => void;\n /** Track checkout */\n checkout: (cart: Cart, step?: number) => void;\n /** Track purchase */\n purchase: (orderId: string | number, cart: Cart) => void;\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\n/** Generate unique event ID */\nfunction eventId(prefix: string): string {\n return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;\n}\n\n/** Convert Product to GTM format */\nfunction toProduct(product: Product, overrides?: Record<string, unknown>): Record<string, unknown> {\n return {\n id: product.id,\n name: product.name,\n price: product.sale_price,\n brand: product.brand?.name,\n category: product.category?.name,\n quantity: 1,\n ...overrides,\n };\n}\n\n/** Get currency from product or fallback */\nfunction getCurrency(product?: Product, fallback = 'SAR'): string {\n return product?.currency ?? fallback;\n}\n\n// ============================================================================\n// Hook Implementation\n// ============================================================================\n\n/**\n * useGtm - Google Tag Manager hook for tracking events\n *\n * @example\n * ```tsx\n * function ProductPage({ product }) {\n * const gtm = useGtm();\n *\n * useEffect(() => { gtm.detail(product); }, [product.id]);\n * return <button onClick={() => gtm.add(product)}>Add to Cart</button>;\n * }\n * ```\n */\nexport function useGtm(): UseGtmResult {\n const { store } = useTwilight();\n const { data: user } = useUser();\n\n const gtmIds = store.settings?.keys?.gtm;\n const enabled = !!(gtmIds && gtmIds.length > 0);\n const currency = user?.preferences?.currency_code ?? 'SAR';\n\n const push = useCallback(\n (data: Record<string, unknown>) => {\n if (!enabled) return;\n window.dataLayer = window.dataLayer || [];\n window.dataLayer.push(data);\n },\n [enabled]\n );\n\n const viewPage = useCallback((pageType: string) => push({ event: 'viewPage', pageType }), [push]);\n\n const detail = useCallback(\n (product: Product) =>\n push({\n event: 'detail',\n ecommerce: {\n currencyCode: getCurrency(product, currency),\n event_id: eventId('detail'),\n detail: { products: [toProduct(product)] },\n },\n }),\n [push, currency]\n );\n\n const impressions = useCallback(\n (products: Product[], list?: string) => {\n if (products.length === 0) return;\n push({\n event: 'impressions',\n ecommerce: {\n currencyCode: getCurrency(products[0], currency),\n event_id: eventId('impressions'),\n impressions: {\n products: products.map((p, i) => toProduct(p, { position: i + 1, list })),\n },\n },\n });\n },\n [push, currency]\n );\n\n const click = useCallback(\n (product: Product, list?: string, position?: number) =>\n push({\n event: 'click',\n ecommerce: {\n currencyCode: getCurrency(product, currency),\n event_id: eventId('click'),\n click: {\n actionField: { list },\n products: [toProduct(product, { position, list })],\n },\n },\n }),\n [push, currency]\n );\n\n const add = useCallback(\n (product: Product, quantity = 1) =>\n push({\n event: 'addToCart',\n ecommerce: {\n currencyCode: getCurrency(product, currency),\n event_id: eventId('addToCart'),\n add: { products: [toProduct(product, { quantity })] },\n },\n }),\n [push, currency]\n );\n\n const remove = useCallback(\n (item: CartItem) =>\n push({\n event: 'removeFromCart',\n ecommerce: {\n currencyCode: currency,\n event_id: eventId('removeFromCart'),\n remove: {\n products: [\n {\n id: item.product_id,\n name: item.product_name,\n price: typeof item.price === 'number' ? item.price : item.price.amount,\n quantity: item.quantity,\n },\n ],\n },\n },\n }),\n [push, currency]\n );\n\n const checkout = useCallback(\n (cart: Cart, step = 1) =>\n push({\n event: 'checkout',\n ecommerce: {\n currencyCode: currency,\n event_id: eventId('checkout'),\n checkout: {\n actionField: { step, id: cart.id },\n products: cart.items.map((item) => ({\n id: item.product_id,\n name: item.product_name,\n price: typeof item.price === 'number' ? item.price : item.price.amount,\n quantity: item.quantity,\n })),\n },\n },\n }),\n [push, currency]\n );\n\n const purchase = useCallback(\n (orderId: string | number, cart: Cart) =>\n push({\n event: 'purchase',\n ecommerce: {\n currencyCode: currency,\n event_id: eventId('purchase'),\n purchase: {\n actionField: {\n id: orderId,\n revenue: cart.total,\n tax: cart.tax_amount,\n coupon: cart.coupon,\n },\n products: cart.items.map((item) => ({\n id: item.product_id,\n name: item.product_name,\n price: typeof item.price === 'number' ? item.price : item.price.amount,\n quantity: item.quantity,\n })),\n },\n },\n }),\n [push, currency]\n );\n\n return { enabled, push, viewPage, detail, impressions, click, add, remove, checkout, purchase };\n}\n","import { useMemo } from 'react';\nimport { useTranslation } from '../providers/I18nProvider';\nimport type { OpeningHoursSettings } from '../types';\n\ntype DayOfWeek = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';\n\nconst DAYS: DayOfWeek[] = [\n 'monday',\n 'tuesday',\n 'wednesday',\n 'thursday',\n 'friday',\n 'saturday',\n 'sunday',\n];\n\nconst DAY_NAMES: Record<string, string> = {\n monday: 'common.days.monday',\n tuesday: 'common.days.tuesday',\n wednesday: 'common.days.wednesday',\n thursday: 'common.days.thursday',\n friday: 'common.days.friday',\n saturday: 'common.days.saturday',\n sunday: 'common.days.sunday',\n};\n\nconst TIME_NAMES: Record<string, string> = {\n AM: 'common.time.am',\n PM: 'common.time.pm',\n};\n\ninterface ParsedTimeRange {\n start: number; // minutes from midnight\n end: number; // minutes from midnight\n}\n\ninterface DaySchedule {\n ranges: ParsedTimeRange[];\n}\n\nexport interface UseOpeningHoursResult {\n /** Whether the store is currently open */\n isOpen: boolean;\n /** Whether opening hours feature is enabled and configured */\n isEnabled: boolean;\n /** Next opening time as Date object, null if currently open or not configured */\n nextOpen: Date | null;\n /** Formatted next opening time string, empty if currently open or not configured */\n nextOpenFormatted: string;\n}\n\n/**\n * Parse a time string like \"09:00\" or \"9:00 AM\" to minutes from midnight.\n */\nfunction parseTime(timeStr: string): number {\n const cleaned = timeStr.trim().toLowerCase();\n const match = cleaned.match(/^(\\d{1,2}):(\\d{2})(?:\\s*(am|pm))?$/);\n\n if (!match) {\n return 0;\n }\n\n let hours = parseInt(match[1], 10);\n const minutes = parseInt(match[2], 10);\n const meridiem = match[3];\n\n if (meridiem === 'pm' && hours < 12) {\n hours += 12;\n } else if (meridiem === 'am' && hours === 12) {\n hours = 0;\n }\n\n return hours * 60 + minutes;\n}\n\n/**\n * Parse opening hours ranges for a day.\n * Input format: [\"09:00-12:00\", \"13:00-18:00\"] or [\"09:00 AM - 12:00 PM\"]\n */\nfunction parseRanges(ranges: string[]): ParsedTimeRange[] {\n return ranges\n .map((range) => {\n const parts = range.split('-').map((s) => s.trim());\n if (parts.length !== 2) return null;\n\n const start = parseTime(parts[0]);\n const end = parseTime(parts[1]);\n\n return { start, end };\n })\n .filter((r): r is ParsedTimeRange => r !== null && r.start < r.end);\n}\n\n/**\n * Convert day index (0 = Monday) to day name.\n */\nfunction indexToDay(index: number): DayOfWeek {\n return DAYS[index % 7];\n}\n\n/**\n * Get the day index for a date (0 = Monday, 6 = Sunday).\n */\nfunction getDayIndex(date: Date): number {\n const jsDay = date.getDay(); // 0 = Sunday, 1 = Monday, etc.\n return jsDay === 0 ? 6 : jsDay - 1; // Convert to 0 = Monday\n}\n\n/**\n * Get current time in minutes from midnight.\n */\nfunction getTimeInMinutes(date: Date): number {\n return date.getHours() * 60 + date.getMinutes();\n}\n\n/**\n * Check if the given time falls within any of the ranges.\n */\nfunction isInRanges(time: number, ranges: ParsedTimeRange[]): boolean {\n return ranges.some((range) => time >= range.start && time < range.end);\n}\n\n/**\n * Find the next time range that starts after the given time.\n */\nfunction findNextRange(time: number, ranges: ParsedTimeRange[]): ParsedTimeRange | null {\n const sorted = [...ranges].sort((a, b) => a.start - b.start);\n return sorted.find((range) => range.start > time) ?? null;\n}\n\n/**\n * useOpeningHours - Hook for checking store opening status and next open time.\n *\n * @param settings - Opening hours settings from the store\n * @returns Opening status information\n *\n * @example\n * ```tsx\n * const { isOpen, nextOpenFormatted } = useOpeningHours(store.settings.opening_hours);\n *\n * if (!isOpen) {\n * return <div>Store closed. Opens at {nextOpenFormatted}</div>;\n * }\n * ```\n */\nexport function useOpeningHours(settings?: OpeningHoursSettings): UseOpeningHoursResult {\n const { t } = useTranslation();\n\n return useMemo(() => {\n if (!settings?.enabled || !settings?.hours) {\n return {\n isOpen: true, // Assume open if not configured\n isEnabled: false,\n nextOpen: null,\n nextOpenFormatted: '',\n };\n }\n\n const hours = settings.hours;\n const now = new Date();\n const currentDayIndex = getDayIndex(now);\n const currentTime = getTimeInMinutes(now);\n\n // Build schedule for all days\n const schedule: Record<DayOfWeek, DaySchedule> = {} as Record<DayOfWeek, DaySchedule>;\n for (const day of DAYS) {\n const dayRanges = hours[day];\n schedule[day] = {\n ranges: dayRanges ? parseRanges(dayRanges) : [],\n };\n }\n\n // Check if currently open\n const todaySchedule = schedule[indexToDay(currentDayIndex)];\n if (isInRanges(currentTime, todaySchedule.ranges)) {\n return {\n isOpen: true,\n isEnabled: true,\n nextOpen: null,\n nextOpenFormatted: '',\n };\n }\n\n // Find next open time\n // Check remaining ranges today\n const nextRangeToday = findNextRange(currentTime, todaySchedule.ranges);\n if (nextRangeToday) {\n const nextOpen = new Date(now);\n nextOpen.setHours(Math.floor(nextRangeToday.start / 60), nextRangeToday.start % 60, 0, 0);\n\n return {\n isOpen: false,\n isEnabled: true,\n nextOpen,\n nextOpenFormatted: formatNextOpen(nextOpen, t),\n };\n }\n\n // Check subsequent days (up to 7 days ahead)\n for (let i = 1; i <= 7; i++) {\n const nextDayIndex = (currentDayIndex + i) % 7;\n const nextDayName = indexToDay(nextDayIndex);\n const nextDaySchedule = schedule[nextDayName];\n\n if (nextDaySchedule.ranges.length > 0) {\n // Get the first range of that day\n const firstRange = [...nextDaySchedule.ranges].sort((a, b) => a.start - b.start)[0];\n\n const nextOpen = new Date(now);\n nextOpen.setDate(nextOpen.getDate() + i);\n nextOpen.setHours(Math.floor(firstRange.start / 60), firstRange.start % 60, 0, 0);\n\n return {\n isOpen: false,\n isEnabled: true,\n nextOpen,\n nextOpenFormatted: formatNextOpen(nextOpen, t),\n };\n }\n }\n\n // No opening hours found in the next week - assume open\n return {\n isOpen: true,\n isEnabled: true,\n nextOpen: null,\n nextOpenFormatted: '',\n };\n }, [settings, t]);\n}\n\n/**\n * Format the next open time similar to the PHP widget.\n * Output: \"Sunday 09:00 AM\" (translated)\n */\nfunction formatNextOpen(date: Date, t: (key: string) => string): string {\n const dayName = t(DAY_NAMES[indexToDay(getDayIndex(date))]);\n const hours = date.getHours();\n const minutes = date.getMinutes().toString().padStart(2, '0');\n const isPM = hours >= 12;\n const displayHours = hours > 12 ? hours - 12 : hours === 0 ? 12 : hours;\n const meridiem = t(TIME_NAMES[isPM ? 'PM' : 'AM']);\n\n return `${dayName} ${displayHours}:${minutes} ${meridiem}`;\n}\n","import { useEffect, useRef } from 'react';\nimport { whenSallaLoaded } from '../utils/sdk-helpers';\n\n/**\n * Page config data structure for salla.config.set('page', ...)\n */\nexport interface PageConfigData {\n slug: string;\n id?: string | number;\n title: string;\n /** Optional - defaults to current location pathname + search */\n url?: string;\n parent?: { id: string | number; name: string; url: string } | null;\n}\n\n/**\n * usePageConfig - Centralized hook for setting salla.config.page\n *\n * Replaces scattered salla?.config?.set('page', ...) calls across multiple pages.\n * Handles optional salla object safely.\n * Automatically uses current URL from router context if url not provided.\n *\n * @param pageData - Page configuration data to set\n *\n * @example\n * ```tsx\n * // URL is auto-detected from router context\n * usePageConfig({\n * slug: 'product.index',\n * id: categoryId,\n * title: category.name,\n * });\n *\n * // With explicit URL override\n * usePageConfig({\n * slug: 'product.index',\n * id: categoryId,\n * title: category.name,\n * url: '/custom-url',\n * });\n * ```\n */\nexport function usePageConfig(pageData: PageConfigData): void {\n const pageDataRef = useRef(pageData);\n pageDataRef.current = pageData;\n\n useEffect(\n () =>\n whenSallaLoaded((salla) => {\n if (!salla.config?.set) {\n if (process.env.NODE_ENV === 'development') {\n console.warn('[usePageConfig] salla.config.set not available. Page config not set.');\n }\n return;\n }\n\n const current = pageDataRef.current;\n // A page can render without loader page data (tests, custom mounts) — nothing to seed.\n if (!current) return;\n const url = current.url ?? window.location.pathname + window.location.search;\n\n salla.config.set('page', {\n ...current,\n url,\n });\n }),\n []\n );\n}\n","import type { Breadcrumb } from '../types';\n\nconst BREADCRUMB_REFERRER_KEY = 'breadcrumb-referrer';\n\nexport function getBreadcrumbReferrer(): Breadcrumb | null {\n try {\n const raw = sessionStorage.getItem(BREADCRUMB_REFERRER_KEY);\n if (!raw) return null;\n const { name, url } = JSON.parse(raw);\n return typeof name === 'string' && typeof url === 'string' ? { name, url } : null;\n } catch {\n return null;\n }\n}\n\nexport function setBreadcrumbReferrer(breadcrumb: Breadcrumb): void {\n try {\n sessionStorage.setItem(BREADCRUMB_REFERRER_KEY, JSON.stringify(breadcrumb));\n } catch {\n // sessionStorage unavailable (private browsing quota, etc.)\n }\n}\n","import { useMemo, useEffect, useState } from 'react';\nimport { useLocation, useIsHome } from '../providers/NavigationProvider';\nimport { useTranslation } from '../providers/I18nProvider';\nimport { getBreadcrumbReferrer, setBreadcrumbReferrer } from '../utils/breadcrumb';\nimport type { Breadcrumb, Page } from '../types';\n\nexport function useBreadcrumbs(page?: Page | null): Breadcrumb[] {\n const location = useLocation();\n const isHome = useIsHome();\n const { t } = useTranslation();\n\n const [referrerCrumb, setReferrerCrumb] = useState<Breadcrumb | null>(null);\n\n useEffect(() => {\n if (page?.slug === 'product.single') {\n const ref = getBreadcrumbReferrer();\n if (ref) setReferrerCrumb(ref);\n return;\n }\n\n setReferrerCrumb(null);\n\n if (!isHome && page) {\n setBreadcrumbReferrer({ name: page.title, url: location.pathname + location.searchStr });\n }\n }, [page, isHome, location.pathname, location.searchStr]);\n\n return useMemo(() => {\n if (!page) return [];\n\n if (page.breadcrumbs?.length) {\n if (page.slug === 'product.single' && referrerCrumb) {\n const last = page.breadcrumbs.at(-1);\n return last ? [page.breadcrumbs[0], referrerCrumb, last] : page.breadcrumbs;\n }\n return page.breadcrumbs;\n }\n\n if (isHome) return [];\n\n const home: Breadcrumb = { name: t('common.titles.home'), url: '/' };\n return [home, { name: page.title, url: location.pathname }];\n }, [isHome, location.pathname, page, t, referrerCrumb]);\n}\n","/**\n * `salla-add-product-button` renders its quick-buy widget only when an element with this id exists\n * at render time. The body:end default hook keeps a src-less marker with this id in the DOM on every\n * page; the widget code itself is loaded by `fastCheckoutScript()` (eager from the product route\n * head, on idle elsewhere) and deduped by src, not by id.\n */\nexport const FAST_CHECKOUT_SCRIPT_ID = 'fast-checkout-js';\nexport const FAST_CHECKOUT_SCRIPT_URL =\n 'https://cdn.assets.salla.network/mini-checkout/widget/widget.esm.js?v=0.0.9';\n\nexport const fastCheckoutScript = () => ({ type: 'module', src: FAST_CHECKOUT_SCRIPT_URL });\n\n/**\n * Appends the widget script unless one with the same src is already in the document. On a product\n * page's first load TanStack has removed its own head tag by the time this runs, so a second tag can\n * land; that is harmless, the module map serves the same URL without refetching or re-evaluating.\n */\nexport function injectFastCheckoutScript(): void {\n if (document.querySelector(`script[src=\"${FAST_CHECKOUT_SCRIPT_URL}\"]`)) return;\n const s = document.createElement('script');\n Object.assign(s, fastCheckoutScript());\n document.head.appendChild(s);\n}\n","/**\n * Auto-registered default hooks for tracking/notification components.\n *\n * This module is imported automatically by hooks/index.ts to register\n * default handlers for body:start and body:end hooks.\n *\n * All handlers check conditions at render time via twilight context,\n * so they work without any setup from theme-custom.\n */\n\nimport React, { lazy, Suspense, useEffect } from 'react';\nimport { hookRegistry } from './HookRegistry';\nimport { HookName } from '../types/hooks';\nimport type { HookContext } from './HookSlot';\nimport { useUser } from './useUser';\nimport { FAST_CHECKOUT_SCRIPT_ID, injectFastCheckoutScript } from '../utils/fast-checkout';\n\n// Lazy load tracking/notification components from theme-engine\nconst GoogleTagBody = lazy(() =>\n import('../components/tracking/GoogleTag').then((m) => ({ default: m.GoogleTagBody }))\n);\n\nconst TwilightBundles = lazy(() =>\n import('../components/tracking/TwilightBundles').then((m) => ({ default: m.TwilightBundles }))\n);\n\nconst LazySiftSnippet = lazy(() =>\n import('../components/tracking/SiftSnippet').then((m) => ({ default: m.SiftSnippet }))\n);\n\nconst LazyStoreClosedNotification = lazy(() =>\n import('../components/store/StoreClosedNotification').then((m) => ({\n default: m.StoreClosedNotification,\n }))\n);\n\n// Lazy load cart widget components\nconst LazyPriceQuoteButton = lazy(() =>\n import('../components/cart/PriceQuoteButton').then((m) => ({ default: m.PriceQuoteButton }))\n);\n\nconst LazyPreOrderNotification = lazy(() =>\n import('../components/cart/PreOrderNotification').then((m) => ({\n default: m.PreOrderNotification,\n }))\n);\n\n/**\n * GTM handler - renders GoogleTagBody if store has GTM keys configured.\n */\nfunction gtmHandler({ twilight }: HookContext): React.ReactNode {\n if (!twilight?.store?.settings?.keys?.gtm?.length) {\n return null;\n }\n\n return (\n <Suspense fallback={null}>\n <GoogleTagBody gtmIds={twilight.store.settings.keys.gtm} />\n </Suspense>\n );\n}\n\n/**\n * Sift handler - renders SiftSnippet if store has sift key configured.\n */\nfunction useSiftHandler({ twilight }: HookContext): React.ReactNode {\n const { data: user } = useUser();\n\n if (!twilight?.store?.settings?.keys?.sift) {\n return null;\n }\n\n const customerId = user?.type === 'user' && user.id ? String(user.id) : '';\n\n return (\n <Suspense fallback={null}>\n <LazySiftSnippet beaconKey={twilight.store.settings.keys.sift} customerId={customerId} />\n </Suspense>\n );\n}\n\n/**\n * Store closed notification handler - renders if opening hours feature is enabled.\n */\nfunction storeClosedHandler({ twilight }: HookContext): React.ReactNode {\n if (!twilight?.store?.settings?.opening_hours?.enabled) {\n return null;\n }\n\n return (\n <Suspense fallback={null}>\n <LazyStoreClosedNotification />\n </Suspense>\n );\n}\n\n/**\n * Quick-buy widget presence + lazy loader. `salla-add-product-button` only checks that\n * `#fast-checkout-js` exists when it renders, so a src-less marker with that id is kept in the\n * body on every page: it survives hydration (TanStack drops head scripts after hydrating) and is\n * there before any app or custom JS renders a quick-buy button. An early `<salla-mini-checkout-widget>`\n * simply upgrades once the code lands. The code is loaded eagerly by the product route head and,\n * elsewhere, appended once the page is idle so it stays off the critical chain.\n */\nfunction FastCheckoutTag(): React.JSX.Element {\n useEffect(() => {\n if (typeof window.requestIdleCallback === 'function') {\n const id = window.requestIdleCallback(injectFastCheckoutScript);\n return () => window.cancelIdleCallback(id);\n }\n const id = window.setTimeout(injectFastCheckoutScript, 2000);\n return () => window.clearTimeout(id);\n }, []);\n return <script id={FAST_CHECKOUT_SCRIPT_ID} type=\"module\" />;\n}\n\n/**\n * Fast checkout handler - keeps the quick-buy marker in the DOM and lazily loads the widget when\n * quick purchase (`store.settings.buy_now`) is on.\n */\nfunction fastCheckoutHandler({ twilight }: HookContext): React.ReactNode {\n if (!twilight?.store?.settings?.buy_now) {\n return null;\n }\n\n return <FastCheckoutTag />;\n}\n\n/**\n * Twilight bundles handler - always renders (core tracking).\n */\nfunction bundlesHandler(): React.ReactNode {\n return (\n <Suspense fallback={null}>\n <TwilightBundles />\n </Suspense>\n );\n}\n\n/**\n * Price quote handler - renders if price-quote feature is enabled.\n * Twig: PriceQuoteWidget - checks feature('price-quote')->isAccessibleForCustomers()\n */\nfunction priceQuoteHandler({ twilight }: HookContext): React.ReactNode {\n // TODO: support price_quote in store settings API response\n if (!twilight?.store?.settings?.features?.price_quote) {\n return null;\n }\n\n return (\n <Suspense fallback={null}>\n <LazyPriceQuoteButton />\n </Suspense>\n );\n}\n\n/**\n * Pre-order notification handler - renders if cart has items with active pre-order campaigns.\n * Twig: PreOrderNotificationWidget - checks cart items for getHasActivePreorderCampaign()\n */\nfunction preOrderNotificationHandler({ twilight, cartItems }: HookContext): React.ReactNode {\n if (!twilight?.store?.settings?.features?.['pre-order-campaigns']) {\n return null;\n }\n\n const items = cartItems as\n Array<{ has_pre_order_campaign?: boolean; parent_id?: unknown }> | undefined;\n const hasPreOrder = items?.some((item) => !item.parent_id && item.has_pre_order_campaign);\n\n if (!hasPreOrder) {\n return null;\n }\n\n return (\n <Suspense fallback={null}>\n <LazyPreOrderNotification />\n </Suspense>\n );\n}\n\n/**\n * Register all default hooks from theme-engine.\n * Called automatically on module import.\n *\n * Note: theme-custom can register additional handlers like AddProductToast.\n */\nfunction registerDefaultHooks(): void {\n // Body start hooks (tracking, notifications)\n hookRegistry.register(HookName.BODY_START, gtmHandler, 100);\n hookRegistry.register(HookName.BODY_START, useSiftHandler, 90);\n hookRegistry.register(HookName.BODY_START, storeClosedHandler, 80);\n\n // Body end hooks (bundles)\n hookRegistry.register(HookName.BODY_END, bundlesHandler, 100);\n hookRegistry.register(HookName.BODY_END, fastCheckoutHandler, 90);\n\n // Cart hooks\n hookRegistry.register('cart:submit.start', priceQuoteHandler, 100);\n hookRegistry.register('cart:items.start', preOrderNotificationHandler, 100);\n}\n\n// Auto-register on module load\nregisterDefaultHooks();\n\nexport { registerDefaultHooks };\n","import { lazy, Suspense } from 'react';\nimport { Header } from './Header';\nimport { Footer } from './Footer';\nimport type { LayoutProps } from '../../types';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { useUser } from '../../hooks';\n\nconst SallaLoginModal = lazy(() =>\n import('@salla.sa/twilight-components-react/login-modal').then((m) => ({\n default: m.SallaLoginModal,\n }))\n);\nconst SallaScopes = lazy(() =>\n import('@salla.sa/twilight-components-react/scopes').then((m) => ({\n default: m.SallaScopes,\n }))\n);\nconst SallaOfferModal = lazy(() =>\n import('@salla.sa/twilight-components-react/offer-modal').then((m) => ({\n default: m.SallaOfferModal,\n }))\n);\n\nexport function MasterLayout({ children }: LayoutProps) {\n const { store } = useTwilight();\n const { isLoggedIn } = useUser();\n\n return (\n <>\n <div className=\"app-inner flex flex-col min-h-full\">\n <Header />\n <main id=\"main-content\" role=\"main\" className=\"flex-1\">\n {children}\n </main>\n <Footer />\n </div>\n\n <Suspense>\n <SallaOfferModal />\n </Suspense>\n\n {!isLoggedIn && (\n <Suspense>\n <SallaLoginModal\n isEmailAllowed={store?.settings?.auth?.email_allowed}\n isMobileAllowed={store?.settings?.auth?.mobile_allowed}\n isEmailRequired={store?.settings?.auth?.is_email_required}\n suppressHydrationWarning\n />\n </Suspense>\n )}\n\n {store?.scope && (\n <Suspense>\n <SallaScopes\n selection={store?.scope?.display_as === 'popup' ? 'mandatory' : 'optional'}\n suppressHydrationWarning\n />\n </Suspense>\n )}\n </>\n );\n}\n","import { useEffect, useMemo } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { apps, type AppSnippetRow } from '../../api/apps';\nimport { installAppScope } from '../../utils/app-scope';\nimport { applyThemeHookSlots } from '../../utils/theme-hook-slots';\nimport { getTwilightContext } from '../../twilight/context';\n\n/** How long to wait on the SDK / settings before injecting anyway. */\nconst READY_TIMEOUT_MS = 2500;\n\n// Module-level so StrictMode double-effects and remounts can't inject twice per page load.\nlet injected = false;\n\n/** A snippet plus its app's scope id — the key that resolves its config bucket. */\ntype OwnedSnippet = AppSnippetRow & { appScopeId: string };\n\n/**\n * Appends raw snippet HTML to `target`, recreating each `<script>` — innerHTML-parsed\n * scripts are flagged \"already started\" and never run.\n */\nexport function injectHtml(html: string, target: HTMLElement) {\n const tpl = document.createElement('template');\n tpl.innerHTML = html;\n tpl.content.querySelectorAll('script').forEach((inert) => {\n // importmap scripts can't be added post-init; the engine already injects its own.\n if (inert.type === 'importmap') {\n inert.remove();\n return;\n }\n const script = document.createElement('script');\n for (const attr of Array.from(inert.attributes)) {\n script.setAttribute(attr.name, attr.value);\n }\n script.text = inert.text;\n inert.replaceWith(script);\n });\n target.appendChild(tpl.content);\n}\n\n/**\n * Replaces `{{customer.x}}` placeholders with SDK config `user.*` values. Non-`customer.`\n * params are left untouched, matching the classic themes.\n */\nexport function resolveCustomerParams(content: string, params?: string[]): string {\n if (!params?.length) return content;\n for (const param of params) {\n if (!param.startsWith('customer.')) continue;\n const value = String(window.salla?.config?.get(param.replace(/^customer\\./, 'user.')) ?? '');\n // Tolerate inner whitespace (`{{ customer.email }}`); function replacement keeps `value`\n // literal so a `$&` in customer data isn't expanded.\n const escaped = param.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n const placeholder = new RegExp(`\\\\{\\\\{\\\\s*${escaped}\\\\s*\\\\}\\\\}`, 'g');\n content = content.replace(placeholder, () => value);\n }\n return content;\n}\n\n/** Resolves after `ms`, so a promise that may never settle can't block injection. */\nconst timeout = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * `onReady` hangs forever if the SDK never initializes; race a timeout so a broken SDK\n * degrades to unsubstituted placeholders instead of dropping every snippet.\n */\nconst waitForSdk = (): Promise<unknown> => {\n const ready = window.salla?.onReady();\n return ready ? Promise.race([ready, timeout(READY_TIMEOUT_MS)]) : Promise.resolve();\n};\n\n/** Holds the snippets' onReady callbacks until all are injected, as on Twig, where they parse before ready. */\nexport function withDeferredOnReady(inject: () => void): void {\n const sdk = window.salla;\n const onReady = sdk?.onReady;\n if (!sdk || typeof onReady !== 'function') return inject();\n\n const queued: Array<() => void> = [];\n sdk.onReady = (callback) =>\n new Promise<void>((resolve, reject) => {\n queued.push(() => onReady.call(sdk, callback).then(resolve, reject));\n });\n try {\n inject();\n } finally {\n sdk.onReady = onReady;\n }\n queued.forEach((run) => run());\n}\n\n/**\n * Whitelists hook slots, installs the config sandbox, then injects the inline snippets.\n * Runs once per page load, after the SDK is ready.\n */\nfunction mountSnippets(\n owned: OwnedSnippet[],\n clientSnippets: OwnedSnippet[],\n buckets: Record<string, Record<string, unknown>>\n): void {\n // Backstop for the inline head copy (see renderThemeHookSlotsScript) — that one runs at\n // parse time, ahead of the snippet scripts; this only covers a head that didn't render.\n applyThemeHookSlots();\n\n // Install before any snippet resolves config. The inline SSR-head install normally got there\n // first (with these buckets, or with none when its prefetch failed), so this either installs\n // the factory or seeds the buckets into it. Pass the complete map once.\n installAppScope({ apps: buckets });\n\n // Flag every CDN scope with a missing bucket (SSR-rendered ones included).\n const unresolved = new Set<string>();\n for (const s of owned) {\n if (s.url && !(s.appScopeId in buckets)) unresolved.add(s.appScopeId);\n }\n\n withDeferredOnReady(() => {\n for (const snippet of clientSnippets) {\n // Honour `place`: a head-placed snippet is often a <meta>/<link>/<style> (site\n // verification, canonical, preload) that crawlers only read inside <head>.\n const target = snippet.place?.includes('head') ? document.head : document.body;\n try {\n injectHtml(resolveCustomerParams(snippet.content, snippet.customer_parameters), target);\n } catch (error) {\n console.error(`[salla] failed to inject snippet for app ${snippet.appScopeId}`, error);\n }\n }\n });\n\n if (unresolved.size) {\n // One line per page, not per snippet; expected during settings-endpoint rollout.\n console.warn(\n `[salla] app settings missing for ${unresolved.size} app(s); their snippets ran without app.* config`,\n [...unresolved]\n );\n }\n}\n\n/** A CDN snippet reduced to what its SSR `<script>` tag needs. */\ninterface SsrCdnScript {\n key: string;\n url: string;\n snippetId?: number;\n appScopeId: string;\n}\n\n/**\n * Mounts installed apps' snippets once per page load:\n * - **CDN** — rendered as SSR `<script>` tags in <body> (see return), so they exist on first\n * paint. `place` doesn't apply: they're deferred scripts, which run in order either way.\n * - **inline** — injected client-side in the effect, into `place`'s target (head or body).\n */\nexport function AppsSnippets() {\n // From twilight context, not useQuery: React Query isn't dehydrated here, so useQuery has no\n // SSR data — but the CDN <script> tags must render server-side.\n const ssrSnippets = getTwilightContext().appsSnippets;\n\n // Client fallback for when the SSR prefetch failed or timed out (it fails open, non-fatal).\n // Without it a single blip on `apps/snippets` would drop every installed app's snippets for\n // the whole page load — no CDN tags, no inline scripts, no hook slots. Retries here because\n // the query's own `retry: 0` exists only to bound the SSR wait.\n const { data: fallbackSnippets } = useQuery({\n ...apps.queries.snippets(),\n enabled: !ssrSnippets,\n retry: 2,\n });\n const data = ssrSnippets ?? fallbackSnippets;\n\n const { data: settings, isSuccess, isError } = useQuery({ ...apps.queries.settings(), retry: 2 });\n\n // Fail open: inject once settings settle either way, so snippets that never read `app.*`\n // aren't dropped when the bucket is empty.\n const settingsSettled = isSuccess || isError;\n\n // Each enabled app's snippets, tagged with its scope id (the encoded `id`). Older payloads\n // lacking `id` get a deterministic per-app fallback sharing one empty bucket.\n const owned = useMemo<OwnedSnippet[]>(\n () =>\n (data ?? [])\n .filter((app) => app.status === 'enabled')\n .flatMap((app) =>\n app.snippets.map((s) => ({ ...s, appScopeId: app.id ?? `unresolved-${app.app_id}` }))\n ),\n [data]\n );\n\n // Every CDN snippet → a real `<script>` tag in the SSR body (rendered below).\n const ssrCdnScripts = useMemo<SsrCdnScript[]>(\n () =>\n owned\n .filter((s) => s.url)\n .map((s, i) => ({\n key: `${s.appScopeId}:${s.id ?? i}`,\n url: s.url as string,\n snippetId: s.id,\n appScopeId: s.appScopeId,\n })),\n [owned]\n );\n\n useEffect(() => {\n if (injected || !data || !settingsSettled) return;\n injected = true;\n\n // Client-injected: inline snippets only. Every CDN snippet is SSR-rendered (below).\n const clientSnippets = owned.filter((s) => !s.url);\n\n // Always wait for the SDK: a snippet body calls the global `salla`/`Salla` (config, hooks,\n // event bus) whether or not it declares customer parameters, and those are only populated\n // after init. The wait is timeout-raced, so a broken SDK still can't strand injection.\n void waitForSdk().then(() => mountSnippets(owned, clientSnippets, settings?.apps ?? {}));\n }, [data, owned, settings, settingsSettled]);\n\n // CDN snippets as classic `defer` scripts: non-blocking, in-order, kept in <body> (React hoists\n // only `async` to <head>), and still exposing `document.currentScript` for the wrapper.\n return (\n <>\n {ssrCdnScripts.map((s) => (\n <script\n key={s.key}\n src={s.url}\n defer\n data-scope-id={s.appScopeId}\n data-snippet-id={s.snippetId != null ? String(s.snippetId) : ''}\n />\n ))}\n </>\n );\n}\n","import type { StoreContext } from '../../api/store';\nimport { resolveTwilightSdkUrl, TICKETING_SCRIPT_URL } from '../../routes/root/head';\n\n/** SDK modules at the end of <body>, ahead of the snippets: same run order as from <head>, later download. */\nexport function SallaSdkScripts({ settings }: { settings?: StoreContext }) {\n return (\n <>\n <script id=\"salla-sdk\" type=\"module\" src={resolveTwilightSdkUrl(settings)} />\n {settings?.store?.settings?.ticketing_system_enabled && (\n <script id=\"salla-ticketing-script\" type=\"module\" src={TICKETING_SCRIPT_URL} />\n )}\n </>\n );\n}\n","import React, { useMemo, Suspense, useState, useEffect, useSyncExternalStore } from 'react';\nimport { WidgetHead } from '../components/layout/WidgetHead';\nimport { HookSlot } from '../hooks/HookSlot';\nimport { HookName } from '../types/hooks';\nimport { DocumentClassProvider } from './DocumentClassProvider';\nimport { TwilightContext } from './twilight-context';\nimport { ThemeDocumentSync } from './twilight-theme';\nimport { useTwilightInit } from './twilight-init';\nimport { useNativeSafeArea } from './native-safe-area';\nimport { I18nProvider, FALLBACK_LOCALE } from './I18nProvider';\nimport { NavigationInterceptor } from './NavigationProvider';\nimport { navigationSetups } from './navigation-setups';\nimport { routeDocumentSyncs } from './DocumentSyncRegistry';\nimport { MasterLayout } from '../components/layout/MasterLayout';\nimport { Toaster } from '../components/toast/Toaster';\nimport { AppsSnippets } from '../components/snippets/AppsSnippets';\nimport { SallaSdkScripts } from '../components/snippets/SallaSdkScripts';\nimport {\n getTwilightContext,\n hasTwilightSettings,\n subscribeTwilight,\n updateTwilightContext,\n} from '../twilight/context';\nimport { AUTH_TOKEN_COOKIE_NAME, clearAuthTokenCookie, rememberDevStoreId } from '../utils/cookies';\nimport { whenSallaLoaded } from '../utils/sdk-helpers';\nimport type {\n TwilightContextValue,\n TwilightConfig,\n TwilightProviderProps,\n TwilightLog,\n} from '../types/twilight';\nimport type { StoreContext } from '../api/store';\n\nconst getSalla = () => (typeof window !== 'undefined' ? window.salla : undefined);\n\nconst TWILIGHT_LOG_STYLES = {\n header:\n 'background: linear-gradient(90deg, #7c3aed, #6366f1); color: white; padding: 4px 8px; border-radius: 4px; font-weight: bold;',\n error:\n 'background: #dc2626; color: white; padding: 2px 6px; border-radius: 3px; font-weight: bold;',\n warn: 'background: #f59e0b; color: white; padding: 2px 6px; border-radius: 3px; font-weight: bold;',\n info: 'background: #3b82f6; color: white; padding: 2px 6px; border-radius: 3px; font-weight: bold;',\n label: 'color: #7c3aed; font-weight: bold;',\n value: 'color: inherit;',\n};\n\nexport { useTwilight } from './twilight-context';\nexport type { TwilightProviderProps };\n\nfunction currentSettings(): StoreContext | undefined {\n return hasTwilightSettings() ? getTwilightContext().settings : undefined;\n}\n\nexport function TwilightProvider({\n children,\n debug = false,\n skeleton,\n translations: themeTranslations,\n onReady,\n onError,\n client = { framework: 'tanstack', interceptLinks: true },\n toast = true,\n toastMobilePosition = 'bottom-center',\n addToCartToast = true,\n routeClass = true,\n layout: LayoutComponent = MasterLayout,\n}: TwilightProviderProps): React.ReactElement {\n const ctx = getTwilightContext();\n const initialLocale = ctx.locale || FALLBACK_LOCALE;\n // Subscribed, not read once: a market switch re-runs the root loader with another\n // scope and the router publishes the new settings here, and the theme version they\n // name has its own colours and settings.\n const initialData = useSyncExternalStore(subscribeTwilight, currentSettings, currentSettings);\n\n // Auth token state for React re-renders on login/logout\n const [authToken, setAuthToken] = useState<string | null>(() => {\n if (typeof window !== 'undefined') {\n return ctx.authToken ?? window.localStorage.getItem(AUTH_TOKEN_COOKIE_NAME);\n }\n return null;\n });\n\n useNativeSafeArea();\n\n // SDK auth event listeners, bound when the SDK arrives — on a cold load, after this runs.\n useEffect(() => {\n if (typeof window === 'undefined') return;\n\n let unbind: (() => void) | undefined;\n const cancel = whenSallaLoaded((sdk) => {\n // Symmetric counterpart to handleTokenInvalid's clear below. path=/ + Lax so the\n // cookie is sent on the native webview's top-level navigation to /account/orders,\n // letting twilightMiddleware authenticate the SSR render — the SDK only stores the\n // token in localStorage, which the server can't read.\n const writeAuthCookie = (token: string) => {\n document.cookie = `${AUTH_TOKEN_COOKIE_NAME}=${token}; path=/; max-age=${60 * 60 * 24 * 30}; SameSite=Lax; Secure`;\n };\n\n const clearAuthCookie = clearAuthTokenCookie;\n\n // The SDK only refreshes `user.type` on a full page load, but our auth flows update\n // the UI without one — SDK components read it directly (e.g. salla-login-modal's\n // render bails for 'user' and never creates its inner modal), so keep it in sync.\n const setSdkUserType = (type: 'user' | 'guest') => {\n sdk.config?.set?.('user.type', type);\n };\n\n const handleLogin = () => {\n const newToken = sdk.storage.get(AUTH_TOKEN_COOKIE_NAME) as string | null;\n // logged.in can fire before the token is stored (iframe mirror) — don't clobber\n if (!newToken) return;\n setAuthToken(newToken);\n updateTwilightContext({ authToken: newToken });\n setSdkUserType('user');\n };\n\n // Fires on a fresh token fetch (login / web-session refresh — the native app flow).\n // Mirror the token into a cookie so SSR loads of authenticated pages are authenticated.\n const handleTokenFetched = (token: unknown) => {\n if (typeof token !== 'string' || !token) return;\n setAuthToken(token);\n updateTwilightContext({ authToken: token });\n writeAuthCookie(token);\n setSdkUserType('user');\n };\n\n const handleLogout = () => {\n const wasLoggedIn = Boolean(getTwilightContext().authToken);\n setAuthToken(null);\n updateTwilightContext({ authToken: null });\n setSdkUserType('guest');\n // Clear the SSR cookie too, otherwise a logged-out user's next full-page load\n // would still send a stale token to the server.\n try {\n clearAuthCookie();\n } catch {\n // Cookie removal may fail in restricted environments\n }\n // SDK logout redirects via location.href only after an accounts-iframe roundtrip\n // that can hang forever (iOS webview). If its redirect hasn't unloaded the page\n // by then, reload so SSR re-renders as guest. Guarded to logged-in users so the\n // SDK's force_logout guest flow can't reload-loop.\n if (wasLoggedIn) {\n window.setTimeout(() => window.location.reload(), 3500);\n }\n };\n\n const handleTokenInvalid = () => {\n setAuthToken(null);\n updateTwilightContext({ authToken: null });\n setSdkUserType('guest');\n try {\n window.localStorage.removeItem(AUTH_TOKEN_COOKIE_NAME);\n sdk.storage.remove?.(AUTH_TOKEN_COOKIE_NAME);\n clearAuthCookie();\n } catch {\n // Storage/cookie removal may fail in restricted environments\n }\n };\n\n const listeners: Array<[string, (...args: unknown[]) => void]> = [\n ['auth::logged.in', handleLogin],\n ['auth::logged.out', handleLogout],\n ['auth::token.invalid', handleTokenInvalid],\n ['auth::token.fetched', handleTokenFetched],\n // fires on every token path, and BEFORE logged.in in the login-iframe flow\n ['api::token.injected', handleTokenFetched],\n ];\n listeners.forEach(([name, listener]) => sdk.event.on(name, listener));\n unbind = () => listeners.forEach(([name, listener]) => sdk.event.off(name, listener));\n });\n\n return () => {\n cancel();\n unbind?.();\n };\n }, []);\n\n const { isReady, storeData, setStoreData, themeData, currency, isMobileWebview } =\n useTwilightInit({\n debug,\n initialData,\n onReady,\n onError,\n initialLocale,\n });\n\n const storeId = storeData?.id;\n useEffect(() => rememberDevStoreId(storeId), [storeId]);\n\n const config = useMemo<TwilightConfig>(() => ({ debug }), [debug]);\n\n const log = useMemo<TwilightLog>(\n () => ({\n groupCollapsed: (title) =>\n console.groupCollapsed(`%c ⚡ Twilight: ${title} `, TWILIGHT_LOG_STYLES.header),\n group: (title) => console.group(`%c${title}`, TWILIGHT_LOG_STYLES.label),\n groupEnd: () => console.groupEnd(),\n error: (label, value) =>\n console.log(`%c[${label}]%c`, TWILIGHT_LOG_STYLES.error, TWILIGHT_LOG_STYLES.value, value),\n warn: (label, value) =>\n console.log(`%c[${label}]%c`, TWILIGHT_LOG_STYLES.warn, TWILIGHT_LOG_STYLES.value, value),\n info: (label, value) =>\n console.log(`%c[${label}]%c`, TWILIGHT_LOG_STYLES.info, TWILIGHT_LOG_STYLES.value, value),\n label: (label, value) =>\n console.log(`%c[${label}]%c`, TWILIGHT_LOG_STYLES.label, TWILIGHT_LOG_STYLES.value, value),\n dir: (label, value) => {\n console.log(`%c${label}`, TWILIGHT_LOG_STYLES.label);\n console.dir(value);\n },\n trace: (label, trace) => {\n console.log(`%c${label}`, TWILIGHT_LOG_STYLES.label);\n console.error(trace);\n },\n }),\n []\n );\n\n const contextValue = useMemo<TwilightContextValue>(\n () => ({\n isReady,\n store: storeData,\n _setStore: setStoreData,\n theme: themeData,\n currency,\n config,\n log,\n get salla() {\n return getSalla();\n },\n get settings() {\n return getTwilightContext().settings;\n },\n get locale() {\n return getTwilightContext().locale;\n },\n get routeId() {\n return getTwilightContext().routeId;\n },\n get location() {\n return getTwilightContext().location;\n },\n get authToken() {\n return authToken;\n },\n get i18n() {\n return getTwilightContext().i18n;\n },\n get dir() {\n return getTwilightContext().dir;\n },\n get extras() {\n return getTwilightContext().extras;\n },\n }),\n [isReady, storeData, setStoreData, themeData, currency, config, log, authToken]\n );\n\n const framework = client !== false ? (client?.framework ?? 'tanstack') : null;\n const LazyNavSetup = framework ? navigationSetups[framework] : null;\n const LazyDocumentSync = routeClass && framework ? routeDocumentSyncs[framework] : null;\n const interceptLinks = client !== false && (client?.interceptLinks ?? true);\n\n const documentSyncElement = useMemo(\n () => (LazyDocumentSync ? React.createElement(LazyDocumentSync) : null),\n [LazyDocumentSync]\n );\n\n const readyShell = useMemo(() => {\n if (!isReady) return null;\n return {\n LayoutComponent,\n LazyNavSetup,\n toast,\n toastMobilePosition,\n addToCartToast,\n interceptLinks,\n };\n }, [\n isReady,\n LazyNavSetup,\n LayoutComponent,\n toast,\n toastMobilePosition,\n addToCartToast,\n interceptLinks,\n ]);\n\n const readyContent = useMemo(() => {\n if (!readyShell) return null;\n\n const inner = readyShell.LayoutComponent ? (\n <readyShell.LayoutComponent>{children}</readyShell.LayoutComponent>\n ) : (\n children\n );\n\n const wrapped = (\n <>\n <WidgetHead />\n <HookSlot name={HookName.BODY_START} />\n <Suspense fallback={null}>\n {readyShell.toast && (\n <Toaster\n mobilePosition={readyShell.toastMobilePosition}\n addToCartToast={readyShell.addToCartToast}\n />\n )}\n {readyShell.interceptLinks && <NavigationInterceptor />}\n </Suspense>\n {inner}\n {/* The SDK, then installed apps' snippets (which need it), last so neither downloads ahead of the page. */}\n <SallaSdkScripts settings={initialData} />\n <AppsSnippets />\n <HookSlot name={HookName.BODY_END} />\n </>\n );\n\n if (readyShell.LazyNavSetup) {\n return React.createElement(readyShell.LazyNavSetup, null, wrapped);\n }\n return wrapped;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [readyShell]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const i18nInstance = useMemo(() => getTwilightContext().i18n, [initialLocale]);\n\n return (\n <DocumentClassProvider>\n <TwilightContext.Provider value={contextValue}>\n <I18nProvider i18nInstance={i18nInstance} themeTranslations={themeTranslations}>\n <ThemeDocumentSync\n theme={themeData}\n locale={initialLocale}\n direction={getTwilightContext().dir}\n isMobileWebview={isMobileWebview}\n />\n {documentSyncElement}\n {!isReady && (\n <div className=\"loading-overlay\">{skeleton || <div className=\"loading-spinner\" />}</div>\n )}\n {readyContent}\n </I18nProvider>\n </TwilightContext.Provider>\n </DocumentClassProvider>\n );\n}\n\nexport default TwilightProvider;\n","import { useCallback } from 'react';\nimport { useTwilight } from '../providers/TwilightProvider';\nimport type { Store } from '../types';\n\n/**\n * UseStoreResult - Return type for useStore hook\n *\n * Extends the Store interface with a refresh method to re-fetch\n * the latest store configuration from the Salla SDK.\n */\nexport interface UseStoreResult extends Store {\n refresh: () => Promise<void>;\n}\n\n/**\n * useStore - Hook for accessing and managing store state\n *\n * Provides access to the store configuration and metadata from the\n * Twilight provider. Includes a refresh method to update the store\n * state with the latest data from the Salla SDK.\n *\n * @returns Store object with refresh() method to reload store data\n *\n * @example\n * ```tsx\n * function StoreInfo() {\n * const { name, currency, refresh } = useStore();\n *\n * return (\n * <div>\n * <h1>{name}</h1>\n * <button onClick={refresh}>Refresh store data</button>\n * <p>Current currency: {currency}</p>\n * </div>\n * );\n * }\n * ```\n */\nexport function useStore(): UseStoreResult {\n const { store, _setStore, salla } = useTwilight();\n\n const refresh = useCallback(async () => {\n if (!salla) return;\n try {\n const data = salla.config.all();\n if (data?.store && typeof data.store === 'object') {\n _setStore((prev) => ({ ...prev, ...(data.store as Partial<Store>) }));\n }\n } catch {\n // Silently ignore errors - store remains unchanged\n }\n }, [salla, _setStore]);\n\n return { ...store, refresh };\n}\n"]}
@@ -1,14 +0,0 @@
1
- import { lazy } from 'react';
2
-
3
- // src/components/cart/lazy.ts
4
- var LazyCartItem = lazy(() => import('./CartItem-G3H34GW6.js').then((m) => ({ default: m.CartItem })));
5
- var LazyCartSummary = lazy(
6
- () => import('./CartSummary-VH37RPUI.js').then((m) => ({ default: m.CartSummary }))
7
- );
8
- var LazySeoCartWidget = lazy(
9
- () => import('./SeoCartWidget-5JR5RXQM.js').then((m) => ({ default: m.SeoCartWidget }))
10
- );
11
-
12
- export { LazyCartItem, LazyCartSummary, LazySeoCartWidget };
13
- //# sourceMappingURL=chunk-QJYUTRAQ.js.map
14
- //# sourceMappingURL=chunk-QJYUTRAQ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/layout/Footer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAcA,IAAM,YAAA,GACJ,+HAAA;AAOF,SAAS,SAAA,CAAU,EAAE,IAAA,EAAK,EAAsB;AAC9C,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,KAAK,CAAA;AACtC,EAAA,MAAM,MAAA,GAAS,KAAA,CAAM,QAAA,EAAU,GAAA,EAAK,MAAA;AACpC,EAAA,MAAM,WAAA,GAAc,KAAA,CAAM,QAAA,EAAU,GAAA,EAAK,WAAA;AACzC,EAAA,IAAI,CAAC,QAAQ,OAAO,IAAA;AAEpB,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAA,EAAY,kBAAA;AAAA,MACZ,SAAA,EAAU,4DAAA;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AA,CAAC,QAAA,EAAA,EAAS,MAAK,YAAA,EAAa;AAAA;AAAA;AAAA,GAC3C;AAEJ","file":"chunk-U55ZJC2X.js","sourcesContent":["import { useState } from 'react';\nimport { SallaAppsIcons } from '@salla.sa/twilight-components-react/apps-icons';\nimport { SallaSocial } from '@salla.sa/twilight-components-react/social';\nimport { SallaMenu } from '@salla.sa/twilight-components-react/menu';\nimport { SallaTrustBadges } from '@salla.sa/twilight-components-react/trust-badges';\nimport { SallaPayments } from '@salla.sa/twilight-components-react/payments';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { HookSlot } from '../../hooks/HookSlot';\nimport { Link, Image } from '../common';\nimport { ImageModal } from '../modal';\n\n/** Salla's value-added-tax badge icon (70×70, CDN-resized) — a platform\n * asset shared by every store, not specific to any one theme. */\nconst TAX_ICON_URL =\n 'https://cdn.salla.network/cdn-cgi/image/fit=scale-down,width=70,height=70,onerror=redirect,format=auto/images/tax.png?v=2.0.5';\n\n/**\n * The store's value-added-tax registration: the tax number, plus the certificate as\n * the tax icon that opens the certificate image full size in a modal. Nothing shows\n * when the store has no tax number.\n */\nfunction FooterTax({ dark }: { dark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n const number = store.settings?.tax?.number;\n const certificate = store.settings?.tax?.certificate;\n if (!number) return null;\n\n return (\n <div\n data-testid=\"store-footer-tax\"\n className=\"store-footer__tax flex items-end gap-2 rtl:space-x-reverse\"\n >\n {certificate && (\n <>\n <button\n type=\"button\"\n data-testid=\"store-footer-tax-certificate\"\n className=\"store-footer__tax-cert shrink-0\"\n aria-label={t('common.elements.tax_certificate', 'Tax Certificate')}\n aria-haspopup=\"dialog\"\n onClick={() => setOpen(true)}\n >\n <img\n src={TAX_ICON_URL}\n alt={t('common.elements.tax_certificate', 'Tax Certificate')}\n width={40}\n height={50}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"w-10 rounded-sm transition-opacity hover:opacity-80\"\n />\n </button>\n <ImageModal\n isOpen={open}\n onClose={() => setOpen(false)}\n src={certificate}\n alt={t('common.elements.tax_certificate', 'Tax Certificate')}\n title={t('common.elements.tax_certificate', 'Tax Certificate')}\n />\n </>\n )}\n <div>\n <p className={`mb-1 text-sm opacity-70 ${dark ? 'text-white' : ''}`}>\n {t('common.elements.tax_number', 'Tax Number')}\n </p>\n <b className=\"text-sm\">{number}</b>\n </div>\n </div>\n );\n}\n\n/** Saudi Business Center (SBC) logo, CDN-versioned like the tax icon -- also a\n * platform asset, not theme-specific. */\nconst SBC_ICON_URL = 'https://cdn.salla.network/images/sbc.png?v=2.0.5';\n\n/**\n * The store's Saudi Business Center certificate: a \"Trusted by Business Platform\" badge that\n * opens the certificate's page on the SBC site so visitors can verify the merchant. Nothing\n * shows when the store has no certificate.\n */\nfunction FooterSbc({ dark }: { dark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const id = store.settings?.certificate?.id;\n if (!id) return null;\n\n return (\n <a\n href={`https://eauthenticate.saudibusiness.gov.sa/certificate-details/${encodeURIComponent(id)}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-testid=\"store-footer-sbc\"\n className=\"store-footer__sbc flex items-center gap-2.5 transition-opacity hover:opacity-75\"\n >\n <img\n src={SBC_ICON_URL}\n alt={`SBC ${id}`}\n width={56}\n height={40}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"h-10 w-14 rounded-sm\"\n />\n <div>\n <p className={`text-xs opacity-70 ${dark ? 'text-white' : ''}`}>\n {t('blocks.footer.sbc_trusted_by', 'Trusted by')}\n </p>\n <b className=\"text-sm\">{t('blocks.footer.sbc_platform', 'Business Platform')}</b>\n </div>\n </a>\n );\n}\n\n/** Trust badges, the tax registration and the SBC badge, side by side (wrapping on narrow columns). */\nfunction FooterTrust({ dark, centered }: { dark: boolean; centered: boolean }) {\n return (\n <div\n data-testid=\"store-footer-trust\"\n className={`store-footer__trust flex flex-wrap items-end gap-x-6 gap-y-3${centered ? ' justify-center' : ''}`}\n >\n <FooterTax dark={dark} />\n <FooterSbc dark={dark} />\n <SallaTrustBadges {...(dark ? { dark: true } : {})} />\n </div>\n );\n}\n\n/**\n * The footer's own menu of (\"important\") links -- skipped entirely when\n * `inSheet`, for a theme that opens it from somewhere else of its own (a\n * mobile account sheet, a dedicated links screen, …) instead; showing it\n * again down here would just be a redundant second copy. `heading` wraps it\n * in the grid layout's own `.store-footer__links` column; the centered\n * layout's inline row has none.\n */\nfunction FooterLinksMenu({\n inSheet,\n className,\n heading,\n dark,\n}: {\n inSheet: boolean;\n className: string;\n heading?: string;\n dark: boolean;\n}) {\n if (inSheet) return null;\n\n const menu = (\n <SallaMenu source=\"footer\" useReactLink className={className} suppressHydrationWarning />\n );\n if (!heading) return menu;\n\n return (\n <div className=\"store-footer__links\">\n <h3 className={`mb-3 text-lg font-bold lg:mb-5 ${dark ? 'text-white' : 'text-gray-900'}`}>\n {heading}\n </h3>\n {menu}\n </div>\n );\n}\n\n/** The logo link, same shape in both layouts -- only its own spacing differs. */\nfunction FooterLogo({ className }: { className: string }) {\n const { store } = useTwilight();\n return (\n <Link\n to=\"/\"\n className={`store-footer__logo inline-flex items-center m-0 transition-opacity hover:opacity-75 ${className}`}\n >\n <Image\n src={store.logo}\n alt={store.name || 'Store'}\n width={150}\n height={44}\n objectFit=\"contain\"\n className=\"h-11 w-auto max-w-[180px]\"\n />\n </Link>\n );\n}\n\n/** Merchant-authored description HTML -- mirrors the Twig theme's\n * `store.description|raw`. Renders nothing when the store has none set. */\nfunction FooterDescription({ className }: { className: string }) {\n const { store } = useTwilight();\n if (!store.description) return null;\n return (\n <div\n className={`store-footer__desc opacity-80 ${className}`}\n dangerouslySetInnerHTML={{ __html: store.description }}\n />\n );\n}\n\n/** Centered layout: logo, description, social, footer menu, trust badges and\n * app buttons stacked as one centered column. */\nfunction FooterCenteredBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n\n return (\n <div className=\"container mx-auto flex max-w-2xl flex-col items-center gap-6 text-center\">\n <FooterLogo className=\"\" />\n <FooterDescription className=\"\" />\n <SallaSocial />\n\n <FooterLinksMenu\n inSheet={inSheet}\n className=\"store-footer__menu store-footer__menu--inline\"\n dark={isDark}\n />\n\n <FooterTrust dark={isDark} centered />\n\n <div className=\"store-footer__apps flex flex-col items-center gap-3\">\n <SallaAppsIcons\n apps={store.apps}\n appsTitle={t('blocks.footer.download_apps', 'Get our apps')}\n />\n </div>\n </div>\n );\n}\n\n/** Columns layout: brand (logo / description / social / trust) and app\n * buttons side by side, with the footer menu as its own labeled column. */\nfunction FooterColumnsBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n\n return (\n <div className=\"container grid grid-cols-1 gap-10 sm:grid-cols-2 lg:grid-cols-4 lg:gap-16\">\n <div className=\"store-footer__brand rtl:lg:pl-16 ltr:lg:pr-16 sm:col-span-2\">\n <FooterLogo className=\"mb-5\" />\n <FooterDescription className=\"max-w-sm leading-6 my-5\" />\n <SallaSocial className=\"block mb-6\" />\n <FooterTrust dark={isDark} centered={false} />\n </div>\n\n <FooterLinksMenu\n inSheet={inSheet}\n className=\"store-footer__menu store-footer__menu--stacked\"\n heading={t('blocks.footer.important_links', 'Important links')}\n dark={isDark}\n />\n\n <div className=\"store-footer__apps\">\n <SallaAppsIcons\n apps={store.apps}\n appsTitle={t('blocks.footer.download_apps', 'Get our apps')}\n />\n </div>\n </div>\n );\n}\n\nexport interface FooterProps {\n /**\n * Renders as a plain `<div>` (no second `<footer>` landmark) with the\n * `footer:start` / `footer:end` hook slots skipped -- for a theme that\n * repeats these widgets somewhere other than the page's own footer (a\n * mobile sheet, for example) rather than rendering the real page footer a\n * second time.\n */\n inSheet?: boolean;\n}\n\n/**\n * Storefront footer.\n *\n * Two layouts, chosen by the `footer_layout` theme setting:\n * - **columns** (default): logo / description / social / trust badges, the\n * footer menu (\"important links\"), and app-store buttons, side by side.\n * - **centered**: the same pieces stacked as one centered column, with the\n * footer menu laid out as an inline, pipe-separated row.\n *\n * Styling for the handful of pieces rendered by web components this owns no\n * markup for (`<salla-social>`'s `.social-link` icons, `<salla-menu>`'s\n * `.s-menu-footer-item` rows, `<salla-payments>`'s `.s-payments-list-item`\n * icons) is the consuming theme's own responsibility, the same way\n * `inSheet`'s own presentation is -- this component owns structure and data,\n * not every pixel.\n */\nexport function Footer({ inSheet = false }: FooterProps = {}) {\n const { store, theme } = useTwilight();\n const { t } = useTranslation();\n const year = new Date().getFullYear();\n const isCentered = theme.settings?.footer_layout === 'centered';\n const isDark = !!theme.settings?.footer_is_dark;\n\n const Root = inSheet ? 'div' : 'footer';\n\n return (\n <Root\n className={`store-footer store-footer--${isCentered ? 'centered' : 'columns'}${\n inSheet ? ' store-footer--sheet' : ''\n } relative mt-8 sm:mt-16 ${isDark ? 'bg-[#0E0F0F] text-white' : 'bg-[#F4F7F2] text-gray-600'}`}\n suppressHydrationWarning\n >\n {!inSheet && <HookSlot name=\"footer:start\" />}\n\n <div\n aria-label=\"footer\"\n className={`store-footer__inner border-b py-8 lg:py-16 ${\n isDark ? 'bg-[#1D1F1F] border-dashed border-white/10' : 'bg-transparent border-gray-200'\n }`}\n >\n {isCentered ? (\n <FooterCenteredBody inSheet={inSheet} isDark={isDark} />\n ) : (\n <FooterColumnsBody inSheet={inSheet} isDark={isDark} />\n )}\n </div>\n\n <div className=\"store-footer__bottom container md:flex items-center justify-between gap-4 py-4 lg:py-7 text-center\">\n <span className={`text-sm copyright-text ${isDark ? 'text-gray-400' : 'text-gray-700'}`}>\n <HookSlot\n name=\"copyright\"\n context={{ storeName: store.name }}\n fallback={\n <>\n {t('blocks.footer.copyright', 'All rights reserved')}{' '}\n <Link to=\"/\" className=\"transition-opacity hover:opacity-75 hover:text-primary\">\n {store.name}\n </Link>{' '}\n © {year}\n </>\n }\n />\n </span>\n\n <SallaPayments />\n </div>\n\n {!inSheet && <HookSlot name=\"footer:end\" />}\n </Root>\n );\n}\n"]}