@salla.sa/twilight-components 2.14.533 → 2.14.534

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 (336) hide show
  1. package/dist/cjs/{filepond-CTU0puJK.js → filepond-CzzYqkM-.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-e2j_qdEq.js → filepond-plugin-file-poster-IGnsXbLV.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-CJ2bdUHS.js → filepond-plugin-file-validate-size-BKJOg89u.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-BAPOnkKm.js → filepond-plugin-file-validate-type-BBlZyrmo.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-Qg5TvRQk.js → filepond-plugin-image-edit-CkV-JfTG.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-CDWu2nuZ.js → filepond-plugin-image-exif-orientation-Bnr5h4aU.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-D7tinAVs.js → filepond-plugin-image-preview-YE3Qz2Qn.js} +1 -1
  8. package/dist/cjs/{functions-9UoEMgE8.js → functions-BToxmlJ7.js} +1 -1
  9. package/dist/cjs/{index-Bzkj4Mih.js → index-DOmij-lb.js} +2 -2
  10. package/dist/cjs/{intlTelInput-B-ymxxq7.js → intlTelInput-CXGip9wa.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +604 -47
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
  22. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  47. package/dist/cjs/salla-loyalty-exchange-product-card_5.cjs.entry.js +3 -3
  48. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  49. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  50. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  54. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  55. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-order-shipments.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-B0bluwtb.js → tracked-promise-CuRiQ-oJ.js} +1 -1
  108. package/dist/cjs/twilight.cjs.js +1 -1
  109. package/dist/cjs/{vanilla-picker-b_58j2ys.js → vanilla-picker-BwXKIjHv.js} +1 -1
  110. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +7 -4
  111. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +18 -36
  112. package/dist/components/index.js +2 -2
  113. package/dist/components/salla-add-product-button2.js +7 -5
  114. package/dist/components/salla-quick-buy2.js +597 -42
  115. package/dist/esm/{filepond-cbwmiCMW.js → filepond-BmC2BnNt.js} +1 -1
  116. package/dist/esm/{filepond-plugin-file-poster-CnPkPMW8.js → filepond-plugin-file-poster-CSClKnVg.js} +1 -1
  117. package/dist/esm/{filepond-plugin-file-validate-size-DvbfP3XU.js → filepond-plugin-file-validate-size-D0cipAUK.js} +1 -1
  118. package/dist/esm/{filepond-plugin-file-validate-type-BmKx6JGC.js → filepond-plugin-file-validate-type-xifbBb1D.js} +1 -1
  119. package/dist/esm/{filepond-plugin-image-edit-Bs6ewOpy.js → filepond-plugin-image-edit-Clcbrj3n.js} +1 -1
  120. package/dist/esm/{filepond-plugin-image-exif-orientation-BHCRYCoF.js → filepond-plugin-image-exif-orientation-DcUAf5kZ.js} +1 -1
  121. package/dist/esm/{filepond-plugin-image-preview-BcBXsocw.js → filepond-plugin-image-preview-ezr-Aasn.js} +1 -1
  122. package/dist/esm/{functions-BDNgBQjQ.js → functions-DPP-xnlV.js} +1 -1
  123. package/dist/esm/{index-_4UMswuA.js → index-DMRFX0Bm.js} +2 -2
  124. package/dist/esm/{intlTelInput-BqsfLR9B.js → intlTelInput-C6EYZSt7.js} +1 -1
  125. package/dist/esm/loader.js +2 -2
  126. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  127. package/dist/esm/salla-accordion_6.entry.js +1 -1
  128. package/dist/esm/salla-add-product-button_5.entry.js +604 -47
  129. package/dist/esm/salla-advertisement.entry.js +1 -1
  130. package/dist/esm/salla-alert_2.entry.js +1 -1
  131. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  132. package/dist/esm/salla-apps-icons.entry.js +1 -1
  133. package/dist/esm/salla-badge.entry.js +1 -1
  134. package/dist/esm/salla-basket-gap.entry.js +1 -1
  135. package/dist/esm/salla-booking-field_7.entry.js +10 -10
  136. package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
  137. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  138. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  139. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  140. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  141. package/dist/esm/salla-comment-factors.entry.js +1 -1
  142. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  143. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  144. package/dist/esm/salla-contacts.entry.js +1 -1
  145. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  146. package/dist/esm/salla-count-down_2.entry.js +1 -1
  147. package/dist/esm/salla-custom-fields.entry.js +1 -1
  148. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  149. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  150. package/dist/esm/salla-filters-widget.entry.js +1 -1
  151. package/dist/esm/salla-filters.entry.js +1 -1
  152. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  153. package/dist/esm/salla-gifting.entry.js +1 -1
  154. package/dist/esm/salla-hook.entry.js +1 -1
  155. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  156. package/dist/esm/salla-installment.entry.js +1 -1
  157. package/dist/esm/salla-list-tile.entry.js +1 -1
  158. package/dist/esm/salla-localization-modal.entry.js +1 -1
  159. package/dist/esm/salla-login-modal.entry.js +1 -1
  160. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  161. package/dist/esm/salla-loyalty-exchange-product-card_5.entry.js +3 -3
  162. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  163. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  164. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  165. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  166. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  167. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  168. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  169. package/dist/esm/salla-loyalty.entry.js +1 -1
  170. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  171. package/dist/esm/salla-map_2.entry.js +1 -1
  172. package/dist/esm/salla-menu.entry.js +1 -1
  173. package/dist/esm/salla-metadata.entry.js +1 -1
  174. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  175. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  176. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  177. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  178. package/dist/esm/salla-notification-item.entry.js +1 -1
  179. package/dist/esm/salla-notifications.entry.js +1 -1
  180. package/dist/esm/salla-offer-modal.entry.js +1 -1
  181. package/dist/esm/salla-offer.entry.js +1 -1
  182. package/dist/esm/salla-order-branch.entry.js +1 -1
  183. package/dist/esm/salla-order-cancel.entry.js +1 -1
  184. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  185. package/dist/esm/salla-order-details-options.entry.js +1 -1
  186. package/dist/esm/salla-order-details.entry.js +1 -1
  187. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  188. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  189. package/dist/esm/salla-order-edit.entry.js +1 -1
  190. package/dist/esm/salla-order-shipments.entry.js +1 -1
  191. package/dist/esm/salla-order-summary.entry.js +1 -1
  192. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  193. package/dist/esm/salla-orders.entry.js +1 -1
  194. package/dist/esm/salla-payments.entry.js +1 -1
  195. package/dist/esm/salla-placeholder.entry.js +1 -1
  196. package/dist/esm/salla-price-range.entry.js +1 -1
  197. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  198. package/dist/esm/salla-product-card_2.entry.js +1 -1
  199. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  200. package/dist/esm/salla-products-list.entry.js +1 -1
  201. package/dist/esm/salla-quick-order.entry.js +1 -1
  202. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  203. package/dist/esm/salla-rating-modal.entry.js +1 -1
  204. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  205. package/dist/esm/salla-scopes.entry.js +1 -1
  206. package/dist/esm/salla-search.entry.js +1 -1
  207. package/dist/esm/salla-skeleton.entry.js +1 -1
  208. package/dist/esm/salla-slider.entry.js +1 -1
  209. package/dist/esm/salla-social-share.entry.js +1 -1
  210. package/dist/esm/salla-social.entry.js +1 -1
  211. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  212. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  213. package/dist/esm/salla-tooltip.entry.js +1 -1
  214. package/dist/esm/salla-trust-badges.entry.js +1 -1
  215. package/dist/esm/salla-user-menu.entry.js +1 -1
  216. package/dist/esm/salla-user-profile.entry.js +1 -1
  217. package/dist/esm/salla-user-settings.entry.js +1 -1
  218. package/dist/esm/salla-verify.entry.js +1 -1
  219. package/dist/esm/salla-wallet.entry.js +1 -1
  220. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  221. package/dist/esm/{tracked-promise-t43zESfb.js → tracked-promise-JX-9kfib.js} +1 -1
  222. package/dist/esm/twilight.js +2 -2
  223. package/dist/esm/{vanilla-picker-Cqv-m1pV.js → vanilla-picker-BOcd8HtV.js} +1 -1
  224. package/dist/twilight/{p-56daec16.entry.js → p-0019e3e8.entry.js} +1 -1
  225. package/dist/twilight/{p-a2579e15.entry.js → p-00f7449f.entry.js} +1 -1
  226. package/dist/twilight/{p-5e4c6345.entry.js → p-01ad9b56.entry.js} +1 -1
  227. package/dist/twilight/{p-877ef36d.entry.js → p-04edddc0.entry.js} +1 -1
  228. package/dist/twilight/{p-0652db81.entry.js → p-0645a5fa.entry.js} +1 -1
  229. package/dist/twilight/{p-336bec27.entry.js → p-07e2cff4.entry.js} +1 -1
  230. package/dist/twilight/{p-2a5ed2b8.entry.js → p-0c2dded8.entry.js} +1 -1
  231. package/dist/twilight/{p-46610835.entry.js → p-0e40a73d.entry.js} +1 -1
  232. package/dist/twilight/{p-146bb40b.entry.js → p-0e74721e.entry.js} +1 -1
  233. package/dist/twilight/{p-4cac0554.entry.js → p-16a7a8b6.entry.js} +1 -1
  234. package/dist/twilight/{p-0103aab1.entry.js → p-177f581c.entry.js} +1 -1
  235. package/dist/twilight/{p-83ec7e8a.entry.js → p-19e3ea39.entry.js} +1 -1
  236. package/dist/twilight/{p-646a753d.entry.js → p-1ae3bfef.entry.js} +1 -1
  237. package/dist/twilight/{p-380c1d1f.entry.js → p-20c7d16a.entry.js} +1 -1
  238. package/dist/twilight/{p-3b3d778b.entry.js → p-21b86df9.entry.js} +1 -1
  239. package/dist/twilight/{p-0b18a6dd.entry.js → p-23c7a7e7.entry.js} +1 -1
  240. package/dist/twilight/{p-431ddda2.entry.js → p-253dbb0f.entry.js} +1 -1
  241. package/dist/twilight/{p-a5907a8a.entry.js → p-2aaf2ebe.entry.js} +1 -1
  242. package/dist/twilight/{p-8ecfb854.entry.js → p-2ba1aa7a.entry.js} +1 -1
  243. package/dist/twilight/{p-a7353a2c.entry.js → p-2e785589.entry.js} +1 -1
  244. package/dist/twilight/{p-e47a4b60.entry.js → p-2fd3ca0c.entry.js} +1 -1
  245. package/dist/twilight/{p-3c5dabea.entry.js → p-35b7bec7.entry.js} +1 -1
  246. package/dist/twilight/{p-1cf132f6.entry.js → p-35bbf039.entry.js} +1 -1
  247. package/dist/twilight/{p-230dbdb0.entry.js → p-36f417cd.entry.js} +1 -1
  248. package/dist/twilight/{p-ed84e84a.entry.js → p-3a0199f5.entry.js} +1 -1
  249. package/dist/twilight/{p-ef02ff89.entry.js → p-3e1e3c8d.entry.js} +1 -1
  250. package/dist/twilight/{p-9bdabb1a.entry.js → p-414382de.entry.js} +1 -1
  251. package/dist/twilight/{p-8be62ddd.entry.js → p-42716366.entry.js} +1 -1
  252. package/dist/twilight/{p-8522445b.entry.js → p-43414c27.entry.js} +1 -1
  253. package/dist/twilight/{p-518fd323.entry.js → p-442964f3.entry.js} +1 -1
  254. package/dist/twilight/{p-414b8e8b.entry.js → p-45164ddb.entry.js} +1 -1
  255. package/dist/twilight/{p-0a76c201.entry.js → p-48022e4b.entry.js} +1 -1
  256. package/dist/twilight/{p-527caf04.entry.js → p-4e4247d2.entry.js} +1 -1
  257. package/dist/twilight/{p-5aa2673e.entry.js → p-4f0e5e66.entry.js} +1 -1
  258. package/dist/twilight/{p-fe21d16a.entry.js → p-4f664ccf.entry.js} +1 -1
  259. package/dist/twilight/p-5123aecb.entry.js +4 -0
  260. package/dist/twilight/{p-6a7f0db4.entry.js → p-529a6ad3.entry.js} +1 -1
  261. package/dist/twilight/{p-fcdac58f.entry.js → p-5457bf97.entry.js} +1 -1
  262. package/dist/twilight/{p-cc4694eb.entry.js → p-552427c8.entry.js} +1 -1
  263. package/dist/twilight/{p-e4c11c19.entry.js → p-59419760.entry.js} +1 -1
  264. package/dist/twilight/{p-5dd628bf.entry.js → p-5a1c72f6.entry.js} +1 -1
  265. package/dist/twilight/{p-f020c70a.entry.js → p-5bd0afb5.entry.js} +1 -1
  266. package/dist/twilight/{p-30a9ce5f.entry.js → p-63711930.entry.js} +1 -1
  267. package/dist/twilight/{p-85650252.entry.js → p-67af2790.entry.js} +1 -1
  268. package/dist/twilight/{p-8bdca313.entry.js → p-6813e203.entry.js} +1 -1
  269. package/dist/twilight/{p-9645a657.entry.js → p-6ad531a1.entry.js} +1 -1
  270. package/dist/twilight/{p-e242ca31.entry.js → p-6ba474ce.entry.js} +1 -1
  271. package/dist/twilight/{p-8db35b36.entry.js → p-6f848a95.entry.js} +1 -1
  272. package/dist/twilight/{p-8dd69b86.entry.js → p-73d608b3.entry.js} +1 -1
  273. package/dist/twilight/{p-9817c793.entry.js → p-742506a4.entry.js} +1 -1
  274. package/dist/twilight/{p-4c645ee5.entry.js → p-7433074e.entry.js} +1 -1
  275. package/dist/twilight/{p-a89c3af1.entry.js → p-7446cae3.entry.js} +1 -1
  276. package/dist/twilight/{p-941c3ffa.entry.js → p-7bf3d532.entry.js} +1 -1
  277. package/dist/twilight/{p-34a836bc.entry.js → p-7c506e86.entry.js} +1 -1
  278. package/dist/twilight/{p-0eb8b68f.entry.js → p-7f91c2ed.entry.js} +1 -1
  279. package/dist/twilight/{p-eac49193.entry.js → p-8a15ec3f.entry.js} +1 -1
  280. package/dist/twilight/{p-dcf83d8d.entry.js → p-935aeb6b.entry.js} +1 -1
  281. package/dist/twilight/{p-fbcb213b.entry.js → p-93c20cb3.entry.js} +1 -1
  282. package/dist/twilight/{p-cfec1c83.entry.js → p-94a435b5.entry.js} +1 -1
  283. package/dist/twilight/{p-4c6e6aa9.entry.js → p-9709cacf.entry.js} +1 -1
  284. package/dist/twilight/p-997290f2.entry.js +4 -0
  285. package/dist/twilight/{p-ebab9397.entry.js → p-9fe342b4.entry.js} +1 -1
  286. package/dist/twilight/{p-DTy2I02l.js → p-CWYfwsTI.js} +1 -1
  287. package/dist/twilight/{p-BeurE6_H.js → p-CjKClehN.js} +1 -1
  288. package/dist/twilight/{p-mFNP-Qco.js → p-DFs1TK5k.js} +1 -1
  289. package/dist/twilight/{p-_4UMswuA.js → p-DMRFX0Bm.js} +1 -1
  290. package/dist/twilight/{p-BbGG982X.js → p-DNPKdEKw.js} +1 -1
  291. package/dist/twilight/{p-6QnQGXyw.js → p-DjLY5QYK.js} +2 -2
  292. package/dist/twilight/{p-NVUJ-yak.js → p-Don-qm2w.js} +1 -1
  293. package/dist/twilight/{p-b92c5be6.entry.js → p-a1203169.entry.js} +1 -1
  294. package/dist/twilight/{p-60e976c3.entry.js → p-a398e92a.entry.js} +1 -1
  295. package/dist/twilight/{p-a5313de1.entry.js → p-a3fa2180.entry.js} +1 -1
  296. package/dist/twilight/{p-7480f7ea.entry.js → p-ade49777.entry.js} +1 -1
  297. package/dist/twilight/{p-da371fb5.entry.js → p-b0b7bd90.entry.js} +1 -1
  298. package/dist/twilight/{p-61cba9b5.entry.js → p-b2b80632.entry.js} +1 -1
  299. package/dist/twilight/{p-11a92952.entry.js → p-b5802fb5.entry.js} +1 -1
  300. package/dist/twilight/{p-452ccc3e.entry.js → p-b7be34aa.entry.js} +1 -1
  301. package/dist/twilight/{p-0bb747c4.entry.js → p-b82b1941.entry.js} +1 -1
  302. package/dist/twilight/{p-3d81a00f.entry.js → p-bd3ec0b6.entry.js} +1 -1
  303. package/dist/twilight/{p-aad1a140.entry.js → p-bfe5e648.entry.js} +1 -1
  304. package/dist/twilight/p-c3772da0.entry.js +4 -0
  305. package/dist/twilight/{p-012ab001.entry.js → p-c6f6646d.entry.js} +1 -1
  306. package/dist/twilight/{p-ee6eae74.entry.js → p-c7ebc3f4.entry.js} +1 -1
  307. package/dist/twilight/{p-fBq3tL2U.js → p-cFX85Of2.js} +1 -1
  308. package/dist/twilight/{p-3b536684.entry.js → p-ccba5864.entry.js} +1 -1
  309. package/dist/twilight/{p-98e4b302.entry.js → p-cd28dfd3.entry.js} +1 -1
  310. package/dist/twilight/{p-533b4ad3.entry.js → p-cf0387de.entry.js} +1 -1
  311. package/dist/twilight/{p-8a26d45f.entry.js → p-cf59df56.entry.js} +1 -1
  312. package/dist/twilight/{p-c1fb3330.entry.js → p-d16544a6.entry.js} +1 -1
  313. package/dist/twilight/{p-fb52bc60.entry.js → p-d1675995.entry.js} +1 -1
  314. package/dist/twilight/{p-853bcd69.entry.js → p-d4430516.entry.js} +1 -1
  315. package/dist/twilight/{p-2fca58b7.entry.js → p-d551636a.entry.js} +1 -1
  316. package/dist/twilight/{p-b60c13a0.entry.js → p-d73ac5b1.entry.js} +1 -1
  317. package/dist/twilight/{p-731c71ae.entry.js → p-e16de2e2.entry.js} +1 -1
  318. package/dist/twilight/{p-a30a0d74.entry.js → p-e5f04d7c.entry.js} +1 -1
  319. package/dist/twilight/{p-7f2d5291.entry.js → p-ea1ab663.entry.js} +1 -1
  320. package/dist/twilight/{p-64b3ec8e.entry.js → p-ebda295b.entry.js} +1 -1
  321. package/dist/twilight/{p-73865fc4.entry.js → p-efc3c32a.entry.js} +1 -1
  322. package/dist/twilight/{p-a9d7afd4.entry.js → p-f3a0306d.entry.js} +1 -1
  323. package/dist/twilight/{p-7a6c2a19.entry.js → p-f897bd73.entry.js} +1 -1
  324. package/dist/twilight/{p-d3f13515.entry.js → p-f9b68bc0.entry.js} +1 -1
  325. package/dist/twilight/{p-45db790d.entry.js → p-fdd367b4.entry.js} +1 -1
  326. package/dist/twilight/{p-041337bf.entry.js → p-ffafd845.entry.js} +1 -1
  327. package/dist/twilight/{p-1DFQh6fF.js → p-g97W9KXu.js} +1 -1
  328. package/dist/twilight/{p-Cukniya-.js → p-rAQK31DJ.js} +1 -1
  329. package/dist/twilight/{p-BYBXGGPY.js → p-rUVc3GKD.js} +1 -1
  330. package/dist/twilight/{p-CrgJZliu.js → p-v0aY0153.js} +1 -1
  331. package/dist/twilight/twilight.esm.js +1 -1
  332. package/dist/types/components/salla-quick-buy/salla-quick-buy.d.ts +0 -4
  333. package/package.json +5 -5
  334. package/dist/twilight/p-b80d0e39.entry.js +0 -4
  335. package/dist/twilight/p-c1dd71f0.entry.js +0 -4
  336. package/dist/twilight/p-f7ab48c1.entry.js +0 -4
@@ -3,7 +3,7 @@
3
3
  */
4
4
  'use strict';
5
5
 
6
- var index = require('./index-Bzkj4Mih.js');
6
+ var index = require('./index-DOmij-lb.js');
7
7
  var cart = require('./cart-s-x1Fshk.js');
8
8
  var Helper = require('./Helper-B2B-kxAI.js');
9
9
  var catalogRecommendations = require('./catalog-recommendations-dtK9Dlfw.js');
@@ -20,6 +20,135 @@ var WalletIcon = `<!-- Generated by IcoMoon.io -->
20
20
  </svg>
21
21
  `;
22
22
 
23
+ /**
24
+ * Shared Apple Pay support helpers: SDK loading, capability detection, merchant
25
+ * identifier resolution, and Payment Request method-data construction.
26
+ *
27
+ * Lives in @salla.sa/applepay (not a theme) because it is Apple Pay domain
28
+ * logic and is consumed by every Apple Pay entry point — the storefront
29
+ * components (salla-quick-buy, salla-add-product-button) and the shared
30
+ * SallaApplePay session in ./index.js.
31
+ *
32
+ * Apple Pay runs through two flows:
33
+ * - Native (Safari / Apple devices) → window.ApplePaySession
34
+ * - Payment Request API (other browsers) → Apple's "Scan Code with iPhone"
35
+ * QR sheet, which requires Apple's JS SDK to be *loaded and registered*
36
+ * before PaymentRequest.canMakePayment() reports the method as available.
37
+ */
38
+
39
+ const APPLE_PAY_METHOD$1 = 'https://apple.com/apple-pay';
40
+ const APPLE_PAY_SDK_ID = 'apple-pay-sdk';
41
+ const APPLE_PAY_SDK_SRC = 'https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js';
42
+
43
+ let sdkPromise = null;
44
+
45
+ /**
46
+ * Salla-native Apple merchant identifier, sourced from store settings. Returns
47
+ * null when the store has no Apple Pay merchant configured — callers treat that
48
+ * absence as the guard and skip Apple Pay entirely (no hardcoded fallback).
49
+ * @returns {string|null}
50
+ */
51
+ function applePayMerchantId() {
52
+ return salla?.config?.get?.('store.settings.buy_now.merchant_identifier') || null;
53
+ }
54
+
55
+ /**
56
+ * Build the W3C Payment Request `methodData` for the Apple Pay method. Callers
57
+ * supply the values (the probe reads them from config; the live session reads
58
+ * them from the transaction detail), this owns the constant scaffold so the two
59
+ * can't drift apart.
60
+ * @param {{ version: number, merchantIdentifier: string, supportedNetworks: string[], countryCode: string }} opts
61
+ * @returns {PaymentMethodData[]}
62
+ */
63
+ function buildApplePayMethodData({ version, merchantIdentifier, supportedNetworks, countryCode }) {
64
+ return [{
65
+ supportedMethods: APPLE_PAY_METHOD$1,
66
+ data: {
67
+ version,
68
+ merchantIdentifier,
69
+ merchantCapabilities: ['supports3DS'],
70
+ supportedNetworks,
71
+ countryCode,
72
+ },
73
+ }];
74
+ }
75
+
76
+ /**
77
+ * Inject Apple's Pay JS SDK (`1.latest` ships the cross-browser / QR support)
78
+ * and resolve once it has loaded. Idempotent: a second call reuses the same
79
+ * in-flight promise and never appends a second <script>. Resolves (rather than
80
+ * rejects) on load error so a failed CDN fetch simply falls back to "no QR".
81
+ * @returns {Promise<void>}
82
+ */
83
+ function ensureApplePaySdk() {
84
+ if (typeof document === 'undefined') return Promise.resolve();
85
+
86
+ if (sdkPromise) return sdkPromise;
87
+
88
+ const existing = document.getElementById(APPLE_PAY_SDK_ID);
89
+ if (existing) {
90
+ // Script already in the DOM (e.g. added before this refactor). We can't know
91
+ // if it finished loading, so resolve immediately — the native/PaymentRequest
92
+ // probe will just report unavailable until the browser registers the method.
93
+ sdkPromise = Promise.resolve();
94
+ return sdkPromise;
95
+ }
96
+
97
+ sdkPromise = new Promise((resolve) => {
98
+ const script = document.createElement('script');
99
+ script.src = APPLE_PAY_SDK_SRC;
100
+ script.setAttribute('id', APPLE_PAY_SDK_ID);
101
+ script.async = true;
102
+ script.onload = () => resolve();
103
+ script.onerror = () => resolve();
104
+ document.body.appendChild(script);
105
+ });
106
+
107
+ return sdkPromise;
108
+ }
109
+
110
+ /**
111
+ * Whether Apple Pay can be completed in the current browser: natively
112
+ * (Safari / Apple devices) or via the Payment Request API (non-Safari browsers
113
+ * / non-Apple devices → QR-code fallback).
114
+ *
115
+ * For the QR path this awaits the SDK before probing, so callers get a stable
116
+ * answer on first load instead of racing the async script fetch.
117
+ * @param {string} [currency]
118
+ * @returns {Promise<boolean>}
119
+ */
120
+ async function canCompleteApplePay(currency = 'SAR') {
121
+ try {
122
+ if (window.ApplePaySession?.canMakePayments?.()) return true;
123
+ } catch (e) { /* not supported natively */ }
124
+
125
+ if (typeof window === 'undefined' || !window.PaymentRequest) return false;
126
+
127
+ // QR path only: it can't validate the merchant without a merchant identifier,
128
+ // so treat a missing config key as the guard. Native (above) is unaffected —
129
+ // it never uses the client-side merchant id.
130
+ if (!applePayMerchantId()) return false;
131
+
132
+ await ensureApplePaySdk();
133
+
134
+ try {
135
+ const request = new PaymentRequest(
136
+ buildApplePayMethodData({
137
+ version: 3,
138
+ merchantIdentifier: applePayMerchantId(),
139
+ supportedNetworks: salla?.config?.get?.('store.settings.buy_now.supportedNetworks')
140
+ || salla?.config?.get?.('store.settings.buy_now.networks')
141
+ || ['masterCard', 'visa'],
142
+ countryCode: salla?.config?.get?.('store.store_country') || 'SA',
143
+ }),
144
+ { total: { label: 'Salla', amount: { currency: currency || 'SAR', value: '0.00' } } },
145
+ );
146
+ return await request.canMakePayment();
147
+ } catch (e) {
148
+ return false;
149
+ }
150
+ }
151
+
23
152
  /**
24
153
  * Order-options gate for the fast-checkout widget — keeps <salla-add-product-button> thin.
25
154
  * Intercepts the widget click → runs the order-options modal → injects the result → re-fires the click.
@@ -303,16 +432,18 @@ const SallaAddProductButton = class {
303
432
  }
304
433
  componentWillLoad() {
305
434
  return salla.onReady()
306
- .then(() => {
435
+ .then(async () => {
307
436
  // this to fix not added hydrated class to html element after components loaded
308
437
  document.documentElement.classList.add('hydrated');
309
438
  this.showQuickBuy = this.quickBuy
310
439
  && salla.config.get('store.settings.buy_now')
311
440
  && this.productStatus == 'sale'
312
441
  && this.productType !== 'booking';
313
- this.isApplePayActive = window.ApplePaySession?.canMakePayments()
314
- && salla.config.get('store.settings.payments')?.includes('apple_pay')
315
- && salla.config.get('store.settings.is_salla_gateway', false);
442
+ // Cross-browser Apple Pay: native (Safari) OR the Payment Request API
443
+ // (non-Safari browsers / non-Apple devices via the QR-code fallback).
444
+ this.isApplePayActive = salla.config.get('store.settings.payments')?.includes('apple_pay')
445
+ && salla.config.get('store.settings.is_salla_gateway', false)
446
+ && await canCompleteApplePay();
316
447
  this.passedLabel = this.host.innerHTML.replace('<!---->', '').trim();
317
448
  if (!!this.passedLabel && this.isDesktopViewport) {
318
449
  return this.btn?.setText(this.passedLabel);
@@ -1835,9 +1966,6 @@ const SallaProductOptions = class {
1835
1966
  };
1836
1967
  SallaProductOptions.style = sallaProductOptionsCss;
1837
1968
 
1838
- // display currency (these requests use the global axios, not salla's instance). Legacy-BE stores
1839
- // (isLegacyBuyNowBE) keep the old behavior — no override. Set once on the axios defaults so
1840
- // every method inherits it without overriding the rest of the headers.
1841
1969
  function setBaseCurrencyHeader() {
1842
1970
  index.axios.defaults.headers.common.currency = salla?.config?.get?.('user.currency_code');
1843
1971
  }
@@ -2223,6 +2351,14 @@ if (typeof window !== 'undefined') {
2223
2351
  window.Salla.Payments = window.Salla.Payments || {};
2224
2352
  }
2225
2353
 
2354
+ // Apple Pay method identifier for the W3C Payment Request API.
2355
+ const APPLE_PAY_METHOD = 'https://apple.com/apple-pay';
2356
+
2357
+ // Captured at module load, before the Apple Pay SDK is injected: real Safari /
2358
+ // Apple devices expose `ApplePaySession` natively, whereas non-Safari browsers
2359
+ // only get it once the SDK loads. Keeps native-vs-PaymentRequest routing stable.
2360
+ const HAS_NATIVE_APPLE_PAY = typeof window !== 'undefined' && !!window.ApplePaySession;
2361
+
2226
2362
  /**
2227
2363
  * Full Example
2228
2364
  *
@@ -2266,6 +2402,11 @@ const SallaApplePay = typeof window !== 'undefined' ? {
2266
2402
  countryCode: null,
2267
2403
  totals: [],
2268
2404
  shippingCompany: null,
2405
+ // Set true once onCancel has fired for the current transaction, so the
2406
+ // QR (PaymentRequest) dismissal catch can notify on a plain sheet-close
2407
+ // without double-firing when a prior handler (e.g. merchant validation)
2408
+ // already routed through onCancel. Reset at the start of each transaction.
2409
+ canceled: false,
2269
2410
  init: function () {
2270
2411
  document.removeEventListener('payments::apple-pay.start-transaction', SallaApplePay.startSession);
2271
2412
  Salla.event.addEventListener('payments::apple-pay.start-transaction', SallaApplePay.startSession);
@@ -2328,14 +2469,52 @@ const SallaApplePay = typeof window !== 'undefined' ? {
2328
2469
  return SallaApplePay.detail?.requiredShippingContactFields?.includes('postalAddress');
2329
2470
  },
2330
2471
 
2472
+ /**
2473
+ * Whether the native Apple Pay flow (Safari / Apple devices) can run. Gated
2474
+ * on the module-load capture so the SDK loading later can't flip a
2475
+ * non-Safari browser into the native path.
2476
+ */
2477
+ canUseNative: function () {
2478
+ if (!HAS_NATIVE_APPLE_PAY) {
2479
+ return false;
2480
+ }
2481
+ try {
2482
+ return ApplePaySession.canMakePayments();
2483
+ } catch (e) {
2484
+ return false;
2485
+ }
2486
+ },
2487
+
2488
+ // Sourced from config (via the transaction detail). No fallback: a missing
2489
+ // identifier means Apple Pay isn't configured for this store, and callers
2490
+ // treat that null as the guard to skip Apple Pay.
2491
+ getMerchantIdentifier: function () {
2492
+ return (SallaApplePay.detail && SallaApplePay.detail.merchantIdentifier) || null;
2493
+ },
2494
+
2331
2495
  startSession: async function (event) {
2332
2496
 
2333
2497
  SallaApplePay.detail = event.detail || event;
2334
2498
 
2499
+ // Fresh transaction → clear any cancel flag from a previous attempt.
2500
+ SallaApplePay.canceled = false;
2501
+
2335
2502
  salla.log('🍏 Pay: payments::apple-pay.start-transaction', SallaApplePay.detail);
2336
2503
 
2337
2504
  SallaApplePay.initDefault();
2338
2505
 
2506
+ // Native (Safari / Apple devices) → classic ApplePaySession. Otherwise
2507
+ // (non-Safari / non-Apple device) → Payment Request API, which renders
2508
+ // Apple's "Scan Code with iPhone" QR sheet.
2509
+ if (!SallaApplePay.canUseNative()) {
2510
+ return SallaApplePay.startPaymentRequestSession(event);
2511
+ }
2512
+
2513
+ return SallaApplePay.startNativeSession(event);
2514
+ },
2515
+
2516
+ startNativeSession: async function (event) {
2517
+
2339
2518
  let version = SallaApplePay.getApplePaySessionVersion();
2340
2519
  // Normalize to an array: the backend can serialize the networks list as a JSON object
2341
2520
  // (non-sequential PHP array keys). Copy it so we never mutate the shared `detail` reference.
@@ -2469,6 +2648,7 @@ const SallaApplePay = typeof window !== 'undefined' ? {
2469
2648
  },
2470
2649
 
2471
2650
  onCancel: (event = {}, message = null) => {
2651
+ SallaApplePay.canceled = true;
2472
2652
  SallaApplePay.detail.onError(message || salla.lang.get('pages.checkout.payment_failed'));
2473
2653
  Salla.event.createAndDispatch('payments::apple-pay.canceled', event);
2474
2654
  },
@@ -2685,6 +2865,400 @@ const SallaApplePay = typeof window !== 'undefined' ? {
2685
2865
  }
2686
2866
  },
2687
2867
 
2868
+ /* -------------------------------------------------------------------------
2869
+ * Payment Request API flow (non-Safari browsers / non-Apple devices).
2870
+ * Apple renders the "Scan Code with iPhone" QR sheet. Reuses the same
2871
+ * backend endpoints (validate / address / shipping / recalculate / submit)
2872
+ * as the native flow; only the sheet-completion model differs
2873
+ * (event.updateWith / response.complete instead of session.completeXxx).
2874
+ * ---------------------------------------------------------------------- */
2875
+
2876
+ paymentRequest: null,
2877
+ paymentResponse: null,
2878
+
2879
+ getCurrency: () => SallaApplePay.detail.currency || 'SAR',
2880
+
2881
+ prAmount: (value) => ({ currency: SallaApplePay.getCurrency(), value: String(value) }),
2882
+
2883
+ prTotal: () => {
2884
+ const total = SallaApplePay.prepareTotal();
2885
+ return { label: total.label, amount: SallaApplePay.prAmount(total.amount) };
2886
+ },
2887
+
2888
+ prDisplayItems: () => SallaApplePay.prepareLineItems().map(item => ({
2889
+ label: item.label,
2890
+ amount: SallaApplePay.prAmount(item.amount),
2891
+ })),
2892
+
2893
+ prShippingOptions: (selectedId = null) => {
2894
+ const options = SallaApplePay.mappingShippingMethods(SallaApplePay.shipping_methods || []);
2895
+ return options.map((option, index) => ({
2896
+ id: option.identifier,
2897
+ label: option.label,
2898
+ amount: SallaApplePay.prAmount(option.amount),
2899
+ selected: selectedId ? option.identifier === selectedId : index === 0,
2900
+ }));
2901
+ },
2902
+
2903
+ prContactOptions: () => {
2904
+ const fields = SallaApplePay.detail.requiredShippingContactFields || [];
2905
+ return {
2906
+ requestPayerName: fields.includes('name'),
2907
+ requestPayerEmail: fields.includes('email'),
2908
+ requestPayerPhone: fields.includes('phone'),
2909
+ requestShipping: fields.includes('postalAddress'),
2910
+ shippingType: 'shipping',
2911
+ };
2912
+ },
2913
+
2914
+ startPaymentRequestSession: async function () {
2915
+ // No merchant identifier in config → Apple Pay isn't set up for this
2916
+ // store; bail rather than open a QR sheet that can't be validated.
2917
+ const merchantIdentifier = SallaApplePay.getMerchantIdentifier();
2918
+ if (!merchantIdentifier) {
2919
+ salla.logger.error('🍏 Pay: missing merchant identifier — skipping QR Apple Pay');
2920
+ return;
2921
+ }
2922
+
2923
+ const version = SallaApplePay.getApplePaySessionVersion();
2924
+ const supportedNetworks = [...(SallaApplePay.detail.supportedNetworks || ['masterCard', 'visa'])];
2925
+ if (version === 5 && !supportedNetworks.includes('mada')) {
2926
+ supportedNetworks.push('mada');
2927
+ }
2928
+
2929
+ const methodData = [{
2930
+ supportedMethods: APPLE_PAY_METHOD,
2931
+ data: {
2932
+ version,
2933
+ merchantIdentifier,
2934
+ merchantCapabilities: ['supports3DS'],
2935
+ supportedNetworks,
2936
+ countryCode: SallaApplePay.detail.countryCode || 'SA',
2937
+ },
2938
+ }];
2939
+
2940
+ const requiresShipping = SallaApplePay.isPhysical();
2941
+
2942
+ const details = {
2943
+ total: SallaApplePay.prTotal(),
2944
+ displayItems: SallaApplePay.prDisplayItems(),
2945
+ };
2946
+ if (requiresShipping) {
2947
+ details.shippingOptions = SallaApplePay.prShippingOptions();
2948
+ }
2949
+
2950
+ let request;
2951
+ try {
2952
+ request = new PaymentRequest(methodData, details, SallaApplePay.prContactOptions());
2953
+ } catch (error) {
2954
+ salla.logger.error('🍏 Pay: Failed to create PaymentRequest', error);
2955
+ SallaApplePay.detail.onError(salla.lang.get('pages.checkout.payment_failed'));
2956
+ return;
2957
+ }
2958
+
2959
+ SallaApplePay.paymentRequest = request;
2960
+
2961
+ request.onmerchantvalidation = (event) => {
2962
+ event.complete(SallaApplePay.prValidateMerchant(event));
2963
+ };
2964
+
2965
+ if (requiresShipping) {
2966
+ request.onshippingaddresschange = (event) => {
2967
+ event.updateWith(SallaApplePay.prShippingAddressChange(request));
2968
+ };
2969
+ request.onshippingoptionchange = (event) => {
2970
+ event.updateWith(SallaApplePay.prShippingOptionChange(request));
2971
+ };
2972
+ }
2973
+
2974
+ // Showing the sheet is the QR equivalent of ApplePaySession.begin(): it
2975
+ // must run inside the user gesture (transient activation). Wrapped so the
2976
+ // order-options deferral can drive it — the caller either calls begin()
2977
+ // itself (no options → open the QR sheet now) or discards this request
2978
+ // and the modal's own Apple Pay button starts a fresh one (options found).
2979
+ const beginShow = async () => {
2980
+ // The QR sheet is browser chrome (fixed, top layer) that overlays the
2981
+ // page. Signal open/closed so hosts embedding Apple Pay (e.g. the
2982
+ // mini-checkout modal in an iframe) can hide UI — like their own close
2983
+ // button — that would otherwise collide with the sheet.
2984
+ Salla.event.dispatch('payments::apple-pay.sheet-opened');
2985
+ try {
2986
+ const response = await request.show();
2987
+ SallaApplePay.paymentResponse = response;
2988
+ await SallaApplePay.prPaymentAuthorized(response);
2989
+ } catch (error) {
2990
+ // AbortError → the shopper dismissed the sheet / QR, or merchant
2991
+ // validation rejected. Mirror the native oncancel path so hosts
2992
+ // listening for payments::apple-pay.canceled (to reset checkout UI)
2993
+ // still get notified on a plain dismissal. The `canceled` guard
2994
+ // skips the double-fire when validation already routed through
2995
+ // onCancel via validateMerchant.onFailed.
2996
+ salla.logger.log('🍏 Pay: PaymentRequest closed', error);
2997
+ if (error?.name === 'AbortError' && !SallaApplePay.canceled) {
2998
+ SallaApplePay.onCancel({});
2999
+ }
3000
+ } finally {
3001
+ SallaApplePay.paymentRequest = null;
3002
+ SallaApplePay.paymentResponse = null;
3003
+ Salla.event.dispatch('payments::apple-pay.sheet-closed');
3004
+ }
3005
+ };
3006
+
3007
+ // Mirror the native path (startNativeSession): expose a hook between
3008
+ // request creation and show(). Returning truthy skips the immediate
3009
+ // show() so the order-options modal can open first. Same shim contract
3010
+ // as native — the caller only needs `.begin()`.
3011
+ let skipBegin;
3012
+ if (typeof SallaApplePay.detail.onStartedSession === 'function') {
3013
+ skipBegin = SallaApplePay.detail.onStartedSession({ begin: beginShow });
3014
+ }
3015
+ if (!skipBegin) {
3016
+ await beginShow();
3017
+ }
3018
+ },
3019
+
3020
+ /** Merchant validation — resolves the promise passed to event.complete(). */
3021
+ prValidateMerchant: async function (event) {
3022
+ Salla.event.dispatch('payments::apple-pay.validate-merchant.init', event);
3023
+ try {
3024
+ const { data } = await http.post(
3025
+ SallaApplePay.detail.validateMerchant.url.replace('{id}', SallaApplePay.id),
3026
+ { validation_url: event.validationURL }
3027
+ );
3028
+
3029
+ // The BE can return HTTP 200 while Apple actually rejected the session
3030
+ // (e.g. statusCode 417 "not a registered merchant in WWDR"), with the
3031
+ // real session under data.data. A valid Apple session always carries a
3032
+ // merchantSessionIdentifier; its absence means validation failed. Without
3033
+ // this the QR sheet just closes silently — notify the shopper and abort.
3034
+ if (!data?.data?.merchantSessionIdentifier) {
3035
+ salla.logger.error('🍏 Pay: merchant validation failed', data?.statusMessage || data);
3036
+ Salla.event.dispatch('payments::apple-pay.validate-merchant.failed', { data });
3037
+ SallaApplePay.onCancel({});
3038
+ // Dismiss the sheet + paired device immediately. Rejecting
3039
+ // event.complete() alone leaves them spinning until Apple's own
3040
+ // timeout; abort() forces an instant close. Deferred a tick so it
3041
+ // runs after this validation update settles (abort() throws if
3042
+ // called while an update is still in flight).
3043
+ setTimeout(() => {
3044
+ try { SallaApplePay.paymentRequest?.abort(); } catch (e) { /* already closing */ }
3045
+ }, 0);
3046
+ const validationError = new Error('Apple Pay merchant validation failed');
3047
+ validationError.handled = true;
3048
+ throw validationError;
3049
+ }
3050
+
3051
+ Salla.event.dispatch('payments::apple-pay.validate-merchant.success', data);
3052
+
3053
+ if (typeof SallaApplePay.detail.validateMerchant.onSuccess === 'function') {
3054
+ const response = await SallaApplePay.detail.validateMerchant.onSuccess(data);
3055
+ if (response?.redirect) {
3056
+ window.location = response.redirect;
3057
+ }
3058
+ }
3059
+
3060
+ return data.data;
3061
+ } catch (error) {
3062
+ // Skip when the invalid-session branch above already notified via onCancel.
3063
+ if (!error?.handled) {
3064
+ const response = error?.response;
3065
+ Salla.event.dispatch('payments::apple-pay.validate-merchant.failed', response);
3066
+ if (typeof SallaApplePay.detail.validateMerchant.onFailed === 'function') {
3067
+ SallaApplePay.detail.validateMerchant.onFailed(response);
3068
+ }
3069
+ }
3070
+ // Rethrow so PaymentRequest aborts the sheet.
3071
+ throw error;
3072
+ }
3073
+ },
3074
+
3075
+ /**
3076
+ * ISO 3166 alpha-2 code → localized country name. The native path sends the
3077
+ * country *name* in `country` (from ApplePayPaymentContact.country) and the
3078
+ * ISO code in `country_code`; W3C PaymentAddress only exposes the ISO code,
3079
+ * so we derive the name the backend expects. Falls back to the code if
3080
+ * Intl.DisplayNames is unavailable or the code is unknown.
3081
+ */
3082
+ prCountryName: (isoCode) => {
3083
+ if (!isoCode) {
3084
+ return isoCode;
3085
+ }
3086
+ try {
3087
+ const locale = (salla?.config?.get?.('user.language_code')) || 'en';
3088
+ return new Intl.DisplayNames([locale], { type: 'region' }).of(isoCode) || isoCode;
3089
+ } catch (e) {
3090
+ return isoCode;
3091
+ }
3092
+ },
3093
+
3094
+ /** Shipping address selected in the sheet → returns a PaymentDetailsUpdate. */
3095
+ prShippingAddressChange: async function (request) {
3096
+ const address = request.shippingAddress;
3097
+ const fallback = {
3098
+ total: SallaApplePay.prTotal(),
3099
+ displayItems: SallaApplePay.prDisplayItems(),
3100
+ shippingOptions: [],
3101
+ };
3102
+
3103
+ if (!address) {
3104
+ return fallback;
3105
+ }
3106
+
3107
+ try {
3108
+ const { data } = await http.post(
3109
+ SallaApplePay.detail.shippingContactSelected.url.replace('{id}', SallaApplePay.id),
3110
+ {
3111
+ country: SallaApplePay.prCountryName(address.country),
3112
+ city: address.city,
3113
+ local: address.dependentLocality || address.region || address.city,
3114
+ description: address.region,
3115
+ street: (address.addressLine || []).join(', ') || address.region,
3116
+ country_code: address.country,
3117
+ postal_code: address.postalCode,
3118
+ }
3119
+ );
3120
+
3121
+ SallaApplePay.address_id = data.data.address_id;
3122
+ SallaApplePay.shipping_methods = data.data.shipping_methods;
3123
+
3124
+ if (!SallaApplePay.shipping_methods?.length) {
3125
+ return { ...fallback, error: salla.lang.get('pages.checkout.payment_failed') };
3126
+ }
3127
+
3128
+ await SallaApplePay.selectApplePayShippingMethod(SallaApplePay.shipping_methods[0]);
3129
+ await SallaApplePay.recalculateTotal();
3130
+
3131
+ return {
3132
+ total: SallaApplePay.prTotal(),
3133
+ displayItems: SallaApplePay.prDisplayItems(),
3134
+ shippingOptions: SallaApplePay.prShippingOptions(),
3135
+ };
3136
+ } catch (error) {
3137
+ salla.logger.warn('🍏 Pay: PR shipping address change failed', error);
3138
+ return { ...fallback, error: salla.lang.get('pages.checkout.payment_failed') };
3139
+ }
3140
+ },
3141
+
3142
+ /** Shipping option selected in the sheet → returns a PaymentDetailsUpdate. */
3143
+ prShippingOptionChange: async function (request) {
3144
+ const identifier = request.shippingOption;
3145
+ if (!identifier) {
3146
+ return {
3147
+ total: SallaApplePay.prTotal(),
3148
+ displayItems: SallaApplePay.prDisplayItems(),
3149
+ shippingOptions: SallaApplePay.prShippingOptions(),
3150
+ };
3151
+ }
3152
+
3153
+ const ids = identifier.split(',');
3154
+ const shippingMethod = {
3155
+ ship_id: ids[0],
3156
+ private_ship_id: typeof ids[1] === 'undefined' ? null : ids[1],
3157
+ type: typeof ids[2] === 'undefined' ? null : ids[2],
3158
+ route_id: typeof ids[3] === 'undefined' ? null : ids[3],
3159
+ };
3160
+
3161
+ try {
3162
+ if (SallaApplePay.shouldUpdateShippingCompany(shippingMethod)) {
3163
+ await SallaApplePay.selectApplePayShippingMethod(shippingMethod);
3164
+ await SallaApplePay.recalculateTotal();
3165
+ }
3166
+ return {
3167
+ total: SallaApplePay.prTotal(),
3168
+ displayItems: SallaApplePay.prDisplayItems(),
3169
+ shippingOptions: SallaApplePay.prShippingOptions(identifier),
3170
+ };
3171
+ } catch (error) {
3172
+ salla.logger.warn('🍏 Pay: PR shipping option change failed', error);
3173
+ return {
3174
+ total: SallaApplePay.prTotal(),
3175
+ displayItems: SallaApplePay.prDisplayItems(),
3176
+ shippingOptions: SallaApplePay.prShippingOptions(identifier),
3177
+ error: salla.lang.get('pages.checkout.payment_failed'),
3178
+ };
3179
+ }
3180
+ },
3181
+
3182
+ /** Map the PaymentResponse payer fields to the contact shape the API expects. */
3183
+ prContactFromResponse: (response) => {
3184
+ const name = (response.payerName || '').trim();
3185
+ const spaceIndex = name.indexOf(' ');
3186
+ return {
3187
+ givenName: spaceIndex > -1 ? name.slice(0, spaceIndex) : name,
3188
+ familyName: spaceIndex > -1 ? name.slice(spaceIndex + 1) : '',
3189
+ emailAddress: response.payerEmail || null,
3190
+ phoneNumber: response.payerPhone || null,
3191
+ countryCode: response.shippingAddress?.country || SallaApplePay.detail.countryCode || null,
3192
+ };
3193
+ },
3194
+
3195
+ /** Authorize + submit the payment, then close the sheet. */
3196
+ prPaymentAuthorized: async function (response) {
3197
+ // Guest checkout → persist the payer contact before submitting.
3198
+ if (SallaApplePay.detail.guestContactSelected) {
3199
+ const contact = SallaApplePay.prContactFromResponse(response);
3200
+
3201
+ // Require familyName too, mirroring the native guest guard
3202
+ // (utils.js mutateShippingContact). Keeps the payload the backend
3203
+ // receives identical to the production native flow — it has only
3204
+ // ever been sent a non-empty last_name from Apple Pay guest checkout.
3205
+ if (!contact.emailAddress || !contact.givenName || !contact.familyName || !contact.phoneNumber) {
3206
+ await response.complete('fail');
3207
+ SallaApplePay.detail.onError(salla.lang.get('common.messages.required_fields'));
3208
+ return;
3209
+ }
3210
+
3211
+ try {
3212
+ await http.post(
3213
+ SallaApplePay.detail.guestContactSelected.url.replace('{id}', SallaApplePay.id),
3214
+ {
3215
+ email: contact.emailAddress,
3216
+ first_name: contact.givenName,
3217
+ last_name: contact.familyName,
3218
+ phone_number: contact.phoneNumber,
3219
+ country_code: contact.countryCode,
3220
+ }
3221
+ );
3222
+ } catch (error) {
3223
+ await response.complete('fail');
3224
+ SallaApplePay.detail.onError(
3225
+ error?.response?.data?.error?.message || salla.lang.get('pages.checkout.payment_failed')
3226
+ );
3227
+ return;
3228
+ }
3229
+ }
3230
+
3231
+ Salla.event.dispatch('payments::apple-pay.authorized.init', response);
3232
+
3233
+ let authorizedData;
3234
+ try {
3235
+ const { data } = await http.post(
3236
+ SallaApplePay.detail.authorized.url.replace('{id}', SallaApplePay.id),
3237
+ { payment_method: 'apple_pay', applepay_token: JSON.stringify(response.details) }
3238
+ );
3239
+
3240
+ authorizedData = data;
3241
+ Salla.event.dispatch('payments::apple-pay.authorized.success', data);
3242
+ await response.complete('success');
3243
+ } catch (error) {
3244
+ const errorResponse = error?.response;
3245
+ Salla.event.dispatch('payments::apple-pay.authorized.failed', errorResponse);
3246
+ await response.complete('fail');
3247
+ if (typeof SallaApplePay.detail.authorized.onFailed === 'function') {
3248
+ SallaApplePay.detail.authorized.onFailed(errorResponse);
3249
+ }
3250
+ return;
3251
+ }
3252
+
3253
+ // response.complete() has already run above, and it can only be called
3254
+ // once. Run the merchant onSuccess callback OUTSIDE the try/catch so a
3255
+ // throw here (e.g. redirect handling) can't fall into the catch and fire
3256
+ // a second complete('fail') → InvalidStateError that masks the real error.
3257
+ if (typeof SallaApplePay.detail.authorized.onSuccess === 'function') {
3258
+ SallaApplePay.detail.authorized.onSuccess(authorizedData);
3259
+ }
3260
+ },
3261
+
2688
3262
  shouldUpdateShippingCompany(shippingCompany) {
2689
3263
  return SallaApplePay.shippingCompany?.ship_id != shippingCompany?.ship_id || SallaApplePay.shippingCompany?.private_ship_id != shippingCompany?.private_ship_id
2690
3264
  },
@@ -2808,8 +3382,10 @@ if (typeof window !== 'undefined') {
2808
3382
  }
2809
3383
 
2810
3384
  //applePay doesn't allow iframes
2811
- // SSR-safe: only initialize in browser
2812
- if (typeof window !== 'undefined' && window.ApplePaySession?.canMakePayments()) {
3385
+ // SSR-safe (init only in the browser). Native (Safari) OR any browser with the
3386
+ // Payment Request API (non-Safari / QR-code fallback) can start a transaction;
3387
+ // capability is confirmed per-flow.
3388
+ if (typeof window !== 'undefined' && (SallaApplePay.canUseNative() || window.PaymentRequest)) {
2813
3389
  SallaApplePay.init();
2814
3390
  } else if (typeof document !== 'undefined') {
2815
3391
  // You can hide the Apple Pay button easy with add data-show-if-apple-pay-supported to element like <div data-show-if-apple-pay-supported>
@@ -3024,16 +3600,12 @@ const SallaQuickBuy = class {
3024
3600
  currency: this.currency || salla.config.get('store.settings.buy_now.currency') || 'SAR', // SAR
3025
3601
  requiredShippingContactFields: this.getRequiredShippingContactFields(),
3026
3602
  shippingMethods: this.isRequireShipping ? [] : undefined,
3027
- // Legacy BE
3028
- supportedNetworks: this.isLegacyBuyNowBE()
3029
- ? salla.config.get('store.settings.buy_now.networks')
3030
- : ((Array.isArray(this.supportedNetworks) && this.supportedNetworks.length)
3031
- ? this.supportedNetworks : salla.config.get('store.settings.buy_now.supportedNetworks')),
3032
- supportedCountries: this.isLegacyBuyNowBE()
3033
- ? salla.config.get('store.settings.buy_now.countries')
3034
- : ((Array.isArray(this.supportedCountries) && this.supportedCountries.length)
3035
- ? this.supportedCountries : salla.config.get('store.settings.buy_now.supportedCountries')),
3603
+ supportedNetworks: (Array.isArray(this.supportedNetworks) && this.supportedNetworks.length)
3604
+ ? this.supportedNetworks : salla.config.get('store.settings.buy_now.supportedNetworks'),
3605
+ supportedCountries: (Array.isArray(this.supportedCountries) && this.supportedCountries.length)
3606
+ ? this.supportedCountries : salla.config.get('store.settings.buy_now.supportedCountries'),
3036
3607
  countryCode: salla.config.get('store.store_country') || 'SA',
3608
+ merchantIdentifier: applePayMerchantId(),
3037
3609
  onStartedSession: this.handleApplePaySessionStarted,
3038
3610
  validateMerchant: {
3039
3611
  url: this.validateHost ? `${this.validateHost}/checkout/applepay/validate` : salla.url.get('checkout/applepay/validate'),
@@ -3109,21 +3681,8 @@ const SallaQuickBuy = class {
3109
3681
  }
3110
3682
  return fields;
3111
3683
  }
3112
- /**
3113
- * TEMPORARY for BE Vip sync
3114
- */
3115
- isLegacyBuyNowBE() {
3116
- return salla?.config?.get?.('store.settings.buy_now.multi_currency') != null;
3117
- }
3118
3684
  /** Set Apple Pay amount + currency from a price payload, always keeping the pair in one currency. */
3119
3685
  applyBaseCurrencyPrice(data) {
3120
- // Legacy BE: amount only; currency is set once in runInit.
3121
- if (this.isLegacyBuyNowBE()) {
3122
- if (data?.price != null) {
3123
- this.amount = data.price;
3124
- }
3125
- return;
3126
- }
3127
3686
  const base = data?.base_currency_price;
3128
3687
  // Unified BE base pair (regular products): charge in base currency.
3129
3688
  if (base?.amount != null) {
@@ -3145,11 +3704,6 @@ const SallaQuickBuy = class {
3145
3704
  const isSallaGateway = salla?.config?.get?.('store.settings.is_salla_gateway', false) ?? true;
3146
3705
  this.isApplePayActive = canMakePayments && storeHasApplePay && isSallaGateway;
3147
3706
  const runInit = async () => {
3148
- if (this.isLegacyBuyNowBE() && !this.currency && salla?.config?.get) {
3149
- // Legacy BE (pre-PR): currency from the multi_currency flag. The unified BE instead
3150
- // sources amount + currency from `base_currency_price` (see applyBaseCurrencyPrice).
3151
- this.currency = salla.config.get('store.settings.buy_now.multi_currency') ? salla.config.get('user.currency_code') : (salla.config.get('store.settings.buy_now.currency') || 'SAR');
3152
- }
3153
3707
  if (!this.productId && salla?.config?.get && salla.url?.is_page) {
3154
3708
  this.productId = salla.config.get('page.id');
3155
3709
  }
@@ -3175,16 +3729,19 @@ const SallaQuickBuy = class {
3175
3729
  else if (salla?.url?.is_page?.('product.single') && salla?.product?.event?.onPriceUpdated) {
3176
3730
  salla.product.event.onPriceUpdated(response => { this.applyBaseCurrencyPrice(response?.data); });
3177
3731
  }
3178
- this.isApplePayActive = (salla?.helpers?.hasApplePay?.() ?? canMakePayments)
3179
- && (salla?.config?.get?.('store.settings.payments')?.includes?.('apple_pay') ?? storeHasApplePay)
3732
+ const storeAllowsApplePay = (salla?.config?.get?.('store.settings.payments')?.includes?.('apple_pay') ?? storeHasApplePay)
3180
3733
  && (salla?.config?.get?.('store.settings.is_salla_gateway', false) ?? isSallaGateway);
3181
- if (!document.getElementById('apple-pay-sdk') && this.isApplePayActive) {
3182
- const script = document.createElement('script');
3183
- script.src = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';
3184
- script.setAttribute('id', 'apple-pay-sdk');
3185
- script.async = true;
3186
- document.body.appendChild(script);
3187
- }
3734
+ // Preload Apple's JS SDK so the rendered <apple-pay-button> upgrades on
3735
+ // every flow (native Safari + QR). Fire-and-forget: the element upgrades
3736
+ // retroactively once the script defines it.
3737
+ if (storeAllowsApplePay) {
3738
+ ensureApplePaySdk();
3739
+ }
3740
+ // Cross-browser capability: native (Safari) OR the Payment Request API
3741
+ // (non-Safari browsers / non-Apple devices via the QR-code fallback). The
3742
+ // helper loads Apple's JS SDK and awaits it before probing, so this is a
3743
+ // stable answer on first load (no race against the async script fetch).
3744
+ this.isApplePayActive = storeAllowsApplePay && await canCompleteApplePay(this.currency);
3188
3745
  };
3189
3746
  return new Promise((resolve) => {
3190
3747
  if (typeof salla?.onReady === 'function') {
@@ -3196,7 +3753,7 @@ const SallaQuickBuy = class {
3196
3753
  });
3197
3754
  }
3198
3755
  render() {
3199
- return index.h(index.Host, { key: 'c2ba63eb4fad49f80977d6f1adc836f655524933' }, this.quickBuyButton());
3756
+ return index.h(index.Host, { key: '100f3cd501d568084f3596f5cef7c9b744f7ec82' }, this.quickBuyButton());
3200
3757
  }
3201
3758
  quickBuyButton() {
3202
3759
  return index.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 });