@salla.sa/twilight-theme-engine 1.0.146 → 1.0.148

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 (254) hide show
  1. package/dist/{AddToCartForm-ZZMT3ZRO.js → AddToCartForm-WY5QEHJ4.js} +3 -3
  2. package/dist/{AddToCartForm-ZZMT3ZRO.js.map → AddToCartForm-WY5QEHJ4.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-LVRGWFOC.js → BlogAuthorPage-E2WXK6HD.js} +17 -17
  4. package/dist/{BlogAuthorPage-LVRGWFOC.js.map → BlogAuthorPage-E2WXK6HD.js.map} +1 -1
  5. package/dist/{BlogCategoryPage-CONL6QSN.js → BlogCategoryPage-B2JEB33A.js} +17 -17
  6. package/dist/{BlogCategoryPage-CONL6QSN.js.map → BlogCategoryPage-B2JEB33A.js.map} +1 -1
  7. package/dist/{BlogPage-6ZA474IU.js → BlogPage-CSNI6SS5.js} +15 -15
  8. package/dist/{BlogPage-6ZA474IU.js.map → BlogPage-CSNI6SS5.js.map} +1 -1
  9. package/dist/{BlogSinglePage-W7WYKP7W.js → BlogSinglePage-5ZY5EB6H.js} +15 -15
  10. package/dist/{BlogSinglePage-W7WYKP7W.js.map → BlogSinglePage-5ZY5EB6H.js.map} +1 -1
  11. package/dist/{BlogTagPage-G5JX7FSN.js → BlogTagPage-QFS7AKNK.js} +17 -17
  12. package/dist/{BlogTagPage-G5JX7FSN.js.map → BlogTagPage-QFS7AKNK.js.map} +1 -1
  13. package/dist/{BrandsPage-TB5NDSGL.js → BrandsPage-QBA2WQHF.js} +16 -16
  14. package/dist/{BrandsPage-TB5NDSGL.js.map → BrandsPage-QBA2WQHF.js.map} +1 -1
  15. package/dist/{Breadcrumb-EVZDJG7H.js → Breadcrumb-CH35WQ6M.js} +15 -15
  16. package/dist/{Breadcrumb-EVZDJG7H.js.map → Breadcrumb-CH35WQ6M.js.map} +1 -1
  17. package/dist/{CartItem-D2LJIFGL.js → CartItem-NBM3KRUH.js} +15 -15
  18. package/dist/{CartItem-D2LJIFGL.js.map → CartItem-NBM3KRUH.js.map} +1 -1
  19. package/dist/{CartSummary-V4HYUEPB.js → CartSummary-OD2IJTTA.js} +15 -15
  20. package/dist/{CartSummary-V4HYUEPB.js.map → CartSummary-OD2IJTTA.js.map} +1 -1
  21. package/dist/{Copyright-JLIFLENS.js → Copyright-7EC2FQUB.js} +3 -3
  22. package/dist/{Copyright-JLIFLENS.js.map → Copyright-7EC2FQUB.js.map} +1 -1
  23. package/dist/{CustomerLayout-JSIYPWY4.js → CustomerLayout-7GEOMQ3Z.js} +15 -15
  24. package/dist/{CustomerLayout-JSIYPWY4.js.map → CustomerLayout-7GEOMQ3Z.js.map} +1 -1
  25. package/dist/{Footer-BNIVXKRM.js → Footer-JTQIMWSF.js} +4 -4
  26. package/dist/{Footer-BNIVXKRM.js.map → Footer-JTQIMWSF.js.map} +1 -1
  27. package/dist/{Header-DI3OK5TC.js → Header-4ZW5UVTX.js} +8 -8
  28. package/dist/{Header-DI3OK5TC.js.map → Header-4ZW5UVTX.js.map} +1 -1
  29. package/dist/{LatestProducts-PEIN355E.js → LatestProducts-VHN2P5TE.js} +17 -17
  30. package/dist/{LatestProducts-PEIN355E.js.map → LatestProducts-VHN2P5TE.js.map} +1 -1
  31. package/dist/{LoyaltyPage-GV6WMYVE.js → LoyaltyPage-PVK7FBFE.js} +15 -15
  32. package/dist/{LoyaltyPage-GV6WMYVE.js.map → LoyaltyPage-PVK7FBFE.js.map} +1 -1
  33. package/dist/{LoyaltyPointsPage-QNOVSCKB.js → LoyaltyPointsPage-WYCO453U.js} +6 -6
  34. package/dist/{LoyaltyPointsPage-QNOVSCKB.js.map → LoyaltyPointsPage-WYCO453U.js.map} +1 -1
  35. package/dist/{MainMenu-IN5HUX3U.js → MainMenu-Y2PAFESM.js} +5 -5
  36. package/dist/{MainMenu-IN5HUX3U.js.map → MainMenu-Y2PAFESM.js.map} +1 -1
  37. package/dist/{MasterLayout-GHAXKYOR.js → MasterLayout-EBLVT53G.js} +15 -15
  38. package/dist/{MasterLayout-GHAXKYOR.js.map → MasterLayout-EBLVT53G.js.map} +1 -1
  39. package/dist/{MobileMenu-XU45EZMG.js → MobileMenu-YIL4MEWX.js} +16 -16
  40. package/dist/{MobileMenu-XU45EZMG.js.map → MobileMenu-YIL4MEWX.js.map} +1 -1
  41. package/dist/{NotificationsPage-AMY7TARF.js → NotificationsPage-K2CJOV2N.js} +15 -15
  42. package/dist/{NotificationsPage-AMY7TARF.js.map → NotificationsPage-K2CJOV2N.js.map} +1 -1
  43. package/dist/{OrderSinglePage-L2E6YH3Z.js → OrderSinglePage-T7S7KXJ3.js} +16 -16
  44. package/dist/{OrderSinglePage-L2E6YH3Z.js.map → OrderSinglePage-T7S7KXJ3.js.map} +1 -1
  45. package/dist/{OrdersPage-76ORWMJY.js → OrdersPage-WAW3NS2E.js} +15 -15
  46. package/dist/{OrdersPage-76ORWMJY.js.map → OrdersPage-WAW3NS2E.js.map} +1 -1
  47. package/dist/{PageSingle-D7I6EHBF.js → PageSingle-L5EBQGWS.js} +3 -3
  48. package/dist/{PageSingle-D7I6EHBF.js.map → PageSingle-L5EBQGWS.js.map} +1 -1
  49. package/dist/{ProductDetails-BZVRXSCD.js → ProductDetails-4E46ZCMQ.js} +5 -5
  50. package/dist/{ProductDetails-BZVRXSCD.js.map → ProductDetails-4E46ZCMQ.js.map} +1 -1
  51. package/dist/{ProfilePage-65NYRBON.js → ProfilePage-KN7BWYFZ.js} +15 -15
  52. package/dist/{ProfilePage-65NYRBON.js.map → ProfilePage-KN7BWYFZ.js.map} +1 -1
  53. package/dist/{ReviewsPage-C7NSCMBE.js → ReviewsPage-CCTPJN76.js} +3 -3
  54. package/dist/{ReviewsPage-C7NSCMBE.js.map → ReviewsPage-CCTPJN76.js.map} +1 -1
  55. package/dist/{SeoCartWidget-GK3KC2M3.js → SeoCartWidget-Q5XK5MEW.js} +15 -15
  56. package/dist/{SeoCartWidget-GK3KC2M3.js.map → SeoCartWidget-Q5XK5MEW.js.map} +1 -1
  57. package/dist/{SettingsPage-7VGJBA5K.js → SettingsPage-DQAAMJE5.js} +15 -15
  58. package/dist/{SettingsPage-7VGJBA5K.js.map → SettingsPage-DQAAMJE5.js.map} +1 -1
  59. package/dist/{StoreClosedNotification-44JN2FZV.js → StoreClosedNotification-ZSDPBM3L.js} +16 -16
  60. package/dist/{StoreClosedNotification-44JN2FZV.js.map → StoreClosedNotification-ZSDPBM3L.js.map} +1 -1
  61. package/dist/{TestimonialsPage-KGCGTUJQ.js → TestimonialsPage-6LGQSJSQ.js} +3 -3
  62. package/dist/{TestimonialsPage-KGCGTUJQ.js.map → TestimonialsPage-6LGQSJSQ.js.map} +1 -1
  63. package/dist/ThankYouPage-ZI6NEGN3.js +187 -0
  64. package/dist/ThankYouPage-ZI6NEGN3.js.map +1 -0
  65. package/dist/{WalletPage-J3CX6MLS.js → WalletPage-R6G5BQAI.js} +16 -16
  66. package/dist/{WalletPage-J3CX6MLS.js.map → WalletPage-R6G5BQAI.js.map} +1 -1
  67. package/dist/{WebMcpTools-3MV53OMT.js → WebMcpTools-2NWIVDL2.js} +5 -5
  68. package/dist/{WebMcpTools-3MV53OMT.js.map → WebMcpTools-2NWIVDL2.js.map} +1 -1
  69. package/dist/{WishlistPage-HHX3OVOF.js → WishlistPage-CQ62GPLC.js} +17 -17
  70. package/dist/{WishlistPage-HHX3OVOF.js.map → WishlistPage-CQ62GPLC.js.map} +1 -1
  71. package/dist/ambient/salla-components.d.ts +42 -0
  72. package/dist/api/advertisement.js +2 -2
  73. package/dist/api/apps.js +2 -2
  74. package/dist/api/blog.js +3 -3
  75. package/dist/api/brands.js +3 -3
  76. package/dist/api/cart.js +3 -3
  77. package/dist/api/category.js +3 -3
  78. package/dist/api/client.js +1 -1
  79. package/dist/api/home.js +2 -2
  80. package/dist/api/loyalty.js +3 -3
  81. package/dist/api/menu.js +2 -2
  82. package/dist/api/notification.js +2 -2
  83. package/dist/api/order.js +3 -3
  84. package/dist/api/page.js +3 -3
  85. package/dist/api/product.js +3 -3
  86. package/dist/api/profile.js +1 -1
  87. package/dist/api/store.js +2 -2
  88. package/dist/api/translations.js +2 -2
  89. package/dist/api/user.js +2 -2
  90. package/dist/api/wallet.js +2 -2
  91. package/dist/api/wishlist.js +4 -4
  92. package/dist/{chunk-VNHYMLGK.js → chunk-23OJW6CK.js} +3 -3
  93. package/dist/{chunk-VNHYMLGK.js.map → chunk-23OJW6CK.js.map} +1 -1
  94. package/dist/{chunk-O6RZ6AWT.js → chunk-33327CFA.js} +4 -4
  95. package/dist/{chunk-O6RZ6AWT.js.map → chunk-33327CFA.js.map} +1 -1
  96. package/dist/{chunk-VDY3VY7S.js → chunk-3AIK4QGW.js} +3 -3
  97. package/dist/{chunk-VDY3VY7S.js.map → chunk-3AIK4QGW.js.map} +1 -1
  98. package/dist/{chunk-5EN3XZ32.js → chunk-3BDSQIYZ.js} +3 -3
  99. package/dist/{chunk-5EN3XZ32.js.map → chunk-3BDSQIYZ.js.map} +1 -1
  100. package/dist/{chunk-C6PNF2OT.js → chunk-3WA5RJGC.js} +3 -3
  101. package/dist/{chunk-C6PNF2OT.js.map → chunk-3WA5RJGC.js.map} +1 -1
  102. package/dist/{chunk-X6WDFQYL.js → chunk-4FFABE3P.js} +3 -3
  103. package/dist/{chunk-X6WDFQYL.js.map → chunk-4FFABE3P.js.map} +1 -1
  104. package/dist/{chunk-F7S2QA3D.js → chunk-5ABT7QLS.js} +7 -7
  105. package/dist/{chunk-F7S2QA3D.js.map → chunk-5ABT7QLS.js.map} +1 -1
  106. package/dist/chunk-5PMEGLR6.js +75 -0
  107. package/dist/chunk-5PMEGLR6.js.map +1 -0
  108. package/dist/{chunk-PCYZMJUC.js → chunk-6T4HGLQM.js} +3 -3
  109. package/dist/{chunk-PCYZMJUC.js.map → chunk-6T4HGLQM.js.map} +1 -1
  110. package/dist/{chunk-MVT5AF2A.js → chunk-6T55LXJL.js} +3 -2
  111. package/dist/chunk-6T55LXJL.js.map +1 -0
  112. package/dist/chunk-7R43CIG7.js +90 -0
  113. package/dist/chunk-7R43CIG7.js.map +1 -0
  114. package/dist/{chunk-3O6BB7SI.js → chunk-BAJBKIGI.js} +3 -3
  115. package/dist/{chunk-3O6BB7SI.js.map → chunk-BAJBKIGI.js.map} +1 -1
  116. package/dist/{chunk-C5P2C2NR.js → chunk-C7LAIXEO.js} +3 -3
  117. package/dist/{chunk-C5P2C2NR.js.map → chunk-C7LAIXEO.js.map} +1 -1
  118. package/dist/{chunk-JOHFXU4C.js → chunk-CAAIQPEN.js} +4 -4
  119. package/dist/{chunk-JOHFXU4C.js.map → chunk-CAAIQPEN.js.map} +1 -1
  120. package/dist/{chunk-QXWCIK6D.js → chunk-CNTXY27A.js} +4 -4
  121. package/dist/{chunk-QXWCIK6D.js.map → chunk-CNTXY27A.js.map} +1 -1
  122. package/dist/{chunk-YDRURQ2W.js → chunk-CUURFACL.js} +3 -3
  123. package/dist/{chunk-YDRURQ2W.js.map → chunk-CUURFACL.js.map} +1 -1
  124. package/dist/{chunk-2DUN6DZK.js → chunk-CXKA35FJ.js} +3 -3
  125. package/dist/{chunk-2DUN6DZK.js.map → chunk-CXKA35FJ.js.map} +1 -1
  126. package/dist/{chunk-K4YRFOFA.js → chunk-DQEJV5SR.js} +7 -7
  127. package/dist/{chunk-K4YRFOFA.js.map → chunk-DQEJV5SR.js.map} +1 -1
  128. package/dist/{chunk-Z4EQHB26.js → chunk-ELYKF67K.js} +5 -5
  129. package/dist/{chunk-Z4EQHB26.js.map → chunk-ELYKF67K.js.map} +1 -1
  130. package/dist/{chunk-T2O2IQJQ.js → chunk-F3QHKYS3.js} +4 -4
  131. package/dist/{chunk-T2O2IQJQ.js.map → chunk-F3QHKYS3.js.map} +1 -1
  132. package/dist/{chunk-A4Y5BVJN.js → chunk-GBJK6KKM.js} +3 -3
  133. package/dist/{chunk-A4Y5BVJN.js.map → chunk-GBJK6KKM.js.map} +1 -1
  134. package/dist/{chunk-BKSVKSAW.js → chunk-HPK6GB7G.js} +15 -15
  135. package/dist/{chunk-BKSVKSAW.js.map → chunk-HPK6GB7G.js.map} +1 -1
  136. package/dist/{chunk-CFG6PGUZ.js → chunk-IFKCPNDF.js} +4 -4
  137. package/dist/{chunk-CFG6PGUZ.js.map → chunk-IFKCPNDF.js.map} +1 -1
  138. package/dist/{chunk-HZWTDQVJ.js → chunk-JDCZWE7N.js} +5 -5
  139. package/dist/{chunk-HZWTDQVJ.js.map → chunk-JDCZWE7N.js.map} +1 -1
  140. package/dist/{chunk-7ZTSYUCJ.js → chunk-JZ54GDXO.js} +4 -4
  141. package/dist/{chunk-7ZTSYUCJ.js.map → chunk-JZ54GDXO.js.map} +1 -1
  142. package/dist/{chunk-TQQN5AE2.js → chunk-KUQQJTFA.js} +3 -3
  143. package/dist/{chunk-TQQN5AE2.js.map → chunk-KUQQJTFA.js.map} +1 -1
  144. package/dist/{chunk-YEBA44IV.js → chunk-LILNJBFU.js} +3 -3
  145. package/dist/{chunk-YEBA44IV.js.map → chunk-LILNJBFU.js.map} +1 -1
  146. package/dist/{chunk-DMGSEY7F.js → chunk-MA3R5QON.js} +3 -3
  147. package/dist/{chunk-DMGSEY7F.js.map → chunk-MA3R5QON.js.map} +1 -1
  148. package/dist/{chunk-VEVFVWF3.js → chunk-MJHYLDXL.js} +3 -3
  149. package/dist/{chunk-VEVFVWF3.js.map → chunk-MJHYLDXL.js.map} +1 -1
  150. package/dist/{chunk-AECYX56P.js → chunk-NRMAYV4G.js} +4 -4
  151. package/dist/{chunk-AECYX56P.js.map → chunk-NRMAYV4G.js.map} +1 -1
  152. package/dist/{chunk-PBT52UWY.js → chunk-NWQUPGB4.js} +4 -4
  153. package/dist/{chunk-PBT52UWY.js.map → chunk-NWQUPGB4.js.map} +1 -1
  154. package/dist/{chunk-VQO4TTPE.js → chunk-QOC7HUYN.js} +4 -4
  155. package/dist/{chunk-VQO4TTPE.js.map → chunk-QOC7HUYN.js.map} +1 -1
  156. package/dist/{chunk-7PPNAVBF.js → chunk-R72B5P4R.js} +4 -4
  157. package/dist/{chunk-7PPNAVBF.js.map → chunk-R72B5P4R.js.map} +1 -1
  158. package/dist/{chunk-BEYWTFOR.js → chunk-SCWUJ5PP.js} +3 -3
  159. package/dist/{chunk-BEYWTFOR.js.map → chunk-SCWUJ5PP.js.map} +1 -1
  160. package/dist/{chunk-DHKZCR6U.js → chunk-T55MRK24.js} +5 -5
  161. package/dist/{chunk-DHKZCR6U.js.map → chunk-T55MRK24.js.map} +1 -1
  162. package/dist/{chunk-ZSEECSDV.js → chunk-V6IKYNU6.js} +7 -7
  163. package/dist/{chunk-ZSEECSDV.js.map → chunk-V6IKYNU6.js.map} +1 -1
  164. package/dist/{chunk-FTH3XLIN.js → chunk-W2A5AWNA.js} +3 -3
  165. package/dist/{chunk-FTH3XLIN.js.map → chunk-W2A5AWNA.js.map} +1 -1
  166. package/dist/{chunk-FXW6H6J3.js → chunk-W3QKGF2O.js} +3 -3
  167. package/dist/{chunk-FXW6H6J3.js.map → chunk-W3QKGF2O.js.map} +1 -1
  168. package/dist/{chunk-EF3PLLLA.js → chunk-WH73HWTE.js} +7 -7
  169. package/dist/{chunk-EF3PLLLA.js.map → chunk-WH73HWTE.js.map} +1 -1
  170. package/dist/{chunk-3QOALQQJ.js → chunk-WPRJVK7K.js} +4 -4
  171. package/dist/{chunk-3QOALQQJ.js.map → chunk-WPRJVK7K.js.map} +1 -1
  172. package/dist/{chunk-B36NISD2.js → chunk-X5W7HZNX.js} +4 -4
  173. package/dist/{chunk-B36NISD2.js.map → chunk-X5W7HZNX.js.map} +1 -1
  174. package/dist/{chunk-3G4YCXOR.js → chunk-ZXEJ46OF.js} +87 -23
  175. package/dist/chunk-ZXEJ46OF.js.map +1 -0
  176. package/dist/components/cart/index.js +1 -1
  177. package/dist/components/common/index.js +1 -1
  178. package/dist/components/drawer/index.js +13 -13
  179. package/dist/components/home/index.js +18 -18
  180. package/dist/components/layout/index.js +4 -4
  181. package/dist/components/product/index.js +15 -15
  182. package/dist/components/store/index.js +14 -14
  183. package/dist/dev/editor/index.js +1 -1
  184. package/dist/dev/index.js +1 -1
  185. package/dist/{document-class-SWL4NCC6.js → document-class-B57F7JZW.js} +12 -11
  186. package/dist/{document-class-SWL4NCC6.js.map → document-class-B57F7JZW.js.map} +1 -1
  187. package/dist/hooks/index.js +13 -13
  188. package/dist/hooks/useGtm.js +13 -13
  189. package/dist/hooks/useMoney.js +13 -13
  190. package/dist/hooks/useStore.js +13 -13
  191. package/dist/hooks/useUser.js +3 -3
  192. package/dist/index.js +13 -13
  193. package/dist/{navigation-7V4CSVG5.js → navigation-N3WBAE74.js} +5 -5
  194. package/dist/{navigation-7V4CSVG5.js.map → navigation-N3WBAE74.js.map} +1 -1
  195. package/dist/{navigation-VMR4V27L.js → navigation-VJBIYPFD.js} +4 -4
  196. package/dist/{navigation-VMR4V27L.js.map → navigation-VJBIYPFD.js.map} +1 -1
  197. package/dist/{not-found-S33EUV2Q.js → not-found-KDDMHTAU.js} +16 -16
  198. package/dist/{not-found-S33EUV2Q.js.map → not-found-KDDMHTAU.js.map} +1 -1
  199. package/dist/providers/index.js +13 -13
  200. package/dist/routes/account/orders.js +4 -4
  201. package/dist/routes/account.js +13 -13
  202. package/dist/routes/blog.js +8 -8
  203. package/dist/routes/brands.js +4 -4
  204. package/dist/routes/cart.js +22 -22
  205. package/dist/routes/home.js +19 -19
  206. package/dist/routes/index.js +3 -3
  207. package/dist/routes/loyalty.js +5 -5
  208. package/dist/routes/page.js +4 -4
  209. package/dist/routes/product-listing/ProductListPage.d.ts.map +1 -1
  210. package/dist/routes/product-listing/useAppliedFilters.d.ts.map +1 -1
  211. package/dist/routes/product-listing.js +27 -86
  212. package/dist/routes/product-listing.js.map +1 -1
  213. package/dist/routes/product.js +18 -18
  214. package/dist/routes/seo-redirects.js +3 -3
  215. package/dist/routes/testimonials.js +2 -2
  216. package/dist/routes/thank-you/ThankYouPage.d.ts +2 -1
  217. package/dist/routes/thank-you/ThankYouPage.d.ts.map +1 -1
  218. package/dist/routes/thank-you/loader.d.ts +5 -1
  219. package/dist/routes/thank-you/loader.d.ts.map +1 -1
  220. package/dist/routes/thank-you/types.d.ts +23 -1
  221. package/dist/routes/thank-you/types.d.ts.map +1 -1
  222. package/dist/routes/thank-you.js +79 -15
  223. package/dist/routes/thank-you.js.map +1 -1
  224. package/dist/skeleton.js +19 -19
  225. package/dist/{store-lookup-D5C2LNXK.js → store-lookup-WBKOYMDU.js} +8 -8
  226. package/dist/{store-lookup-D5C2LNXK.js.map → store-lookup-WBKOYMDU.js.map} +1 -1
  227. package/dist/tanstack/router.d.ts.map +1 -1
  228. package/dist/tanstack.js +12 -11
  229. package/dist/tanstack.js.map +1 -1
  230. package/dist/types/hooks.d.ts +1 -0
  231. package/dist/types/hooks.d.ts.map +1 -1
  232. package/dist/types/hooks.js +1 -1
  233. package/dist/types/index.js +1 -1
  234. package/dist/types/salla-sdk.d.ts +4 -0
  235. package/dist/types/salla-sdk.d.ts.map +1 -1
  236. package/dist/utils/index.js +2 -2
  237. package/dist/utils/sdk-events.d.ts +32 -1
  238. package/dist/utils/sdk-events.d.ts.map +1 -1
  239. package/dist/vite/index.js +1 -0
  240. package/dist/vite/index.js.map +1 -1
  241. package/dist/vite/plugins/best-practices/hooks-registry.d.ts.map +1 -1
  242. package/package.json +1 -1
  243. package/tailwind/routes/product-listing/ProductListPage.tsx.txt +3 -1
  244. package/tailwind/routes/product-listing/useAppliedFilters.ts.txt +5 -1
  245. package/tailwind/routes/thank-you/ThankYouPage.tsx.txt +124 -209
  246. package/tailwind/routes/thank-you/index.tsx.txt +1 -1
  247. package/tailwind/routes/thank-you/loader.ts.txt +112 -14
  248. package/tailwind/routes/thank-you/types.ts.txt +24 -1
  249. package/dist/ThankYouPage-XWB4X236.js +0 -267
  250. package/dist/ThankYouPage-XWB4X236.js.map +0 -1
  251. package/dist/chunk-3G4YCXOR.js.map +0 -1
  252. package/dist/chunk-MVT5AF2A.js.map +0 -1
  253. package/dist/chunk-QBVXQHVJ.js +0 -40
  254. package/dist/chunk-QBVXQHVJ.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"hooks-registry.d.ts","sourceRoot":"","sources":["../../../../src/vite/plugins/best-practices/hooks-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,EAgN1C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,IAAI,CAOxE"}
1
+ {"version":3,"file":"hooks-registry.d.ts","sourceRoot":"","sources":["../../../../src/vite/plugins/best-practices/hooks-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,YAAY,EAAE,CAAC;CAC/B;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,EAiN1C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,IAAI,CAOxE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-theme-engine",
3
- "version": "1.0.146",
3
+ "version": "1.0.148",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -17,6 +17,7 @@ import type { ProductListLoaderData } from './types';
17
17
  import type { Brand } from '../brands/types';
18
18
  import type { Product } from '../../types';
19
19
  import { onSallaEvent } from '../../utils/sdk-helpers';
20
+ import { dispatchProductsFetched } from '../../utils/sdk-events';
20
21
 
21
22
  /** 3-col + 288px sidebar from md; 3-col of the full container below md. */
22
23
  const FILTERED_PRODUCT_IMAGE_SIZES = '(min-width: 768px) 25vw, 33vw';
@@ -146,9 +147,10 @@ export function ProductListPage({
146
147
  });
147
148
 
148
149
  nextCursorRef.current = result.next;
150
+ dispatchProductsFetched(result, source);
149
151
 
150
152
  return result;
151
- }, [source.type, source.value, selectedSort, appliedFilters]);
153
+ }, [source, selectedSort, appliedFilters]);
152
154
 
153
155
  return (
154
156
  <div
@@ -4,6 +4,7 @@ import type { ProductListFilters } from '../../api/product';
4
4
  import type { Product } from '../../types';
5
5
  import type { ProductListLoaderData } from './types';
6
6
  import { onSallaEvent } from '../../utils/sdk-helpers';
7
+ import { dispatchProductsFetched } from '../../utils/sdk-events';
7
8
 
8
9
  type Source = ProductListLoaderData['source'];
9
10
  type Node = Record<string, unknown>;
@@ -110,7 +111,10 @@ export function useAppliedFilters(
110
111
  filters,
111
112
  signal: controller.signal,
112
113
  })
113
- .then((res) => setResult({ key, page: { items: res.items, next: res.next } }))
114
+ .then((res) => {
115
+ setResult({ key, page: { items: res.items, next: res.next } });
116
+ dispatchProductsFetched(res, source);
117
+ })
114
118
  .catch(() => {
115
119
  // Aborted by a newer selection (its own effect run owns the state now), or failed.
116
120
  if (!controller.signal.aborted) setFailedKey(key);
@@ -1,240 +1,155 @@
1
- import { useState, useEffect } from 'react';
2
- import { useCopyToClipboard } from '@uidotdev/usehooks';
3
- import { SallaButton } from '@salla.sa/twilight-components-react/button';
4
- import { SallaNextOrderCoupon } from '@salla.sa/twilight-components-react/next-order-coupon';
5
- import { SallaOrderBranch } from '@salla.sa/twilight-components-react/order-branch';
6
- import { Link } from '../../components/common';
7
- import { HookSlot, usePageConfig } from '../../hooks';
1
+ import { useMemo } from 'react';
2
+ import { HookSlot, useIsClient, usePageConfig } from '../../hooks';
8
3
  import type { ThankYouPageProps } from './types';
9
4
  import { useTwilight } from '../../providers/twilight-context';
10
5
  import { useTranslation } from '../../providers/I18nProvider';
11
- import confettiImage from './confetti.svg';
12
- import { onSallaEvent } from '../../utils/sdk-helpers';
6
+ import { stripUnsafeHtml } from '../../utils/sanitize';
13
7
 
14
8
  const EMPTY_MESSAGES: NonNullable<ThankYouPageProps['messages']> = [];
9
+ const ICON_FONT_URL = 'https://cdn.salla.network/fonts/hugeicons-font.css';
15
10
 
11
+ /** The order confirmation page, built like Twig Raed's from the Twilight thank-you components. */
16
12
  export function ThankYouPage({
17
13
  page,
18
14
  order,
19
15
  thank_you_title,
20
16
  messages = EMPTY_MESSAGES,
17
+ instructions,
18
+ items,
19
+ is_pickable,
20
+ created_at,
21
+ loyalty_points = 0,
22
+ loyalty_url,
23
+ cashback,
24
+ wallet_url,
21
25
  }: ThankYouPageProps) {
22
26
  const { store } = useTwilight();
23
27
  const { t } = useTranslation();
24
- // `<salla-order-branch>` reads the order id from `salla.config.page.id` (see OrderSinglePage).
28
+ // The order components read the order id from `salla.config.page.id`.
25
29
  usePageConfig(page);
26
- const title =
30
+ // The components rewrite their light DOM once the SDK loads, which can come before hydration.
31
+ const isClient = useIsClient();
32
+ const heading =
27
33
  thank_you_title ?? t('pages.thank_you.hero_title', 'Thank you for shopping with us! 😊');
28
- const [invoiceSent, setInvoiceSent] = useState(order?.email_sent ?? false);
29
- const [invoiceMessage, setInvoiceMessage] = useState<string | null>(null);
30
- const [, copyToClipboard] = useCopyToClipboard();
31
-
32
- // Listen for invoice sent event (matches thankyou.js)
33
- useEffect(() => {
34
- const handleInvoiceSent = (res: { data?: { message?: string } }) => {
35
- setInvoiceMessage(
36
- res.data?.message || t('pages.thank_you.invoice_sent_success', 'Invoice sent successfully')
37
- );
38
- setInvoiceSent(true);
39
- };
40
- const listener = handleInvoiceSent as (...args: unknown[]) => void;
41
-
42
- return onSallaEvent('order::invoice.sent', listener);
43
- }, [t]);
34
+ const currency = order?.currency;
35
+ const itemsJson = useMemo(() => JSON.stringify(items ?? []), [items]);
36
+ const discountsJson = useMemo(() => {
37
+ const discounts = order?.amounts.discounts ?? [];
38
+ return discounts.length
39
+ ? JSON.stringify(discounts.map(({ title, discount }) => ({ name: title, discount })))
40
+ : undefined;
41
+ }, [order]);
42
+ const amounts = order?.amounts;
43
+ const showRewards = loyalty_points > 0 || !!cashback;
44
44
 
45
45
  return (
46
46
  <>
47
- <HookSlot name="thank-you:start" />
48
-
49
- <div className="h-52 -mb-52 w-full bg-primary rtl:right-0 ltr:left-0 relative -z-1">
50
- <svg
51
- className="text-primary absolute top-full"
52
- xmlns="http://www.w3.org/2000/svg"
53
- viewBox="0 0 1440 320"
54
- >
55
- <path
56
- className="fill-current"
57
- fillOpacity="1"
58
- d="M0,96L120,112C240,128,480,160,720,165.3C960,171,1200,149,1320,138.7L1440,128L1440,0L1320,0C1200,0,960,0,720,0C480,0,240,0,120,0L0,0Z"
59
- ></path>
60
- </svg>
61
- </div>
62
-
63
- <div className="container mb-20">
64
- <nav className="w-full py-5">
65
- <ol className="list-reset flex items-center text-sm text-primary-reverse">
66
- <li>
67
- <Link to="/" className="fix-align text-primary-reverse">
68
- {t('common.titles.home', 'Home')}
69
- </Link>
70
- </li>
71
- <li>
72
- <i className="sicon-keyboard_arrow_left mx-2"></i>
73
- </li>
74
- <li>
75
- <span className="fix-align">{title}</span>
76
- </li>
77
- </ol>
78
- </nav>
79
-
80
- <div className="bg-white p-4 md:p-8 rounded-md mb-6 md:mb-8">
81
- <div className="flex flex-col items-center pt-16 pb-10">
82
- <img src={confettiImage} alt={title} className="size-[140px] mb-8" />
83
- <h1 className="font-bold text-lg mb-2.5">{title}</h1>
84
- <p className="text-gray-500 max-w-xs text-center text-sm leading-6 mb-2.5">
85
- {t(
86
- 'pages.thank_you.description',
87
- 'Your order has been received and will be reviewed and confirmed shortly.'
88
- )}
89
- </p>
90
- {order && (
91
- <>
92
- <p className="text-gray-500 max-w-xs text-center text-sm leading-6 mb-6">
93
- {t('pages.thank_you.order_id_label', 'Order ID')}{' '}
94
- <SallaButton
95
- className="relative"
96
- onClick={() => copyToClipboard(String(order.reference_id))}
97
- color="dark"
98
- shape="link"
99
- >
100
- <span>#{order.reference_id}</span>
101
- <i className="copy-icon sicon-swap-stroke pointer-events-none rtl:mr-1 ltr:ml-1"></i>
102
- </SallaButton>
103
- </p>
104
- <Link
105
- to={`/account/orders/${order.id}`}
106
- className="bg-primary text-white text-sm font-bold h-10 px-4 rounded-md flex items-center justify-center gap-1.5"
107
- >
108
- <i className="sicon-newspaper rtl:ml-1 ltr:mr-1"></i>
109
- {t('pages.thank_you.view_order_details', 'View Order Details')}
110
- </Link>
111
- </>
112
- )}
113
- </div>
114
-
115
- {(order as { instructions?: string } | undefined)?.instructions && (
116
- <article
117
- className="article article--main article--small text-center"
118
- dangerouslySetInnerHTML={{
119
- __html: (order as { instructions?: string }).instructions ?? '',
120
- }}
121
- />
122
- )}
47
+ <link rel="stylesheet" href={ICON_FONT_URL} />
123
48
 
124
- {messages.map((message) => (
125
- <div
126
- key={message}
127
- className="flex flex-col items-center pt-1 pb-10 justify-start rtl:space-x-reverse space-x-2"
128
- >
129
- <span className="font-bold">{message}</span>
130
- </div>
131
- ))}
132
-
133
- <HookSlot name="thank-you:items.start" />
134
- <HookSlot name="thank-you:items.end" />
135
- </div>
136
-
137
- {/* Next-order coupon and pickup branch — each renders nothing when it doesn't apply */}
138
- <SallaNextOrderCoupon />
139
- <SallaOrderBranch />
49
+ <HookSlot name="thank-you:start" />
140
50
 
141
- <div className="lg:flex rtl:space-x-reverse lg:space-x-8">
142
- {invoiceSent ? (
143
- <div className="duration-500 hover:shadow-default flex-1 bg-white p-8 rounded-md mb-6 md:mb-10 flex flex-col items-center justify-center">
144
- <div className="bg-gray-100 rounded-icon w-12 h-12 mb-2.5">
145
- <i className="sicon-newspaper-alt text-xl"></i>
146
- </div>
147
- <p className="text-sm mb-2.5">
148
- {t('pages.thank_you.email_sent_to', 'Email sent to')}
149
- </p>
150
- <b className="text-sm">{order?.customer?.email}</b>
151
- {invoiceMessage && <p className="text-sm text-green-600 mt-2">{invoiceMessage}</p>}
152
- </div>
153
- ) : (
154
- <div
155
- id="invoice-form"
156
- className={invoiceMessage ? 'thankyou-block sent' : 'thankyou-block'}
157
- >
158
- {invoiceMessage ? (
159
- <div className="text-center">
160
- <div className="bg-gray-100 rounded-icon w-12 h-12 mb-2.5 mx-auto">
161
- <i className="sicon-newspaper-alt text-xl"></i>
162
- </div>
163
- <p className="text-sm" dangerouslySetInnerHTML={{ __html: invoiceMessage }} />
164
- </div>
165
- ) : (
166
- <>
167
- <div className="bg-gray-100 rounded-icon w-12 h-12 mb-2.5">
168
- <i className="sicon-newspaper-alt text-xl"></i>
169
- </div>
170
- <p className="text-sm mb-2.5">
171
- {t('pages.thank_you.resend_invoice', 'Resend invoice email')}
172
- </p>
173
- <form
174
- onSubmit={(e) => {
175
- e.preventDefault();
176
- window.salla?.form.onSubmit('order.sendInvoice', e);
177
- }}
178
- >
179
- <div className="flex max-w-3xl w-full">
180
- <input
181
- type="email"
182
- className="form-input rtl:rounded-l-none ltr:rounded-r-none rtl:border-l-0 ltr:border-r-0 !w-[160px] sm:!w-[220px]"
183
- placeholder="your@email.com"
184
- required
185
- name="email"
186
- />
187
- <SallaButton
188
- type="submit"
189
- loaderPosition="center"
190
- className="rtl:rounded-r-none ltr:rounded-l-none lg:w-24 h-10"
191
- >
192
- <span className="btn__text">{t('pages.thank_you.send', 'Send')}</span>
193
- </SallaButton>
194
- </div>
195
- </form>
196
- </>
51
+ <div className="container">
52
+ {isClient && (
53
+ <salla-thank-you-page className="thank-you-content">
54
+ <div slot="main">
55
+ <salla-thank-you-header
56
+ heading={heading}
57
+ subtitle={t('pages.thank_you.order_received', 'Your order has been received')}
58
+ store-logo={store.logo || ''}
59
+ store-name={store.name}
60
+ reference-id={order ? String(order.reference_id) : undefined}
61
+ created-at={created_at}
62
+ >
63
+ {instructions && (
64
+ <article className="article article--main article--small text-center">
65
+ <p
66
+ // nosemgrep: the store's own order message, with unsafe markup stripped
67
+ dangerouslySetInnerHTML={{ __html: stripUnsafeHtml(instructions) }}
68
+ />
69
+ </article>
70
+ )}
71
+ {messages.map((message) => (
72
+ <span key={message} className="font-bold">
73
+ {message}
74
+ </span>
75
+ ))}
76
+ </salla-thank-you-header>
77
+
78
+ <HookSlot name="thank-you:items.start" />
79
+ {order &&
80
+ (is_pickable ? (
81
+ <salla-order-branch
82
+ data-testid="store-thankyou-branch"
83
+ items={itemsJson}
84
+ currency={currency}
85
+ sticky-cta
86
+ />
87
+ ) : (
88
+ <salla-order-shipments
89
+ data-testid="store-thankyou-shipments"
90
+ order-id={String(order.id)}
91
+ items={itemsJson}
92
+ currency={currency}
93
+ sticky-cta
94
+ />
95
+ ))}
96
+ <HookSlot name="thank-you:items.end" />
97
+
98
+ {order && amounts && (
99
+ <salla-order-payment
100
+ data-testid="store-thankyou-payment"
101
+ payment-method={order.payment?.method}
102
+ currency={currency}
103
+ payment-logo={
104
+ order.payment?.method
105
+ ? `https://cdn.salla.network/images/payment/${order.payment.method}_mini.png`
106
+ : undefined
107
+ }
108
+ sub-total={amounts.sub_total.amount}
109
+ total={amounts.total.amount}
110
+ tax-amount={amounts.tax?.amount.amount}
111
+ shipping-cost={amounts.shipping_cost?.amount}
112
+ cod-cost={amounts.cash_on_delivery?.amount}
113
+ discounts={discountsJson}
114
+ invoice-url={order.urls.print}
115
+ />
197
116
  )}
198
117
  </div>
199
- )}
200
118
 
201
- <div className="thankyou-block">
202
- <div className="bg-gray-100 rounded-icon w-12 h-12 mb-2.5">
203
- <i className="sicon-mail-letter text-xl"></i>
204
- </div>
205
- <p className="text-sm mb-2.5">{t('pages.thank_you.support', 'Support')}</p>
119
+ <HookSlot name="thank-you:payment.end" />
120
+
121
+ {showRewards && (
122
+ <salla-order-rewards
123
+ data-testid="store-thankyou-rewards"
124
+ {...(loyalty_points > 0
125
+ ? { 'loyalty-points': loyalty_points, 'loyalty-url': loyalty_url }
126
+ : {})}
127
+ {...(cashback
128
+ ? {
129
+ 'cashback-amount': cashback.amount,
130
+ currency: cashback.currency,
131
+ 'cashback-url': wallet_url,
132
+ }
133
+ : {})}
134
+ />
135
+ )}
206
136
 
207
- <div className="flex rtl:space-x-reverse space-x-6">
208
- {store.contacts.mobile && (
209
- <div className="text-sm unicode flex items-center">
210
- <i className="sicon-phone"></i>
211
- <a
212
- href={`tel:${store.contacts.mobile}`}
213
- className="hover:text-primary transition"
214
- >
215
- <b className="unicode mx-1.5">{store.contacts.mobile}</b>
216
- </a>
217
- </div>
218
- )}
137
+ <salla-next-order-coupon data-testid="store-thankyou-coupon" />
219
138
 
220
- {store.contacts.whatsapp && (
221
- <div className="text-sm unicode flex items-center">
222
- <i className="sicon-whatsapp"></i>
223
- <a
224
- href={`https://wa.me/${store.contacts.whatsapp.replace(/[\s+-]/g, '')}`}
225
- className="hover:text-primary transition"
226
- target="_blank"
227
- rel="noopener noreferrer"
228
- >
229
- <b className="unicode mx-1.5">{store.contacts.whatsapp}</b>
230
- </a>
231
- </div>
139
+ <salla-contacts
140
+ data-testid="store-thankyou-contacts"
141
+ introduction={t(
142
+ 'pages.thank_you.contact_us',
143
+ 'Got a question? We are happy to hear from you'
232
144
  )}
233
- </div>
234
- </div>
235
- </div>
145
+ hide-title
146
+ horizontal
147
+ icons-only
148
+ />
236
149
 
237
- <HookSlot name="thank-you:end" />
150
+ <HookSlot name="thank-you:end" />
151
+ </salla-thank-you-page>
152
+ )}
238
153
  </div>
239
154
  </>
240
155
  );
@@ -23,7 +23,7 @@ async function loader(
23
23
  ctx: { params: ThankYouLoaderParams }
24
24
  ) => Promise<Record<string, unknown>> | Record<string, unknown>
25
25
  ): Promise<ThankYouPageProps> {
26
- const data = await thankYouLoader({ params: ctx.params });
26
+ const data = await thankYouLoader({ params: ctx.params, locale: ctx.locale });
27
27
 
28
28
  if (extend) {
29
29
  const extra = await extend(data, ctx);
@@ -1,30 +1,119 @@
1
- import type { ThankYouPageProps, ThankYouLoaderParams } from './types';
1
+ import type { ThankYouPageProps, ThankYouLoaderParams, ThankYouLineItem } from './types';
2
2
  import type { Order } from '../account/types';
3
- import { order } from '../../api/order';
3
+ import type { PointBalanceResponse } from '../loyalty/types';
4
+ import type { TransactionItem } from '../../api/wallet';
5
+ import type { StoreOrderInstruction } from '../../types';
6
+ import { api, getAuthToken } from '../../api/client';
7
+ import { order, type TwilightOrder } from '../../api/order';
4
8
  import { getTwilightContext } from '../../twilight/context';
9
+ import { storePageUrl } from '../../utils/baseHead';
5
10
  import { RouteId } from '../../router/route-ids';
6
11
 
12
+ const INSTRUCTION_BY_STATUS: Record<string, keyof StoreOrderInstruction> = {
13
+ payment_pending: 'order_instructions_payment_waiting',
14
+ under_review: 'order_instructions_under_review',
15
+ completed: 'order_instructions_completed',
16
+ };
17
+
18
+ async function orderLoyaltyPoints(): Promise<PointBalanceResponse['data']> {
19
+ const response = await api.get('balance/points').json<PointBalanceResponse>();
20
+ return response.data ?? [];
21
+ }
22
+
23
+ // A plain array today; `wallet.list` expects the paginated object, so accept both.
24
+ async function walletTransactions(): Promise<TransactionItem[]> {
25
+ const response = await api
26
+ .get('balance/wallet?page=1&per_page=20')
27
+ .json<{ data?: { transactions?: TransactionItem[] | { data?: TransactionItem[] } } }>();
28
+ const transactions = response.data?.transactions;
29
+ return Array.isArray(transactions) ? transactions : (transactions?.data ?? []);
30
+ }
31
+
32
+ function offsetMinutes(timeZone: string, at: number): number {
33
+ const name = new Intl.DateTimeFormat('en-US', { timeZone, timeZoneName: 'longOffset' })
34
+ .formatToParts(at)
35
+ .find((part) => part.type === 'timeZoneName')?.value;
36
+ const [, sign, hours, minutes] = name?.match(/([+-])(\d{2}):(\d{2})/) ?? [];
37
+ return sign ? (sign === '-' ? -1 : 1) * (Number(hours) * 60 + Number(minutes)) : 0;
38
+ }
39
+
40
+ /** `2026-11-03 14:00:42.000000` in `Asia/Riyadh` -> `2026-11-03T14:00:42+03:00`. */
41
+ export function orderCreatedAtIso(createdAt?: Order['created_at']): string | undefined {
42
+ if (!createdAt?.date) return undefined;
43
+ const [day, time = '00:00:00'] = createdAt.date.split(' ');
44
+ const local = `${day}T${time.slice(0, 8)}`;
45
+ try {
46
+ const asUtc = Date.parse(`${local}Z`);
47
+ // The local clock read as UTC can fall on the other side of a DST change; look again.
48
+ const offset = offsetMinutes(
49
+ createdAt.timezone,
50
+ asUtc - offsetMinutes(createdAt.timezone, asUtc) * 60_000
51
+ );
52
+ const abs = Math.abs(offset);
53
+ const hhmm = `${String(Math.floor(abs / 60)).padStart(2, '0')}:${String(abs % 60).padStart(2, '0')}`;
54
+ return `${local}${offset < 0 ? '-' : '+'}${hhmm}`;
55
+ } catch {
56
+ return local;
57
+ }
58
+ }
59
+
7
60
  export async function thankYouLoader({
8
61
  params,
62
+ locale,
9
63
  }: {
10
64
  params: ThankYouLoaderParams;
65
+ locale?: string;
11
66
  }): Promise<ThankYouPageProps> {
12
67
  const orderId = params.orderId;
68
+ const { i18n, settings } = getTwilightContext();
69
+ const store = settings?.store;
70
+ const signedIn = !!getAuthToken();
71
+ const loyaltyEnabled = signedIn && !!store?.features?.includes('loyalty-system');
13
72
 
14
- // orders/{id} needs a customer token that guest checkout / tokenless SSR lacks (400
15
- // token_not_provided). Don't let that 500 the page — render whatever resolves.
16
- // ponytail: guest order detail needs checkout/thank-you to return the order; source it
17
- // here once that payload is confirmed on a correctly store-bound worker.
18
- const [orderResult, thankYouResult] = await Promise.allSettled([
73
+ // Guests have no token for orders/{id}; render whatever resolves.
74
+ const [orderResult, componentsResult, pointsResult, walletResult] = await Promise.allSettled([
19
75
  order.find(orderId),
20
- order.thankYou(orderId),
76
+ order.findForComponents(orderId),
77
+ loyaltyEnabled ? orderLoyaltyPoints() : Promise.resolve([]),
78
+ signedIn ? walletTransactions() : Promise.resolve([]),
21
79
  ]);
22
80
 
23
81
  const orderData: Order | undefined =
24
82
  orderResult.status === 'fulfilled' ? orderResult.value.order : undefined;
25
- const thankYouData = thankYouResult.status === 'fulfilled' ? thankYouResult.value : undefined;
83
+ const componentsOrder: TwilightOrder | undefined =
84
+ componentsResult.status === 'fulfilled' ? componentsResult.value : undefined;
85
+ // Points and wallet entries name the order by its reference number, not its id.
86
+ const isThisOrder = (id: number | string | null | undefined) =>
87
+ !!orderData && Number(id) === Number(orderData.reference_id);
88
+
89
+ const loyaltyPoints =
90
+ pointsResult.status === 'fulfilled'
91
+ ? (pointsResult.value.find(
92
+ (entry) => entry.key === 'BUY_FROM_STORE' && isThisOrder(entry.order_id)
93
+ )?.amount ?? 0)
94
+ : 0;
95
+ const cashbackAmount =
96
+ walletResult.status === 'fulfilled'
97
+ ? walletResult.value
98
+ .filter((entry) => entry.action_type === 'cashback' && isThisOrder(entry.order_id))
99
+ .reduce((sum, entry) => sum + Number(entry.amount), 0)
100
+ : 0;
101
+
102
+ const items: ThankYouLineItem[] | undefined = orderData?.items.map((item, index) => ({
103
+ id: item.id,
104
+ name: item.name,
105
+ image: item.thumbnail ?? item.product_thumbnail ?? item.image,
106
+ quantity: item.quantity,
107
+ price: item.amounts.amount,
108
+ url: componentsOrder?.items[index]?.product?.url,
109
+ }));
110
+
111
+ const instructionKey = orderData
112
+ ? INSTRUCTION_BY_STATUS[orderData.status?.slug ?? '']
113
+ : undefined;
114
+ const instruction = instructionKey ? store?.order_instruction?.[instructionKey] : undefined;
115
+ const storeUrl = (path: string) => storePageUrl(settings, locale ? `/${locale}${path}` : path);
26
116
 
27
- const i18n = getTwilightContext().i18n;
28
117
  return {
29
118
  page: {
30
119
  slug: RouteId.THANK_YOU,
@@ -32,9 +121,18 @@ export async function thankYouLoader({
32
121
  title: i18n.t('common.titles.thank_you') || 'Thank You',
33
122
  },
34
123
  order: orderData,
35
- thank_you_title: thankYouData?.thank_you_title,
36
- messages: thankYouData?.messages ?? [],
37
- share_message: thankYouData?.share_message,
38
- short_share_message: thankYouData?.short_share_message,
124
+ thank_you_title: store?.order_instruction?.thank_title || undefined,
125
+ messages: [],
126
+ instructions: instruction || undefined,
127
+ items,
128
+ is_pickable: !!(componentsOrder as { is_pickable?: boolean } | undefined)?.is_pickable,
129
+ created_at: orderCreatedAtIso(orderData?.created_at),
130
+ loyalty_points: loyaltyPoints,
131
+ loyalty_url: storeUrl('/loyalty'),
132
+ cashback:
133
+ cashbackAmount > 0 && orderData
134
+ ? { amount: cashbackAmount, currency: orderData.currency }
135
+ : undefined,
136
+ wallet_url: storeUrl('/wallet'),
39
137
  };
40
138
  }
@@ -1,10 +1,20 @@
1
- import type { Page } from '../../types';
1
+ import type { Money, Page } from '../../types';
2
2
  import type { Order } from '../account/types';
3
3
 
4
4
  export interface ThankYouLoaderParams {
5
5
  orderId: string;
6
6
  }
7
7
 
8
+ /** An order line in the shape the thank-you web components read. */
9
+ export interface ThankYouLineItem {
10
+ id?: number;
11
+ name: string;
12
+ image?: string;
13
+ quantity: number;
14
+ price?: Money;
15
+ url?: string;
16
+ }
17
+
8
18
  export interface ThankYouPageProps {
9
19
  page: Page;
10
20
  /** Absent when the authenticated `orders/{id}` fetch fails (e.g. guest checkout / no token). */
@@ -13,4 +23,17 @@ export interface ThankYouPageProps {
13
23
  share_message?: string;
14
24
  short_share_message?: string;
15
25
  messages?: string[];
26
+ /** The merchant's message for the order's status (HTML). */
27
+ instructions?: string;
28
+ items?: ThankYouLineItem[];
29
+ /** Pickup orders show the branch card instead of the shipments card. */
30
+ is_pickable?: boolean;
31
+ /** Order time as ISO 8601 with the store's offset. */
32
+ created_at?: string;
33
+ /** Loyalty points this order earns; 0 when the store has no loyalty program. */
34
+ loyalty_points?: number;
35
+ loyalty_url?: string;
36
+ /** Cashback already credited to the customer's wallet for this order. */
37
+ cashback?: Money;
38
+ wallet_url?: string;
16
39
  }