@salla.sa/twilight-components 1.0.22 → 1.0.24
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/index.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-branches.cjs.entry.js +5 -2
- package/dist/cjs/salla-button_5.cjs.entry.js +79 -29
- package/dist/cjs/salla-localization.cjs.entry.js +6 -4
- package/dist/cjs/salla-login-c74587ef.js +154 -0
- package/dist/cjs/salla-offer.cjs.entry.js +2 -2
- package/dist/cjs/salla-rating.cjs.entry.js +12 -9
- package/dist/cjs/{salla-search-45173394.js → salla-search-eb0112c0.js} +16 -23
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/components/salla-branches/salla-branches.js +7 -3
- package/dist/collection/components/salla-button/salla-button.js +2 -0
- package/dist/collection/components/salla-localization/salla-localization.js +11 -60
- package/dist/collection/components/salla-login/salla-login.css +15 -2
- package/dist/collection/components/salla-login/salla-login.js +132 -252
- package/dist/collection/components/salla-modal/salla-modal.css +0 -0
- package/dist/collection/components/salla-modal/salla-modal.js +28 -20
- package/dist/collection/components/salla-offer/salla-offer.js +2 -2
- package/dist/collection/components/salla-rating/salla-rating.js +12 -9
- package/dist/collection/components/salla-search/salla-search.css +1 -0
- package/dist/collection/components/salla-search/salla-search.js +19 -62
- package/dist/collection/components/salla-search/search-response.js +1 -0
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +86 -6
- package/dist/collection/components/salla-verify/salla-verify.js +18 -13
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-branches.entry.js +5 -2
- package/dist/esm/salla-button_5.entry.js +79 -29
- package/dist/esm/salla-localization.entry.js +6 -4
- package/dist/esm/salla-login-d08f0d7e.js +152 -0
- package/dist/esm/salla-offer.entry.js +2 -2
- package/dist/esm/salla-rating.entry.js +12 -9
- package/dist/esm/{salla-search-5e691ebb.js → salla-search-57bd45eb.js} +16 -23
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/index.esm.js +1 -1
- package/dist/twilight-components/p-1918a33c.js +1 -0
- package/dist/twilight-components/p-22f06d26.entry.js +1 -0
- package/dist/twilight-components/p-47f3d098.entry.js +1 -0
- package/dist/twilight-components/p-5bf5ce53.entry.js +1 -0
- package/dist/twilight-components/p-aa9880cb.entry.js +1 -0
- package/dist/twilight-components/p-b195e28c.entry.js +1 -0
- package/dist/twilight-components/p-e6a3a0dc.entry.js +1 -0
- package/dist/twilight-components/p-e7edc889.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-branches/salla-branches.d.ts +1 -0
- package/dist/types/components/salla-login/salla-login.d.ts +21 -12
- package/dist/types/components/salla-search/salla-search.d.ts +2 -7
- package/dist/types/components/salla-search/search-response.d.ts +18 -0
- package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +18 -6
- package/dist/types/components/salla-verify/salla-verify.d.ts +2 -2
- package/dist/types/components.d.ts +5 -43
- package/package.json +1 -1
- package/dist/cjs/salla-login-c438bb35.js +0 -128
- package/dist/esm/salla-login-dd957742.js +0 -126
- package/dist/twilight-components/p-1a6d8171.entry.js +0 -1
- package/dist/twilight-components/p-1deb8111.entry.js +0 -1
- package/dist/twilight-components/p-3a4d963e.js +0 -1
- package/dist/twilight-components/p-5b2eb87d.entry.js +0 -1
- package/dist/twilight-components/p-7fbdf746.entry.js +0 -1
- package/dist/twilight-components/p-81a61f4e.js +0 -1
- package/dist/twilight-components/p-ce991664.entry.js +0 -1
- package/dist/twilight-components/p-da73fc9b.entry.js +0 -1
|
@@ -3,30 +3,25 @@
|
|
|
3
3
|
const index = require('./index-714023c8.js');
|
|
4
4
|
const Helper = require('./Helper-fcea994c.js');
|
|
5
5
|
|
|
6
|
-
const sallaSearchCss = "#s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}#s-search-modal .s-modal-spacer{display:inline}#s-search-modal .s-modal-body{padding:0;max-width:90%;margin-top:3.2rem}#s-search-modal .s-modal-close{top:1rem}";
|
|
6
|
+
const sallaSearchCss = "#s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}#s-search-modal .s-modal-spacer{display:inline}#s-search-modal .s-modal-body{padding:0;max-width:90%;margin-top:3.2rem;border-radius:0.5rem}#s-search-modal .s-modal-close{top:1rem}";
|
|
7
7
|
|
|
8
8
|
const SallaSearch = class {
|
|
9
9
|
constructor(hostRef) {
|
|
10
10
|
index.registerInstance(this, hostRef);
|
|
11
11
|
var _a;
|
|
12
|
-
this.results = [];
|
|
13
|
-
/**
|
|
14
|
-
* Override search placeholder.
|
|
15
|
-
*/
|
|
16
|
-
this.placeholder = salla.lang.get('blocks.header.search_placeholder');
|
|
17
|
-
/**
|
|
18
|
-
* Override no results error message.
|
|
19
|
-
*/
|
|
20
|
-
this.noResultsText = salla.lang.get('common.elements.no_options');
|
|
21
12
|
Helper.Helper.setHost(this.host);
|
|
22
13
|
this.productSlot = ((_a = Helper.Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
|
|
14
|
+
salla.event.on('languages::translations.loaded', () => {
|
|
15
|
+
this.placeholder = salla.lang.get('blocks.header.search_placeholder');
|
|
16
|
+
this.noResultsText = salla.lang.get('common.elements.no_options');
|
|
17
|
+
});
|
|
23
18
|
}
|
|
24
19
|
onModalOpen() {
|
|
25
20
|
this.modal.querySelector('.s-search-input').focus();
|
|
26
21
|
}
|
|
27
22
|
onModalClose() {
|
|
28
23
|
this.modal.querySelector('.s-search-input').value = '';
|
|
29
|
-
this.results =
|
|
24
|
+
this.results = undefined;
|
|
30
25
|
this.afterSearching();
|
|
31
26
|
}
|
|
32
27
|
getDefaultProductSlot() {
|
|
@@ -41,7 +36,7 @@ const SallaSearch = class {
|
|
|
41
36
|
search(e) {
|
|
42
37
|
Helper.Helper.hideElement(this.noResults);
|
|
43
38
|
if (e.target.value.length === 0) {
|
|
44
|
-
this.results =
|
|
39
|
+
this.results = undefined;
|
|
45
40
|
this.afterSearching();
|
|
46
41
|
return;
|
|
47
42
|
}
|
|
@@ -51,26 +46,24 @@ const SallaSearch = class {
|
|
|
51
46
|
//run loading spinner or stop it
|
|
52
47
|
Helper.Helper.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => true);
|
|
53
48
|
salla.search.api.search(e.target.value)
|
|
54
|
-
.then(response => this.results = response
|
|
55
|
-
.catch(err => err !== 'Query Same As Previous!' ? this.results =
|
|
49
|
+
.then(response => this.results = response)
|
|
50
|
+
.catch(err => err !== 'Query Same As Previous!' ? this.results = undefined : null)
|
|
56
51
|
.finally(() => this.afterSearching(/*isEmpty*/ false));
|
|
57
52
|
}
|
|
58
53
|
afterSearching(isEmpty = true) {
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
var _a;
|
|
55
|
+
this.noResults.style.display = isEmpty || ((_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length) > 0 ? 'none' : 'block';
|
|
56
|
+
Helper.Helper.toggleElement(this.container, 's-search-container-open', 'no-results', () => { var _a; return (_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length; })
|
|
61
57
|
.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => false); //stop searching anime
|
|
62
58
|
salla.search.api.previousQuery = ''; //avoid having error 'Query Same As Previous' after reopen modal;
|
|
63
59
|
}
|
|
64
60
|
render() {
|
|
65
61
|
var _a;
|
|
66
62
|
return (index.h("salla-modal", { position: "top", id: "s-search-modal", ref: modal => this.modal = modal }, index.h("div", { class: "s-search-container", ref: container => this.container = container }, index.h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e) }), index.h("span", { class: "s-search-icon" }, index.h("i", { class: "sicon-search", ref: el => this.searchIcon = el })), index.h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
|
|
67
|
-
_a.map(item => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
.replace(/\{price\}/g, (_a = item.price) === null || _a === void 0 ? void 0 : _a.after) //todo:: get discounted price too
|
|
72
|
-
.replace(/\{image\}/g, item.thumb) });
|
|
73
|
-
}), index.h("p", { ref: el => this.noResults = el, class: "s-search-no-results" }, this.noResultsText)))));
|
|
63
|
+
_a.data.map(item => index.h("a", { href: item.url, class: "s-search-product", innerHTML: this.productSlot
|
|
64
|
+
.replace(/\{name\}/g, item.name)
|
|
65
|
+
.replace(/\{price\}/g, item.price) //todo:: get discounted price too
|
|
66
|
+
.replace(/\{image\}/g, item.image_url) })), index.h("p", { ref: el => this.noResults = el, class: "s-search-no-results" }, this.noResultsText)))));
|
|
74
67
|
}
|
|
75
68
|
/**
|
|
76
69
|
* Run it one time after load
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"
|
|
18
|
+
return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isEmailAllowed":[4,"is-email-allowed"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"isEmailValid":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameRequired":[32],"lastNameRequired":[32],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"isShowBack":[4,"is-show-back"],"autoReload":[4,"auto-reload"],"getCode":[64],"show":[64]}],[0,"salla-tel-input",{"phone":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"invalidNumber":[32],"invalidCountryCode":[32],"tooShort":[32],"tooLong":[32],"mobileLabel":[32],"mobileRequired":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"ok":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[32],"currenciesTitle":[32],"ok":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"buttonText":[1,"button-text"],"countryCode":[1,"country-code"],"subscribeText":[1,"subscribe-text"],"cancelText":[1,"cancel-text"],"subTitle":[1,"sub-title"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"mobilePlaceholder":[1,"mobile-placeholder"],"emailPlaceholder":[1,"email-placeholder"],"productId":[2,"product-id"],"subscribedMessage":[1,"subscribed-message"],"isSubscribed":[1028,"is-subscribed"],"submit":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"order":[32],"show":[64],"hide":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]]]]], options);
|
|
19
19
|
});
|
|
@@ -34,6 +34,9 @@ export class SallaBranches {
|
|
|
34
34
|
: 'التسوق من فرع آخر';
|
|
35
35
|
};
|
|
36
36
|
salla.event.on('branches::show', () => this.show());
|
|
37
|
+
salla.event.on('languages::translations.loaded', () => {
|
|
38
|
+
this.ok = salla.lang.get('common.elements.ok');
|
|
39
|
+
});
|
|
37
40
|
}
|
|
38
41
|
async show() {
|
|
39
42
|
return this.modal.show();
|
|
@@ -55,7 +58,7 @@ export class SallaBranches {
|
|
|
55
58
|
}, 300);
|
|
56
59
|
}
|
|
57
60
|
render() {
|
|
58
|
-
return (h("salla-modal", { icon: "sicon-store-alt", 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, "is-closable": !this.isOpenedBefore && this.displayAs == 'popup' ? 'false' : 'true', ref: modal => this.modal = modal,
|
|
61
|
+
return (h("salla-modal", { icon: "sicon-store-alt", 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, "is-closable": !this.isOpenedBefore && this.displayAs == 'popup' ? 'false' : 'true', ref: modal => this.modal = modal, width: "sm", id: "s-branches-modal", class: "hidden" },
|
|
59
62
|
h("h4", { class: "s-branches-title" }, this.formTitle()),
|
|
60
63
|
this.branches.length <= 5 ?
|
|
61
64
|
h("div", { class: "s-branches-space-v" }, this.branches.map((branch) => h("div", { class: "s-branches-input-wrap" },
|
|
@@ -80,7 +83,7 @@ export class SallaBranches {
|
|
|
80
83
|
branch.open ? '' : '- مُغلق')))),
|
|
81
84
|
this.isChoiceable() ?
|
|
82
85
|
h("slot", { name: "footer" },
|
|
83
|
-
h("salla-button", { ref: btn => this.btn = btn, onClick: () => this.handleSubmit(), class: "s-branches-submit", wide: true },
|
|
86
|
+
h("salla-button", { ref: btn => this.btn = btn, onClick: () => this.handleSubmit(), class: "s-branches-submit", wide: true }, this.ok))
|
|
84
87
|
: ''));
|
|
85
88
|
}
|
|
86
89
|
componentDidRender() {
|
|
@@ -187,7 +190,8 @@ export class SallaBranches {
|
|
|
187
190
|
static get states() { return {
|
|
188
191
|
"open": {},
|
|
189
192
|
"selected": {},
|
|
190
|
-
"isOpenedBefore": {}
|
|
193
|
+
"isOpenedBefore": {},
|
|
194
|
+
"ok": {}
|
|
191
195
|
}; }
|
|
192
196
|
static get methods() { return {
|
|
193
197
|
"show": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Element, h, Method,
|
|
1
|
+
import { Component, Element, h, Method, State } from '@stencil/core';
|
|
2
2
|
import Helper from "../../Helpers/Helper";
|
|
3
3
|
/**
|
|
4
4
|
* @slot header - The top of the modal.
|
|
@@ -11,11 +11,13 @@ export class SallaLocalization {
|
|
|
11
11
|
var _a, _b;
|
|
12
12
|
this.language = salla.config.get('language', {});
|
|
13
13
|
this.currency = salla.config.get('currency', {});
|
|
14
|
-
this.languagesTitle = salla.lang.get('common.titles.language');
|
|
15
|
-
this.currenciesTitle = salla.lang.get('common.titles.currency');
|
|
16
|
-
this.ok = salla.lang.get('common.elements.ok');
|
|
17
14
|
Helper.setHost(this.host);
|
|
18
15
|
salla.event.on('localization::show', () => this.show());
|
|
16
|
+
salla.event.on('languages::translations.loaded', () => {
|
|
17
|
+
this.languagesTitle = salla.lang.get('common.titles.language');
|
|
18
|
+
this.currenciesTitle = salla.lang.get('common.titles.currency');
|
|
19
|
+
this.ok = salla.lang.get('common.elements.ok');
|
|
20
|
+
});
|
|
19
21
|
/**
|
|
20
22
|
* letting developer to insert his own slot like:
|
|
21
23
|
* <salla-localization>
|
|
@@ -53,7 +55,7 @@ export class SallaLocalization {
|
|
|
53
55
|
.then(() => url && (window.location.href = url));
|
|
54
56
|
}
|
|
55
57
|
render() {
|
|
56
|
-
return (h("salla-modal", { id: "salla-localization", class: "hidden", ref: modal => this.modal = modal,
|
|
58
|
+
return (h("salla-modal", { id: "salla-localization", class: "hidden", ref: modal => this.modal = modal, width: "xs" },
|
|
57
59
|
h("div", { slot: "header" },
|
|
58
60
|
h("slot", { name: "header" })),
|
|
59
61
|
h("div", { class: "s-localization-inner" },
|
|
@@ -92,61 +94,10 @@ export class SallaLocalization {
|
|
|
92
94
|
this.host.querySelectorAll('#language-slot').forEach(el => el.replaceWith(el.firstChild));
|
|
93
95
|
}
|
|
94
96
|
static get is() { return "salla-localization"; }
|
|
95
|
-
static get
|
|
96
|
-
"languagesTitle": {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"complexType": {
|
|
100
|
-
"original": "string",
|
|
101
|
-
"resolved": "string",
|
|
102
|
-
"references": {}
|
|
103
|
-
},
|
|
104
|
-
"required": false,
|
|
105
|
-
"optional": false,
|
|
106
|
-
"docs": {
|
|
107
|
-
"tags": [],
|
|
108
|
-
"text": ""
|
|
109
|
-
},
|
|
110
|
-
"attribute": "languages-title",
|
|
111
|
-
"reflect": false,
|
|
112
|
-
"defaultValue": "salla.lang.get('common.titles.language')"
|
|
113
|
-
},
|
|
114
|
-
"currenciesTitle": {
|
|
115
|
-
"type": "string",
|
|
116
|
-
"mutable": false,
|
|
117
|
-
"complexType": {
|
|
118
|
-
"original": "string",
|
|
119
|
-
"resolved": "string",
|
|
120
|
-
"references": {}
|
|
121
|
-
},
|
|
122
|
-
"required": false,
|
|
123
|
-
"optional": false,
|
|
124
|
-
"docs": {
|
|
125
|
-
"tags": [],
|
|
126
|
-
"text": ""
|
|
127
|
-
},
|
|
128
|
-
"attribute": "currencies-title",
|
|
129
|
-
"reflect": false,
|
|
130
|
-
"defaultValue": "salla.lang.get('common.titles.currency')"
|
|
131
|
-
},
|
|
132
|
-
"ok": {
|
|
133
|
-
"type": "string",
|
|
134
|
-
"mutable": false,
|
|
135
|
-
"complexType": {
|
|
136
|
-
"original": "string",
|
|
137
|
-
"resolved": "string",
|
|
138
|
-
"references": {}
|
|
139
|
-
},
|
|
140
|
-
"required": false,
|
|
141
|
-
"optional": false,
|
|
142
|
-
"docs": {
|
|
143
|
-
"tags": [],
|
|
144
|
-
"text": ""
|
|
145
|
-
},
|
|
146
|
-
"attribute": "ok",
|
|
147
|
-
"reflect": false,
|
|
148
|
-
"defaultValue": "salla.lang.get('common.elements.ok')"
|
|
149
|
-
}
|
|
97
|
+
static get states() { return {
|
|
98
|
+
"languagesTitle": {},
|
|
99
|
+
"currenciesTitle": {},
|
|
100
|
+
"ok": {}
|
|
150
101
|
}; }
|
|
151
102
|
static get methods() { return {
|
|
152
103
|
"show": {
|