@salla.sa/twilight-components 2.14.500 → 2.14.502

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 (349) hide show
  1. package/dist/cjs/catalog-recommendations-Bzt0HRy8.js +94 -0
  2. package/dist/cjs/{filepond-B9PtMjXt.js → filepond-CIptScDL.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-poster-CMd-UUZx.js → filepond-plugin-file-poster-DwHNuiWd.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-size-DpJalosf.js → filepond-plugin-file-validate-size-BMLUB-u0.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-file-validate-type-CZjeYI0w.js → filepond-plugin-file-validate-type-DiRunNiR.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-edit-Bl6fwgrn.js → filepond-plugin-image-edit-DujWvbF5.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-exif-orientation-BeQ8iCyg.js → filepond-plugin-image-exif-orientation-CzdpRTlH.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-image-preview-BkGKXzOB.js → filepond-plugin-image-preview-CpEEysug.js} +1 -1
  9. package/dist/cjs/{functions-UaOjMOb2.js → functions-DL46a-BT.js} +1 -1
  10. package/dist/cjs/{index-Cd5xdrCT.js → index-CeCWRg4V.js} +6 -2
  11. package/dist/cjs/{index-CQPk27Eg.js → index-D7i3cgiE.js} +1 -1
  12. package/dist/cjs/loader.cjs.js +2 -2
  13. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +70 -30
  16. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-basket-gap.cjs.entry.js +269 -0
  22. package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
  23. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-count-down_2.cjs.entry.js +4 -3
  34. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  48. package/dist/cjs/salla-loyalty-exchange-product-card_5.cjs.entry.js +3 -3
  49. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  50. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  51. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  55. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  56. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  106. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  107. package/dist/cjs/{tracked-promise-DwUVHl1m.js → tracked-promise-DQhIwhjv.js} +1 -1
  108. package/dist/cjs/twilight.cjs.js +2 -2
  109. package/dist/cjs/{vanilla-picker-BTiOI13l.js → vanilla-picker-DlMSPnXD.js} +1 -1
  110. package/dist/collection/collection-manifest.json +1 -0
  111. package/dist/collection/components/salla-basket-gap/salla-basket-gap.css +3 -0
  112. package/dist/collection/components/salla-basket-gap/salla-basket-gap.js +306 -0
  113. package/dist/collection/components/salla-bought-together/salla-bought-together.js +5 -17
  114. package/dist/collection/components/salla-count-down/salla-count-down.js +3 -2
  115. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +87 -7
  116. package/dist/collection/shared/catalog-recommendations.js +89 -0
  117. package/dist/components/catalog-recommendations.js +91 -0
  118. package/dist/components/index.js +2 -2
  119. package/dist/components/salla-basket-gap.d.ts +11 -0
  120. package/dist/components/salla-basket-gap.js +402 -0
  121. package/dist/components/salla-bought-together.js +5 -17
  122. package/dist/components/salla-count-down2.js +3 -2
  123. package/dist/components/salla-quick-buy2.js +66 -12
  124. package/dist/esm/catalog-recommendations-9fzJJ_Ox.js +91 -0
  125. package/dist/esm/{filepond-DjtqIoeD.js → filepond--jRYda4S.js} +1 -1
  126. package/dist/esm/{filepond-plugin-file-poster-CFxoEHLP.js → filepond-plugin-file-poster-CckDj7tB.js} +1 -1
  127. package/dist/esm/{filepond-plugin-file-validate-size-BnBRYL0y.js → filepond-plugin-file-validate-size-9b6v_l6Z.js} +1 -1
  128. package/dist/esm/{filepond-plugin-file-validate-type-Dr5ofT9v.js → filepond-plugin-file-validate-type-CjGNB5Pv.js} +1 -1
  129. package/dist/esm/{filepond-plugin-image-edit-DyMeCzTZ.js → filepond-plugin-image-edit-UIthhs_A.js} +1 -1
  130. package/dist/esm/{filepond-plugin-image-exif-orientation-ngtve06j.js → filepond-plugin-image-exif-orientation-DPcDqfwl.js} +1 -1
  131. package/dist/esm/{filepond-plugin-image-preview-aqxBqAYf.js → filepond-plugin-image-preview-BWlnovlW.js} +1 -1
  132. package/dist/esm/{functions-Drikk4uf.js → functions-Vnk4zyHS.js} +1 -1
  133. package/dist/esm/{index-DuoSRdS5.js → index-BOjfFBGe.js} +6 -2
  134. package/dist/esm/{index-CaZkz-p0.js → index-D8XjJYaY.js} +1 -1
  135. package/dist/esm/loader.js +3 -3
  136. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  137. package/dist/esm/salla-accordion_6.entry.js +1 -1
  138. package/dist/esm/salla-add-product-button_5.entry.js +70 -30
  139. package/dist/esm/salla-advertisement.entry.js +1 -1
  140. package/dist/esm/salla-alert_2.entry.js +1 -1
  141. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  142. package/dist/esm/salla-apps-icons.entry.js +1 -1
  143. package/dist/esm/salla-badge.entry.js +1 -1
  144. package/dist/esm/salla-basket-gap.entry.js +267 -0
  145. package/dist/esm/salla-booking-field_7.entry.js +10 -10
  146. package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
  147. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  148. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  149. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  150. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  151. package/dist/esm/salla-comment-factors.entry.js +1 -1
  152. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  153. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  154. package/dist/esm/salla-contacts.entry.js +1 -1
  155. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  156. package/dist/esm/salla-count-down_2.entry.js +4 -3
  157. package/dist/esm/salla-custom-fields.entry.js +1 -1
  158. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  159. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  160. package/dist/esm/salla-filters-widget.entry.js +1 -1
  161. package/dist/esm/salla-filters.entry.js +1 -1
  162. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  163. package/dist/esm/salla-gifting.entry.js +1 -1
  164. package/dist/esm/salla-hook.entry.js +1 -1
  165. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  166. package/dist/esm/salla-installment.entry.js +1 -1
  167. package/dist/esm/salla-list-tile.entry.js +1 -1
  168. package/dist/esm/salla-localization-modal.entry.js +1 -1
  169. package/dist/esm/salla-login-modal.entry.js +1 -1
  170. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  171. package/dist/esm/salla-loyalty-exchange-product-card_5.entry.js +3 -3
  172. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  173. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  174. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  175. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  176. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  177. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  178. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  179. package/dist/esm/salla-loyalty.entry.js +1 -1
  180. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  181. package/dist/esm/salla-map_2.entry.js +1 -1
  182. package/dist/esm/salla-menu.entry.js +1 -1
  183. package/dist/esm/salla-metadata.entry.js +1 -1
  184. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  185. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  186. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  187. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  188. package/dist/esm/salla-notification-item.entry.js +1 -1
  189. package/dist/esm/salla-notifications.entry.js +1 -1
  190. package/dist/esm/salla-offer-modal.entry.js +1 -1
  191. package/dist/esm/salla-offer.entry.js +1 -1
  192. package/dist/esm/salla-order-branch.entry.js +1 -1
  193. package/dist/esm/salla-order-cancel.entry.js +1 -1
  194. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  195. package/dist/esm/salla-order-details-options.entry.js +1 -1
  196. package/dist/esm/salla-order-details.entry.js +1 -1
  197. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  198. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  199. package/dist/esm/salla-order-edit.entry.js +1 -1
  200. package/dist/esm/salla-order-summary.entry.js +1 -1
  201. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  202. package/dist/esm/salla-orders.entry.js +1 -1
  203. package/dist/esm/salla-payments.entry.js +1 -1
  204. package/dist/esm/salla-placeholder.entry.js +1 -1
  205. package/dist/esm/salla-price-range.entry.js +1 -1
  206. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  207. package/dist/esm/salla-product-card_2.entry.js +1 -1
  208. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  209. package/dist/esm/salla-products-list.entry.js +1 -1
  210. package/dist/esm/salla-quick-order.entry.js +1 -1
  211. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  212. package/dist/esm/salla-rating-modal.entry.js +1 -1
  213. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  214. package/dist/esm/salla-scopes.entry.js +1 -1
  215. package/dist/esm/salla-search.entry.js +1 -1
  216. package/dist/esm/salla-skeleton.entry.js +1 -1
  217. package/dist/esm/salla-slider.entry.js +1 -1
  218. package/dist/esm/salla-social-share.entry.js +1 -1
  219. package/dist/esm/salla-social.entry.js +1 -1
  220. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  221. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  222. package/dist/esm/salla-tooltip.entry.js +1 -1
  223. package/dist/esm/salla-trust-badges.entry.js +1 -1
  224. package/dist/esm/salla-user-menu.entry.js +1 -1
  225. package/dist/esm/salla-user-profile.entry.js +1 -1
  226. package/dist/esm/salla-user-settings.entry.js +1 -1
  227. package/dist/esm/salla-verify.entry.js +1 -1
  228. package/dist/esm/salla-wallet.entry.js +1 -1
  229. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  230. package/dist/esm/{tracked-promise-CUM6cNiF.js → tracked-promise-DPZbMaax.js} +1 -1
  231. package/dist/esm/twilight.js +3 -3
  232. package/dist/esm/{vanilla-picker-kF8Cgi5q.js → vanilla-picker-Db2JkkPK.js} +1 -1
  233. package/dist/twilight/{p-74cac8a8.entry.js → p-0076e440.entry.js} +1 -1
  234. package/dist/twilight/{p-c3530e7a.entry.js → p-0245e2c0.entry.js} +1 -1
  235. package/dist/twilight/{p-00d73870.entry.js → p-05533207.entry.js} +1 -1
  236. package/dist/twilight/{p-a5eeb082.entry.js → p-0809ec4c.entry.js} +1 -1
  237. package/dist/twilight/{p-404d3645.entry.js → p-0846a39c.entry.js} +1 -1
  238. package/dist/twilight/{p-0604eb27.entry.js → p-0a36a8df.entry.js} +1 -1
  239. package/dist/twilight/{p-2c4f4539.entry.js → p-0c4b50a8.entry.js} +1 -1
  240. package/dist/twilight/{p-9a161a84.entry.js → p-145f51a4.entry.js} +1 -1
  241. package/dist/twilight/{p-a1d3a45f.entry.js → p-16060f64.entry.js} +1 -1
  242. package/dist/twilight/{p-cd65e560.entry.js → p-16407a84.entry.js} +1 -1
  243. package/dist/twilight/{p-ca0a62f9.entry.js → p-166287b8.entry.js} +1 -1
  244. package/dist/twilight/{p-2104f800.entry.js → p-1ad1e565.entry.js} +1 -1
  245. package/dist/twilight/{p-92d37b3e.entry.js → p-1d7a5517.entry.js} +1 -1
  246. package/dist/twilight/{p-ca52add5.entry.js → p-2495ba63.entry.js} +1 -1
  247. package/dist/twilight/{p-95d8a11b.entry.js → p-24af33da.entry.js} +1 -1
  248. package/dist/twilight/p-24cdca69.entry.js +4 -0
  249. package/dist/twilight/{p-4fb48be8.entry.js → p-25be867c.entry.js} +1 -1
  250. package/dist/twilight/{p-0daa8221.entry.js → p-27ed0bb7.entry.js} +1 -1
  251. package/dist/twilight/{p-d3a9573e.entry.js → p-2f0b08a4.entry.js} +1 -1
  252. package/dist/twilight/{p-a34c031b.entry.js → p-3075687f.entry.js} +1 -1
  253. package/dist/twilight/{p-0a1f28c9.entry.js → p-3330e9b1.entry.js} +1 -1
  254. package/dist/twilight/{p-1d75fdd9.entry.js → p-3431ad47.entry.js} +1 -1
  255. package/dist/twilight/{p-dc6b3dfb.entry.js → p-36d820e1.entry.js} +1 -1
  256. package/dist/twilight/{p-d8c9d454.entry.js → p-3ed4357e.entry.js} +1 -1
  257. package/dist/twilight/{p-72291ad7.entry.js → p-3f137515.entry.js} +1 -1
  258. package/dist/twilight/{p-67d7bd8b.entry.js → p-404e7d5b.entry.js} +1 -1
  259. package/dist/twilight/{p-b0437615.entry.js → p-45b6ec5f.entry.js} +1 -1
  260. package/dist/twilight/{p-2c9c0815.entry.js → p-490e83b7.entry.js} +1 -1
  261. package/dist/twilight/{p-99ff235e.entry.js → p-4a9fbb6e.entry.js} +1 -1
  262. package/dist/twilight/{p-d39bf8b5.entry.js → p-4cf257b2.entry.js} +1 -1
  263. package/dist/twilight/{p-0c1721e1.entry.js → p-4d32ef06.entry.js} +1 -1
  264. package/dist/twilight/{p-74e009df.entry.js → p-5259181e.entry.js} +1 -1
  265. package/dist/twilight/{p-f8d642b2.entry.js → p-534c5ce0.entry.js} +1 -1
  266. package/dist/twilight/{p-d54b75de.entry.js → p-540b7c0c.entry.js} +1 -1
  267. package/dist/twilight/{p-9e27778a.entry.js → p-5492fef2.entry.js} +1 -1
  268. package/dist/twilight/{p-0b814320.entry.js → p-558eef65.entry.js} +1 -1
  269. package/dist/twilight/{p-be973f87.entry.js → p-56c55c15.entry.js} +1 -1
  270. package/dist/twilight/{p-7df52f7b.entry.js → p-5804914e.entry.js} +1 -1
  271. package/dist/twilight/p-591dc47b.entry.js +4 -0
  272. package/dist/twilight/{p-7b9ed1e4.entry.js → p-5cbeee21.entry.js} +1 -1
  273. package/dist/twilight/{p-01636f53.entry.js → p-5f0565be.entry.js} +1 -1
  274. package/dist/twilight/{p-92ec265b.entry.js → p-5f3b36fe.entry.js} +1 -1
  275. package/dist/twilight/{p-51bc9c4d.entry.js → p-628fb2e7.entry.js} +1 -1
  276. package/dist/twilight/{p-ae83c325.entry.js → p-62d4e685.entry.js} +1 -1
  277. package/dist/twilight/{p-5fe29fcf.entry.js → p-648704dc.entry.js} +1 -1
  278. package/dist/twilight/{p-9196b7a9.entry.js → p-67d5bded.entry.js} +1 -1
  279. package/dist/twilight/{p-19c6d83a.entry.js → p-6bdbd0f3.entry.js} +1 -1
  280. package/dist/twilight/{p-5a215130.entry.js → p-71d90a27.entry.js} +1 -1
  281. package/dist/twilight/{p-56ba7f94.entry.js → p-73acf48f.entry.js} +1 -1
  282. package/dist/twilight/{p-9cc2e54c.entry.js → p-7460706e.entry.js} +1 -1
  283. package/dist/twilight/{p-39389b31.entry.js → p-7ab7f179.entry.js} +1 -1
  284. package/dist/twilight/{p-aed6d4eb.entry.js → p-7be94cc2.entry.js} +1 -1
  285. package/dist/twilight/{p-286d9ba3.entry.js → p-7d10ae17.entry.js} +1 -1
  286. package/dist/twilight/{p-5cb10852.entry.js → p-7ef4cd2e.entry.js} +1 -1
  287. package/dist/twilight/{p-f5ac65b4.entry.js → p-85333282.entry.js} +1 -1
  288. package/dist/twilight/{p-c6b82041.entry.js → p-8e298b27.entry.js} +1 -1
  289. package/dist/twilight/{p-a2e8a9d1.entry.js → p-9018a13b.entry.js} +1 -1
  290. package/dist/twilight/{p-953da0b5.entry.js → p-91853c93.entry.js} +1 -1
  291. package/dist/twilight/{p-15c3b0cc.entry.js → p-95e6774b.entry.js} +1 -1
  292. package/dist/twilight/{p-77d816b8.entry.js → p-980deae9.entry.js} +1 -1
  293. package/dist/twilight/{p-0e6a0989.entry.js → p-9b9eb649.entry.js} +1 -1
  294. package/dist/twilight/p-9fzJJ_Ox.js +4 -0
  295. package/dist/twilight/p-B-m0e6tL.js +4 -0
  296. package/dist/twilight/{p-lYj74H1f.js → p-B93EBMau.js} +1 -1
  297. package/dist/twilight/{p-Ca84RIBI.js → p-BI-CCdbp.js} +1 -1
  298. package/dist/twilight/{p-DuoSRdS5.js → p-BOjfFBGe.js} +1 -1
  299. package/dist/twilight/{p-DQXp-sN5.js → p-BTd4Mp32.js} +1 -1
  300. package/dist/twilight/{p-BYpv9A8D.js → p-Bdy-19kn.js} +1 -1
  301. package/dist/twilight/{p-DYcV7UW8.js → p-Be0gsl2J.js} +1 -1
  302. package/dist/twilight/{p-KZ7SFw0C.js → p-BeJV4WrP.js} +1 -1
  303. package/dist/twilight/{p-DYgnIxqR.js → p-BsrZms1J.js} +1 -1
  304. package/dist/twilight/{p-kflOqry6.js → p-CIW_DqnB.js} +1 -1
  305. package/dist/twilight/{p-DMHhYV48.js → p-CZFiZZq_.js} +1 -1
  306. package/dist/twilight/{p-CHOv1Smw.js → p-CkIv9zJH.js} +1 -1
  307. package/dist/twilight/{p-061fdc55.entry.js → p-a38b58ca.entry.js} +1 -1
  308. package/dist/twilight/{p-47c9e882.entry.js → p-a60c4d82.entry.js} +1 -1
  309. package/dist/twilight/{p-3c96d5af.entry.js → p-a6a3a2af.entry.js} +1 -1
  310. package/dist/twilight/{p-eb2e3e67.entry.js → p-a8683925.entry.js} +1 -1
  311. package/dist/twilight/{p-04fadfb3.entry.js → p-a9dd59e6.entry.js} +1 -1
  312. package/dist/twilight/{p-98186fb3.entry.js → p-ae1d9d25.entry.js} +1 -1
  313. package/dist/twilight/{p-e5c2df5a.entry.js → p-aec3c134.entry.js} +1 -1
  314. package/dist/twilight/{p-f9a3f3f4.entry.js → p-b879c791.entry.js} +1 -1
  315. package/dist/twilight/{p-bd2672ee.entry.js → p-b8875211.entry.js} +1 -1
  316. package/dist/twilight/{p-4fff03a8.entry.js → p-b9d30af2.entry.js} +1 -1
  317. package/dist/twilight/{p-5f47eb12.entry.js → p-bb4774ef.entry.js} +1 -1
  318. package/dist/twilight/{p-6e535738.entry.js → p-bd3b3b56.entry.js} +1 -1
  319. package/dist/twilight/{p-72c9cd44.entry.js → p-bf22b091.entry.js} +1 -1
  320. package/dist/twilight/{p-9c798a1a.entry.js → p-c23d9868.entry.js} +1 -1
  321. package/dist/twilight/{p-90d53c9b.entry.js → p-c2fd3800.entry.js} +1 -1
  322. package/dist/twilight/p-c3598ac9.entry.js +4 -0
  323. package/dist/twilight/{p-c6d64b53.entry.js → p-cbe499ec.entry.js} +1 -1
  324. package/dist/twilight/{p-ecdf7027.entry.js → p-cdc167c6.entry.js} +1 -1
  325. package/dist/twilight/{p-022343f3.entry.js → p-d3807e1d.entry.js} +1 -1
  326. package/dist/twilight/{p-f9912293.entry.js → p-d3a91c42.entry.js} +1 -1
  327. package/dist/twilight/{p-d49130fc.entry.js → p-d4242231.entry.js} +1 -1
  328. package/dist/twilight/p-d454c6ac.entry.js +4 -0
  329. package/dist/twilight/{p-a96e5e06.entry.js → p-d86136e7.entry.js} +1 -1
  330. package/dist/twilight/{p-8658fefd.entry.js → p-dfc06251.entry.js} +1 -1
  331. package/dist/twilight/{p-930ff69a.entry.js → p-e033c3ad.entry.js} +1 -1
  332. package/dist/twilight/{p-03db477f.entry.js → p-e416ee2b.entry.js} +1 -1
  333. package/dist/twilight/{p-7e730733.entry.js → p-ef0ff326.entry.js} +1 -1
  334. package/dist/twilight/{p-f4eba1d1.entry.js → p-f00e25a1.entry.js} +1 -1
  335. package/dist/twilight/{p-0bc04e3f.entry.js → p-f5a960be.entry.js} +1 -1
  336. package/dist/twilight/{p-168e3ad8.entry.js → p-f6623828.entry.js} +1 -1
  337. package/dist/twilight/{p-54e43314.entry.js → p-fb79a1b4.entry.js} +1 -1
  338. package/dist/twilight/{p-f060a3dd.entry.js → p-fb8e031a.entry.js} +1 -1
  339. package/dist/twilight/{p-bdda14f6.entry.js → p-fd53f57a.entry.js} +1 -1
  340. package/dist/twilight/twilight.esm.js +1 -1
  341. package/dist/types/components/salla-basket-gap/salla-basket-gap.d.ts +52 -0
  342. package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +20 -0
  343. package/dist/types/components.d.ts +43 -0
  344. package/dist/types/shared/catalog-recommendations.d.ts +2 -0
  345. package/package.json +5 -5
  346. package/dist/twilight/p-25ZR4Fc8.js +0 -4
  347. package/dist/twilight/p-2985e01e.entry.js +0 -4
  348. package/dist/twilight/p-931c44fb.entry.js +0 -4
  349. package/dist/twilight/p-982ccb80.entry.js +0 -4
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SallaBasketGap extends Components.SallaBasketGap, HTMLElement {}
4
+ export const SallaBasketGap: {
5
+ prototype: SallaBasketGap;
6
+ new (): SallaBasketGap;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,402 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
5
+ import { f as fetchCartBoughtTogether } from './catalog-recommendations.js';
6
+ import { d as defineCustomElement$j } from './salla-add-product-button2.js';
7
+ import { d as defineCustomElement$i } from './salla-booking-field2.js';
8
+ import { d as defineCustomElement$h } from './salla-button2.js';
9
+ import { d as defineCustomElement$g } from './salla-color-picker2.js';
10
+ import { d as defineCustomElement$f } from './salla-conditional-fields2.js';
11
+ import { d as defineCustomElement$e } from './salla-count-down2.js';
12
+ import { d as defineCustomElement$d } from './salla-datetime-picker2.js';
13
+ import { d as defineCustomElement$c } from './salla-file-upload2.js';
14
+ import { d as defineCustomElement$b } from './salla-loading2.js';
15
+ import { d as defineCustomElement$a } from './salla-map2.js';
16
+ import { d as defineCustomElement$9 } from './salla-modal2.js';
17
+ import { d as defineCustomElement$8 } from './salla-order-options-modal2.js';
18
+ import { d as defineCustomElement$7 } from './salla-product-availability2.js';
19
+ import { d as defineCustomElement$6 } from './salla-product-options2.js';
20
+ import { d as defineCustomElement$5 } from './salla-progress-bar2.js';
21
+ import { d as defineCustomElement$4 } from './salla-quick-buy2.js';
22
+ import { d as defineCustomElement$3 } from './salla-skeleton2.js';
23
+ import { d as defineCustomElement$2 } from './salla-tel-input2.js';
24
+
25
+ const sallaBasketGapCss = ":host{display:block}";
26
+
27
+ const SallaBasketGap$1 = /*@__PURE__*/ proxyCustomElement(class SallaBasketGap extends HTMLElement {
28
+ constructor() {
29
+ super();
30
+ this.__registerHost();
31
+ /**
32
+ * Maximum number of recommendations to fetch.
33
+ */
34
+ this.limit = 10;
35
+ this.products = [];
36
+ this.isLoading = true;
37
+ this.canRender = true;
38
+ this.title = '';
39
+ this.addToCartLabel = '';
40
+ this.weightLabel = '';
41
+ this.discountLabel = '';
42
+ this.placeholder = '';
43
+ this.fetchGeneration = 0;
44
+ this.isSyncingCart = false;
45
+ this.cartItemChangedHandler = (response) => {
46
+ const items = response?.data?.cart?.items ?? [];
47
+ const ids = items.map((i) => String(i.product_id)).filter(Boolean);
48
+ // Reflect a newly added product in the cart list without a full page refresh.
49
+ this.syncCartItemsDom(items);
50
+ this.fetchRecommendations(ids);
51
+ };
52
+ this.beforeAddItemHandler = (data) => {
53
+ const id = String(data?.id ?? '');
54
+ if (id && this.products.some((p) => String(p.id) === id) && salla.cart?.api) {
55
+ salla.cart.api.addToCartSource = 'basket_gap';
56
+ }
57
+ };
58
+ this.addButtonSuccessHandler = (event) => {
59
+ const productId = event?.target?.getAttribute?.('product-id');
60
+ if (!productId)
61
+ return;
62
+ const product = this.products.find((p) => String(p.id) === String(productId));
63
+ if (!product)
64
+ return;
65
+ const items = event?.detail?.data?.items ?? [];
66
+ const cartItem = items.find((i) => String(i.product_id) === String(product.id)) ?? items.slice(-1)[0];
67
+ salla.event.emit('salla-basket-gap::product.added', [{
68
+ product,
69
+ position: this.products.indexOf(product) + 1,
70
+ cartItem,
71
+ cartId: event?.detail?.data?.id,
72
+ source: 'basket_gap',
73
+ }]);
74
+ };
75
+ salla.lang.onLoaded(() => {
76
+ this.title = salla.lang.get('pages.cart.basket_gap_title');
77
+ this.addToCartLabel = salla.lang.get('pages.cart.add_to_cart');
78
+ this.weightLabel = salla.lang.get('pages.products.weight');
79
+ this.discountLabel = salla.lang.get('pages.products.discount');
80
+ });
81
+ }
82
+ componentWillLoad() {
83
+ salla.onReady().then(() => {
84
+ if (!salla.config.get('store.settings.cart.basket_gap')) {
85
+ this.canRender = false;
86
+ this.isLoading = false;
87
+ return;
88
+ }
89
+ this.title = salla.lang.get('pages.cart.basket_gap_title');
90
+ this.addToCartLabel = salla.lang.get('pages.cart.add_to_cart');
91
+ this.weightLabel = salla.lang.get('pages.products.weight');
92
+ this.discountLabel = salla.lang.get('pages.products.discount');
93
+ this.placeholder = salla.url.asset(salla.config.get('theme.settings.placeholder'));
94
+ const cachedCart = salla.storage.get('cart');
95
+ const cachedIds = (cachedCart?.items ?? []).map((i) => String(i.product_id)).filter(Boolean);
96
+ if (cachedIds.length) {
97
+ return this.fetchRecommendations(cachedIds);
98
+ }
99
+ return salla.api.cart.details()
100
+ .then(({ data: { cart } }) => {
101
+ const objectIDs = (cart?.items ?? []).map((i) => String(i.product_id)).filter(Boolean);
102
+ return this.fetchRecommendations(objectIDs);
103
+ })
104
+ .catch(() => {
105
+ this.canRender = false;
106
+ this.isLoading = false;
107
+ });
108
+ });
109
+ }
110
+ componentDidLoad() {
111
+ this.positionUnderCartItems();
112
+ }
113
+ componentDidUpdate() {
114
+ document.lazyLoadInstance?.update(this.host.querySelectorAll('.lazy'));
115
+ this.positionUnderCartItems();
116
+ }
117
+ /**
118
+ * Cart item rows on the storefront cart page (excluding the order-options block).
119
+ * Kept defensive: themes that don't use the `form[id^="item-"]` pattern return none.
120
+ */
121
+ getCartItemForms(root = document) {
122
+ return Array.from(root.querySelectorAll('form[id^="item-"]'))
123
+ .filter((form) => !form.closest('.cart-options'));
124
+ }
125
+ /**
126
+ * The component is injected at the theme's `cart:items.end` hook, which may sit
127
+ * below the order options/offers. Move the host to render directly under the
128
+ * cart items. No-ops when the cart item pattern isn't present.
129
+ */
130
+ positionUnderCartItems() {
131
+ const items = this.getCartItemForms();
132
+ const lastItem = items[items.length - 1];
133
+ if (lastItem && lastItem.nextElementSibling !== this.host) {
134
+ lastItem.after(this.host);
135
+ }
136
+ }
137
+ /**
138
+ * Reflect a newly added product in the cart list without a full page reload.
139
+ * The whole item list is replaced with the fresh server-rendered rows because
140
+ * Salla re-assigns cart line-item ids on add, so diffing by id would duplicate
141
+ * the existing rows. No-ops on themes without the cart item markup.
142
+ */
143
+ syncCartItemsDom(cartItems) {
144
+ if (!cartItems?.length || this.isSyncingCart)
145
+ return;
146
+ const missing = cartItems.filter((item) => !document.getElementById('item-' + item.id));
147
+ if (!missing.length)
148
+ return;
149
+ this.isSyncingCart = true;
150
+ fetch(window.location.href, { headers: { 'X-Requested-With': 'XMLHttpRequest' }, credentials: 'same-origin' })
151
+ .then((res) => res.text())
152
+ .then((html) => {
153
+ const doc = new DOMParser().parseFromString(html, 'text/html');
154
+ const freshForms = this.getCartItemForms(doc);
155
+ const currentForms = this.getCartItemForms();
156
+ if (!freshForms.length || !currentForms.length)
157
+ return;
158
+ const firstCurrent = currentForms[0];
159
+ const parent = firstCurrent.parentElement;
160
+ if (!parent)
161
+ return;
162
+ // Insert the fresh rows in place of the current ones, then drop the old rows.
163
+ freshForms.forEach((form) => {
164
+ parent.insertBefore(document.importNode(form, true), firstCurrent);
165
+ });
166
+ currentForms.forEach((form) => form.remove());
167
+ document.lazyLoadInstance?.update?.();
168
+ this.positionUnderCartItems();
169
+ })
170
+ .catch(() => { })
171
+ .finally(() => { this.isSyncingCart = false; });
172
+ }
173
+ connectedCallback() {
174
+ salla.event.on('cart::item.added', this.cartItemChangedHandler);
175
+ salla.event.on('cart::item.deleted', this.cartItemChangedHandler);
176
+ // Tag adds originating from a basket-gap recommendation so the cart auto-track
177
+ // is suppressed in favour of our attributed `salla-basket-gap::product.added`.
178
+ salla.event.on('cart::before.add.item', this.beforeAddItemHandler);
179
+ this.host.addEventListener('success', this.addButtonSuccessHandler);
180
+ }
181
+ disconnectedCallback() {
182
+ salla.event.off('cart::item.added', this.cartItemChangedHandler);
183
+ salla.event.off('cart::item.deleted', this.cartItemChangedHandler);
184
+ salla.event.off('cart::before.add.item', this.beforeAddItemHandler);
185
+ this.host.removeEventListener('success', this.addButtonSuccessHandler);
186
+ }
187
+ // The recommendation API receives at most 5 cart product IDs, so it can return
188
+ // products that are already in the cart (those beyond the 5-item payload limit).
189
+ // We filter them out here to avoid showing items the customer already has.
190
+ // cartProductIds may be passed in directly from a live event payload; otherwise
191
+ // we fall back to storage (which can lag behind on the initial load path).
192
+ getCartProductIds(knownIds) {
193
+ if (knownIds?.length)
194
+ return new Set(knownIds);
195
+ const cart = salla.storage.get('cart');
196
+ return new Set((cart?.items ?? []).map((i) => String(i.product_id)).filter(Boolean));
197
+ }
198
+ fetchRecommendations(objectIDs) {
199
+ if (!objectIDs.length) {
200
+ this.canRender = false;
201
+ this.isLoading = false;
202
+ return Promise.resolve();
203
+ }
204
+ const generation = ++this.fetchGeneration;
205
+ return fetchCartBoughtTogether(objectIDs)
206
+ .then((ids) => {
207
+ if (generation !== this.fetchGeneration)
208
+ return;
209
+ // Pass objectIDs as the authoritative cart list so the filter is not
210
+ // affected by stale storage when called from a live cart event.
211
+ const cartIds = this.getCartProductIds(objectIDs);
212
+ const filteredIds = ids.filter(id => !cartIds.has(id));
213
+ if (!filteredIds.length) {
214
+ this.canRender = false;
215
+ return;
216
+ }
217
+ return this.fetchProducts(filteredIds.slice(0, this.limit), generation);
218
+ })
219
+ .catch(() => {
220
+ if (generation !== this.fetchGeneration)
221
+ return;
222
+ this.canRender = false;
223
+ })
224
+ .finally(() => {
225
+ if (generation !== this.fetchGeneration)
226
+ return;
227
+ this.isLoading = false;
228
+ });
229
+ }
230
+ fetchProducts(ids, generation) {
231
+ return salla.api.withoutNotifier(() => salla.product.api.fetch({
232
+ source: 'selected',
233
+ source_value: ids,
234
+ limit: this.limit,
235
+ })).then((response) => {
236
+ if (generation !== this.fetchGeneration)
237
+ return;
238
+ this.products = response?.data ?? [];
239
+ this.canRender = this.products.length > 0;
240
+ }).catch(() => {
241
+ if (generation !== this.fetchGeneration)
242
+ return;
243
+ this.canRender = false;
244
+ });
245
+ }
246
+ getDiscountLabel(product) {
247
+ if (product.promotion_title)
248
+ return product.promotion_title;
249
+ if (product.is_on_sale && product.regular_price > 0 && product.sale_price > 0) {
250
+ const percent = Math.round((1 - product.sale_price / product.regular_price) * 100);
251
+ return percent > 0 ? `${this.discountLabel} ${percent}%` : null;
252
+ }
253
+ return null;
254
+ }
255
+ formatDate(timestamp) {
256
+ const d = new Date(timestamp * 1000);
257
+ const mm = String(d.getMonth() + 1).padStart(2, '0');
258
+ const dd = String(d.getDate()).padStart(2, '0');
259
+ return `${d.getFullYear()}-${mm}-${dd}`;
260
+ }
261
+ getSkeletonView() {
262
+ return (h(Host, { class: "s-basket-gap-entry" }, h("div", { class: "s-basket-gap-skeleton" }, h("salla-skeleton", { height: "16px", width: "40%", style: { marginBottom: '16px' } }), Array(3).fill(null).map((_, i) => (h("div", { key: i, class: "s-basket-gap-skeleton-card" }, h("salla-skeleton", { height: "64px", width: "64px", style: { borderRadius: '8px', flexShrink: '0' } }), h("div", { class: "s-basket-gap-skeleton-info" }, h("salla-skeleton", { height: "14px", width: "50%" }), h("salla-skeleton", { height: "12px", width: "25%", style: { marginTop: '6px' } }), h("salla-skeleton", { height: "10px", width: "35%", style: { marginTop: '4px' } })), h("salla-skeleton", { height: "36px", width: "100px", style: { borderRadius: '6px', flexShrink: '0', marginInlineStart: 'auto' } })))))));
263
+ }
264
+ getProductCard(product) {
265
+ const discountLabel = this.getDiscountLabel(product);
266
+ return (h("div", { key: product.id, class: "s-basket-gap-card" }, h("a", { href: product.url, class: "s-basket-gap-card-image" }, h("img", { class: "lazy", src: this.placeholder, "data-src": product.image?.url, alt: product.image?.alt || product.name })), h("div", { class: "s-basket-gap-card-info" }, h("h3", { class: "s-basket-gap-card-name" }, h("a", { href: product.url }, product.name)), product.is_on_sale
267
+ ? h("div", { class: "s-basket-gap-card-sale-price" }, h("span", { innerHTML: salla.money(product.sale_price) }), h("del", { innerHTML: salla.money(product.regular_price) }))
268
+ : h("span", { class: "s-basket-gap-card-price", innerHTML: salla.money(product.price) }), product.weight_label && (h("span", { class: "s-basket-gap-card-weight" }, this.weightLabel, " ", product.weight_label))), (product.promotion_title || product.discount_ends || product.is_on_sale) && (h("div", { class: "s-basket-gap-card-offer" }, h("i", { class: "sicon-gift" }), discountLabel && h("span", null, discountLabel), product.discount_ends && [
269
+ h("salla-count-down", { date: this.formatDate(product.discount_ends), "end-of-day": true, digits: "en" }),
270
+ h("i", { class: "sicon-alarm" }),
271
+ ])), h("salla-add-product-button", { class: "s-basket-gap-card-btn", "product-id": product.id, "product-status": product.status, "product-type": product.type }, this.addToCartLabel)));
272
+ }
273
+ render() {
274
+ if (!this.canRender)
275
+ return null;
276
+ if (this.isLoading)
277
+ return this.getSkeletonView();
278
+ if (!this.products.length)
279
+ return null;
280
+ return (h(Host, { class: "s-basket-gap-entry" }, this.title && h("h2", { class: "s-basket-gap-title" }, this.title), h("div", { class: "s-basket-gap-list" }, this.products.map(product => this.getProductCard(product)))));
281
+ }
282
+ get host() { return this; }
283
+ static get style() { return sallaBasketGapCss; }
284
+ }, [0, "salla-basket-gap", {
285
+ "limit": [2],
286
+ "products": [32],
287
+ "isLoading": [32],
288
+ "canRender": [32],
289
+ "title": [32],
290
+ "addToCartLabel": [32],
291
+ "weightLabel": [32],
292
+ "discountLabel": [32]
293
+ }]);
294
+ function defineCustomElement$1() {
295
+ if (typeof customElements === "undefined") {
296
+ return;
297
+ }
298
+ const components = ["salla-basket-gap", "salla-add-product-button", "salla-booking-field", "salla-button", "salla-color-picker", "salla-conditional-fields", "salla-count-down", "salla-datetime-picker", "salla-file-upload", "salla-loading", "salla-map", "salla-modal", "salla-order-options-modal", "salla-product-availability", "salla-product-options", "salla-progress-bar", "salla-quick-buy", "salla-skeleton", "salla-tel-input"];
299
+ components.forEach(tagName => { switch (tagName) {
300
+ case "salla-basket-gap":
301
+ if (!customElements.get(tagName)) {
302
+ customElements.define(tagName, SallaBasketGap$1);
303
+ }
304
+ break;
305
+ case "salla-add-product-button":
306
+ if (!customElements.get(tagName)) {
307
+ defineCustomElement$j();
308
+ }
309
+ break;
310
+ case "salla-booking-field":
311
+ if (!customElements.get(tagName)) {
312
+ defineCustomElement$i();
313
+ }
314
+ break;
315
+ case "salla-button":
316
+ if (!customElements.get(tagName)) {
317
+ defineCustomElement$h();
318
+ }
319
+ break;
320
+ case "salla-color-picker":
321
+ if (!customElements.get(tagName)) {
322
+ defineCustomElement$g();
323
+ }
324
+ break;
325
+ case "salla-conditional-fields":
326
+ if (!customElements.get(tagName)) {
327
+ defineCustomElement$f();
328
+ }
329
+ break;
330
+ case "salla-count-down":
331
+ if (!customElements.get(tagName)) {
332
+ defineCustomElement$e();
333
+ }
334
+ break;
335
+ case "salla-datetime-picker":
336
+ if (!customElements.get(tagName)) {
337
+ defineCustomElement$d();
338
+ }
339
+ break;
340
+ case "salla-file-upload":
341
+ if (!customElements.get(tagName)) {
342
+ defineCustomElement$c();
343
+ }
344
+ break;
345
+ case "salla-loading":
346
+ if (!customElements.get(tagName)) {
347
+ defineCustomElement$b();
348
+ }
349
+ break;
350
+ case "salla-map":
351
+ if (!customElements.get(tagName)) {
352
+ defineCustomElement$a();
353
+ }
354
+ break;
355
+ case "salla-modal":
356
+ if (!customElements.get(tagName)) {
357
+ defineCustomElement$9();
358
+ }
359
+ break;
360
+ case "salla-order-options-modal":
361
+ if (!customElements.get(tagName)) {
362
+ defineCustomElement$8();
363
+ }
364
+ break;
365
+ case "salla-product-availability":
366
+ if (!customElements.get(tagName)) {
367
+ defineCustomElement$7();
368
+ }
369
+ break;
370
+ case "salla-product-options":
371
+ if (!customElements.get(tagName)) {
372
+ defineCustomElement$6();
373
+ }
374
+ break;
375
+ case "salla-progress-bar":
376
+ if (!customElements.get(tagName)) {
377
+ defineCustomElement$5();
378
+ }
379
+ break;
380
+ case "salla-quick-buy":
381
+ if (!customElements.get(tagName)) {
382
+ defineCustomElement$4();
383
+ }
384
+ break;
385
+ case "salla-skeleton":
386
+ if (!customElements.get(tagName)) {
387
+ defineCustomElement$3();
388
+ }
389
+ break;
390
+ case "salla-tel-input":
391
+ if (!customElements.get(tagName)) {
392
+ defineCustomElement$2();
393
+ }
394
+ break;
395
+ } });
396
+ }
397
+ defineCustomElement$1();
398
+
399
+ const SallaBasketGap = SallaBasketGap$1;
400
+ const defineCustomElement = defineCustomElement$1;
401
+
402
+ export { SallaBasketGap, defineCustomElement };
@@ -2,13 +2,12 @@
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
4
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
5
+ import { a as fetchProductCustomersAlsoBought } from './catalog-recommendations.js';
5
6
  import { d as defineCustomElement$3 } from './salla-button2.js';
6
7
  import { d as defineCustomElement$2 } from './salla-skeleton2.js';
7
8
 
8
9
  const sallaBoughtTogetherCss = ":host{display:block}.s-bought-together-checkbox:checked~.s-bought-together-checkmark{background-color:var(--color-primary, #2ECC71);border-color:var(--color-primary, #2ECC71)}.s-bought-together-checkbox:checked~.s-bought-together-checkmark::after{content:\"\";display:block;width:5px;height:9px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg);margin-top:-2px}";
9
10
 
10
- // Read-only recommendations key confirmed safe for client-side use by the API team — no write access or sensitive scope.
11
- const XSELL_API_KEY = 'VOL5WaZu2YROp0RplCZAr1RplhL9FFGQ';
12
11
  const SallaBoughtTogether$1 = /*@__PURE__*/ proxyCustomElement(class SallaBoughtTogether extends HTMLElement {
13
12
  constructor() {
14
13
  super();
@@ -46,25 +45,14 @@ const SallaBoughtTogether$1 = /*@__PURE__*/ proxyCustomElement(class SallaBought
46
45
  return;
47
46
  }
48
47
  this.resolvedProductId = id;
49
- return salla.api.request('https://api.salla.dev/1/indexes/*/recommendations', {
50
- requests: [{
51
- indexName: 'products',
52
- model: 'xsell-v1',
53
- priceThreshold: 2,
54
- objectID: String(id),
55
- maxRecommendations: this.limit,
56
- }]
57
- }, 'post', { headers: { 'X-Algolia-Api-Key': XSELL_API_KEY, 'X-Query-Enrichment': 'false', 'X-source': 'store' } });
48
+ return fetchProductCustomersAlsoBought(String(id));
58
49
  })
59
- .then((response) => {
60
- if (!response)
61
- return;
62
- const hits = response?.results?.[0]?.hits ?? [];
63
- if (!hits.length) {
50
+ .then((recommendedIds) => {
51
+ if (!recommendedIds?.length) {
64
52
  this.canRender = false;
65
53
  return;
66
54
  }
67
- const ids = [String(this.resolvedProductId), ...hits.map(h => h.objectID)];
55
+ const ids = [String(this.resolvedProductId), ...recommendedIds.slice(0, this.limit)];
68
56
  return salla.product.fetch({ source: 'selected', source_value: ids });
69
57
  })
70
58
  .then((response) => {
@@ -131,7 +131,8 @@ const SallaCountDown = /*@__PURE__*/ proxyCustomElement(class SallaCountDown ext
131
131
  return !isNaN(Date.parse(testedDate));
132
132
  }
133
133
  number(digit) {
134
- return salla.helpers.number(digit, this.digits === 'en');
134
+ const value = String(Math.max(0, Math.floor(digit))).padStart(2, '0');
135
+ return salla.helpers.number(value, this.digits === 'en');
135
136
  }
136
137
  startCountDown() {
137
138
  const normalized = this.normalizeDate(this.date);
@@ -234,7 +235,7 @@ const SallaCountDown = /*@__PURE__*/ proxyCustomElement(class SallaCountDown ext
234
235
  return this.renderCountDown();
235
236
  }
236
237
  render() {
237
- return (h(Host, { key: '966a6ce961c0cc07b937d9b8e328211377084d44', class: `s-count-down-wrapper ${this.preOrder && this.isValidDate(this.date) ? 's-count-down-pre-order' : ''} ${this.horizontal ? 's-count-down-horizontal' : ''} ${this.withButton ? 's-count-down-with-button' : ''} ${this.offerEnded ? 's-count-down-ended' : ''}` }, this.renderPrefixText(), this.renderContent(), this.offerEnded && this.renderOfferEnded(), this.renderButton()));
238
+ return (h(Host, { key: 'e2805e528a52b71ad71f4f1f16a473947dafb5bc', class: `s-count-down-wrapper ${this.preOrder && this.isValidDate(this.date) ? 's-count-down-pre-order' : ''} ${this.horizontal ? 's-count-down-horizontal' : ''} ${this.withButton ? 's-count-down-with-button' : ''} ${this.offerEnded ? 's-count-down-ended' : ''}` }, this.renderPrefixText(), this.renderContent(), this.offerEnded && this.renderOfferEnded(), this.renderButton()));
238
239
  }
239
240
  static get style() { return sallaCountDownCss; }
240
241
  }, [0, "salla-count-down", {
@@ -493,9 +493,15 @@ window.SallaApplePay = {
493
493
  SallaApplePay.initDefault();
494
494
 
495
495
  let version = SallaApplePay.getApplePaySessionVersion();
496
- let supportedNetworks = SallaApplePay.detail.supportedNetworks || ['masterCard', 'visa'];
497
-
498
- if (version === 5) {
496
+ // Normalize to an array: the backend can serialize the networks list as a JSON object
497
+ // (non-sequential PHP array keys). Copy it so we never mutate the shared `detail` reference.
498
+ // Works for both legacy (plain array) and unified (object-shaped) payloads.
499
+ let rawNetworks = SallaApplePay.detail.supportedNetworks;
500
+ let supportedNetworks = Array.isArray(rawNetworks) ? [...rawNetworks] : Object.values(rawNetworks || {});
501
+ if (!supportedNetworks.length) {
502
+ supportedNetworks = ['masterCard', 'visa'];
503
+ }
504
+ if (version === 5 && !supportedNetworks.includes('mada')) {
499
505
  supportedNetworks.push('mada');
500
506
  }
501
507
 
@@ -876,8 +882,16 @@ window.SallaApplePay = {
876
882
  payments
877
883
  });
878
884
 
879
- // todo :: enhance response from backend
880
- SallaApplePay.detail.amount = payments?.gateways?.applePay?.supportedMultiCurrency ? cart.total_in_customer_currency : cart.total;
885
+ // BE-canary gate keyed on the live payload (not cached config): the unified BE adds
886
+ // applePay.amount, legacy BE doesn't so gate and data can never desync.
887
+ if (payments?.gateways?.applePay?.amount != null) {
888
+ // Unified BE: Apple Pay is always charged in the store base currency.
889
+ SallaApplePay.detail.amount = payments.gateways.applePay.amount;
890
+ SallaApplePay.detail.currency = payments.gateways.applePay.currency ?? SallaApplePay.detail.currency;
891
+ } else {
892
+ // Legacy BE .
893
+ SallaApplePay.detail.amount = payments?.gateways?.applePay?.supportedMultiCurrency ? cart.total_in_customer_currency : cart.total;
894
+ }
881
895
  SallaApplePay.detail.items = (cart.totals || cart.items).map((item) => {
882
896
  return {
883
897
  label: item.title,
@@ -1162,8 +1176,15 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class SallaQuickBuy exten
1162
1176
  currency: this.currency || 'SAR', // SAR
1163
1177
  requiredShippingContactFields: this.getRequiredShippingContactFields(),
1164
1178
  shippingMethods: this.isRequireShipping ? [] : undefined,
1165
- supportedNetworks: salla.config.get('store.settings.buy_now.networks'),
1166
- supportedCountries: salla.config.get('store.settings.buy_now.countries'),
1179
+ // Legacy BE
1180
+ supportedNetworks: this.isLegacyBuyNowBE()
1181
+ ? salla.config.get('store.settings.buy_now.networks')
1182
+ : ((Array.isArray(this.supportedNetworks) && this.supportedNetworks.length)
1183
+ ? this.supportedNetworks : salla.config.get('store.settings.buy_now.supportedNetworks')),
1184
+ supportedCountries: this.isLegacyBuyNowBE()
1185
+ ? salla.config.get('store.settings.buy_now.countries')
1186
+ : ((Array.isArray(this.supportedCountries) && this.supportedCountries.length)
1187
+ ? this.supportedCountries : salla.config.get('store.settings.buy_now.supportedCountries')),
1167
1188
  countryCode: salla.config.get('store.store_country') || 'SA',
1168
1189
  onStartedSession: this.handleApplePaySessionStarted,
1169
1190
  validateMerchant: {
@@ -1240,6 +1261,35 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class SallaQuickBuy exten
1240
1261
  }
1241
1262
  return fields;
1242
1263
  }
1264
+ /**
1265
+ * TEMPORARY for BE Vip sync
1266
+ */
1267
+ isLegacyBuyNowBE() {
1268
+ return salla?.config?.get?.('store.settings.buy_now.networks') != null;
1269
+ }
1270
+ /** Set Apple Pay amount + currency from a price payload, always keeping the pair in one currency. */
1271
+ applyBaseCurrencyPrice(data) {
1272
+ // Legacy BE: amount only; currency is set once in runInit.
1273
+ if (this.isLegacyBuyNowBE()) {
1274
+ if (data?.price != null) {
1275
+ this.amount = data.price;
1276
+ }
1277
+ return;
1278
+ }
1279
+ const base = data?.base_currency_price;
1280
+ // Unified BE base pair (regular products): charge in base currency.
1281
+ if (base?.amount != null) {
1282
+ this.amount = base.amount;
1283
+ if (base?.currency) {
1284
+ this.currency = base.currency;
1285
+ }
1286
+ // Display-only payload (e.g. donation { id, price }): pair amount with its display currency.
1287
+ }
1288
+ else if (data?.price != null) {
1289
+ this.amount = data.price;
1290
+ this.currency = salla.config.get('user.currency_code') || this.currency || 'SAR';
1291
+ }
1292
+ }
1243
1293
  componentWillLoad() {
1244
1294
  console.log('🍏 Pay: Quick Buy Component Loaded');
1245
1295
  const canMakePayments = typeof window !== 'undefined' && !!window.ApplePaySession?.canMakePayments?.();
@@ -1247,7 +1297,9 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class SallaQuickBuy exten
1247
1297
  const isSallaGateway = salla?.config?.get?.('store.settings.is_salla_gateway', false) ?? true;
1248
1298
  this.isApplePayActive = canMakePayments && storeHasApplePay && isSallaGateway;
1249
1299
  const runInit = async () => {
1250
- if (!this.currency && salla?.config?.get) {
1300
+ if (this.isLegacyBuyNowBE() && !this.currency && salla?.config?.get) {
1301
+ // Legacy BE (pre-PR): currency from the multi_currency flag. The unified BE instead
1302
+ // sources amount + currency from `base_currency_price` (see applyBaseCurrencyPrice).
1251
1303
  this.currency = salla.config.get('store.settings.buy_now.multi_currency') ? salla.config.get('user.currency_code') : 'SAR';
1252
1304
  }
1253
1305
  if (!this.productId && salla?.config?.get && salla.url?.is_page) {
@@ -1259,7 +1311,7 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class SallaQuickBuy exten
1259
1311
  }
1260
1312
  if ((!this.amount || !this.isRequireShipping) && this.productId && salla?.product?.getDetails) {
1261
1313
  await salla.product.getDetails(this.productId, []).then((response) => {
1262
- this.amount = response.data.price;
1314
+ this.applyBaseCurrencyPrice(response?.data);
1263
1315
  this.isRequireShipping = response?.data?.is_require_shipping || false;
1264
1316
  }).catch((error) => {
1265
1317
  salla?.logger?.warn?.('🍏 Pay: Failed load the quick buy, get the product details failed: ', error);
@@ -1269,11 +1321,11 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class SallaQuickBuy exten
1269
1321
  salla.event.on('product-options::donation-changed', (data) => {
1270
1322
  if (String(data.id) !== String(this.productId))
1271
1323
  return;
1272
- this.amount = data.price;
1324
+ this.applyBaseCurrencyPrice(data);
1273
1325
  });
1274
1326
  }
1275
1327
  else if (salla?.url?.is_page?.('product.single') && salla?.product?.event?.onPriceUpdated) {
1276
- salla.product.event.onPriceUpdated(response => { this.amount = response.data.price; });
1328
+ salla.product.event.onPriceUpdated(response => { this.applyBaseCurrencyPrice(response?.data); });
1277
1329
  }
1278
1330
  this.isApplePayActive = (salla?.helpers?.hasApplePay?.() ?? canMakePayments)
1279
1331
  && (salla?.config?.get?.('store.settings.payments')?.includes?.('apple_pay') ?? storeHasApplePay)
@@ -1296,7 +1348,7 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class SallaQuickBuy exten
1296
1348
  });
1297
1349
  }
1298
1350
  render() {
1299
- return h(Host, { key: '1895bf6077b3c9d2068830ac621e8f5b8afd1193' }, this.quickBuyButton());
1351
+ return h(Host, { key: '8df291680d9b59f1627c8e1185a01cb30b92c2e4' }, this.quickBuyButton());
1300
1352
  }
1301
1353
  quickBuyButton() {
1302
1354
  return h("apple-pay-button", { locale: salla?.config?.get?.('user.language_code') || 'ar', onClick: () => this.quickBuyHandler(), "data-quick-purchase": "applepay", class: "s-quick-buy-apple-pay", "data-is-applepay": "1", buttonstyle: "black", type: this.type });
@@ -1318,6 +1370,8 @@ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class SallaQuickBuy exten
1318
1370
  "isRequireShipping": [1028, "is-require-shipping"],
1319
1371
  "applePayOnly": [1028, "apple-pay-only"],
1320
1372
  "validateHost": [1025, "validate-host"],
1373
+ "supportedNetworks": [1040, "supported-networks"],
1374
+ "supportedCountries": [1040, "supported-countries"],
1321
1375
  "isApplePayActive": [32],
1322
1376
  "quickBuy": [32]
1323
1377
  }]);