@salla.sa/twilight-components 2.14.392 → 2.14.393

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 (568) hide show
  1. package/dist/cjs/app-globals-oehrC7QI.js +39 -0
  2. package/dist/cjs/{filepond-D-ur1GA-.js → filepond-D7RVR_w_.js} +10 -5
  3. package/dist/cjs/{filepond-plugin-file-poster-DigEeKId.js → filepond-plugin-file-poster-DTuZK2ot.js} +11 -7
  4. package/dist/cjs/{filepond-plugin-file-validate-size-R9el3Yro.js → filepond-plugin-file-validate-size-DHc6pF_j.js} +1 -1
  5. package/dist/cjs/filepond-plugin-file-validate-type-DnkcvJVc.js +271 -0
  6. package/dist/cjs/{filepond-plugin-image-edit-bhI8kqN_.js → filepond-plugin-image-edit-vrZ1s7kw.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-exif-orientation-COXZUVRV.js → filepond-plugin-image-exif-orientation-Bn5JSzQK.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-image-preview-COP8QJBf.js → filepond-plugin-image-preview-8qWUFe9n.js} +1 -1
  9. package/dist/cjs/{index-CGnPURjZ.js → index-C5VeFDQ0.js} +1966 -1344
  10. package/dist/cjs/{index-BILBEE9f.js → index-CwD81m7i.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +4 -3
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +5 -5
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +19 -15
  14. package/dist/cjs/salla-add-product-button_4.cjs.entry.js +12 -10
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +3 -3
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +5 -5
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +3 -3
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +3 -3
  19. package/dist/cjs/salla-booking-field_7.cjs.entry.js +25 -23
  20. package/dist/cjs/salla-bullet-delivery.cjs.entry.js +3 -3
  21. package/dist/cjs/salla-cart-coupons.cjs.entry.js +3 -3
  22. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +5 -5
  23. package/dist/cjs/salla-comment-form_8.cjs.entry.js +17 -17
  24. package/dist/cjs/salla-conditional-offer.cjs.entry.js +3 -3
  25. package/dist/cjs/salla-contacts.cjs.entry.js +3 -3
  26. package/dist/cjs/salla-cookies-bar.cjs.entry.js +3 -3
  27. package/dist/cjs/salla-count-down.cjs.entry.js +35 -11
  28. package/dist/cjs/salla-custom-fields.cjs.entry.js +3 -3
  29. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-filters-widget.cjs.entry.js +3 -3
  31. package/dist/cjs/salla-filters.cjs.entry.js +3 -3
  32. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-gifting.cjs.entry.js +3 -3
  34. package/dist/cjs/salla-hook.cjs.entry.js +5 -2
  35. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +3 -3
  36. package/dist/cjs/salla-installment.cjs.entry.js +3 -3
  37. package/dist/cjs/salla-list-tile.cjs.entry.js +3 -3
  38. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-login-modal.cjs.entry.js +3 -3
  40. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +3 -3
  41. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  42. package/dist/cjs/salla-loyalty.cjs.entry.js +3 -3
  43. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +3 -3
  44. package/dist/cjs/salla-map.cjs.entry.js +3 -3
  45. package/dist/cjs/salla-menu.cjs.entry.js +3 -3
  46. package/dist/cjs/salla-metadata.cjs.entry.js +3 -3
  47. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +5 -5
  48. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +8 -6
  49. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +6 -4
  50. package/dist/cjs/salla-notification-item.cjs.entry.js +3 -3
  51. package/dist/cjs/salla-notifications.cjs.entry.js +50 -5
  52. package/dist/cjs/salla-offer-modal.cjs.entry.js +3 -3
  53. package/dist/cjs/salla-offer.cjs.entry.js +3 -3
  54. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +3 -3
  55. package/dist/cjs/salla-order-details-options.cjs.entry.js +3 -3
  56. package/dist/cjs/salla-order-details.cjs.entry.js +6 -4
  57. package/dist/cjs/salla-order-edit-item.cjs.entry.js +3 -3
  58. package/dist/cjs/salla-order-edit.cjs.entry.js +3 -3
  59. package/dist/cjs/salla-order-summary.cjs.entry.js +3 -3
  60. package/dist/cjs/salla-order-totals-card.cjs.entry.js +6 -4
  61. package/dist/cjs/salla-orders.cjs.entry.js +3 -3
  62. package/dist/cjs/salla-payments.cjs.entry.js +3 -3
  63. package/dist/cjs/salla-placeholder.cjs.entry.js +3 -3
  64. package/dist/cjs/salla-price-range.cjs.entry.js +3 -3
  65. package/dist/cjs/salla-product-card.cjs.entry.js +3 -3
  66. package/dist/cjs/salla-product-size-guide.cjs.entry.js +3 -3
  67. package/dist/cjs/salla-products-list.cjs.entry.js +3 -3
  68. package/dist/cjs/salla-products-slider.cjs.entry.js +3 -3
  69. package/dist/cjs/salla-progress-bar.cjs.entry.js +3 -3
  70. package/dist/cjs/salla-quick-order.cjs.entry.js +3 -3
  71. package/dist/cjs/salla-rating-modal.cjs.entry.js +3 -3
  72. package/dist/cjs/salla-scopes.cjs.entry.js +3 -3
  73. package/dist/cjs/salla-search.cjs.entry.js +6 -4
  74. package/dist/cjs/salla-skeleton.cjs.entry.js +3 -3
  75. package/dist/cjs/salla-slider.cjs.entry.js +20 -14
  76. package/dist/cjs/salla-social-share.cjs.entry.js +3 -3
  77. package/dist/cjs/salla-social.cjs.entry.js +3 -3
  78. package/dist/cjs/salla-tab-content_3.cjs.entry.js +7 -7
  79. package/dist/cjs/salla-tiered-offer.cjs.entry.js +3 -3
  80. package/dist/cjs/salla-tooltip.cjs.entry.js +3 -3
  81. package/dist/cjs/salla-trust-badges.cjs.entry.js +3 -3
  82. package/dist/cjs/salla-user-menu.cjs.entry.js +3 -3
  83. package/dist/cjs/salla-user-profile.cjs.entry.js +3 -3
  84. package/dist/cjs/salla-user-settings.cjs.entry.js +3 -3
  85. package/dist/cjs/salla-verify.cjs.entry.js +3 -3
  86. package/dist/cjs/salla-wallet.cjs.entry.js +3 -3
  87. package/dist/cjs/twilight.cjs.js +5 -4
  88. package/dist/cjs/{vanilla-picker-DI3TImGd.js → vanilla-picker-yKERbLpx.js} +1 -1
  89. package/dist/collection/collection-manifest.json +3 -2
  90. package/dist/collection/components/salla-accordion/salla-accordion-head.js +2 -2
  91. package/dist/collection/components/salla-accordion/salla-accordion.js +4 -4
  92. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +19 -19
  93. package/dist/collection/components/salla-alert/salla-alert.js +5 -5
  94. package/dist/collection/components/salla-apps-icons/salla-apps-icons.js +6 -6
  95. package/dist/collection/components/salla-booking-field/salla-booking-field.js +4 -4
  96. package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +9 -9
  97. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +6 -3
  98. package/dist/collection/components/salla-button/salla-button.js +11 -11
  99. package/dist/collection/components/salla-cart-coupons/salla-cart-coupons.js +2 -1
  100. package/dist/collection/components/salla-cart-item-offers/salla-cart-item-offers.js +8 -8
  101. package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +2 -2
  102. package/dist/collection/components/salla-color-picker/salla-color-picker.js +20 -14
  103. package/dist/collection/components/salla-comment-form/salla-comment-form.js +6 -6
  104. package/dist/collection/components/salla-comments/salla-comment-item.js +2 -3
  105. package/dist/collection/components/salla-comments/salla-comments.js +18 -17
  106. package/dist/collection/components/salla-contacts/salla-contacts.js +10 -10
  107. package/dist/collection/components/salla-count-down/salla-count-down.js +66 -42
  108. package/dist/collection/components/salla-custom-fields/salla-custom-fields.js +9 -7
  109. package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +69 -65
  110. package/dist/collection/components/salla-drawer/salla-drawer.js +11 -11
  111. package/dist/collection/components/salla-file-upload/salla-file-upload.css +1 -1
  112. package/dist/collection/components/salla-file-upload/salla-file-upload.js +85 -84
  113. package/dist/collection/components/salla-filters/salla-filters.js +2 -2
  114. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +4 -5
  115. package/dist/collection/components/salla-gifting/salla-gifting.js +11 -11
  116. package/dist/collection/components/salla-hook/salla-hook.js +2 -2
  117. package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.js +6 -6
  118. package/dist/collection/components/salla-installment/salla-installment.js +5 -5
  119. package/dist/collection/components/salla-list-tile/salla-list-tile.js +2 -2
  120. package/dist/collection/components/salla-loading/salla-loading.js +4 -4
  121. package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +5 -5
  122. package/dist/collection/components/salla-login-modal/salla-login-modal.js +14 -14
  123. package/dist/collection/components/salla-loyalty/salla-loyalty-prize-item.js +4 -3
  124. package/dist/collection/components/salla-loyalty/salla-loyalty.js +13 -12
  125. package/dist/collection/components/salla-map/salla-map.js +14 -14
  126. package/dist/collection/components/salla-menu/salla-menu.js +10 -9
  127. package/dist/collection/components/salla-metadata/salla-metadata.js +3 -3
  128. package/dist/collection/components/salla-modal/salla-modal.js +11 -11
  129. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-cart.js +2 -2
  130. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-details.js +2 -2
  131. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-options-modal.js +4 -2
  132. package/dist/collection/components/salla-multiple-bundle-product/components/salla-multiple-bundle-product-slider.js +8 -7
  133. package/dist/collection/components/salla-multiple-bundle-product/salla-multiple-bundle-product.js +2 -2
  134. package/dist/collection/components/salla-notifications/salla-notification-item.js +2 -2
  135. package/dist/collection/components/salla-notifications/salla-notifications.js +50 -5
  136. package/dist/collection/components/salla-offer/salla-offer.js +1 -1
  137. package/dist/collection/components/salla-order-details/salla-order-details-multiple-bundle-product.js +5 -5
  138. package/dist/collection/components/salla-order-details/salla-order-details-options.js +6 -5
  139. package/dist/collection/components/salla-order-details/salla-order-details.js +4 -3
  140. package/dist/collection/components/salla-order-edit/salla-order-edit-item.js +4 -4
  141. package/dist/collection/components/salla-order-edit/salla-order-edit.js +4 -4
  142. package/dist/collection/components/salla-order-summary/salla-order-summary.js +2 -2
  143. package/dist/collection/components/salla-order-totals-card/salla-order-totals-card.js +4 -3
  144. package/dist/collection/components/salla-orders/salla-orders.js +4 -4
  145. package/dist/collection/components/salla-payments/salla-payments.js +0 -1
  146. package/dist/collection/components/salla-placeholder/salla-placeholder.js +3 -3
  147. package/dist/collection/components/salla-price-range/salla-price-range.js +8 -8
  148. package/dist/collection/components/salla-product-availability/salla-product-availability.js +6 -6
  149. package/dist/collection/components/salla-product-card/salla-product-card.js +18 -18
  150. package/dist/collection/components/salla-product-options/salla-product-options.js +15 -13
  151. package/dist/collection/components/salla-products-list/salla-products-list.js +20 -21
  152. package/dist/collection/components/salla-products-slider/salla-products-slider.js +22 -23
  153. package/dist/collection/components/salla-progress-bar/salla-progress-bar.js +21 -20
  154. package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +2 -2
  155. package/dist/collection/components/salla-quick-buy/salla-quick-buy.js +16 -17
  156. package/dist/collection/components/salla-quick-order/salla-quick-order.js +11 -11
  157. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +2 -2
  158. package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +8 -8
  159. package/dist/collection/components/salla-review-card/salla-review-card.js +3 -3
  160. package/dist/collection/components/salla-reviews/salla-reviews.js +16 -13
  161. package/dist/collection/components/salla-reviews-summary/salla-reviews-summary.js +2 -2
  162. package/dist/collection/components/salla-scopes/salla-scopes.js +2 -2
  163. package/dist/collection/components/salla-search/salla-search.js +6 -6
  164. package/dist/collection/components/salla-skeleton/salla-skeleton.js +3 -3
  165. package/dist/collection/components/salla-slider/salla-slider.css +9 -2
  166. package/dist/collection/components/salla-slider/salla-slider.js +25 -25
  167. package/dist/collection/components/salla-social-share/salla-social-share.js +3 -3
  168. package/dist/collection/components/salla-tabs/salla-tab-content.js +2 -2
  169. package/dist/collection/components/salla-tabs/salla-tab-header.js +5 -5
  170. package/dist/collection/components/salla-tabs/salla-tabs.js +2 -2
  171. package/dist/collection/components/salla-tel-input/salla-tel-input.js +9 -8
  172. package/dist/collection/components/salla-tooltip/salla-tooltip.js +5 -5
  173. package/dist/collection/components/salla-trust-badges/salla-trust-badges.js +1 -1
  174. package/dist/collection/components/salla-user-menu/salla-user-menu.js +5 -5
  175. package/dist/collection/components/salla-user-profile/salla-user-profile.js +1 -1
  176. package/dist/collection/components/salla-verify/salla-verify.js +4 -4
  177. package/dist/components/Helper.js +1 -432
  178. package/dist/components/_commonjsHelpers.js +1 -7
  179. package/dist/components/anime.es.js +1 -1310
  180. package/dist/components/arrow-left.js +1 -8
  181. package/dist/components/axios.js +2 -3908
  182. package/dist/components/bell-ring.js +1 -8
  183. package/dist/components/camera.js +1 -8
  184. package/dist/components/cancel.js +1 -8
  185. package/dist/components/cart.js +1 -8
  186. package/dist/components/check-circle2.js +1 -15
  187. package/dist/components/check.js +1 -8
  188. package/dist/components/facebook.js +1 -10
  189. package/dist/components/filepond-plugin-file-poster.js +3 -659
  190. package/dist/components/filepond-plugin-file-validate-size.js +2 -204
  191. package/dist/components/filepond-plugin-file-validate-type.js +3 -279
  192. package/dist/components/filepond-plugin-image-edit.js +2 -487
  193. package/dist/components/filepond-plugin-image-exif-orientation.js +2 -214
  194. package/dist/components/filepond-plugin-image-preview.js +2 -2237
  195. package/dist/components/filepond.js +3 -11282
  196. package/dist/components/gift.js +1 -8
  197. package/dist/components/image.js +1 -8
  198. package/dist/components/index.d.ts +2 -0
  199. package/dist/components/index.js +1 -8163
  200. package/dist/components/index2.js +1 -1709
  201. package/dist/components/index3.js +1 -2550
  202. package/dist/components/interfaces.js +1 -12
  203. package/dist/components/isObject.js +1 -292
  204. package/dist/components/keyboard_arrow_down.js +1 -8
  205. package/dist/components/keyboard_arrow_right.js +1 -15
  206. package/dist/components/location.js +1 -11
  207. package/dist/components/mail.js +1 -8
  208. package/dist/components/minus.js +1 -15
  209. package/dist/components/salla-accordion-body.js +1 -6
  210. package/dist/components/salla-accordion-body2.js +1 -30
  211. package/dist/components/salla-accordion-head.js +1 -6
  212. package/dist/components/salla-accordion-head2.js +1 -63
  213. package/dist/components/salla-accordion.js +1 -6
  214. package/dist/components/salla-accordion2.js +1 -68
  215. package/dist/components/salla-add-product-button.js +1 -6
  216. package/dist/components/salla-add-product-button2.js +1 -306
  217. package/dist/components/salla-advertisement.js +1 -155
  218. package/dist/components/salla-alert.js +1 -59
  219. package/dist/components/salla-app-install-alert.js +1 -91
  220. package/dist/components/salla-apps-icons.js +1 -63
  221. package/dist/components/salla-booking-field.js +1 -6
  222. package/dist/components/salla-booking-field2.js +1 -221
  223. package/dist/components/salla-bottom-alert.js +1 -214
  224. package/dist/components/salla-breadcrumb.js +1 -226
  225. package/dist/components/salla-bullet-delivery.js +1 -2114
  226. package/dist/components/salla-button.js +1 -6
  227. package/dist/components/salla-button2.js +1 -174
  228. package/dist/components/salla-cart-coupons.js +1 -284
  229. package/dist/components/salla-cart-item-offers.js +1 -143
  230. package/dist/components/salla-cart-summary.js +1 -136
  231. package/dist/components/salla-color-picker.js +1 -6
  232. package/dist/components/salla-color-picker2.js +1 -260
  233. package/dist/components/salla-comment-form.js +1 -6
  234. package/dist/components/salla-comment-form2.js +1 -64
  235. package/dist/components/salla-comment-item.js +1 -6
  236. package/dist/components/salla-comment-item2.js +1 -217
  237. package/dist/components/salla-comments.js +1 -395
  238. package/dist/components/salla-conditional-fields.js +1 -6
  239. package/dist/components/salla-conditional-fields2.js +1 -137
  240. package/dist/components/salla-conditional-offer.js +1 -194
  241. package/dist/components/salla-contacts.js +1 -125
  242. package/dist/components/salla-cookies-bar.js +1 -107
  243. package/dist/components/salla-count-down.js +1 -6
  244. package/dist/components/salla-count-down2.js +1 -247
  245. package/dist/components/salla-custom-fields.js +1 -175
  246. package/dist/components/salla-datetime-picker.js +1 -6
  247. package/dist/components/salla-datetime-picker2.js +1 -342
  248. package/dist/components/salla-delivery-promise.js +1 -263
  249. package/dist/components/salla-drawer.js +1 -6
  250. package/dist/components/salla-drawer2.js +1 -214
  251. package/dist/components/salla-file-upload.js +1 -6
  252. package/dist/components/salla-file-upload2.js +1 -583
  253. package/dist/components/salla-filters-widget.js +1 -6
  254. package/dist/components/salla-filters-widget2.js +1 -245
  255. package/dist/components/salla-filters.js +1 -253
  256. package/dist/components/salla-fulfillment-methods.js +1 -61
  257. package/dist/components/salla-gifting.js +1 -732
  258. package/dist/components/salla-hook.js +1 -47
  259. package/dist/components/salla-infinite-scroll.js +1 -112
  260. package/dist/components/salla-installment.js +1 -306
  261. package/dist/components/salla-list-tile.js +1 -6
  262. package/dist/components/salla-list-tile2.js +1 -47
  263. package/dist/components/salla-loading.js +1 -6
  264. package/dist/components/salla-loading2.js +1 -51
  265. package/dist/components/salla-localization-modal.js +1 -296
  266. package/dist/components/salla-login-modal.js +1 -6
  267. package/dist/components/salla-login-modal2.js +1 -359
  268. package/dist/components/salla-loyalty-prize-item.js +1 -39
  269. package/dist/components/salla-loyalty-program.js +1 -115
  270. package/dist/components/salla-loyalty.js +1 -304
  271. package/dist/components/salla-maintenance-alert.js +1 -57
  272. package/dist/components/salla-map.js +1 -6
  273. package/dist/components/salla-map2.js +1 -766
  274. package/dist/components/salla-menu.js +1 -165
  275. package/dist/components/salla-metadata.js +1 -97
  276. package/dist/components/salla-modal.js +1 -6
  277. package/dist/components/salla-modal2.js +1 -215
  278. package/dist/components/salla-multiple-bundle-product-cart.js +1 -6
  279. package/dist/components/salla-multiple-bundle-product-cart2.js +1 -151
  280. package/dist/components/salla-multiple-bundle-product-details.js +1 -6
  281. package/dist/components/salla-multiple-bundle-product-details2.js +1 -296
  282. package/dist/components/salla-multiple-bundle-product-options-modal.js +1 -6
  283. package/dist/components/salla-multiple-bundle-product-options-modal2.js +1 -598
  284. package/dist/components/salla-multiple-bundle-product-slider.js +1 -6
  285. package/dist/components/salla-multiple-bundle-product-slider2.js +1 -136
  286. package/dist/components/salla-multiple-bundle-product.js +1 -207
  287. package/dist/components/salla-notification-item.js +1 -6
  288. package/dist/components/salla-notification-item2.js +1 -32
  289. package/dist/components/salla-notifications.js +1 -145
  290. package/dist/components/salla-offer-modal.js +1 -328
  291. package/dist/components/salla-offer.js +1 -478
  292. package/dist/components/salla-order-details-multiple-bundle-product.js +1 -6
  293. package/dist/components/salla-order-details-multiple-bundle-product2.js +1 -122
  294. package/dist/components/salla-order-details-options.js +1 -6
  295. package/dist/components/salla-order-details-options2.js +1 -140
  296. package/dist/components/salla-order-details.js +1 -122
  297. package/dist/components/salla-order-edit-item.js +1 -6
  298. package/dist/components/salla-order-edit-item2.js +1 -181
  299. package/dist/components/salla-order-edit.js +1 -288
  300. package/dist/components/salla-order-summary.js +1 -132
  301. package/dist/components/salla-order-totals-card.js +1 -87
  302. package/dist/components/salla-orders.js +1 -271
  303. package/dist/components/salla-payments.js +1 -76
  304. package/dist/components/salla-placeholder.js +1 -6
  305. package/dist/components/salla-placeholder2.js +1 -66
  306. package/dist/components/salla-price-range.js +1 -6
  307. package/dist/components/salla-price-range2.js +1 -204
  308. package/dist/components/salla-product-availability.js +1 -6
  309. package/dist/components/salla-product-availability2.js +1 -206
  310. package/dist/components/salla-product-card.js +1 -6
  311. package/dist/components/salla-product-card2.js +1 -241
  312. package/dist/components/salla-product-options.js +1 -6
  313. package/dist/components/salla-product-options2.js +1 -962
  314. package/dist/components/salla-product-size-guide.js +1 -130
  315. package/dist/components/salla-products-list.js +1 -6
  316. package/dist/components/salla-products-list2.js +1 -812
  317. package/dist/components/salla-products-slider.js +1 -6
  318. package/dist/components/salla-products-slider2.js +1 -215
  319. package/dist/components/salla-progress-bar.js +1 -6
  320. package/dist/components/salla-progress-bar2.js +1 -94
  321. package/dist/components/salla-quantity-input.js +1 -6
  322. package/dist/components/salla-quantity-input2.js +1 -127
  323. package/dist/components/salla-quick-buy.js +1 -6
  324. package/dist/components/salla-quick-buy2.js +1 -1181
  325. package/dist/components/salla-quick-order.js +1 -299
  326. package/dist/components/salla-rating-modal.js +1 -530
  327. package/dist/components/salla-rating-stars.js +1 -6
  328. package/dist/components/salla-rating-stars2.js +1 -162
  329. package/dist/components/salla-review-card.js +1 -6
  330. package/dist/components/salla-review-card2.js +1 -198
  331. package/dist/components/salla-reviews-page.js +1 -726
  332. package/dist/components/salla-reviews-summary.js +1 -6
  333. package/dist/components/salla-reviews-summary2.js +1 -132
  334. package/dist/components/salla-reviews.js +1 -143
  335. package/dist/components/salla-scopes.js +1 -249
  336. package/dist/components/salla-search.js +1 -213
  337. package/dist/components/salla-skeleton.js +1 -6
  338. package/dist/components/salla-skeleton2.js +1 -50
  339. package/dist/components/salla-slider.js +1 -6
  340. package/dist/components/salla-slider2.js +1 -10483
  341. package/dist/components/salla-social-share.js +1 -194
  342. package/dist/components/salla-social.js +1 -89
  343. package/dist/components/salla-tab-content.js +1 -6
  344. package/dist/components/salla-tab-content2.js +1 -55
  345. package/dist/components/salla-tab-header.js +1 -6
  346. package/dist/components/salla-tab-header2.js +1 -85
  347. package/dist/components/salla-tabs.js +1 -6
  348. package/dist/components/salla-tabs2.js +1 -75
  349. package/dist/components/salla-tel-input.js +1 -6
  350. package/dist/components/salla-tel-input2.js +1 -168
  351. package/dist/components/salla-tiered-offer.js +1 -366
  352. package/dist/components/salla-tooltip.js +1 -6
  353. package/dist/components/salla-tooltip2.js +1 -57
  354. package/dist/components/salla-trust-badges.js +1 -90
  355. package/dist/components/salla-user-menu.js +1 -344
  356. package/dist/components/salla-user-profile.js +1 -203
  357. package/dist/components/salla-user-settings.js +1 -139
  358. package/dist/components/salla-verify.js +1 -303
  359. package/dist/components/salla-wallet.js +1 -114
  360. package/dist/components/search.js +1 -8
  361. package/dist/components/shopping-bag.js +1 -8
  362. package/dist/components/special-discount.js +1 -8
  363. package/dist/components/star.js +1 -8
  364. package/dist/components/star2.js +1 -8
  365. package/dist/components/vanilla-picker.js +2 -1034
  366. package/dist/components/whatsapp2.js +1 -8
  367. package/dist/esm/app-globals-BFryt7-C.js +37 -0
  368. package/dist/esm/{filepond-kTbl0kuh.js → filepond-DlGaLh8N.js} +10 -5
  369. package/dist/esm/{filepond-plugin-file-poster-CyywnjKv.js → filepond-plugin-file-poster-BTVFYcQx.js} +11 -7
  370. package/dist/esm/{filepond-plugin-file-validate-size-DgteZhje.js → filepond-plugin-file-validate-size-DGryLmWv.js} +1 -1
  371. package/dist/esm/filepond-plugin-file-validate-type-DxKfCD0V.js +269 -0
  372. package/dist/esm/{filepond-plugin-image-edit-pZ_mETE7.js → filepond-plugin-image-edit-2W7pu9hn.js} +1 -1
  373. package/dist/esm/{filepond-plugin-image-exif-orientation-CjKYl7HL.js → filepond-plugin-image-exif-orientation-OQu-IvPH.js} +1 -1
  374. package/dist/esm/{filepond-plugin-image-preview-BzJTl_2A.js → filepond-plugin-image-preview-DEW_tSNR.js} +1 -1
  375. package/dist/esm/{index-3Kis_Ivk.js → index-BDqMkCqE.js} +1 -1
  376. package/dist/esm/{index-C23tPnnH.js → index-DYB20YqN.js} +1966 -1344
  377. package/dist/esm/loader.js +4 -3
  378. package/dist/esm/salla-accordion-body_2.entry.js +5 -5
  379. package/dist/esm/salla-accordion_6.entry.js +19 -15
  380. package/dist/esm/salla-add-product-button_4.entry.js +12 -10
  381. package/dist/esm/salla-advertisement.entry.js +3 -3
  382. package/dist/esm/salla-alert_2.entry.js +5 -5
  383. package/dist/esm/salla-app-install-alert.entry.js +3 -3
  384. package/dist/esm/salla-apps-icons.entry.js +3 -3
  385. package/dist/esm/salla-booking-field_7.entry.js +25 -23
  386. package/dist/esm/salla-bullet-delivery.entry.js +3 -3
  387. package/dist/esm/salla-cart-coupons.entry.js +3 -3
  388. package/dist/esm/salla-cart-item-offers_2.entry.js +5 -5
  389. package/dist/esm/salla-comment-form_8.entry.js +17 -17
  390. package/dist/esm/salla-conditional-offer.entry.js +3 -3
  391. package/dist/esm/salla-contacts.entry.js +3 -3
  392. package/dist/esm/salla-cookies-bar.entry.js +3 -3
  393. package/dist/esm/salla-count-down.entry.js +35 -11
  394. package/dist/esm/salla-custom-fields.entry.js +3 -3
  395. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  396. package/dist/esm/salla-filters-widget.entry.js +3 -3
  397. package/dist/esm/salla-filters.entry.js +3 -3
  398. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  399. package/dist/esm/salla-gifting.entry.js +3 -3
  400. package/dist/esm/salla-hook.entry.js +5 -2
  401. package/dist/esm/salla-infinite-scroll.entry.js +3 -3
  402. package/dist/esm/salla-installment.entry.js +3 -3
  403. package/dist/esm/salla-list-tile.entry.js +3 -3
  404. package/dist/esm/salla-localization-modal.entry.js +1 -1
  405. package/dist/esm/salla-login-modal.entry.js +3 -3
  406. package/dist/esm/salla-loyalty-prize-item.entry.js +3 -3
  407. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  408. package/dist/esm/salla-loyalty.entry.js +3 -3
  409. package/dist/esm/salla-maintenance-alert.entry.js +3 -3
  410. package/dist/esm/salla-map.entry.js +3 -3
  411. package/dist/esm/salla-menu.entry.js +3 -3
  412. package/dist/esm/salla-metadata.entry.js +3 -3
  413. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +5 -5
  414. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +8 -6
  415. package/dist/esm/salla-multiple-bundle-product.entry.js +6 -4
  416. package/dist/esm/salla-notification-item.entry.js +3 -3
  417. package/dist/esm/salla-notifications.entry.js +50 -5
  418. package/dist/esm/salla-offer-modal.entry.js +3 -3
  419. package/dist/esm/salla-offer.entry.js +3 -3
  420. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +3 -3
  421. package/dist/esm/salla-order-details-options.entry.js +3 -3
  422. package/dist/esm/salla-order-details.entry.js +6 -4
  423. package/dist/esm/salla-order-edit-item.entry.js +3 -3
  424. package/dist/esm/salla-order-edit.entry.js +3 -3
  425. package/dist/esm/salla-order-summary.entry.js +3 -3
  426. package/dist/esm/salla-order-totals-card.entry.js +6 -4
  427. package/dist/esm/salla-orders.entry.js +3 -3
  428. package/dist/esm/salla-payments.entry.js +3 -3
  429. package/dist/esm/salla-placeholder.entry.js +3 -3
  430. package/dist/esm/salla-price-range.entry.js +3 -3
  431. package/dist/esm/salla-product-card.entry.js +3 -3
  432. package/dist/esm/salla-product-size-guide.entry.js +3 -3
  433. package/dist/esm/salla-products-list.entry.js +3 -3
  434. package/dist/esm/salla-products-slider.entry.js +3 -3
  435. package/dist/esm/salla-progress-bar.entry.js +3 -3
  436. package/dist/esm/salla-quick-order.entry.js +3 -3
  437. package/dist/esm/salla-rating-modal.entry.js +3 -3
  438. package/dist/esm/salla-scopes.entry.js +3 -3
  439. package/dist/esm/salla-search.entry.js +6 -4
  440. package/dist/esm/salla-skeleton.entry.js +3 -3
  441. package/dist/esm/salla-slider.entry.js +20 -14
  442. package/dist/esm/salla-social-share.entry.js +3 -3
  443. package/dist/esm/salla-social.entry.js +3 -3
  444. package/dist/esm/salla-tab-content_3.entry.js +7 -7
  445. package/dist/esm/salla-tiered-offer.entry.js +3 -3
  446. package/dist/esm/salla-tooltip.entry.js +3 -3
  447. package/dist/esm/salla-trust-badges.entry.js +3 -3
  448. package/dist/esm/salla-user-menu.entry.js +3 -3
  449. package/dist/esm/salla-user-profile.entry.js +3 -3
  450. package/dist/esm/salla-user-settings.entry.js +3 -3
  451. package/dist/esm/salla-verify.entry.js +3 -3
  452. package/dist/esm/salla-wallet.entry.js +3 -3
  453. package/dist/esm/twilight.js +5 -4
  454. package/dist/esm/{vanilla-picker-CEy5x8Cf.js → vanilla-picker-Dt9vZPZF.js} +1 -1
  455. package/dist/twilight/{p-651fe6e4.entry.js → p-06fa7327.entry.js} +1 -1
  456. package/dist/twilight/{p-a50f7f70.entry.js → p-09d39785.entry.js} +1 -1
  457. package/dist/twilight/{p-744d6394.entry.js → p-0add06f9.entry.js} +1 -1
  458. package/dist/twilight/{p-f251e744.entry.js → p-105b1dab.entry.js} +1 -1
  459. package/dist/twilight/{p-407828e4.entry.js → p-108d8c8b.entry.js} +1 -1
  460. package/dist/twilight/{p-2a1871c2.entry.js → p-1875537e.entry.js} +1 -1
  461. package/dist/twilight/{p-ff6f769c.entry.js → p-18bb0181.entry.js} +1 -1
  462. package/dist/twilight/p-1daeed6e.entry.js +4 -0
  463. package/dist/twilight/{p-2aa48902.entry.js → p-1ef2602d.entry.js} +1 -1
  464. package/dist/twilight/{p-27f34c85.entry.js → p-2881bb33.entry.js} +1 -1
  465. package/dist/twilight/{p-c3d0c062.entry.js → p-293c6cf3.entry.js} +1 -1
  466. package/dist/twilight/{p-866b297b.entry.js → p-296d2dd0.entry.js} +1 -1
  467. package/dist/twilight/{p-3a5aaa20.entry.js → p-2abaa633.entry.js} +1 -1
  468. package/dist/twilight/p-2ddb3fce.entry.js +4 -0
  469. package/dist/twilight/{p-81f648a2.entry.js → p-2fe01e44.entry.js} +1 -1
  470. package/dist/twilight/p-33779828.entry.js +4 -0
  471. package/dist/twilight/p-34968e31.entry.js +4 -0
  472. package/dist/twilight/{p-3745a7d0.entry.js → p-34b670fc.entry.js} +1 -1
  473. package/dist/twilight/{p-9f23dd30.entry.js → p-3ccc532d.entry.js} +1 -1
  474. package/dist/twilight/{p-f2ee9ceb.entry.js → p-41c733c2.entry.js} +1 -1
  475. package/dist/twilight/{p-67fe5680.entry.js → p-44fa7521.entry.js} +1 -1
  476. package/dist/twilight/{p-b4f07395.entry.js → p-4932857d.entry.js} +1 -1
  477. package/dist/twilight/{p-81f6638f.entry.js → p-4fa4547a.entry.js} +1 -1
  478. package/dist/twilight/{p-ba4b672c.entry.js → p-542d3277.entry.js} +1 -1
  479. package/dist/twilight/{p-a00e249b.entry.js → p-57ff1f25.entry.js} +1 -1
  480. package/dist/twilight/{p-827edf95.entry.js → p-59ae82bd.entry.js} +1 -1
  481. package/dist/twilight/{p-82e3c734.entry.js → p-647b6d76.entry.js} +1 -1
  482. package/dist/twilight/p-665189b4.entry.js +4 -0
  483. package/dist/twilight/{p-b55da21d.entry.js → p-6f36541a.entry.js} +1 -1
  484. package/dist/twilight/{p-c8aa5377.entry.js → p-7093a427.entry.js} +1 -1
  485. package/dist/twilight/{p-f201122a.entry.js → p-748df7e6.entry.js} +1 -1
  486. package/dist/twilight/p-776c9d33.entry.js +4 -0
  487. package/dist/twilight/{p-ce9fee6d.entry.js → p-7abddca8.entry.js} +1 -1
  488. package/dist/twilight/p-7b8313ef.entry.js +4 -0
  489. package/dist/twilight/p-7bd0ede5.entry.js +4 -0
  490. package/dist/twilight/p-817b8ba5.entry.js +4 -0
  491. package/dist/twilight/{p-5ef1b170.entry.js → p-87c0ca91.entry.js} +1 -1
  492. package/dist/twilight/p-8e8d9d7d.entry.js +4 -0
  493. package/dist/twilight/{p-BHjlzmYy.js → p-8r0S6BcZ.js} +1 -1
  494. package/dist/twilight/{p-face0448.entry.js → p-94dbc1e9.entry.js} +1 -1
  495. package/dist/twilight/{p-4e00f827.entry.js → p-96a20515.entry.js} +1 -1
  496. package/dist/twilight/{p-81f76d49.entry.js → p-96d03a28.entry.js} +1 -1
  497. package/dist/twilight/{p-97df32eb.entry.js → p-96e78428.entry.js} +1 -1
  498. package/dist/twilight/{p-CU-HtXWh.js → p-BZnoSB1s.js} +1 -1
  499. package/dist/twilight/p-BkClxrC4.js +9 -0
  500. package/dist/twilight/p-Ck4zxCil.js +9 -0
  501. package/dist/twilight/{p-IoI86ovS.js → p-Cw3UBzjl.js} +1 -1
  502. package/dist/twilight/p-D1vqXXNX.js +9 -0
  503. package/dist/twilight/p-DYB20YqN.js +5 -0
  504. package/dist/twilight/p-Vl6qpttb.js +4 -0
  505. package/dist/twilight/{p-BgG5eq1x.js → p-X6Yi3bYP.js} +1 -1
  506. package/dist/twilight/{p-d022b6ec.entry.js → p-a01f1992.entry.js} +1 -1
  507. package/dist/twilight/{p-5d37cc33.entry.js → p-aa7c5de0.entry.js} +1 -1
  508. package/dist/twilight/{p-b6ded196.entry.js → p-aaa0c743.entry.js} +1 -1
  509. package/dist/twilight/{p-713590e2.entry.js → p-ad041ab5.entry.js} +1 -1
  510. package/dist/twilight/{p-d1dd1db6.entry.js → p-ad07f67a.entry.js} +1 -1
  511. package/dist/twilight/{p-f1f74b41.entry.js → p-af3c74f4.entry.js} +1 -1
  512. package/dist/twilight/p-af60e72a.entry.js +4 -0
  513. package/dist/twilight/{p-bdcf3926.entry.js → p-b17d055d.entry.js} +1 -1
  514. package/dist/twilight/{p-c68f3054.entry.js → p-b598c0f7.entry.js} +1 -1
  515. package/dist/twilight/{p-8c6db6d7.entry.js → p-b64f3155.entry.js} +1 -1
  516. package/dist/twilight/p-bNzv71Xl.js +9 -0
  517. package/dist/twilight/{p-BqCmPfAo.js → p-bScl0xMh.js} +2 -2
  518. package/dist/twilight/{p-344c1910.entry.js → p-bff4c7b3.entry.js} +1 -1
  519. package/dist/twilight/{p-1b1f9f71.entry.js → p-c091e2dc.entry.js} +1 -1
  520. package/dist/twilight/{p-775b42ec.entry.js → p-c1fd45b1.entry.js} +1 -1
  521. package/dist/twilight/{p-1c215c8c.entry.js → p-c3ffb88a.entry.js} +1 -1
  522. package/dist/twilight/{p-9deae4f4.entry.js → p-c87951a2.entry.js} +1 -1
  523. package/dist/twilight/{p-1899f283.entry.js → p-ccfe5308.entry.js} +1 -1
  524. package/dist/twilight/{p-98eb495e.entry.js → p-d337c399.entry.js} +1 -1
  525. package/dist/twilight/{p-7b717899.entry.js → p-d371d450.entry.js} +1 -1
  526. package/dist/twilight/{p-f8b6967f.entry.js → p-d4a242f8.entry.js} +1 -1
  527. package/dist/twilight/{p-194d87c6.entry.js → p-d9f5a8cd.entry.js} +1 -1
  528. package/dist/twilight/{p-ff9b33bb.entry.js → p-dd2bd5dc.entry.js} +1 -1
  529. package/dist/twilight/{p-e89812d8.entry.js → p-df6853b5.entry.js} +1 -1
  530. package/dist/twilight/{p-05663bb1.entry.js → p-e28c0773.entry.js} +1 -1
  531. package/dist/twilight/{p-a76b3dba.entry.js → p-e3b8e0e1.entry.js} +1 -1
  532. package/dist/twilight/p-e679884a.entry.js +4 -0
  533. package/dist/twilight/{p-11767786.entry.js → p-e6bbf50d.entry.js} +1 -1
  534. package/dist/twilight/{p-1ca75c99.entry.js → p-e94f217b.entry.js} +1 -1
  535. package/dist/twilight/{p-d81ad2c3.entry.js → p-eac718cd.entry.js} +1 -1
  536. package/dist/twilight/{p-85ceef78.entry.js → p-ede67a08.entry.js} +1 -1
  537. package/dist/twilight/p-efab88c5.entry.js +4 -0
  538. package/dist/twilight/{p-1dbaefb8.entry.js → p-f176d41d.entry.js} +1 -1
  539. package/dist/twilight/p-f5d15e71.entry.js +4 -0
  540. package/dist/twilight/{p-50621375.entry.js → p-f7999a6d.entry.js} +1 -1
  541. package/dist/twilight/twilight.esm.js +1 -1
  542. package/dist/types/components/salla-count-down/salla-count-down.d.ts +6 -0
  543. package/dist/types/components/salla-notifications/interfaces.d.ts +20 -0
  544. package/dist/types/components/salla-notifications/salla-notifications.d.ts +17 -0
  545. package/dist/types/components.d.ts +763 -177
  546. package/dist/types/stencil-public-runtime.d.ts +169 -11
  547. package/package.json +5 -5
  548. package/dist/cjs/filepond-plugin-file-validate-type-Dfy66STE.js +0 -287
  549. package/dist/esm/filepond-plugin-file-validate-type-BYs_scJr.js +0 -285
  550. package/dist/twilight/p-0652987b.entry.js +0 -4
  551. package/dist/twilight/p-14529fd6.entry.js +0 -4
  552. package/dist/twilight/p-1c8394db.entry.js +0 -4
  553. package/dist/twilight/p-346b55d6.entry.js +0 -4
  554. package/dist/twilight/p-3962c34c.entry.js +0 -4
  555. package/dist/twilight/p-4e9e3ab1.entry.js +0 -4
  556. package/dist/twilight/p-549f59ed.entry.js +0 -4
  557. package/dist/twilight/p-54f65187.entry.js +0 -4
  558. package/dist/twilight/p-726513f8.entry.js +0 -4
  559. package/dist/twilight/p-753464fd.entry.js +0 -4
  560. package/dist/twilight/p-AfW2b46_.js +0 -9
  561. package/dist/twilight/p-C23tPnnH.js +0 -5
  562. package/dist/twilight/p-CrYUKEsF.js +0 -9
  563. package/dist/twilight/p-HWjjIZ9_.js +0 -9
  564. package/dist/twilight/p-Ig1Tafsp.js +0 -9
  565. package/dist/twilight/p-c9001d7f.entry.js +0 -4
  566. package/dist/twilight/p-cf9573fd.entry.js +0 -4
  567. package/dist/twilight/p-e6124fab.entry.js +0 -4
  568. package/dist/twilight/p-eb5a8329.entry.js +0 -4
@@ -1,1184 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
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 };
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}