@salla.sa/twilight-components 2.14.357 → 2.14.358

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 (243) hide show
  1. package/dist/cjs/{filepond-CVZ-BhRy.js → filepond-C8Iv03Xw.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-2ShKuqPr.js → filepond-plugin-file-poster-6G0m20wb.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-BFWtiLWL.js → filepond-plugin-file-validate-size-BrrvFDrX.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-BzqK-hKY.js → filepond-plugin-file-validate-type-BAIli6YR.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-Bcnu5eSZ.js → filepond-plugin-image-edit-CLI8O8iN.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-CCnsEJ8x.js → filepond-plugin-image-exif-orientation-D6pllZWx.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-kn_ZJZXi.js → filepond-plugin-image-preview-CkkozCc3.js} +1 -1
  8. package/dist/cjs/{index-B-qAr7bS.js → index-CiABtziQ.js} +1 -1
  9. package/dist/cjs/{index-CF5bZnDB.js → index-D8CYdUGa.js} +6 -6
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/salla-accordion-body_3.cjs.entry.js +1 -1
  12. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-add-product-button_4.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
  19. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-user-menu.cjs.entry.js +57 -47
  73. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  77. package/dist/cjs/twilight.cjs.js +2 -2
  78. package/dist/cjs/{vanilla-picker-DuWLLDIZ.js → vanilla-picker-AGoPnWFt.js} +1 -1
  79. package/dist/collection/components/salla-user-menu/salla-user-menu.js +76 -46
  80. package/dist/components/index.js +2 -2
  81. package/dist/components/salla-login-modal.js +1 -358
  82. package/dist/components/salla-login-modal2.js +363 -0
  83. package/dist/components/salla-user-menu.js +76 -47
  84. package/dist/esm/{filepond-BInIwZYj.js → filepond-BbukY3G5.js} +1 -1
  85. package/dist/esm/{filepond-plugin-file-poster-DRu2Mi6P.js → filepond-plugin-file-poster-DIB4KhNs.js} +1 -1
  86. package/dist/esm/{filepond-plugin-file-validate-size-DO5zxC4X.js → filepond-plugin-file-validate-size-C2La5co0.js} +1 -1
  87. package/dist/esm/{filepond-plugin-file-validate-type-BwxMZ28-.js → filepond-plugin-file-validate-type-s5WI8DP4.js} +1 -1
  88. package/dist/esm/{filepond-plugin-image-edit-CwEZfbKE.js → filepond-plugin-image-edit-BdW45IS3.js} +1 -1
  89. package/dist/esm/{filepond-plugin-image-exif-orientation-B2YJJ8ni.js → filepond-plugin-image-exif-orientation-C12lmnIq.js} +1 -1
  90. package/dist/esm/{filepond-plugin-image-preview-BdiNpvoD.js → filepond-plugin-image-preview-DC2SjiV6.js} +1 -1
  91. package/dist/esm/{index-BKsC0x_d.js → index-COH2oGKJ.js} +1 -1
  92. package/dist/esm/{index-DhtEPVv1.js → index-CTOqXLNX.js} +6 -6
  93. package/dist/esm/loader.js +3 -3
  94. package/dist/esm/salla-accordion-body_3.entry.js +1 -1
  95. package/dist/esm/salla-accordion_6.entry.js +1 -1
  96. package/dist/esm/salla-add-product-button_4.entry.js +1 -1
  97. package/dist/esm/salla-advertisement.entry.js +1 -1
  98. package/dist/esm/salla-alert_2.entry.js +1 -1
  99. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  100. package/dist/esm/salla-apps-icons.entry.js +1 -1
  101. package/dist/esm/salla-booking-field_7.entry.js +10 -10
  102. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  103. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  104. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  105. package/dist/esm/salla-contacts.entry.js +1 -1
  106. package/dist/esm/salla-count-down_2.entry.js +1 -1
  107. package/dist/esm/salla-custom-fields.entry.js +1 -1
  108. package/dist/esm/salla-filters-widget.entry.js +1 -1
  109. package/dist/esm/salla-filters.entry.js +1 -1
  110. package/dist/esm/salla-gifting.entry.js +1 -1
  111. package/dist/esm/salla-hook.entry.js +1 -1
  112. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  113. package/dist/esm/salla-installment.entry.js +1 -1
  114. package/dist/esm/salla-list-tile.entry.js +1 -1
  115. package/dist/esm/salla-localization-modal.entry.js +1 -1
  116. package/dist/esm/salla-login-modal.entry.js +1 -1
  117. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  118. package/dist/esm/salla-loyalty-program.entry.js +1 -1
  119. package/dist/esm/salla-loyalty.entry.js +1 -1
  120. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  121. package/dist/esm/salla-menu.entry.js +1 -1
  122. package/dist/esm/salla-metadata.entry.js +1 -1
  123. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  124. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  125. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  126. package/dist/esm/salla-notification-item.entry.js +1 -1
  127. package/dist/esm/salla-notifications.entry.js +1 -1
  128. package/dist/esm/salla-offer-modal.entry.js +1 -1
  129. package/dist/esm/salla-offer.entry.js +1 -1
  130. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  131. package/dist/esm/salla-order-details-options.entry.js +1 -1
  132. package/dist/esm/salla-order-details.entry.js +1 -1
  133. package/dist/esm/salla-order-summary.entry.js +1 -1
  134. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  135. package/dist/esm/salla-orders.entry.js +1 -1
  136. package/dist/esm/salla-payments.entry.js +1 -1
  137. package/dist/esm/salla-placeholder.entry.js +1 -1
  138. package/dist/esm/salla-price-range.entry.js +1 -1
  139. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  140. package/dist/esm/salla-products-list.entry.js +1 -1
  141. package/dist/esm/salla-products-slider.entry.js +1 -1
  142. package/dist/esm/salla-progress-bar.entry.js +1 -1
  143. package/dist/esm/salla-quick-order.entry.js +1 -1
  144. package/dist/esm/salla-rating-modal.entry.js +1 -1
  145. package/dist/esm/salla-scopes.entry.js +1 -1
  146. package/dist/esm/salla-search.entry.js +1 -1
  147. package/dist/esm/salla-skeleton.entry.js +1 -1
  148. package/dist/esm/salla-slider.entry.js +1 -1
  149. package/dist/esm/salla-social-share.entry.js +1 -1
  150. package/dist/esm/salla-social.entry.js +1 -1
  151. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  152. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  153. package/dist/esm/salla-tooltip.entry.js +1 -1
  154. package/dist/esm/salla-trust-badges.entry.js +1 -1
  155. package/dist/esm/salla-user-menu.entry.js +57 -47
  156. package/dist/esm/salla-user-profile.entry.js +1 -1
  157. package/dist/esm/salla-user-settings.entry.js +1 -1
  158. package/dist/esm/salla-verify.entry.js +1 -1
  159. package/dist/esm/salla-wallet.entry.js +1 -1
  160. package/dist/esm/twilight.js +3 -3
  161. package/dist/esm/{vanilla-picker-9y3LOKrc.js → vanilla-picker-xnlQPhDH.js} +1 -1
  162. package/dist/twilight/p-030cfa72.entry.js +4 -0
  163. package/dist/twilight/{p-12c7abc7.entry.js → p-08085ebd.entry.js} +1 -1
  164. package/dist/twilight/{p-0523a5ef.entry.js → p-1a18938a.entry.js} +1 -1
  165. package/dist/twilight/{p-63fb4f6a.entry.js → p-1b706044.entry.js} +1 -1
  166. package/dist/twilight/{p-9902b843.entry.js → p-25d51430.entry.js} +1 -1
  167. package/dist/twilight/{p-3071d452.entry.js → p-26c0b94a.entry.js} +1 -1
  168. package/dist/twilight/{p-f47c7d7e.entry.js → p-26cc636d.entry.js} +1 -1
  169. package/dist/twilight/{p-8318e5a4.entry.js → p-2f9c2638.entry.js} +1 -1
  170. package/dist/twilight/{p-da2a9d5e.entry.js → p-3306aeb9.entry.js} +1 -1
  171. package/dist/twilight/{p-9da9a96e.entry.js → p-331cc73d.entry.js} +1 -1
  172. package/dist/twilight/{p-83a9dae4.entry.js → p-341b1773.entry.js} +1 -1
  173. package/dist/twilight/{p-ca414718.entry.js → p-342648a6.entry.js} +1 -1
  174. package/dist/twilight/{p-de3f8afc.entry.js → p-3cfcccd4.entry.js} +1 -1
  175. package/dist/twilight/{p-06af1120.entry.js → p-3d953eaa.entry.js} +1 -1
  176. package/dist/twilight/{p-56b5658d.entry.js → p-40fe2fdb.entry.js} +1 -1
  177. package/dist/twilight/{p-47bc1b0e.entry.js → p-4288fffb.entry.js} +1 -1
  178. package/dist/twilight/{p-378f9cb2.entry.js → p-45cfc834.entry.js} +1 -1
  179. package/dist/twilight/{p-17a49368.entry.js → p-4d8b8554.entry.js} +1 -1
  180. package/dist/twilight/{p-00c8b870.entry.js → p-53fcf35b.entry.js} +1 -1
  181. package/dist/twilight/{p-dbd7bab7.entry.js → p-54a1b32c.entry.js} +1 -1
  182. package/dist/twilight/{p-659378d1.entry.js → p-5c57f6a7.entry.js} +1 -1
  183. package/dist/twilight/{p-706fc07a.entry.js → p-605cf513.entry.js} +1 -1
  184. package/dist/twilight/{p-a5094c62.entry.js → p-61ab5693.entry.js} +1 -1
  185. package/dist/twilight/{p-2ab31b93.entry.js → p-66d0fc30.entry.js} +1 -1
  186. package/dist/twilight/{p-fd9858a0.entry.js → p-680a8a26.entry.js} +1 -1
  187. package/dist/twilight/{p-478da0db.entry.js → p-6b166062.entry.js} +1 -1
  188. package/dist/twilight/{p-6aa0b298.entry.js → p-6be952b4.entry.js} +1 -1
  189. package/dist/twilight/{p-b350c896.entry.js → p-6cf2ffe8.entry.js} +1 -1
  190. package/dist/twilight/{p-df17bdfb.entry.js → p-707bbd12.entry.js} +1 -1
  191. package/dist/twilight/{p-476a002f.entry.js → p-73f89ae0.entry.js} +1 -1
  192. package/dist/twilight/{p-5a691df0.entry.js → p-770b684e.entry.js} +1 -1
  193. package/dist/twilight/{p-67656ed6.entry.js → p-77380609.entry.js} +1 -1
  194. package/dist/twilight/{p-04871dde.entry.js → p-7fc1087d.entry.js} +1 -1
  195. package/dist/twilight/{p-a37b4382.entry.js → p-81148c5c.entry.js} +1 -1
  196. package/dist/twilight/{p-e13bcda5.entry.js → p-852f653a.entry.js} +1 -1
  197. package/dist/twilight/{p-6b48b78c.entry.js → p-881d81da.entry.js} +1 -1
  198. package/dist/twilight/{p-18c1aa82.entry.js → p-8b251669.entry.js} +1 -1
  199. package/dist/twilight/{p-68f77bf9.entry.js → p-8b444008.entry.js} +1 -1
  200. package/dist/twilight/{p-8e3ab101.entry.js → p-8c87fc89.entry.js} +1 -1
  201. package/dist/twilight/{p-ddf1eb8e.entry.js → p-8d380340.entry.js} +1 -1
  202. package/dist/twilight/{p-c623dae3.entry.js → p-9247e41a.entry.js} +1 -1
  203. package/dist/twilight/{p-c50ea722.entry.js → p-953dc2c7.entry.js} +1 -1
  204. package/dist/twilight/{p-C5JBfwX3.js → p-BTHq9O3t.js} +1 -1
  205. package/dist/twilight/{p-9kdhmfl0.js → p-B_QZ5Uh8.js} +2 -2
  206. package/dist/twilight/{p-DhtEPVv1.js → p-CTOqXLNX.js} +1 -1
  207. package/dist/twilight/{p-BnEemU3K.js → p-CUP6xpY8.js} +1 -1
  208. package/dist/twilight/{p-Oa-SLesW.js → p-CVhlRyCZ.js} +1 -1
  209. package/dist/twilight/p-CeLw8fUj.js +9 -0
  210. package/dist/twilight/{p-D5Ctrxqk.js → p-CfxXglSG.js} +1 -1
  211. package/dist/twilight/{p-ChWBy7Mi.js → p-D-swSluC.js} +1 -1
  212. package/dist/twilight/{p-sTgCEptc.js → p-DneV5uAu.js} +1 -1
  213. package/dist/twilight/{p-c6abc912.entry.js → p-a1fa152d.entry.js} +1 -1
  214. package/dist/twilight/{p-e61517dd.entry.js → p-a2536d37.entry.js} +1 -1
  215. package/dist/twilight/{p-ead767db.entry.js → p-a44e8395.entry.js} +1 -1
  216. package/dist/twilight/{p-89f4a500.entry.js → p-a6f29cf5.entry.js} +1 -1
  217. package/dist/twilight/{p-4d200466.entry.js → p-a84a4855.entry.js} +1 -1
  218. package/dist/twilight/{p-e0506d5f.entry.js → p-aa2ba103.entry.js} +1 -1
  219. package/dist/twilight/{p-6c9a3556.entry.js → p-aea1ea51.entry.js} +1 -1
  220. package/dist/twilight/{p-d597ea5a.entry.js → p-b02413c6.entry.js} +1 -1
  221. package/dist/twilight/{p-e0f3dcc1.entry.js → p-b8738435.entry.js} +1 -1
  222. package/dist/twilight/{p-3874791d.entry.js → p-b95b8e92.entry.js} +1 -1
  223. package/dist/twilight/{p-0317ca56.entry.js → p-bb333ec8.entry.js} +1 -1
  224. package/dist/twilight/{p-c2167627.entry.js → p-bff05b48.entry.js} +1 -1
  225. package/dist/twilight/{p-af829f6e.entry.js → p-ca96c86b.entry.js} +1 -1
  226. package/dist/twilight/{p-a1853dac.entry.js → p-cb619ea6.entry.js} +1 -1
  227. package/dist/twilight/{p-93e72677.entry.js → p-cec6fce5.entry.js} +1 -1
  228. package/dist/twilight/{p-e6de17d2.entry.js → p-d3852cc4.entry.js} +1 -1
  229. package/dist/twilight/{p-8b8442ec.entry.js → p-d8affce0.entry.js} +1 -1
  230. package/dist/twilight/{p-0108db0e.entry.js → p-dcb6403c.entry.js} +1 -1
  231. package/dist/twilight/{p-3253d74f.entry.js → p-e9619d27.entry.js} +1 -1
  232. package/dist/twilight/{p-e0f56ef8.entry.js → p-ed8ce802.entry.js} +1 -1
  233. package/dist/twilight/{p-adbb3dcd.entry.js → p-f81009de.entry.js} +1 -1
  234. package/dist/twilight/{p-135b2262.entry.js → p-f81e3982.entry.js} +1 -1
  235. package/dist/twilight/{p-b01b370a.entry.js → p-fbc8d862.entry.js} +1 -1
  236. package/dist/twilight/{p-5636bdc5.entry.js → p-fc958ce6.entry.js} +1 -1
  237. package/dist/twilight/{p-DucyXwUa.js → p-kA0d1JcV.js} +1 -1
  238. package/dist/twilight/twilight.esm.js +1 -1
  239. package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +7 -1
  240. package/dist/types/components.d.ts +10 -0
  241. package/package.json +5 -5
  242. package/dist/twilight/p-a798090d.entry.js +0 -4
  243. package/dist/twilight/p-upVSO4PR.js +0 -9
@@ -0,0 +1,363 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { proxyCustomElement, HTMLElement, h, Fragment } from '@stencil/core/internal/client';
5
+ import { d as defineCustomElement$2 } from './salla-loading2.js';
6
+ import { d as defineCustomElement$1 } from './salla-modal2.js';
7
+
8
+ const sallaLoginModalCss = "iframe{-moz-transition:height 0.3s;-ms-transition:height 0.3s;-o-transition:height 0.3s;-webkit-transition:height 0.3s;transition:height 0.3s;width:100%}";
9
+
10
+ const SallaLoginModal = /*@__PURE__*/ proxyCustomElement(class SallaLoginModal extends HTMLElement {
11
+ constructor() {
12
+ super();
13
+ this.__registerHost();
14
+ /**
15
+ * Does the merchant/current location for visitor allow to login using mobile, By default outside KSA is `false`
16
+ */
17
+ this.isMobileAllowed = true;
18
+ /**
19
+ * Does the merchant require registration with email & mobile
20
+ */
21
+ this.isEmailRequired = false;
22
+ /**
23
+ * Once the api verify success, it will be login the customer in web pages
24
+ */
25
+ this.supportWebAuth = true;
26
+ /**
27
+ * Reload after a successful login
28
+ */
29
+ this.withoutReload = false;
30
+ /**
31
+ * The source of opening login modal
32
+ */
33
+ this.source = '';
34
+ this.htmlElement = document.documentElement;
35
+ this.messages = [];
36
+ this.isClosable = true;
37
+ this.iframeLoaded = false;
38
+ this.scrolling = 'no';
39
+ this.direction = document.dir;
40
+ this.canRenderIframe = false;
41
+ salla.event.on('login::open', (data) => {
42
+ if (!this.isEmailAllowed && !this.isMobileAllowed) {
43
+ salla.logger.warn('Please enable atleast one login type to use this component.');
44
+ return;
45
+ }
46
+ this.source = data?.source ?? false;
47
+ this.withoutReload = data?.withoutReload ?? this.withoutReload;
48
+ this.open(data);
49
+ this.openModal();
50
+ });
51
+ salla.event.on('modal::close', (data) => {
52
+ if (this.iframe)
53
+ this.sendMessageToIframe({
54
+ source: 'login',
55
+ type: 'modal_closed',
56
+ data,
57
+ });
58
+ });
59
+ salla.onReady(() => {
60
+ this.api = salla.config.get('store.api');
61
+ this.storeId = salla.config.get('store.id');
62
+ });
63
+ }
64
+ componentDidLoad() {
65
+ window.addEventListener('message', (event) => {
66
+ if (event.data.source != "login") {
67
+ return;
68
+ }
69
+ if (!this.inline && !this.canRenderIframe) {
70
+ return;
71
+ }
72
+ salla.log(`salla-account:: recived an event`, event.data);
73
+ let action = event.data?.type?.replace('iframe::', '');
74
+ let value = event.data.message;
75
+ //if we need skip some events
76
+ // if (action === 'dispatchEvent' && [].includes(value.event)) {
77
+ // return;
78
+ // }
79
+ // if (action == "dispatchEvent") {
80
+ // return this.host.dispatchEvent(new CustomEvent(value.name, {
81
+ // cancelable: true,
82
+ // bubbles: true,
83
+ // detail: value.payload
84
+ // }));
85
+ // }
86
+ if (action == 'ready') {
87
+ if (value.isPasskeyPage) {
88
+ this.createPassKey.postMessage({ source: "login", type: "init_passkey_page", data: {
89
+ token: salla.storage.get('token'),
90
+ store_id: salla.config.get('store.id'),
91
+ locale: salla.config.get('user.language_code'),
92
+ redirect: salla.config.get('store.url')
93
+ } }, salla.config.get('login.url'));
94
+ return;
95
+ }
96
+ this.handleIframeReadyAction();
97
+ return;
98
+ }
99
+ if (action == 'height') {
100
+ return (this.iframe.height = value?.height + 'px');
101
+ }
102
+ //share the iframe storage, so login too
103
+ if (action == "storage") {
104
+ return this.handleIframeStorageAction(value);
105
+ }
106
+ // if (action == "success") {
107
+ // this.isClosable = true;
108
+ // confetti.startConfetti(1200, 50, 150);
109
+ // }
110
+ if (action == "scrolling") {
111
+ this.scrolling = value;
112
+ this.isClosable = false;
113
+ return;
114
+ }
115
+ if (action == "direction") {
116
+ return document.dir = this.direction = value ? "rtl" : "ltr";
117
+ }
118
+ if (action == 'notify') {
119
+ return salla.notify[value.type](value.message);
120
+ }
121
+ // temporary condition until we handle both cases separately
122
+ if (action == 'authenticated' || action == 'authenticated_web_auth') {
123
+ !value?.withoutClose && this.close();
124
+ return salla.auth.api.handlAfterAuthenticatedResponse(value, this.supportWebAuth)
125
+ .then(() => !(value?.withoutReload || this.withoutReload) && setTimeout(() => window.location.reload(), 1000));
126
+ }
127
+ if (action == 'dispatchEvent' && value.event == 'auth::verified') {
128
+ salla.log('Ignored dispatchEvent `auth::verified` from iframe');
129
+ //we don't need to fire this event because it have listeners for it, and already it's fired/firing from `salla.auth.api.handlAfterAuthenticatedResponse` already we are handling it
130
+ return;
131
+ }
132
+ if (action == 'dispatchEvent') {
133
+ return salla.event.emit(value.event, ...value.payload);
134
+ }
135
+ if (action == 'reload') {
136
+ if (value?.withClose)
137
+ this.modal.close();
138
+ return window.location.reload();
139
+ }
140
+ if (action === 'open_page') {
141
+ return window.location.href = value.url;
142
+ }
143
+ if (action === 'open_passkey_page') {
144
+ this.createPassKey = window.open(`${salla.config.get('login.url')}/create-passkey`);
145
+ return;
146
+ }
147
+ if (action === 'guest-checkout') {
148
+ return this.handleGuestCheckout();
149
+ }
150
+ if (action == "close") {
151
+ this.close();
152
+ }
153
+ });
154
+ this.observeDarkModeChanges();
155
+ setTimeout(() => Salla.event.emit('salla-login::ready'), 1);
156
+ }
157
+ /**
158
+ * Open login component
159
+ */
160
+ async open(_event = null) {
161
+ /**
162
+ * This is a workaround until we remove all the user objet from twig files
163
+ * When the user is already login, let's reload the page
164
+ */
165
+ if (!salla.config.isGuest()) {
166
+ if (!this.withoutReload) {
167
+ return location.reload();
168
+ }
169
+ // Fire an event if withoutReload is true
170
+ return;
171
+ }
172
+ return this.modal.open();
173
+ }
174
+ close() {
175
+ Salla.event.emit('salla-login::closing');
176
+ this.modal.close();
177
+ this.iframeLoaded = false;
178
+ this.canRenderIframe = false;
179
+ this.host.dispatchEvent(new CustomEvent('salla-login:closed', {
180
+ cancelable: true,
181
+ bubbles: true,
182
+ detail: null
183
+ }));
184
+ Salla.event.emit('salla-login::closed');
185
+ }
186
+ handleIframeReadyAction() {
187
+ this.sendInitMessage();
188
+ this.sendMessageToIframe({
189
+ source: 'login',
190
+ type: 'width',
191
+ data: document.body.clientWidth,
192
+ });
193
+ }
194
+ observeDarkModeChanges() {
195
+ const observer = new MutationObserver((mutations) => {
196
+ mutations.forEach((mutation) => {
197
+ if (mutation.attributeName === 'class') {
198
+ this.sendMessageToIframe({
199
+ source: 'login',
200
+ type: 'darkMode',
201
+ data: { isDark: this.htmlElement.classList.contains('dark') ? true : false },
202
+ });
203
+ }
204
+ });
205
+ });
206
+ // observing the HTML element for attribute changes
207
+ observer.observe(this.htmlElement, { attributes: true });
208
+ }
209
+ async handleIframeStorageAction(value) {
210
+ let token, cartUserId = salla.storage.get('cart.user_id');
211
+ let withCartReset = false;
212
+ Object.entries(value).filter(item => !Salla.storage.get(item[0]))
213
+ .forEach(([key, value]) => {
214
+ salla.log('Shared storage from accounts domain', key, value);
215
+ let cleanedValue = (typeof value === 'string') ? value?.replace(/^"|"$/g, '') : value;
216
+ salla.storage.set(key, cleanedValue);
217
+ if (key === 'token') {
218
+ token = cleanedValue;
219
+ }
220
+ if (key === 'user' && cartUserId && (cleanedValue.id !== cartUserId)) {
221
+ withCartReset = true;
222
+ }
223
+ });
224
+ if (token) {
225
+ this.modal.close();
226
+ Salla.auth.event.tokenFetched(token);
227
+ try {
228
+ await Salla.api.cart.assign();
229
+ }
230
+ catch (err) {
231
+ Salla.log('Error on assign after handle iframe', err);
232
+ }
233
+ withCartReset && Salla.cart.reset();
234
+ try {
235
+ !Salla.auth.api.isSessionless() && await Salla.auth.api.request('auth/jwt');
236
+ if (Salla.auth.api.canRedirect()) {
237
+ setTimeout(() => window.location.reload(), 100);
238
+ }
239
+ else {
240
+ // Match handlAfterAuthenticatedResponse order: loggedIn (fetches profile + emits) -> afterUserLogin
241
+ // Note: auth::verified is omitted here since cart.assign() already handles cart sync above
242
+ await Salla.auth.event.loggedIn({ data: { token } }).then(() => Salla.auth.api.afterUserLogin());
243
+ }
244
+ }
245
+ catch (err) {
246
+ this.modal.open();
247
+ Salla.log('Error on request auth/jwt after handle iframe', err);
248
+ }
249
+ return;
250
+ }
251
+ withCartReset && Salla.cart.reset();
252
+ }
253
+ sendMessageToIframe(message) {
254
+ if (!this.iframe)
255
+ return;
256
+ return this.iframe.contentWindow.postMessage(message, '*');
257
+ }
258
+ sendInitMessage() {
259
+ let headers = this.headers;
260
+ try {
261
+ headers = typeof headers === 'string' ? JSON.parse(headers) : headers;
262
+ }
263
+ catch (error) {
264
+ console.error('Failed to parse headers!', this.headers, error);
265
+ headers = undefined;
266
+ }
267
+ const storageObject = {
268
+ user: salla.storage.get('user'),
269
+ s_translations: salla.storage.get('s_translations'),
270
+ token: salla.storage.get('token'),
271
+ };
272
+ storageObject.user || (delete storageObject.user);
273
+ storageObject.s_translations || (delete storageObject.s_translations);
274
+ storageObject.token || (delete storageObject.token);
275
+ this.sendMessageToIframe({
276
+ source: "login",
277
+ type: "init",
278
+ data: {
279
+ id: this.storeId,
280
+ lang: salla.lang.locale,
281
+ isDark: this.htmlElement.classList.contains('dark') ? true : false,
282
+ apiUrl: this.api?.replace(/\/+$/, ''),
283
+ supportWebAuth: this.supportWebAuth,
284
+ withoutReload: this.withoutReload,
285
+ inline: this.inline,
286
+ settings: salla.config.all(),
287
+ headers: headers,
288
+ storage: storageObject,
289
+ }
290
+ });
291
+ }
292
+ async handleGuestCheckout() {
293
+ this.modal.close();
294
+ if (salla.config.isGuest()) {
295
+ await salla.api.cart.syncGuestCart();
296
+ return salla.cart.submit(true);
297
+ }
298
+ }
299
+ openModal() {
300
+ if (!this.canRenderIframe) {
301
+ this.canRenderIframe = true;
302
+ }
303
+ this.modal.open();
304
+ }
305
+ render() {
306
+ if (this.inline) {
307
+ return this.getLoginDom();
308
+ }
309
+ return (h("salla-modal", { class: "s-login-modal", ref: modal => this.modal = modal, width: "xs" }, this.getLoginDom()));
310
+ }
311
+ getLoginDom() {
312
+ if (!this.canRenderIframe) {
313
+ return;
314
+ }
315
+ return h(Fragment, null, h("iframe", { src: `${salla.config.get('login.url', 'https://accounts.salla.com')}?src=${this.source}`, title: "Salla Login", class: "hide-scroll", loading: 'lazy', ref: iframe => { this.iframe = iframe; }, allow: "publickey-credentials-get; publickey-credentials-create", scrolling: this.scrolling, frameborder: "0", width: "100%" }));
316
+ }
317
+ get host() { return this; }
318
+ static get style() { return sallaLoginModalCss; }
319
+ }, [0, "salla-login-modal", {
320
+ "isEmailAllowed": [1028, "is-email-allowed"],
321
+ "isMobileAllowed": [1028, "is-mobile-allowed"],
322
+ "isEmailRequired": [1028, "is-email-required"],
323
+ "supportWebAuth": [516, "support-web-auth"],
324
+ "inline": [516],
325
+ "storeId": [1032, "store-id"],
326
+ "api": [1],
327
+ "headers": [1025],
328
+ "withoutReload": [1028, "without-reload"],
329
+ "source": [32],
330
+ "messages": [32],
331
+ "isClosable": [32],
332
+ "iframeLoaded": [32],
333
+ "scrolling": [32],
334
+ "direction": [32],
335
+ "canRenderIframe": [32],
336
+ "open": [64]
337
+ }]);
338
+ function defineCustomElement() {
339
+ if (typeof customElements === "undefined") {
340
+ return;
341
+ }
342
+ const components = ["salla-login-modal", "salla-loading", "salla-modal"];
343
+ components.forEach(tagName => { switch (tagName) {
344
+ case "salla-login-modal":
345
+ if (!customElements.get(tagName)) {
346
+ customElements.define(tagName, SallaLoginModal);
347
+ }
348
+ break;
349
+ case "salla-loading":
350
+ if (!customElements.get(tagName)) {
351
+ defineCustomElement$2();
352
+ }
353
+ break;
354
+ case "salla-modal":
355
+ if (!customElements.get(tagName)) {
356
+ defineCustomElement$1();
357
+ }
358
+ break;
359
+ } });
360
+ }
361
+ defineCustomElement();
362
+
363
+ export { SallaLoginModal as S, defineCustomElement as d };
@@ -9,6 +9,9 @@ import { W as WishListIcon } from './star.js';
9
9
  import { C as Cancel } from './cancel.js';
10
10
  import { R as Rate } from './star2.js';
11
11
  import { l as loyaltyProgramIcon } from './gift.js';
12
+ import { d as defineCustomElement$4 } from './salla-loading2.js';
13
+ import { d as defineCustomElement$3 } from './salla-login-modal2.js';
14
+ import { d as defineCustomElement$2 } from './salla-modal2.js';
12
15
 
13
16
  var OrderIcon = `<!-- Generated by IcoMoon.io -->
14
17
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
@@ -90,6 +93,10 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class SallaUserMenu ext
90
93
  * To Make the dropdown menu relative to parent element or not
91
94
  */
92
95
  this.relativeDropdown = false;
96
+ /**
97
+ * To auto mount the login modal or not
98
+ */
99
+ this.autoMount = false;
93
100
  this.onClickOutside = () => {
94
101
  this.opened = false;
95
102
  };
@@ -103,56 +110,12 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class SallaUserMenu ext
103
110
  loyalty_program: loyaltyProgramIcon,
104
111
  profile: UserCircle
105
112
  };
106
- // salla.auth.event.onLoggedIn(() => {
107
- // this.is_loggedIn = true
108
- // })
109
- salla.lang.onLoaded(() => {
110
- this.notifications = salla.lang.get('common.titles.notifications');
111
- this.orders = salla.lang.get('common.titles.orders');
112
- this.pending_orders = salla.lang.get('common.titles.pending_orders');
113
- this.wishlist = salla.lang.get('common.titles.wishlist');
114
- this.profile = salla.lang.get('common.titles.profile');
115
- this.hello = salla.lang.get('pages.checkout.hello');
116
- this.rating = salla.lang.get('common.titles.rating');
117
- this.wallet = salla.lang.get('common.titles.wallet');
118
- this.settings = salla.lang.get('common.titles.settings');
119
- this.loyalty_program = salla.lang.get('pages.loyalty_program.loyalty_points');
120
- this.logout = salla.lang.get('blocks.header.logout');
121
- });
122
- Salla.onReady(() => {
123
- if (salla.config.isGuest()) {
124
- return;
125
- }
126
- this.is_loggedIn = true;
127
- /**
128
- * Get Fresh Notifications In These Cases:
129
- * - is notification page, if user already changed the status of his orders (to reset notification badge)
130
- * - is pending orders page, if user already changed the status of his orders (to reset orders badge)
131
- * - is profile page, in case user changed his name or avatar, we need to update it
132
- * - half hour is passed from the last user data fetched
133
- *
134
- * //todo:: update the data in the storage in customer pages
135
- * //todo:: cover two requests in customer pages
136
- * //todo:: make sure to run this only after token is set
137
- */
138
- const shouldFetchProfile = !this.inline &&
139
- (salla.url.is_page('customer.notifications') ||
140
- salla.url.is_page('customer.orders.index.pending') ||
141
- salla.url.is_page('customer.profile') ||
142
- (Date.now() - (salla.storage.get('user.fetched_at') || 0)) / 1000 / 60 > 30);
143
- if (shouldFetchProfile) {
144
- this.fetchFreshProfile();
145
- }
146
- else {
147
- salla.event.on('profile::info.fetched', res => {
148
- this.updateProfileState(res);
149
- });
150
- }
151
- });
152
113
  }
153
114
  async componentWillLoad() {
154
115
  await salla.onReady();
155
116
  await salla.lang.onLoaded();
117
+ this.loadTranslations();
118
+ this.initiate();
156
119
  Salla.event.on('api::token.injected', (token) => this.profileUrl = this.buildProfileUrl(token));
157
120
  this.sallaAccountEnabled = Salla.config.get('store.features')?.includes('salla-account');
158
121
  this.items = this.sallaAccountEnabled ? { ...this.items, settings: SettingstIcon } : this.items;
@@ -176,6 +139,56 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class SallaUserMenu ext
176
139
  this.triggerSlot = trigger.innerHTML;
177
140
  trigger.innerHTML = this.replaceParams(trigger.innerHTML);
178
141
  }
142
+ loadTranslations() {
143
+ this.notifications = Salla.lang.get('common.titles.notifications');
144
+ this.orders = Salla.lang.get('common.titles.orders');
145
+ this.pending_orders = Salla.lang.get('common.titles.pending_orders');
146
+ this.wishlist = Salla.lang.get('common.titles.wishlist');
147
+ this.profile = Salla.lang.get('common.titles.profile');
148
+ this.hello = Salla.lang.get('pages.checkout.hello');
149
+ this.rating = Salla.lang.get('common.titles.rating');
150
+ this.wallet = Salla.lang.get('common.titles.wallet');
151
+ this.settings = Salla.lang.get('common.titles.settings');
152
+ this.loyalty_program = Salla.lang.get('pages.loyalty_program.loyalty_points');
153
+ this.logout = Salla.lang.get('blocks.header.logout');
154
+ }
155
+ initiate() {
156
+ if (Salla.config.isGuest()) {
157
+ return this.autoMountLoginModal();
158
+ }
159
+ this.is_loggedIn = true;
160
+ /**
161
+ * Get Fresh Notifications In These Cases:
162
+ * - is notification page, if user already changed the status of his orders (to reset notification badge)
163
+ * - is pending orders page, if user already changed the status of his orders (to reset orders badge)
164
+ * - is profile page, in case user changed his name or avatar, we need to update it
165
+ * - half hour is passed from the last user data fetched
166
+ *
167
+ * //todo:: update the data in the storage in customer pages
168
+ * //todo:: cover two requests in customer pages
169
+ * //todo:: make sure to run this only after token is set
170
+ */
171
+ const shouldFetchProfile = !this.inline &&
172
+ (salla.url.is_page('customer.notifications') ||
173
+ salla.url.is_page('customer.orders.index.pending') ||
174
+ salla.url.is_page('customer.profile') ||
175
+ (Date.now() - (salla.storage.get('user.fetched_at') || 0)) / 1000 / 60 > 30);
176
+ if (shouldFetchProfile) {
177
+ return this.fetchFreshProfile();
178
+ }
179
+ salla.event.on('profile::info.fetched', res => {
180
+ this.updateProfileState(res);
181
+ });
182
+ }
183
+ autoMountLoginModal() {
184
+ if (!this.autoMount) {
185
+ return;
186
+ }
187
+ if (document.querySelector('salla-login-modal')) {
188
+ return;
189
+ }
190
+ Salla.hooks.mount('body:end', document.createElement('salla-login-modal'));
191
+ }
179
192
  fetchFreshProfile() {
180
193
  //don't request fetchFreshProfile unless token is injected into the api
181
194
  if (!salla.api.token) {
@@ -274,6 +287,7 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class SallaUserMenu ext
274
287
  "avatarOnly": [516, "avatar-only"],
275
288
  "showHeader": [516, "show-header"],
276
289
  "relativeDropdown": [516, "relative-dropdown"],
290
+ "autoMount": [516, "auto-mount"],
277
291
  "accountLoading": [32],
278
292
  "opened": [32],
279
293
  "notifications": [32],
@@ -301,13 +315,28 @@ function defineCustomElement$1() {
301
315
  if (typeof customElements === "undefined") {
302
316
  return;
303
317
  }
304
- const components = ["salla-user-menu"];
318
+ const components = ["salla-user-menu", "salla-loading", "salla-login-modal", "salla-modal"];
305
319
  components.forEach(tagName => { switch (tagName) {
306
320
  case "salla-user-menu":
307
321
  if (!customElements.get(tagName)) {
308
322
  customElements.define(tagName, SallaUserMenu$1);
309
323
  }
310
324
  break;
325
+ case "salla-loading":
326
+ if (!customElements.get(tagName)) {
327
+ defineCustomElement$4();
328
+ }
329
+ break;
330
+ case "salla-login-modal":
331
+ if (!customElements.get(tagName)) {
332
+ defineCustomElement$3();
333
+ }
334
+ break;
335
+ case "salla-modal":
336
+ if (!customElements.get(tagName)) {
337
+ defineCustomElement$2();
338
+ }
339
+ break;
311
340
  } });
312
341
  }
313
342
  defineCustomElement$1();
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { d as getDefaultExportFromCjs } from './index-DhtEPVv1.js';
4
+ import { d as getDefaultExportFromCjs } from './index-CTOqXLNX.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { d as getDefaultExportFromCjs } from './index-DhtEPVv1.js';
4
+ import { d as getDefaultExportFromCjs } from './index-CTOqXLNX.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { d as getDefaultExportFromCjs } from './index-DhtEPVv1.js';
4
+ import { d as getDefaultExportFromCjs } from './index-CTOqXLNX.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { d as getDefaultExportFromCjs } from './index-DhtEPVv1.js';
4
+ import { d as getDefaultExportFromCjs } from './index-CTOqXLNX.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { d as getDefaultExportFromCjs } from './index-DhtEPVv1.js';
4
+ import { d as getDefaultExportFromCjs } from './index-CTOqXLNX.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { d as getDefaultExportFromCjs } from './index-DhtEPVv1.js';
4
+ import { d as getDefaultExportFromCjs } from './index-CTOqXLNX.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { d as getDefaultExportFromCjs } from './index-DhtEPVv1.js';
4
+ import { d as getDefaultExportFromCjs } from './index-CTOqXLNX.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { d as getDefaultExportFromCjs } from './index-DhtEPVv1.js';
4
+ import { d as getDefaultExportFromCjs } from './index-CTOqXLNX.js';
5
5
 
6
6
  function _mergeNamespaces(n, m) {
7
7
  m.forEach(function (e) {