@salla.sa/twilight-components 1.2.0 → 1.3.0
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/loader.cjs.js +1 -1
- package/dist/cjs/salla-branches_22.cjs.entry.js +117 -26
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/assets/flat.svg +1 -0
- package/dist/collection/components/salla-loyalty/salla-loyalty.css +4 -0
- package/dist/collection/components/salla-loyalty/salla-loyalty.js +268 -50
- package/dist/collection/components/salla-modal/salla-modal.js +5 -2
- package/dist/collection/components/salla-placeholder/salla-placeholder.js +13 -3
- package/dist/collection/components/salla-search/salla-search.js +5 -4
- package/dist/collection/global/app.js +6 -1
- package/dist/components/salla-loyalty.js +115 -22
- package/dist/components/salla-modal2.js +5 -2
- package/dist/components/salla-placeholder2.js +8 -2
- package/dist/components/salla-search.js +5 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-branches_22.entry.js +117 -26
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/p-ff70bbc9.entry.js +4 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-loyalty/salla-loyalty.d.ts +40 -2
- package/dist/types/components/salla-modal/salla-modal.d.ts +1 -0
- package/dist/types/components/salla-placeholder/salla-placeholder.d.ts +3 -0
- package/dist/types/components/salla-search/salla-search.d.ts +1 -1
- package/dist/types/components.d.ts +60 -0
- package/example/assets/tailwind.css +528 -14
- package/package.json +2 -2
- package/dist/twilight-components/p-49a2ee1e.entry.js +0 -4
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -17,7 +17,7 @@ const patchEsm = () => {
|
|
|
17
17
|
const defineCustomElements = (win, options) => {
|
|
18
18
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
19
19
|
return patchEsm().then(() => {
|
|
20
|
-
return index.bootstrapLazy([["salla-branches_22.cjs",[[4,"salla-loyalty",{"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"points":[32],"exchange_points":[32],"are_you_sure_to_exchange":[32],"for":[32],"cancel":[32],"confirm":[32],"
|
|
20
|
+
return index.bootstrapLazy([["salla-branches_22.cjs",[[4,"salla-loyalty",{"prizePoints":[8,"prize-points"],"customerPoints":[2,"customer-points"],"prizeTitle":[1,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"points":[32],"exchange_points":[32],"are_you_sure_to_exchange":[32],"for":[32],"cancel":[32],"confirm":[32],"cart_total_point_summary":[32],"cart_point_exchange_now":[32],"login_button":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"open":[64],"close":[64]}],[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"add_to_cart":[32],"out_of_stock":[32],"open":[64],"showOffer":[64]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32],"typing":[32],"debounce":[32],"search_term":[32]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"emailErrorMsg":[32],"isVisitorSubscribed":[32]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-swiper",{"loop":[4],"speed":[2],"itemPerView":[8,"item-per-view"],"spaceBetweenItems":[2,"space-between-items"],"direction":[1],"currentIndex":[32],"isLastSlideItem":[32],"isFirstSlideItem":[32]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"default_title":[32],"default_description":[32]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"onSelect","onSelectedTab"]]],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"icon":[1],"iconStyle":[1,"icon-style"],"imageIcon":[1,"image-icon"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["salla-add-product-button.cjs",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"]}]]],["salla-conditional-fields.cjs",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-installment.cjs",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-quantity-input.cjs",[[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}]]]], options);
|
|
21
21
|
});
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -638,6 +638,13 @@ const SallaLoginModal = class {
|
|
|
638
638
|
};
|
|
639
639
|
SallaLoginModal.style = sallaLoginModalCss;
|
|
640
640
|
|
|
641
|
+
const Star2 = `<!-- Generated by IcoMoon.io -->
|
|
642
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="30" height="32" viewBox="0 0 30 32">
|
|
643
|
+
<title>star2</title>
|
|
644
|
+
<path d="M29.714 11.839c0 0.321-0.232 0.625-0.464 0.857l-6.482 6.321 1.536 8.929c0.018 0.125 0.018 0.232 0.018 0.357 0 0.464-0.214 0.893-0.732 0.893-0.25 0-0.5-0.089-0.714-0.214l-8.018-4.214-8.018 4.214c-0.232 0.125-0.464 0.214-0.714 0.214-0.518 0-0.75-0.429-0.75-0.893 0-0.125 0.018-0.232 0.036-0.357l1.536-8.929-6.5-6.321c-0.214-0.232-0.446-0.536-0.446-0.857 0-0.536 0.554-0.75 1-0.821l8.964-1.304 4.018-8.125c0.161-0.339 0.464-0.732 0.875-0.732s0.714 0.393 0.875 0.732l4.018 8.125 8.964 1.304c0.429 0.071 1 0.286 1 0.821z"></path>
|
|
645
|
+
</svg>
|
|
646
|
+
`;
|
|
647
|
+
|
|
641
648
|
const Star3 = `<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" viewBox="0 0 80 80">
|
|
642
649
|
<title>star3</title>
|
|
643
650
|
<defs>
|
|
@@ -688,14 +695,16 @@ const Star3 = `<svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" vi
|
|
|
688
695
|
</svg>
|
|
689
696
|
`;
|
|
690
697
|
|
|
691
|
-
const
|
|
698
|
+
const CancelIcon = `<!-- Generated by IcoMoon.io -->
|
|
692
699
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
693
|
-
<title>
|
|
694
|
-
<path d="
|
|
700
|
+
<title>cancel</title>
|
|
701
|
+
<path d="M17.885 16l7.057-7.057c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-7.057 7.057-7.057-7.057c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l7.057 7.057-7.057 7.057c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l7.057-7.057 7.057 7.057c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885z"></path>
|
|
695
702
|
</svg>
|
|
696
703
|
`;
|
|
697
704
|
|
|
698
|
-
const
|
|
705
|
+
const GiftImg = `<svg xmlns="http://www.w3.org/2000/svg" width="54.079" height="53.191" viewBox="0 0 54.079 53.191"><defs><style>.a{fill:#ee9d0d;}.b{fill:#c7830b;}.c{fill:#ea2b2d;}.d{fill:#cb2527;}.e{fill:#6699ce;}.f{fill:#faa6b2;}.g{fill:#a6deff;}.h{fill:#eeb436;}.i{fill:#f72d2f;}</style></defs><path class="a" d="M40,248H77.3v25.88a2.1,2.1,0,0,1-2.1,2.1H42.1a2.1,2.1,0,0,1-2.1-2.1Z" transform="translate(-38.135 -222.787)"/><path class="b" d="M250.632,248.711v12.755L236.2,248h13.67Z" transform="translate(-211.463 -222.787)"/><path class="b" d="M333.957,336v3.207L330.52,336Z" transform="translate(-294.787 -300.528)"/><path class="c" d="M226.194,32.048l-.5.185a5.035,5.035,0,0,0-3.072,3.292l-.468,1.585-.759.414a5.035,5.035,0,0,0-2.422,3l8.865,8.271,5.09-5.456.262-6.205a5.191,5.191,0,0,0-7-5.083Z" transform="translate(-196.246 -31.722)"/><path class="c" d="M358.628,175.48l-.15.509a5.034,5.034,0,0,1-3.072,3.292l-1.55.577-.359.785a5.034,5.034,0,0,1-2.822,2.624L341.81,175l5.09-5.455,6.172-.69a5.191,5.191,0,0,1,5.555,6.629Z" transform="translate(-304.761 -152.837)"/><path class="d" d="M168,248h7.461v27.978H168Z" transform="translate(-151.213 -222.787)"/><path class="c" d="M40,336H77.3v7.461H40Z" transform="translate(-38.135 -300.528)"/><path class="d" d="M333.957,336v3.207L330.52,336Z" transform="translate(-294.787 -300.528)"/><path class="a" d="M2.1,0H40.8a2.1,2.1,0,0,1,2.1,2.1V9.326H0V2.1A2.1,2.1,0,0,1,2.1,0Z" transform="matrix(0.731, 0.682, -0.682, 0.731, 18.641, 4.976)"/><path class="d" d="M0,0H9.326V9.326H0Z" transform="matrix(0.731, 0.682, -0.682, 0.731, 30.912, 16.424)"/><path class="d" d="M286.857,79.389a.931.931,0,0,1-.74-.365l-.615-.8a12.516,12.516,0,0,1-2.528-9,.933.933,0,0,1,1.855.2,10.66,10.66,0,0,0,2.153,7.667l.615.8a.933.933,0,0,1-.739,1.5Z" transform="translate(-252.718 -64.113)"/><path class="c" d="M185.485,178.151l-.039.014a30.78,30.78,0,0,1-12.034,1.906l-2.381-.1,4.092,3.817-1.181,4,3.728-1.206a30.775,30.775,0,0,0,9.833-5.315l.71-.572Z" transform="translate(-153.891 -161.081)"/><path class="d" d="M363.834,194.779a12.51,12.51,0,0,1-6.93-2.1l-.843-.559a.933.933,0,1,1,1.031-1.554l.842.558a10.659,10.659,0,0,0,7.8,1.618.933.933,0,1,1,.328,1.836A12.663,12.663,0,0,1,363.834,194.779Z" transform="translate(-316.982 -171.914)"/><path class="c" d="M275,202.524l-.012.04a30.776,30.776,0,0,0-1.069,12.137l.265,2.369-4.092-3.817-3.909,1.455.945-3.8a30.776,30.776,0,0,1,4.622-10.177l.521-.748Z" transform="translate(-237.949 -180.364)"/><circle class="e" cx="1.865" cy="1.865" r="1.865" transform="translate(10.259 0.032)"/><circle class="f" cx="1.865" cy="1.865" r="1.865" transform="translate(0 21.482)"/><path class="g" d="M36.663,36.663a.933.933,0,0,1-.885-.638l-.048-.143a2.946,2.946,0,0,0-2.8-2.017.933.933,0,1,1,0-1.865A4.808,4.808,0,0,1,37.5,35.292l.048.143a.933.933,0,0,1-.885,1.228Z" transform="translate(-31.067 -31.968)"/><path class="g" d="M79.493,194.438a.929.929,0,0,1-.506-.15l-.185-.12a2.074,2.074,0,0,0-2.192-.047.933.933,0,0,1-.947-1.607,3.929,3.929,0,0,1,4.153.088l.185.12a.933.933,0,0,1-.508,1.716Z" transform="translate(-69.235 -173.283)"/><path class="h" d="M27.751,85.141l2.88,2.644,3.811-.874-1.624,3.556,2.008,3.354-3.884-.446-2.569,2.946L27.6,92.49,24,90.957l3.4-1.922Z" transform="translate(-24 -78.914)"/><path class="h" d="M82.174,227.375l-.959,3.772,2.564,2.928-3.884.254L77.9,237.673l-1.442-3.615-3.8-.862,2.993-2.488-.353-3.876,3.291,2.078Z" transform="translate(-66.992 -204.086)"/><path class="i" d="M300.471,141.9l-5.455-5.09,5.09-5.456a8.342,8.342,0,0,1,5.455,5.09Z" transform="translate(-263.422 -119.737)"/></svg>`;
|
|
706
|
+
|
|
707
|
+
const sallaLoyaltyCss = "#salla-loyalty-modal .s-swiper-button-prev button,#salla-loyalty-modal .s-swiper-button-next button{box-shadow:#32325d40 0px 6px 12px -2px, #0000004d 0px 3px 7px -3px}";
|
|
699
708
|
|
|
700
709
|
const SallaLoyalty = class {
|
|
701
710
|
constructor(hostRef) {
|
|
@@ -704,6 +713,35 @@ const SallaLoyalty = class {
|
|
|
704
713
|
this.buttonLoading = false;
|
|
705
714
|
this.selectedItem = undefined;
|
|
706
715
|
this.askConfirmation = false;
|
|
716
|
+
this.is_loggedin = false;
|
|
717
|
+
/**
|
|
718
|
+
* The exchanged prize point
|
|
719
|
+
*/
|
|
720
|
+
this.prizePoints = undefined;
|
|
721
|
+
/**
|
|
722
|
+
* Available customer points with which they can exchange.
|
|
723
|
+
*/
|
|
724
|
+
this.customerPoints = undefined;
|
|
725
|
+
/**
|
|
726
|
+
* The exchangable prize title
|
|
727
|
+
*/
|
|
728
|
+
this.prizeTitle = undefined;
|
|
729
|
+
/**
|
|
730
|
+
* Does the merchant allow to login using email
|
|
731
|
+
*/
|
|
732
|
+
this.allowEmail = true;
|
|
733
|
+
/**
|
|
734
|
+
* Does the merchant/current location for visitor allow to login using mobile, By default outside KSA is `false`
|
|
735
|
+
*/
|
|
736
|
+
this.allowMobile = true;
|
|
737
|
+
/**
|
|
738
|
+
* Does the merchant require registration with email & mobile
|
|
739
|
+
*/
|
|
740
|
+
this.requireEmail = false;
|
|
741
|
+
salla.event.on('loyalty::open', () => this.open());
|
|
742
|
+
salla.auth.event.onLoggedIn(() => {
|
|
743
|
+
this.is_loggedin = true;
|
|
744
|
+
});
|
|
707
745
|
salla.lang.onLoaded(() => {
|
|
708
746
|
this.points = salla.lang.get('pages.loyalty_program.point');
|
|
709
747
|
this.exchange_points = salla.lang.get('pages.loyalty_program.exchange_points');
|
|
@@ -711,8 +749,12 @@ const SallaLoyalty = class {
|
|
|
711
749
|
this.for = salla.lang.get('pages.loyalty_program.for');
|
|
712
750
|
this.confirm = salla.lang.get('pages.loyalty_program.confirm');
|
|
713
751
|
this.cancel = salla.lang.get('pages.loyalty_program.cancellation');
|
|
714
|
-
this.
|
|
715
|
-
this.
|
|
752
|
+
this.cart_total_point_summary = salla.lang.get('pages.loyalty_program.cart_total_point_summary', { "balance": this.customerPoints });
|
|
753
|
+
this.cart_point_exchange_now = salla.lang.get('pages.loyalty_program.cart_point_exchange_now');
|
|
754
|
+
this.login_button = salla.lang.get('blocks.header.login');
|
|
755
|
+
if (!this.guestMessage) {
|
|
756
|
+
this.guestMessage = salla.lang.get('pages.loyalty_program.guest_message');
|
|
757
|
+
}
|
|
716
758
|
});
|
|
717
759
|
}
|
|
718
760
|
setSelectedPrizeItem(item) {
|
|
@@ -723,24 +765,39 @@ const SallaLoyalty = class {
|
|
|
723
765
|
this.selectedItem = undefined;
|
|
724
766
|
}
|
|
725
767
|
}
|
|
768
|
+
handleLongText(text) {
|
|
769
|
+
if (text.length > 150) {
|
|
770
|
+
return text.substring(0, 150) + '...';
|
|
771
|
+
}
|
|
772
|
+
return text;
|
|
773
|
+
}
|
|
726
774
|
prizeItem(item) {
|
|
727
|
-
|
|
775
|
+
let klass = {
|
|
728
776
|
's-loyalty-prize-item-selected': !!this.selectedItem && this.selectedItem.id == item.id,
|
|
729
777
|
"s-loyalty-prize-item": true
|
|
730
778
|
};
|
|
731
|
-
return index$1.h("div", { onClick: () => this.setSelectedPrizeItem(item), class: klass }, index$1.h("
|
|
779
|
+
return index$1.h("div", { onClick: () => this.setSelectedPrizeItem(item), class: klass }, index$1.h("img", { class: "s-loyalty-prize-item-image", src: item.image, alt: item.name }), index$1.h("div", { class: "s-loyalty-prize-item-title" }, item.name), index$1.h("div", { class: "s-loyalty-prize-item-subtitle" }, this.handleLongText(item.description)), index$1.h("div", { class: "s-loyalty-prize-item-points" }, item.cost_points, " ", this.points, index$1.h("div", { class: "s-loyalty-prize-item-check" }, index$1.h("div", null))));
|
|
732
780
|
}
|
|
733
781
|
getConfirmationModal() {
|
|
734
782
|
var _a, _b;
|
|
735
|
-
return
|
|
783
|
+
return [
|
|
784
|
+
index$1.h("salla-placeholder", { alignment: "center", icon: Star3, class: "s-loyalty-confirmation-modal-content" }, index$1.h("div", { slot: "title", class: "s-loyalty-confirmation-title" }, this.exchange_points), index$1.h("div", { slot: "description" }, this.are_you_sure_to_exchange, " ( ", index$1.h("strong", null, (_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.cost_points), " ) ", this.for, " ( ", index$1.h("strong", null, (_b = this.selectedItem) === null || _b === void 0 ? void 0 : _b.name), " )")),
|
|
785
|
+
index$1.h("div", { class: "s-loyalty-confirmation-actions" }, index$1.h("salla-button", { fill: 'outline', width: "wide", onClick: () => this.cancelProcess() }, this.cancel), index$1.h("salla-button", { loading: this.buttonLoading, width: "wide", onClick: () => this.exchangeLoyaltyPoint() }, this.confirm))
|
|
786
|
+
];
|
|
787
|
+
}
|
|
788
|
+
getAfterExchangeUI() {
|
|
789
|
+
return index$1.h("slot", { name: 'points-applied-widget' }, index$1.h("salla-list-tile", { class: "s-loyalty-after-exchange" }, index$1.h("div", { slot: "title", class: "s-loyalty-after-exchange-title" }, this.prizeTitle, " \u00A0 - \u00A0 ", this.prizePoints), index$1.h("div", { slot: 'action', class: "s-loyalty-after-exchange-action" }, index$1.h("salla-button", { class: "s-loyalty-after-exchange-reset", shape: "icon", fill: 'outline', color: "danger", size: "small", onClick: () => this.resetExchange() }, index$1.h("span", { innerHTML: CancelIcon })))));
|
|
736
790
|
}
|
|
737
791
|
/**
|
|
738
792
|
* Show loyalty modal
|
|
739
793
|
*/
|
|
740
794
|
async open() {
|
|
795
|
+
if (!this.is_loggedin)
|
|
796
|
+
return salla.event.dispatch('login::open');
|
|
741
797
|
this.modal.open();
|
|
742
798
|
return await salla.loyalty.getProgram()
|
|
743
799
|
.then((response) => {
|
|
800
|
+
console.log("🚀 ~ file: salla-loyalty.tsx ~ line 167 ~ SallaLoyalty ~ .then ~ response", response);
|
|
744
801
|
this.loyaltyProgram = response.data;
|
|
745
802
|
})
|
|
746
803
|
.catch(e => console.log(e))
|
|
@@ -755,6 +812,17 @@ const SallaLoyalty = class {
|
|
|
755
812
|
async close() {
|
|
756
813
|
return this.modal.close();
|
|
757
814
|
}
|
|
815
|
+
/**
|
|
816
|
+
*
|
|
817
|
+
* Cancel Exchanged prizes
|
|
818
|
+
*/
|
|
819
|
+
async resetExchange() {
|
|
820
|
+
return await salla.loyalty.reset()
|
|
821
|
+
.then(() => {
|
|
822
|
+
this.prizePoints = undefined;
|
|
823
|
+
this.prizeTitle = undefined;
|
|
824
|
+
}).catch(e => console.log(e));
|
|
825
|
+
}
|
|
758
826
|
/**
|
|
759
827
|
* Open Confirmation modal
|
|
760
828
|
*/
|
|
@@ -767,7 +835,7 @@ const SallaLoyalty = class {
|
|
|
767
835
|
* Cancel process
|
|
768
836
|
*/
|
|
769
837
|
async cancelProcess() {
|
|
770
|
-
await this.confirmationModal.close()
|
|
838
|
+
return await this.confirmationModal.close()
|
|
771
839
|
.then(() => this.selectedItem = null)
|
|
772
840
|
.catch(e => console.log(e));
|
|
773
841
|
}
|
|
@@ -783,17 +851,32 @@ const SallaLoyalty = class {
|
|
|
783
851
|
this.loyaltyProgram = response.data;
|
|
784
852
|
})
|
|
785
853
|
.catch(e => console.log(e))
|
|
786
|
-
.finally(() =>
|
|
854
|
+
.finally(() => {
|
|
855
|
+
this.buttonLoading = false;
|
|
856
|
+
this.cancelProcess();
|
|
857
|
+
});
|
|
787
858
|
}
|
|
788
859
|
render() {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
860
|
+
// A. when the exchange is done, and we have the final prize points to show it in cart page
|
|
861
|
+
if (this.prizePoints) {
|
|
862
|
+
return this.getAfterExchangeUI();
|
|
863
|
+
}
|
|
864
|
+
return [
|
|
865
|
+
index$1.h("slot", { name: 'widget' }, this.customerPoints ?
|
|
866
|
+
index$1.h("salla-list-tile", { class: 's-loyalty-widget' }, index$1.h("div", { slot: "icon", class: "s-loyalty-widget-icon", innerHTML: Star2 }), index$1.h("div", { slot: "subtitle" }, this.is_loggedin ? this.cart_total_point_summary : this.guestMessage, index$1.h("salla-button", { shape: "link", color: "primary", onClick: () => salla.event.dispatch("loyalty::open") }, this.is_loggedin ? this.cart_point_exchange_now : this.login_button))) :
|
|
867
|
+
''),
|
|
868
|
+
index$1.h("salla-modal", { id: "salla-loyalty-confirmation-modal", noPadding: true, position: 'top', width: "sm", ref: modal => this.confirmationModal = modal }, this.getConfirmationModal()),
|
|
869
|
+
index$1.h("salla-modal", { isLoading: true, id: "salla-loyalty-modal", width: "md", ref: modal => this.modal = modal }, !!this.loyaltyProgram ?
|
|
870
|
+
[
|
|
871
|
+
index$1.h("salla-list-tile", { id: 's-loyalty-header', class: "s-loyalty-header" }, index$1.h("div", { slot: "icon", class: "s-loyalty-header-icon", innerHTML: GiftImg }), index$1.h("div", { slot: "title", class: "s-loyalty-header-title" }, this.loyaltyProgram.prize_promotion_title), index$1.h("div", { slot: "subtitle", class: "s-loyalty-header-subtitle" }, this.loyaltyProgram.prize_promotion_description)),
|
|
872
|
+
index$1.h("salla-tabs", null, this.loyaltyProgram.prizes.map((prize) => index$1.h("salla-tab-header", { slot: "header", name: prize.title }, index$1.h("span", null, prize.title))), this.loyaltyProgram.prizes.map((prize) => index$1.h("salla-tab-content", { slot: "content", name: prize.title }, index$1.h("salla-swiper", { "space-between-items": "20" }, prize.items.map((item) => this.prizeItem(item)))))),
|
|
873
|
+
index$1.h("salla-button", { disabled: !this.selectedItem, width: "wide", class: "s-loyalty-program-redeem-btn", onClick: () => this.openConfirmation() }, this.exchange_points)
|
|
874
|
+
]
|
|
875
|
+
: index$1.h("salla-placeholder", { class: "s-loyalty-placeholder", alignment: "center" })),
|
|
876
|
+
];
|
|
877
|
+
}
|
|
878
|
+
componentDidLoad() {
|
|
879
|
+
this.is_loggedin = salla.config.isUser();
|
|
797
880
|
}
|
|
798
881
|
};
|
|
799
882
|
SallaLoyalty.style = sallaLoyaltyCss;
|
|
@@ -916,13 +999,16 @@ const SallaModal = class {
|
|
|
916
999
|
'sicon-check-circle2': !this.icon && this.iconStyle == 'success' && !this.imageIcon,
|
|
917
1000
|
};
|
|
918
1001
|
}
|
|
1002
|
+
getWidth() {
|
|
1003
|
+
return this.isLoading ? 'sm' : this.width;
|
|
1004
|
+
}
|
|
919
1005
|
//todo:: pref for each modal
|
|
920
1006
|
render() {
|
|
921
1007
|
this.host.id = this.host.id || 'salla-modal';
|
|
922
1008
|
if (this.isLoading) {
|
|
923
|
-
return (index$1.h(index$1.Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, index$1.h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), index$1.h("div", { class: "s-modal-wrapper" }, index$1.h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), index$1.h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.
|
|
1009
|
+
return (index$1.h(index$1.Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, index$1.h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), index$1.h("div", { class: "s-modal-wrapper" }, index$1.h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), index$1.h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, index$1.h("salla-loading", null), index$1.h("div", { class: "s-hidden" }, index$1.h("slot", null))))));
|
|
924
1010
|
}
|
|
925
|
-
return (index$1.h(index$1.Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, index$1.h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), index$1.h("div", { class: "s-modal-wrapper" }, index$1.h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), index$1.h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.
|
|
1011
|
+
return (index$1.h(index$1.Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, index$1.h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), index$1.h("div", { class: "s-modal-wrapper" }, index$1.h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), index$1.h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, index$1.h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.icon != '' || this.imageIcon != '' } }, this.isClosable ?
|
|
926
1012
|
index$1.h("button", { class: "s-modal-close", onClick: () => this.closeModal(), type: "button" }, index$1.h("span", { class: "sicon-cancel" }))
|
|
927
1013
|
: '', this.modalTitle || this.subTitle ?
|
|
928
1014
|
index$1.h("div", { class: "s-modal-header-inner" }, this.iconStyle || this.icon
|
|
@@ -1098,6 +1184,10 @@ const SallaPlaceholder = class {
|
|
|
1098
1184
|
* The size of the icon. Defaults to [`md`]
|
|
1099
1185
|
*/
|
|
1100
1186
|
this.iconSize = 'md';
|
|
1187
|
+
salla.lang.onLoaded(() => {
|
|
1188
|
+
this.default_title = salla.lang.get('common.elements.no_options');
|
|
1189
|
+
this.default_description = salla.lang.get('common.errors.empty_results');
|
|
1190
|
+
});
|
|
1101
1191
|
}
|
|
1102
1192
|
alignmentClass() {
|
|
1103
1193
|
return {
|
|
@@ -1108,7 +1198,7 @@ const SallaPlaceholder = class {
|
|
|
1108
1198
|
};
|
|
1109
1199
|
}
|
|
1110
1200
|
render() {
|
|
1111
|
-
return (index$1.h("div", { class: this.alignmentClass() }, index$1.h("div", { class: `s-placeholder-icon s-placeholder-icon-${this.iconSize}`, innerHTML: this.icon }), index$1.h("div", { class: "s-placeholder-title" }, index$1.h("slot", { name: 'title' })), index$1.h("div", { class: "s-placeholder-description" }, index$1.h("slot", { name: 'description' }))));
|
|
1201
|
+
return (index$1.h("div", { class: this.alignmentClass() }, index$1.h("div", { class: `s-placeholder-icon s-placeholder-icon-${this.iconSize}`, innerHTML: this.icon }), index$1.h("div", { class: "s-placeholder-title" }, index$1.h("slot", { name: 'title' }, index$1.h("span", null, this.default_title))), index$1.h("div", { class: "s-placeholder-description" }, index$1.h("slot", { name: 'description' }, index$1.h("span", null, this.default_description)))));
|
|
1112
1202
|
}
|
|
1113
1203
|
};
|
|
1114
1204
|
SallaPlaceholder.style = sallaPlaceholderCss;
|
|
@@ -1518,16 +1608,17 @@ const SallaSearch = class {
|
|
|
1518
1608
|
this.height = 60;
|
|
1519
1609
|
Helper.Helper.setHost(this.host);
|
|
1520
1610
|
this.productSlot = ((_a = Helper.Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
|
|
1521
|
-
salla.event.on('search::open', () => this.
|
|
1611
|
+
salla.event.on('search::open', () => this.open());
|
|
1522
1612
|
salla.lang.onLoaded(() => {
|
|
1523
1613
|
this.placeholder = salla.lang.get('blocks.header.search_placeholder');
|
|
1524
1614
|
this.noResultsText = salla.lang.get('common.elements.no_options');
|
|
1525
1615
|
});
|
|
1526
|
-
salla.event.on('modalOpened', () => this.onModalOpen());
|
|
1527
1616
|
salla.event.on('modalClosed', () => this.onModalClose());
|
|
1528
1617
|
}
|
|
1529
|
-
|
|
1530
|
-
|
|
1618
|
+
async open() {
|
|
1619
|
+
if (!this.inline) {
|
|
1620
|
+
await this.modal.open().then(() => setTimeout(() => this.searchInput.focus(), 300));
|
|
1621
|
+
}
|
|
1531
1622
|
}
|
|
1532
1623
|
onModalClose() {
|
|
1533
1624
|
this.searchInput.value = '';
|
|
@@ -18,5 +18,5 @@ const patchBrowser = () => {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(options => {
|
|
21
|
-
return index.bootstrapLazy([["salla-branches_22.cjs",[[4,"salla-loyalty",{"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"points":[32],"exchange_points":[32],"are_you_sure_to_exchange":[32],"for":[32],"cancel":[32],"confirm":[32],"
|
|
21
|
+
return index.bootstrapLazy([["salla-branches_22.cjs",[[4,"salla-loyalty",{"prizePoints":[8,"prize-points"],"customerPoints":[2,"customer-points"],"prizeTitle":[1,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"points":[32],"exchange_points":[32],"are_you_sure_to_exchange":[32],"for":[32],"cancel":[32],"confirm":[32],"cart_total_point_summary":[32],"cart_point_exchange_now":[32],"login_button":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"open":[64],"close":[64]}],[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"add_to_cart":[32],"out_of_stock":[32],"open":[64],"showOffer":[64]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32],"typing":[32],"debounce":[32],"search_term":[32]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"emailErrorMsg":[32],"isVisitorSubscribed":[32]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-swiper",{"loop":[4],"speed":[2],"itemPerView":[8,"item-per-view"],"spaceBetweenItems":[2,"space-between-items"],"direction":[1],"currentIndex":[32],"isLastSlideItem":[32],"isFirstSlideItem":[32]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"default_title":[32],"default_description":[32]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"onSelect","onSelectedTab"]]],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"icon":[1],"iconStyle":[1,"icon-style"],"imageIcon":[1,"image-icon"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["salla-add-product-button.cjs",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"]}]]],["salla-conditional-fields.cjs",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-installment.cjs",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-quantity-input.cjs",[[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}]]]], options);
|
|
22
22
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="54.079" height="53.191" viewBox="0 0 54.079 53.191"><defs><style>.a{fill:#ee9d0d;}.b{fill:#c7830b;}.c{fill:#ea2b2d;}.d{fill:#cb2527;}.e{fill:#6699ce;}.f{fill:#faa6b2;}.g{fill:#a6deff;}.h{fill:#eeb436;}.i{fill:#f72d2f;}</style></defs><path class="a" d="M40,248H77.3v25.88a2.1,2.1,0,0,1-2.1,2.1H42.1a2.1,2.1,0,0,1-2.1-2.1Z" transform="translate(-38.135 -222.787)"/><path class="b" d="M250.632,248.711v12.755L236.2,248h13.67Z" transform="translate(-211.463 -222.787)"/><path class="b" d="M333.957,336v3.207L330.52,336Z" transform="translate(-294.787 -300.528)"/><path class="c" d="M226.194,32.048l-.5.185a5.035,5.035,0,0,0-3.072,3.292l-.468,1.585-.759.414a5.035,5.035,0,0,0-2.422,3l8.865,8.271,5.09-5.456.262-6.205a5.191,5.191,0,0,0-7-5.083Z" transform="translate(-196.246 -31.722)"/><path class="c" d="M358.628,175.48l-.15.509a5.034,5.034,0,0,1-3.072,3.292l-1.55.577-.359.785a5.034,5.034,0,0,1-2.822,2.624L341.81,175l5.09-5.455,6.172-.69a5.191,5.191,0,0,1,5.555,6.629Z" transform="translate(-304.761 -152.837)"/><path class="d" d="M168,248h7.461v27.978H168Z" transform="translate(-151.213 -222.787)"/><path class="c" d="M40,336H77.3v7.461H40Z" transform="translate(-38.135 -300.528)"/><path class="d" d="M333.957,336v3.207L330.52,336Z" transform="translate(-294.787 -300.528)"/><path class="a" d="M2.1,0H40.8a2.1,2.1,0,0,1,2.1,2.1V9.326H0V2.1A2.1,2.1,0,0,1,2.1,0Z" transform="matrix(0.731, 0.682, -0.682, 0.731, 18.641, 4.976)"/><path class="d" d="M0,0H9.326V9.326H0Z" transform="matrix(0.731, 0.682, -0.682, 0.731, 30.912, 16.424)"/><path class="d" d="M286.857,79.389a.931.931,0,0,1-.74-.365l-.615-.8a12.516,12.516,0,0,1-2.528-9,.933.933,0,0,1,1.855.2,10.66,10.66,0,0,0,2.153,7.667l.615.8a.933.933,0,0,1-.739,1.5Z" transform="translate(-252.718 -64.113)"/><path class="c" d="M185.485,178.151l-.039.014a30.78,30.78,0,0,1-12.034,1.906l-2.381-.1,4.092,3.817-1.181,4,3.728-1.206a30.775,30.775,0,0,0,9.833-5.315l.71-.572Z" transform="translate(-153.891 -161.081)"/><path class="d" d="M363.834,194.779a12.51,12.51,0,0,1-6.93-2.1l-.843-.559a.933.933,0,1,1,1.031-1.554l.842.558a10.659,10.659,0,0,0,7.8,1.618.933.933,0,1,1,.328,1.836A12.663,12.663,0,0,1,363.834,194.779Z" transform="translate(-316.982 -171.914)"/><path class="c" d="M275,202.524l-.012.04a30.776,30.776,0,0,0-1.069,12.137l.265,2.369-4.092-3.817-3.909,1.455.945-3.8a30.776,30.776,0,0,1,4.622-10.177l.521-.748Z" transform="translate(-237.949 -180.364)"/><circle class="e" cx="1.865" cy="1.865" r="1.865" transform="translate(10.259 0.032)"/><circle class="f" cx="1.865" cy="1.865" r="1.865" transform="translate(0 21.482)"/><path class="g" d="M36.663,36.663a.933.933,0,0,1-.885-.638l-.048-.143a2.946,2.946,0,0,0-2.8-2.017.933.933,0,1,1,0-1.865A4.808,4.808,0,0,1,37.5,35.292l.048.143a.933.933,0,0,1-.885,1.228Z" transform="translate(-31.067 -31.968)"/><path class="g" d="M79.493,194.438a.929.929,0,0,1-.506-.15l-.185-.12a2.074,2.074,0,0,0-2.192-.047.933.933,0,0,1-.947-1.607,3.929,3.929,0,0,1,4.153.088l.185.12a.933.933,0,0,1-.508,1.716Z" transform="translate(-69.235 -173.283)"/><path class="h" d="M27.751,85.141l2.88,2.644,3.811-.874-1.624,3.556,2.008,3.354-3.884-.446-2.569,2.946L27.6,92.49,24,90.957l3.4-1.922Z" transform="translate(-24 -78.914)"/><path class="h" d="M82.174,227.375l-.959,3.772,2.564,2.928-3.884.254L77.9,237.673l-1.442-3.615-3.8-.862,2.993-2.488-.353-3.876,3.291,2.078Z" transform="translate(-66.992 -204.086)"/><path class="i" d="M300.471,141.9l-5.455-5.09,5.09-5.456a8.342,8.342,0,0,1,5.455,5.09Z" transform="translate(-263.422 -119.737)"/></svg>
|