@salla.sa/twilight-components 2.14.356 → 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-Cp7YEyDQ.js → filepond-C8Iv03Xw.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-poster-CR4IT_jI.js → filepond-plugin-file-poster-6G0m20wb.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-size-DINya0Zr.js → filepond-plugin-file-validate-size-BrrvFDrX.js} +1 -1
- package/dist/cjs/{filepond-plugin-file-validate-type-Yo85drbo.js → filepond-plugin-file-validate-type-BAIli6YR.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-edit-DZTSgDgr.js → filepond-plugin-image-edit-CLI8O8iN.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-exif-orientation-Dtdd6Do2.js → filepond-plugin-image-exif-orientation-D6pllZWx.js} +1 -1
- package/dist/cjs/{filepond-plugin-image-preview-kI1VoGOp.js → filepond-plugin-image-preview-CkkozCc3.js} +1 -1
- package/dist/cjs/{index-BB2wN5Zu.js → index-CiABtziQ.js} +1 -1
- package/dist/cjs/{index-B5Ws8rT7.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 +23 -30
- 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-C-AqEZ0S.js → vanilla-picker-AGoPnWFt.js} +1 -1
- package/dist/collection/components/salla-products-slider/salla-products-slider.js +1 -1
- package/dist/collection/components/salla-slider/salla-slider.js +25 -33
- 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-slider2.js +23 -31
- package/dist/components/salla-user-menu.js +76 -47
- package/dist/esm/{filepond-DK_xd-tp.js → filepond-BbukY3G5.js} +1 -1
- package/dist/esm/{filepond-plugin-file-poster-J4J1RcGt.js → filepond-plugin-file-poster-DIB4KhNs.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-size-BDSgcYn7.js → filepond-plugin-file-validate-size-C2La5co0.js} +1 -1
- package/dist/esm/{filepond-plugin-file-validate-type-U8jHGr5v.js → filepond-plugin-file-validate-type-s5WI8DP4.js} +1 -1
- package/dist/esm/{filepond-plugin-image-edit-CFrud4h0.js → filepond-plugin-image-edit-BdW45IS3.js} +1 -1
- package/dist/esm/{filepond-plugin-image-exif-orientation-D5hBL036.js → filepond-plugin-image-exif-orientation-C12lmnIq.js} +1 -1
- package/dist/esm/{filepond-plugin-image-preview-CPKs1HAm.js → filepond-plugin-image-preview-DC2SjiV6.js} +1 -1
- package/dist/esm/{index-C2KyQGaa.js → index-COH2oGKJ.js} +1 -1
- package/dist/esm/{index-BkWJPw7x.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 +23 -30
- 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-DOvdi39c.js → vanilla-picker-xnlQPhDH.js} +1 -1
- package/dist/twilight/p-030cfa72.entry.js +4 -0
- package/dist/twilight/{p-30907a97.entry.js → p-08085ebd.entry.js} +1 -1
- package/dist/twilight/{p-6a8f5002.entry.js → p-1a18938a.entry.js} +1 -1
- package/dist/twilight/{p-8ab1cb25.entry.js → p-1b706044.entry.js} +1 -1
- package/dist/twilight/{p-c8a82f37.entry.js → p-25d51430.entry.js} +1 -1
- package/dist/twilight/{p-b693aefa.entry.js → p-26c0b94a.entry.js} +1 -1
- package/dist/twilight/{p-c288faca.entry.js → p-26cc636d.entry.js} +1 -1
- package/dist/twilight/{p-65b3442d.entry.js → p-2f9c2638.entry.js} +1 -1
- package/dist/twilight/{p-07f8cb47.entry.js → p-3306aeb9.entry.js} +1 -1
- package/dist/twilight/{p-a32de0ab.entry.js → p-331cc73d.entry.js} +1 -1
- package/dist/twilight/{p-13cc3fb9.entry.js → p-341b1773.entry.js} +1 -1
- package/dist/twilight/{p-215fa138.entry.js → p-342648a6.entry.js} +1 -1
- package/dist/twilight/{p-13d7b8db.entry.js → p-3cfcccd4.entry.js} +1 -1
- package/dist/twilight/{p-eeb474c4.entry.js → p-3d953eaa.entry.js} +1 -1
- package/dist/twilight/{p-924e13b5.entry.js → p-40fe2fdb.entry.js} +1 -1
- package/dist/twilight/{p-59a1cc3e.entry.js → p-4288fffb.entry.js} +1 -1
- package/dist/twilight/{p-7f28971d.entry.js → p-45cfc834.entry.js} +1 -1
- package/dist/twilight/{p-bb9ae7be.entry.js → p-4d8b8554.entry.js} +1 -1
- package/dist/twilight/{p-8e12cdb4.entry.js → p-53fcf35b.entry.js} +1 -1
- package/dist/twilight/{p-414d057a.entry.js → p-54a1b32c.entry.js} +1 -1
- package/dist/twilight/{p-e7a1cda7.entry.js → p-5c57f6a7.entry.js} +1 -1
- package/dist/twilight/{p-1b5fc61d.entry.js → p-605cf513.entry.js} +1 -1
- package/dist/twilight/{p-74a880cc.entry.js → p-61ab5693.entry.js} +1 -1
- package/dist/twilight/{p-162806a6.entry.js → p-66d0fc30.entry.js} +1 -1
- package/dist/twilight/{p-5a2072d5.entry.js → p-680a8a26.entry.js} +1 -1
- package/dist/twilight/{p-a42543cf.entry.js → p-6b166062.entry.js} +1 -1
- package/dist/twilight/{p-0caa1e0c.entry.js → p-6be952b4.entry.js} +1 -1
- package/dist/twilight/{p-415ba86d.entry.js → p-6cf2ffe8.entry.js} +1 -1
- package/dist/twilight/{p-77e219f7.entry.js → p-707bbd12.entry.js} +1 -1
- package/dist/twilight/{p-8f8cbf30.entry.js → p-73f89ae0.entry.js} +1 -1
- package/dist/twilight/{p-29bbbd8f.entry.js → p-770b684e.entry.js} +1 -1
- package/dist/twilight/{p-db6b7e58.entry.js → p-77380609.entry.js} +1 -1
- package/dist/twilight/{p-13f1e451.entry.js → p-7fc1087d.entry.js} +1 -1
- package/dist/twilight/{p-90440e96.entry.js → p-81148c5c.entry.js} +1 -1
- package/dist/twilight/{p-e6c7e348.entry.js → p-852f653a.entry.js} +1 -1
- package/dist/twilight/{p-bd9e6239.entry.js → p-881d81da.entry.js} +1 -1
- package/dist/twilight/{p-95862483.entry.js → p-8b251669.entry.js} +1 -1
- package/dist/twilight/{p-7edda278.entry.js → p-8b444008.entry.js} +1 -1
- package/dist/twilight/{p-a7c0bc08.entry.js → p-8c87fc89.entry.js} +1 -1
- package/dist/twilight/{p-2e2dce52.entry.js → p-8d380340.entry.js} +1 -1
- package/dist/twilight/{p-67ed8f76.entry.js → p-9247e41a.entry.js} +1 -1
- package/dist/twilight/{p-a528f44e.entry.js → p-953dc2c7.entry.js} +1 -1
- package/dist/twilight/{p-DDUfBWCl.js → p-BTHq9O3t.js} +1 -1
- package/dist/twilight/{p-B7hfl1_L.js → p-B_QZ5Uh8.js} +1 -1
- package/dist/twilight/{p-BkWJPw7x.js → p-CTOqXLNX.js} +1 -1
- package/dist/twilight/{p-D1-Giq37.js → p-CUP6xpY8.js} +1 -1
- package/dist/twilight/{p-DEfwTter.js → p-CVhlRyCZ.js} +1 -1
- package/dist/twilight/{p-C-TeNpQx.js → p-CeLw8fUj.js} +2 -2
- package/dist/twilight/{p-BZ1obY9a.js → p-CfxXglSG.js} +1 -1
- package/dist/twilight/{p-DK6KzbCc.js → p-D-swSluC.js} +1 -1
- package/dist/twilight/{p-Dvq8cJys.js → p-DneV5uAu.js} +1 -1
- package/dist/twilight/{p-1616852e.entry.js → p-a1fa152d.entry.js} +1 -1
- package/dist/twilight/{p-131f1a54.entry.js → p-a2536d37.entry.js} +1 -1
- package/dist/twilight/{p-560f8e69.entry.js → p-a44e8395.entry.js} +1 -1
- package/dist/twilight/{p-bde045fa.entry.js → p-a6f29cf5.entry.js} +1 -1
- package/dist/twilight/{p-b6554543.entry.js → p-a84a4855.entry.js} +1 -1
- package/dist/twilight/{p-7fa36512.entry.js → p-aa2ba103.entry.js} +1 -1
- package/dist/twilight/{p-2f3e8d60.entry.js → p-aea1ea51.entry.js} +1 -1
- package/dist/twilight/{p-c14df66d.entry.js → p-b02413c6.entry.js} +1 -1
- package/dist/twilight/{p-7ee15c9e.entry.js → p-b8738435.entry.js} +1 -1
- package/dist/twilight/{p-39f15e8c.entry.js → p-b95b8e92.entry.js} +1 -1
- package/dist/twilight/{p-26d123cb.entry.js → p-bb333ec8.entry.js} +1 -1
- package/dist/twilight/{p-5f58d298.entry.js → p-bff05b48.entry.js} +1 -1
- package/dist/twilight/{p-cd20dfbd.entry.js → p-ca96c86b.entry.js} +1 -1
- package/dist/twilight/{p-f184ab27.entry.js → p-cb619ea6.entry.js} +1 -1
- package/dist/twilight/{p-f052464b.entry.js → p-cec6fce5.entry.js} +1 -1
- package/dist/twilight/{p-f2292a2c.entry.js → p-d3852cc4.entry.js} +1 -1
- package/dist/twilight/{p-f6acc615.entry.js → p-d8affce0.entry.js} +1 -1
- package/dist/twilight/{p-47d09695.entry.js → p-dcb6403c.entry.js} +1 -1
- package/dist/twilight/{p-b303d4aa.entry.js → p-e9619d27.entry.js} +1 -1
- package/dist/twilight/{p-3f911fed.entry.js → p-ed8ce802.entry.js} +1 -1
- package/dist/twilight/{p-4af20310.entry.js → p-f81009de.entry.js} +1 -1
- package/dist/twilight/{p-86e020f4.entry.js → p-f81e3982.entry.js} +1 -1
- package/dist/twilight/{p-01fbef77.entry.js → p-fbc8d862.entry.js} +1 -1
- package/dist/twilight/{p-3f71adc6.entry.js → p-fc958ce6.entry.js} +1 -1
- package/dist/twilight/{p-CXfpMFgS.js → p-kA0d1JcV.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-slider/salla-slider.d.ts +5 -6
- package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +7 -1
- package/dist/types/components.d.ts +20 -10
- package/package.json +5 -6
- package/dist/twilight/p-1965c320.entry.js +0 -4
|
@@ -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 };
|
|
@@ -9862,7 +9862,7 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
9862
9862
|
* When enabled and there is exactly one slide in the `items` slot,
|
|
9863
9863
|
* render without initializing Swiper (single slide mode).
|
|
9864
9864
|
*/
|
|
9865
|
-
this.
|
|
9865
|
+
this.staticWhenSingle = false;
|
|
9866
9866
|
/**
|
|
9867
9867
|
* Enable autoplay - working with `type="carousel" only`
|
|
9868
9868
|
*/
|
|
@@ -9894,8 +9894,6 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
9894
9894
|
this.isBeginning = true;
|
|
9895
9895
|
/** Use matchMedia instead of window.innerWidth to avoid forced reflow (Lighthouse recommended) */
|
|
9896
9896
|
this.isDesktopViewport = typeof window !== 'undefined' ? window.matchMedia('(min-width: 768px)').matches : true;
|
|
9897
|
-
/** When true, only one slide is present; we render without Swiper for performance. */
|
|
9898
|
-
this.singleSlideMode = false;
|
|
9899
9897
|
this._rafId = null;
|
|
9900
9898
|
this.viewportMediaQuery = null;
|
|
9901
9899
|
this.hasThumbSlot = false;
|
|
@@ -9952,7 +9950,7 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
9952
9950
|
* @returns The Swiper slider instance
|
|
9953
9951
|
*/
|
|
9954
9952
|
async sliderInstance() {
|
|
9955
|
-
return this.
|
|
9953
|
+
return this.slider;
|
|
9956
9954
|
}
|
|
9957
9955
|
/**
|
|
9958
9956
|
* Run transition to the slide with index number equal to 'index' parameter for the duration equal to 'speed' parameter.
|
|
@@ -10063,7 +10061,7 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
10063
10061
|
* Get slider slides
|
|
10064
10062
|
* **/
|
|
10065
10063
|
async getSlides() {
|
|
10066
|
-
return this.
|
|
10064
|
+
return this.slider?.slides;
|
|
10067
10065
|
}
|
|
10068
10066
|
/**
|
|
10069
10067
|
* Get slider slides
|
|
@@ -10114,9 +10112,7 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
10114
10112
|
* @param {boolean} runCallbacks - Set it to false (by default it is true) and transition will not produce transition events.
|
|
10115
10113
|
* **/
|
|
10116
10114
|
async thumbsSlideTo(index, speed, runCallbacks) {
|
|
10117
|
-
|
|
10118
|
-
return;
|
|
10119
|
-
return this.thumbsSlider.slideTo(index, speed, runCallbacks);
|
|
10115
|
+
return this.thumbsSlider?.slideTo(index, speed, runCallbacks);
|
|
10120
10116
|
}
|
|
10121
10117
|
/**
|
|
10122
10118
|
* Get thumbs slider slides
|
|
@@ -10124,7 +10120,14 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
10124
10120
|
async getThumbsSlides() {
|
|
10125
10121
|
return await this.thumbsSlider?.slides;
|
|
10126
10122
|
}
|
|
10127
|
-
|
|
10123
|
+
isStaticWhenSingle() {
|
|
10124
|
+
return this.staticWhenSingle && this.host.querySelector('[slot="items"]')?.children?.length === 1;
|
|
10125
|
+
}
|
|
10126
|
+
async componentWillLoad() {
|
|
10127
|
+
if (this.isStaticWhenSingle()) {
|
|
10128
|
+
this.host.classList.add('s-slider-single-mode');
|
|
10129
|
+
return;
|
|
10130
|
+
}
|
|
10128
10131
|
salla.lang.onLoaded(() => {
|
|
10129
10132
|
this.displayAllTitle = salla.lang.get('blocks.home.display_all');
|
|
10130
10133
|
});
|
|
@@ -10297,21 +10300,15 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
10297
10300
|
this.slider.on('transitionStart', (slider) => this.sliderTransitionStart.emit(slider));
|
|
10298
10301
|
}
|
|
10299
10302
|
render() {
|
|
10303
|
+
if (this.isStaticWhenSingle()) {
|
|
10304
|
+
return;
|
|
10305
|
+
}
|
|
10300
10306
|
let classes = this.type ? this.type + '-slider ' : '';
|
|
10301
10307
|
classes += this.controlsOuter ? ' s-slider-controls-outer ' : '';
|
|
10302
10308
|
classes += this.blockTitle == '' ? ' s-slider-has-notitle s-slider-v-centered ' : '';
|
|
10303
10309
|
classes += this.verticalThumbs ? ' s-slider-vertical ' : ' s-slider-horizontal ';
|
|
10304
10310
|
classes += this.arrowsCentered ? ' s-slider-v-centered ' : '';
|
|
10305
10311
|
classes += this.gridThumbs ? ' s-slider-with-grid-thumbs ' : '';
|
|
10306
|
-
if (this.singleSlideMode) {
|
|
10307
|
-
return (h(Host, { class: 's-slider-wrapper s-slider-single-mode ' + classes }, this.blockTitle || this.displayAllUrl ?
|
|
10308
|
-
h("div", { class: "s-slider-block__title" }, this.blockTitle ?
|
|
10309
|
-
h("div", { class: "s-slider-block__title-right" }, h("h2", null, this.blockTitle), this.blockSubtitle ? h("p", { innerHTML: this.blockSubtitle }) : '')
|
|
10310
|
-
: '', this.displayAllUrl ?
|
|
10311
|
-
h("div", { class: "s-slider-block__title-left" }, h("a", { href: this.displayAllUrl, class: "s-slider-block__display-all" }, this.displayAllTitle))
|
|
10312
|
-
: '')
|
|
10313
|
-
: '', h("div", { class: "swiper s-slider-container s-slider-single", dir: this.vertical ? "ltr" : this.direction }, h("slot", null), h("div", { class: "swiper-wrapper s-slider-swiper-wrapper" }, h("slot", { name: 'items' })))));
|
|
10314
|
-
}
|
|
10315
10312
|
return (h(Host, { class: 's-slider-wrapper ' + classes }, this.blockTitle || this.showControls ?
|
|
10316
10313
|
h("div", { class: "s-slider-block__title" }, this.blockTitle ?
|
|
10317
10314
|
h("div", { class: "s-slider-block__title-right" }, h("h2", null, this.blockTitle), this.blockSubtitle ? h("p", { innerHTML: this.blockSubtitle }) : '')
|
|
@@ -10380,9 +10377,11 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
10380
10377
|
this.lazyObserver.observe(el);
|
|
10381
10378
|
}
|
|
10382
10379
|
componentDidLoad() {
|
|
10380
|
+
if (this.isStaticWhenSingle()) {
|
|
10381
|
+
return;
|
|
10382
|
+
}
|
|
10383
10383
|
// 1. Batch Reads (Get all elements first without modifying DOM)
|
|
10384
10384
|
const tasks = [];
|
|
10385
|
-
let _singleSlideMode = false;
|
|
10386
10385
|
const prepareFlatten = (container, slotSelector) => {
|
|
10387
10386
|
const slotEl = container?.querySelector(slotSelector);
|
|
10388
10387
|
if (!slotEl)
|
|
@@ -10391,10 +10390,6 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
10391
10390
|
if (elements.length) {
|
|
10392
10391
|
// Queue the Write operation
|
|
10393
10392
|
tasks.push(() => slotEl.replaceWith(...elements));
|
|
10394
|
-
if (elements.length === 1 && this.enableSingleSlideMode) {
|
|
10395
|
-
_singleSlideMode = true;
|
|
10396
|
-
elements[0].classList.add('swiper-slide');
|
|
10397
|
-
}
|
|
10398
10393
|
}
|
|
10399
10394
|
};
|
|
10400
10395
|
prepareFlatten(this.sliderWrapper, 'div[slot="items"]');
|
|
@@ -10404,16 +10399,14 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
10404
10399
|
// 2. Batch Writes (Execute all DOM modifications together)
|
|
10405
10400
|
tasks.forEach(task => task());
|
|
10406
10401
|
// 3. Init Swiper inside rAF
|
|
10407
|
-
this._rafId = requestAnimationFrame(() =>
|
|
10408
|
-
this.singleSlideMode = _singleSlideMode;
|
|
10409
|
-
if (!_singleSlideMode) {
|
|
10410
|
-
this.initSlider();
|
|
10411
|
-
}
|
|
10412
|
-
});
|
|
10402
|
+
this._rafId = requestAnimationFrame(() => this.initSlider());
|
|
10413
10403
|
this.viewportMediaQuery = window.matchMedia('(min-width: 768px)');
|
|
10414
10404
|
this.viewportMediaQuery.addEventListener('change', this.onViewportChange);
|
|
10415
10405
|
}
|
|
10416
10406
|
disconnectedCallback() {
|
|
10407
|
+
if (this.isStaticWhenSingle()) {
|
|
10408
|
+
return;
|
|
10409
|
+
}
|
|
10417
10410
|
if (this._rafId)
|
|
10418
10411
|
cancelAnimationFrame(this._rafId);
|
|
10419
10412
|
this.viewportMediaQuery?.removeEventListener('change', this.onViewportChange);
|
|
@@ -10435,7 +10428,7 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
10435
10428
|
"showControls": [516, "show-controls"],
|
|
10436
10429
|
"controlsOuter": [516, "controls-outer"],
|
|
10437
10430
|
"showThumbsControls": [4, "show-thumbs-controls"],
|
|
10438
|
-
"
|
|
10431
|
+
"staticWhenSingle": [516, "static-when-single"],
|
|
10439
10432
|
"autoPlay": [4, "auto-play"],
|
|
10440
10433
|
"slidesPerView": [1, "slides-per-view"],
|
|
10441
10434
|
"pagination": [4],
|
|
@@ -10450,7 +10443,6 @@ const SallaSlider = /*@__PURE__*/ proxyCustomElement(class SallaSlider extends H
|
|
|
10450
10443
|
"isBeginning": [32],
|
|
10451
10444
|
"displayAllTitle": [32],
|
|
10452
10445
|
"isDesktopViewport": [32],
|
|
10453
|
-
"singleSlideMode": [32],
|
|
10454
10446
|
"sliderInstance": [64],
|
|
10455
10447
|
"slideTo": [64],
|
|
10456
10448
|
"slideNext": [64],
|
|
@@ -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();
|