@salla.sa/twilight-components 1.5.12 → 1.5.13
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-add-product-button.cjs.entry.js +7 -1
- package/dist/cjs/salla-button_24.cjs.entry.js +81 -134
- package/dist/cjs/salla-scopes.cjs.entry.js +12 -17
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/assets/svg/star3.svg +1 -1
- package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +7 -1
- package/dist/collection/components/salla-localization-modal/salla-localization-modal.css +4 -0
- package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +5 -8
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +25 -41
- package/dist/collection/components/salla-loyalty/salla-loyalty.js +12 -31
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +6 -15
- package/dist/collection/components/salla-placeholder/salla-placeholder.js +5 -6
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +12 -26
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +13 -28
- package/dist/collection/components/salla-scopes/salla-scopes.js +14 -25
- package/dist/collection/components/salla-search/salla-search.js +5 -6
- package/dist/collection/components/salla-social-share/salla-social-share.js +12 -14
- package/dist/collection/components/salla-tabs/salla-tab-content.js +4 -4
- package/dist/collection/components/salla-tabs/salla-tab-header.js +3 -3
- package/dist/collection/components/salla-tabs/salla-tabs.js +3 -3
- package/dist/collection/components/salla-verify/salla-verify.js +4 -3
- package/dist/components/salla-add-product-button.js +7 -1
- package/dist/components/salla-localization-modal.js +6 -9
- package/dist/components/salla-login-modal.js +20 -36
- package/dist/components/salla-loyalty.js +9 -28
- package/dist/components/salla-offer-modal.js +6 -15
- package/dist/components/salla-placeholder2.js +4 -5
- package/dist/components/salla-product-availability2.js +12 -26
- package/dist/components/salla-rating-modal.js +7 -22
- package/dist/components/salla-scopes.js +13 -24
- package/dist/components/salla-search.js +5 -6
- package/dist/components/salla-social-share.js +12 -14
- package/dist/components/salla-tab-content2.js +2 -2
- package/dist/components/salla-tab-header2.js +1 -1
- package/dist/components/salla-tabs2.js +3 -3
- package/dist/components/salla-verify2.js +4 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-add-product-button.entry.js +7 -1
- package/dist/esm/salla-button_24.entry.js +81 -134
- package/dist/esm/salla-scopes.entry.js +12 -17
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/p-5fb32395.entry.js +4 -0
- package/dist/twilight-components/{p-b9fe5498.entry.js → p-76cb2574.entry.js} +1 -1
- package/dist/twilight-components/p-9e48ca27.entry.js +4 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-localization-modal/salla-localization-modal.d.ts +1 -2
- package/dist/types/components/salla-login-modal/salla-login-modal.d.ts +2 -10
- package/dist/types/components/salla-loyalty/salla-loyalty.d.ts +1 -9
- package/dist/types/components/salla-offer-modal/salla-offer-modal.d.ts +1 -4
- package/dist/types/components/salla-placeholder/salla-placeholder.d.ts +1 -2
- package/dist/types/components/salla-product-availability/salla-product-availability.d.ts +1 -8
- package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +1 -9
- package/dist/types/components/salla-scopes/salla-scopes.d.ts +1 -7
- package/dist/types/components/salla-search/salla-search.d.ts +1 -2
- package/dist/types/components/salla-tabs/interfaces.d.ts +1 -1
- package/dist/types/components/salla-tabs/salla-tab-content.d.ts +2 -2
- package/dist/types/components/salla-tabs/salla-tab-header.d.ts +1 -1
- package/dist/types/components/salla-verify/salla-verify.d.ts +1 -0
- package/dist/types/components.d.ts +2 -2
- package/package.json +5 -5
- package/dist/twilight-components/p-88f8666d.entry.js +0 -4
- package/dist/twilight-components/p-952f6c78.entry.js +0 -4
|
@@ -22,6 +22,7 @@ const sallaScopesCss = ".s-scopes-availability-content{display:flex;justify-cont
|
|
|
22
22
|
const SallaScopees = class {
|
|
23
23
|
constructor(hostRef) {
|
|
24
24
|
registerInstance(this, hostRef);
|
|
25
|
+
this.translationLoaded = false;
|
|
25
26
|
this.mode = ModeType.DEFAULT;
|
|
26
27
|
this.scopes = [];
|
|
27
28
|
this.originalScopesList = [];
|
|
@@ -39,20 +40,14 @@ const SallaScopees = class {
|
|
|
39
40
|
if (((_a = this.originalScopesList) === null || _a === void 0 ? void 0 : _a.length) < 2)
|
|
40
41
|
return "";
|
|
41
42
|
return this.mode === ModeType.DEFAULT ?
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
salla.lang.get("blocks.scope.shopping_from_another_branch") :
|
|
44
|
+
salla.lang.get('blocks.scope.search_for_availability_in_other_branches');
|
|
44
45
|
};
|
|
45
46
|
salla.event.on('scopes::open', ({ mode = null, product_id = null }) => {
|
|
46
47
|
this.open(mode, product_id);
|
|
47
48
|
});
|
|
48
49
|
salla.lang.onLoaded(() => {
|
|
49
|
-
this.
|
|
50
|
-
this.ourServiceIsNotFound = salla.lang.get("blocks.scope.our_services_not_available_in_this_branch");
|
|
51
|
-
this.searchForAvailabilityInOtherBranch = salla.lang.get('blocks.scope.search_for_availability_in_other_branches');
|
|
52
|
-
this.shoppingFromAnotherBranch = salla.lang.get("blocks.scope.shopping_from_another_branch");
|
|
53
|
-
this.nowBrowsingFrom = salla.lang.get('blocks.scope.you_are_browse_store_from');
|
|
54
|
-
this.confirmButton = salla.lang.get('common.elements.confirm');
|
|
55
|
-
this.scopeSearchPlaceholder = salla.lang.get('blocks.scope.searching_for_a_branch');
|
|
50
|
+
this.translationLoaded = true;
|
|
56
51
|
});
|
|
57
52
|
}
|
|
58
53
|
/**
|
|
@@ -101,10 +96,10 @@ const SallaScopees = class {
|
|
|
101
96
|
'type': this.current_scope.type,
|
|
102
97
|
'id': this.current_scope.id
|
|
103
98
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
window.location.
|
|
99
|
+
var url = new URL(window.location.href);
|
|
100
|
+
url.searchParams.set('scope', this.current_scope.id);
|
|
101
|
+
window.location.href = url.toString();
|
|
102
|
+
window.location.replace(url.toString());
|
|
108
103
|
}).catch(e => console.log(e))
|
|
109
104
|
.finally(() => {
|
|
110
105
|
this.changeBtn.stop();
|
|
@@ -135,7 +130,7 @@ const SallaScopees = class {
|
|
|
135
130
|
this.current_scope = this.scopes.find(scope => scope.id == event.target.value);
|
|
136
131
|
}
|
|
137
132
|
placeholderContent() {
|
|
138
|
-
return h("salla-placeholder", { alignment: "center", class: "s-scopes-placeholder" }, h("span", { slot: "title" },
|
|
133
|
+
return h("salla-placeholder", { alignment: "center", class: "s-scopes-placeholder" }, h("span", { slot: "title" }, salla.lang.get("blocks.scope.branch_looking_for_not_found")), h("span", { slot: "description" }, salla.lang.get("blocks.scope.our_services_not_available_in_this_branch")));
|
|
139
134
|
}
|
|
140
135
|
defaultContent() {
|
|
141
136
|
return [h("div", { class: "s-scopes-container s-scrollbar" }, this.scopes.map((scope) => h("div", { class: "s-scopes-input-wrap", "data-selection": this.selection }, h("input", { id: `${this.selection} + '_scope_' + ${scope.id}`, name: "lang", type: "radio", value: scope.id, onChange: (event) => this.handleScopeSelection(event), class: "s-scopes-input", checked: !!this.current_scope && this.current_scope.id == scope.id }), h("label", { htmlFor: `${this.selection} + '_scope_' + ${scope.id}`, class: "s-scopes-label s-scopes-clickable" }, h("span", null, scope.name))))), this.footerContent()];
|
|
@@ -147,11 +142,11 @@ const SallaScopees = class {
|
|
|
147
142
|
}));
|
|
148
143
|
}
|
|
149
144
|
footerContent() {
|
|
150
|
-
return h("div", { class: "s-scopes-footer" }, h("slot", { name: "footer" }, h("salla-button", { ref: btn => this.changeBtn = btn, disabled: !this.current_scope, onClick: () => this.handleSubmit(), class: "s-scopes-submit", "loader-position": "center", width: "wide" },
|
|
145
|
+
return h("div", { class: "s-scopes-footer" }, h("slot", { name: "footer" }, h("salla-button", { ref: btn => this.changeBtn = btn, disabled: !this.current_scope, onClick: () => this.handleSubmit(), class: "s-scopes-submit", "loader-position": "center", width: "wide" }, salla.lang.get('common.elements.confirm'))));
|
|
151
146
|
}
|
|
152
147
|
render() {
|
|
153
|
-
return (h(Host, null, h("salla-modal", { ref: modal => this.modal = modal, isClosable: !!(this.isOpenedBefore || (this.selection == 'optional')), class: "s-scopes-modal", isLoading: true, "has-skeleton": true }, h("div", { slot: "loading" }, h("div", { class: "s-scopes-skeleton" }, h("salla-list-tile", { class: "s-scopes-header" }, h("div", { slot: "icon", class: "s-scopes-header-icon" }, h("salla-skeleton", { type: "circle" })), h("div", { slot: "title", class: "s-scopes-header-title mb-5" }, h("salla-skeleton", { height: '15px', width: '50%' })), h("div", { slot: "subtitle", class: "s-scopes-header-subtitle" }, h("salla-skeleton", { height: '10px' }), h("salla-skeleton", { height: '10px', width: '75%' }))), h("div", { class: "s-scopes-skeleton-search" }, h("salla-skeleton", { height: '10px', width: '50%' }), h("salla-skeleton", { height: '30px', width: '100%' })), h("div", { class: "s-scopes-skeleton-scopes" }, h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' })), h("div", { class: "s-scopes-skeleton-btn" }, h("salla-skeleton", { height: '40px', width: '100%' })))), h("salla-list-tile", { class: this.originalScopesList.length ? "s-scopes-header block" : "s-hidden" }, h("div", { slot: "icon", class: "s-scopes-header-icon", innerHTML: StoreAlt }), h("div", { slot: "title", class: "s-scopes-header-title" },
|
|
154
|
-
h("div", { class: "s-scopes-search-wrapper" }, h("div", { class: "s-scopes-search-icon", innerHTML: Search }), h("input", { type: "text", class: "s-scopes-search-input", onInput: e => this.handleSearchFieldTyping(e), placeholder:
|
|
148
|
+
return (h(Host, null, h("salla-modal", { ref: modal => this.modal = modal, isClosable: !!(this.isOpenedBefore || (this.selection == 'optional')), class: "s-scopes-modal", isLoading: true, "has-skeleton": true }, h("div", { slot: "loading" }, h("div", { class: "s-scopes-skeleton" }, h("salla-list-tile", { class: "s-scopes-header" }, h("div", { slot: "icon", class: "s-scopes-header-icon" }, h("salla-skeleton", { type: "circle" })), h("div", { slot: "title", class: "s-scopes-header-title mb-5" }, h("salla-skeleton", { height: '15px', width: '50%' })), h("div", { slot: "subtitle", class: "s-scopes-header-subtitle" }, h("salla-skeleton", { height: '10px' }), h("salla-skeleton", { height: '10px', width: '75%' }))), h("div", { class: "s-scopes-skeleton-search" }, h("salla-skeleton", { height: '10px', width: '50%' }), h("salla-skeleton", { height: '30px', width: '100%' })), h("div", { class: "s-scopes-skeleton-scopes" }, h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '30%' }), h("salla-skeleton", { height: '10px', width: '25%' })), h("div", { class: "s-scopes-skeleton-btn" }, h("salla-skeleton", { height: '40px', width: '100%' })))), h("salla-list-tile", { class: this.originalScopesList.length ? "s-scopes-header block" : "s-hidden" }, h("div", { slot: "icon", class: "s-scopes-header-icon", innerHTML: StoreAlt }), h("div", { slot: "title", class: "s-scopes-header-title" }, salla.lang.get('blocks.scope.you_are_browse_store_from')), h("div", { slot: "subtitle", class: "s-scopes-header-subtitle" }, !!this.selected_scope ? this.selected_scope.name : "")), h("div", { class: "s-scopes-wrap" }, !!this.originalScopesList.length && h("h4", { class: "s-scopes-title" }, this.getFormTitle()), this.originalScopesList.length > this.searchDisplayLimit ?
|
|
149
|
+
h("div", { class: "s-scopes-search-wrapper" }, h("div", { class: "s-scopes-search-icon", innerHTML: Search }), h("input", { type: "text", class: "s-scopes-search-input", onInput: e => this.handleSearchFieldTyping(e), placeholder: salla.lang.get('blocks.scope.searching_for_a_branch') }))
|
|
155
150
|
: "", this.scopes.length < 2 ?
|
|
156
151
|
this.placeholderContent()
|
|
157
152
|
: this.mode === ModeType.DEFAULT ? this.defaultContent() : this.availabilityContent()))));
|
|
@@ -16,5 +16,5 @@ const patchBrowser = () => {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
patchBrowser().then(options => {
|
|
19
|
-
return bootstrapLazy([["salla-button_24",[[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],"
|
|
19
|
+
return bootstrapLazy([["salla-button_24",[[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],"translationLoaded":[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"],"translationLoaded":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"translationLoaded":[32],"open":[64],"showOffer":[64]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]}],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[16],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"open":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"translationLoaded":[32],"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"],"currentIndex":[32],"isLastSlideItem":[32],"isFirstSlideItem":[32]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[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,"tabSelected","onSelectedTab"]]],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[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]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[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]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["salla-scopes",[[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"close":[64],"open":[64],"handleSubmit":[64]}]]],["salla-add-product-button",[[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",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-installment",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]]], options);
|
|
20
20
|
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as s,h as e,H as l}from"./p-1503d976.js";import{S as t}from"./p-475ef754.js";var i;!function(s){s.DEFAULT="default",s.AVAILABILITY="availability"}(i||(i={}));const a=class{constructor(e){s(this,e),this.translationLoaded=!1,this.mode=i.DEFAULT,this.scopes=[],this.originalScopesList=[],this.isOpenedBefore=salla.storage.get("branch-choosed-before"),this.selection="optional",this.searchDisplayLimit=6,this.getFormTitle=()=>{var s;return(null===(s=this.originalScopesList)||void 0===s?void 0:s.length)<2?"":this.mode===i.DEFAULT?salla.lang.get("blocks.scope.shopping_from_another_branch"):salla.lang.get("blocks.scope.search_for_availability_in_other_branches")},salla.event.on("scopes::open",(({mode:s=null,product_id:e=null})=>{this.open(s,e)})),salla.lang.onLoaded((()=>{this.translationLoaded=!0}))}async close(){var s;return await(null===(s=this.modal)||void 0===s?void 0:s.close())}async open(s=i.DEFAULT,e=null){return this.setScopeValues([]),this.mode=void 0!==s&&[i.AVAILABILITY,i.DEFAULT].includes(s)?s:i.DEFAULT,this.modal.loading(),this.modal.open(),await(s==i.AVAILABILITY?salla.scope.getProductAvailability(e):salla.scope.get()).then((e=>{this.setScopeValues(s==i.AVAILABILITY?e.data:e.data.scopes)})).catch((s=>console.log(s))).finally((()=>{this.modal.stopLoading()}))}async handleSubmit(){let s={id:this.current_scope.id};return this.changeBtn.load(),await salla.scope.change(s).then((()=>{salla.storage.set("branch-choosed-before",!0),salla.storage.set("scope",{type:this.current_scope.type,id:this.current_scope.id});var s=new URL(window.location.href);s.searchParams.set("scope",this.current_scope.id),window.location.href=s.toString(),window.location.replace(s.toString())})).catch((s=>console.log(s))).finally((()=>{this.changeBtn.stop()}))}setScopeValues(s){this.scopes=s,this.originalScopesList=s,1==s.length?(this.current_scope=s[0],this.selected_scope=s[0]):(this.current_scope=s.find((s=>s.selected)),this.selected_scope=s.find((s=>s.selected)))}handleSearchFieldTyping(s){let e=s.target.value.toLocaleLowerCase();this.scopes=e?this.originalScopesList.filter((s=>s.name.toLowerCase().includes(e))):this.originalScopesList}handleScopeSelection(s){this.current_scope=this.scopes.find((e=>e.id==s.target.value))}placeholderContent(){return e("salla-placeholder",{alignment:"center",class:"s-scopes-placeholder"},e("span",{slot:"title"},salla.lang.get("blocks.scope.branch_looking_for_not_found")),e("span",{slot:"description"},salla.lang.get("blocks.scope.our_services_not_available_in_this_branch")))}defaultContent(){return[e("div",{class:"s-scopes-container s-scrollbar"},this.scopes.map((s=>e("div",{class:"s-scopes-input-wrap","data-selection":this.selection},e("input",{id:`${this.selection} + '_scope_' + ${s.id}`,name:"lang",type:"radio",value:s.id,onChange:s=>this.handleScopeSelection(s),class:"s-scopes-input",checked:!!this.current_scope&&this.current_scope.id==s.id}),e("label",{htmlFor:`${this.selection} + '_scope_' + ${s.id}`,class:"s-scopes-label s-scopes-clickable"},e("span",null,s.name)))))),this.footerContent()]}availabilityContent(){return e("div",{class:"s-scopes-container"},this.scopes.map((s=>{var l,t,a,o,h,c;return e("div",{class:"s-scopes-input-wrap","data-selection":this.selection},e("h2",{class:{"s-scopes-label":!0,"s-scopes-clickable":this.mode===i.DEFAULT}},e("span",null,s.name)),e("h2",{style:{color:null===(t=null===(l=s)||void 0===l?void 0:l.availability)||void 0===t?void 0:t.color},class:`s-scopes-${null===(o=null===(a=s)||void 0===a?void 0:a.availability)||void 0===o?void 0:o.key}`},null===(c=null===(h=s)||void 0===h?void 0:h.availability)||void 0===c?void 0:c.label))})))}footerContent(){return e("div",{class:"s-scopes-footer"},e("slot",{name:"footer"},e("salla-button",{ref:s=>this.changeBtn=s,disabled:!this.current_scope,onClick:()=>this.handleSubmit(),class:"s-scopes-submit","loader-position":"center",width:"wide"},salla.lang.get("common.elements.confirm"))))}render(){return e(l,null,e("salla-modal",{ref:s=>this.modal=s,isClosable:!(!this.isOpenedBefore&&"optional"!=this.selection),class:"s-scopes-modal",isLoading:!0,"has-skeleton":!0},e("div",{slot:"loading"},e("div",{class:"s-scopes-skeleton"},e("salla-list-tile",{class:"s-scopes-header"},e("div",{slot:"icon",class:"s-scopes-header-icon"},e("salla-skeleton",{type:"circle"})),e("div",{slot:"title",class:"s-scopes-header-title mb-5"},e("salla-skeleton",{height:"15px",width:"50%"})),e("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},e("salla-skeleton",{height:"10px"}),e("salla-skeleton",{height:"10px",width:"75%"}))),e("div",{class:"s-scopes-skeleton-search"},e("salla-skeleton",{height:"10px",width:"50%"}),e("salla-skeleton",{height:"30px",width:"100%"})),e("div",{class:"s-scopes-skeleton-scopes"},e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"}),e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"}),e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"}),e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"})),e("div",{class:"s-scopes-skeleton-btn"},e("salla-skeleton",{height:"40px",width:"100%"})))),e("salla-list-tile",{class:this.originalScopesList.length?"s-scopes-header block":"s-hidden"},e("div",{slot:"icon",class:"s-scopes-header-icon",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>store-alt</title>\n<path d="M6.667 24h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333zM31.86 10.071l-4-8c-0.227-0.452-0.688-0.737-1.193-0.737h-21.333c-0.505 0-0.967 0.285-1.193 0.737l-4 8c-0.092 0.184-0.14 0.389-0.14 0.596v18.667c0 0.737 0.597 1.333 1.333 1.333h29.333c0.736 0 1.333-0.596 1.333-1.333v-18.667c0-0.207-0.048-0.412-0.14-0.596zM6.157 4h19.685l3.333 6.667h-26.352zM24 28h-5.333v-9.333h5.333zM29.333 28h-2.667v-10.667c0-0.737-0.597-1.333-1.333-1.333h-8c-0.736 0-1.333 0.596-1.333 1.333v10.667h-13.333v-14.667h26.667zM6.667 18.667h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n'}),e("div",{slot:"title",class:"s-scopes-header-title"},salla.lang.get("blocks.scope.you_are_browse_store_from")),e("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},this.selected_scope?this.selected_scope.name:"")),e("div",{class:"s-scopes-wrap"},!!this.originalScopesList.length&&e("h4",{class:"s-scopes-title"},this.getFormTitle()),this.originalScopesList.length>this.searchDisplayLimit?e("div",{class:"s-scopes-search-wrapper"},e("div",{class:"s-scopes-search-icon",innerHTML:t}),e("input",{type:"text",class:"s-scopes-search-input",onInput:s=>this.handleSearchFieldTyping(s),placeholder:salla.lang.get("blocks.scope.searching_for_a_branch")})):"",this.scopes.length<2?this.placeholderContent():this.mode===i.DEFAULT?this.defaultContent():this.availabilityContent())))}componentDidLoad(){this.isOpenedBefore||"mandatory"!=this.selection||this.open()}};a.style=".s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-placeholder{flex:0 0 85%}";export{a as salla_scopes}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as t,c as s,h as i,H as a,g as l}from"./p-1503d976.js";const o=class{constructor(i){t(this,i),this.success=s(this,"success",7),this.failed=s(this,"failed",7),this.hostAttributes={},this.hasLabel=!1,this.channels=null,this.quantity=0,this.donatingAmount=0,this.productStatus="sale",this.productType="product"}getLabel(){return"sale"===this.productStatus?salla.lang.get("pages.cart.add_to_cart"):"donating"!==this.productType?salla.lang.get("pages.products.out_of_stock"):salla.lang.get("pages.products.donation_exceed")}addProductToCart(t){if("submit"===this.hostAttributes.type)return!1;t.preventDefault();const s=Object.entries({id:this.productId,donating_amount:this.donatingAmount,quantity:this.quantity}).reduce(((t,[s,i])=>i?(t[s]=i,t):t),{});return salla.cart.quickAdd(s).then((t=>this.success.emit(t))).catch((t=>this.failed.emit(t)))}getBtnAttributes(){for(let t=0;t<this.host.attributes.length;t++)["id","class"].includes(this.host.attributes[t].name)||(this.hostAttributes[this.host.attributes[t].name]=this.host.attributes[t].value);return this.hostAttributes}componentWillLoad(){this.hasLabel=!!this.host.innerHTML.replace("\x3c!----\x3e","").trim()}render(){return i(a,null,"out-and-notify"===this.productStatus&&this.channels?i("salla-product-availability",Object.assign({},this.getBtnAttributes()),i("slot",null)):i("salla-button",Object.assign({ref:t=>this.btn=t,onClick:t=>this.addProductToCart(t),type:"button",fill:"sale"===this.productStatus?"solid":"outline",color:"sale"===this.productStatus?"primary":"light","loader-position":"center"},this.getBtnAttributes(),{disabled:"sale"!==this.productStatus}),i("slot",null)))}componentDidRender(){this.hasLabel||
|
|
4
|
+
import{r as t,c as s,h as i,H as a,g as l}from"./p-1503d976.js";const o=class{constructor(i){t(this,i),this.success=s(this,"success",7),this.failed=s(this,"failed",7),this.hostAttributes={},this.hasLabel=!1,this.channels=null,this.quantity=0,this.donatingAmount=0,this.productStatus="sale",this.productType="product"}getLabel(){return"sale"===this.productStatus?salla.lang.get("pages.cart.add_to_cart"):"donating"!==this.productType?salla.lang.get("pages.products.out_of_stock"):salla.lang.get("pages.products.donation_exceed")}addProductToCart(t){if("submit"===this.hostAttributes.type)return!1;t.preventDefault();const s=Object.entries({id:this.productId,donating_amount:this.donatingAmount,quantity:this.quantity}).reduce(((t,[s,i])=>i?(t[s]=i,t):t),{});return salla.cart.quickAdd(s).then((t=>this.success.emit(t))).catch((t=>this.failed.emit(t)))}getBtnAttributes(){for(let t=0;t<this.host.attributes.length;t++)["id","class"].includes(this.host.attributes[t].name)||(this.hostAttributes[this.host.attributes[t].name]=this.host.attributes[t].value);return this.hostAttributes}componentWillLoad(){this.hasLabel=!!this.host.innerHTML.replace("\x3c!----\x3e","").trim()}render(){return i(a,null,"out-and-notify"===this.productStatus&&this.channels?i("salla-product-availability",Object.assign({},this.getBtnAttributes()),i("slot",null)):i("salla-button",Object.assign({ref:t=>this.btn=t,onClick:t=>this.addProductToCart(t),type:"button",fill:"sale"===this.productStatus?"solid":"outline",color:"sale"===this.productStatus?"primary":"light","loader-position":"center"},this.getBtnAttributes(),{disabled:"sale"!==this.productStatus}),i("slot",null)))}componentDidRender(){this.hasLabel||(this.btn.setText(this.getLabel()||"اضافة للسلة"),salla.lang.onLoaded((()=>{this.btn.setText(this.getLabel()||"اضافة للسلة")})))}get host(){return l(this)}};o.style=":host{display:block}salla-add-product-button[width=wide]{width:100%}";export{o as salla_add_product_button}
|