@salla.sa/twilight-theme-engine 1.0.46 → 1.0.48

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 (198) hide show
  1. package/dist/{AddToCartForm-OOHYADAR.js → AddToCartForm-5QCWKLPJ.js} +3 -3
  2. package/dist/{AddToCartForm-OOHYADAR.js.map → AddToCartForm-5QCWKLPJ.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-WWW5AI5C.js → BlogAuthorPage-SJK25SGM.js} +15 -15
  4. package/dist/{BlogAuthorPage-WWW5AI5C.js.map → BlogAuthorPage-SJK25SGM.js.map} +1 -1
  5. package/dist/{BlogCategoryPage-NG3NK253.js → BlogCategoryPage-KRWHN3RE.js} +15 -15
  6. package/dist/{BlogCategoryPage-NG3NK253.js.map → BlogCategoryPage-KRWHN3RE.js.map} +1 -1
  7. package/dist/{BlogPage-45Q4NCJD.js → BlogPage-NSUA7VE5.js} +13 -13
  8. package/dist/{BlogPage-45Q4NCJD.js.map → BlogPage-NSUA7VE5.js.map} +1 -1
  9. package/dist/{BlogSinglePage-226G6GNY.js → BlogSinglePage-C2VSDMDP.js} +13 -13
  10. package/dist/{BlogSinglePage-226G6GNY.js.map → BlogSinglePage-C2VSDMDP.js.map} +1 -1
  11. package/dist/{BlogTagPage-QXVLCJXK.js → BlogTagPage-HUXYKEQF.js} +15 -15
  12. package/dist/{BlogTagPage-QXVLCJXK.js.map → BlogTagPage-HUXYKEQF.js.map} +1 -1
  13. package/dist/{BrandsPage-TFPITVGL.js → BrandsPage-I3RMJZTB.js} +13 -13
  14. package/dist/{BrandsPage-TFPITVGL.js.map → BrandsPage-I3RMJZTB.js.map} +1 -1
  15. package/dist/{Breadcrumb-LXSYCVGP.js → Breadcrumb-A6QUPWMB.js} +13 -13
  16. package/dist/{Breadcrumb-LXSYCVGP.js.map → Breadcrumb-A6QUPWMB.js.map} +1 -1
  17. package/dist/{CartItem-7P2ZPNRC.js → CartItem-NEXK7VYX.js} +13 -13
  18. package/dist/{CartItem-7P2ZPNRC.js.map → CartItem-NEXK7VYX.js.map} +1 -1
  19. package/dist/{CartSummary-W6FWXDLZ.js → CartSummary-TUV2G2EJ.js} +13 -13
  20. package/dist/{CartSummary-W6FWXDLZ.js.map → CartSummary-TUV2G2EJ.js.map} +1 -1
  21. package/dist/{Copyright-WD5FF3T4.js → Copyright-4HKPWJOF.js} +3 -3
  22. package/dist/{Copyright-WD5FF3T4.js.map → Copyright-4HKPWJOF.js.map} +1 -1
  23. package/dist/{CustomerLayout-E7VEI6HY.js → CustomerLayout-RELEEQGD.js} +13 -13
  24. package/dist/{CustomerLayout-E7VEI6HY.js.map → CustomerLayout-RELEEQGD.js.map} +1 -1
  25. package/dist/{Footer-DGL76KHV.js → Footer-KIYYQZUF.js} +13 -13
  26. package/dist/{Footer-DGL76KHV.js.map → Footer-KIYYQZUF.js.map} +1 -1
  27. package/dist/{Header-IBSFB44P.js → Header-B452P6PJ.js} +6 -6
  28. package/dist/{Header-IBSFB44P.js.map → Header-B452P6PJ.js.map} +1 -1
  29. package/dist/{LoyaltyPage-LVJX2672.js → LoyaltyPage-QA2UVEO7.js} +14 -14
  30. package/dist/{LoyaltyPage-LVJX2672.js.map → LoyaltyPage-QA2UVEO7.js.map} +1 -1
  31. package/dist/{MainMenu-J3BUNME7.js → MainMenu-5EBPQ6OY.js} +7 -7
  32. package/dist/{MainMenu-J3BUNME7.js.map → MainMenu-5EBPQ6OY.js.map} +1 -1
  33. package/dist/{MasterLayout-SBIGH2HB.js → MasterLayout-PIVKKSYE.js} +13 -13
  34. package/dist/{MasterLayout-SBIGH2HB.js.map → MasterLayout-PIVKKSYE.js.map} +1 -1
  35. package/dist/{MobileMenu-GT5Y5G37.js → MobileMenu-BWELJ7YQ.js} +14 -14
  36. package/dist/{MobileMenu-GT5Y5G37.js.map → MobileMenu-BWELJ7YQ.js.map} +1 -1
  37. package/dist/{NotificationsPage-4IZU7OEO.js → NotificationsPage-4TGQB2BB.js} +13 -13
  38. package/dist/{NotificationsPage-4IZU7OEO.js.map → NotificationsPage-4TGQB2BB.js.map} +1 -1
  39. package/dist/{OrderSinglePage-ZNRBEGQS.js → OrderSinglePage-UQWOX7YQ.js} +14 -14
  40. package/dist/{OrderSinglePage-ZNRBEGQS.js.map → OrderSinglePage-UQWOX7YQ.js.map} +1 -1
  41. package/dist/{OrdersPage-TAMZXHKA.js → OrdersPage-NFZPCCFE.js} +14 -14
  42. package/dist/{OrdersPage-TAMZXHKA.js.map → OrdersPage-NFZPCCFE.js.map} +1 -1
  43. package/dist/{PageSingle-PRPYUPJQ.js → PageSingle-AERRZYAE.js} +3 -3
  44. package/dist/{PageSingle-PRPYUPJQ.js.map → PageSingle-AERRZYAE.js.map} +1 -1
  45. package/dist/{ProductDetails-TLJDAC6Z.js → ProductDetails-NZXETZCX.js} +3 -3
  46. package/dist/{ProductDetails-TLJDAC6Z.js.map → ProductDetails-NZXETZCX.js.map} +1 -1
  47. package/dist/{ProfilePage-CE6AJWBT.js → ProfilePage-A7PPNV7Q.js} +13 -13
  48. package/dist/{ProfilePage-CE6AJWBT.js.map → ProfilePage-A7PPNV7Q.js.map} +1 -1
  49. package/dist/{SeoCartWidget-KTU43V5G.js → SeoCartWidget-ONRQUR5A.js} +13 -13
  50. package/dist/{SeoCartWidget-KTU43V5G.js.map → SeoCartWidget-ONRQUR5A.js.map} +1 -1
  51. package/dist/{SettingsPage-4IHMDH7A.js → SettingsPage-CVKDP7ON.js} +13 -13
  52. package/dist/{SettingsPage-4IHMDH7A.js.map → SettingsPage-CVKDP7ON.js.map} +1 -1
  53. package/dist/{StoreClosedNotification-DXI3LH3Z.js → StoreClosedNotification-RZFLBK4P.js} +14 -14
  54. package/dist/{StoreClosedNotification-DXI3LH3Z.js.map → StoreClosedNotification-RZFLBK4P.js.map} +1 -1
  55. package/dist/{TestimonialsPage-7XPCC7G5.js → TestimonialsPage-B7RDWU6U.js} +3 -3
  56. package/dist/{TestimonialsPage-7XPCC7G5.js.map → TestimonialsPage-B7RDWU6U.js.map} +1 -1
  57. package/dist/{ThankYouPage-P36Q7WCY.js → ThankYouPage-VJQHHOLD.js} +13 -13
  58. package/dist/{ThankYouPage-P36Q7WCY.js.map → ThankYouPage-VJQHHOLD.js.map} +1 -1
  59. package/dist/{WalletPage-7BNJRH6H.js → WalletPage-6J5HODU3.js} +14 -14
  60. package/dist/{WalletPage-7BNJRH6H.js.map → WalletPage-6J5HODU3.js.map} +1 -1
  61. package/dist/{WishlistPage-CT3NBFQW.js → WishlistPage-VPHKKRRR.js} +15 -15
  62. package/dist/{WishlistPage-CT3NBFQW.js.map → WishlistPage-VPHKKRRR.js.map} +1 -1
  63. package/dist/api/apps.js +4 -4
  64. package/dist/api/brands.js +5 -5
  65. package/dist/api/cart.js +5 -5
  66. package/dist/api/category.js +5 -5
  67. package/dist/api/client.js +3 -3
  68. package/dist/api/home.js +4 -4
  69. package/dist/api/loyalty.js +5 -5
  70. package/dist/api/menu.js +4 -4
  71. package/dist/api/notification.js +4 -4
  72. package/dist/api/order.js +5 -5
  73. package/dist/api/page.js +5 -5
  74. package/dist/api/product.d.ts +6 -1
  75. package/dist/api/product.d.ts.map +1 -1
  76. package/dist/api/product.js +5 -5
  77. package/dist/api/profile.js +3 -3
  78. package/dist/api/store.js +4 -4
  79. package/dist/api/translations.js +4 -4
  80. package/dist/api/user.js +4 -4
  81. package/dist/api/wishlist.js +6 -6
  82. package/dist/{chunk-XKWRHCKI.js → chunk-3FIWHGCZ.js} +3 -3
  83. package/dist/{chunk-XKWRHCKI.js.map → chunk-3FIWHGCZ.js.map} +1 -1
  84. package/dist/{chunk-VVOJ5T6U.js → chunk-3MHDV5JS.js} +3 -3
  85. package/dist/{chunk-VVOJ5T6U.js.map → chunk-3MHDV5JS.js.map} +1 -1
  86. package/dist/{chunk-CNZGOERI.js → chunk-3YP2SQZ7.js} +4 -4
  87. package/dist/{chunk-CNZGOERI.js.map → chunk-3YP2SQZ7.js.map} +1 -1
  88. package/dist/{chunk-GARC3WHA.js → chunk-6L3XMWXX.js} +6 -6
  89. package/dist/{chunk-GARC3WHA.js.map → chunk-6L3XMWXX.js.map} +1 -1
  90. package/dist/{chunk-ENPQPRYV.js → chunk-AFSS4XNW.js} +4 -4
  91. package/dist/{chunk-ENPQPRYV.js.map → chunk-AFSS4XNW.js.map} +1 -1
  92. package/dist/{chunk-4I3BH73Z.js → chunk-BX2LJHEE.js} +5 -5
  93. package/dist/{chunk-4I3BH73Z.js.map → chunk-BX2LJHEE.js.map} +1 -1
  94. package/dist/{chunk-HMCEXUIP.js → chunk-CBNUZ7LI.js} +26 -14
  95. package/dist/chunk-CBNUZ7LI.js.map +1 -0
  96. package/dist/{chunk-OJQH7JB7.js → chunk-DHLA33CA.js} +3 -3
  97. package/dist/{chunk-OJQH7JB7.js.map → chunk-DHLA33CA.js.map} +1 -1
  98. package/dist/{chunk-TUKKZRKX.js → chunk-DQXVJYST.js} +6 -6
  99. package/dist/{chunk-TUKKZRKX.js.map → chunk-DQXVJYST.js.map} +1 -1
  100. package/dist/{chunk-UCSBJ5K2.js → chunk-EMKO3C2V.js} +4 -4
  101. package/dist/{chunk-UCSBJ5K2.js.map → chunk-EMKO3C2V.js.map} +1 -1
  102. package/dist/{chunk-OOOQN7HE.js → chunk-G2OFWZAU.js} +11 -11
  103. package/dist/{chunk-OOOQN7HE.js.map → chunk-G2OFWZAU.js.map} +1 -1
  104. package/dist/{chunk-4R2QJ7ZL.js → chunk-GXNQX4Z2.js} +4 -4
  105. package/dist/{chunk-4R2QJ7ZL.js.map → chunk-GXNQX4Z2.js.map} +1 -1
  106. package/dist/{chunk-SS6PMXD4.js → chunk-ICNOLZNT.js} +4 -4
  107. package/dist/{chunk-SS6PMXD4.js.map → chunk-ICNOLZNT.js.map} +1 -1
  108. package/dist/{chunk-YAYPUOHQ.js → chunk-IH3TQ3LD.js} +4 -4
  109. package/dist/{chunk-YAYPUOHQ.js.map → chunk-IH3TQ3LD.js.map} +1 -1
  110. package/dist/{chunk-TU2GYTBL.js → chunk-JD4J2ZB6.js} +3 -3
  111. package/dist/{chunk-TU2GYTBL.js.map → chunk-JD4J2ZB6.js.map} +1 -1
  112. package/dist/{chunk-ZCTMTICK.js → chunk-JEJR23P4.js} +4 -4
  113. package/dist/{chunk-ZCTMTICK.js.map → chunk-JEJR23P4.js.map} +1 -1
  114. package/dist/{chunk-LDNBA7H6.js → chunk-JK77XRXR.js} +3 -3
  115. package/dist/{chunk-LDNBA7H6.js.map → chunk-JK77XRXR.js.map} +1 -1
  116. package/dist/{chunk-LTOTQ75E.js → chunk-KT2MUSRN.js} +3 -3
  117. package/dist/{chunk-LTOTQ75E.js.map → chunk-KT2MUSRN.js.map} +1 -1
  118. package/dist/{chunk-QNYX2XLB.js → chunk-KV5R4LKM.js} +3 -3
  119. package/dist/{chunk-QNYX2XLB.js.map → chunk-KV5R4LKM.js.map} +1 -1
  120. package/dist/{chunk-62KII53A.js → chunk-L73AZXRJ.js} +15 -15
  121. package/dist/{chunk-62KII53A.js.map → chunk-L73AZXRJ.js.map} +1 -1
  122. package/dist/{chunk-OQR6N5L3.js → chunk-MENDTTOA.js} +3 -3
  123. package/dist/{chunk-OQR6N5L3.js.map → chunk-MENDTTOA.js.map} +1 -1
  124. package/dist/{chunk-FEATBCPL.js → chunk-O6XXHXC4.js} +4 -4
  125. package/dist/{chunk-FEATBCPL.js.map → chunk-O6XXHXC4.js.map} +1 -1
  126. package/dist/{chunk-4GYBBD5Q.js → chunk-OKP6LUT7.js} +4 -4
  127. package/dist/{chunk-4GYBBD5Q.js.map → chunk-OKP6LUT7.js.map} +1 -1
  128. package/dist/{chunk-KZPAFRHC.js → chunk-P4DUWQU4.js} +3 -3
  129. package/dist/{chunk-KZPAFRHC.js.map → chunk-P4DUWQU4.js.map} +1 -1
  130. package/dist/{chunk-PWQX77OG.js → chunk-PZL3JWM2.js} +3 -3
  131. package/dist/{chunk-PWQX77OG.js.map → chunk-PZL3JWM2.js.map} +1 -1
  132. package/dist/{chunk-U7OSJVFN.js → chunk-QKIQ3K24.js} +3 -3
  133. package/dist/{chunk-U7OSJVFN.js.map → chunk-QKIQ3K24.js.map} +1 -1
  134. package/dist/{chunk-6TAGXR2C.js → chunk-QQOFCR3L.js} +6 -6
  135. package/dist/{chunk-6TAGXR2C.js.map → chunk-QQOFCR3L.js.map} +1 -1
  136. package/dist/{chunk-AVDNMFUA.js → chunk-QUUSMVCP.js} +3 -3
  137. package/dist/{chunk-AVDNMFUA.js.map → chunk-QUUSMVCP.js.map} +1 -1
  138. package/dist/chunk-RCJRQGQO.js +14 -0
  139. package/dist/{chunk-YSOWRAZR.js.map → chunk-RCJRQGQO.js.map} +1 -1
  140. package/dist/{chunk-4WRWHIUU.js → chunk-UV5BRJH4.js} +3 -3
  141. package/dist/{chunk-4WRWHIUU.js.map → chunk-UV5BRJH4.js.map} +1 -1
  142. package/dist/{chunk-2NFVY2KK.js → chunk-VSBG4G2C.js} +4 -4
  143. package/dist/{chunk-2NFVY2KK.js.map → chunk-VSBG4G2C.js.map} +1 -1
  144. package/dist/{chunk-25NJ5RJO.js → chunk-WHOWSSX4.js} +4 -4
  145. package/dist/{chunk-25NJ5RJO.js.map → chunk-WHOWSSX4.js.map} +1 -1
  146. package/dist/{chunk-R6XKIKK6.js → chunk-WMSOSA74.js} +4 -4
  147. package/dist/{chunk-R6XKIKK6.js.map → chunk-WMSOSA74.js.map} +1 -1
  148. package/dist/{chunk-KY5DLFKQ.js → chunk-XTMHHLNK.js} +3 -3
  149. package/dist/chunk-XTMHHLNK.js.map +1 -0
  150. package/dist/{chunk-ASG64WXJ.js → chunk-Z74NUTEI.js} +3 -3
  151. package/dist/{chunk-ASG64WXJ.js.map → chunk-Z74NUTEI.js.map} +1 -1
  152. package/dist/{chunk-7ZPCIUMS.js → chunk-ZXJLVZIZ.js} +4 -4
  153. package/dist/{chunk-7ZPCIUMS.js.map → chunk-ZXJLVZIZ.js.map} +1 -1
  154. package/dist/components/cart/index.js +1 -1
  155. package/dist/components/common/index.js +1 -1
  156. package/dist/components/drawer/index.js +11 -11
  157. package/dist/components/home/index.js +14 -14
  158. package/dist/components/layout/index.js +5 -5
  159. package/dist/components/product/index.js +12 -12
  160. package/dist/components/store/index.js +13 -13
  161. package/dist/{document-class-DXABEK7X.js → document-class-SA2OXLP5.js} +12 -12
  162. package/dist/{document-class-DXABEK7X.js.map → document-class-SA2OXLP5.js.map} +1 -1
  163. package/dist/hooks/index.js +11 -11
  164. package/dist/hooks/useGtm.js +11 -11
  165. package/dist/hooks/useMoney.js +11 -11
  166. package/dist/hooks/useStore.js +11 -11
  167. package/dist/hooks/useUser.js +5 -5
  168. package/dist/index.js +11 -11
  169. package/dist/{navigation-JHGLXGSN.js → navigation-BCTD7TIG.js} +4 -4
  170. package/dist/{navigation-JHGLXGSN.js.map → navigation-BCTD7TIG.js.map} +1 -1
  171. package/dist/{navigation-E5CCL2TU.js → navigation-DF2RT7D6.js} +5 -5
  172. package/dist/{navigation-E5CCL2TU.js.map → navigation-DF2RT7D6.js.map} +1 -1
  173. package/dist/{not-found-CRT4YC5W.js → not-found-6CVGXYQ3.js} +13 -13
  174. package/dist/{not-found-CRT4YC5W.js.map → not-found-6CVGXYQ3.js.map} +1 -1
  175. package/dist/providers/index.js +11 -11
  176. package/dist/routes/account/orders.js +6 -6
  177. package/dist/routes/account.js +15 -15
  178. package/dist/routes/blog.js +10 -10
  179. package/dist/routes/brands.js +6 -6
  180. package/dist/routes/cart.js +19 -19
  181. package/dist/routes/home.js +16 -16
  182. package/dist/routes/index.js +3 -3
  183. package/dist/routes/loyalty.js +6 -6
  184. package/dist/routes/page.js +6 -6
  185. package/dist/routes/product-listing.js +16 -16
  186. package/dist/routes/product.js +14 -14
  187. package/dist/routes/seo-redirects.js +3 -3
  188. package/dist/routes/testimonials.js +1 -1
  189. package/dist/routes/thank-you.js +6 -6
  190. package/dist/skeleton.js +16 -16
  191. package/dist/tanstack.js +12 -12
  192. package/dist/utils/cookies.d.ts +20 -5
  193. package/dist/utils/cookies.d.ts.map +1 -1
  194. package/dist/utils/index.js +3 -3
  195. package/package.json +1 -1
  196. package/dist/chunk-HMCEXUIP.js.map +0 -1
  197. package/dist/chunk-KY5DLFKQ.js.map +0 -1
  198. package/dist/chunk-YSOWRAZR.js +0 -14
@@ -1,7 +1,7 @@
1
- export { pendingOrdersRedirectLoader, slugBrandRedirectLoader } from '../chunk-QNYX2XLB.js';
2
- import '../chunk-LDNBA7H6.js';
1
+ export { pendingOrdersRedirectLoader, slugBrandRedirectLoader } from '../chunk-KV5R4LKM.js';
2
+ import '../chunk-JK77XRXR.js';
3
3
  import '../chunk-MTONGOJD.js';
4
- import '../chunk-KY5DLFKQ.js';
4
+ import '../chunk-XTMHHLNK.js';
5
5
  import '../chunk-PJWFEMBX.js';
6
6
  import '../chunk-T72DAX7R.js';
7
7
  import '../chunk-DF6FBKDN.js';
@@ -18,7 +18,7 @@ async function testimonialsLoader(_ctx) {
18
18
 
19
19
  // src/routes/testimonials/index.tsx
20
20
  var LazyTestimonialsPage = lazy(
21
- () => import('../TestimonialsPage-7XPCC7G5.js').then((m) => ({ default: m.TestimonialsPage }))
21
+ () => import('../TestimonialsPage-B7RDWU6U.js').then((m) => ({ default: m.TestimonialsPage }))
22
22
  );
23
23
  var TestimonialsPage = LazyTestimonialsPage;
24
24
  async function loader(ctx, extend) {
@@ -1,10 +1,10 @@
1
- import { order } from '../chunk-4GYBBD5Q.js';
1
+ import { order } from '../chunk-OKP6LUT7.js';
2
2
  import { buildHreflangAlternates } from '../chunk-TZ3E5BN4.js';
3
- import '../chunk-LDNBA7H6.js';
3
+ import '../chunk-JK77XRXR.js';
4
4
  import { RouteId } from '../chunk-MTONGOJD.js';
5
- import '../chunk-FEATBCPL.js';
6
- import '../chunk-XKWRHCKI.js';
7
- import '../chunk-KY5DLFKQ.js';
5
+ import '../chunk-O6XXHXC4.js';
6
+ import '../chunk-3FIWHGCZ.js';
7
+ import '../chunk-XTMHHLNK.js';
8
8
  import { getTwilightContext } from '../chunk-PJWFEMBX.js';
9
9
  import '../chunk-T72DAX7R.js';
10
10
  import '../chunk-DF6FBKDN.js';
@@ -39,7 +39,7 @@ async function thankYouLoader({
39
39
 
40
40
  // src/routes/thank-you/index.tsx
41
41
  var LazyThankYouPage = lazy(
42
- () => import('../ThankYouPage-P36Q7WCY.js').then((m) => ({ default: m.ThankYouPage }))
42
+ () => import('../ThankYouPage-VJQHHOLD.js').then((m) => ({ default: m.ThankYouPage }))
43
43
  );
44
44
  var ThankYouPage = LazyThankYouPage;
45
45
  async function loader(ctx, extend) {
package/dist/skeleton.js CHANGED
@@ -1,27 +1,27 @@
1
1
  export { BlogSkeleton, BreadcrumbSkeleton, CartSkeleton, CustomerLayoutSkeleton, CustomerPageSkeleton, PageSkeleton, ProductCardSkeleton, ProductDetailSkeleton, ProductGridSkeleton, SkeletonPulse } from './chunk-N7CCSGZF.js';
2
- export { HomeSkeleton } from './chunk-CNZGOERI.js';
3
- import './chunk-KZPAFRHC.js';
2
+ export { HomeSkeleton } from './chunk-3YP2SQZ7.js';
3
+ import './chunk-P4DUWQU4.js';
4
4
  import './chunk-TZ3E5BN4.js';
5
- import './chunk-4I3BH73Z.js';
6
- import './chunk-HMCEXUIP.js';
7
- import './chunk-GARC3WHA.js';
5
+ import './chunk-BX2LJHEE.js';
6
+ import './chunk-CBNUZ7LI.js';
7
+ import './chunk-6L3XMWXX.js';
8
8
  import './chunk-342EPVXN.js';
9
- import './chunk-62KII53A.js';
10
- import './chunk-TUKKZRKX.js';
9
+ import './chunk-L73AZXRJ.js';
10
+ import './chunk-DQXVJYST.js';
11
11
  import './chunk-JKIRRMBU.js';
12
12
  import './chunk-2JV6WZ6O.js';
13
13
  import './chunk-6IATCGID.js';
14
- import './chunk-VVOJ5T6U.js';
14
+ import './chunk-3MHDV5JS.js';
15
15
  import './chunk-VVZNW5CB.js';
16
- import './chunk-TU2GYTBL.js';
17
- import './chunk-LDNBA7H6.js';
16
+ import './chunk-JD4J2ZB6.js';
17
+ import './chunk-JK77XRXR.js';
18
18
  import './chunk-MTONGOJD.js';
19
19
  import './chunk-C5X6CVXC.js';
20
- import './chunk-U7OSJVFN.js';
21
- import './chunk-ASG64WXJ.js';
22
- import './chunk-FEATBCPL.js';
23
- import './chunk-XKWRHCKI.js';
24
- import './chunk-KY5DLFKQ.js';
20
+ import './chunk-QKIQ3K24.js';
21
+ import './chunk-Z74NUTEI.js';
22
+ import './chunk-O6XXHXC4.js';
23
+ import './chunk-3FIWHGCZ.js';
24
+ import './chunk-XTMHHLNK.js';
25
25
  import './chunk-PJWFEMBX.js';
26
26
  import './chunk-TP3LCGE7.js';
27
27
  import './chunk-Z653O7MX.js';
@@ -38,7 +38,7 @@ import './chunk-YMVLYYLU.js';
38
38
  import './chunk-RJPPO3ET.js';
39
39
  import './chunk-Q7VWURUR.js';
40
40
  import './chunk-GU2KUQVD.js';
41
- import './chunk-OJQH7JB7.js';
41
+ import './chunk-DHLA33CA.js';
42
42
  import './chunk-AXW67SY7.js';
43
43
  import './chunk-BYMOPN2S.js';
44
44
  import './chunk-SKLEJJ6M.js';
package/dist/tanstack.js CHANGED
@@ -1,22 +1,22 @@
1
- import { rootHead } from './chunk-OOOQN7HE.js';
2
- export { tanstackDocumentAdapter as attrs, createRouter, createTwilightRootRoute, useTanstackDocumentAttrs as useAttrs } from './chunk-OOOQN7HE.js';
3
- export { TanStackLinkAdapter, TanStackNavigationProvider, createTanStackLinkAdapter } from './chunk-AVDNMFUA.js';
1
+ import { rootHead } from './chunk-G2OFWZAU.js';
2
+ export { tanstackDocumentAdapter as attrs, createRouter, createTwilightRootRoute, useTanstackDocumentAttrs as useAttrs } from './chunk-G2OFWZAU.js';
3
+ export { TanStackLinkAdapter, TanStackNavigationProvider, createTanStackLinkAdapter } from './chunk-QUUSMVCP.js';
4
4
  import './chunk-Z4Y55HWX.js';
5
5
  export { tanstackHeadAdapter as head, withHead } from './chunk-4D44TJ72.js';
6
6
  import './chunk-R6M6RM6U.js';
7
7
  import './chunk-B3EFOE57.js';
8
- import './chunk-R6XKIKK6.js';
9
- import './chunk-LTOTQ75E.js';
8
+ import './chunk-WMSOSA74.js';
9
+ import './chunk-KT2MUSRN.js';
10
10
  import './chunk-TZ3E5BN4.js';
11
- import './chunk-HMCEXUIP.js';
11
+ import './chunk-CBNUZ7LI.js';
12
12
  import './chunk-6IATCGID.js';
13
- import './chunk-VVOJ5T6U.js';
14
- import './chunk-TU2GYTBL.js';
15
- import './chunk-LDNBA7H6.js';
13
+ import './chunk-3MHDV5JS.js';
14
+ import './chunk-JD4J2ZB6.js';
15
+ import './chunk-JK77XRXR.js';
16
16
  import './chunk-MTONGOJD.js';
17
- import './chunk-FEATBCPL.js';
18
- import './chunk-XKWRHCKI.js';
19
- import { AUTH_TOKEN_COOKIE_NAME, extractTokenFromCookies, extractScopeFromCookies, resolveRequestStore, resolveRequestVersionId } from './chunk-KY5DLFKQ.js';
17
+ import './chunk-O6XXHXC4.js';
18
+ import './chunk-3FIWHGCZ.js';
19
+ import { AUTH_TOKEN_COOKIE_NAME, extractTokenFromCookies, extractScopeFromCookies, resolveRequestStore, resolveRequestVersionId } from './chunk-XTMHHLNK.js';
20
20
  import { runWithTwilightContext } from './chunk-PJWFEMBX.js';
21
21
  export { getTwilightContext, runWithTwilightContext, updateTwilightContext } from './chunk-PJWFEMBX.js';
22
22
  import './chunk-JWXJPJBO.js';
@@ -115,18 +115,33 @@ export declare function hostIdentifiesStore(host: string | null | undefined): bo
115
115
  * just typed.
116
116
  */
117
117
  export declare function resolveRequestStoreId(url: string, cookieHeader: string | null, host: string | null | undefined): string | null;
118
- /** Whether this could be a store's username in the first segment of a path. */
118
+ /**
119
+ * Whether this could be a store's username in the first segment of a path.
120
+ *
121
+ * A supported locale code never is, in any case: `/ar` and `/EN` are languages,
122
+ * so `preview.salla.design/en/cart` is the English cart of the store the cookie
123
+ * names. That makes a store whose username is a locale code (`ar` is one)
124
+ * unreachable by path; `?storeId=` still reaches it.
125
+ *
126
+ * The same predicate decides whether a username may become a path's root
127
+ * (`storeBaseRedirectHref`). That is what stops the redirect from looping: a
128
+ * store called `ar`, sent to `/ar/…`, would find no store there and be sent again.
129
+ */
119
130
  export declare function isStoreBaseSegment(value: string | null | undefined): value is string;
120
131
  /**
121
132
  * The store the first segment of this request's path names, on a host permitted
122
133
  * to name one.
123
134
  *
124
- * On such a host the first segment **is** the store, always. It is the root of the
135
+ * On such a host the first segment **is** the store. It is the root of the
125
136
  * application there, so `https://preview.salla.design/mtgr-alaatr-2/cart` is the
126
137
  * cart of the store whose username is `mtgr-alaatr-2`. This is a rule rather than
127
- * a guess, and it has to be: `cart`, `offers`, `search` and `ar` are all real
128
- * store usernames, so a store cannot be told from a page by looking at the
129
- * segment. `/cart` on these hosts is the store called `cart`.
138
+ * a guess, and it has to be: `cart`, `offers` and `search` are all real store
139
+ * usernames, so a store cannot be told from a page by looking at the segment.
140
+ * `/cart` on these hosts is the store called `cart`.
141
+ *
142
+ * The one segment that is not a store is a supported locale code (see
143
+ * {@link isStoreBaseSegment}). `/ar/cart` names a language, and the store comes
144
+ * from the cookie or `VITE_STORE_DOMAIN`, as it would at `/`.
130
145
  *
131
146
  * A URL that carries `storeId` is not read this way at all, whatever its value.
132
147
  * That is how `salla theme dev` names a store (`/ar?storeId=…`), on a path that
@@ -1 +1 @@
1
- {"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../src/utils/cookies.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,UAAU,CAAC;AAC9C,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAEzC;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB,cAAc,CAAC;AAEhD,6EAA6E;AAC7E,eAAO,MAAM,cAAc,YAAY,CAAC;AAExC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,cAAc,CAAC;AAElD,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAmB5C,oEAAoE;AACpE,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AM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAeD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CAQvF;AAED,yDAAyD;AACzD,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAEpF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,WAAW,GAAG,IAAI,GAAG,SAAS,CAI7D;AAED,oFAAoF;AACpF,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,GAAG,SAAS,CAG1D;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,GAAG,OAAO,CAYnE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAGzC"}
@@ -5,9 +5,9 @@ export { mergeHead, resolveHead, setHeadAdapter } from '../chunk-B3EFOE57.js';
5
5
  export { sortOptions } from '../chunk-6Z4MOC4S.js';
6
6
  export { buildBaseHead, buildHreflangAlternates, localeToOgLocale } from '../chunk-TZ3E5BN4.js';
7
7
  export { color } from '../chunk-VVZNW5CB.js';
8
- export { applyAppScopeMocks, registerThemeHookSlots } from '../chunk-TU2GYTBL.js';
9
- export { getSallaSDK, getStoreIdentifier } from '../chunk-XKWRHCKI.js';
10
- export { AUTH_TOKEN_COOKIE_NAME, clearAuthTokenCookie, extractTokenFromCookies } from '../chunk-KY5DLFKQ.js';
8
+ export { applyAppScopeMocks, registerThemeHookSlots } from '../chunk-JD4J2ZB6.js';
9
+ export { getSallaSDK, getStoreIdentifier } from '../chunk-3FIWHGCZ.js';
10
+ export { AUTH_TOKEN_COOKIE_NAME, clearAuthTokenCookie, extractTokenFromCookies } from '../chunk-XTMHHLNK.js';
11
11
  import '../chunk-PJWFEMBX.js';
12
12
  export { asset, cdn, isPlaceholder } from '../chunk-ZCH7W7DZ.js';
13
13
  export { mergeDocumentDescriptors, mergeElementAttrs, normalizeClasses, syncAttrsToElement, toReactProps } from '../chunk-CW625T2E.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-theme-engine",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/api/product.ts"],"names":["product"],"mappings":";;;;;AAiFA,SAAS,iBAAA,GAAoB;AAC3B,EAAA,IAAI;AACF,IAAA,MAAM,WAAA,GAAc,oBAAmB,CAAE,WAAA;AACzC,IAAA,OAAO,WAAA,IAAe,OAAO,WAAA,CAAY,YAAA,KAAiB,aAAa,WAAA,GAAc,IAAA;AAAA,EACvF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAEO,SAAS,uBAAuB,EAAA,EAAY;AACjD,EAAA,OAAO,CAAC,UAAA,EAAY,SAAA,EAAW,MAAA,CAAO,EAAE,GAAG,EAAE,KAAA,EAAO,cAAA,EAAe,EAAG,CAAA;AACxE;AAEO,SAAS,sBAAsB,EAAA,EAAY;AAChD,EAAA,OAAO,CAAC,YAAY,QAAA,EAAU,EAAA,EAAI,EAAE,KAAA,EAAO,cAAA,IAAkB,CAAA;AAC/D;AAGO,SAAS,sBAAsB,KAAA,EAAkD;AACtF,EAAA,OAAO,KAAA,CAAM,SAAS,CAAC,CAAA,KAAM,cAAc,KAAA,CAAM,QAAA,CAAS,CAAC,CAAA,KAAM,SAAA;AACnE;AAMO,SAAS,qBACd,KAAA,EACS;AACT,EAAA,OACE,CAAC,sBAAsB,KAAK,CAAA,KAC3B,4BAA4B,KAAK,CAAA,IAAK,KAAA,CAAM,KAAA,CAA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A,EAAS,CAAC,EAAE,MAAA,EAAO,KAAM,OAAA,CAAQ,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,MAAA,EAAQ;AAAA,KAC5D;AAAA;AAEP","file":"chunk-HMCEXUIP.js","sourcesContent":["import { queryOptions, defaultShouldDehydrateQuery } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { Product } from '../types';\nimport type { Pagination, PaginatedResult } from './types';\nimport { orThrow } from '../providers/NavigationProvider';\nimport { getTwilightContext } from '../twilight/context';\nimport type { ActiveScope } from '../utils/cookies';\n\n// ===== Filter Types =====\n\nexport interface FilterValue {\n key?: string;\n count?: number;\n value?: string;\n from?: number | '*';\n to?: number | '*';\n}\n\nexport interface Filter {\n key?: string;\n label?: string;\n type?: string;\n values?: FilterValue[];\n max?: number;\n min?: number;\n}\n\n// ===== Product List Types =====\n\nexport type ProductsListSource =\n | 'brands'\n | 'categories'\n | 'json'\n | 'landing-page'\n | 'latest'\n | 'offers'\n | 'recently'\n | 'related'\n | 'selected'\n | 'tags'\n | 'top-rated'\n | 'wishlist'\n | 'search'\n | 'sales'\n | 'reorder'\n | 'best_selling';\n\nexport interface ProductsListParams {\n /** Source type (wishlist, latest, brands, etc.) */\n source: ProductsListSource;\n /** Source value (brand_id, category_id, tag_id, search keyword, or JSON array of product IDs) */\n sourceValue?: string | number | number[] | null;\n /** Page number for offset-based pagination */\n page?: number;\n /** Cursor for cursor-based pagination (from previous response) */\n cursor?: string | null;\n /** Items per page (default: 15) */\n perPage?: number;\n /** Sort option */\n sort?: string;\n /** Enable filters on the response */\n filterable?: boolean;\n /** Abort signal for cancellation */\n signal?: AbortSignal;\n}\n\nexport type ProductsListResult = PaginatedResult<Product> & {\n filters?: Filter[];\n};\n\nexport interface ProductsListResponse {\n data: Product[];\n cursor?: Pagination;\n filters?: Filter[];\n}\n\n// ===== List-card preview cache =====\n// List payloads are a subset of details (one `image`, no `options` / `images[]`).\n// They live on a separate query key so they can paint a sheet/quick-view without\n// being treated as a successful `products/{id}/details` fetch.\n\nfunction queryClientOrNull() {\n try {\n const queryClient = getTwilightContext().queryClient;\n return queryClient && typeof queryClient.setQueryData === 'function' ? queryClient : null;\n } catch {\n return null;\n }\n}\n\nexport function productPreviewQueryKey(id: string) {\n return ['products', 'preview', String(id), { scope: getActiveScope() }] as const;\n}\n\nexport function productDetailQueryKey(id: string) {\n return ['products', 'detail', id, { scope: getActiveScope() }] as const;\n}\n\n/** True when this query is a list-card stand-in — skip it when dehydrating SSR. */\nexport function isProductPreviewQuery(query: { queryKey: readonly unknown[] }): boolean {\n return query.queryKey[0] === 'products' && query.queryKey[1] === 'preview';\n}\n\n/**\n * Default dehydrate policy (success) plus pending SSR-stream queries, minus\n * list-card stand-ins. Replacing the default wholesale would ship error states.\n */\nexport function shouldDehydrateQuery(\n query: Parameters<typeof defaultShouldDehydrateQuery>[0]\n): boolean {\n return (\n !isProductPreviewQuery(query) &&\n (defaultShouldDehydrateQuery(query) || query.state.status === 'pending')\n );\n}\n\n/**\n * Remember a list/card product so `product.queries.detail(id)` can use it as\n * `placeholderData` while details load. No-op if details for this id are already\n * cached. Themes that fetch products outside `product.list` should call this.\n */\nexport function rememberProductPreview(product: Product): void {\n const queryClient = queryClientOrNull();\n if (!queryClient || product?.id == null) return;\n const id = String(product.id);\n if (queryClient.getQueryState(productDetailQueryKey(id))?.status === 'success') return;\n queryClient.setQueryData(productPreviewQueryKey(id), product);\n}\n\nfunction scopeFromQueryKey(queryKey: readonly unknown[]): ActiveScope | null | undefined {\n const last = queryKey[queryKey.length - 1];\n if (last == null || typeof last !== 'object' || !('scope' in last)) return undefined;\n return (last as { scope: ActiveScope | null }).scope;\n}\n\nfunction isSameScope(a: ActiveScope | null | undefined, b: ActiveScope | null): boolean {\n if (a === undefined) return false;\n if (a === b) return true;\n if (a == null || b == null) return a == null && b == null;\n return (\n a.id === b.id &&\n a.type === b.type &&\n a.allocation_id === b.allocation_id &&\n a.allocation_type === b.allocation_type\n );\n}\n\nconst LIST_QUERY_PREFIXES = [\n ['products', 'list'],\n ['wishlist', 'list'],\n] as const;\n\n/**\n * Rebuild the scoped preview index from hydrated list/wishlist queries (SSR\n * dehydrate drops preview keys). Subsequent lookups hit `productPreviewQueryKey`.\n */\nfunction findProductInScopedLists(\n queryClient: NonNullable<ReturnType<typeof queryClientOrNull>>,\n id: string\n): Product | undefined {\n const scope = getActiveScope();\n let found: Product | undefined;\n for (const prefix of LIST_QUERY_PREFIXES) {\n for (const [queryKey, data] of queryClient.getQueriesData<ProductsListResult>({\n queryKey: prefix,\n })) {\n if (!isSameScope(scopeFromQueryKey(queryKey), scope)) continue;\n for (const item of data?.items ?? []) {\n if (item?.id == null) continue;\n rememberProductPreview(item);\n if (!found && String(item.id) === id) found = item;\n }\n }\n }\n return found;\n}\n\n/**\n * List-card product for `placeholderData`. Prefers the preview key; if that was\n * dropped on SSR dehydrate, rebuilds it from the current-scope list/wishlist.\n */\nexport function getProductPreview(id: string): Product | undefined {\n const queryClient = queryClientOrNull();\n if (!queryClient) return undefined;\n const key = String(id);\n return (\n queryClient.getQueryData(productPreviewQueryKey(key)) ??\n findProductInScopedLists(queryClient, key)\n );\n}\n\nfunction rememberProductPreviews(items: Product[]): void {\n for (const item of items) rememberProductPreview(item);\n}\n\n// ===== API Functions =====\n\nexport const product = {\n find: async (id: string): Promise<Product> => {\n const endpoint = `products/${id}/details?with[]=images&with[]=category&with[]=rating&with[]=notify_availability&with[]=tags&with[]=brand&with[]=options&with[]=skus&with[]=skus_availability&with[]=included_products&with[]=bundle&with[]=sold_quantity`;\n const { data } = await api.get(endpoint).json<{ data: Product }>();\n return data;\n },\n\n findOrThrow: (id: string): Promise<Product> => orThrow(product.find(id)),\n\n /**\n * Fetch products list with pagination support\n * Used by native ProductsList component for SSR loaders\n *\n * API pattern: GET /products?source=wishlist&page=1\n */\n list: async (params: ProductsListParams): Promise<ProductsListResult> => {\n const { source, sourceValue, page, cursor, perPage = 16, sort, filterable, signal } = params;\n\n // Build URL with query parameters\n const searchParams = new URLSearchParams();\n searchParams.set('source', source);\n // Only send page when explicitly provided — cursor-based callers omit it entirely\n if (page !== undefined) searchParams.set('page', String(page));\n searchParams.set('per_page', String(perPage));\n\n // Add source_value[] parameter (brand_id, category_id, tag_id, etc.)\n // For search source, use keyword parameter instead\n if (sourceValue !== undefined) {\n if (source === 'search') {\n searchParams.set('keyword', String(sourceValue));\n } else if (Array.isArray(sourceValue)) {\n sourceValue.forEach((val) => searchParams.append('source_value[]', String(val)));\n } else {\n searchParams.append('source_value[]', String(sourceValue));\n }\n }\n\n // Add filterable parameter\n if (filterable !== undefined) {\n searchParams.set('filterable', filterable ? '1' : '0');\n }\n\n // Add sort parameter\n if (sort) {\n searchParams.set('sort', sort);\n }\n\n // Add cursor for cursor-based pagination\n if (cursor) {\n searchParams.set('cursor', cursor);\n }\n\n // Make the request\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`products?${searchParams.toString()}`, options as any)\n .json<ProductsListResponse>();\n\n const items = response.data ?? [];\n rememberProductPreviews(items);\n\n return {\n items,\n next: response.cursor?.next ?? null,\n filters: response.filters,\n };\n },\n\n queries: {\n detail: (id: string) =>\n queryOptions({\n // Stock and availability are resolved per branch allocation — same as the list.\n queryKey: productDetailQueryKey(id),\n queryFn: () => product.find(id),\n // List-card product, if one was remembered. Not written as the detail\n // cache entry — `queryFn` still hits products/{id}/details.\n placeholderData: () => getProductPreview(id),\n }),\n list: (params: Omit<ProductsListParams, 'signal'>) =>\n queryOptions({\n // Scope (branch) varies product availability — key must include it.\n queryKey: ['products', 'list', params, { scope: getActiveScope() }],\n queryFn: ({ signal }) => product.list({ ...params, signal }),\n }),\n },\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/cookies.ts","../src/utils/store-base.ts"],"names":[],"mappings":";;;AAAO,IAAM,sBAAA,GAAyB;AAC/B,IAAM,iBAAA,GAAoB,OAAA;AAoB1B,IAAM,oBAAA,GAAuB,WAA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K,EAAA,GAAK,CAAA;AACnC,EAAA,IAAI,EAAA,KAAO,IAAI,OAAO,QAAA;AAEtB,EAAA,QAAA,CAAS,MAAA,CAAO,IAAI,CAAC,CAAA;AACrB,EAAA,OAAO,QAAA,CAAS,IAAA,CAAK,GAAG,CAAA,IAAK,GAAA;AAC/B;AAGA,SAAS,eAAA,CAAgB,kBAA0B,QAAA,EAAyC;AAC1F,EAAA,MAAM,IAAA,GAAO,iBAAiB,KAAA,CAAM,GAAG,EAAE,MAAA,CAAO,OAAO,EAAE,GAAA,EAAI;AAC7D,EAAA,IAAI,CAAC,MAAM,OAAO,IAAA;AAClB,EAAA,IAAI,QAAA,EAAU,OAAO,IAAA,KAAS,QAAA,GAAW,IAAA,GAAO,IAAA;AAChD,EAAA,OAAO,QAAA,CAAS,IAAI,CAAA,GAAI,IAAA,GAAO,IAAA;AACjC;AAqBO,SAAS,sBAAsB,IAAA,EAKpB;AAChB,EAAA,MAAM,EAAE,IAAA,EAAM,IAAA,EAAM,QAAA,EAAU,MAAK,GAAI,IAAA;AACvC,EAAA,IAAI,CAAC,qBAAqB,IAAI,CAAA,IAAK,CAAC,kBAAA,CAAmB,QAAQ,CAAA,IAAK,QAAA,KAAa,IAAA,EAAM;AACrF,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,IAAA,EAAM,2BAA2B,CAAA;AACrD,EAAA,GAAA,CAAI,YAAA,CAAa,OAAO,cAAc,CAAA;AACtC,EAAA,OAAO,CAAA,EAAG,eAAA,CAAgB,GAAA,CAAI,QAAA,EAAU,QAAQ,CAAC,CAAA,EAAG,GAAA,CAAI,MAAM,CAAA,EAAG,GAAA,CAAI,IAAI,CAAA,CAAA;AAC3E","file":"chunk-KY5DLFKQ.js","sourcesContent":["export const AUTH_TOKEN_COOKIE_NAME = 'token';\nexport const SCOPE_COOKIE_NAME = 'scope';\n\n/**\n * Which store this request is for, when the hostname does not say.\n *\n * A live storefront is reached at its own domain, so the hostname identifies it\n * and nothing else is needed. A preview is not: every theme under review is\n * served from the one preview hostname, so the store has to be named some other\n * way — the dispatcher takes it from `?storeId=` and puts it here, the same way\n * it remembers which theme to serve.\n *\n * Written by the dispatcher rather than the theme, and set on the *forwarded\n * request* as well as the response, because the response cookie only arrives in\n * time for the second page load and the first one has to render too.\n *\n * The literal is a contract with `STORE_COOKIE` in store-front-dispacher\n * (`src/dispatch/preview.ts`), and **nothing checks the two agree**. Drift does\n * not fail loudly — it renders somebody else's shop. Grep both repos before\n * changing it.\n */\nexport const STORE_ID_COOKIE_NAME = 'salla_sid';\n\n/** Query parameter naming the store, on a host that serves more than one. */\nexport const STORE_ID_PARAM = 'storeId';\n\n/**\n * Which version of the theme's settings to render.\n *\n * A merchant's theme settings are versioned, and the storefront normally shows\n * whichever version is live — the API answers with it, and names it back as\n * `theme.profile.id`. Two places need a different one: the merchant's own theme\n * editor, which previews a draft version before it is published, and a partner\n * running a theme locally against a store whose settings they are editing. Both\n * open the theme inside an iframe, and the version travels in that URL.\n *\n * Named `versionId` rather than the `version_id` the Dashboard uses internally,\n * because it sits beside `?storeId=` and one URL should not spell two ids two\n * ways. The value is the same one either way: the Optimus-encoded version id,\n * which is exactly what `s-version-id` has always carried.\n *\n * The literal is a contract with `VERSION_COOKIE` in store-front-dispacher\n * (`src/dispatch/preview.ts`), on the same terms as {@link STORE_ID_COOKIE_NAME}:\n * nothing checks the two agree, and drift shows a merchant the wrong version of\n * their own settings rather than failing.\n */\nexport const VERSION_ID_COOKIE_NAME = 'salla_vid';\n\n/** Query parameter naming the theme-settings version, where one may be named. */\nexport const VERSION_ID_PARAM = 'versionId';\n\n/**\n * An id named by a request is an integer, and anything else is not one.\n *\n * Validated rather than passed through because these values end up in an upstream\n * API path and header. Leading zeroes, signs, decimals and whitespace are all\n * rejected: the point is a single canonical form, not the widest set of things\n * that could be coerced into a number.\n *\n * One function for both ids on purpose. They arrive the same way, from the same\n * untrusted place, and are spent the same way; two copies of this rule would be\n * two chances for one of them to be relaxed on its own.\n */\nfunction parseRequestId(raw: string | null | undefined): string | null {\n if (!raw) return null;\n return /^[1-9][0-9]{0,18}$/.test(raw) ? raw : null;\n}\n\n/** A store id in its canonical form, or null when it is not one. */\nexport function parseStoreId(raw: string | null | undefined): string | null {\n return parseRequestId(raw);\n}\n\n/** A theme-settings version id in its canonical form, or null when it is not one. */\nexport function parseVersionId(raw: string | null | undefined): string | null {\n return parseRequestId(raw);\n}\n\n/** The store id the dispatcher left in the cookie, or null when absent or malformed. */\nexport function extractStoreIdFromCookies(cookieHeader: string | null): string | null {\n return parseStoreId(extractTokenFromCookies(cookieHeader, STORE_ID_COOKIE_NAME));\n}\n\n/** The version id the dispatcher left in the cookie, or null when absent or malformed. */\nexport function extractVersionIdFromCookies(cookieHeader: string | null): string | null {\n return parseVersionId(extractTokenFromCookies(cookieHeader, VERSION_ID_COOKIE_NAME));\n}\n\n/**\n * The only hosts on which a request may name its own store.\n *\n * **This is a security boundary, not a convenience.** On a merchant's own domain\n * the hostname *is* the store, and it is the only thing that may decide. A theme\n * that also honoured `?storeId=` there would let anyone open\n * `https://reefperfumes.com/?storeId=<someone else>` and be served a different\n * merchant's shop from the domain its owner controls — their branding, their\n * customers' address bar, somebody else's catalogue — and the cookie would keep\n * serving it for the rest of that browser's session. Salla points SaaS domains\n * at this dispatcher, so those hostnames are real and reachable.\n *\n * The override exists for one situation: a host that serves many stores and so\n * cannot identify one from its name. That is the preview host, where every theme\n * under review answers on the same address, and local development.\n *\n * Adding an entry grants that host the ability to render any store on request.\n * Add nothing that a merchant's traffic reaches.\n */\nexport const STORE_ID_HOSTS: readonly string[] = ['preview.salla.design'];\n\n/** The hostname alone — a port never distinguishes one host's authority from another's. */\nfunction hostnameOf(host: string): string {\n const trimmed = host.trim().toLowerCase();\n // IPv6 literals are bracketed, and the colons inside them are not a port.\n if (trimmed.startsWith('[')) return trimmed.slice(0, trimmed.indexOf(']') + 1) || trimmed;\n const colon = trimmed.indexOf(':');\n return colon === -1 ? trimmed : trimmed.slice(0, colon);\n}\n\nfunction isLoopback(hostname: string): boolean {\n return (\n hostname === 'localhost' ||\n hostname === '127.0.0.1' ||\n hostname === '[::1]' ||\n hostname.endsWith('.localhost')\n );\n}\n\n/**\n * Whether this host is allowed to let the request choose a store.\n *\n * Deliberately an allowlist of exact hostnames plus loopback. No suffix matching:\n * a rule like \"anything ending in salla.design\" is one wildcard DNS record away\n * from admitting a host nobody meant to admit, and the list of hosts that serve\n * more than one store is short and known.\n *\n * It gates {@link resolveRequestVersionId} as well, and the name has been left\n * alone rather than generalised because one predicate that both call is the\n * property worth keeping — a second, subtly different list is how a host ends up\n * permitted to name one thing and not the other. A version is worth gating for\n * the same reason a store is: on a merchant's own domain, honouring\n * `?versionId=` would publish whatever draft settings they are still working on\n * to anyone who guessed the URL.\n */\nexport function allowsRequestStoreId(host: string | null | undefined): boolean {\n if (!host) return false;\n const hostname = hostnameOf(host);\n return STORE_ID_HOSTS.includes(hostname) || isLoopback(hostname);\n}\n\n/**\n * Whether this host *is* a store, so its name can be used as the identifier.\n *\n * The exact inverse of {@link allowsRequestStoreId}, and deliberately written as\n * one so the two can never disagree: a host that may name its store is a host\n * that serves more than one, and a host that serves more than one cannot be the\n * answer to \"which store is this?\". `preview.salla.design` and `localhost:5188`\n * are not shops; asking the API about them earns a 422 and a page that reads as\n * a broken theme.\n */\nexport function hostIdentifiesStore(host: string | null | undefined): boolean {\n return Boolean(host) && !allowsRequestStoreId(host);\n}\n\n/**\n * The store this request names, on a host permitted to name one.\n *\n * The host check is inside the resolution rather than at a call site, because a\n * call site is a thing someone can add without reading this comment. There is no\n * way to ask \"what store did the request name?\" without also asking \"is this a\n * host that may say?\" — get it wrong and the answer is a security bug that looks\n * like a feature.\n *\n * Between the two permitted sources the URL wins, the same precedence the\n * dispatcher uses for the theme and for the same reason: a link is how someone\n * switches, and a cookie they cannot see should never beat the address they\n * just typed.\n */\nexport function resolveRequestStoreId(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined\n): string | null {\n return resolveRequestId(url, cookieHeader, host, STORE_ID_PARAM, STORE_ID_COOKIE_NAME);\n}\n\n/**\n * A store username as it can appear as the first segment of a path.\n *\n * Starts with a letter or digit, so nothing the platform mounts at the root of a\n * host — `/_serverFn/`, `/.well-known/`, `/favicon.ico` — is ever read as a store.\n * The value is sent upstream as the `store-identifier` header, so the set is kept\n * narrow on purpose: a username outside it cannot be addressed by path, and\n * `?storeId=` still can.\n */\nconst STORE_BASE_SEGMENT = /^[a-z0-9][a-z0-9_-]{0,62}$/i;\n\n/** Whether this could be a store's username in the first segment of a path. */\nexport function isStoreBaseSegment(value: string | null | undefined): value is string {\n return typeof value === 'string' && STORE_BASE_SEGMENT.test(value);\n}\n\n/**\n * The store the first segment of this request's path names, on a host permitted\n * to name one.\n *\n * On such a host the first segment **is** the store, always. It is the root of the\n * application there, so `https://preview.salla.design/mtgr-alaatr-2/cart` is the\n * cart of the store whose username is `mtgr-alaatr-2`. This is a rule rather than\n * a guess, and it has to be: `cart`, `offers`, `search` and `ar` are all real\n * store usernames, so a store cannot be told from a page by looking at the\n * segment. `/cart` on these hosts is the store called `cart`.\n *\n * A URL that carries `storeId` is not read this way at all, whatever its value.\n * That is how `salla theme dev` names a store (`/ar?storeId=…`), on a path that\n * begins with a page; the root loader then redirects to the store's own address.\n * Checking for a *valid* id instead would let a malformed one hand the page's\n * first segment the store's job. (On the preview host the dispatcher removes the\n * parameter and sends a cookie; the editor opens that host at `/`, where there is\n * no segment to read.)\n *\n * Same gate as {@link resolveRequestStoreId}, for the same reason: on a merchant's\n * own domain the hostname is the store and the path is only ever a page.\n */\nexport function resolveRequestStoreBase(\n url: string,\n host: string | null | undefined\n): string | null {\n if (!allowsRequestStoreId(host)) return null;\n\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return null;\n }\n if (parsed.searchParams.has(STORE_ID_PARAM)) return null;\n\n const first = parsed.pathname.split('/')[1];\n return isStoreBaseSegment(first) ? first : null;\n}\n\n/** Which store a request addressed, and how. At most one of the two is set. */\nexport interface RequestStore {\n /** Named by `?storeId=`, or by the cookie remembering it. */\n storeId: string | null;\n /** Named by the first segment of the path. */\n storeBase: string | null;\n}\n\n/**\n * The store this request addressed: the query, then the path, then the cookie.\n *\n * The path outranks the cookie because it is the address the visitor can see.\n * The cookie is one value for the whole preview host, so with two stores open in\n * two tabs it names whichever was opened last; the path names the one in front\n * of them.\n */\nexport function resolveRequestStore(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined\n): RequestStore {\n const storeBase = resolveRequestStoreBase(url, host);\n return {\n storeBase,\n storeId: storeBase ? null : resolveRequestStoreId(url, cookieHeader, host),\n };\n}\n\n/**\n * The theme-settings version this request names, on a host permitted to name one.\n *\n * Same shape and the same host gate as {@link resolveRequestStoreId}, deliberately:\n * both answer \"what did this request ask to be shown?\", both are reached only on\n * a host that serves more than one thing, and a version that could be named where\n * a store could not would be a second rule to keep in step with the first.\n *\n * Null is the ordinary answer, and it is not a failure — it means nothing\n * addressed a version, so the store's own live one is what gets rendered.\n */\nexport function resolveRequestVersionId(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined\n): string | null {\n return resolveRequestId(url, cookieHeader, host, VERSION_ID_PARAM, VERSION_ID_COOKIE_NAME);\n}\n\n/**\n * The id this request names, from the query first and the cookie after.\n *\n * The host check lives here rather than at either call site, for the reason the\n * two wrappers above are wrappers at all: there must be no way to ask what a\n * request named without also asking whether this host may say.\n */\nfunction resolveRequestId(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined,\n param: string,\n cookieName: string\n): string | null {\n if (!allowsRequestStoreId(host)) return null;\n\n let fromQuery: string | null = null;\n try {\n fromQuery = parseRequestId(new URL(url).searchParams.get(param));\n } catch {\n /* a relative or malformed URL simply names nothing */\n }\n return fromQuery ?? parseRequestId(extractTokenFromCookies(cookieHeader, cookieName));\n}\n\n/**\n * Deletes the auth `token` cookie. This cookie is written client-side by the theme\n * (TwilightProvider), not by the SDK — `salla.cookie.clearAll()` only clears its own\n * allowlist and leaves `token` behind — so logout must clear it here. Client-only.\n */\nexport function clearAuthTokenCookie(): void {\n if (typeof document === 'undefined') return;\n document.cookie = `${AUTH_TOKEN_COOKIE_NAME}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;\n}\n\nexport function extractTokenFromCookies(\n cookieHeader: string | null,\n cookieName: string\n): string | null {\n if (!cookieHeader) return null;\n\n const prefix = `${cookieName}=`;\n let start = 0;\n\n while (start < cookieHeader.length) {\n const idx = cookieHeader.indexOf(prefix, start);\n if (idx === -1) return null;\n\n const prevChar = idx > 0 ? cookieHeader[idx - 1] : '';\n if (prevChar === '' || prevChar === ';' || prevChar === ' ') {\n let end = cookieHeader.indexOf(';', idx);\n if (end === -1) end = cookieHeader.length;\n\n const value = cookieHeader.slice(idx + prefix.length, end).trim();\n try {\n return decodeURIComponent(value) || null;\n } catch {\n return value || null;\n }\n }\n\n start = idx + prefix.length;\n }\n\n return null;\n}\n\n/**\n * The scope the Salla SDK persists as `scope`: the market (`id`/`type`) plus, once\n * bullet delivery confirms an address or branch, the allocation. The SDK sends all\n * four as request headers (`s-scope-id`, `s-scope-type`, `s-scope-allocation-type`,\n * `s-scope-allocation-id`) and the API resolves stock per allocation — a scope sent\n * without its allocation is a different question, answered from a different branch.\n */\nexport interface ActiveScope {\n id: string;\n type?: string;\n allocation_type?: string;\n allocation_id?: string;\n}\n\n/** The SDK stores the scope either as its full object or as a bare id. */\nfunction normalizeScope(raw: unknown): ActiveScope | null {\n if (raw == null) return null;\n if (typeof raw !== 'object') return { id: String(raw) };\n const s = raw as Record<string, unknown>;\n if (s.id == null) return null;\n const scope: ActiveScope = { id: String(s.id) };\n if (s.type != null) scope.type = String(s.type);\n if (s.allocation_type != null) scope.allocation_type = String(s.allocation_type);\n if (s.allocation_id != null) scope.allocation_id = String(s.allocation_id);\n return scope;\n}\n\n/**\n * Reads the active scope from the `scope` cookie, which Salla persists as a JSON\n * object (e.g. `{\"id\":123,\"type\":\"scope\",\"allocation_type\":\"branch\",\"allocation_id\":\"9\"}`).\n * Returns null when the cookie is missing or unparseable. Used server-side, where\n * `salla.storage` is absent.\n */\nexport function extractScopeFromCookies(cookieHeader: string | null): ActiveScope | null {\n const raw = extractTokenFromCookies(cookieHeader, SCOPE_COOKIE_NAME);\n if (!raw) return null;\n try {\n return normalizeScope(JSON.parse(raw));\n } catch {\n return null;\n }\n}\n\n/** {@link extractScopeFromCookies} reduced to the id. */\nexport function extractScopeIdFromCookies(cookieHeader: string | null): string | null {\n return extractScopeFromCookies(cookieHeader)?.id ?? null;\n}\n\n/**\n * The scope the Salla SDK persisted in its storage (`salla.storage.get('scope')`).\n *\n * Returns `undefined` when the SDK storage API isn't ready yet — deliberately\n * distinct from `null` (\"no branch selected\"), so callers can't mistake a\n * not-yet-hydrated SDK for a cleared selection. Client-only.\n */\nexport function readSdkScope(): ActiveScope | null | undefined {\n const storage = typeof window !== 'undefined' ? window.salla?.storage : undefined;\n if (typeof storage?.get !== 'function') return undefined;\n return normalizeScope(storage.get(SCOPE_COOKIE_NAME));\n}\n\n/** {@link readSdkScope} reduced to the id; keeps the not-ready/none distinction. */\nexport function readSdkScopeId(): string | null | undefined {\n const scope = readSdkScope();\n return scope === undefined ? undefined : (scope?.id ?? null);\n}\n\n/** One year — the SDK keeps the selected branch in localStorage indefinitely. */\nconst SCOPE_COOKIE_MAX_AGE = 60 * 60 * 24 * 365;\n\nconst sameScope = (a: ActiveScope | null, b: ActiveScope | null): boolean =>\n JSON.stringify(a) === JSON.stringify(b);\n\n/**\n * Mirrors the scope the Salla SDK selected into the `scope` cookie so the SERVER\n * can see it. The SDK persists the selection in localStorage ONLY and writes no\n * cookie, so without this the server computes scope=null for every visitor who\n * picked a branch while the client computes the branch id — the dehydrated settings\n * query key never matches and the client refetches store settings on every page\n * load (SAL-122).\n *\n * Written in the SDK's own JSON shape so {@link extractScopeFromCookies} parses it,\n * allocation included: the bullet-delivery component writes the same cookie with the\n * full object, and rewriting it with the id alone would drop the branch the server\n * needs. Returns true when the cookie was (re)written. Client-only; no-op on the server.\n */\nexport function writeScopeCookie(scope: ActiveScope | null): boolean {\n if (typeof document === 'undefined') return false;\n if (sameScope(extractScopeFromCookies(document.cookie), scope)) return false;\n\n if (scope == null) {\n document.cookie = `${SCOPE_COOKIE_NAME}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;\n return true;\n }\n\n const value = encodeURIComponent(JSON.stringify(scope));\n document.cookie = `${SCOPE_COOKIE_NAME}=${value}; path=/; max-age=${SCOPE_COOKIE_MAX_AGE}; samesite=lax`;\n return true;\n}\n\n/**\n * Keeps the `scope` cookie in step with the SDK's selected branch. Call on every\n * client navigation; it no-ops while the SDK storage API is still hydrating so a\n * late-loading SDK can't wipe a valid cookie.\n */\nexport function syncScopeCookie(): boolean {\n const scope = readSdkScope();\n return scope === undefined ? false : writeScopeCookie(scope);\n}\n","/**\n * @fileoverview Paths on a host where the store is the root.\n *\n * On `preview.salla.design` and a dev server a store is addressed by the first\n * segment of the path — `/mtgr-alaatr-2/cart` — and that segment is the root of\n * the application. No route knows about it: the router takes it off every URL on\n * the way in and puts it back on every URL on the way out\n * (`tanstack/store-base.ts`), so pages, links and loaders all see `/cart`.\n *\n * Which segment it is, and on which hosts, is decided once, by\n * `resolveRequestStoreBase` in `utils/cookies.ts`. This file only moves it on and\n * off a path. See `docs/store-base-path.md`.\n */\nimport { allowsRequestStoreId, isStoreBaseSegment, STORE_ID_PARAM } from './cookies';\nimport { isLocale } from '../providers/locale-constants';\n\n/**\n * An application pathname, without the store segment in front.\n *\n * Only a whole segment is removed, so `/mtgr-alaatr-2x/cart` is left alone, and a\n * pathname that does not start with the segment comes back unchanged.\n */\nexport function stripStoreBase(pathname: string, base: string): string {\n const prefix = `/${base}`;\n if (pathname === prefix) return '/';\n return pathname.startsWith(`${prefix}/`) ? pathname.slice(prefix.length) : pathname;\n}\n\n/**\n * An application path as the browser addresses it, with the store segment in front.\n *\n * It never checks whether the segment is already there, because that cannot be\n * told apart from a page of the same name: a store called `cart` keeps its cart at\n * `/cart/cart`. Callers pass application paths only.\n */\nexport function prefixStoreBase(path: string, base: string): string {\n const rooted = path.startsWith('/') ? path : `/${path}`;\n // The store's root is `/<base>`, not `/<base>/`, with or without a query or hash.\n const atRoot = rooted === '/' || rooted[1] === '?' || rooted[1] === '#';\n return `/${base}${atRoot ? rooted.slice(1) : rooted}`;\n}\n\n/**\n * A pathname from a link the Salla API handed out, without the store's username in it.\n *\n * A store with no domain of its own is served under its username on a shared host,\n * and every URL the API returns for it carries that segment. Its `store.url` is\n * `/{lang}/{username}/` when the store is multilingual and `/{username}/` when it is\n * not: `https://demostore.salla.sa/ar/dev-vgckq3fssfhjewwi/`, `https://salla.sa/cart/`.\n * The segment there belongs to Salla's host, not to the application. Left in, it\n * lands where a page slug is expected and matches no route.\n *\n * The username is the last segment of `store.url`, but only when it equals the\n * store's username. Neither its position nor its spelling says so on its own: `/ar/`\n * is the locale of `https://3tir.com/ar/`, a store on its own domain whose links carry\n * no username, and it is also the whole address of the store called `ar`,\n * `https://salla.sa/ar/`. Without a username to compare against, a last segment\n * spelled like a locale is taken to be one, which is wrong only for a store whose\n * username is a locale code.\n *\n * The locale stays wherever the link put it.\n */\nexport function withoutStoreUrlBase(\n pathname: string,\n storeUrlPathname: string,\n username?: string | null\n): string {\n const own = storeUrlSegment(storeUrlPathname, username);\n if (!own) return pathname;\n\n const segments = pathname.split('/');\n // Salla puts the locale first (`/ar/dev-x/…`); a store that is not multilingual has\n // none (`/dev-x/…`). Checked in that order, `/ar/ar/…` for a store called `ar` keeps\n // its locale.\n let at = -1;\n if (isLocale(segments[1]) && segments[2] === own) at = 2;\n else if (segments[1] === own) at = 1;\n if (at === -1) return pathname;\n\n segments.splice(at, 1);\n return segments.join('/') || '/';\n}\n\n/** The segment `store.url` serves the store under, or null when it has none. */\nfunction storeUrlSegment(storeUrlPathname: string, username?: string | null): string | null {\n const last = storeUrlPathname.split('/').filter(Boolean).pop();\n if (!last) return null;\n if (username) return last === username ? last : null;\n return isLocale(last) ? null : last;\n}\n\n/**\n * Where to send a page whose store was not named by its own first segment, or null\n * when it already was.\n *\n * On a host where the store is the root, every page has one address,\n * `/<username>/…`. A request that found its store some other way (`?storeId=`, the\n * preview cookie, `VITE_STORE_DOMAIN`, or a first segment that named the store by\n * another spelling, such as its numeric id) is sent there once the store's settings\n * say what its username is.\n *\n * `storeId` is dropped from the query on the way. It has to be: a URL carrying it\n * is never read for a store segment, so keeping it would redirect to an address\n * that redirects again, forever. For the same reason a username that could not be\n * read back out of a path produces no redirect at all.\n *\n * `href` is the application's own href (path, query and hash, already without any\n * store segment), which the router keeps percent-encoded, so the result is safe to\n * put in a `Location` header.\n */\nexport function storeBaseRedirectHref(args: {\n host: string | null | undefined;\n base: string | null;\n username: string | null | undefined;\n href: string;\n}): string | null {\n const { host, base, username, href } = args;\n if (!allowsRequestStoreId(host) || !isStoreBaseSegment(username) || username === base) {\n return null;\n }\n\n const url = new URL(href, 'http://store-base.invalid');\n url.searchParams.delete(STORE_ID_PARAM);\n return `${prefixStoreBase(url.pathname, username)}${url.search}${url.hash}`;\n}\n"]}
@@ -1,14 +0,0 @@
1
- import { lazy } from 'react';
2
-
3
- // src/components/cart/lazy.ts
4
- var LazyCartItem = lazy(() => import('./CartItem-7P2ZPNRC.js').then((m) => ({ default: m.CartItem })));
5
- var LazyCartSummary = lazy(
6
- () => import('./CartSummary-W6FWXDLZ.js').then((m) => ({ default: m.CartSummary }))
7
- );
8
- var LazySeoCartWidget = lazy(
9
- () => import('./SeoCartWidget-KTU43V5G.js').then((m) => ({ default: m.SeoCartWidget }))
10
- );
11
-
12
- export { LazyCartItem, LazyCartSummary, LazySeoCartWidget };
13
- //# sourceMappingURL=chunk-YSOWRAZR.js.map
14
- //# sourceMappingURL=chunk-YSOWRAZR.js.map