@salla.sa/twilight-components 1.0.12 → 1.0.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/{esm → twilight-components}/Helper-81ac9a8c.js +0 -0
- package/dist/twilight-components/app-globals-0f993ce5.js +3 -0
- package/dist/twilight-components/css-shim-a64b8820.js +4 -0
- package/dist/twilight-components/dom-d08ba8aa.js +73 -0
- package/dist/twilight-components/index-8cf58712.js +3010 -0
- package/dist/twilight-components/index.esm.js +3 -1
- package/dist/twilight-components/multi-warehouse.entry.js +89 -0
- package/dist/twilight-components/salla-button.entry.js +70 -0
- package/dist/{esm → twilight-components}/salla-localization.entry.js +8 -7
- package/dist/{esm/salla-login-0e85b2d8.js → twilight-components/salla-login-97e0a9ab.js} +1 -1
- package/dist/twilight-components/salla-login.entry.js +2 -0
- package/dist/twilight-components/salla-modal.entry.js +85 -0
- package/dist/{esm → twilight-components}/salla-product-availability.entry.js +12 -15
- package/dist/{esm → twilight-components}/salla-rating.entry.js +17 -17
- package/dist/{esm/salla-search-615b8f94.js → twilight-components/salla-search-df1c9b54.js} +1 -1
- package/dist/twilight-components/salla-search.entry.js +2 -0
- package/dist/{esm → twilight-components}/salla-verify.entry.js +1 -1
- package/dist/twilight-components/shadow-css-bc14d9fd.js +389 -0
- package/dist/twilight-components/twilight-components.esm.js +125 -1
- package/dist/types/components/salla-button/salla-button.d.ts +1 -0
- package/dist/types/components/salla-localization/salla-localization.d.ts +2 -2
- package/dist/types/components/salla-product-availability/salla-product-availability.d.ts +4 -3
- package/dist/types/components.d.ts +14 -10
- package/package.json +1 -1
- package/dist/cjs/Helper-8852feaa.js +0 -23
- package/dist/cjs/index-23da2c6b.js +0 -1601
- package/dist/cjs/index.cjs.js +0 -12
- package/dist/cjs/loader.cjs.js +0 -21
- package/dist/cjs/multi-warehouse_4.cjs.entry.js +0 -242
- package/dist/cjs/salla-localization.cjs.entry.js +0 -76
- package/dist/cjs/salla-login-476fb312.js +0 -14
- package/dist/cjs/salla-product-availability.cjs.entry.js +0 -78
- package/dist/cjs/salla-rating.cjs.entry.js +0 -299
- package/dist/cjs/salla-search-f9e00be9.js +0 -97
- package/dist/cjs/salla-search.cjs.entry.js +0 -10
- package/dist/cjs/salla-verify.cjs.entry.js +0 -96
- package/dist/cjs/twilight-components.cjs.js +0 -19
- package/dist/collection/Helpers/Helper.js +0 -19
- package/dist/collection/collection-manifest.json +0 -20
- package/dist/collection/components/generate-summary.js +0 -35
- package/dist/collection/components/multi-warehouse/multi-warehouse.css +0 -13
- package/dist/collection/components/multi-warehouse/multi-warehouse.js +0 -238
- package/dist/collection/components/salla-button/salla-button.css +0 -3
- package/dist/collection/components/salla-button/salla-button.js +0 -219
- package/dist/collection/components/salla-localization/salla-localization.js +0 -201
- package/dist/collection/components/salla-login/salla-login.js +0 -31
- package/dist/collection/components/salla-modal/salla-modal.js +0 -316
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +0 -316
- package/dist/collection/components/salla-rating/salla-rating.css +0 -3
- package/dist/collection/components/salla-rating/salla-rating.js +0 -484
- package/dist/collection/components/salla-search/salla-search.js +0 -155
- package/dist/collection/components/salla-verify/salla-verify.js +0 -99
- package/dist/collection/index.js +0 -2
- package/dist/collection/interfaces/colors.js +0 -1
- package/dist/collection/interfaces/index.js +0 -2
- package/dist/collection/interfaces/ratio.js +0 -1
- package/dist/collection/plugins/tailwind-theme/generator.js +0 -53
- package/dist/collection/plugins/tailwind-theme/index.js +0 -26
- package/dist/esm/index-643344dc.js +0 -1573
- package/dist/esm/index.js +0 -3
- package/dist/esm/loader.js +0 -17
- package/dist/esm/multi-warehouse_4.entry.js +0 -235
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/salla-search.entry.js +0 -2
- package/dist/esm/twilight-components.js +0 -17
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/twilight-components/p-2b8a5fa4.entry.js +0 -1
- package/dist/twilight-components/p-36c87e2e.js +0 -1
- package/dist/twilight-components/p-4e37a6cb.entry.js +0 -1
- package/dist/twilight-components/p-751643d8.entry.js +0 -1
- package/dist/twilight-components/p-8a2410e6.js +0 -1
- package/dist/twilight-components/p-94b18718.entry.js +0 -1
- package/dist/twilight-components/p-9bc28e0c.js +0 -1
- package/dist/twilight-components/p-bb503365.entry.js +0 -1
- package/dist/twilight-components/p-d1ef2268.js +0 -1
- package/dist/twilight-components/p-d34bbfc4.entry.js +0 -1
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Component, h } from '@stencil/core';
|
|
2
|
-
export class SallaLogin {
|
|
3
|
-
render() {
|
|
4
|
-
return (h("salla-modal", { id: "salla-login", title: "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644 \u0625\u0644\u0649 \u0627\u0644\u0645\u0648\u0642\u0639" },
|
|
5
|
-
h("div", { id: "showLoginMethods" },
|
|
6
|
-
h("p", { class: "text-sm text-gray-text mb-5" }, "\u0627\u062E\u062A\u0631 \u0627\u0644\u0648\u0633\u064A\u0644\u0629 \u0627\u0644\u0645\u0646\u0627\u0633\u0628\u0629"),
|
|
7
|
-
h("div", { id: "openEmailLogin", class: "mb-2.5 box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200" },
|
|
8
|
-
h("div", { class: "flex-shrink-0" },
|
|
9
|
-
h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" },
|
|
10
|
-
h("i", { class: "sicon-mail" }))),
|
|
11
|
-
h("div", { class: "flex-1 min-w-0" },
|
|
12
|
-
h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" },
|
|
13
|
-
h("div", { class: "flex-1" },
|
|
14
|
-
h("span", { class: "absolute inset-0", "aria-hidden": "true" }),
|
|
15
|
-
h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"),
|
|
16
|
-
h("h6", { class: "font-boldf" }, "\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A")),
|
|
17
|
-
h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))),
|
|
18
|
-
h("div", { class: "box-content relative rounded-md border border-border-color bg-white py-5 pe-4 ps-5 flex items-center space-s-3 hover:border-gray-200" },
|
|
19
|
-
h("div", { class: "flex-shrink-0" },
|
|
20
|
-
h("div", { class: "bg-primary w-12 h-12 text-lg text-white rounded-icon" },
|
|
21
|
-
h("i", { class: "sicon-phone" }))),
|
|
22
|
-
h("div", { class: "flex-1 min-w-0" },
|
|
23
|
-
h("a", { href: "#", class: "focus:outline-none flex justify-between items-center" },
|
|
24
|
-
h("div", { class: "flex-1" },
|
|
25
|
-
h("span", { class: "absolute inset-0", "aria-hidden": "true" }),
|
|
26
|
-
h("p", { class: "text-sm text-gray-text" }, "\u0633\u062C\u0644 \u062F\u062E\u0648\u0644"),
|
|
27
|
-
h("h6", { class: "font-boldf" }, "\u0627\u0644\u0647\u0627\u062A\u0641")),
|
|
28
|
-
h("i", { class: "sicon-keyboard_arrow_left text-primary text-xl" })))))));
|
|
29
|
-
}
|
|
30
|
-
static get is() { return "salla-login"; }
|
|
31
|
-
}
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { Component, h, Prop, Host, Element, Event, Watch, Method } from '@stencil/core';
|
|
2
|
-
import Helper from "../../Helpers/Helper";
|
|
3
|
-
//todo:: button component
|
|
4
|
-
export class SallaModal {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.error = false;
|
|
7
|
-
this.success = false;
|
|
8
|
-
this.isClosable = true;
|
|
9
|
-
this.modalWidth = 'w-96'; //todo use friendly names
|
|
10
|
-
this.visible = false;
|
|
11
|
-
this.subTitle = '';
|
|
12
|
-
this.icon = '';
|
|
13
|
-
salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.show());
|
|
14
|
-
salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
|
|
15
|
-
this.title = this.host.title;
|
|
16
|
-
this.host.removeAttribute('title');
|
|
17
|
-
}
|
|
18
|
-
handleVisible(newValue) {
|
|
19
|
-
if (!newValue) {
|
|
20
|
-
this.toggleModal(false);
|
|
21
|
-
this.close.emit();
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
this.host.classList.remove('hidden');
|
|
25
|
-
setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
|
|
26
|
-
this.ready.emit();
|
|
27
|
-
}
|
|
28
|
-
async show() {
|
|
29
|
-
this.host.setAttribute('visible', '');
|
|
30
|
-
return this.host;
|
|
31
|
-
}
|
|
32
|
-
async hide() {
|
|
33
|
-
this.host.removeAttribute('visible');
|
|
34
|
-
return this.host;
|
|
35
|
-
}
|
|
36
|
-
async setTitle(title) {
|
|
37
|
-
this.title = title;
|
|
38
|
-
return this.host;
|
|
39
|
-
}
|
|
40
|
-
toggleModal(isOpen) {
|
|
41
|
-
//todo:: use ref
|
|
42
|
-
Helper.toggleElement(this.host.querySelector('.s-modal-overlay'), 'ease-out duration-300 opacity-100', 'opacity-0', () => isOpen)
|
|
43
|
-
.toggleElement(this.host.querySelector('.s-modal-body'), 'ease-out duration-300 opacity-100 translate-y-0 sm:scale-100', //add these classes
|
|
44
|
-
'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95', //remove these classes
|
|
45
|
-
() => isOpen)
|
|
46
|
-
.toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
|
|
47
|
-
if (!isOpen) {
|
|
48
|
-
setTimeout(() => this.host.classList.add('hidden'), 350);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
closeModal() {
|
|
52
|
-
if (!this.isClosable) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
this.host.removeAttribute('visible');
|
|
56
|
-
}
|
|
57
|
-
//todo:: pref for each modal
|
|
58
|
-
render() {
|
|
59
|
-
this.host.id = this.host.id || 'salla-modal';
|
|
60
|
-
return (h(Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" },
|
|
61
|
-
h("div", { class: "s-modal-wrapper" },
|
|
62
|
-
h("div", { class: "s-modal-overlay", onClick: () => this.closeModal() }),
|
|
63
|
-
h("span", { class: "s-modal-spacer" }, "\u200B"),
|
|
64
|
-
h("div", { class: 's-modal-body ' + this.modalWidth },
|
|
65
|
-
h("div", { class: { 's-modal-header': true,
|
|
66
|
-
'text-center': this.icon != '' } },
|
|
67
|
-
this.isClosable ?
|
|
68
|
-
h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.closeModal(), type: "button" },
|
|
69
|
-
h("span", { class: "sicon-cancel" }))
|
|
70
|
-
: '',
|
|
71
|
-
this.error || this.success || this.icon
|
|
72
|
-
? h("div", { class: {
|
|
73
|
-
's-modal-icon': true,
|
|
74
|
-
's-modal-bg-error': this.error,
|
|
75
|
-
's-modal-bg-success': this.success,
|
|
76
|
-
's-modal-bg-normal': !this.error && !this.success
|
|
77
|
-
} },
|
|
78
|
-
h("i", { class: {
|
|
79
|
-
[this.icon]: true,
|
|
80
|
-
's-modal-text-error': this.error,
|
|
81
|
-
's-modal-text-success': this.success,
|
|
82
|
-
} }))
|
|
83
|
-
: '',
|
|
84
|
-
h("div", { class: "s-modal-title", innerHTML: this.title }),
|
|
85
|
-
h("p", { class: "s-modal-sub-title", innerHTML: this.subTitle })),
|
|
86
|
-
h("slot", null),
|
|
87
|
-
h("slot", { name: "footer" })))));
|
|
88
|
-
}
|
|
89
|
-
static get is() { return "salla-modal"; }
|
|
90
|
-
static get properties() { return {
|
|
91
|
-
"error": {
|
|
92
|
-
"type": "boolean",
|
|
93
|
-
"mutable": false,
|
|
94
|
-
"complexType": {
|
|
95
|
-
"original": "boolean",
|
|
96
|
-
"resolved": "boolean",
|
|
97
|
-
"references": {}
|
|
98
|
-
},
|
|
99
|
-
"required": false,
|
|
100
|
-
"optional": false,
|
|
101
|
-
"docs": {
|
|
102
|
-
"tags": [],
|
|
103
|
-
"text": ""
|
|
104
|
-
},
|
|
105
|
-
"attribute": "error",
|
|
106
|
-
"reflect": false,
|
|
107
|
-
"defaultValue": "false"
|
|
108
|
-
},
|
|
109
|
-
"success": {
|
|
110
|
-
"type": "boolean",
|
|
111
|
-
"mutable": false,
|
|
112
|
-
"complexType": {
|
|
113
|
-
"original": "boolean",
|
|
114
|
-
"resolved": "boolean",
|
|
115
|
-
"references": {}
|
|
116
|
-
},
|
|
117
|
-
"required": false,
|
|
118
|
-
"optional": false,
|
|
119
|
-
"docs": {
|
|
120
|
-
"tags": [],
|
|
121
|
-
"text": ""
|
|
122
|
-
},
|
|
123
|
-
"attribute": "success",
|
|
124
|
-
"reflect": false,
|
|
125
|
-
"defaultValue": "false"
|
|
126
|
-
},
|
|
127
|
-
"isClosable": {
|
|
128
|
-
"type": "boolean",
|
|
129
|
-
"mutable": true,
|
|
130
|
-
"complexType": {
|
|
131
|
-
"original": "boolean",
|
|
132
|
-
"resolved": "boolean",
|
|
133
|
-
"references": {}
|
|
134
|
-
},
|
|
135
|
-
"required": false,
|
|
136
|
-
"optional": false,
|
|
137
|
-
"docs": {
|
|
138
|
-
"tags": [],
|
|
139
|
-
"text": ""
|
|
140
|
-
},
|
|
141
|
-
"attribute": "is-closable",
|
|
142
|
-
"reflect": false,
|
|
143
|
-
"defaultValue": "true"
|
|
144
|
-
},
|
|
145
|
-
"modalWidth": {
|
|
146
|
-
"type": "string",
|
|
147
|
-
"mutable": false,
|
|
148
|
-
"complexType": {
|
|
149
|
-
"original": "string",
|
|
150
|
-
"resolved": "string",
|
|
151
|
-
"references": {}
|
|
152
|
-
},
|
|
153
|
-
"required": false,
|
|
154
|
-
"optional": false,
|
|
155
|
-
"docs": {
|
|
156
|
-
"tags": [],
|
|
157
|
-
"text": ""
|
|
158
|
-
},
|
|
159
|
-
"attribute": "modal-width",
|
|
160
|
-
"reflect": true,
|
|
161
|
-
"defaultValue": "'w-96'"
|
|
162
|
-
},
|
|
163
|
-
"visible": {
|
|
164
|
-
"type": "boolean",
|
|
165
|
-
"mutable": false,
|
|
166
|
-
"complexType": {
|
|
167
|
-
"original": "boolean",
|
|
168
|
-
"resolved": "boolean",
|
|
169
|
-
"references": {}
|
|
170
|
-
},
|
|
171
|
-
"required": false,
|
|
172
|
-
"optional": false,
|
|
173
|
-
"docs": {
|
|
174
|
-
"tags": [],
|
|
175
|
-
"text": ""
|
|
176
|
-
},
|
|
177
|
-
"attribute": "visible",
|
|
178
|
-
"reflect": true,
|
|
179
|
-
"defaultValue": "false"
|
|
180
|
-
},
|
|
181
|
-
"subTitle": {
|
|
182
|
-
"type": "string",
|
|
183
|
-
"mutable": false,
|
|
184
|
-
"complexType": {
|
|
185
|
-
"original": "string",
|
|
186
|
-
"resolved": "string",
|
|
187
|
-
"references": {}
|
|
188
|
-
},
|
|
189
|
-
"required": false,
|
|
190
|
-
"optional": false,
|
|
191
|
-
"docs": {
|
|
192
|
-
"tags": [],
|
|
193
|
-
"text": ""
|
|
194
|
-
},
|
|
195
|
-
"attribute": "sub-title",
|
|
196
|
-
"reflect": false,
|
|
197
|
-
"defaultValue": "''"
|
|
198
|
-
},
|
|
199
|
-
"icon": {
|
|
200
|
-
"type": "string",
|
|
201
|
-
"mutable": false,
|
|
202
|
-
"complexType": {
|
|
203
|
-
"original": "string",
|
|
204
|
-
"resolved": "string",
|
|
205
|
-
"references": {}
|
|
206
|
-
},
|
|
207
|
-
"required": false,
|
|
208
|
-
"optional": false,
|
|
209
|
-
"docs": {
|
|
210
|
-
"tags": [],
|
|
211
|
-
"text": ""
|
|
212
|
-
},
|
|
213
|
-
"attribute": "icon",
|
|
214
|
-
"reflect": false,
|
|
215
|
-
"defaultValue": "''"
|
|
216
|
-
}
|
|
217
|
-
}; }
|
|
218
|
-
static get events() { return [{
|
|
219
|
-
"method": "ready",
|
|
220
|
-
"name": "ready",
|
|
221
|
-
"bubbles": true,
|
|
222
|
-
"cancelable": true,
|
|
223
|
-
"composed": true,
|
|
224
|
-
"docs": {
|
|
225
|
-
"tags": [],
|
|
226
|
-
"text": ""
|
|
227
|
-
},
|
|
228
|
-
"complexType": {
|
|
229
|
-
"original": "any",
|
|
230
|
-
"resolved": "any",
|
|
231
|
-
"references": {}
|
|
232
|
-
}
|
|
233
|
-
}, {
|
|
234
|
-
"method": "close",
|
|
235
|
-
"name": "close",
|
|
236
|
-
"bubbles": true,
|
|
237
|
-
"cancelable": true,
|
|
238
|
-
"composed": true,
|
|
239
|
-
"docs": {
|
|
240
|
-
"tags": [],
|
|
241
|
-
"text": ""
|
|
242
|
-
},
|
|
243
|
-
"complexType": {
|
|
244
|
-
"original": "any",
|
|
245
|
-
"resolved": "any",
|
|
246
|
-
"references": {}
|
|
247
|
-
}
|
|
248
|
-
}]; }
|
|
249
|
-
static get methods() { return {
|
|
250
|
-
"show": {
|
|
251
|
-
"complexType": {
|
|
252
|
-
"signature": "() => Promise<HTMLElement>",
|
|
253
|
-
"parameters": [],
|
|
254
|
-
"references": {
|
|
255
|
-
"Promise": {
|
|
256
|
-
"location": "global"
|
|
257
|
-
},
|
|
258
|
-
"HTMLElement": {
|
|
259
|
-
"location": "global"
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
"return": "Promise<HTMLElement>"
|
|
263
|
-
},
|
|
264
|
-
"docs": {
|
|
265
|
-
"text": "",
|
|
266
|
-
"tags": []
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
"hide": {
|
|
270
|
-
"complexType": {
|
|
271
|
-
"signature": "() => Promise<HTMLElement>",
|
|
272
|
-
"parameters": [],
|
|
273
|
-
"references": {
|
|
274
|
-
"Promise": {
|
|
275
|
-
"location": "global"
|
|
276
|
-
},
|
|
277
|
-
"HTMLElement": {
|
|
278
|
-
"location": "global"
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
"return": "Promise<HTMLElement>"
|
|
282
|
-
},
|
|
283
|
-
"docs": {
|
|
284
|
-
"text": "",
|
|
285
|
-
"tags": []
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
"setTitle": {
|
|
289
|
-
"complexType": {
|
|
290
|
-
"signature": "(title: any) => Promise<HTMLElement>",
|
|
291
|
-
"parameters": [{
|
|
292
|
-
"tags": [],
|
|
293
|
-
"text": ""
|
|
294
|
-
}],
|
|
295
|
-
"references": {
|
|
296
|
-
"Promise": {
|
|
297
|
-
"location": "global"
|
|
298
|
-
},
|
|
299
|
-
"HTMLElement": {
|
|
300
|
-
"location": "global"
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
"return": "Promise<HTMLElement>"
|
|
304
|
-
},
|
|
305
|
-
"docs": {
|
|
306
|
-
"text": "",
|
|
307
|
-
"tags": []
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}; }
|
|
311
|
-
static get elementRef() { return "host"; }
|
|
312
|
-
static get watchers() { return [{
|
|
313
|
-
"propName": "visible",
|
|
314
|
-
"methodName": "handleVisible"
|
|
315
|
-
}]; }
|
|
316
|
-
}
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import { Component, Host, h, Prop, Watch, Element, Method } from '@stencil/core';
|
|
2
|
-
import Helper from "../../Helpers/Helper";
|
|
3
|
-
export class SallaProductAvailability {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.isUser = Helper.isUser();
|
|
6
|
-
this.buttonText = salla.lang.get('pages.products.notify_availability');
|
|
7
|
-
this.countryCode = salla.config.country_code || 'SA';
|
|
8
|
-
this.subscribe = salla.lang.get('common.elements.submit');
|
|
9
|
-
this.cancel = salla.lang.get('common.elements.cancel');
|
|
10
|
-
this.subTitle = salla.lang.get('pages.products.notify_availability_subtitle');
|
|
11
|
-
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
12
|
-
this.emailLabel = salla.lang.get('common.elements.email');
|
|
13
|
-
this.mobilePlaceholder = salla.lang.get('common.elements.mobile_placeholder');
|
|
14
|
-
this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder');
|
|
15
|
-
this.productId = salla.config.page.id;
|
|
16
|
-
this.subscribed = salla.lang.get('pages.products.notify_availability_success');
|
|
17
|
-
if (this.isUser) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
this.channelsWatcher(this.channels);
|
|
21
|
-
this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
|
|
22
|
-
this.host.removeAttribute('title');
|
|
23
|
-
}
|
|
24
|
-
channelsWatcher(newValue) {
|
|
25
|
-
this.channels_ = newValue.split(',');
|
|
26
|
-
}
|
|
27
|
-
async submit() {
|
|
28
|
-
if (this.isUser) {
|
|
29
|
-
return salla.api.product.availabilitySubscribe(this.productId)
|
|
30
|
-
.then(() => {
|
|
31
|
-
salla.success(this.subscribed);
|
|
32
|
-
}) //no need to wait until finishing alert animation
|
|
33
|
-
.then(() => this.host.remove());
|
|
34
|
-
}
|
|
35
|
-
let data = { id: this.productId, country_code: this.countryCode };
|
|
36
|
-
if (this.mobile.value !== '') {
|
|
37
|
-
data['mobile'] = this.mobile.value;
|
|
38
|
-
}
|
|
39
|
-
if (this.email.value !== '') {
|
|
40
|
-
data['email'] = this.email.value;
|
|
41
|
-
}
|
|
42
|
-
return this.btn.load()
|
|
43
|
-
.then(() => this.btn.disable())
|
|
44
|
-
.then(() => salla.api.product.availabilitySubscribe(data))
|
|
45
|
-
.then(() => {
|
|
46
|
-
salla.success(this.subscribed);
|
|
47
|
-
}) //no need to wait until finishing alert animation
|
|
48
|
-
.then(() => this.btn.stop())
|
|
49
|
-
.then(() => this.modal.hide())
|
|
50
|
-
.then(() => this.host.remove())
|
|
51
|
-
.catch(() => this.btn.stop() && this.btn.enable());
|
|
52
|
-
}
|
|
53
|
-
render() {
|
|
54
|
-
return (h(Host, null,
|
|
55
|
-
h("slot", null,
|
|
56
|
-
h("salla-button", { onClick: () => this.isUser ? this.submit() : this.modal.show() }, this.buttonText)),
|
|
57
|
-
this.isUser ? '' : this.renderModal()));
|
|
58
|
-
}
|
|
59
|
-
renderModal() {
|
|
60
|
-
return (h("salla-modal", { ref: modal => this.modal = modal, id: "product-availability-modal", title: this.title_, subTitle: this.subTitle, icon: "sicon-bell-ring", modalWidth: "w-full" },
|
|
61
|
-
h("div", { class: "s-product-availability-body" },
|
|
62
|
-
this.channels_.includes('email') ? [
|
|
63
|
-
h("label", { class: "s-product-availability-label" }, this.emailLabel),
|
|
64
|
-
h("input", { class: "s-product-availability-input", placeholder: this.emailPlaceholder, ref: el => this.email = el, type: "email" })
|
|
65
|
-
] : '',
|
|
66
|
-
this.channels_.includes('sms') ? [
|
|
67
|
-
h("label", { class: "s-product-availability-label" }, this.mobileLabel),
|
|
68
|
-
h("input", { class: "s-product-availability-input", placeholder: this.mobilePlaceholder, ref: el => this.mobile = el, type: "text" }),
|
|
69
|
-
h("input", { type: "hidden", value: this.countryCode }),
|
|
70
|
-
] : ''),
|
|
71
|
-
h("div", { slot: "footer", class: "common-anime flex justify-between space-s-4" },
|
|
72
|
-
h("salla-button", { ref: btn => this.btn = btn, class: "w-full", onClick: () => this.submit() }, this.subscribe),
|
|
73
|
-
h("salla-button", { class: "w-full", color: "outline" }, this.cancel))));
|
|
74
|
-
}
|
|
75
|
-
static get is() { return "salla-product-availability"; }
|
|
76
|
-
static get properties() { return {
|
|
77
|
-
"channels": {
|
|
78
|
-
"type": "string",
|
|
79
|
-
"mutable": false,
|
|
80
|
-
"complexType": {
|
|
81
|
-
"original": "string",
|
|
82
|
-
"resolved": "string",
|
|
83
|
-
"references": {}
|
|
84
|
-
},
|
|
85
|
-
"required": false,
|
|
86
|
-
"optional": false,
|
|
87
|
-
"docs": {
|
|
88
|
-
"tags": [],
|
|
89
|
-
"text": ""
|
|
90
|
-
},
|
|
91
|
-
"attribute": "channels",
|
|
92
|
-
"reflect": false
|
|
93
|
-
},
|
|
94
|
-
"buttonText": {
|
|
95
|
-
"type": "string",
|
|
96
|
-
"mutable": false,
|
|
97
|
-
"complexType": {
|
|
98
|
-
"original": "string",
|
|
99
|
-
"resolved": "string",
|
|
100
|
-
"references": {}
|
|
101
|
-
},
|
|
102
|
-
"required": false,
|
|
103
|
-
"optional": false,
|
|
104
|
-
"docs": {
|
|
105
|
-
"tags": [],
|
|
106
|
-
"text": ""
|
|
107
|
-
},
|
|
108
|
-
"attribute": "button-text",
|
|
109
|
-
"reflect": false,
|
|
110
|
-
"defaultValue": "salla.lang.get('pages.products.notify_availability')"
|
|
111
|
-
},
|
|
112
|
-
"countryCode": {
|
|
113
|
-
"type": "string",
|
|
114
|
-
"mutable": false,
|
|
115
|
-
"complexType": {
|
|
116
|
-
"original": "string",
|
|
117
|
-
"resolved": "string",
|
|
118
|
-
"references": {}
|
|
119
|
-
},
|
|
120
|
-
"required": false,
|
|
121
|
-
"optional": false,
|
|
122
|
-
"docs": {
|
|
123
|
-
"tags": [],
|
|
124
|
-
"text": ""
|
|
125
|
-
},
|
|
126
|
-
"attribute": "country-code",
|
|
127
|
-
"reflect": false,
|
|
128
|
-
"defaultValue": "salla.config.country_code || 'SA'"
|
|
129
|
-
},
|
|
130
|
-
"subscribe": {
|
|
131
|
-
"type": "string",
|
|
132
|
-
"mutable": false,
|
|
133
|
-
"complexType": {
|
|
134
|
-
"original": "string",
|
|
135
|
-
"resolved": "string",
|
|
136
|
-
"references": {}
|
|
137
|
-
},
|
|
138
|
-
"required": false,
|
|
139
|
-
"optional": false,
|
|
140
|
-
"docs": {
|
|
141
|
-
"tags": [],
|
|
142
|
-
"text": ""
|
|
143
|
-
},
|
|
144
|
-
"attribute": "subscribe",
|
|
145
|
-
"reflect": false,
|
|
146
|
-
"defaultValue": "salla.lang.get('common.elements.submit')"
|
|
147
|
-
},
|
|
148
|
-
"cancel": {
|
|
149
|
-
"type": "string",
|
|
150
|
-
"mutable": false,
|
|
151
|
-
"complexType": {
|
|
152
|
-
"original": "string",
|
|
153
|
-
"resolved": "string",
|
|
154
|
-
"references": {}
|
|
155
|
-
},
|
|
156
|
-
"required": false,
|
|
157
|
-
"optional": false,
|
|
158
|
-
"docs": {
|
|
159
|
-
"tags": [],
|
|
160
|
-
"text": ""
|
|
161
|
-
},
|
|
162
|
-
"attribute": "cancel",
|
|
163
|
-
"reflect": false,
|
|
164
|
-
"defaultValue": "salla.lang.get('common.elements.cancel')"
|
|
165
|
-
},
|
|
166
|
-
"subTitle": {
|
|
167
|
-
"type": "string",
|
|
168
|
-
"mutable": false,
|
|
169
|
-
"complexType": {
|
|
170
|
-
"original": "string",
|
|
171
|
-
"resolved": "string",
|
|
172
|
-
"references": {}
|
|
173
|
-
},
|
|
174
|
-
"required": false,
|
|
175
|
-
"optional": false,
|
|
176
|
-
"docs": {
|
|
177
|
-
"tags": [],
|
|
178
|
-
"text": ""
|
|
179
|
-
},
|
|
180
|
-
"attribute": "sub-title",
|
|
181
|
-
"reflect": false,
|
|
182
|
-
"defaultValue": "salla.lang.get('pages.products.notify_availability_subtitle')"
|
|
183
|
-
},
|
|
184
|
-
"mobileLabel": {
|
|
185
|
-
"type": "string",
|
|
186
|
-
"mutable": false,
|
|
187
|
-
"complexType": {
|
|
188
|
-
"original": "string",
|
|
189
|
-
"resolved": "string",
|
|
190
|
-
"references": {}
|
|
191
|
-
},
|
|
192
|
-
"required": false,
|
|
193
|
-
"optional": false,
|
|
194
|
-
"docs": {
|
|
195
|
-
"tags": [],
|
|
196
|
-
"text": ""
|
|
197
|
-
},
|
|
198
|
-
"attribute": "mobile-label",
|
|
199
|
-
"reflect": false,
|
|
200
|
-
"defaultValue": "salla.lang.get('common.elements.mobile')"
|
|
201
|
-
},
|
|
202
|
-
"emailLabel": {
|
|
203
|
-
"type": "string",
|
|
204
|
-
"mutable": false,
|
|
205
|
-
"complexType": {
|
|
206
|
-
"original": "string",
|
|
207
|
-
"resolved": "string",
|
|
208
|
-
"references": {}
|
|
209
|
-
},
|
|
210
|
-
"required": false,
|
|
211
|
-
"optional": false,
|
|
212
|
-
"docs": {
|
|
213
|
-
"tags": [],
|
|
214
|
-
"text": ""
|
|
215
|
-
},
|
|
216
|
-
"attribute": "email-label",
|
|
217
|
-
"reflect": false,
|
|
218
|
-
"defaultValue": "salla.lang.get('common.elements.email')"
|
|
219
|
-
},
|
|
220
|
-
"mobilePlaceholder": {
|
|
221
|
-
"type": "string",
|
|
222
|
-
"mutable": false,
|
|
223
|
-
"complexType": {
|
|
224
|
-
"original": "string",
|
|
225
|
-
"resolved": "string",
|
|
226
|
-
"references": {}
|
|
227
|
-
},
|
|
228
|
-
"required": false,
|
|
229
|
-
"optional": false,
|
|
230
|
-
"docs": {
|
|
231
|
-
"tags": [],
|
|
232
|
-
"text": ""
|
|
233
|
-
},
|
|
234
|
-
"attribute": "mobile-placeholder",
|
|
235
|
-
"reflect": false,
|
|
236
|
-
"defaultValue": "salla.lang.get('common.elements.mobile_placeholder')"
|
|
237
|
-
},
|
|
238
|
-
"emailPlaceholder": {
|
|
239
|
-
"type": "string",
|
|
240
|
-
"mutable": false,
|
|
241
|
-
"complexType": {
|
|
242
|
-
"original": "string",
|
|
243
|
-
"resolved": "string",
|
|
244
|
-
"references": {}
|
|
245
|
-
},
|
|
246
|
-
"required": false,
|
|
247
|
-
"optional": false,
|
|
248
|
-
"docs": {
|
|
249
|
-
"tags": [],
|
|
250
|
-
"text": ""
|
|
251
|
-
},
|
|
252
|
-
"attribute": "email-placeholder",
|
|
253
|
-
"reflect": false,
|
|
254
|
-
"defaultValue": "salla.lang.get('common.elements.email_placeholder')"
|
|
255
|
-
},
|
|
256
|
-
"productId": {
|
|
257
|
-
"type": "number",
|
|
258
|
-
"mutable": false,
|
|
259
|
-
"complexType": {
|
|
260
|
-
"original": "number",
|
|
261
|
-
"resolved": "number",
|
|
262
|
-
"references": {}
|
|
263
|
-
},
|
|
264
|
-
"required": false,
|
|
265
|
-
"optional": false,
|
|
266
|
-
"docs": {
|
|
267
|
-
"tags": [],
|
|
268
|
-
"text": ""
|
|
269
|
-
},
|
|
270
|
-
"attribute": "product-id",
|
|
271
|
-
"reflect": false,
|
|
272
|
-
"defaultValue": "salla.config.page.id"
|
|
273
|
-
},
|
|
274
|
-
"subscribed": {
|
|
275
|
-
"type": "string",
|
|
276
|
-
"mutable": false,
|
|
277
|
-
"complexType": {
|
|
278
|
-
"original": "string",
|
|
279
|
-
"resolved": "string",
|
|
280
|
-
"references": {}
|
|
281
|
-
},
|
|
282
|
-
"required": false,
|
|
283
|
-
"optional": false,
|
|
284
|
-
"docs": {
|
|
285
|
-
"tags": [],
|
|
286
|
-
"text": ""
|
|
287
|
-
},
|
|
288
|
-
"attribute": "subscribed",
|
|
289
|
-
"reflect": false,
|
|
290
|
-
"defaultValue": "salla.lang.get('pages.products.notify_availability_success')"
|
|
291
|
-
}
|
|
292
|
-
}; }
|
|
293
|
-
static get methods() { return {
|
|
294
|
-
"submit": {
|
|
295
|
-
"complexType": {
|
|
296
|
-
"signature": "() => Promise<any>",
|
|
297
|
-
"parameters": [],
|
|
298
|
-
"references": {
|
|
299
|
-
"Promise": {
|
|
300
|
-
"location": "global"
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
"return": "Promise<any>"
|
|
304
|
-
},
|
|
305
|
-
"docs": {
|
|
306
|
-
"text": "",
|
|
307
|
-
"tags": []
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}; }
|
|
311
|
-
static get elementRef() { return "host"; }
|
|
312
|
-
static get watchers() { return [{
|
|
313
|
-
"propName": "channels",
|
|
314
|
-
"methodName": "channelsWatcher"
|
|
315
|
-
}]; }
|
|
316
|
-
}
|