@salla.sa/twilight-components 1.0.52 → 1.0.53
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 +2 -2
- package/dist/cjs/salla-button.cjs.entry.js +16 -21
- package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
- package/dist/cjs/{salla-login-modal-a2c7fa5d.js → salla-login-modal-54cc2e83.js} +1 -1
- package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
- package/dist/cjs/salla-modal_2.cjs.entry.js +2 -2
- package/dist/cjs/salla-offer-modal.cjs.entry.js +2 -2
- package/dist/cjs/salla-product-availability.cjs.entry.js +2 -2
- package/dist/cjs/{salla-search-99d08b1f.js → salla-search-f76c6d61.js} +15 -4
- package/dist/cjs/salla-tel-input.cjs.entry.js +2 -4
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/components/salla-branches/salla-branches.js +2 -2
- package/dist/collection/components/salla-button/salla-button.css +51 -1
- package/dist/collection/components/salla-button/salla-button.js +54 -25
- package/dist/collection/components/salla-localization-modal/salla-localization-modal.css +5 -1
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +1 -1
- package/dist/collection/components/salla-modal/salla-modal.css +4 -1
- package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +2 -2
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +2 -2
- package/dist/collection/components/salla-search/salla-search.css +11 -0
- package/dist/collection/components/salla-search/salla-search.js +79 -13
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +2 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-branches.entry.js +2 -2
- package/dist/esm/salla-button.entry.js +16 -21
- package/dist/esm/salla-localization-modal.entry.js +1 -1
- package/dist/esm/{salla-login-modal-187c1f98.js → salla-login-modal-473768a6.js} +1 -1
- package/dist/esm/salla-login-modal.entry.js +1 -1
- package/dist/esm/salla-modal_2.entry.js +2 -2
- package/dist/esm/salla-offer-modal.entry.js +2 -2
- package/dist/esm/salla-product-availability.entry.js +2 -2
- package/dist/esm/{salla-search-2e3e60cb.js → salla-search-7521be0c.js} +15 -4
- package/dist/esm/salla-tel-input.entry.js +2 -4
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/index.esm.js +1 -1
- package/dist/twilight-components/{p-05dff05e.entry.js → p-105af48d.entry.js} +1 -1
- package/dist/twilight-components/p-10ea748b.js +1 -0
- package/dist/twilight-components/{p-ea455ae9.entry.js → p-134fa158.entry.js} +1 -1
- package/dist/twilight-components/p-17ebe444.entry.js +1 -0
- package/dist/twilight-components/p-2a032b88.entry.js +1 -0
- package/dist/twilight-components/p-2f3f4cce.entry.js +1 -0
- package/dist/twilight-components/p-669a9b08.entry.js +1 -0
- package/dist/twilight-components/p-78b10bac.entry.js +1 -0
- package/dist/twilight-components/{p-1f873057.entry.js → p-c51984d6.entry.js} +1 -1
- package/dist/twilight-components/p-e4f716b0.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-button/salla-button.d.ts +9 -2
- package/dist/types/components/salla-search/salla-search.d.ts +4 -0
- package/dist/types/components.d.ts +24 -2
- package/package.json +1 -1
- package/dist/twilight-components/p-0b599094.js +0 -1
- package/dist/twilight-components/p-2e03db57.entry.js +0 -1
- package/dist/twilight-components/p-5ffd56fb.js +0 -1
- package/dist/twilight-components/p-88d1bb89.entry.js +0 -1
- package/dist/twilight-components/p-8bfa19fb.entry.js +0 -1
- package/dist/twilight-components/p-c0a7b5a2.entry.js +0 -1
- package/dist/twilight-components/p-e6c67b55.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, h, State, Element, Listen } from '@stencil/core';
|
|
1
|
+
import { Component, Prop, h, State, Element, Listen } from '@stencil/core';
|
|
2
2
|
import Helper from "../../Helpers/Helper";
|
|
3
3
|
/**
|
|
4
4
|
* @slot product - Replaces products card in the results, has replaceable props `{name}`, `{price}`, `{name}`.
|
|
@@ -6,6 +6,10 @@ import Helper from "../../Helpers/Helper";
|
|
|
6
6
|
export class SallaSearch {
|
|
7
7
|
constructor() {
|
|
8
8
|
var _a;
|
|
9
|
+
this.inputValue = '';
|
|
10
|
+
this.inline = false;
|
|
11
|
+
this.oval = false;
|
|
12
|
+
this.height = 60;
|
|
9
13
|
Helper.setHost(this.host);
|
|
10
14
|
this.productSlot = ((_a = Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
|
|
11
15
|
salla.event.on('search::show', () => this.modal.show());
|
|
@@ -21,6 +25,7 @@ export class SallaSearch {
|
|
|
21
25
|
this.modal.querySelector('.s-search-input').value = '';
|
|
22
26
|
this.results = undefined;
|
|
23
27
|
this.afterSearching();
|
|
28
|
+
this.container.classList.remove('s-search-no-results');
|
|
24
29
|
}
|
|
25
30
|
getDefaultProductSlot() {
|
|
26
31
|
return '<div class="s-search-product-image-container">' +
|
|
@@ -32,6 +37,7 @@ export class SallaSearch {
|
|
|
32
37
|
}
|
|
33
38
|
//todo:: reset data when closing
|
|
34
39
|
search(e) {
|
|
40
|
+
this.inputValue = e.target.value;
|
|
35
41
|
Helper.hideElement(this.noResults);
|
|
36
42
|
if (e.target.value.length === 0) {
|
|
37
43
|
this.results = undefined;
|
|
@@ -51,23 +57,27 @@ export class SallaSearch {
|
|
|
51
57
|
afterSearching(isEmpty = true) {
|
|
52
58
|
var _a;
|
|
53
59
|
this.noResults.style.display = isEmpty || ((_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length) > 0 ? 'none' : 'block';
|
|
54
|
-
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; })
|
|
60
|
+
Helper.toggleElement(this.container, 's-search-container-open', 's-search-no-results', () => { var _a; return (_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length; })
|
|
55
61
|
.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => false); //stop searching anime
|
|
56
62
|
salla.search.api.previousQuery = ''; //avoid having error 'Query Same As Previous' after reopen modal;
|
|
63
|
+
this.inputValue.length == 0 ? this.container.classList.remove('s-search-no-results') : '';
|
|
57
64
|
}
|
|
58
65
|
render() {
|
|
59
66
|
var _a;
|
|
60
|
-
|
|
61
|
-
h("
|
|
62
|
-
|
|
63
|
-
h("
|
|
64
|
-
|
|
65
|
-
h("
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
const searchContent = h("div", { class: { 's-search-container': true, 's-search-inline': this.inline }, ref: container => this.container = container, style: this.oval ? { borderRadius: this.height / 2 + 'px' } : {} },
|
|
68
|
+
h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e), style: { height: this.height + 'px' } }),
|
|
69
|
+
h("span", { class: "s-search-icon-wrap" },
|
|
70
|
+
h("i", { class: "s-search-icon sicon-search", ref: el => this.searchIcon = el })),
|
|
71
|
+
h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
|
|
72
|
+
_a.data.map(item => h("a", { href: item.url, class: "s-search-product", innerHTML: this.productSlot
|
|
73
|
+
.replace(/\{name\}/g, item.name)
|
|
74
|
+
.replace(/\{price\}/g, item.price) //todo:: get discounted price too
|
|
75
|
+
.replace(/\{image\}/g, item.image_url) })),
|
|
76
|
+
h("p", { ref: el => this.noResults = el, class: "s-search-no-results-placeholder" }, this.noResultsText)));
|
|
77
|
+
return (this.inline ?
|
|
78
|
+
h("div", { id: "s-search-modal" }, searchContent)
|
|
79
|
+
:
|
|
80
|
+
h("salla-modal", { position: "top", id: "s-search-modal", ref: modal => this.modal = modal }, searchContent));
|
|
71
81
|
}
|
|
72
82
|
/**
|
|
73
83
|
* Run it one time after load
|
|
@@ -82,6 +92,62 @@ export class SallaSearch {
|
|
|
82
92
|
static get styleUrls() { return {
|
|
83
93
|
"$": ["salla-search.css"]
|
|
84
94
|
}; }
|
|
95
|
+
static get properties() { return {
|
|
96
|
+
"inline": {
|
|
97
|
+
"type": "boolean",
|
|
98
|
+
"mutable": false,
|
|
99
|
+
"complexType": {
|
|
100
|
+
"original": "boolean",
|
|
101
|
+
"resolved": "boolean",
|
|
102
|
+
"references": {}
|
|
103
|
+
},
|
|
104
|
+
"required": false,
|
|
105
|
+
"optional": false,
|
|
106
|
+
"docs": {
|
|
107
|
+
"tags": [],
|
|
108
|
+
"text": ""
|
|
109
|
+
},
|
|
110
|
+
"attribute": "inline",
|
|
111
|
+
"reflect": false,
|
|
112
|
+
"defaultValue": "false"
|
|
113
|
+
},
|
|
114
|
+
"oval": {
|
|
115
|
+
"type": "boolean",
|
|
116
|
+
"mutable": false,
|
|
117
|
+
"complexType": {
|
|
118
|
+
"original": "boolean",
|
|
119
|
+
"resolved": "boolean",
|
|
120
|
+
"references": {}
|
|
121
|
+
},
|
|
122
|
+
"required": false,
|
|
123
|
+
"optional": false,
|
|
124
|
+
"docs": {
|
|
125
|
+
"tags": [],
|
|
126
|
+
"text": ""
|
|
127
|
+
},
|
|
128
|
+
"attribute": "oval",
|
|
129
|
+
"reflect": false,
|
|
130
|
+
"defaultValue": "false"
|
|
131
|
+
},
|
|
132
|
+
"height": {
|
|
133
|
+
"type": "number",
|
|
134
|
+
"mutable": false,
|
|
135
|
+
"complexType": {
|
|
136
|
+
"original": "number",
|
|
137
|
+
"resolved": "number",
|
|
138
|
+
"references": {}
|
|
139
|
+
},
|
|
140
|
+
"required": false,
|
|
141
|
+
"optional": false,
|
|
142
|
+
"docs": {
|
|
143
|
+
"tags": [],
|
|
144
|
+
"text": ""
|
|
145
|
+
},
|
|
146
|
+
"attribute": "height",
|
|
147
|
+
"reflect": false,
|
|
148
|
+
"defaultValue": "60"
|
|
149
|
+
}
|
|
150
|
+
}; }
|
|
85
151
|
static get states() { return {
|
|
86
152
|
"results": {},
|
|
87
153
|
"placeholder": {},
|
|
@@ -68,10 +68,8 @@ export class SallaTelInput {
|
|
|
68
68
|
});
|
|
69
69
|
this.phoneInput.addEventListener("countrychange", () => {
|
|
70
70
|
let data = this.iti.getSelectedCountryData();
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
input.value = ('+' + data.dialCode).replace('++', '+');
|
|
74
|
-
});
|
|
71
|
+
this.countryCodeInput.value = data.iso2.toUpperCase();
|
|
72
|
+
this.countryKeyInput.value = ('+' + data.dialCode).replace('++', '+');
|
|
75
73
|
});
|
|
76
74
|
// on blur: validate
|
|
77
75
|
this.phoneInput.addEventListener('blur', () => this.isValid());
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { S as SallaLoginModal } from './salla-login-modal-
|
|
2
|
-
export { S as SallaSearch } from './salla-search-
|
|
1
|
+
export { S as SallaLoginModal } from './salla-login-modal-473768a6.js';
|
|
2
|
+
export { S as SallaSearch } from './salla-search-7521be0c.js';
|
|
3
3
|
import './index-8b97d225.js';
|
|
4
4
|
import './Helper-7162a06c.js';
|
package/dist/esm/loader.js
CHANGED
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["salla-button",[[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}]]],["salla-modal_2",[[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[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"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-login-modal",[[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],"show":[64]},[[0,"verified","onVerified"]]]]],["salla-product-availability",[[4,"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]}]]],["salla-branches",[[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]}]]],["salla-localization-modal",[[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer-modal",[[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"show":[64],"showOffer":[64]}]]],["salla-rating-modal",[[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"show":[64],"hide":[64]}]]],["salla-infinite-scroll",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"nextPageAutoload":[1028,"next-page-autoload"],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]],["salla-verify-modal",[[4,"salla-verify-modal",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"autoReload":[4,"auto-reload"],"title":[32],"getCode":[64],"show":[64]}]]],["salla-tel-input",[[0,"salla-tel-input",{"mobile":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}]]]], options);
|
|
13
|
+
return bootstrapLazy([["salla-button",[[4,"salla-button",{"btnStyle":[513,"btn-style"],"icon":[516],"miniIcon":[516,"mini-icon"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}]]],["salla-modal_2",[[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[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"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-login-modal",[[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],"show":[64]},[[0,"verified","onVerified"]]]]],["salla-product-availability",[[4,"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]}]]],["salla-branches",[[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]}]]],["salla-localization-modal",[[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer-modal",[[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"show":[64],"showOffer":[64]}]]],["salla-rating-modal",[[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"show":[64],"hide":[64]}]]],["salla-infinite-scroll",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"nextPageAutoload":[1028,"next-page-autoload"],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]],["salla-verify-modal",[[4,"salla-verify-modal",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"autoReload":[4,"auto-reload"],"title":[32],"getCode":[64],"show":[64]}]]],["salla-tel-input",[[0,"salla-tel-input",{"mobile":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -6,7 +6,7 @@ const SallaBranches = class {
|
|
|
6
6
|
constructor(hostRef) {
|
|
7
7
|
registerInstance(this, hostRef);
|
|
8
8
|
this.open = false;
|
|
9
|
-
this.isOpenedBefore = salla.
|
|
9
|
+
this.isOpenedBefore = salla.storage.get("branch-choosed-before");
|
|
10
10
|
this.displayAs = 'default'; //todo:: change it to boolean, isPopup default false
|
|
11
11
|
this.browseProductsFrom = 'all'; //todo:: get better name
|
|
12
12
|
this.branches = [
|
|
@@ -51,7 +51,7 @@ const SallaBranches = class {
|
|
|
51
51
|
this.btn.load().then(() => {
|
|
52
52
|
setTimeout(() => location.reload(), 2000);
|
|
53
53
|
});
|
|
54
|
-
salla.
|
|
54
|
+
salla.storage.set("branch-choosed-before", true);
|
|
55
55
|
this.show();
|
|
56
56
|
setTimeout(() => {
|
|
57
57
|
this.current = this.selected;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, g as getElement } from './index-8b97d225.js';
|
|
2
|
-
import { H as Helper } from './Helper-7162a06c.js';
|
|
3
2
|
|
|
4
|
-
const sallaButtonCss = "";
|
|
3
|
+
const sallaButtonCss = "salla-button{pointer-events:none}salla-button[type=submit]{-webkit-appearance:none}.s-button-wrap[loading]{pointer-events:none}.s-button-wrap[loading] .s-button-text{opacity:0}.s-button-wrap .s-button-icon:not(:disabled),.s-button-wrap .s-button-btn:not(:disabled){pointer-events:auto}.s-button-wrap .s-button-loader-after .s-button-load{flex-direction:row}.s-button-wrap .s-button-loader-start .s-button-loader{position:absolute;right:8px}.s-button-wrap .s-button-loader-start .s-button-loader [dir=ltr]{left:8px;right:auto}.s-button-wrap .s-button-loader-end .s-button-loader{position:absolute;left:8px}.s-button-wrap .s-button-loader-end .s-button-loader [dir=ltr]{right:8px;left:auto}.s-button-wrap .s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);margin:0 !important}.s-button-wrap .s-button-mini-icon .s-button-loader:before{width:0.85rem;height:0.85rem}.s-button-wrap .s-button-danger .s-button-loader::before,.s-button-wrap .s-button-outline-danger .s-button-loader::before{border-top-color:#f87171;border-left-color:#f87171}";
|
|
5
4
|
|
|
6
5
|
const SallaButton = class {
|
|
7
6
|
constructor(hostRef) {
|
|
@@ -10,6 +9,14 @@ const SallaButton = class {
|
|
|
10
9
|
* Button Style
|
|
11
10
|
*/
|
|
12
11
|
this.btnStyle = 'primary';
|
|
12
|
+
/**
|
|
13
|
+
* Circle Button with icon
|
|
14
|
+
*/
|
|
15
|
+
this.icon = false;
|
|
16
|
+
/**
|
|
17
|
+
* Mini Circle Button with icon
|
|
18
|
+
*/
|
|
19
|
+
this.miniIcon = false;
|
|
13
20
|
/**
|
|
14
21
|
* Is the button currently loading
|
|
15
22
|
*/
|
|
@@ -31,14 +38,13 @@ const SallaButton = class {
|
|
|
31
38
|
this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
|
|
32
39
|
}
|
|
33
40
|
this.hostAttributes.type = this.hostAttributes.type || 'button';
|
|
34
|
-
this.hostAttributes.class +=
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
this.hostAttributes.class +=
|
|
42
|
+
(this.icon ? ' s-button-icon s-button-loader-center' : ' s-button-btn ' + 's-button-loader-' + this.loaderPosition)
|
|
43
|
+
+ (this.wide ? ' s-button-wide ' : '')
|
|
44
|
+
+ (this.disabled ? ' s-button-disabled ' : ' s-button-' + this.btnStyle)
|
|
45
|
+
+ (this.miniIcon ? ' s-button-mini-icon ' : '');
|
|
39
46
|
delete this.hostAttributes['btn-style'];
|
|
40
47
|
delete this.hostAttributes['id'];
|
|
41
|
-
delete this.hostAttributes['data-on-click'];
|
|
42
48
|
if (this.wide) {
|
|
43
49
|
this.host.classList.add('s-button-wide');
|
|
44
50
|
}
|
|
@@ -86,25 +92,14 @@ const SallaButton = class {
|
|
|
86
92
|
this.btn.classList.remove('btn-' + oldKind);
|
|
87
93
|
this.btn.classList.add('btn-' + newKind);
|
|
88
94
|
}
|
|
89
|
-
handleLoading(newVal) {
|
|
90
|
-
//todo::use united styles
|
|
91
|
-
Helper.toggleElement(this.btn, 'btn--is-loading', 'btn--no-loading', () => newVal);
|
|
92
|
-
}
|
|
93
95
|
render() {
|
|
94
96
|
return (
|
|
95
97
|
//TODO:: use HOST then fake button behaviours
|
|
96
|
-
h(Host, { class: "s-button-wrap" }, h("button", Object.assign({ ref: btn => this.btn = btn, disabled: this.disabled }
|
|
97
|
-
//todo::use united styles
|
|
98
|
-
's-button-loader': true,
|
|
99
|
-
's-button-loader-start': this.loaderPosition === 'start',
|
|
100
|
-
's-button-loader-end': this.loaderPosition === 'end',
|
|
101
|
-
's-button-loader-center': this.loaderPosition === 'center',
|
|
102
|
-
} }) : '')));
|
|
98
|
+
h(Host, { class: "s-button-wrap" }, h("button", Object.assign({ ref: btn => this.btn = btn }, this.hostAttributes, { disabled: this.disabled }), h("span", { class: "s-button-text", ref: el => this.text = el }, h("slot", null)), this.loading ? h("span", { class: "s-button-loader" }) : '')));
|
|
103
99
|
}
|
|
104
100
|
get host() { return getElement(this); }
|
|
105
101
|
static get watchers() { return {
|
|
106
|
-
"btnStyle": ["handleVisible"]
|
|
107
|
-
"loading": ["handleLoading"]
|
|
102
|
+
"btnStyle": ["handleVisible"]
|
|
108
103
|
}; }
|
|
109
104
|
};
|
|
110
105
|
SallaButton.style = sallaButtonCss;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, h, g as getElement } from './index-8b97d225.js';
|
|
2
2
|
import { H as Helper } from './Helper-7162a06c.js';
|
|
3
3
|
|
|
4
|
-
const sallaLocalizationModalCss = "";
|
|
4
|
+
const sallaLocalizationModalCss = "#salla-localization .s-localization-modal-select{appearance:none;-webkit-appearance:none}";
|
|
5
5
|
|
|
6
6
|
const SallaLocalizationModal = class {
|
|
7
7
|
constructor(hostRef) {
|
|
@@ -68,7 +68,7 @@ const SallaLoginModal = class {
|
|
|
68
68
|
};
|
|
69
69
|
this.newUser = async () => {
|
|
70
70
|
var _a;
|
|
71
|
-
const { mobile: regPhone, countryCode, countryKey } = await this.regTelInput.getValues(), emailValue = this.regEmail.value || ((_a = this.loginEmail) === null || _a === void 0 ? void 0 : _a.value);
|
|
71
|
+
const { mobile: regPhone, countryCode, countryKey } = this.regType == "email" ? await this.regTelInput.getValues() : await this.loginTelInput.getValues(), emailValue = this.regEmail.value || ((_a = this.loginEmail) === null || _a === void 0 ? void 0 : _a.value);
|
|
72
72
|
await this.newUserValidation();
|
|
73
73
|
await this.regBtn.load();
|
|
74
74
|
await this.regBtn.disable();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-8b97d225.js';
|
|
2
2
|
import { H as Helper } from './Helper-7162a06c.js';
|
|
3
|
-
export { S as salla_search } from './salla-search-
|
|
3
|
+
export { S as salla_search } from './salla-search-7521be0c.js';
|
|
4
4
|
|
|
5
|
-
const sallaModalCss = "";
|
|
5
|
+
const sallaModalCss = ".salla-modal .s-modal-wrapper{height:calc(var(--vh, 1vh) * 100)}";
|
|
6
6
|
|
|
7
7
|
const SallaModal = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -19,7 +19,7 @@ const SallaOfferModal = class {
|
|
|
19
19
|
this.productSlot = ((_b = Helper.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.defaultProductSlot();
|
|
20
20
|
salla.offer.event.onExisted(data => {
|
|
21
21
|
//TODO:: use the best, should we hide the offer by product Id or Offer id🤔
|
|
22
|
-
if (salla.
|
|
22
|
+
if (salla.storage.get('remember-offer-' + data.offer.offer_id)) {
|
|
23
23
|
salla.log('User selected to don\'t show this offer again.');
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -46,7 +46,7 @@ const SallaOfferModal = class {
|
|
|
46
46
|
return this.modal.show();
|
|
47
47
|
}
|
|
48
48
|
rememberMe(event) {
|
|
49
|
-
salla.
|
|
49
|
+
salla.storage.set('remember-offer-' + this.offer.id, event.target.checked);
|
|
50
50
|
}
|
|
51
51
|
addItem() {
|
|
52
52
|
// this here, is sallaButton
|
|
@@ -30,7 +30,7 @@ const SallaProductAvailability = class {
|
|
|
30
30
|
.then(() => salla.api.product.availabilitySubscribe(data))
|
|
31
31
|
.then(() => {
|
|
32
32
|
this.isSubscribed = true;
|
|
33
|
-
salla.
|
|
33
|
+
salla.storage.set(`product-${this.productId}-subscribed`, true);
|
|
34
34
|
}) //no need to wait until finishing alert animation
|
|
35
35
|
.then(() => this.btn.stop())
|
|
36
36
|
.then(() => this.modal.hide())
|
|
@@ -63,7 +63,7 @@ const SallaProductAvailability = class {
|
|
|
63
63
|
this.channelsWatcher(this.channels);
|
|
64
64
|
this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
|
|
65
65
|
this.host.removeAttribute('title');
|
|
66
|
-
this.isVisitorSubscribed = salla.
|
|
66
|
+
this.isVisitorSubscribed = salla.storage.get(`product-${this.productId}-subscribed`);
|
|
67
67
|
}
|
|
68
68
|
channelsWatcher(newValue) {
|
|
69
69
|
this.channels_ = newValue.split(',');
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { r as registerInstance, h, g as getElement } from './index-8b97d225.js';
|
|
2
2
|
import { H as Helper } from './Helper-7162a06c.js';
|
|
3
3
|
|
|
4
|
-
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:50%;transform:translateY(-50%)}";
|
|
4
|
+
const sallaSearchCss = "#s-search-modal .s-search-inline{border:1px solid #eee}#s-search-modal .s-search-no-results .s-search-input,#s-search-modal .s-search-container-open .s-search-input{border-bottom:1px solid #f4f4f5}#s-search-modal .s-search-product-image[src=null]{opacity:0}#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;background:transparent;overflow:visible}#s-search-modal .s-modal-close{top:50%;transform:translateY(-50%)}";
|
|
5
5
|
|
|
6
6
|
const SallaSearch = class {
|
|
7
7
|
constructor(hostRef) {
|
|
8
8
|
registerInstance(this, hostRef);
|
|
9
9
|
var _a;
|
|
10
|
+
this.inputValue = '';
|
|
11
|
+
this.inline = false;
|
|
12
|
+
this.oval = false;
|
|
13
|
+
this.height = 60;
|
|
10
14
|
Helper.setHost(this.host);
|
|
11
15
|
this.productSlot = ((_a = Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
|
|
12
16
|
salla.event.on('search::show', () => this.modal.show());
|
|
@@ -22,6 +26,7 @@ const SallaSearch = class {
|
|
|
22
26
|
this.modal.querySelector('.s-search-input').value = '';
|
|
23
27
|
this.results = undefined;
|
|
24
28
|
this.afterSearching();
|
|
29
|
+
this.container.classList.remove('s-search-no-results');
|
|
25
30
|
}
|
|
26
31
|
getDefaultProductSlot() {
|
|
27
32
|
return '<div class="s-search-product-image-container">' +
|
|
@@ -33,6 +38,7 @@ const SallaSearch = class {
|
|
|
33
38
|
}
|
|
34
39
|
//todo:: reset data when closing
|
|
35
40
|
search(e) {
|
|
41
|
+
this.inputValue = e.target.value;
|
|
36
42
|
Helper.hideElement(this.noResults);
|
|
37
43
|
if (e.target.value.length === 0) {
|
|
38
44
|
this.results = undefined;
|
|
@@ -52,17 +58,22 @@ const SallaSearch = class {
|
|
|
52
58
|
afterSearching(isEmpty = true) {
|
|
53
59
|
var _a;
|
|
54
60
|
this.noResults.style.display = isEmpty || ((_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length) > 0 ? 'none' : 'block';
|
|
55
|
-
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
|
+
Helper.toggleElement(this.container, 's-search-container-open', 's-search-no-results', () => { var _a; return (_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length; })
|
|
56
62
|
.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => false); //stop searching anime
|
|
57
63
|
salla.search.api.previousQuery = ''; //avoid having error 'Query Same As Previous' after reopen modal;
|
|
64
|
+
this.inputValue.length == 0 ? this.container.classList.remove('s-search-no-results') : '';
|
|
58
65
|
}
|
|
59
66
|
render() {
|
|
60
67
|
var _a;
|
|
61
|
-
|
|
68
|
+
const searchContent = h("div", { class: { 's-search-container': true, 's-search-inline': this.inline }, ref: container => this.container = container, style: this.oval ? { borderRadius: this.height / 2 + 'px' } : {} }, h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e), style: { height: this.height + 'px' } }), h("span", { class: "s-search-icon-wrap" }, h("i", { class: "s-search-icon sicon-search", ref: el => this.searchIcon = el })), h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
|
|
62
69
|
_a.data.map(item => h("a", { href: item.url, class: "s-search-product", innerHTML: this.productSlot
|
|
63
70
|
.replace(/\{name\}/g, item.name)
|
|
64
71
|
.replace(/\{price\}/g, item.price) //todo:: get discounted price too
|
|
65
|
-
.replace(/\{image\}/g, item.image_url) })), h("p", { ref: el => this.noResults = el, class: "s-search-no-results" }, this.noResultsText)))
|
|
72
|
+
.replace(/\{image\}/g, item.image_url) })), h("p", { ref: el => this.noResults = el, class: "s-search-no-results-placeholder" }, this.noResultsText)));
|
|
73
|
+
return (this.inline ?
|
|
74
|
+
h("div", { id: "s-search-modal" }, searchContent)
|
|
75
|
+
:
|
|
76
|
+
h("salla-modal", { position: "top", id: "s-search-modal", ref: modal => this.modal = modal }, searchContent));
|
|
66
77
|
}
|
|
67
78
|
/**
|
|
68
79
|
* Run it one time after load
|
|
@@ -1445,10 +1445,8 @@ const SallaTelInput = class {
|
|
|
1445
1445
|
});
|
|
1446
1446
|
this.phoneInput.addEventListener("countrychange", () => {
|
|
1447
1447
|
let data = this.iti.getSelectedCountryData();
|
|
1448
|
-
this.
|
|
1449
|
-
this.
|
|
1450
|
-
input.value = ('+' + data.dialCode).replace('++', '+');
|
|
1451
|
-
});
|
|
1448
|
+
this.countryCodeInput.value = data.iso2.toUpperCase();
|
|
1449
|
+
this.countryKeyInput.value = ('+' + data.dialCode).replace('++', '+');
|
|
1452
1450
|
});
|
|
1453
1451
|
// on blur: validate
|
|
1454
1452
|
this.phoneInput.addEventListener('blur', () => this.isValid());
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["salla-button",[[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}]]],["salla-modal_2",[[0,"salla-search",{"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[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"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-login-modal",[[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],"show":[64]},[[0,"verified","onVerified"]]]]],["salla-product-availability",[[4,"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]}]]],["salla-branches",[[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]}]]],["salla-localization-modal",[[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer-modal",[[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"show":[64],"showOffer":[64]}]]],["salla-rating-modal",[[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"show":[64],"hide":[64]}]]],["salla-infinite-scroll",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"nextPageAutoload":[1028,"next-page-autoload"],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]],["salla-verify-modal",[[4,"salla-verify-modal",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"autoReload":[4,"auto-reload"],"title":[32],"getCode":[64],"show":[64]}]]],["salla-tel-input",[[0,"salla-tel-input",{"mobile":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}]]]], options);
|
|
16
|
+
return bootstrapLazy([["salla-button",[[4,"salla-button",{"btnStyle":[513,"btn-style"],"icon":[516],"miniIcon":[516,"mini-icon"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}]]],["salla-modal_2",[[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[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"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-login-modal",[[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],"show":[64]},[[0,"verified","onVerified"]]]]],["salla-product-availability",[[4,"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]}]]],["salla-branches",[[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]}]]],["salla-localization-modal",[[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer-modal",[[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"show":[64],"showOffer":[64]}]]],["salla-rating-modal",[[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"show":[64],"hide":[64]}]]],["salla-infinite-scroll",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"nextPageAutoload":[1028,"next-page-autoload"],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]],["salla-verify-modal",[[4,"salla-verify-modal",{"withoutModal":[4,"without-modal"],"url":[513],"by":[1],"autoReload":[4,"auto-reload"],"title":[32],"getCode":[64],"show":[64]}]]],["salla-tel-input",[[0,"salla-tel-input",{"mobile":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}]]]], options);
|
|
17
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{S as SallaLoginModal}from"./p-
|
|
1
|
+
export{S as SallaLoginModal}from"./p-10ea748b.js";export{S as SallaSearch}from"./p-e4f716b0.js";import"./p-cb1c59a2.js";import"./p-ed1c00c5.js";
|