@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.
- package/dist/cjs/{filepond-CVZ-BhRy.js → filepond-C8Iv03Xw.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-2ShKuqPr.js → filepond-plugin-file-poster-6G0m20wb.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-BFWtiLWL.js → filepond-plugin-file-validate-size-BrrvFDrX.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-BzqK-hKY.js → filepond-plugin-file-validate-type-BAIli6YR.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-Bcnu5eSZ.js → filepond-plugin-image-edit-CLI8O8iN.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-CCnsEJ8x.js → filepond-plugin-image-exif-orientation-D6pllZWx.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-kn_ZJZXi.js → filepond-plugin-image-preview-CkkozCc3.js} +1 -1
- package/dist/cjs/{index-B-qAr7bS.js → index-CiABtziQ.js} +1 -1
- package/dist/cjs/{index-CF5bZnDB.js → index-D8CYdUGa.js} +6 -6
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-accordion-body_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_4.cjs.entry.js +1 -1
- package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
- package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
- package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
- package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
- package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
- package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +1 -1
- package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
- package/dist/cjs/salla-hook.cjs.entry.js +1 -1
- package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
- package/dist/cjs/salla-installment.cjs.entry.js +1 -1
- package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
- package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
- package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
- package/dist/cjs/salla-menu.cjs.entry.js +1 -1
- package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
- package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
- package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
- package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
- package/dist/cjs/salla-orders.cjs.entry.js +1 -1
- package/dist/cjs/salla-payments.cjs.entry.js +1 -1
- package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
- package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
- package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
- package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/salla-slider.cjs.entry.js +1 -1
- package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
- package/dist/cjs/salla-social.cjs.entry.js +1 -1
- package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
- package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
- package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-menu.cjs.entry.js +57 -47
- package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
- package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
- package/dist/cjs/salla-verify.cjs.entry.js +1 -1
- package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/cjs/{vanilla-picker-DuWLLDIZ.js → vanilla-picker-AGoPnWFt.js} +1 -1
- package/dist/collection/components/salla-user-menu/salla-user-menu.js +76 -46
- package/dist/components/index.js +2 -2
- package/dist/components/salla-login-modal.js +1 -358
- package/dist/components/salla-login-modal2.js +363 -0
- package/dist/components/salla-user-menu.js +76 -47
- package/dist/esm/{filepond-BInIwZYj.js → filepond-BbukY3G5.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-DRu2Mi6P.js → filepond-plugin-file-poster-DIB4KhNs.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-DO5zxC4X.js → filepond-plugin-file-validate-size-C2La5co0.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-BwxMZ28-.js → filepond-plugin-file-validate-type-s5WI8DP4.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-CwEZfbKE.js → filepond-plugin-image-edit-BdW45IS3.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-B2YJJ8ni.js → filepond-plugin-image-exif-orientation-C12lmnIq.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-BdiNpvoD.js → filepond-plugin-image-preview-DC2SjiV6.js} +1 -1
- package/dist/esm/{index-BKsC0x_d.js → index-COH2oGKJ.js} +1 -1
- package/dist/esm/{index-DhtEPVv1.js → index-CTOqXLNX.js} +6 -6
- package/dist/esm/loader.js +3 -3
- package/dist/esm/salla-accordion-body_3.entry.js +1 -1
- package/dist/esm/salla-accordion_6.entry.js +1 -1
- package/dist/esm/salla-add-product-button_4.entry.js +1 -1
- package/dist/esm/salla-advertisement.entry.js +1 -1
- package/dist/esm/salla-alert_2.entry.js +1 -1
- package/dist/esm/salla-app-install-alert.entry.js +1 -1
- package/dist/esm/salla-apps-icons.entry.js +1 -1
- package/dist/esm/salla-booking-field_7.entry.js +10 -10
- package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
- package/dist/esm/salla-comment-form_8.entry.js +1 -1
- package/dist/esm/salla-conditional-offer.entry.js +1 -1
- package/dist/esm/salla-contacts.entry.js +1 -1
- package/dist/esm/salla-count-down_2.entry.js +1 -1
- package/dist/esm/salla-custom-fields.entry.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +1 -1
- package/dist/esm/salla-gifting.entry.js +1 -1
- package/dist/esm/salla-hook.entry.js +1 -1
- package/dist/esm/salla-infinite-scroll.entry.js +1 -1
- package/dist/esm/salla-installment.entry.js +1 -1
- package/dist/esm/salla-list-tile.entry.js +1 -1
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
- package/dist/esm/salla-loyalty-program.entry.js +1 -1
- package/dist/esm/salla-loyalty.entry.js +1 -1
- package/dist/esm/salla-maintenance-alert.entry.js +1 -1
- package/dist/esm/salla-menu.entry.js +1 -1
- package/dist/esm/salla-metadata.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
- package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-notification-item.entry.js +1 -1
- package/dist/esm/salla-notifications.entry.js +1 -1
- package/dist/esm/salla-offer-modal.entry.js +1 -1
- package/dist/esm/salla-offer.entry.js +1 -1
- package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
- package/dist/esm/salla-order-details-options.entry.js +1 -1
- package/dist/esm/salla-order-details.entry.js +1 -1
- package/dist/esm/salla-order-summary.entry.js +1 -1
- package/dist/esm/salla-order-totals-card.entry.js +1 -1
- package/dist/esm/salla-orders.entry.js +1 -1
- package/dist/esm/salla-payments.entry.js +1 -1
- package/dist/esm/salla-placeholder.entry.js +1 -1
- package/dist/esm/salla-price-range.entry.js +1 -1
- package/dist/esm/salla-product-size-guide.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +1 -1
- package/dist/esm/salla-products-slider.entry.js +1 -1
- package/dist/esm/salla-progress-bar.entry.js +1 -1
- package/dist/esm/salla-quick-order.entry.js +1 -1
- package/dist/esm/salla-rating-modal.entry.js +1 -1
- package/dist/esm/salla-scopes.entry.js +1 -1
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/salla-skeleton.entry.js +1 -1
- package/dist/esm/salla-slider.entry.js +1 -1
- package/dist/esm/salla-social-share.entry.js +1 -1
- package/dist/esm/salla-social.entry.js +1 -1
- package/dist/esm/salla-tab-content_3.entry.js +1 -1
- package/dist/esm/salla-tiered-offer.entry.js +1 -1
- package/dist/esm/salla-tooltip.entry.js +1 -1
- package/dist/esm/salla-trust-badges.entry.js +1 -1
- package/dist/esm/salla-user-menu.entry.js +57 -47
- package/dist/esm/salla-user-profile.entry.js +1 -1
- package/dist/esm/salla-user-settings.entry.js +1 -1
- package/dist/esm/salla-verify.entry.js +1 -1
- package/dist/esm/salla-wallet.entry.js +1 -1
- package/dist/esm/twilight.js +3 -3
- package/dist/esm/{vanilla-picker-9y3LOKrc.js → vanilla-picker-xnlQPhDH.js} +1 -1
- package/dist/twilight/p-030cfa72.entry.js +4 -0
- package/dist/twilight/{p-12c7abc7.entry.js → p-08085ebd.entry.js} +1 -1
- package/dist/twilight/{p-0523a5ef.entry.js → p-1a18938a.entry.js} +1 -1
- package/dist/twilight/{p-63fb4f6a.entry.js → p-1b706044.entry.js} +1 -1
- package/dist/twilight/{p-9902b843.entry.js → p-25d51430.entry.js} +1 -1
- package/dist/twilight/{p-3071d452.entry.js → p-26c0b94a.entry.js} +1 -1
- package/dist/twilight/{p-f47c7d7e.entry.js → p-26cc636d.entry.js} +1 -1
- package/dist/twilight/{p-8318e5a4.entry.js → p-2f9c2638.entry.js} +1 -1
- package/dist/twilight/{p-da2a9d5e.entry.js → p-3306aeb9.entry.js} +1 -1
- package/dist/twilight/{p-9da9a96e.entry.js → p-331cc73d.entry.js} +1 -1
- package/dist/twilight/{p-83a9dae4.entry.js → p-341b1773.entry.js} +1 -1
- package/dist/twilight/{p-ca414718.entry.js → p-342648a6.entry.js} +1 -1
- package/dist/twilight/{p-de3f8afc.entry.js → p-3cfcccd4.entry.js} +1 -1
- package/dist/twilight/{p-06af1120.entry.js → p-3d953eaa.entry.js} +1 -1
- package/dist/twilight/{p-56b5658d.entry.js → p-40fe2fdb.entry.js} +1 -1
- package/dist/twilight/{p-47bc1b0e.entry.js → p-4288fffb.entry.js} +1 -1
- package/dist/twilight/{p-378f9cb2.entry.js → p-45cfc834.entry.js} +1 -1
- package/dist/twilight/{p-17a49368.entry.js → p-4d8b8554.entry.js} +1 -1
- package/dist/twilight/{p-00c8b870.entry.js → p-53fcf35b.entry.js} +1 -1
- package/dist/twilight/{p-dbd7bab7.entry.js → p-54a1b32c.entry.js} +1 -1
- package/dist/twilight/{p-659378d1.entry.js → p-5c57f6a7.entry.js} +1 -1
- package/dist/twilight/{p-706fc07a.entry.js → p-605cf513.entry.js} +1 -1
- package/dist/twilight/{p-a5094c62.entry.js → p-61ab5693.entry.js} +1 -1
- package/dist/twilight/{p-2ab31b93.entry.js → p-66d0fc30.entry.js} +1 -1
- package/dist/twilight/{p-fd9858a0.entry.js → p-680a8a26.entry.js} +1 -1
- package/dist/twilight/{p-478da0db.entry.js → p-6b166062.entry.js} +1 -1
- package/dist/twilight/{p-6aa0b298.entry.js → p-6be952b4.entry.js} +1 -1
- package/dist/twilight/{p-b350c896.entry.js → p-6cf2ffe8.entry.js} +1 -1
- package/dist/twilight/{p-df17bdfb.entry.js → p-707bbd12.entry.js} +1 -1
- package/dist/twilight/{p-476a002f.entry.js → p-73f89ae0.entry.js} +1 -1
- package/dist/twilight/{p-5a691df0.entry.js → p-770b684e.entry.js} +1 -1
- package/dist/twilight/{p-67656ed6.entry.js → p-77380609.entry.js} +1 -1
- package/dist/twilight/{p-04871dde.entry.js → p-7fc1087d.entry.js} +1 -1
- package/dist/twilight/{p-a37b4382.entry.js → p-81148c5c.entry.js} +1 -1
- package/dist/twilight/{p-e13bcda5.entry.js → p-852f653a.entry.js} +1 -1
- package/dist/twilight/{p-6b48b78c.entry.js → p-881d81da.entry.js} +1 -1
- package/dist/twilight/{p-18c1aa82.entry.js → p-8b251669.entry.js} +1 -1
- package/dist/twilight/{p-68f77bf9.entry.js → p-8b444008.entry.js} +1 -1
- package/dist/twilight/{p-8e3ab101.entry.js → p-8c87fc89.entry.js} +1 -1
- package/dist/twilight/{p-ddf1eb8e.entry.js → p-8d380340.entry.js} +1 -1
- package/dist/twilight/{p-c623dae3.entry.js → p-9247e41a.entry.js} +1 -1
- package/dist/twilight/{p-c50ea722.entry.js → p-953dc2c7.entry.js} +1 -1
- package/dist/twilight/{p-C5JBfwX3.js → p-BTHq9O3t.js} +1 -1
- package/dist/twilight/{p-9kdhmfl0.js → p-B_QZ5Uh8.js} +2 -2
- package/dist/twilight/{p-DhtEPVv1.js → p-CTOqXLNX.js} +1 -1
- package/dist/twilight/{p-BnEemU3K.js → p-CUP6xpY8.js} +1 -1
- package/dist/twilight/{p-Oa-SLesW.js → p-CVhlRyCZ.js} +1 -1
- package/dist/twilight/p-CeLw8fUj.js +9 -0
- package/dist/twilight/{p-D5Ctrxqk.js → p-CfxXglSG.js} +1 -1
- package/dist/twilight/{p-ChWBy7Mi.js → p-D-swSluC.js} +1 -1
- package/dist/twilight/{p-sTgCEptc.js → p-DneV5uAu.js} +1 -1
- package/dist/twilight/{p-c6abc912.entry.js → p-a1fa152d.entry.js} +1 -1
- package/dist/twilight/{p-e61517dd.entry.js → p-a2536d37.entry.js} +1 -1
- package/dist/twilight/{p-ead767db.entry.js → p-a44e8395.entry.js} +1 -1
- package/dist/twilight/{p-89f4a500.entry.js → p-a6f29cf5.entry.js} +1 -1
- package/dist/twilight/{p-4d200466.entry.js → p-a84a4855.entry.js} +1 -1
- package/dist/twilight/{p-e0506d5f.entry.js → p-aa2ba103.entry.js} +1 -1
- package/dist/twilight/{p-6c9a3556.entry.js → p-aea1ea51.entry.js} +1 -1
- package/dist/twilight/{p-d597ea5a.entry.js → p-b02413c6.entry.js} +1 -1
- package/dist/twilight/{p-e0f3dcc1.entry.js → p-b8738435.entry.js} +1 -1
- package/dist/twilight/{p-3874791d.entry.js → p-b95b8e92.entry.js} +1 -1
- package/dist/twilight/{p-0317ca56.entry.js → p-bb333ec8.entry.js} +1 -1
- package/dist/twilight/{p-c2167627.entry.js → p-bff05b48.entry.js} +1 -1
- package/dist/twilight/{p-af829f6e.entry.js → p-ca96c86b.entry.js} +1 -1
- package/dist/twilight/{p-a1853dac.entry.js → p-cb619ea6.entry.js} +1 -1
- package/dist/twilight/{p-93e72677.entry.js → p-cec6fce5.entry.js} +1 -1
- package/dist/twilight/{p-e6de17d2.entry.js → p-d3852cc4.entry.js} +1 -1
- package/dist/twilight/{p-8b8442ec.entry.js → p-d8affce0.entry.js} +1 -1
- package/dist/twilight/{p-0108db0e.entry.js → p-dcb6403c.entry.js} +1 -1
- package/dist/twilight/{p-3253d74f.entry.js → p-e9619d27.entry.js} +1 -1
- package/dist/twilight/{p-e0f56ef8.entry.js → p-ed8ce802.entry.js} +1 -1
- package/dist/twilight/{p-adbb3dcd.entry.js → p-f81009de.entry.js} +1 -1
- package/dist/twilight/{p-135b2262.entry.js → p-f81e3982.entry.js} +1 -1
- package/dist/twilight/{p-b01b370a.entry.js → p-fbc8d862.entry.js} +1 -1
- package/dist/twilight/{p-5636bdc5.entry.js → p-fc958ce6.entry.js} +1 -1
- package/dist/twilight/{p-DucyXwUa.js → p-kA0d1JcV.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +7 -1
- package/dist/types/components.d.ts +10 -0
- package/package.json +5 -5
- package/dist/twilight/p-a798090d.entry.js +0 -4
- package/dist/twilight/p-upVSO4PR.js +0 -9
|
@@ -1,364 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { d as defineCustomElement$3 } from './salla-loading2.js';
|
|
6
|
-
import { d as defineCustomElement$2 } 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$1 = /*@__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$1() {
|
|
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$1);
|
|
347
|
-
}
|
|
348
|
-
break;
|
|
349
|
-
case "salla-loading":
|
|
350
|
-
if (!customElements.get(tagName)) {
|
|
351
|
-
defineCustomElement$3();
|
|
352
|
-
}
|
|
353
|
-
break;
|
|
354
|
-
case "salla-modal":
|
|
355
|
-
if (!customElements.get(tagName)) {
|
|
356
|
-
defineCustomElement$2();
|
|
357
|
-
}
|
|
358
|
-
break;
|
|
359
|
-
} });
|
|
360
|
-
}
|
|
361
|
-
defineCustomElement$1();
|
|
4
|
+
import { S as SallaLoginModal$1, d as defineCustomElement$1 } from './salla-login-modal2.js';
|
|
362
5
|
|
|
363
6
|
const SallaLoginModal = SallaLoginModal$1;
|
|
364
7
|
const defineCustomElement = defineCustomElement$1;
|