@salla.sa/twilight-components 2.14.393 → 2.14.394

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 (555) hide show
  1. package/dist/cjs/{filepond-D7RVR_w_.js → filepond-C_gLbAbF.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-DTuZK2ot.js → filepond-plugin-file-poster-DXWo2FUU.js} +2 -2
  3. package/dist/cjs/{filepond-plugin-file-validate-size-DHc6pF_j.js → filepond-plugin-file-validate-size-fBXMP7ez.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DnkcvJVc.js → filepond-plugin-file-validate-type-DEo7juC7.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-vrZ1s7kw.js → filepond-plugin-image-edit-4j4e1VEp.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-Bn5JSzQK.js → filepond-plugin-image-exif-orientation-DWqiXxv1.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-8qWUFe9n.js → filepond-plugin-image-preview-emT_teia.js} +1 -1
  8. package/dist/cjs/{index-C5VeFDQ0.js → index-B03mYCWz.js} +547 -780
  9. package/dist/cjs/{index-CwD81m7i.js → index-Y-2uyQDK.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +3 -4
  11. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +5 -5
  12. package/dist/cjs/salla-accordion_6.cjs.entry.js +15 -19
  13. package/dist/cjs/salla-add-product-button_4.cjs.entry.js +10 -12
  14. package/dist/cjs/salla-advertisement.cjs.entry.js +3 -3
  15. package/dist/cjs/salla-alert_2.cjs.entry.js +5 -5
  16. package/dist/cjs/salla-app-install-alert.cjs.entry.js +3 -3
  17. package/dist/cjs/salla-apps-icons.cjs.entry.js +3 -3
  18. package/dist/cjs/salla-booking-field_7.cjs.entry.js +23 -25
  19. package/dist/cjs/salla-bullet-delivery.cjs.entry.js +3 -3
  20. package/dist/cjs/salla-cart-coupons.cjs.entry.js +3 -3
  21. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +5 -5
  22. package/dist/cjs/salla-comment-form_8.cjs.entry.js +17 -17
  23. package/dist/cjs/salla-conditional-offer.cjs.entry.js +3 -3
  24. package/dist/cjs/salla-contacts.cjs.entry.js +3 -3
  25. package/dist/cjs/salla-cookies-bar.cjs.entry.js +3 -3
  26. package/dist/cjs/salla-count-down.cjs.entry.js +3 -3
  27. package/dist/cjs/salla-custom-fields.cjs.entry.js +3 -3
  28. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-filters-widget.cjs.entry.js +3 -3
  30. package/dist/cjs/salla-filters.cjs.entry.js +3 -3
  31. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-gifting.cjs.entry.js +3 -3
  33. package/dist/cjs/salla-hook.cjs.entry.js +2 -5
  34. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +3 -3
  35. package/dist/cjs/salla-installment.cjs.entry.js +3 -3
  36. package/dist/cjs/salla-list-tile.cjs.entry.js +3 -3
  37. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-login-modal.cjs.entry.js +3 -3
  39. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +3 -3
  40. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  41. package/dist/cjs/salla-loyalty.cjs.entry.js +3 -3
  42. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +3 -3
  43. package/dist/cjs/salla-map.cjs.entry.js +3 -3
  44. package/dist/cjs/salla-menu.cjs.entry.js +3 -3
  45. package/dist/cjs/salla-metadata.cjs.entry.js +3 -3
  46. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +5 -5
  47. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +6 -8
  48. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +4 -6
  49. package/dist/cjs/salla-notification-item.cjs.entry.js +3 -3
  50. package/dist/cjs/salla-notifications.cjs.entry.js +3 -3
  51. package/dist/cjs/salla-offer-modal.cjs.entry.js +3 -3
  52. package/dist/cjs/salla-offer.cjs.entry.js +3 -3
  53. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +3 -3
  54. package/dist/cjs/salla-order-details-options.cjs.entry.js +3 -3
  55. package/dist/cjs/salla-order-details.cjs.entry.js +4 -6
  56. package/dist/cjs/salla-order-edit-item.cjs.entry.js +3 -3
  57. package/dist/cjs/salla-order-edit.cjs.entry.js +3 -3
  58. package/dist/cjs/salla-order-summary.cjs.entry.js +3 -3
  59. package/dist/cjs/salla-order-totals-card.cjs.entry.js +4 -6
  60. package/dist/cjs/salla-orders.cjs.entry.js +3 -3
  61. package/dist/cjs/salla-payments.cjs.entry.js +3 -3
  62. package/dist/cjs/salla-placeholder.cjs.entry.js +3 -3
  63. package/dist/cjs/salla-price-range.cjs.entry.js +3 -3
  64. package/dist/cjs/salla-product-card.cjs.entry.js +3 -3
  65. package/dist/cjs/salla-product-size-guide.cjs.entry.js +3 -3
  66. package/dist/cjs/salla-products-list.cjs.entry.js +3 -3
  67. package/dist/cjs/salla-products-slider.cjs.entry.js +3 -3
  68. package/dist/cjs/salla-progress-bar.cjs.entry.js +3 -3
  69. package/dist/cjs/salla-quick-order.cjs.entry.js +3 -3
  70. package/dist/cjs/salla-rating-modal.cjs.entry.js +3 -3
  71. package/dist/cjs/salla-scopes.cjs.entry.js +3 -3
  72. package/dist/cjs/salla-search.cjs.entry.js +4 -6
  73. package/dist/cjs/salla-skeleton.cjs.entry.js +3 -3
  74. package/dist/cjs/salla-slider.cjs.entry.js +3 -3
  75. package/dist/cjs/salla-social-share.cjs.entry.js +3 -3
  76. package/dist/cjs/salla-social.cjs.entry.js +3 -3
  77. package/dist/cjs/salla-tab-content_3.cjs.entry.js +7 -7
  78. package/dist/cjs/salla-tiered-offer.cjs.entry.js +3 -3
  79. package/dist/cjs/salla-tooltip.cjs.entry.js +3 -3
  80. package/dist/cjs/salla-trust-badges.cjs.entry.js +3 -3
  81. package/dist/cjs/salla-user-menu.cjs.entry.js +3 -3
  82. package/dist/cjs/salla-user-profile.cjs.entry.js +3 -3
  83. package/dist/cjs/salla-user-settings.cjs.entry.js +3 -3
  84. package/dist/cjs/salla-verify.cjs.entry.js +3 -3
  85. package/dist/cjs/salla-wallet.cjs.entry.js +3 -3
  86. package/dist/cjs/twilight.cjs.js +4 -5
  87. package/dist/cjs/{vanilla-picker-yKERbLpx.js → vanilla-picker-CKZvBtHS.js} +1 -1
  88. package/dist/collection/collection-manifest.json +2 -3
  89. package/dist/collection/components/salla-accordion/salla-accordion-head.js +2 -2
  90. package/dist/collection/components/salla-accordion/salla-accordion.js +4 -4
  91. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +19 -19
  92. package/dist/collection/components/salla-alert/salla-alert.js +5 -5
  93. package/dist/collection/components/salla-apps-icons/salla-apps-icons.js +6 -6
  94. package/dist/collection/components/salla-booking-field/salla-booking-field.js +4 -4
  95. package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +9 -9
  96. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +3 -6
  97. package/dist/collection/components/salla-button/salla-button.js +11 -11
  98. package/dist/collection/components/salla-cart-coupons/salla-cart-coupons.js +1 -2
  99. package/dist/collection/components/salla-cart-item-offers/salla-cart-item-offers.js +8 -8
  100. package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +2 -2
  101. package/dist/collection/components/salla-color-picker/salla-color-picker.js +14 -20
  102. package/dist/collection/components/salla-comment-form/salla-comment-form.js +6 -6
  103. package/dist/collection/components/salla-comments/salla-comment-item.js +3 -2
  104. package/dist/collection/components/salla-comments/salla-comments.js +17 -18
  105. package/dist/collection/components/salla-contacts/salla-contacts.js +10 -10
  106. package/dist/collection/components/salla-count-down/salla-count-down.js +34 -34
  107. package/dist/collection/components/salla-custom-fields/salla-custom-fields.js +7 -9
  108. package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +65 -69
  109. package/dist/collection/components/salla-drawer/salla-drawer.js +11 -11
  110. package/dist/collection/components/salla-file-upload/salla-file-upload.js +84 -85
  111. package/dist/collection/components/salla-filters/salla-filters.js +2 -2
  112. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +5 -4
  113. package/dist/collection/components/salla-gifting/salla-gifting.js +11 -11
  114. package/dist/collection/components/salla-hook/salla-hook.js +2 -2
  115. package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.js +6 -6
  116. package/dist/collection/components/salla-installment/salla-installment.js +5 -5
  117. package/dist/collection/components/salla-list-tile/salla-list-tile.js +2 -2
  118. package/dist/collection/components/salla-loading/salla-loading.js +4 -4
  119. package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +5 -5
  120. package/dist/collection/components/salla-login-modal/salla-login-modal.js +14 -14
  121. package/dist/collection/components/salla-loyalty/salla-loyalty-prize-item.js +3 -4
  122. package/dist/collection/components/salla-loyalty/salla-loyalty.js +12 -13
  123. package/dist/collection/components/salla-map/salla-map.js +14 -14
  124. package/dist/collection/components/salla-menu/salla-menu.js +9 -10
  125. package/dist/collection/components/salla-metadata/salla-metadata.js +3 -3
  126. package/dist/collection/components/salla-modal/salla-modal.js +11 -11
  127. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +2 -2
  128. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +2 -2
  129. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +2 -4
  130. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +7 -8
  131. package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +2 -2
  132. package/dist/collection/components/salla-notifications/salla-notification-item.js +2 -2
  133. package/dist/collection/components/salla-notifications/salla-notifications.js +3 -3
  134. package/dist/collection/components/salla-offer/salla-offer.js +1 -1
  135. package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.js +5 -5
  136. package/dist/collection/components/salla-order-details/salla-order-details-options.js +5 -6
  137. package/dist/collection/components/salla-order-details/salla-order-details.js +3 -4
  138. package/dist/collection/components/salla-order-edit/salla-order-edit-item.js +4 -4
  139. package/dist/collection/components/salla-order-edit/salla-order-edit.js +4 -4
  140. package/dist/collection/components/salla-order-summary/salla-order-summary.js +2 -2
  141. package/dist/collection/components/salla-order-totals-card/salla-order-totals-card.js +3 -4
  142. package/dist/collection/components/salla-orders/salla-orders.js +4 -4
  143. package/dist/collection/components/salla-payments/salla-payments.js +1 -0
  144. package/dist/collection/components/salla-placeholder/salla-placeholder.js +3 -3
  145. package/dist/collection/components/salla-price-range/salla-price-range.js +8 -8
  146. package/dist/collection/components/salla-product-availability/salla-product-availability.js +6 -6
  147. package/dist/collection/components/salla-product-card/salla-product-card.js +18 -18
  148. package/dist/collection/components/salla-product-options/salla-product-options.js +13 -15
  149. package/dist/collection/components/salla-products-list/salla-products-list.js +21 -20
  150. package/dist/collection/components/salla-products-slider/salla-products-slider.js +23 -22
  151. package/dist/collection/components/salla-progress-bar/salla-progress-bar.js +20 -21
  152. package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +2 -2
  153. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +17 -16
  154. package/dist/collection/components/salla-quick-order/salla-quick-order.js +11 -11
  155. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +2 -2
  156. package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +8 -8
  157. package/dist/collection/components/salla-review-card/salla-review-card.js +3 -3
  158. package/dist/collection/components/salla-reviews/salla-reviews.js +13 -16
  159. package/dist/collection/components/salla-reviews-summary/salla-reviews-summary.js +2 -2
  160. package/dist/collection/components/salla-scopes/salla-scopes.js +2 -2
  161. package/dist/collection/components/salla-search/salla-search.js +6 -6
  162. package/dist/collection/components/salla-skeleton/salla-skeleton.js +3 -3
  163. package/dist/collection/components/salla-slider/salla-slider.js +25 -25
  164. package/dist/collection/components/salla-social-share/salla-social-share.js +3 -3
  165. package/dist/collection/components/salla-tabs/salla-tab-content.js +2 -2
  166. package/dist/collection/components/salla-tabs/salla-tab-header.js +5 -5
  167. package/dist/collection/components/salla-tabs/salla-tabs.js +2 -2
  168. package/dist/collection/components/salla-tel-input/salla-tel-input.js +8 -9
  169. package/dist/collection/components/salla-tooltip/salla-tooltip.js +5 -5
  170. package/dist/collection/components/salla-trust-badges/salla-trust-badges.js +1 -1
  171. package/dist/collection/components/salla-user-menu/salla-user-menu.js +5 -5
  172. package/dist/collection/components/salla-user-profile/salla-user-profile.js +1 -1
  173. package/dist/collection/components/salla-verify/salla-verify.js +4 -4
  174. package/dist/components/Helper.js +432 -1
  175. package/dist/components/_commonjsHelpers.js +7 -1
  176. package/dist/components/anime.es.js +1310 -1
  177. package/dist/components/arrow-left.js +8 -1
  178. package/dist/components/axios.js +4240 -2
  179. package/dist/components/bell-ring.js +8 -1
  180. package/dist/components/camera.js +8 -1
  181. package/dist/components/cancel.js +8 -1
  182. package/dist/components/cart.js +8 -1
  183. package/dist/components/check-circle2.js +15 -1
  184. package/dist/components/check.js +8 -1
  185. package/dist/components/facebook.js +10 -1
  186. package/dist/components/filepond-plugin-file-poster.js +662 -2
  187. package/dist/components/filepond-plugin-file-validate-size.js +204 -2
  188. package/dist/components/filepond-plugin-file-validate-type.js +262 -2
  189. package/dist/components/filepond-plugin-image-edit.js +487 -2
  190. package/dist/components/filepond-plugin-image-exif-orientation.js +214 -2
  191. package/dist/components/filepond-plugin-image-preview.js +2237 -2
  192. package/dist/components/filepond.js +11286 -2
  193. package/dist/components/gift.js +8 -1
  194. package/dist/components/image.js +8 -1
  195. package/dist/components/index.d.ts +0 -2
  196. package/dist/components/index.js +8220 -1
  197. package/dist/components/index2.js +1709 -1
  198. package/dist/components/index3.js +2550 -1
  199. package/dist/components/interfaces.js +12 -1
  200. package/dist/components/isObject.js +292 -1
  201. package/dist/components/keyboard_arrow_down.js +8 -1
  202. package/dist/components/keyboard_arrow_right.js +15 -1
  203. package/dist/components/location.js +11 -1
  204. package/dist/components/mail.js +8 -1
  205. package/dist/components/minus.js +15 -1
  206. package/dist/components/salla-accordion-body.js +6 -1
  207. package/dist/components/salla-accordion-body2.js +30 -1
  208. package/dist/components/salla-accordion-head.js +6 -1
  209. package/dist/components/salla-accordion-head2.js +63 -1
  210. package/dist/components/salla-accordion.js +6 -1
  211. package/dist/components/salla-accordion2.js +68 -1
  212. package/dist/components/salla-add-product-button.js +6 -1
  213. package/dist/components/salla-add-product-button2.js +306 -1
  214. package/dist/components/salla-advertisement.js +155 -1
  215. package/dist/components/salla-alert.js +59 -1
  216. package/dist/components/salla-app-install-alert.js +91 -1
  217. package/dist/components/salla-apps-icons.js +63 -1
  218. package/dist/components/salla-booking-field.js +6 -1
  219. package/dist/components/salla-booking-field2.js +221 -1
  220. package/dist/components/salla-bottom-alert.js +214 -1
  221. package/dist/components/salla-breadcrumb.js +226 -1
  222. package/dist/components/salla-bullet-delivery.js +2114 -1
  223. package/dist/components/salla-button.js +6 -1
  224. package/dist/components/salla-button2.js +174 -1
  225. package/dist/components/salla-cart-coupons.js +284 -1
  226. package/dist/components/salla-cart-item-offers.js +143 -1
  227. package/dist/components/salla-cart-summary.js +136 -1
  228. package/dist/components/salla-color-picker.js +6 -1
  229. package/dist/components/salla-color-picker2.js +260 -1
  230. package/dist/components/salla-comment-form.js +6 -1
  231. package/dist/components/salla-comment-form2.js +64 -1
  232. package/dist/components/salla-comment-item.js +6 -1
  233. package/dist/components/salla-comment-item2.js +217 -1
  234. package/dist/components/salla-comments.js +395 -1
  235. package/dist/components/salla-conditional-fields.js +6 -1
  236. package/dist/components/salla-conditional-fields2.js +137 -1
  237. package/dist/components/salla-conditional-offer.js +194 -1
  238. package/dist/components/salla-contacts.js +125 -1
  239. package/dist/components/salla-cookies-bar.js +107 -1
  240. package/dist/components/salla-count-down.js +6 -1
  241. package/dist/components/salla-count-down2.js +271 -1
  242. package/dist/components/salla-custom-fields.js +175 -1
  243. package/dist/components/salla-datetime-picker.js +6 -1
  244. package/dist/components/salla-datetime-picker2.js +342 -1
  245. package/dist/components/salla-delivery-promise.js +263 -1
  246. package/dist/components/salla-drawer.js +6 -1
  247. package/dist/components/salla-drawer2.js +214 -1
  248. package/dist/components/salla-file-upload.js +6 -1
  249. package/dist/components/salla-file-upload2.js +583 -1
  250. package/dist/components/salla-filters-widget.js +6 -1
  251. package/dist/components/salla-filters-widget2.js +245 -1
  252. package/dist/components/salla-filters.js +253 -1
  253. package/dist/components/salla-fulfillment-methods.js +61 -1
  254. package/dist/components/salla-gifting.js +732 -1
  255. package/dist/components/salla-hook.js +47 -1
  256. package/dist/components/salla-infinite-scroll.js +112 -1
  257. package/dist/components/salla-installment.js +306 -1
  258. package/dist/components/salla-list-tile.js +6 -1
  259. package/dist/components/salla-list-tile2.js +47 -1
  260. package/dist/components/salla-loading.js +6 -1
  261. package/dist/components/salla-loading2.js +51 -1
  262. package/dist/components/salla-localization-modal.js +296 -1
  263. package/dist/components/salla-login-modal.js +6 -1
  264. package/dist/components/salla-login-modal2.js +359 -1
  265. package/dist/components/salla-loyalty-prize-item.js +39 -1
  266. package/dist/components/salla-loyalty-program.js +115 -1
  267. package/dist/components/salla-loyalty.js +304 -1
  268. package/dist/components/salla-maintenance-alert.js +57 -1
  269. package/dist/components/salla-map.js +6 -1
  270. package/dist/components/salla-map2.js +766 -1
  271. package/dist/components/salla-menu.js +165 -1
  272. package/dist/components/salla-metadata.js +97 -1
  273. package/dist/components/salla-modal.js +6 -1
  274. package/dist/components/salla-modal2.js +215 -1
  275. package/dist/components/salla-multiple-bundle-product-cart.js +6 -1
  276. package/dist/components/salla-multiple-bundle-product-cart2.js +151 -1
  277. package/dist/components/salla-multiple-bundle-product-details.js +6 -1
  278. package/dist/components/salla-multiple-bundle-product-details2.js +296 -1
  279. package/dist/components/salla-multiple-bundle-product-options-modal.js +6 -1
  280. package/dist/components/salla-multiple-bundle-product-options-modal2.js +598 -1
  281. package/dist/components/salla-multiple-bundle-product-slider.js +6 -1
  282. package/dist/components/salla-multiple-bundle-product-slider2.js +136 -1
  283. package/dist/components/salla-multiple-bundle-product.js +207 -1
  284. package/dist/components/salla-notification-item.js +6 -1
  285. package/dist/components/salla-notification-item2.js +32 -1
  286. package/dist/components/salla-notifications.js +190 -1
  287. package/dist/components/salla-offer-modal.js +328 -1
  288. package/dist/components/salla-offer.js +478 -1
  289. package/dist/components/salla-order-details-multiple-bundle-product.js +6 -1
  290. package/dist/components/salla-order-details-multiple-bundle-product2.js +122 -1
  291. package/dist/components/salla-order-details-options.js +6 -1
  292. package/dist/components/salla-order-details-options2.js +140 -1
  293. package/dist/components/salla-order-details.js +122 -1
  294. package/dist/components/salla-order-edit-item.js +6 -1
  295. package/dist/components/salla-order-edit-item2.js +181 -1
  296. package/dist/components/salla-order-edit.js +288 -1
  297. package/dist/components/salla-order-summary.js +132 -1
  298. package/dist/components/salla-order-totals-card.js +87 -1
  299. package/dist/components/salla-orders.js +271 -1
  300. package/dist/components/salla-payments.js +76 -1
  301. package/dist/components/salla-placeholder.js +6 -1
  302. package/dist/components/salla-placeholder2.js +66 -1
  303. package/dist/components/salla-price-range.js +6 -1
  304. package/dist/components/salla-price-range2.js +204 -1
  305. package/dist/components/salla-product-availability.js +6 -1
  306. package/dist/components/salla-product-availability2.js +206 -1
  307. package/dist/components/salla-product-card.js +6 -1
  308. package/dist/components/salla-product-card2.js +241 -1
  309. package/dist/components/salla-product-options.js +6 -1
  310. package/dist/components/salla-product-options2.js +962 -1
  311. package/dist/components/salla-product-size-guide.js +130 -1
  312. package/dist/components/salla-products-list.js +6 -1
  313. package/dist/components/salla-products-list2.js +812 -1
  314. package/dist/components/salla-products-slider.js +6 -1
  315. package/dist/components/salla-products-slider2.js +215 -1
  316. package/dist/components/salla-progress-bar.js +6 -1
  317. package/dist/components/salla-progress-bar2.js +94 -1
  318. package/dist/components/salla-quantity-input.js +6 -1
  319. package/dist/components/salla-quantity-input2.js +127 -1
  320. package/dist/components/salla-quick-buy.js +6 -1
  321. package/dist/components/salla-quick-buy2.js +1181 -1
  322. package/dist/components/salla-quick-order.js +299 -1
  323. package/dist/components/salla-rating-modal.js +530 -1
  324. package/dist/components/salla-rating-stars.js +6 -1
  325. package/dist/components/salla-rating-stars2.js +162 -1
  326. package/dist/components/salla-review-card.js +6 -1
  327. package/dist/components/salla-review-card2.js +198 -1
  328. package/dist/components/salla-reviews-page.js +726 -1
  329. package/dist/components/salla-reviews-summary.js +6 -1
  330. package/dist/components/salla-reviews-summary2.js +132 -1
  331. package/dist/components/salla-reviews.js +143 -1
  332. package/dist/components/salla-scopes.js +249 -1
  333. package/dist/components/salla-search.js +213 -1
  334. package/dist/components/salla-skeleton.js +6 -1
  335. package/dist/components/salla-skeleton2.js +50 -1
  336. package/dist/components/salla-slider.js +6 -1
  337. package/dist/components/salla-slider2.js +10489 -1
  338. package/dist/components/salla-social-share.js +194 -1
  339. package/dist/components/salla-social.js +89 -1
  340. package/dist/components/salla-tab-content.js +6 -1
  341. package/dist/components/salla-tab-content2.js +55 -1
  342. package/dist/components/salla-tab-header.js +6 -1
  343. package/dist/components/salla-tab-header2.js +85 -1
  344. package/dist/components/salla-tabs.js +6 -1
  345. package/dist/components/salla-tabs2.js +75 -1
  346. package/dist/components/salla-tel-input.js +6 -1
  347. package/dist/components/salla-tel-input2.js +168 -1
  348. package/dist/components/salla-tiered-offer.js +366 -1
  349. package/dist/components/salla-tooltip.js +6 -1
  350. package/dist/components/salla-tooltip2.js +57 -1
  351. package/dist/components/salla-trust-badges.js +90 -1
  352. package/dist/components/salla-user-menu.js +344 -1
  353. package/dist/components/salla-user-profile.js +203 -1
  354. package/dist/components/salla-user-settings.js +139 -1
  355. package/dist/components/salla-verify.js +303 -1
  356. package/dist/components/salla-wallet.js +114 -1
  357. package/dist/components/search.js +8 -1
  358. package/dist/components/shopping-bag.js +8 -1
  359. package/dist/components/special-discount.js +8 -1
  360. package/dist/components/star.js +8 -1
  361. package/dist/components/star2.js +8 -1
  362. package/dist/components/vanilla-picker.js +1034 -2
  363. package/dist/components/whatsapp2.js +8 -1
  364. package/dist/esm/{filepond-DlGaLh8N.js → filepond-Be7JObSq.js} +1 -1
  365. package/dist/esm/{filepond-plugin-file-poster-BTVFYcQx.js → filepond-plugin-file-poster-DF0NWKCQ.js} +2 -2
  366. package/dist/esm/{filepond-plugin-file-validate-size-DGryLmWv.js → filepond-plugin-file-validate-size-DJFlJHtE.js} +1 -1
  367. package/dist/esm/{filepond-plugin-file-validate-type-DxKfCD0V.js → filepond-plugin-file-validate-type-DykpLW1Z.js} +1 -1
  368. package/dist/esm/{filepond-plugin-image-edit-2W7pu9hn.js → filepond-plugin-image-edit-CyIHxrnW.js} +1 -1
  369. package/dist/esm/{filepond-plugin-image-exif-orientation-OQu-IvPH.js → filepond-plugin-image-exif-orientation-DbCOAhSu.js} +1 -1
  370. package/dist/esm/{filepond-plugin-image-preview-DEW_tSNR.js → filepond-plugin-image-preview-CGRGZcft.js} +1 -1
  371. package/dist/esm/{index-DYB20YqN.js → index-Cz6cYzxG.js} +547 -780
  372. package/dist/esm/{index-BDqMkCqE.js → index-_kPnZdm0.js} +1 -1
  373. package/dist/esm/loader.js +3 -4
  374. package/dist/esm/salla-accordion-body_2.entry.js +5 -5
  375. package/dist/esm/salla-accordion_6.entry.js +15 -19
  376. package/dist/esm/salla-add-product-button_4.entry.js +10 -12
  377. package/dist/esm/salla-advertisement.entry.js +3 -3
  378. package/dist/esm/salla-alert_2.entry.js +5 -5
  379. package/dist/esm/salla-app-install-alert.entry.js +3 -3
  380. package/dist/esm/salla-apps-icons.entry.js +3 -3
  381. package/dist/esm/salla-booking-field_7.entry.js +23 -25
  382. package/dist/esm/salla-bullet-delivery.entry.js +3 -3
  383. package/dist/esm/salla-cart-coupons.entry.js +3 -3
  384. package/dist/esm/salla-cart-item-offers_2.entry.js +5 -5
  385. package/dist/esm/salla-comment-form_8.entry.js +17 -17
  386. package/dist/esm/salla-conditional-offer.entry.js +3 -3
  387. package/dist/esm/salla-contacts.entry.js +3 -3
  388. package/dist/esm/salla-cookies-bar.entry.js +3 -3
  389. package/dist/esm/salla-count-down.entry.js +3 -3
  390. package/dist/esm/salla-custom-fields.entry.js +3 -3
  391. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  392. package/dist/esm/salla-filters-widget.entry.js +3 -3
  393. package/dist/esm/salla-filters.entry.js +3 -3
  394. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  395. package/dist/esm/salla-gifting.entry.js +3 -3
  396. package/dist/esm/salla-hook.entry.js +2 -5
  397. package/dist/esm/salla-infinite-scroll.entry.js +3 -3
  398. package/dist/esm/salla-installment.entry.js +3 -3
  399. package/dist/esm/salla-list-tile.entry.js +3 -3
  400. package/dist/esm/salla-localization-modal.entry.js +1 -1
  401. package/dist/esm/salla-login-modal.entry.js +3 -3
  402. package/dist/esm/salla-loyalty-prize-item.entry.js +3 -3
  403. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  404. package/dist/esm/salla-loyalty.entry.js +3 -3
  405. package/dist/esm/salla-maintenance-alert.entry.js +3 -3
  406. package/dist/esm/salla-map.entry.js +3 -3
  407. package/dist/esm/salla-menu.entry.js +3 -3
  408. package/dist/esm/salla-metadata.entry.js +3 -3
  409. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +5 -5
  410. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +6 -8
  411. package/dist/esm/salla-multiple-bundle-product.entry.js +4 -6
  412. package/dist/esm/salla-notification-item.entry.js +3 -3
  413. package/dist/esm/salla-notifications.entry.js +3 -3
  414. package/dist/esm/salla-offer-modal.entry.js +3 -3
  415. package/dist/esm/salla-offer.entry.js +3 -3
  416. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +3 -3
  417. package/dist/esm/salla-order-details-options.entry.js +3 -3
  418. package/dist/esm/salla-order-details.entry.js +4 -6
  419. package/dist/esm/salla-order-edit-item.entry.js +3 -3
  420. package/dist/esm/salla-order-edit.entry.js +3 -3
  421. package/dist/esm/salla-order-summary.entry.js +3 -3
  422. package/dist/esm/salla-order-totals-card.entry.js +4 -6
  423. package/dist/esm/salla-orders.entry.js +3 -3
  424. package/dist/esm/salla-payments.entry.js +3 -3
  425. package/dist/esm/salla-placeholder.entry.js +3 -3
  426. package/dist/esm/salla-price-range.entry.js +3 -3
  427. package/dist/esm/salla-product-card.entry.js +3 -3
  428. package/dist/esm/salla-product-size-guide.entry.js +3 -3
  429. package/dist/esm/salla-products-list.entry.js +3 -3
  430. package/dist/esm/salla-products-slider.entry.js +3 -3
  431. package/dist/esm/salla-progress-bar.entry.js +3 -3
  432. package/dist/esm/salla-quick-order.entry.js +3 -3
  433. package/dist/esm/salla-rating-modal.entry.js +3 -3
  434. package/dist/esm/salla-scopes.entry.js +3 -3
  435. package/dist/esm/salla-search.entry.js +4 -6
  436. package/dist/esm/salla-skeleton.entry.js +3 -3
  437. package/dist/esm/salla-slider.entry.js +3 -3
  438. package/dist/esm/salla-social-share.entry.js +3 -3
  439. package/dist/esm/salla-social.entry.js +3 -3
  440. package/dist/esm/salla-tab-content_3.entry.js +7 -7
  441. package/dist/esm/salla-tiered-offer.entry.js +3 -3
  442. package/dist/esm/salla-tooltip.entry.js +3 -3
  443. package/dist/esm/salla-trust-badges.entry.js +3 -3
  444. package/dist/esm/salla-user-menu.entry.js +3 -3
  445. package/dist/esm/salla-user-profile.entry.js +3 -3
  446. package/dist/esm/salla-user-settings.entry.js +3 -3
  447. package/dist/esm/salla-verify.entry.js +3 -3
  448. package/dist/esm/salla-wallet.entry.js +3 -3
  449. package/dist/esm/twilight.js +4 -5
  450. package/dist/esm/{vanilla-picker-Dt9vZPZF.js → vanilla-picker-C_YV5LtA.js} +1 -1
  451. package/dist/twilight/{p-33779828.entry.js → p-0200cddd.entry.js} +1 -1
  452. package/dist/twilight/p-04dc0b71.entry.js +4 -0
  453. package/dist/twilight/{p-105b1dab.entry.js → p-0bac200e.entry.js} +1 -1
  454. package/dist/twilight/{p-ccfe5308.entry.js → p-0ef99df1.entry.js} +1 -1
  455. package/dist/twilight/{p-647b6d76.entry.js → p-1087f0dd.entry.js} +1 -1
  456. package/dist/twilight/{p-1875537e.entry.js → p-17dd8b68.entry.js} +1 -1
  457. package/dist/twilight/{p-aa7c5de0.entry.js → p-25a9bf1b.entry.js} +1 -1
  458. package/dist/twilight/{p-34b670fc.entry.js → p-2602927d.entry.js} +1 -1
  459. package/dist/twilight/p-268695ff.entry.js +4 -0
  460. package/dist/twilight/{p-aaa0c743.entry.js → p-34920aac.entry.js} +1 -1
  461. package/dist/twilight/{p-817b8ba5.entry.js → p-3656b48d.entry.js} +1 -1
  462. package/dist/twilight/{p-4932857d.entry.js → p-3857beb4.entry.js} +1 -1
  463. package/dist/twilight/{p-af3c74f4.entry.js → p-39c601e3.entry.js} +1 -1
  464. package/dist/twilight/{p-b598c0f7.entry.js → p-3c810881.entry.js} +1 -1
  465. package/dist/twilight/{p-d371d450.entry.js → p-3cf5c61f.entry.js} +1 -1
  466. package/dist/twilight/{p-3ccc532d.entry.js → p-413a7236.entry.js} +1 -1
  467. package/dist/twilight/{p-f176d41d.entry.js → p-42778349.entry.js} +1 -1
  468. package/dist/twilight/{p-b17d055d.entry.js → p-45e4f6f4.entry.js} +1 -1
  469. package/dist/twilight/{p-2abaa633.entry.js → p-4680956b.entry.js} +1 -1
  470. package/dist/twilight/{p-96a20515.entry.js → p-468b999f.entry.js} +1 -1
  471. package/dist/twilight/{p-df6853b5.entry.js → p-46d1823f.entry.js} +1 -1
  472. package/dist/twilight/{p-c87951a2.entry.js → p-49db497f.entry.js} +1 -1
  473. package/dist/twilight/{p-18bb0181.entry.js → p-4b033276.entry.js} +1 -1
  474. package/dist/twilight/{p-296d2dd0.entry.js → p-4f7bc9c3.entry.js} +1 -1
  475. package/dist/twilight/{p-4fa4547a.entry.js → p-543ee624.entry.js} +1 -1
  476. package/dist/twilight/{p-2fe01e44.entry.js → p-5957f774.entry.js} +1 -1
  477. package/dist/twilight/{p-96e78428.entry.js → p-5a4f0b99.entry.js} +1 -1
  478. package/dist/twilight/{p-87c0ca91.entry.js → p-5a8c0fd2.entry.js} +1 -1
  479. package/dist/twilight/{p-e28c0773.entry.js → p-5ab7a295.entry.js} +1 -1
  480. package/dist/twilight/{p-542d3277.entry.js → p-5e496aaa.entry.js} +1 -1
  481. package/dist/twilight/{p-c3ffb88a.entry.js → p-5f440956.entry.js} +1 -1
  482. package/dist/twilight/{p-94dbc1e9.entry.js → p-60fafcd9.entry.js} +1 -1
  483. package/dist/twilight/{p-1ef2602d.entry.js → p-708f02db.entry.js} +1 -1
  484. package/dist/twilight/{p-b64f3155.entry.js → p-7829ea8a.entry.js} +1 -1
  485. package/dist/twilight/{p-7093a427.entry.js → p-7d3e592a.entry.js} +1 -1
  486. package/dist/twilight/{p-96d03a28.entry.js → p-81876026.entry.js} +1 -1
  487. package/dist/twilight/{p-d9f5a8cd.entry.js → p-8306ef5e.entry.js} +1 -1
  488. package/dist/twilight/{p-d4a242f8.entry.js → p-8403cd93.entry.js} +1 -1
  489. package/dist/twilight/{p-7abddca8.entry.js → p-8474c4f6.entry.js} +1 -1
  490. package/dist/twilight/p-8552160a.entry.js +4 -0
  491. package/dist/twilight/p-8c9b0e2a.entry.js +4 -0
  492. package/dist/twilight/{p-2881bb33.entry.js → p-8f2dfc57.entry.js} +1 -1
  493. package/dist/twilight/{p-c091e2dc.entry.js → p-94b1a2ae.entry.js} +1 -1
  494. package/dist/twilight/{p-ede67a08.entry.js → p-95dad1af.entry.js} +1 -1
  495. package/dist/twilight/{p-eac718cd.entry.js → p-964b7db9.entry.js} +1 -1
  496. package/dist/twilight/{p-e3b8e0e1.entry.js → p-99735748.entry.js} +1 -1
  497. package/dist/twilight/{p-X6Yi3bYP.js → p-BZKDQg1s.js} +1 -1
  498. package/dist/twilight/{p-Cw3UBzjl.js → p-B_sN7OnY.js} +1 -1
  499. package/dist/twilight/{p-8r0S6BcZ.js → p-Bpi0aG1F.js} +1 -1
  500. package/dist/twilight/{p-BkClxrC4.js → p-CP8rFQ5n.js} +1 -1
  501. package/dist/twilight/{p-bNzv71Xl.js → p-CfmIbM8B.js} +1 -1
  502. package/dist/twilight/{p-bScl0xMh.js → p-CpO1SrBd.js} +1 -1
  503. package/dist/twilight/p-Cz6cYzxG.js +5 -0
  504. package/dist/twilight/p-Do4hSOGo.js +9 -0
  505. package/dist/twilight/{p-Ck4zxCil.js → p-JJmlh-ji.js} +1 -1
  506. package/dist/twilight/{p-dd2bd5dc.entry.js → p-a4aedcfe.entry.js} +1 -1
  507. package/dist/twilight/{p-06fa7327.entry.js → p-b0d01f9f.entry.js} +1 -1
  508. package/dist/twilight/p-b8404cfb.entry.js +4 -0
  509. package/dist/twilight/{p-108d8c8b.entry.js → p-b8e3e180.entry.js} +1 -1
  510. package/dist/twilight/{p-ad07f67a.entry.js → p-bd687cd0.entry.js} +1 -1
  511. package/dist/twilight/{p-44fa7521.entry.js → p-c0037fac.entry.js} +1 -1
  512. package/dist/twilight/{p-293c6cf3.entry.js → p-c121f8e4.entry.js} +1 -1
  513. package/dist/twilight/{p-a01f1992.entry.js → p-c29907df.entry.js} +1 -1
  514. package/dist/twilight/p-c39675ef.entry.js +4 -0
  515. package/dist/twilight/{p-bff4c7b3.entry.js → p-cb7a985e.entry.js} +1 -1
  516. package/dist/twilight/p-cbe620c4.entry.js +4 -0
  517. package/dist/twilight/{p-6f36541a.entry.js → p-d2fd79b4.entry.js} +1 -1
  518. package/dist/twilight/{p-d337c399.entry.js → p-d6cf0ffd.entry.js} +1 -1
  519. package/dist/twilight/{p-748df7e6.entry.js → p-d8f60f2f.entry.js} +1 -1
  520. package/dist/twilight/p-d99610f9.entry.js +4 -0
  521. package/dist/twilight/{p-e6bbf50d.entry.js → p-dc897bdd.entry.js} +1 -1
  522. package/dist/twilight/{p-f7999a6d.entry.js → p-dca46236.entry.js} +1 -1
  523. package/dist/twilight/{p-e94f217b.entry.js → p-e48853c9.entry.js} +1 -1
  524. package/dist/twilight/{p-09d39785.entry.js → p-e4fdb206.entry.js} +1 -1
  525. package/dist/twilight/p-ed913ae7.entry.js +4 -0
  526. package/dist/twilight/p-f067fcd6.entry.js +4 -0
  527. package/dist/twilight/{p-57ff1f25.entry.js → p-f2cd6975.entry.js} +1 -1
  528. package/dist/twilight/{p-ad041ab5.entry.js → p-f2ffbfbb.entry.js} +1 -1
  529. package/dist/twilight/{p-f5d15e71.entry.js → p-f3166e60.entry.js} +1 -1
  530. package/dist/twilight/{p-59ae82bd.entry.js → p-f8fcc8f4.entry.js} +1 -1
  531. package/dist/twilight/{p-c1fd45b1.entry.js → p-f9e52fd9.entry.js} +1 -1
  532. package/dist/twilight/p-fcddbfc3.entry.js +4 -0
  533. package/dist/twilight/{p-41c733c2.entry.js → p-fe7ac9bb.entry.js} +1 -1
  534. package/dist/twilight/{p-0add06f9.entry.js → p-ff14dca3.entry.js} +1 -1
  535. package/dist/twilight/{p-BZnoSB1s.js → p-mlFGjxcj.js} +1 -1
  536. package/dist/twilight/twilight.esm.js +1 -1
  537. package/dist/types/components.d.ts +177 -763
  538. package/dist/types/stencil-public-runtime.d.ts +11 -169
  539. package/package.json +5 -5
  540. package/dist/cjs/app-globals-oehrC7QI.js +0 -39
  541. package/dist/esm/app-globals-BFryt7-C.js +0 -37
  542. package/dist/twilight/p-1daeed6e.entry.js +0 -4
  543. package/dist/twilight/p-2ddb3fce.entry.js +0 -4
  544. package/dist/twilight/p-34968e31.entry.js +0 -4
  545. package/dist/twilight/p-665189b4.entry.js +0 -4
  546. package/dist/twilight/p-776c9d33.entry.js +0 -4
  547. package/dist/twilight/p-7b8313ef.entry.js +0 -4
  548. package/dist/twilight/p-7bd0ede5.entry.js +0 -4
  549. package/dist/twilight/p-8e8d9d7d.entry.js +0 -4
  550. package/dist/twilight/p-D1vqXXNX.js +0 -9
  551. package/dist/twilight/p-DYB20YqN.js +0 -5
  552. package/dist/twilight/p-Vl6qpttb.js +0 -4
  553. package/dist/twilight/p-af60e72a.entry.js +0 -4
  554. package/dist/twilight/p-e679884a.entry.js +0 -4
  555. package/dist/twilight/p-efab88c5.entry.js +0 -4
@@ -1,4 +1,1184 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{transformTag as a,proxyCustomElement as l,HTMLElement as e,createEvent as t,h as p,Host as n}from"@stencil/core/internal/client";import{a as s}from"./axios.js";var i={request:(a,l,e,t=null,p=null)=>s.request({url:l,data:e,method:a.toLowerCase(),responseType:"json"}).then(t).catch(p),get:(a,l=null,e=null,t)=>s.get(a,{params:t}).then(l).catch(e),post(a,l,e=null,t=null){return this.request("post",a,l,e,t)},put(a,l,e=null,t=null){return this.request("put",a,l,e,t)},delete(a,l,e=null,t=null){return this.request("delete",a,l,e,t)},requestWithSupportAjax(a,l,e="post"){return new Promise(((t,p)=>{if(!window?.isLegacyTheme)return this.request(e,a,l,(({data:a})=>t(a)),(({response:a})=>p(a)));$.ajax({url:a,method:e.toUpperCase(),data:l,async:!1,success:function({data:a}){return t(a)},error:function({response:a}){return p(a)}})}))}},o={options:[],header:[navigator.platform,navigator.userAgent,navigator.appVersion,navigator.vendor,window.opera],dataos:[{name:"Windows Phone",value:"Windows Phone",version:"OS"},{name:"Windows",value:"Win",version:"NT"},{name:"iPhone",value:"iPhone",version:"OS"},{name:"iPad",value:"iPad",version:"OS"},{name:"Kindle",value:"Silk",version:"Silk"},{name:"Android",value:"Android",version:"Android"},{name:"PlayBook",value:"PlayBook",version:"OS"},{name:"BlackBerry",value:"BlackBerry",version:"/"},{name:"Macintosh",value:"Mac",version:"OS X"},{name:"Linux",value:"Linux",version:"rv"},{name:"Palm",value:"Palm",version:"PalmOS"}],databrowser:[{name:"Chrome",value:"Chrome",version:"Chrome"},{name:"Firefox",value:"Firefox",version:"Firefox"},{name:"Safari",value:"Safari",version:"Version"},{name:"Internet Explorer",value:"MSIE",version:"MSIE"},{name:"Opera",value:"Opera",version:"Opera"},{name:"BlackBerry",value:"CLDC",version:"CLDC"},{name:"Mozilla",value:"Mozilla",version:"Mozilla"}],init:function(){var a=this.header.join(" ");return{os:this.matchItem(a,this.dataos),browser:this.matchItem(a,this.databrowser)}},matchItem:function(a,l){var e,t,p,n=0,s=0;for(n=0;n<l.length;n+=1)if(new RegExp(l[n].value,"i").test(a)){if(e=new RegExp(l[n].version+"[- /:;]([\\d._]+)","i"),p="",(t=a.match(e))&&t[1]&&(t=t[1]),t)for(t=t.split(/[._]+/),s=0;s<t.length;s+=1)p+=0===s?t[s]+".":t[s];else p="0";return{name:l[n].name,version:parseFloat(p)}}return{name:"unknown",version:0}}};async function r(a,l,e=!1){if(salla.logger.log("🍏 Pay: mutateShippingContact called",l,e),a.detail.requiredShippingContactFields&&0!=a.detail.requiredShippingContactFields.length)if(e){if(salla.config.isGuest()&&salla.config.get("store.features").includes("guest-checkout")){if(!(l.emailAddress&&l.givenName&&l.familyName&&l.phoneNumber)){salla.logger.warn("🍏 Pay: Guest contact fields are required",l);const e=[];return l.emailAddress||e.push(new window.ApplePayError("shippingContactInvalid","emailAddress","Email address is required")),l.phoneNumber||e.push(new window.ApplePayError("shippingContactInvalid","phoneNumber","Phone number is required")),l.givenName&&l.familyName||e.push(new window.ApplePayError("shippingContactInvalid","name","Name is required")),void a.session.completePayment({status:a.session.STATUS_INVALID_SHIPPING_CONTACT,errors:e})}await async function(a,l){return salla.logger.log("🍏 Pay: Updating guest contact",l),new Promise(((e,t)=>{i.post(a.detail.guestContactSelected.url.replace("{id}",a.id),{email:l.emailAddress||null,first_name:l.givenName||null,last_name:l.familyName||null,phone_number:l.phoneNumber||null,country_code:l.countryCode||null},(async({data:l})=>{"function"==typeof a.detail.guestContactSelected?.onSuccess&&a.detail.guestContactSelected.onSuccess(l),e(l)}),(({response:l})=>{salla.logger.warn("🍏 Pay: Failed to update guest contact via api",l),"function"==typeof a.detail.guestContactSelected?.onFailed&&a.detail.guestContactSelected.onFailed(l),t({response:l})}))}))}(a,l)}}else if(a.detail.requiredShippingContactFields.includes("postalAddress"))return i.post(a.detail.shippingContactSelected.url.replace("{id}",a.id),{country:l.country,city:l.locality,local:l.subLocality||l.administrativeArea||l.locality,description:l.subAdministrativeArea,street:l.addressLines?.join(", ")||l.administrativeArea,country_code:l.countryCode,postal_code:l.postalCode},(async({data:l})=>{if("function"==typeof a.detail.shippingContactSelected.onSuccess&&a.detail.shippingContactSelected.onSuccess(l),a.address_id=l.data.address_id,a.shipping_methods=l.data.shipping_methods,!a.shipping_methods||a.shipping_methods&&!a.shipping_methods.length)return salla.logger.warn("🍏 Pay: We dont found any supported methods",l),void a.session.completeShippingContactSelection({status:a.session.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,errors:[new window.ApplePayError("addressUnserviceable")]});try{await a.selectApplePayShippingMethod(a.shipping_methods[0])}catch(l){return salla.logger.warn("Failed set the shipping details to api",l),void a.session.completeShippingContactSelection({status:a.session.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,errors:[new window.ApplePayError("addressUnserviceable")]})}try{await a.recalculateTotal()}catch(l){return salla.logger.warn("🍏 Pay: Failed recalculate total",l),void a.session.completeShippingContactSelection({status:a.session.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,errors:[new window.ApplePayError("addressUnserviceable")]})}const e={newTotal:a.prepareTotal(),newLineItems:a.prepareLineItems(),newShippingMethods:a.mappingShippingMethods(a.shipping_methods)};salla.logger.log("🍏 Pay: completeShippingContactSelection",e),a.session.completeShippingContactSelection(e)}),(({response:l})=>{salla.logger.warn("🍏 Pay: Failed add address via api",l),"function"==typeof a.detail.shippingContactSelected.onFailed&&a.detail.shippingContactSelected.onFailed(l);let e=l?.data?.error?.fields,t=function(a){return Object.entries(a).filter((([a,l])=>l&&l.length>0)).map((([a,l])=>new window.ApplePayError("shippingContactInvalid",a,l[0])))}({countryCode:e?.country_code&&e.country_code.length>0?e.country_code[0]:null,locality:e?.city&&e.city.length>0?e.city[0]:null,country:e?.country&&e.country.length>0?e.country[0]:null});0===t.length&&l?.data?.error?.message&&t.push(new window.ApplePayError("shippingContactInvalid","locality",l?.data?.error?.message)),a.session.completeShippingContactSelection({newTotal:a.prepareTotal(),newLineItems:a.prepareLineItems(),status:a.session.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,errors:t})}))}window.Salla=window.Salla||{},window.Salla.Payments=window.Salla.Payments||{},window.SallaApplePay={session:null,detail:null,address_id:null,shipping_methods:[],total:void 0,request:void 0,id:void 0,countryCode:null,totals:[],shippingCompany:null,init:function(){document.removeEventListener("payments::apple-pay.start-transaction",SallaApplePay.startSession),Salla.event.addEventListener("payments::apple-pay.start-transaction",SallaApplePay.startSession)},initDefault:function(){SallaApplePay.detail.onError||(SallaApplePay.detail.onError=function(a){salla.notify.error(a)}),SallaApplePay.detail.authorized.onFailed||(SallaApplePay.detail.authorized.onFailed=a=>{salla.logger.log(JSON.stringify(a)),salla.api.handleErrorResponse(a),SallaApplePay.onCancel({},a.data.error.message)}),SallaApplePay.detail.validateMerchant.onFailed||(SallaApplePay.detail.validateMerchant.onFailed=a=>{salla.logger.log(JSON.stringify(a)),salla.api.handleErrorResponse({response:a}),SallaApplePay.onCancel({},a.data.error.message)}),SallaApplePay.detail.authorized.onSuccess||(SallaApplePay.detail.authorized.onSuccess=a=>{salla.logger.log(JSON.stringify(a)),salla.api.handleAfterResponseActions(a)})},prepareLineItems:function(){return SallaApplePay.detail?.items?.length||(SallaApplePay.detail.items=[{label:salla.lang.get("pages.cart.items_total"),amount:parseFloat(SallaApplePay.detail.amount).toString()}]),SallaApplePay.detail.items},prepareTotal:function(){return{label:window.location.hostname||"Salla",amount:parseFloat(SallaApplePay.detail.amount).toString()}},isPhysical:()=>SallaApplePay.detail?.requiredShippingContactFields?.includes("postalAddress"),startSession:async function(a){SallaApplePay.detail=a.detail||a,salla.log("🍏 Pay: payments::apple-pay.start-transaction",SallaApplePay.detail),SallaApplePay.initDefault();let l=SallaApplePay.getApplePaySessionVersion(),e=SallaApplePay.detail.supportedNetworks||["masterCard","visa"];5===l&&e.push("mada"),SallaApplePay.request={countryCode:SallaApplePay.detail.countryCode||"SA",supportsCouponCode:!0,couponCode:"",currencyCode:SallaApplePay.detail.currency||"SAR",requiredShippingContactFields:SallaApplePay.detail.requiredShippingContactFields?SallaApplePay.detail.requiredShippingContactFields:[],merchantCapabilities:["supports3DS"],supportedNetworks:e,supportedCountries:SallaApplePay.detail.supportedCountries||["SA"],total:SallaApplePay.prepareTotal(),shippingContact:SallaApplePay.detail.shippingContact?SallaApplePay.detail.shippingContact:{},shippingMethods:SallaApplePay.detail.shippingMethods&&SallaApplePay.detail.shippingMethods.length?SallaApplePay.mappingShippingMethods(a.detail.shippingMethods):[],lineItems:SallaApplePay.prepareLineItems()},salla.log("🍏 Pay: init ",SallaApplePay.request),SallaApplePay.session=new ApplePaySession(l,SallaApplePay.request),SallaApplePay.session.onshippingcontactselected=SallaApplePay.onShippingContactSelected,SallaApplePay.session.onshippingmethodselected=SallaApplePay.onShippingMethodSelected,SallaApplePay.session.onvalidatemerchant=SallaApplePay.onValidateMerchant,SallaApplePay.session.onpaymentauthorized=SallaApplePay.onPaymentAuthorized,SallaApplePay.session.oncancel=SallaApplePay.onCancel,SallaApplePay.session.oncouponcodechanged=SallaApplePay.onCouponCodeChanged,SallaApplePay.session.onpaymentmethodselected=SallaApplePay.onPaymentMethodSelected,SallaApplePay.session.begin()},onPaymentMethodSelected:async a=>{if(salla.logger.log("🍏 Pay: onPaymentMethodSelected",a),SallaApplePay.isPhysical())salla.logger.log("🍏 Pay: completePaymentMethodSelection",{newTotal:SallaApplePay.prepareTotal(),newLineItems:SallaApplePay.prepareLineItems()}),SallaApplePay.session.completePaymentMethodSelection({newTotal:SallaApplePay.prepareTotal(),newLineItems:SallaApplePay.prepareLineItems()});else try{await SallaApplePay.recalculateTotal();const a={newTotal:SallaApplePay.prepareTotal(),newLineItems:SallaApplePay.prepareLineItems()};salla.logger.log("🍏 Pay: completePaymentMethodSelection",a),SallaApplePay.session.completePaymentMethodSelection(a)}catch(a){salla.logger.warn("🍏 Pay: Failed recalculate total",a),SallaApplePay.session.completePaymentMethodSelection({newTotal:SallaApplePay.prepareTotal(),newLineItems:SallaApplePay.prepareLineItems(),status:SallaApplePay.session.STATUS_FAILURE,errors:[new window.ApplePayError("unknown",void 0,a?.response?.data?.error?.message||a?.response?.data?.error?.code||"Failed to recalculate total")]})}},onCouponCodeChanged:a=>(Salla.event.dispatch("payments::apple-pay.coupon.change",a),i.post(SallaApplePay.detail.onCouponCodeChanged.url.replace("{id}",SallaApplePay.id),{coupon:a.couponCode,payment_method:"apple_pay"},(async({data:a})=>{"function"==typeof SallaApplePay.detail.onCouponCodeChanged.onSuccess&&SallaApplePay.detail.onCouponCodeChanged.onSuccess(a),salla.log("🍏 Pay: Coupon applied success"),await SallaApplePay.recalculateTotal(),SallaApplePay.session.completeCouponCodeChange({newTotal:SallaApplePay.prepareTotal(),newLineItems:SallaApplePay.prepareLineItems()})}),(async a=>{let l=a?.response;Salla.event.dispatch("payments::apple-pay.coupon.failed",l),"function"==typeof SallaApplePay.detail.onCouponCodeChanged.onFailed&&SallaApplePay.detail.onCouponCodeChanged.onFailed(l),await SallaApplePay.recalculateTotal(),SallaApplePay.session.completeCouponCodeChange({newTotal:SallaApplePay.prepareTotal(),newLineItems:SallaApplePay.prepareLineItems(),errors:[new window.ApplePayError("couponCodeInvalid")]})}))),onCancel:(a={},l=null)=>{SallaApplePay.detail.onError(l||salla.lang.get("pages.checkout.payment_failed")),Salla.event.createAndDispatch("payments::apple-pay.canceled",a)},onPaymentAuthorized:async a=>{salla.logger.log("🍏 Pay: onPaymentAuthorized",a.payment);try{await r(SallaApplePay,a.payment.shippingContact,!0)}catch(a){salla.logger.error("🍏 Pay: Failed to update guest contact details",a);const l=a?.response||a,e=l?.data?.error?.fields||{},t=[];return e?.email&&e.email.length>0&&t.push(new window.ApplePayError("shippingContactInvalid","emailAddress",e.email[0])),e?.phone&&e.phone.length>0&&t.push(new window.ApplePayError("shippingContactInvalid","phoneNumber",e.phone[0])),e?.first_name&&e.first_name.length>0?t.push(new window.ApplePayError("shippingContactInvalid","name",e.first_name[0])):e?.last_name&&e.last_name.length>0&&t.push(new window.ApplePayError("shippingContactInvalid","name",e.last_name[0])),0===t.length&&t.push(new window.ApplePayError("shippingContactInvalid","name",l?.data?.error?.message||l?.data?.error?.code||"Invalid shipping contact details")),Salla.event.dispatch("payments::apple-pay.authorized.failed",l),"function"==typeof SallaApplePay.detail.authorized.onFailed&&SallaApplePay.detail.authorized.onFailed(l),void SallaApplePay.session.completePayment({status:ApplePaySession.STATUS_INVALID_SHIPPING_CONTACT,errors:t})}Salla.event.dispatch("payments::apple-pay.authorized.init",a),i.post(SallaApplePay.detail.authorized.url.replace("{id}",SallaApplePay.id),{payment_method:"apple_pay",applepay_token:JSON.stringify(a.payment)},(({data:a})=>{Salla.event.dispatch("payments::apple-pay.authorized.success",a),"function"==typeof SallaApplePay.detail.authorized.onSuccess&&SallaApplePay.detail.authorized.onSuccess(a),SallaApplePay.session.completePayment(ApplePaySession.STATUS_SUCCESS)}),(a=>{let l=a?.response;Salla.event.dispatch("payments::apple-pay.authorized.failed",l),"function"==typeof SallaApplePay.detail.authorized.onFailed&&SallaApplePay.detail.authorized.onFailed(l),SallaApplePay.session.completePayment({status:ApplePaySession.STATUS_FAILURE,errors:[new window.ApplePayError("unknown",void 0,l?.data?.error?.message||l?.data?.error?.code||"Failed to parse authorized response")]})}))},onValidateMerchant:async a=>{try{Salla.event.dispatch("payments::apple-pay.validate-merchant.init",a);const{data:l}=await i.post(SallaApplePay.detail.validateMerchant.url.replace("{id}",SallaApplePay.id),{validation_url:a.validationURL});Salla.event.dispatch("payments::apple-pay.validate-merchant.success",l);const e=a=>{SallaApplePay.session.completeMerchantValidation(a)};if("function"==typeof SallaApplePay.detail.validateMerchant.onSuccess){const a=await SallaApplePay.detail.validateMerchant.onSuccess(l);if(a?.redirect)return window.location=a.redirect,SallaApplePay.abortValidateMerchant(a)}e(l.data)}catch(a){console.error(a),SallaApplePay.abortValidateMerchant(a?.response)}},abortValidateMerchant:(a=null)=>{SallaApplePay.abortSession(),Salla.event.dispatch("payments::apple-pay.validate-merchant.failed",a),"function"==typeof SallaApplePay.detail.validateMerchant.onFailed&&SallaApplePay.detail.validateMerchant.onFailed(a)},onShippingContactSelected:async a=>{salla.logger.log("🍏 Pay: onShippingContactSelected",a.shippingContact),await r(SallaApplePay,a.shippingContact)},onShippingMethodSelected:async a=>{let l=a.shippingMethod.identifier.split(","),e={ship_id:l[0],private_ship_id:void 0===l[1]?null:l[1],type:void 0===l[2]?null:l[2],route_id:void 0===l[3]?null:l[3]};if(salla.logger.log("🍏 Pay: onShippingMethodSelected",{event:a,previous:SallaApplePay.shippingCompany,current:e}),SallaApplePay.shouldUpdateShippingCompany(e))try{await SallaApplePay.selectApplePayShippingMethod(e),await SallaApplePay.recalculateTotal()}catch(a){return salla.logger.warn("🍏 Pay: Failed set the shipping details to api",a),void SallaApplePay.session.completeShippingMethodSelection({newTotal:SallaApplePay.prepareTotal(),newLineItems:SallaApplePay.prepareLineItems(),status:SallaApplePay.session.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,errors:[new window.ApplePayError("addressUnserviceable")]})}salla.logger.log("🍏 Pay: completeShippingMethodSelection",{newTotal:SallaApplePay.prepareTotal(),newLineItems:SallaApplePay.prepareLineItems()}),SallaApplePay.session.completeShippingMethodSelection({newTotal:SallaApplePay.prepareTotal(),newLineItems:SallaApplePay.prepareLineItems()})},abortSession:()=>{SallaApplePay.session&&SallaApplePay.session.abort()},shouldUpdateShippingCompany:a=>SallaApplePay.shippingCompany?.ship_id!=a?.ship_id||SallaApplePay.shippingCompany?.private_ship_id!=a?.private_ship_id,getApplePaySessionVersion:()=>{if("sallapp"===(navigator.userAgent||navigator.vendor||window.opera))return 5;let a=o.init(),l=parseFloat(a.os.version);if("Macintosh"===a.os.name){if(l<10.142)return 1}else if(l<12.11)return 1;return 5},recalculateTotal:()=>(salla.logger.log("🍏 Pay: recalculate total"),i.get(SallaApplePay.detail.recalculateTotal.url.replace("{id}",SallaApplePay.id),(({data:a})=>{salla.logger.log("🍏 Pay: recalculate total success",a);let l=a.data.initial_data?.cart||a.data.cart,e=a.data.initial_data?.payments||a.data.payments;salla.logger.log("🍏 Pay: recalculate total success",{cart:l,payments:e}),SallaApplePay.detail.amount=e?.gateways?.applePay?.supportedMultiCurrency?l.total_in_customer_currency:l.total,SallaApplePay.detail.items=(l.totals||l.items).map((a=>({label:a.title,amount:"مجاني"===a.amount||"Free"===a.amount?0:a.amount.toString().replace("+","")}))),SallaApplePay.detail.items.pop(),SallaApplePay.totals=SallaApplePay.detail.items}),(a=>(salla.logger.warn("🍏 Pay: recalculate total failed",a),a?.response?.data?.message)))),selectApplePayShippingMethod:a=>{salla.logger.log("🍏 Pay: select shipping method ",a),SallaApplePay.shippingCompany=a;const l={address_id:SallaApplePay.address_id,company_id:a.ship_id,private_company_id:a.private_ship_id,type:a.type||void 0,route_id:a.route_id||void 0,payment_method:"apple_pay"};return i.post(SallaApplePay.detail.shippingMethodSelected.url.replace("{id}",SallaApplePay.id),l,(({data:a})=>("function"==typeof SallaApplePay.detail.shippingMethodSelected.onSuccess&&SallaApplePay.detail.shippingMethodSelected.onSuccess(a),!0)),(a=>{salla.logger.warn("🍏 Pay: Set shipping method failed",a),"function"==typeof SallaApplePay.detail.shippingMethodSelected.onFailed&&SallaApplePay.detail.shippingMethodSelected.onFailed(a);let l=a?.response?.data?.error;return l?.data?.fields?.address_id?l?.data?.fields?.address_id[0]:l?.data?.message}))},mappingShippingMethods:a=>a.map((a=>({label:a.shipping_title,amount:a.enable_free_shipping?0:a.ship_cost,detail:"",identifier:a.ship_id.toString()+(a.private_ship_id?","+a.private_ship_id.toString():"")+(a.type?","+a.type:"")+(a.route_id?","+a.route_id:"")})))},window.ApplePaySession?.canMakePayments()?SallaApplePay.init():document.querySelectorAll("data-show-if-apple-pay-supported").forEach((a=>a.style.display="none"));const d=l(class extends e{constructor(a){super(),!1!==a&&this.__registerHost(),this.validationFailed=t(this,"validationFailed",7),this.requireLogin=t(this,"requireLogin",7),this.type="buy",this.productType="product",this.options={},this.quickBuy=salla.lang.get("pages.products.buy_now"),salla.lang.onLoaded((()=>{this.quickBuy=salla.lang.get("pages.products.buy_now")}))}async quickBuyHandler(){if(salla.config.isGuest()&&!this.isGuestCheckout()){this.requireLogin.emit({productId:this.productId});let a="salla-quick-buy::user.logged-in";return salla.event.on(a,(()=>this.settlePayment())),salla.api.auth.setAfterLoginEvent(a),salla.auth.event.dispatch("login::open",{withoutReload:!0})}await this.settlePayment()}async settlePayment(){let a=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);if(a&&!await a.reportValidity())return this.validationFailed.emit({productId:this.productId}),salla.error(salla.lang.get("common.messages.required_fields"));let l=this.host.getElementSallaData();if(!this.isApplePayActive)return salla.api.request("checkout/quick-purchase/"+this.productId,l,"post").then((a=>(a.data.redirect&&(window.location.href=a.data.redirect),a)));l.is_applepay=!0,"append"in l&&l.append("is_applepay",!0),salla.event.dispatch("payments::apple-pay.start-transaction",{amount:this.amount,currency:this.currency||"SAR",requiredShippingContactFields:this.getRequiredShippingContactFields(),shippingMethods:this.isRequireShipping?[]:void 0,supportedNetworks:salla.config.get("store.settings.buy_now.networks"),supportedCountries:salla.config.get("store.settings.buy_now.countries"),countryCode:salla.config.get("store.store_country")||"SA",validateMerchant:{url:this.validateHost?`${this.validateHost}/checkout/applepay/validate`:salla.url.get("checkout/applepay/validate"),onSuccess:a=>this.applePayOnly&&!this.productId?this.cartId?(window.SallaApplePay.id=this.cartId,salla.log("🍏 Pay: create checkout success: with id #"+this.cartId),Promise.resolve(a)):(salla.logger.warn("🍏 Pay: trying to create applePay transaction without cartId/ProductId !"),Promise.resolve(a)):salla.api.request("checkout/quick-purchase/"+this.productId,"object"==typeof l?l:void 0,"post",{}).then((a=>a?.data?.redirect?(salla.log("🍏 Pay: create checkout success: redirect exits, go to checkout page"),window.location.href=a.data.redirect.url,a):a?.data?.id?(window.SallaApplePay.id=a.data.id,void salla.log("🍏 Pay: create checkout success: with id #"+window.SallaApplePay.id)):(salla.logger.warn("🍏 Pay: create checkout success: No id, or redirect"),a)))},authorized:{url:salla.url.get("checkout/{id}/payments/submit"),onFailed:a=>{window.SallaApplePay.onCancel({},a?.data?.error?.message||a?.data?.error?.code||salla.lang.get("pages.checkout.payment_failed"))},onSuccess:a=>{window.location.href=a.redirect.url,salla.log("🍏 Pay: authorized Success:: redirect to thank you page, order placed")}},shippingMethodSelected:this.isRequireShipping?{url:salla.url.get("checkout/{id}/shipping/details")}:void 0,shippingContactSelected:this.isRequireShipping?{url:salla.url.get("checkout/{id}/address/add")}:void 0,guestContactSelected:this.isGuestCheckout()?{url:salla.url.get("checkout/{id}/customer")}:void 0,onCouponCodeChanged:{url:salla.url.get("checkout/{id}/coupons")},recalculateTotal:{url:salla.url.get("checkout/{id}/payments/recalculate?payment_method=apple_pay")},onError:function(a){salla.log(a),salla.notify.error(a)}})}isGuestCheckout(){return salla.config.isGuest()&&salla.config.get("store.features").includes("guest-checkout")&&this.isPhysicalProduct()}getRequiredShippingContactFields(){let a=[];return this.isRequireShipping&&a.push("postalAddress"),this.isGuestCheckout()&&a.push("email","phone","name"),a}componentWillLoad(){console.log("🍏 Pay: Quick Buy Component Loaded");const a="undefined"!=typeof window&&!!window.ApplePaySession?.canMakePayments?.(),l=salla?.config?.get?.("store.settings.payments")?.includes?.("apple_pay")??!0,e=salla?.config?.get?.("store.settings.is_salla_gateway",!1)??!0;this.isApplePayActive=a&&l&&e;const t=async()=>{if(!this.currency&&salla?.config?.get&&(this.currency=salla.config.get("store.settings.buy_now.multi_currency")?salla.config.get("user.currency_code"):"SAR"),!this.productId&&salla?.config?.get&&salla.url?.is_page&&(this.productId=salla.config.get("page.id")),this.applePayOnly||this.productId){if(this.amount&&this.isRequireShipping||!this.productId||!salla?.product?.getDetails||await salla.product.getDetails(this.productId,[]).then((a=>{this.amount=a.data.price,this.isRequireShipping=a?.data?.is_require_shipping||!1})).catch((a=>{salla?.logger?.warn?.("🍏 Pay: Failed load the quick buy, get the product details failed: ",a)})),"donate"===this.type&&salla?.event?.on?salla.event.on("product-options::donation-changed",(a=>{String(a.id)===String(this.productId)&&(this.amount=a.price)})):salla?.url?.is_page?.("product.single")&&salla?.product?.event?.onPriceUpdated&&salla.product.event.onPriceUpdated((a=>{this.amount=a.data.price})),this.isApplePayActive=(salla?.helpers?.hasApplePay?.()??a)&&(salla?.config?.get?.("store.settings.payments")?.includes?.("apple_pay")??l)&&(salla?.config?.get?.("store.settings.is_salla_gateway",!1)??e),!document.getElementById("apple-pay-sdk")&&this.isApplePayActive){const a=document.createElement("script");a.src="https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js",a.setAttribute("id","apple-pay-sdk"),a.async=!0,document.body.appendChild(a)}}else salla?.logger?.warn?.("🍏 Pay: Failed load the quick buy, the product id is missing")};return new Promise((a=>{"function"==typeof salla?.onReady?salla.onReady((()=>t().then((()=>a(!0))))):t().then((()=>a(!0)))}))}render(){return p(n,{key:"9a8785c4a1e04d258a60924acf90407495a4de74"},this.quickBuyButton())}quickBuyButton(){return p("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})}isPhysicalProduct(){return"product"===this.productType||"group_products"===this.productType||"food"===this.productType}get host(){return this}static get style(){return".s-quick-buy-button .s-button-text{display:flex}apple-pay-button{--apple-pay-button-width:100%;--apple-pay-button-height:40px;--apple-pay-button-border-radius:.75rem;--apple-pay-button-box-sizing:content-box}"}},[0,"salla-quick-buy",{type:[1025],productType:[1025,"product-type"],productId:[1025,"product-id"],cartId:[1025,"cart-id"],amount:[1538],currency:[1025],options:[16],isRequireShipping:[1028,"is-require-shipping"],applePayOnly:[1028,"apple-pay-only"],validateHost:[1025,"validate-host"],isApplePayActive:[32],quickBuy:[32]}]);function u(){"undefined"!=typeof customElements&&["salla-quick-buy"].forEach((l=>{"salla-quick-buy"===l&&(customElements.get(a(l))||customElements.define(a(l),d))}))}u();export{d as S,u as d}
4
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
5
+ import { a as axios } from './axios.js';
6
+
7
+ var http = {
8
+ request(method, url, data, successCb = null, errorCb = null) {
9
+ return axios
10
+ .request({url, data, method: method.toLowerCase(), responseType: 'json'})
11
+ .then(successCb)
12
+ .catch(errorCb);
13
+ },
14
+
15
+ get(url, successCb = null, errorCb = null, data) {
16
+ // return this.request('get', url, data, successCb, errorCb);
17
+ return axios
18
+ .get(url, {params: data})
19
+ .then(successCb)
20
+ .catch(errorCb);
21
+ },
22
+
23
+ post(url, data, successCb = null, errorCb = null) {
24
+ return this.request('post', url, data, successCb, errorCb);
25
+ },
26
+
27
+ put(url, data, successCb = null, errorCb = null) {
28
+ return this.request('put', url, data, successCb, errorCb);
29
+ },
30
+
31
+ delete(url, data, successCb = null, errorCb = null) {
32
+ return this.request('delete', url, data, successCb, errorCb);
33
+ },
34
+
35
+ requestWithSupportAjax(url, payload, method = 'post') {
36
+ return new Promise((resolve, reject) => {
37
+ if (!window?.isLegacyTheme) {
38
+ return this.request(method, url, payload, ({data}) => {
39
+ return resolve(data);
40
+ }, ({response}) => {
41
+ return reject(response);
42
+ })
43
+ }
44
+
45
+ /**
46
+ * @deprecated to support legacy themes
47
+ */
48
+ $.ajax({
49
+ url: url,
50
+ method: method.toUpperCase(),
51
+ data: payload,
52
+ async: false,
53
+ success: function ({data}) {
54
+ return resolve(data);
55
+ },
56
+ error: function ({response}) {
57
+ return reject(response);
58
+ }
59
+ });
60
+ })
61
+ }
62
+ };
63
+
64
+ var DetectOS = {
65
+ options: [],
66
+ header: [navigator.platform, navigator.userAgent, navigator.appVersion, navigator.vendor, window.opera],
67
+ dataos: [
68
+ {name: 'Windows Phone', value: 'Windows Phone', version: 'OS'},
69
+ {name: 'Windows', value: 'Win', version: 'NT'},
70
+ {name: 'iPhone', value: 'iPhone', version: 'OS'},
71
+ {name: 'iPad', value: 'iPad', version: 'OS'},
72
+ {name: 'Kindle', value: 'Silk', version: 'Silk'},
73
+ {name: 'Android', value: 'Android', version: 'Android'},
74
+ {name: 'PlayBook', value: 'PlayBook', version: 'OS'},
75
+ {name: 'BlackBerry', value: 'BlackBerry', version: '/'},
76
+ {name: 'Macintosh', value: 'Mac', version: 'OS X'},
77
+ {name: 'Linux', value: 'Linux', version: 'rv'},
78
+ {name: 'Palm', value: 'Palm', version: 'PalmOS'}
79
+ ],
80
+ databrowser: [
81
+ {name: 'Chrome', value: 'Chrome', version: 'Chrome'},
82
+ {name: 'Firefox', value: 'Firefox', version: 'Firefox'},
83
+ {name: 'Safari', value: 'Safari', version: 'Version'},
84
+ {name: 'Internet Explorer', value: 'MSIE', version: 'MSIE'},
85
+ {name: 'Opera', value: 'Opera', version: 'Opera'},
86
+ {name: 'BlackBerry', value: 'CLDC', version: 'CLDC'},
87
+ {name: 'Mozilla', value: 'Mozilla', version: 'Mozilla'}
88
+ ],
89
+ init: function () {
90
+ var agent = this.header.join(' '),
91
+ os = this.matchItem(agent, this.dataos),
92
+ browser = this.matchItem(agent, this.databrowser);
93
+
94
+ return {os: os, browser: browser};
95
+ },
96
+ matchItem: function (string, data) {
97
+ var i = 0,
98
+ j = 0,
99
+ regex,
100
+ regexv,
101
+ match,
102
+ matches,
103
+ version;
104
+
105
+ for (i = 0; i < data.length; i += 1) {
106
+ regex = new RegExp(data[i].value, 'i');
107
+ match = regex.test(string);
108
+ if (match) {
109
+ regexv = new RegExp(data[i].version + '[- /:;]([\\d._]+)', 'i');
110
+ matches = string.match(regexv);
111
+ version = '';
112
+ if (matches) {
113
+ if (matches[1]) {
114
+ matches = matches[1];
115
+ }
116
+ }
117
+ if (matches) {
118
+ matches = matches.split(/[._]+/);
119
+ for (j = 0; j < matches.length; j += 1) {
120
+ if (j === 0) {
121
+ version += matches[j] + '.';
122
+ } else {
123
+ version += matches[j];
124
+ }
125
+ }
126
+ } else {
127
+ version = '0';
128
+ }
129
+ return {
130
+ name: data[i].name,
131
+ version: parseFloat(version)
132
+ };
133
+ }
134
+ }
135
+ return {name: 'unknown', version: 0};
136
+ }
137
+ };
138
+
139
+ /**
140
+ * @typedef {Object} ApplePayPaymentContact
141
+ * @property {string} phoneNumber
142
+ * @property {string} emailAddress
143
+ * @property {string} givenName
144
+ * @property {string} familyName
145
+ * @property {string} [phoneticGivenName]
146
+ * @property {string} [phoneticFamilyName]
147
+ * @property {string[]} addressLines
148
+ * @property {string} [subLocality]
149
+ * @property {string} locality
150
+ * @property {string} postalCode
151
+ * @property {string} [subAdministrativeArea]
152
+ * @property {string} administrativeArea
153
+ * @property {string} country
154
+ * @property {string} countryCode
155
+ */
156
+
157
+
158
+ /**
159
+ *
160
+ * @param {SallaApplePay} SallaApplePay
161
+ * @param {boolean} isAuthorized
162
+ * @param {ApplePayPaymentContact} shippingContact
163
+ *
164
+ */
165
+ async function mutateShippingContact(SallaApplePay, shippingContact, isAuthorized = false) {
166
+ salla.logger.log('🍏 Pay: mutateShippingContact called', shippingContact, isAuthorized);
167
+
168
+ if (!SallaApplePay.detail.requiredShippingContactFields || SallaApplePay.detail.requiredShippingContactFields.length == 0) {
169
+ return;
170
+ }
171
+
172
+ if (isAuthorized) {
173
+ if (isGuestCheckout()) {
174
+
175
+ if (
176
+ !shippingContact.emailAddress ||
177
+ !shippingContact.givenName ||
178
+ !shippingContact.familyName ||
179
+ !shippingContact.phoneNumber
180
+ ) {
181
+
182
+ salla.logger.warn('🍏 Pay: Guest contact fields are required', shippingContact);
183
+
184
+ const errors = [];
185
+ if (!shippingContact.emailAddress) {
186
+ errors.push(new window.ApplePayError('shippingContactInvalid', 'emailAddress', 'Email address is required'));
187
+ }
188
+
189
+ if (!shippingContact.phoneNumber) {
190
+ errors.push(new window.ApplePayError('shippingContactInvalid', 'phoneNumber', 'Phone number is required'));
191
+ }
192
+
193
+ if (!shippingContact.givenName || !shippingContact.familyName) {
194
+ errors.push(new window.ApplePayError('shippingContactInvalid', 'name', 'Name is required'));
195
+ }
196
+
197
+ SallaApplePay.session.completePayment({
198
+ status: SallaApplePay.session.STATUS_INVALID_SHIPPING_CONTACT,
199
+ errors: errors
200
+ });
201
+
202
+ return;
203
+ }
204
+
205
+ await updateGuestContact(SallaApplePay, shippingContact);
206
+
207
+ }
208
+
209
+ // if authorized and not guest checkout, do nothing address already added
210
+ return;
211
+ }
212
+
213
+ if (!SallaApplePay.detail.requiredShippingContactFields.includes('postalAddress')) {
214
+ return;
215
+ }
216
+
217
+ return http.post(
218
+ SallaApplePay.detail.shippingContactSelected.url.replace('{id}', SallaApplePay.id),
219
+ {
220
+ 'country': shippingContact.country,
221
+ 'city': shippingContact.locality,
222
+ 'local': shippingContact.subLocality || shippingContact.administrativeArea || shippingContact.locality,
223
+ 'description': shippingContact.subAdministrativeArea,
224
+ 'street': shippingContact.addressLines?.join(", ") || shippingContact.administrativeArea,
225
+ 'country_code': shippingContact.countryCode,
226
+ 'postal_code': shippingContact.postalCode,
227
+ },
228
+ async ({ data }) => {
229
+ if (typeof SallaApplePay.detail.shippingContactSelected.onSuccess === 'function') {
230
+ SallaApplePay.detail.shippingContactSelected.onSuccess(data);
231
+ }
232
+
233
+ SallaApplePay.address_id = data.data.address_id;
234
+ SallaApplePay.shipping_methods = data.data.shipping_methods;
235
+
236
+ if (!SallaApplePay.shipping_methods || (SallaApplePay.shipping_methods && !SallaApplePay.shipping_methods.length)) {
237
+ salla.logger.warn('🍏 Pay: We dont found any supported methods', data);
238
+
239
+ SallaApplePay.session.completeShippingContactSelection({
240
+ status: SallaApplePay.session.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
241
+ errors: [
242
+ new window.ApplePayError('addressUnserviceable')
243
+ ]
244
+ });
245
+
246
+ return
247
+ }
248
+
249
+ try {
250
+ await SallaApplePay.selectApplePayShippingMethod(SallaApplePay.shipping_methods[0]);
251
+ } catch (error) {
252
+ salla.logger.warn('Failed set the shipping details to api', error);
253
+
254
+ SallaApplePay.session.completeShippingContactSelection({
255
+ status: SallaApplePay.session.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
256
+ errors: [
257
+ new window.ApplePayError('addressUnserviceable')
258
+ ]
259
+ });
260
+
261
+ return;
262
+ }
263
+
264
+ try {
265
+ await SallaApplePay.recalculateTotal();
266
+ } catch (error) {
267
+ salla.logger.warn('🍏 Pay: Failed recalculate total', error);
268
+
269
+ SallaApplePay.session.completeShippingContactSelection({
270
+ status: SallaApplePay.session.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
271
+ errors: [
272
+ new window.ApplePayError('addressUnserviceable')
273
+ ]
274
+ });
275
+
276
+ return;
277
+ }
278
+
279
+ const updatedShippingContactSelection = {
280
+ newTotal: SallaApplePay.prepareTotal(),
281
+ newLineItems: SallaApplePay.prepareLineItems(),
282
+ newShippingMethods: SallaApplePay.mappingShippingMethods(SallaApplePay.shipping_methods)
283
+ };
284
+
285
+ salla.logger.log('🍏 Pay: completeShippingContactSelection', updatedShippingContactSelection);
286
+
287
+ SallaApplePay.session.completeShippingContactSelection(updatedShippingContactSelection);
288
+ },
289
+ ({ response }) => {
290
+ salla.logger.warn('🍏 Pay: Failed add address via api', response);
291
+
292
+ if (typeof SallaApplePay.detail.shippingContactSelected.onFailed === 'function') {
293
+ SallaApplePay.detail.shippingContactSelected.onFailed(response);
294
+ }
295
+
296
+ // parse 422 errors
297
+ let fields = response?.data?.error?.fields;
298
+
299
+ let errors = getApplePayErrors({
300
+ countryCode: fields?.country_code && fields.country_code.length > 0 ? fields.country_code[0] : null,
301
+ locality: fields?.city && fields.city.length > 0 ? fields.city[0] : null,
302
+ country: fields?.country && fields.country.length > 0 ? fields.country[0] : null,
303
+ });
304
+
305
+ if (errors.length === 0 && response?.data?.error?.message) {
306
+ errors.push(new window.ApplePayError('shippingContactInvalid', 'locality', response?.data?.error?.message));
307
+ }
308
+
309
+ SallaApplePay.session.completeShippingContactSelection({
310
+ newTotal: SallaApplePay.prepareTotal(),
311
+ newLineItems: SallaApplePay.prepareLineItems(),
312
+ status: SallaApplePay.session.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
313
+ errors: errors
314
+ });
315
+ }
316
+ );
317
+ }
318
+
319
+ function isGuestCheckout() {
320
+ return salla.config.isGuest() && salla.config.get('store.features').includes('guest-checkout');
321
+ }
322
+
323
+ /**
324
+ * Update guest contact
325
+ *
326
+ * @param {SallaApplePay} SallaApplePay
327
+ * @param {ApplePayPaymentContact} shippingContact
328
+ *
329
+ */
330
+ async function updateGuestContact(SallaApplePay, shippingContact) {
331
+ salla.logger.log('🍏 Pay: Updating guest contact', shippingContact);
332
+
333
+ return new Promise((resolve, reject) => {
334
+ http.post(
335
+ SallaApplePay.detail.guestContactSelected.url.replace('{id}', SallaApplePay.id),
336
+ {
337
+ 'email': shippingContact.emailAddress || null,
338
+ 'first_name': shippingContact.givenName || null,
339
+ 'last_name': shippingContact.familyName || null,
340
+ 'phone_number': shippingContact.phoneNumber || null,
341
+ 'country_code': shippingContact.countryCode || null,
342
+ },
343
+ async ({ data }) => {
344
+ if (typeof SallaApplePay.detail.guestContactSelected?.onSuccess === 'function') {
345
+ SallaApplePay.detail.guestContactSelected.onSuccess(data);
346
+ }
347
+ resolve(data);
348
+ },
349
+ ({ response }) => {
350
+ salla.logger.warn('🍏 Pay: Failed to update guest contact via api', response);
351
+
352
+ if (typeof SallaApplePay.detail.guestContactSelected?.onFailed === 'function') {
353
+ SallaApplePay.detail.guestContactSelected.onFailed(response);
354
+ }
355
+
356
+ // Reject the promise so it can be caught in onPaymentAuthorized
357
+ reject({ response });
358
+ }
359
+ );
360
+ });
361
+ }
362
+
363
+ function getApplePayErrors(fields) {
364
+ return Object.entries(fields)
365
+ .filter(([field, messages]) => messages && messages.length > 0)
366
+ .map(([field, messages]) => new window.ApplePayError('shippingContactInvalid', field, messages[0]));
367
+ }
368
+
369
+ window.Salla = window.Salla || {};
370
+ window.Salla.Payments = window.Salla.Payments || {};
371
+
372
+ /**
373
+ * Full Example
374
+ *
375
+ * Salla.event.createAndDispatch('payments::apple-pay.start-transaction', {
376
+ * amount: 1000,
377
+ * validateMerchant: {
378
+ * url: '{{ route('cp.marketplace.cart.pay', ['cart' => $cart]) }}',
379
+ * // onFailed: (response) => {
380
+ * // laravel.ajax.errorHandler(response);
381
+ * // this.onCancel({}, response.data.error.message);
382
+ * // },
383
+ * // onSuccess: (response) => {
384
+ * // laravel.ajax.successHandler(response);
385
+ * // }
386
+ * },
387
+ * authorized: {
388
+ * url: '{{ route('cp.marketplace.cart.confirm', ['cart' => $cart]) }}',
389
+ * // onFailed: (response) => {
390
+ * // laravel.ajax.errorHandler(response);
391
+ * // this.onCancel({}, response.data.error.message);
392
+ * // },
393
+ * // onSuccess: (response) => {
394
+ * // // nothing
395
+ * // }
396
+ * },
397
+ * // onError: function (message) {
398
+ * // laravel.alert(message);
399
+ * // }
400
+ * });
401
+ */
402
+ window.SallaApplePay = {
403
+ session: null,
404
+ detail: null,
405
+ address_id: null,
406
+ shipping_methods: [],
407
+ total: undefined,
408
+ request: undefined,
409
+ id: undefined,
410
+ countryCode: null,
411
+ totals: [],
412
+ shippingCompany: null,
413
+ init: function () {
414
+ document.removeEventListener('payments::apple-pay.start-transaction', SallaApplePay.startSession);
415
+ Salla.event.addEventListener('payments::apple-pay.start-transaction', SallaApplePay.startSession);
416
+ },
417
+
418
+ initDefault: function () {
419
+ if (!SallaApplePay.detail.onError) {
420
+ SallaApplePay.detail.onError = function (message) {
421
+ salla.notify.error(message);
422
+ };
423
+ }
424
+
425
+ if (!SallaApplePay.detail.authorized.onFailed) {
426
+ SallaApplePay.detail.authorized.onFailed = (response) => {
427
+ salla.logger.log(JSON.stringify(response));
428
+ salla.api.handleErrorResponse(response);
429
+ SallaApplePay.onCancel({}, response.data.error.message);
430
+ };
431
+ }
432
+
433
+ if (!SallaApplePay.detail.validateMerchant.onFailed) {
434
+ SallaApplePay.detail.validateMerchant.onFailed = (response) => {
435
+ salla.logger.log(JSON.stringify(response));
436
+ salla.api.handleErrorResponse({response});
437
+ SallaApplePay.onCancel({}, response.data.error.message);
438
+ };
439
+ }
440
+
441
+ if (!SallaApplePay.detail.authorized.onSuccess) {
442
+ SallaApplePay.detail.authorized.onSuccess = (response) => {
443
+ salla.logger.log(JSON.stringify(response));
444
+ salla.api.handleAfterResponseActions(response);
445
+ };
446
+ }
447
+ },
448
+
449
+ prepareLineItems: function () {
450
+ if (!SallaApplePay.detail?.items?.length) {
451
+ SallaApplePay.detail.items = [
452
+ {
453
+ label: salla.lang.get('pages.cart.items_total'),
454
+ amount: parseFloat(SallaApplePay.detail.amount).toString()
455
+ }
456
+ ];
457
+ }
458
+
459
+ return SallaApplePay.detail.items;
460
+ },
461
+
462
+ prepareTotal: function () {
463
+ return {
464
+ // apple ask to use business name
465
+ label: window.location.hostname || 'Salla',
466
+ //label: salla.lang.get('pages.cart.final_total'),
467
+ amount: parseFloat(SallaApplePay.detail.amount).toString()
468
+ }
469
+ },
470
+
471
+ isPhysical() {
472
+ return SallaApplePay.detail?.requiredShippingContactFields?.includes('postalAddress');
473
+ },
474
+
475
+ startSession: async function (event) {
476
+
477
+ SallaApplePay.detail = event.detail || event;
478
+
479
+ salla.log('🍏 Pay: payments::apple-pay.start-transaction', SallaApplePay.detail);
480
+
481
+ SallaApplePay.initDefault();
482
+
483
+ let version = SallaApplePay.getApplePaySessionVersion();
484
+ let supportedNetworks = SallaApplePay.detail.supportedNetworks || ['masterCard', 'visa'];
485
+
486
+ if (version === 5) {
487
+ supportedNetworks.push('mada');
488
+ }
489
+
490
+ SallaApplePay.request = {
491
+ countryCode: SallaApplePay.detail.countryCode || 'SA',
492
+ supportsCouponCode: true,
493
+ couponCode: '',
494
+ currencyCode: SallaApplePay.detail.currency || 'SAR',
495
+ requiredShippingContactFields: SallaApplePay.detail.requiredShippingContactFields ? SallaApplePay.detail.requiredShippingContactFields : [],
496
+ merchantCapabilities: ['supports3DS'],
497
+ supportedNetworks: supportedNetworks,
498
+ supportedCountries: SallaApplePay.detail.supportedCountries || ['SA'],
499
+ total: SallaApplePay.prepareTotal(),
500
+ shippingContact: SallaApplePay.detail.shippingContact ? SallaApplePay.detail.shippingContact : {},
501
+ shippingMethods: SallaApplePay.detail.shippingMethods && SallaApplePay.detail.shippingMethods.length ? SallaApplePay.mappingShippingMethods(event.detail.shippingMethods) : [],
502
+ lineItems: SallaApplePay.prepareLineItems()
503
+ };
504
+
505
+ salla.log('🍏 Pay: init ', SallaApplePay.request);
506
+
507
+ // https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest
508
+ SallaApplePay.session = new ApplePaySession(version, SallaApplePay.request);
509
+
510
+ SallaApplePay.session.onshippingcontactselected = SallaApplePay.onShippingContactSelected;
511
+ SallaApplePay.session.onshippingmethodselected = SallaApplePay.onShippingMethodSelected;
512
+ SallaApplePay.session.onvalidatemerchant = SallaApplePay.onValidateMerchant;
513
+ SallaApplePay.session.onpaymentauthorized = SallaApplePay.onPaymentAuthorized;
514
+ SallaApplePay.session.oncancel = SallaApplePay.onCancel;
515
+ SallaApplePay.session.oncouponcodechanged = SallaApplePay.onCouponCodeChanged;
516
+ SallaApplePay.session.onpaymentmethodselected = SallaApplePay.onPaymentMethodSelected;
517
+
518
+ SallaApplePay.session.begin();
519
+ },
520
+ onPaymentMethodSelected: async (event) => {
521
+ salla.logger.log('🍏 Pay: onPaymentMethodSelected', event);
522
+
523
+ // perform recalculate here only if digital product
524
+ // if physical recalculate performed with shipping company
525
+ if (!SallaApplePay.isPhysical()) {
526
+ try {
527
+ await SallaApplePay.recalculateTotal();
528
+
529
+ const updatedPaymentDetails = {
530
+ newTotal: SallaApplePay.prepareTotal(),
531
+ newLineItems: SallaApplePay.prepareLineItems()
532
+ };
533
+
534
+ salla.logger.log('🍏 Pay: completePaymentMethodSelection', updatedPaymentDetails);
535
+
536
+ SallaApplePay.session.completePaymentMethodSelection(updatedPaymentDetails);
537
+
538
+ } catch (error) {
539
+ salla.logger.warn('🍏 Pay: Failed recalculate total', error);
540
+
541
+ SallaApplePay.session.completePaymentMethodSelection({
542
+ newTotal: SallaApplePay.prepareTotal(),
543
+ newLineItems: SallaApplePay.prepareLineItems(),
544
+ status: SallaApplePay.session.STATUS_FAILURE,
545
+ errors: [new window.ApplePayError("unknown", undefined, error?.response?.data?.error?.message || error?.response?.data?.error?.code || 'Failed to recalculate total')]
546
+ });
547
+ }
548
+ return;
549
+ }
550
+
551
+ salla.logger.log('🍏 Pay: completePaymentMethodSelection', {
552
+ newTotal: SallaApplePay.prepareTotal(),
553
+ newLineItems: SallaApplePay.prepareLineItems(),
554
+ });
555
+
556
+ SallaApplePay.session.completePaymentMethodSelection({
557
+ newTotal: SallaApplePay.prepareTotal(),
558
+ newLineItems: SallaApplePay.prepareLineItems(),
559
+ });
560
+ },
561
+
562
+ onCouponCodeChanged(event) {
563
+ Salla.event.dispatch('payments::apple-pay.coupon.change', event);
564
+
565
+ return http.post(SallaApplePay.detail.onCouponCodeChanged.url.replace('{id}', SallaApplePay.id), {
566
+ 'coupon': event.couponCode,
567
+ 'payment_method': 'apple_pay',
568
+ }, async ({ data }) => {
569
+ if (typeof SallaApplePay.detail.onCouponCodeChanged.onSuccess === 'function') {
570
+ SallaApplePay.detail.onCouponCodeChanged.onSuccess(data);
571
+ }
572
+
573
+ salla.log('🍏 Pay: Coupon applied success');
574
+
575
+ await SallaApplePay.recalculateTotal();
576
+
577
+ SallaApplePay.session.completeCouponCodeChange({
578
+ newTotal: SallaApplePay.prepareTotal(),
579
+ newLineItems: SallaApplePay.prepareLineItems()
580
+ });
581
+ }, async (error) => {
582
+ let response = error?.response;
583
+
584
+ Salla.event.dispatch('payments::apple-pay.coupon.failed', response);
585
+
586
+ // SallaApplePay.abortSession();
587
+ if (typeof SallaApplePay.detail.onCouponCodeChanged.onFailed === 'function') {
588
+ SallaApplePay.detail.onCouponCodeChanged.onFailed(response);
589
+ }
590
+
591
+ await SallaApplePay.recalculateTotal();
592
+
593
+ SallaApplePay.session.completeCouponCodeChange({
594
+ newTotal: SallaApplePay.prepareTotal(),
595
+ newLineItems: SallaApplePay.prepareLineItems(),
596
+ errors: [new window.ApplePayError('couponCodeInvalid')]
597
+ });
598
+ });
599
+ },
600
+
601
+ onCancel: (event = {}, message = null) => {
602
+ SallaApplePay.detail.onError(message || salla.lang.get('pages.checkout.payment_failed'));
603
+ Salla.event.createAndDispatch('payments::apple-pay.canceled', event);
604
+ },
605
+
606
+ /**
607
+ * Confirm payment after authorization.
608
+ *
609
+ * @param event
610
+ */
611
+ onPaymentAuthorized: async (event) => {
612
+ salla.logger.log('🍏 Pay: onPaymentAuthorized', event.payment);
613
+
614
+ // update guest details
615
+ try {
616
+ await mutateShippingContact(SallaApplePay, event.payment.shippingContact, true);
617
+ } catch (error) {
618
+ salla.logger.error('🍏 Pay: Failed to update guest contact details', error);
619
+
620
+ const response = error?.response || error;
621
+
622
+ // Parse backend errors for shipping contact fields
623
+ const fields = response?.data?.error?.fields || {};
624
+ const errors = [];
625
+
626
+ // Map backend field errors to Apple Pay contact field errors
627
+ if (fields?.email && fields.email.length > 0) {
628
+ errors.push(new window.ApplePayError('shippingContactInvalid', 'emailAddress', fields.email[0]));
629
+ }
630
+
631
+ if (fields?.phone && fields.phone.length > 0) {
632
+ errors.push(new window.ApplePayError('shippingContactInvalid', 'phoneNumber', fields.phone[0]));
633
+ }
634
+
635
+ if (fields?.first_name && fields.first_name.length > 0) {
636
+ errors.push(new window.ApplePayError('shippingContactInvalid', 'name', fields.first_name[0]));
637
+ } else if (fields?.last_name && fields.last_name.length > 0) {
638
+ errors.push(new window.ApplePayError('shippingContactInvalid', 'name', fields.last_name[0]));
639
+ }
640
+
641
+ // If no specific field errors, use general error message
642
+ if (errors.length === 0) {
643
+ const errorMessage = response?.data?.error?.message || response?.data?.error?.code || 'Invalid shipping contact details';
644
+ errors.push(new window.ApplePayError('shippingContactInvalid', 'name', errorMessage));
645
+ }
646
+
647
+ Salla.event.dispatch('payments::apple-pay.authorized.failed', response);
648
+
649
+ if (typeof SallaApplePay.detail.authorized.onFailed === 'function') {
650
+ SallaApplePay.detail.authorized.onFailed(response);
651
+ }
652
+
653
+ // Complete shipping contact selection with invalid contact status
654
+ SallaApplePay.session.completePayment({
655
+ status: ApplePaySession.STATUS_INVALID_SHIPPING_CONTACT,
656
+ errors: errors
657
+ });
658
+
659
+ return;
660
+ }
661
+
662
+ Salla.event.dispatch('payments::apple-pay.authorized.init', event);
663
+ http.post(SallaApplePay.detail.authorized.url.replace('{id}', SallaApplePay.id), {
664
+ payment_method: 'apple_pay',
665
+ applepay_token: JSON.stringify(event.payment)
666
+ }, ({ data }) => {
667
+ Salla.event.dispatch('payments::apple-pay.authorized.success', data);
668
+
669
+ if (typeof SallaApplePay.detail.authorized.onSuccess === 'function') {
670
+ SallaApplePay.detail.authorized.onSuccess(data);
671
+ }
672
+
673
+ SallaApplePay.session.completePayment(ApplePaySession.STATUS_SUCCESS);
674
+ }, (error) => {
675
+
676
+ let response = error?.response;
677
+
678
+ Salla.event.dispatch('payments::apple-pay.authorized.failed', response);
679
+
680
+ if (typeof SallaApplePay.detail.authorized.onFailed === 'function') {
681
+ SallaApplePay.detail.authorized.onFailed(response);
682
+ }
683
+
684
+ SallaApplePay.session.completePayment({
685
+ status: ApplePaySession.STATUS_FAILURE,
686
+ errors: [new window.ApplePayError("unknown", undefined, response?.data?.error?.message || response?.data?.error?.code || 'Failed to parse authorized response')]
687
+ });
688
+ });
689
+ },
690
+
691
+ /**
692
+ * Validate Submit.
693
+ *
694
+ * @param event
695
+ */
696
+ onValidateMerchant: async (event) => {
697
+ try {
698
+ // Dispatch event to initialize Apple Pay merchant validation
699
+ Salla.event.dispatch('payments::apple-pay.validate-merchant.init', event);
700
+
701
+ // Post request to validate merchant
702
+ const { data } = await http.post(SallaApplePay.detail.validateMerchant.url.replace('{id}', SallaApplePay.id), {
703
+ validation_url: event.validationURL
704
+ });
705
+
706
+ // Dispatch event on successful merchant validation
707
+ Salla.event.dispatch('payments::apple-pay.validate-merchant.success', data);
708
+
709
+ // Define a function to handle the completion of merchant validation
710
+ const completeMerchantValidation = (responseData) => {
711
+ SallaApplePay.session.completeMerchantValidation(responseData);
712
+ };
713
+
714
+ // Check if onSuccess function is defined in SallaApplePay.detail.validateMerchant
715
+ if (typeof SallaApplePay.detail.validateMerchant.onSuccess === 'function') {
716
+ // Call onSuccess function and handle response
717
+ const response = await SallaApplePay.detail.validateMerchant.onSuccess(data);
718
+ if (response?.redirect) {
719
+ // Handle redirect if present
720
+ window.location = response.redirect;
721
+ return SallaApplePay.abortValidateMerchant(response);
722
+ }
723
+ }
724
+ completeMerchantValidation(data.data);
725
+ } catch (error) {
726
+ // Handle errors
727
+ console.error(error);
728
+ SallaApplePay.abortValidateMerchant(error?.response);
729
+ }
730
+ },
731
+
732
+ abortValidateMerchant: (response = null) => {
733
+
734
+ SallaApplePay.abortSession();
735
+ Salla.event.dispatch('payments::apple-pay.validate-merchant.failed', response);
736
+
737
+ if (typeof SallaApplePay.detail.validateMerchant.onFailed === 'function') {
738
+ SallaApplePay.detail.validateMerchant.onFailed(response);
739
+ }
740
+ },
741
+
742
+ /**
743
+ * Select Shipping Contact
744
+ *
745
+ * @param event
746
+ */
747
+ onShippingContactSelected: async (event) => {
748
+ salla.logger.log('🍏 Pay: onShippingContactSelected', event.shippingContact);
749
+
750
+ // create address for shipping calculation
751
+ await mutateShippingContact(SallaApplePay, event.shippingContact);
752
+ },
753
+
754
+ /**
755
+ * Select Shipping Method
756
+ *
757
+ * @param event
758
+ *
759
+ */
760
+ onShippingMethodSelected: async (event) => {
761
+
762
+ let shipping_ids = event.shippingMethod.identifier.split(',');
763
+ let shippingMethod = {
764
+ ship_id: shipping_ids[0],
765
+ private_ship_id: typeof shipping_ids[1] === 'undefined' ? null : shipping_ids[1],
766
+ type: typeof shipping_ids[2] === 'undefined' ? null : shipping_ids[2],
767
+ route_id: typeof shipping_ids[3] === 'undefined' ? null : shipping_ids[3],
768
+ };
769
+
770
+ salla.logger.log('🍏 Pay: onShippingMethodSelected', {
771
+ event,
772
+ previous: SallaApplePay.shippingCompany,
773
+ current: shippingMethod,
774
+ });
775
+
776
+ if (SallaApplePay.shouldUpdateShippingCompany(shippingMethod)) {
777
+ try {
778
+
779
+ await SallaApplePay.selectApplePayShippingMethod(shippingMethod);
780
+
781
+ await SallaApplePay.recalculateTotal();
782
+
783
+ } catch (error) {
784
+ salla.logger.warn('🍏 Pay: Failed set the shipping details to api', error);
785
+
786
+ // todo :: find a better handling for error without abort session
787
+ SallaApplePay.session.completeShippingMethodSelection({
788
+ newTotal: SallaApplePay.prepareTotal(),
789
+ newLineItems: SallaApplePay.prepareLineItems(),
790
+ status: SallaApplePay.session.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
791
+ errors: [
792
+ new window.ApplePayError('addressUnserviceable')
793
+ ]
794
+ });
795
+
796
+ return;
797
+ }
798
+ }
799
+
800
+ salla.logger.log('🍏 Pay: completeShippingMethodSelection', {
801
+ newTotal: SallaApplePay.prepareTotal(),
802
+ newLineItems: SallaApplePay.prepareLineItems(),
803
+ });
804
+
805
+ SallaApplePay.session.completeShippingMethodSelection({
806
+ newTotal: SallaApplePay.prepareTotal(),
807
+ newLineItems: SallaApplePay.prepareLineItems(),
808
+ });
809
+ },
810
+
811
+
812
+ abortSession: () => {
813
+ if (SallaApplePay.session) {
814
+ SallaApplePay.session.abort();
815
+ }
816
+ },
817
+
818
+ shouldUpdateShippingCompany(shippingCompany) {
819
+ return SallaApplePay.shippingCompany?.ship_id != shippingCompany?.ship_id || SallaApplePay.shippingCompany?.private_ship_id != shippingCompany?.private_ship_id
820
+ },
821
+
822
+ getApplePaySessionVersion: () => {
823
+ const userAgent = navigator.userAgent || navigator.vendor || window.opera;
824
+
825
+ if (userAgent === 'sallapp') {
826
+ return 5;
827
+ }
828
+
829
+ // can't handle custom user agent like sallapp
830
+ let detection = DetectOS.init();
831
+ let v = parseFloat(detection.os.version);
832
+
833
+ if (detection.os.name === 'Macintosh') {
834
+ if (v < 10.142) {
835
+ return 1;
836
+ }
837
+ } else {
838
+ if (v < 12.11) {
839
+ return 1;
840
+ }
841
+ }
842
+
843
+ return 5;
844
+ },
845
+
846
+ recalculateTotal: () => {
847
+ salla.logger.log('🍏 Pay: recalculate total');
848
+
849
+ return http.get(SallaApplePay.detail.recalculateTotal.url.replace('{id}', SallaApplePay.id), ({ data }) => {
850
+ salla.logger.log('🍏 Pay: recalculate total success', data);
851
+ let cart = data.data.initial_data?.cart || data.data.cart;
852
+ let payments = data.data.initial_data?.payments || data.data.payments;
853
+
854
+ salla.logger.log('🍏 Pay: recalculate total success', {
855
+ cart,
856
+ payments
857
+ });
858
+
859
+ // todo :: enhance response from backend
860
+ SallaApplePay.detail.amount = payments?.gateways?.applePay?.supportedMultiCurrency ? cart.total_in_customer_currency : cart.total;
861
+ SallaApplePay.detail.items = (cart.totals || cart.items).map((item) => {
862
+ return {
863
+ label: item.title,
864
+ amount: (item.amount === 'مجاني' || item.amount === 'Free') ? 0 : item.amount.toString().replace('+', ''),
865
+ };
866
+ });
867
+
868
+ // lets remove last element (final total)
869
+ SallaApplePay.detail.items.pop();
870
+ SallaApplePay.totals = SallaApplePay.detail.items;
871
+
872
+ }, (error) => {
873
+ salla.logger.warn('🍏 Pay: recalculate total failed', error);
874
+
875
+ // general error
876
+ return error?.response?.data?.message;
877
+ });
878
+ },
879
+
880
+
881
+ selectApplePayShippingMethod: (shippingMethod) => {
882
+ salla.logger.log('🍏 Pay: select shipping method ', shippingMethod);
883
+ SallaApplePay.shippingCompany = shippingMethod;
884
+
885
+ const payload = {
886
+ address_id: SallaApplePay.address_id,
887
+ company_id: shippingMethod.ship_id,
888
+ private_company_id: shippingMethod.private_ship_id,
889
+ type: shippingMethod.type || undefined,
890
+ route_id: shippingMethod.route_id || undefined,
891
+ payment_method: 'apple_pay'
892
+ };
893
+ return http.post(SallaApplePay.detail.shippingMethodSelected.url.replace('{id}', SallaApplePay.id), payload, ({ data }) => {
894
+ if (typeof SallaApplePay.detail.shippingMethodSelected.onSuccess === 'function') {
895
+ SallaApplePay.detail.shippingMethodSelected.onSuccess(data);
896
+ }
897
+
898
+ // we don't have any data in this request, lets resolve the promise
899
+ return true;
900
+ }, (error) => {
901
+ salla.logger.warn('🍏 Pay: Set shipping method failed', error);
902
+
903
+ if (typeof SallaApplePay.detail.shippingMethodSelected.onFailed === 'function') {
904
+ SallaApplePay.detail.shippingMethodSelected.onFailed(error);
905
+ }
906
+
907
+ // parse 422 errors
908
+ let response = error?.response?.data?.error;
909
+
910
+ // address id is not valid
911
+ if (response?.data?.fields?.address_id) {
912
+ return response?.data?.fields?.address_id[0];
913
+ }
914
+
915
+ // general error
916
+ return response?.data?.message;
917
+ });
918
+ },
919
+ mappingShippingMethods: methods => methods.map(method => ({
920
+ 'label': method.shipping_title,
921
+ 'amount': method.enable_free_shipping ? 0 : method.ship_cost,
922
+ 'detail': '',
923
+ 'identifier': method.ship_id.toString() + (method.private_ship_id ? ',' + method.private_ship_id.toString() : '') + (method.type ? ',' + method.type : '') + (method.route_id ? ',' + method.route_id : '')
924
+ }))
925
+ };
926
+
927
+ //applePay doesn't allow iframes
928
+ // if (window.ApplePaySession && window.self === window.top && ApplePaySession.canMakePayments()) {
929
+ if (window.ApplePaySession?.canMakePayments()) {
930
+ SallaApplePay.init();
931
+ } else {
932
+ // 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>
933
+ document.querySelectorAll('data-show-if-apple-pay-supported').forEach(element => element.style.display = 'none');
934
+ }
935
+
936
+ const sallaQuickBuyCss = ".s-quick-buy-button .s-button-text{display:flex}apple-pay-button{--apple-pay-button-width:100%;--apple-pay-button-height:40px;--apple-pay-button-border-radius:.75rem;--apple-pay-button-box-sizing:content-box}";
937
+
938
+ const SallaQuickBuy = /*@__PURE__*/ proxyCustomElement(class SallaQuickBuy extends HTMLElement {
939
+ constructor() {
940
+ super();
941
+ this.__registerHost();
942
+ this.validationFailed = createEvent(this, "validationFailed", 7);
943
+ this.requireLogin = createEvent(this, "requireLogin", 7);
944
+ /**
945
+ * Button type.
946
+ *
947
+ * @type {string}
948
+ * @default buy
949
+ **/
950
+ this.type = 'buy';
951
+ /**
952
+ * Product type.
953
+ *
954
+ * @type {string}
955
+ **/
956
+ this.productType = 'product';
957
+ /**
958
+ * Product options, if is empty will get the data from the document.querySelector('salla-product-options[product-id="X"]')
959
+ *
960
+ * @type {object}
961
+ * @default {}
962
+ */
963
+ this.options = {};
964
+ this.quickBuy = salla.lang.get('pages.products.buy_now');
965
+ salla.lang.onLoaded(() => {
966
+ this.quickBuy = salla.lang.get('pages.products.buy_now');
967
+ });
968
+ }
969
+ async quickBuyHandler() {
970
+ // user guest and guest-checkout not enabled
971
+ if (salla.config.isGuest() && !this.isGuestCheckout()) {
972
+ this.requireLogin.emit({ productId: this.productId });
973
+ // todo (low) :: find a way to re-fire the method after success
974
+ let afterLoginEvent = "salla-quick-buy::user.logged-in";
975
+ salla.event.on(afterLoginEvent, () => this.settlePayment());
976
+ salla.api.auth.setAfterLoginEvent(afterLoginEvent);
977
+ return salla.auth.event.dispatch('login::open', { withoutReload: true });
978
+ }
979
+ await this.settlePayment();
980
+ }
981
+ async settlePayment() {
982
+ let optionsElement = document.querySelector(`salla-product-options[product-id="${this.productId}"]`);
983
+ //make sure all the required options are selected
984
+ if (optionsElement && !await optionsElement.reportValidity()) {
985
+ this.validationFailed.emit({ productId: this.productId });
986
+ return salla.error(salla.lang.get('common.messages.required_fields'));
987
+ }
988
+ //use this way to get quantity too
989
+ let data = this.host.getElementSallaData();
990
+ // if the store doesn't have Apple Pay , just create a cart and then redirect to check out page
991
+ if (!this.isApplePayActive) {
992
+ // return salla.product.buyNow(this.productId, data);
993
+ return salla.api.request('checkout/quick-purchase/' + this.productId, data, 'post')
994
+ .then(resp => {
995
+ if (resp.data.redirect) {
996
+ window.location.href = resp.data.redirect;
997
+ }
998
+ return resp;
999
+ });
1000
+ }
1001
+ data.is_applepay = true;
1002
+ if ('append' in data) {
1003
+ data.append('is_applepay', true);
1004
+ }
1005
+ // noinspection TypeScriptValidateJSTypes
1006
+ salla.event.dispatch('payments::apple-pay.start-transaction', {
1007
+ amount: this.amount, // 1000
1008
+ currency: this.currency || 'SAR', // SAR
1009
+ requiredShippingContactFields: this.getRequiredShippingContactFields(),
1010
+ shippingMethods: this.isRequireShipping ? [] : undefined,
1011
+ supportedNetworks: salla.config.get('store.settings.buy_now.networks'),
1012
+ supportedCountries: salla.config.get('store.settings.buy_now.countries'),
1013
+ countryCode: salla.config.get('store.store_country') || 'SA',
1014
+ validateMerchant: {
1015
+ url: this.validateHost ? `${this.validateHost}/checkout/applepay/validate` : salla.url.get('checkout/applepay/validate'),
1016
+ onSuccess: (response) => {
1017
+ if (this.applePayOnly && !this.productId) { // the cart is not passes
1018
+ if (!this.cartId) {
1019
+ salla.logger.warn('🍏 Pay: trying to create applePay transaction without cartId/ProductId !');
1020
+ return Promise.resolve(response);
1021
+ }
1022
+ window.SallaApplePay.id = this.cartId;
1023
+ salla.log('🍏 Pay: create checkout success: with id #' + this.cartId);
1024
+ return Promise.resolve(response);
1025
+ }
1026
+ return salla.api.request('checkout/quick-purchase/' + this.productId, typeof data == 'object' ? data : undefined, 'post', {}).then(response => {
1027
+ // if is redirect url returned for any reason, lets redirect the user to check out
1028
+ if (response?.data?.redirect) {
1029
+ salla.log('🍏 Pay: create checkout success: redirect exits, go to checkout page');
1030
+ window.location.href = response.data.redirect.url;
1031
+ return response;
1032
+ }
1033
+ // the cart is not ready to complete apply pay session
1034
+ if (!response?.data?.id) {
1035
+ salla.logger.warn('🍏 Pay: create checkout success: No id, or redirect');
1036
+ return response;
1037
+ }
1038
+ window.SallaApplePay.id = response.data.id;
1039
+ salla.log('🍏 Pay: create checkout success: with id #' + window.SallaApplePay.id);
1040
+ });
1041
+ }
1042
+ },
1043
+ authorized: {
1044
+ // submit checkout route
1045
+ url: salla.url.get('checkout/{id}/payments/submit'),
1046
+ onFailed: (response) => {
1047
+ window.SallaApplePay.onCancel({}, response?.data?.error?.message || response?.data?.error?.code || salla.lang.get('pages.checkout.payment_failed'));
1048
+ },
1049
+ onSuccess: (response) => {
1050
+ window.location.href = response.redirect.url;
1051
+ salla.log('🍏 Pay: authorized Success:: redirect to thank you page, order placed');
1052
+ }
1053
+ },
1054
+ shippingMethodSelected: this.isRequireShipping ? {
1055
+ url: salla.url.get('checkout/{id}/shipping/details'),
1056
+ } : undefined,
1057
+ shippingContactSelected: this.isRequireShipping ? {
1058
+ url: salla.url.get('checkout/{id}/address/add'),
1059
+ } : undefined,
1060
+ guestContactSelected: this.isGuestCheckout() ? {
1061
+ url: salla.url.get('checkout/{id}/customer'),
1062
+ } : undefined,
1063
+ onCouponCodeChanged: {
1064
+ url: salla.url.get('checkout/{id}/coupons')
1065
+ },
1066
+ recalculateTotal: {
1067
+ url: salla.url.get('checkout/{id}/payments/recalculate?payment_method=apple_pay')
1068
+ },
1069
+ onError: function (message) {
1070
+ salla.log(message);
1071
+ salla.notify.error(message);
1072
+ }
1073
+ });
1074
+ }
1075
+ isGuestCheckout() {
1076
+ return salla.config.isGuest() && salla.config.get('store.features').includes('guest-checkout') && this.isPhysicalProduct();
1077
+ }
1078
+ getRequiredShippingContactFields() {
1079
+ let fields = [];
1080
+ if (this.isRequireShipping) {
1081
+ fields.push('postalAddress');
1082
+ }
1083
+ if (this.isGuestCheckout()) {
1084
+ fields.push('email', 'phone', 'name');
1085
+ }
1086
+ return fields;
1087
+ }
1088
+ componentWillLoad() {
1089
+ console.log('🍏 Pay: Quick Buy Component Loaded');
1090
+ const canMakePayments = typeof window !== 'undefined' && !!window.ApplePaySession?.canMakePayments?.();
1091
+ const storeHasApplePay = salla?.config?.get?.('store.settings.payments')?.includes?.('apple_pay') ?? true;
1092
+ const isSallaGateway = salla?.config?.get?.('store.settings.is_salla_gateway', false) ?? true;
1093
+ this.isApplePayActive = canMakePayments && storeHasApplePay && isSallaGateway;
1094
+ const runInit = async () => {
1095
+ if (!this.currency && salla?.config?.get) {
1096
+ this.currency = salla.config.get('store.settings.buy_now.multi_currency') ? salla.config.get('user.currency_code') : 'SAR';
1097
+ }
1098
+ if (!this.productId && salla?.config?.get && salla.url?.is_page) {
1099
+ this.productId = salla.config.get('page.id');
1100
+ }
1101
+ if (!this.applePayOnly && !this.productId) {
1102
+ salla?.logger?.warn?.('🍏 Pay: Failed load the quick buy, the product id is missing');
1103
+ return;
1104
+ }
1105
+ if ((!this.amount || !this.isRequireShipping) && this.productId && salla?.product?.getDetails) {
1106
+ await salla.product.getDetails(this.productId, []).then((response) => {
1107
+ this.amount = response.data.price;
1108
+ this.isRequireShipping = response?.data?.is_require_shipping || false;
1109
+ }).catch((error) => {
1110
+ salla?.logger?.warn?.('🍏 Pay: Failed load the quick buy, get the product details failed: ', error);
1111
+ });
1112
+ }
1113
+ if (this.type === 'donate' && salla?.event?.on) {
1114
+ salla.event.on('product-options::donation-changed', (data) => {
1115
+ if (String(data.id) !== String(this.productId))
1116
+ return;
1117
+ this.amount = data.price;
1118
+ });
1119
+ }
1120
+ else if (salla?.url?.is_page?.('product.single') && salla?.product?.event?.onPriceUpdated) {
1121
+ salla.product.event.onPriceUpdated(response => { this.amount = response.data.price; });
1122
+ }
1123
+ this.isApplePayActive = (salla?.helpers?.hasApplePay?.() ?? canMakePayments)
1124
+ && (salla?.config?.get?.('store.settings.payments')?.includes?.('apple_pay') ?? storeHasApplePay)
1125
+ && (salla?.config?.get?.('store.settings.is_salla_gateway', false) ?? isSallaGateway);
1126
+ if (!document.getElementById('apple-pay-sdk') && this.isApplePayActive) {
1127
+ const script = document.createElement('script');
1128
+ script.src = 'https://applepay.cdn-apple.com/jsapi/v1/apple-pay-sdk.js';
1129
+ script.setAttribute('id', 'apple-pay-sdk');
1130
+ script.async = true;
1131
+ document.body.appendChild(script);
1132
+ }
1133
+ };
1134
+ return new Promise((resolve) => {
1135
+ if (typeof salla?.onReady === 'function') {
1136
+ salla.onReady(() => runInit().then(() => resolve(true)));
1137
+ }
1138
+ else {
1139
+ runInit().then(() => resolve(true));
1140
+ }
1141
+ });
1142
+ }
1143
+ render() {
1144
+ return h(Host, { key: '9a8785c4a1e04d258a60924acf90407495a4de74' }, this.quickBuyButton());
1145
+ }
1146
+ quickBuyButton() {
1147
+ 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 });
1148
+ }
1149
+ // function to check if product is physical
1150
+ isPhysicalProduct() {
1151
+ return this.productType === 'product' || this.productType === 'group_products' || this.productType === 'food';
1152
+ }
1153
+ get host() { return this; }
1154
+ static get style() { return sallaQuickBuyCss; }
1155
+ }, [0, "salla-quick-buy", {
1156
+ "type": [1025],
1157
+ "productType": [1025, "product-type"],
1158
+ "productId": [1025, "product-id"],
1159
+ "cartId": [1025, "cart-id"],
1160
+ "amount": [1538],
1161
+ "currency": [1025],
1162
+ "options": [16],
1163
+ "isRequireShipping": [1028, "is-require-shipping"],
1164
+ "applePayOnly": [1028, "apple-pay-only"],
1165
+ "validateHost": [1025, "validate-host"],
1166
+ "isApplePayActive": [32],
1167
+ "quickBuy": [32]
1168
+ }]);
1169
+ function defineCustomElement() {
1170
+ if (typeof customElements === "undefined") {
1171
+ return;
1172
+ }
1173
+ const components = ["salla-quick-buy"];
1174
+ components.forEach(tagName => { switch (tagName) {
1175
+ case "salla-quick-buy":
1176
+ if (!customElements.get(tagName)) {
1177
+ customElements.define(tagName, SallaQuickBuy);
1178
+ }
1179
+ break;
1180
+ } });
1181
+ }
1182
+ defineCustomElement();
1183
+
1184
+ export { SallaQuickBuy as S, defineCustomElement as d };