@salla.sa/twilight-components 1.3.1 → 1.4.1
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/README.md +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{salla-branches_23.cjs.entry.js → salla-button_23.cjs.entry.js} +134 -89
- package/dist/cjs/twilight-components.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/salla-scopes/interfaces.js +8 -0
- package/dist/collection/components/salla-scopes/salla-scopes.css +13 -0
- package/dist/collection/components/salla-scopes/salla-scopes.js +256 -0
- package/dist/collection/plugins/tailwind-theme/generator.js +1 -0
- package/dist/collection/plugins/tailwind-theme/index.js +27 -11
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{salla-branches.d.ts → salla-scopes.d.ts} +4 -4
- package/dist/components/salla-scopes.js +206 -0
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{salla-branches_23.entry.js → salla-button_23.entry.js} +135 -90
- package/dist/esm/twilight-components.js +2 -2
- package/dist/twilight-components/p-f14b508a.entry.js +4 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-scopes/interfaces.d.ts +19 -0
- package/dist/types/components/salla-scopes/salla-scopes.d.ts +39 -0
- package/dist/types/components.d.ts +26 -25
- package/example/assets/tailwind.css +288 -113
- package/example/index.html +4 -4
- package/package.json +2 -2
- package/dist/collection/components/salla-branches/salla-branches.css +0 -4
- package/dist/collection/components/salla-branches/salla-branches.js +0 -239
- package/dist/components/salla-branches.js +0 -141
- package/dist/twilight-components/p-9a8c8e0a.entry.js +0 -4
- package/dist/types/components/salla-branches/salla-branches.d.ts +0 -24
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ Every web component comes with a list of **properties and events** that make tha
|
|
|
63
63
|
|
|
64
64
|
| Component | Code Tag | Description |
|
|
65
65
|
| --------------------------------------------------------------------------------- | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
-
| [Branches](https://salla.stoplight.io/docs/twilight-themes-documentation/70422e4259f02-branches) | `salla-
|
|
66
|
+
| [Branches](https://salla.stoplight.io/docs/twilight-themes-documentation/70422e4259f02-branches) | `salla-scopes` | Header component that redirects merchants to a specific branch owned by the store. |
|
|
67
67
|
| [Button](https://salla.stoplight.io/docs/twilight-themes-documentation/f973f4bbc269b-button) | `salla-button` | Customizable Button component. |
|
|
68
68
|
| [Infinite Scroll](https://salla.stoplight.io/docs/twilight-themes-documentation/ede37d6e84859-infinite-scroll) | `salla-infinite-scroll` | Items that can be scrolled infinitely. |
|
|
69
69
|
| [Localization](https://salla.stoplight.io/docs/twilight-themes-documentation/559cc67721f74-localization) | `salla-localization-modal` | Modal dialoug which merchants can select languages/currencies from. |
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
8
8
|
const index = require('./index-0d0167d5.js');
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
|
-
Stencil Client Patch Esm v2.17.
|
|
11
|
+
Stencil Client Patch Esm v2.17.4 | MIT Licensed | https://stenciljs.com
|
|
12
12
|
*/
|
|
13
13
|
const patchEsm = () => {
|
|
14
14
|
return index.promiseResolve();
|
|
@@ -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-
|
|
20
|
+
return index.bootstrapLazy([["salla-button_23.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"]]],[4,"salla-scopes",{"position":[1],"searchFieldToggler":[2,"search-field-toggler"],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"branchNotFound":[32],"ourServiceIsNotFound":[32],"searchForAvailabilityInOtherBranch":[32],"shoppingFromAnotherBranch":[32],"nowBrowsingFrom":[32],"confirmButton":[32],"scopeSearchPlaceholder":[32],"selected_scope":[32],"isDefault":[32],"close":[64],"open":[64],"handleSubmit":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"open":[64],"close":[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-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]}],[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]}],[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,"onSelect","onSelectedTab"]]],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"default_title":[32],"default_description":[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]}],[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]}],[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-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
|
|
|
@@ -9,94 +9,6 @@ const index$1 = require('./index-0d0167d5.js');
|
|
|
9
9
|
const Helper = require('./Helper-8ae6a805.js');
|
|
10
10
|
require('https://static.addtoany.com/menu/page.js');
|
|
11
11
|
|
|
12
|
-
const sallaBranchesCss = "";
|
|
13
|
-
|
|
14
|
-
const SallaBranches = class {
|
|
15
|
-
constructor(hostRef) {
|
|
16
|
-
index$1.registerInstance(this, hostRef);
|
|
17
|
-
this.open = true;
|
|
18
|
-
this.isOpenedBefore = salla.storage.get("branch-choosed-before");
|
|
19
|
-
this.displayAs = 'default'; //todo:: change it to boolean, isPopup default false
|
|
20
|
-
this.browseProductsFrom = 'all'; //todo:: get better name
|
|
21
|
-
this.branches = [
|
|
22
|
-
{ id: 1, name: 'فرع الرياض', open: true, available: true, limited: false, tag: 'متوفر' },
|
|
23
|
-
{ id: 2, name: 'فرع جدة', open: false, available: false, limited: false, tag: 'غير متوفر' },
|
|
24
|
-
{ id: 3, name: 'فرع مكة', open: true, available: true, limited: false, tag: 'متوفر' },
|
|
25
|
-
{ id: 4, name: 'فرع المدينة', open: true, available: true, limited: false, tag: 'متوفر' },
|
|
26
|
-
{ id: 5, name: 'فرع جازان', open: true, available: true, limited: true, tag: 'الكمية محدودة' }
|
|
27
|
-
];
|
|
28
|
-
this.current = 1;
|
|
29
|
-
this.currentBranch = (prop) => {
|
|
30
|
-
return this.branches.filter((el) => el.id == this.current)[0][prop];
|
|
31
|
-
};
|
|
32
|
-
this.statusColor = (branch = null) => {
|
|
33
|
-
return branch ?
|
|
34
|
-
branch.limited ? 's-branches-color-red' : branch.available ? 's-branches-color-green' : 's-branches-color-gray'
|
|
35
|
-
:
|
|
36
|
-
this.currentBranch('limited') ? 's-branches-color-red' : this.currentBranch('available') ? 's-branches-color-green' : 's-branches-color-gray';
|
|
37
|
-
};
|
|
38
|
-
this.isChoiceable = () => {
|
|
39
|
-
return (this.browseProductsFrom !== 'all' && this.position == 'single') || this.position == 'header';
|
|
40
|
-
};
|
|
41
|
-
this.formTitle = () => {
|
|
42
|
-
return this.isChoiceable() ?
|
|
43
|
-
'توفر المنتج في الفروع الآخرى'
|
|
44
|
-
: 'التسوق من فرع آخر';
|
|
45
|
-
};
|
|
46
|
-
salla.event.on('branches::show', btn => btn.dataset.target == this.host.id && this.show());
|
|
47
|
-
salla.lang.onLoaded(() => { var _a; return (_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(salla.lang.get('common.elements.ok')); });
|
|
48
|
-
}
|
|
49
|
-
//todo:: add description for all @methods
|
|
50
|
-
async show() {
|
|
51
|
-
var _a;
|
|
52
|
-
return (_a = this.modal) === null || _a === void 0 ? void 0 : _a.open();
|
|
53
|
-
}
|
|
54
|
-
async hide() {
|
|
55
|
-
var _a;
|
|
56
|
-
return (_a = this.modal) === null || _a === void 0 ? void 0 : _a.close();
|
|
57
|
-
}
|
|
58
|
-
handelChange(event) {
|
|
59
|
-
this.selected = event.target.value;
|
|
60
|
-
}
|
|
61
|
-
handleSubmit() {
|
|
62
|
-
this.btn.load().then(() => {
|
|
63
|
-
setTimeout(() => location.reload(), 2000);
|
|
64
|
-
});
|
|
65
|
-
salla.storage.set("branch-choosed-before", true);
|
|
66
|
-
this.show();
|
|
67
|
-
setTimeout(() => {
|
|
68
|
-
this.current = this.selected;
|
|
69
|
-
}, 300);
|
|
70
|
-
}
|
|
71
|
-
render() {
|
|
72
|
-
return (index$1.h("salla-modal", { icon: "sicon-store-alt", "modal-title": "\u0641\u0631\u0639 \u0627\u0644\u0631\u064A\u0627\u0636", "sub-title": "\u0623\u0646\u062A \u0627\u0644\u0622\u0646 \u062A\u062A\u0635\u0641\u062D \u0627\u0644\u0645\u062A\u062C\u0631 \u0645\u0646", "sub-title-first": true,
|
|
73
|
-
// is-closable={!this.isOpenedBefore && this.displayAs == 'popup' ? 'false' : 'true'}
|
|
74
|
-
ref: (modal) => this.modal = modal, width: "sm", id: "s-branches-modal", class: "s-hidden" }, index$1.h("h4", { class: "s-branches-title" }, this.formTitle()), this.branches.length <= 5 ?
|
|
75
|
-
index$1.h("div", { class: "s-branches-space-v" }, this.branches.map((branch) => index$1.h("div", { class: "s-branches-input-wrap" }, index$1.h("input", { id: this.position + '_branch_' + branch.id, disabled: !branch.open && this.isChoiceable(), name: "lang", type: "radio", value: branch.id, onChange: (event) => this.handelChange(event), class: {
|
|
76
|
-
's-branches-input': true,
|
|
77
|
-
'opacity-50': !branch.open,
|
|
78
|
-
's-hidden': !this.isChoiceable()
|
|
79
|
-
}, checked: this.current == branch.id }), index$1.h("label", { htmlFor: this.position + '_branch_' + branch.id, class: {
|
|
80
|
-
's-branches-label': true,
|
|
81
|
-
's-branches-clickable': this.isChoiceable()
|
|
82
|
-
} }, index$1.h("span", { class: { 's-branches-is-closed': !branch.open } }, branch.name), this.isChoiceable() ?
|
|
83
|
-
index$1.h("small", { class: "s-branches-closed-badge" }, branch.open ? '' : 'مُغلق')
|
|
84
|
-
:
|
|
85
|
-
index$1.h("span", { class: this.statusColor(branch) }, branch.tag)))))
|
|
86
|
-
:
|
|
87
|
-
index$1.h("select", { class: "s-branches-select", onInput: (event) => this.handelChange(event) }, this.branches.map(branch => (index$1.h("option", { value: branch.id, disabled: !branch.open, selected: this.selected == branch.id }, branch.name, " ", branch.open ? '' : '- مُغلق')))), this.isChoiceable() ?
|
|
88
|
-
index$1.h("slot", { name: "footer" }, index$1.h("salla-button", { ref: btn => this.btn = btn, onClick: () => this.handleSubmit(), class: "s-branches-submit", width: "wide" }, salla.lang.get('common.elements.ok')))
|
|
89
|
-
: ''));
|
|
90
|
-
}
|
|
91
|
-
componentDidRender() {
|
|
92
|
-
if (!this.isOpenedBefore && this.displayAs == 'popup') {
|
|
93
|
-
this.show();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
get host() { return index$1.getElement(this); }
|
|
97
|
-
};
|
|
98
|
-
SallaBranches.style = sallaBranchesCss;
|
|
99
|
-
|
|
100
12
|
const sallaButtonCss = "";
|
|
101
13
|
|
|
102
14
|
const SallaButton = class {
|
|
@@ -1595,6 +1507,139 @@ const SallaRatingStars = class {
|
|
|
1595
1507
|
};
|
|
1596
1508
|
SallaRatingStars.style = sallaRatingStarsCss;
|
|
1597
1509
|
|
|
1510
|
+
const StoreAlt = `<!-- Generated by IcoMoon.io -->
|
|
1511
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
1512
|
+
<title>store-alt</title>
|
|
1513
|
+
<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>
|
|
1514
|
+
</svg>
|
|
1515
|
+
`;
|
|
1516
|
+
|
|
1517
|
+
const Search = `<!-- Generated by IcoMoon.io -->
|
|
1518
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
1519
|
+
<title>search</title>
|
|
1520
|
+
<path d="M30.276 28.391l-7.576-7.576c1.644-2.053 2.633-4.652 2.633-7.481 0-6.616-5.384-12-12-12s-12 5.384-12 12 5.384 12 12 12c2.829 0 5.428-0.989 7.481-2.633l7.576 7.576c0.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.885zM13.333 22.667c-5.147 0-9.333-4.187-9.333-9.333s4.187-9.333 9.333-9.333 9.333 4.187 9.333 9.333-4.187 9.333-9.333 9.333z"></path>
|
|
1521
|
+
</svg>
|
|
1522
|
+
`;
|
|
1523
|
+
|
|
1524
|
+
var ModeType;
|
|
1525
|
+
(function (ModeType) {
|
|
1526
|
+
ModeType["DEFAULT"] = "default";
|
|
1527
|
+
ModeType["AVAILABILITY"] = "availability";
|
|
1528
|
+
})(ModeType || (ModeType = {}));
|
|
1529
|
+
|
|
1530
|
+
const sallaScopesCss = ".s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-placeholder{flex:0 0 85%}";
|
|
1531
|
+
|
|
1532
|
+
const SallaScopees = class {
|
|
1533
|
+
constructor(hostRef) {
|
|
1534
|
+
index$1.registerInstance(this, hostRef);
|
|
1535
|
+
this.mode = ModeType.DEFAULT;
|
|
1536
|
+
this.scopes = [];
|
|
1537
|
+
this.originalScopesList = [];
|
|
1538
|
+
this.isDefault = true;
|
|
1539
|
+
/**
|
|
1540
|
+
* Dictates when to show the searchfield
|
|
1541
|
+
*/
|
|
1542
|
+
this.searchFieldToggler = 6;
|
|
1543
|
+
this.getFormTitle = () => {
|
|
1544
|
+
var _a;
|
|
1545
|
+
if (((_a = this.originalScopesList) === null || _a === void 0 ? void 0 : _a.length) < 2)
|
|
1546
|
+
return "";
|
|
1547
|
+
return this.isDefault ?
|
|
1548
|
+
this.shoppingFromAnotherBranch :
|
|
1549
|
+
this.searchForAvailabilityInOtherBranch;
|
|
1550
|
+
};
|
|
1551
|
+
salla.event.on('scopes::open', ({ mode = null, product_id = null }) => {
|
|
1552
|
+
if (!!mode)
|
|
1553
|
+
this.mode = mode;
|
|
1554
|
+
this.isDefault = !mode || mode == ModeType.DEFAULT;
|
|
1555
|
+
this.open(mode, product_id);
|
|
1556
|
+
});
|
|
1557
|
+
salla.lang.onLoaded(() => {
|
|
1558
|
+
this.branchNotFound = salla.lang.get("blocks.scope.branch_looking_for_not_found");
|
|
1559
|
+
this.ourServiceIsNotFound = salla.lang.get("blocks.scope.our_services_not_available_in_this_branch");
|
|
1560
|
+
this.searchForAvailabilityInOtherBranch = salla.lang.get('blocks.scope.search_for_availability_in_other_branches');
|
|
1561
|
+
this.shoppingFromAnotherBranch = salla.lang.get("blocks.scope.shopping_from_another_branch");
|
|
1562
|
+
this.nowBrowsingFrom = salla.lang.get('blocks.scope.you_are_browse_store_from');
|
|
1563
|
+
this.confirmButton = salla.lang.get('common.elements.confirm');
|
|
1564
|
+
this.scopeSearchPlaceholder = salla.lang.get('blocks.scope.searching_for_a_branch');
|
|
1565
|
+
});
|
|
1566
|
+
}
|
|
1567
|
+
async close() {
|
|
1568
|
+
var _a;
|
|
1569
|
+
return await ((_a = this.modal) === null || _a === void 0 ? void 0 : _a.close());
|
|
1570
|
+
}
|
|
1571
|
+
async open(mode = ModeType.DEFAULT, product_id = null) {
|
|
1572
|
+
this.modal.open();
|
|
1573
|
+
return await (mode == ModeType.AVAILABILITY ? salla.scope.getProductAvailability(product_id) : salla.scope.get())
|
|
1574
|
+
.then((resp) => {
|
|
1575
|
+
if (mode == ModeType.AVAILABILITY) {
|
|
1576
|
+
this.setScopeValues(resp.data);
|
|
1577
|
+
}
|
|
1578
|
+
else {
|
|
1579
|
+
this.setScopeValues(resp.data.scopes);
|
|
1580
|
+
}
|
|
1581
|
+
}).catch(e => console.log(e))
|
|
1582
|
+
.finally(() => {
|
|
1583
|
+
this.modal.stopLoading();
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
async handleSubmit() {
|
|
1587
|
+
let payload = { 'scope_id': this.current_scope.id };
|
|
1588
|
+
this.changeBtn.load();
|
|
1589
|
+
return await salla.scope.change(payload)
|
|
1590
|
+
.then(() => {
|
|
1591
|
+
window.location.reload();
|
|
1592
|
+
}).catch(e => console.log(e))
|
|
1593
|
+
.finally(() => {
|
|
1594
|
+
this.changeBtn.stop();
|
|
1595
|
+
});
|
|
1596
|
+
}
|
|
1597
|
+
setScopeValues(value) {
|
|
1598
|
+
this.scopes = value;
|
|
1599
|
+
this.originalScopesList = value;
|
|
1600
|
+
if (value.length == 1) {
|
|
1601
|
+
this.current_scope = value[0];
|
|
1602
|
+
this.selected_scope = value[0];
|
|
1603
|
+
}
|
|
1604
|
+
else {
|
|
1605
|
+
this.current_scope = value.find(scope => scope.selected);
|
|
1606
|
+
this.selected_scope = value.find(scope => scope.selected);
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
handleSearchFieldTyping(e) {
|
|
1610
|
+
let value = e.target.value.toLocaleLowerCase();
|
|
1611
|
+
if (!!value) {
|
|
1612
|
+
this.scopes = this.originalScopesList.filter(scope => scope.name.toLowerCase().includes(value));
|
|
1613
|
+
}
|
|
1614
|
+
else {
|
|
1615
|
+
this.scopes = this.originalScopesList;
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
handleScopeSelection(event) {
|
|
1619
|
+
this.current_scope = this.scopes.find(scope => scope.id == event.target.value);
|
|
1620
|
+
}
|
|
1621
|
+
placeholderContent() {
|
|
1622
|
+
return index$1.h("salla-placeholder", { alignment: "center", class: "s-scopes-placeholder" }, index$1.h("span", { slot: "title" }, this.branchNotFound), index$1.h("span", { slot: "description" }, this.ourServiceIsNotFound));
|
|
1623
|
+
}
|
|
1624
|
+
defaultContent() {
|
|
1625
|
+
return [index$1.h("div", { class: "s-scopes-container s-scrollbar" }, this.scopes.map((scope) => index$1.h("div", { class: "s-scopes-input-wrap", "data-position": this.position }, index$1.h("input", { id: `${this.position} + '_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 }), index$1.h("label", { htmlFor: this.position + '_scope_' + scope.id, class: "s-scopes-label s-scopes-clickable" }, index$1.h("span", null, scope.name))))), this.footerContent()];
|
|
1626
|
+
}
|
|
1627
|
+
availabilityContent() {
|
|
1628
|
+
return index$1.h("div", { class: "s-scopes-container" }, this.scopes.map((scope) => index$1.h("div", { class: "s-scopes-input-wrap", "data-position": this.position }, index$1.h("h2", { class: { "s-scopes-label": true, "s-scopes-clickable": this.isDefault } }, index$1.h("span", null, scope.name)), index$1.h("h2", { style: { 'color': scope.availability.color }, class: `s-scopes-${scope.availability.key}` }, scope.availability.label))));
|
|
1629
|
+
}
|
|
1630
|
+
footerContent() {
|
|
1631
|
+
return index$1.h("div", { class: "s-scopes-footer" }, index$1.h("slot", { name: "footer" }, index$1.h("salla-button", { ref: btn => this.changeBtn = btn, disabled: !this.current_scope, onClick: () => this.handleSubmit(), class: "s-scopes-submit", "loader-position": "center", width: "wide" }, this.confirmButton)));
|
|
1632
|
+
}
|
|
1633
|
+
render() {
|
|
1634
|
+
return (index$1.h(index$1.Host, null, index$1.h("salla-modal", { ref: modal => this.modal = modal, id: "s-scopes-modal", class: "s-scopes-modal", isLoading: true }, index$1.h("salla-list-tile", { class: this.originalScopesList.length ? "s-scopes-header block" : "s-hidden" }, index$1.h("div", { slot: "icon", class: "s-scopes-header-icon", innerHTML: StoreAlt }), index$1.h("div", { slot: "title", class: "s-scopes-header-title" }, this.nowBrowsingFrom, " "), index$1.h("div", { slot: "subtitle", class: "s-scopes-header-subtitle" }, !!this.selected_scope ? this.selected_scope.name : "")), index$1.h("div", { class: "s-scopes-wrap" }, !!this.originalScopesList.length && index$1.h("h4", { class: "s-scopes-title" }, this.getFormTitle()), this.originalScopesList.length > this.searchFieldToggler ?
|
|
1635
|
+
index$1.h("div", { class: "s-scopes-search-wrapper" }, index$1.h("div", { class: "s-scopes-search-icon", innerHTML: Search }), index$1.h("input", { type: "text", class: "s-scopes-search-input", onInput: e => this.handleSearchFieldTyping(e), placeholder: this.scopeSearchPlaceholder }))
|
|
1636
|
+
: "", this.scopes.length < 2 ?
|
|
1637
|
+
this.placeholderContent()
|
|
1638
|
+
: this.isDefault ? this.defaultContent() : this.availabilityContent()))));
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
SallaScopees.style = sallaScopesCss;
|
|
1642
|
+
|
|
1598
1643
|
const sallaSearchCss = "";
|
|
1599
1644
|
|
|
1600
1645
|
const SallaSearch = class {
|
|
@@ -9881,7 +9926,6 @@ const SallaVerify = class {
|
|
|
9881
9926
|
};
|
|
9882
9927
|
SallaVerify.style = sallaVerifyCss;
|
|
9883
9928
|
|
|
9884
|
-
exports.salla_branches = SallaBranches;
|
|
9885
9929
|
exports.salla_button = SallaButton;
|
|
9886
9930
|
exports.salla_infinite_scroll = SallaInfiniteScroll;
|
|
9887
9931
|
exports.salla_list_tile = SallaListTile;
|
|
@@ -9896,6 +9940,7 @@ exports.salla_product_availability = SallaProductAvailability;
|
|
|
9896
9940
|
exports.salla_product_size_guide = SallaProductSizeGuide;
|
|
9897
9941
|
exports.salla_rating_modal = SallaRatingModal;
|
|
9898
9942
|
exports.salla_rating_stars = SallaRatingStars;
|
|
9943
|
+
exports.salla_scopes = SallaScopees;
|
|
9899
9944
|
exports.salla_search = SallaSearch;
|
|
9900
9945
|
exports.salla_social_share = SallaSocialShare;
|
|
9901
9946
|
exports.salla_swiper = SallaSwiper;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
const index = require('./index-0d0167d5.js');
|
|
7
7
|
|
|
8
8
|
/*
|
|
9
|
-
Stencil Client Patch Browser v2.17.
|
|
9
|
+
Stencil Client Patch Browser v2.17.4 | MIT Licensed | https://stenciljs.com
|
|
10
10
|
*/
|
|
11
11
|
const patchBrowser = () => {
|
|
12
12
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('twilight-components.cjs.js', document.baseURI).href));
|
|
@@ -18,5 +18,5 @@ const patchBrowser = () => {
|
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(options => {
|
|
21
|
-
return index.bootstrapLazy([["salla-
|
|
21
|
+
return index.bootstrapLazy([["salla-button_23.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"]]],[4,"salla-scopes",{"position":[1],"searchFieldToggler":[2,"search-field-toggler"],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"branchNotFound":[32],"ourServiceIsNotFound":[32],"searchForAvailabilityInOtherBranch":[32],"shoppingFromAnotherBranch":[32],"nowBrowsingFrom":[32],"confirmButton":[32],"scopeSearchPlaceholder":[32],"selected_scope":[32],"isDefault":[32],"close":[64],"open":[64],"handleSubmit":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"open":[64],"close":[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-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]}],[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]}],[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,"onSelect","onSelectedTab"]]],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"default_title":[32],"default_description":[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]}],[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]}],[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-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
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
3
|
"./components/salla-add-product-button/salla-add-product-button.js",
|
|
4
|
-
"./components/salla-branches/salla-branches.js",
|
|
5
4
|
"./components/salla-button/salla-button.js",
|
|
6
5
|
"./components/salla-conditional-fields/salla-conditional-fields.js",
|
|
7
6
|
"./components/salla-infinite-scroll/salla-infinite-scroll.js",
|
|
@@ -19,6 +18,7 @@
|
|
|
19
18
|
"./components/salla-quantity-input/salla-quantity-input.js",
|
|
20
19
|
"./components/salla-rating-modal/salla-rating-modal.js",
|
|
21
20
|
"./components/salla-rating-stars/salla-rating-stars.js",
|
|
21
|
+
"./components/salla-scopes/salla-scopes.js",
|
|
22
22
|
"./components/salla-search/salla-search.js",
|
|
23
23
|
"./components/salla-social-share/salla-social-share.js",
|
|
24
24
|
"./components/salla-swiper/salla-swiper.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
],
|
|
31
31
|
"compiler": {
|
|
32
32
|
"name": "@stencil/core",
|
|
33
|
-
"version": "2.17.
|
|
33
|
+
"version": "2.17.4",
|
|
34
34
|
"typescriptVersion": "4.5.4"
|
|
35
35
|
},
|
|
36
36
|
"collections": [],
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Salla Branches Component: Store branches & warehouses popup modal
|
|
3
|
+
* You can use these classes to target the elements in the component.
|
|
4
|
+
*/
|
|
5
|
+
.s-scopes-availability-content {
|
|
6
|
+
display: flex;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
align-items: center;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.s-scopes-placeholder {
|
|
12
|
+
flex: 0 0 85%;
|
|
13
|
+
}
|