@salla.sa/twilight-components 1.0.8 → 1.0.10
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-23b2de40.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 +86 -0
- package/dist/twilight-components/order-rating.entry.js +257 -0
- package/dist/{esm → twilight-components}/salla-button.entry.js +10 -6
- package/dist/{esm → twilight-components}/salla-localization.entry.js +8 -8
- 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 +84 -0
- package/dist/twilight-components/salla-product-availability.entry.js +55 -0
- package/dist/{esm/salla-search-5d4a6f1a.js → twilight-components/salla-search-df1c9b54.js} +2 -1
- package/dist/twilight-components/salla-search.entry.js +2 -0
- package/dist/{esm → twilight-components}/salla-verify.entry.js +5 -3
- package/dist/twilight-components/shadow-css-bc14d9fd.js +389 -0
- package/dist/twilight-components/twilight-components.esm.js +125 -1
- package/dist/types/components/multi-warehouse/multi-warehouse.d.ts +1 -0
- package/dist/types/components/order-rating/order-rating.d.ts +16 -10
- package/dist/types/components/salla-button/salla-button.d.ts +1 -1
- package/dist/types/components/salla-localization/salla-localization.d.ts +3 -3
- package/dist/types/components/salla-product-availability/salla-product-availability.d.ts +24 -0
- package/dist/types/components.d.ts +43 -2
- package/package.json +1 -1
- package/dist/cjs/Helper-8c75b6ac.js +0 -20
- 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_3.cjs.entry.js +0 -161
- package/dist/cjs/order-rating.cjs.entry.js +0 -252
- package/dist/cjs/salla-button.cjs.entry.js +0 -57
- package/dist/cjs/salla-localization.cjs.entry.js +0 -52
- package/dist/cjs/salla-login-476fb312.js +0 -14
- package/dist/cjs/salla-search-b9403062.js +0 -96
- package/dist/cjs/salla-search.cjs.entry.js +0 -10
- package/dist/cjs/salla-verify.cjs.entry.js +0 -94
- package/dist/cjs/twilight-components.cjs.js +0 -19
- package/dist/collection/Helpers/Helper.js +0 -16
- package/dist/collection/collection-manifest.json +0 -19
- package/dist/collection/components/generate-summary.js +0 -35
- package/dist/collection/components/multi-warehouse/multi-warehouse.js +0 -239
- package/dist/collection/components/order-rating/order-rating.css +0 -3
- package/dist/collection/components/order-rating/order-rating.js +0 -321
- package/dist/collection/components/salla-button/salla-button.css +0 -3
- package/dist/collection/components/salla-button/salla-button.js +0 -186
- package/dist/collection/components/salla-localization/salla-localization.js +0 -109
- package/dist/collection/components/salla-login/salla-login.js +0 -31
- package/dist/collection/components/salla-modal/salla-modal.js +0 -309
- package/dist/collection/components/salla-search/salla-search.js +0 -154
- package/dist/collection/components/salla-verify/salla-verify.js +0 -97
- 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_3.entry.js +0 -155
- package/dist/esm/order-rating.entry.js +0 -248
- 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-36c87e2e.js +0 -1
- package/dist/twilight-components/p-4b137380.js +0 -1
- package/dist/twilight-components/p-520446eb.js +0 -1
- package/dist/twilight-components/p-653bb9a8.entry.js +0 -1
- package/dist/twilight-components/p-a2395c9d.entry.js +0 -1
- package/dist/twilight-components/p-baeca520.entry.js +0 -1
- package/dist/twilight-components/p-bd10d8d5.entry.js +0 -1
- package/dist/twilight-components/p-d1ef2268.js +0 -1
- package/dist/twilight-components/p-ea986bca.entry.js +0 -1
- package/dist/twilight-components/p-f4340bd9.entry.js +0 -1
|
@@ -1,309 +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 = 'sicon-cancel';
|
|
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
|
-
Helper.toggleElement(this.host.querySelector('.s-modal-overlay'), 'ease-out duration-300 opacity-100', 'opacity-0', () => isOpen)
|
|
42
|
-
.toggleElement(this.host.querySelector('.s-modal-body'), 'ease-out duration-300 opacity-100 translate-y-0 sm:scale-100', //add these classes
|
|
43
|
-
'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95', //remove these classes
|
|
44
|
-
() => isOpen)
|
|
45
|
-
.toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
|
|
46
|
-
if (!isOpen) {
|
|
47
|
-
setTimeout(() => this.host.classList.add('hidden'), 350);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
closeModal() {
|
|
51
|
-
if (!this.isClosable) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
this.host.removeAttribute('visible');
|
|
55
|
-
}
|
|
56
|
-
render() {
|
|
57
|
-
this.host.id = this.host.id || 'salla-modal';
|
|
58
|
-
return (h(Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" },
|
|
59
|
-
h("div", { class: "s-modal-wrapper" },
|
|
60
|
-
h("div", { class: "s-modal-overlay", onClick: () => this.closeModal() }),
|
|
61
|
-
h("span", { class: "s-modal-spacer" }, "\u200B"),
|
|
62
|
-
h("div", { class: 's-modal-body ' + this.modalWidth },
|
|
63
|
-
h("slot", { name: "header" },
|
|
64
|
-
h("div", { class: "s-modal-header" },
|
|
65
|
-
this.isClosable ?
|
|
66
|
-
h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.closeModal(), type: "button" },
|
|
67
|
-
h("span", { class: "sicon-cancel" }))
|
|
68
|
-
: '',
|
|
69
|
-
this.error || this.success
|
|
70
|
-
? h("div", { class: { 's-modal-icon': true, 's-modal-bg-error': this.error, 's-modal-bg-success': this.success } },
|
|
71
|
-
h("i", { class: {
|
|
72
|
-
[this.icon]: true,
|
|
73
|
-
's-modal-text-error': this.error,
|
|
74
|
-
's-modal-text-success': this.success
|
|
75
|
-
} }))
|
|
76
|
-
: '',
|
|
77
|
-
h("div", { class: "s-modal-title", innerHTML: this.title }),
|
|
78
|
-
h("p", { class: "s-modal-sub-title", innerHTML: this.subTitle }))),
|
|
79
|
-
h("slot", null),
|
|
80
|
-
h("slot", { name: "footer" })))));
|
|
81
|
-
}
|
|
82
|
-
static get is() { return "salla-modal"; }
|
|
83
|
-
static get properties() { return {
|
|
84
|
-
"error": {
|
|
85
|
-
"type": "boolean",
|
|
86
|
-
"mutable": false,
|
|
87
|
-
"complexType": {
|
|
88
|
-
"original": "boolean",
|
|
89
|
-
"resolved": "boolean",
|
|
90
|
-
"references": {}
|
|
91
|
-
},
|
|
92
|
-
"required": false,
|
|
93
|
-
"optional": false,
|
|
94
|
-
"docs": {
|
|
95
|
-
"tags": [],
|
|
96
|
-
"text": ""
|
|
97
|
-
},
|
|
98
|
-
"attribute": "error",
|
|
99
|
-
"reflect": false,
|
|
100
|
-
"defaultValue": "false"
|
|
101
|
-
},
|
|
102
|
-
"success": {
|
|
103
|
-
"type": "boolean",
|
|
104
|
-
"mutable": false,
|
|
105
|
-
"complexType": {
|
|
106
|
-
"original": "boolean",
|
|
107
|
-
"resolved": "boolean",
|
|
108
|
-
"references": {}
|
|
109
|
-
},
|
|
110
|
-
"required": false,
|
|
111
|
-
"optional": false,
|
|
112
|
-
"docs": {
|
|
113
|
-
"tags": [],
|
|
114
|
-
"text": ""
|
|
115
|
-
},
|
|
116
|
-
"attribute": "success",
|
|
117
|
-
"reflect": false,
|
|
118
|
-
"defaultValue": "false"
|
|
119
|
-
},
|
|
120
|
-
"isClosable": {
|
|
121
|
-
"type": "boolean",
|
|
122
|
-
"mutable": true,
|
|
123
|
-
"complexType": {
|
|
124
|
-
"original": "boolean",
|
|
125
|
-
"resolved": "boolean",
|
|
126
|
-
"references": {}
|
|
127
|
-
},
|
|
128
|
-
"required": false,
|
|
129
|
-
"optional": false,
|
|
130
|
-
"docs": {
|
|
131
|
-
"tags": [],
|
|
132
|
-
"text": ""
|
|
133
|
-
},
|
|
134
|
-
"attribute": "is-closable",
|
|
135
|
-
"reflect": false,
|
|
136
|
-
"defaultValue": "true"
|
|
137
|
-
},
|
|
138
|
-
"modalWidth": {
|
|
139
|
-
"type": "string",
|
|
140
|
-
"mutable": false,
|
|
141
|
-
"complexType": {
|
|
142
|
-
"original": "string",
|
|
143
|
-
"resolved": "string",
|
|
144
|
-
"references": {}
|
|
145
|
-
},
|
|
146
|
-
"required": false,
|
|
147
|
-
"optional": false,
|
|
148
|
-
"docs": {
|
|
149
|
-
"tags": [],
|
|
150
|
-
"text": ""
|
|
151
|
-
},
|
|
152
|
-
"attribute": "modal-width",
|
|
153
|
-
"reflect": false,
|
|
154
|
-
"defaultValue": "'w-96'"
|
|
155
|
-
},
|
|
156
|
-
"visible": {
|
|
157
|
-
"type": "boolean",
|
|
158
|
-
"mutable": false,
|
|
159
|
-
"complexType": {
|
|
160
|
-
"original": "boolean",
|
|
161
|
-
"resolved": "boolean",
|
|
162
|
-
"references": {}
|
|
163
|
-
},
|
|
164
|
-
"required": false,
|
|
165
|
-
"optional": false,
|
|
166
|
-
"docs": {
|
|
167
|
-
"tags": [],
|
|
168
|
-
"text": ""
|
|
169
|
-
},
|
|
170
|
-
"attribute": "visible",
|
|
171
|
-
"reflect": true,
|
|
172
|
-
"defaultValue": "false"
|
|
173
|
-
},
|
|
174
|
-
"subTitle": {
|
|
175
|
-
"type": "string",
|
|
176
|
-
"mutable": false,
|
|
177
|
-
"complexType": {
|
|
178
|
-
"original": "string",
|
|
179
|
-
"resolved": "string",
|
|
180
|
-
"references": {}
|
|
181
|
-
},
|
|
182
|
-
"required": false,
|
|
183
|
-
"optional": false,
|
|
184
|
-
"docs": {
|
|
185
|
-
"tags": [],
|
|
186
|
-
"text": ""
|
|
187
|
-
},
|
|
188
|
-
"attribute": "sub-title",
|
|
189
|
-
"reflect": false,
|
|
190
|
-
"defaultValue": "''"
|
|
191
|
-
},
|
|
192
|
-
"icon": {
|
|
193
|
-
"type": "string",
|
|
194
|
-
"mutable": false,
|
|
195
|
-
"complexType": {
|
|
196
|
-
"original": "string",
|
|
197
|
-
"resolved": "string",
|
|
198
|
-
"references": {}
|
|
199
|
-
},
|
|
200
|
-
"required": false,
|
|
201
|
-
"optional": false,
|
|
202
|
-
"docs": {
|
|
203
|
-
"tags": [],
|
|
204
|
-
"text": ""
|
|
205
|
-
},
|
|
206
|
-
"attribute": "icon",
|
|
207
|
-
"reflect": false,
|
|
208
|
-
"defaultValue": "'sicon-cancel'"
|
|
209
|
-
}
|
|
210
|
-
}; }
|
|
211
|
-
static get events() { return [{
|
|
212
|
-
"method": "ready",
|
|
213
|
-
"name": "ready",
|
|
214
|
-
"bubbles": true,
|
|
215
|
-
"cancelable": true,
|
|
216
|
-
"composed": true,
|
|
217
|
-
"docs": {
|
|
218
|
-
"tags": [],
|
|
219
|
-
"text": ""
|
|
220
|
-
},
|
|
221
|
-
"complexType": {
|
|
222
|
-
"original": "any",
|
|
223
|
-
"resolved": "any",
|
|
224
|
-
"references": {}
|
|
225
|
-
}
|
|
226
|
-
}, {
|
|
227
|
-
"method": "close",
|
|
228
|
-
"name": "close",
|
|
229
|
-
"bubbles": true,
|
|
230
|
-
"cancelable": true,
|
|
231
|
-
"composed": true,
|
|
232
|
-
"docs": {
|
|
233
|
-
"tags": [],
|
|
234
|
-
"text": ""
|
|
235
|
-
},
|
|
236
|
-
"complexType": {
|
|
237
|
-
"original": "any",
|
|
238
|
-
"resolved": "any",
|
|
239
|
-
"references": {}
|
|
240
|
-
}
|
|
241
|
-
}]; }
|
|
242
|
-
static get methods() { return {
|
|
243
|
-
"show": {
|
|
244
|
-
"complexType": {
|
|
245
|
-
"signature": "() => Promise<HTMLElement>",
|
|
246
|
-
"parameters": [],
|
|
247
|
-
"references": {
|
|
248
|
-
"Promise": {
|
|
249
|
-
"location": "global"
|
|
250
|
-
},
|
|
251
|
-
"HTMLElement": {
|
|
252
|
-
"location": "global"
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
"return": "Promise<HTMLElement>"
|
|
256
|
-
},
|
|
257
|
-
"docs": {
|
|
258
|
-
"text": "",
|
|
259
|
-
"tags": []
|
|
260
|
-
}
|
|
261
|
-
},
|
|
262
|
-
"hide": {
|
|
263
|
-
"complexType": {
|
|
264
|
-
"signature": "() => Promise<HTMLElement>",
|
|
265
|
-
"parameters": [],
|
|
266
|
-
"references": {
|
|
267
|
-
"Promise": {
|
|
268
|
-
"location": "global"
|
|
269
|
-
},
|
|
270
|
-
"HTMLElement": {
|
|
271
|
-
"location": "global"
|
|
272
|
-
}
|
|
273
|
-
},
|
|
274
|
-
"return": "Promise<HTMLElement>"
|
|
275
|
-
},
|
|
276
|
-
"docs": {
|
|
277
|
-
"text": "",
|
|
278
|
-
"tags": []
|
|
279
|
-
}
|
|
280
|
-
},
|
|
281
|
-
"setTitle": {
|
|
282
|
-
"complexType": {
|
|
283
|
-
"signature": "(title: any) => Promise<HTMLElement>",
|
|
284
|
-
"parameters": [{
|
|
285
|
-
"tags": [],
|
|
286
|
-
"text": ""
|
|
287
|
-
}],
|
|
288
|
-
"references": {
|
|
289
|
-
"Promise": {
|
|
290
|
-
"location": "global"
|
|
291
|
-
},
|
|
292
|
-
"HTMLElement": {
|
|
293
|
-
"location": "global"
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
"return": "Promise<HTMLElement>"
|
|
297
|
-
},
|
|
298
|
-
"docs": {
|
|
299
|
-
"text": "",
|
|
300
|
-
"tags": []
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}; }
|
|
304
|
-
static get elementRef() { return "host"; }
|
|
305
|
-
static get watchers() { return [{
|
|
306
|
-
"propName": "visible",
|
|
307
|
-
"methodName": "handleVisible"
|
|
308
|
-
}]; }
|
|
309
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { Component, h, Host, Prop, State, Element } from '@stencil/core';
|
|
2
|
-
export class SallaSearch {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.fetchStatus = '';
|
|
5
|
-
this.showModal = false;
|
|
6
|
-
/**
|
|
7
|
-
* The text to overwrite search placeholder.
|
|
8
|
-
*/
|
|
9
|
-
this.searchPlaceholder = 'Search here ...';
|
|
10
|
-
/**
|
|
11
|
-
* The text to overwrite no results text.
|
|
12
|
-
*/
|
|
13
|
-
this.noResultsText = 'There are no results at the moment';
|
|
14
|
-
this.handleChange = event => {
|
|
15
|
-
this.searchTerm = event.target.value;
|
|
16
|
-
this.fetchStatus = 'loading';
|
|
17
|
-
this.showResult = false;
|
|
18
|
-
this.results = [];
|
|
19
|
-
if (this.searchTerm.length > 2) {
|
|
20
|
-
window.salla.search.api
|
|
21
|
-
.search(this.searchTerm)
|
|
22
|
-
.then(response => response)
|
|
23
|
-
.then(response => {
|
|
24
|
-
console.log('response', response);
|
|
25
|
-
this.fetchStatus = 'idle';
|
|
26
|
-
this.results = response.results;
|
|
27
|
-
this.showResult = true;
|
|
28
|
-
if (this.results.length < 1) {
|
|
29
|
-
this.fetchStatus = 'error';
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
.catch(err => {
|
|
33
|
-
this.showResult = true;
|
|
34
|
-
this.fetchStatus = 'error';
|
|
35
|
-
console.log(err);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
this.openSearch = () => {
|
|
40
|
-
this.searchTerm = '';
|
|
41
|
-
this.fetchStatus = '';
|
|
42
|
-
this.results = [];
|
|
43
|
-
this.showModal = true;
|
|
44
|
-
window.scrollTo(0, 0);
|
|
45
|
-
document.getElementsByTagName('html')[0].style.position = 'fixed';
|
|
46
|
-
document.getElementsByTagName('html')[0].style.overflowY = 'scroll';
|
|
47
|
-
};
|
|
48
|
-
this.closeSearch = () => {
|
|
49
|
-
this.searchTerm = '';
|
|
50
|
-
this.fetchStatus = '';
|
|
51
|
-
this.results = [];
|
|
52
|
-
document.getElementsByTagName('html')[0].style.position = 'static';
|
|
53
|
-
document.getElementsByTagName('html')[0].style.overflowY = 'auto';
|
|
54
|
-
this.showModal = false;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
componentWillLoad() {
|
|
58
|
-
this.hasSearchIconSlot = !!this.hostElement.querySelector('[slot="search-icon"]');
|
|
59
|
-
this.hasProductTemplateSlot = !!this.hostElement.querySelector('[slot="product-template"]');
|
|
60
|
-
if (this.hasProductTemplateSlot) {
|
|
61
|
-
this.productTemplateHtml = this.hostElement.querySelector('[slot="product-template"]').innerHTML;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
getProduct(item) {
|
|
65
|
-
var _a, _b;
|
|
66
|
-
// todo use art-template https://aui.github.io/art-template/docs/.
|
|
67
|
-
if (this.hasProductTemplateSlot) {
|
|
68
|
-
let product = this.productTemplateHtml
|
|
69
|
-
.replace("{title}", item.title)
|
|
70
|
-
.replace("{price}", (_a = item.price) === null || _a === void 0 ? void 0 : _a.after)
|
|
71
|
-
.replace("{url}", item.url)
|
|
72
|
-
.replace("{thumb}", item.thumb);
|
|
73
|
-
return (h("div", { class: "s-search-product", innerHTML: product }));
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
return (h("div", { class: "s-search-product" },
|
|
77
|
-
h("a", { target: "_blank", href: item.url, class: "s-search-product-image-container" },
|
|
78
|
-
h("img", { class: "s-search-product-image", src: item.thumb })),
|
|
79
|
-
h("div", { class: "s-search-product-details" },
|
|
80
|
-
h("div", { class: "s-search-product-title" }, item.title),
|
|
81
|
-
h("div", { class: "s-search-product-price" }, (_b = item.price) === null || _b === void 0 ? void 0 : _b.after))));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
render() {
|
|
85
|
-
return (h(Host, { class: "s-search" },
|
|
86
|
-
h("button", { type: "button", onClick: this.openSearch, class: "s-search-search-button-icon" }, this.hasSearchIconSlot ? (h("slot", { name: "search-icon" })) : (h("i", { class: "sicon-search font-bold" }))),
|
|
87
|
-
this.showModal && (h("div", { class: "s-search-container", style: { backgroundColor: 'rgba(0,0,0,0.5)' } },
|
|
88
|
-
h("div", { class: "s-search-wrapper", onClick: this.closeSearch },
|
|
89
|
-
h("div", { class: "s-search-inner", onClick: e => {
|
|
90
|
-
e.stopPropagation();
|
|
91
|
-
} },
|
|
92
|
-
h("div", { class: "s-search-search-box-container" },
|
|
93
|
-
h("div", { class: !this.showResult
|
|
94
|
-
? 's-search-search-box-inner'
|
|
95
|
-
: 's-search-search-box-inner-open' },
|
|
96
|
-
h("input", { class: "s-search-input", type: "text", placeholder: this.searchPlaceholder, value: this.searchTerm, onInput: event => this.handleChange(event) }),
|
|
97
|
-
this.fetchStatus != 'loading' ? (h("button", { class: "s-search-search-icon" },
|
|
98
|
-
h("i", { class: "sicon-search" }))) : (h("span", { class: "s-search-spinner" },
|
|
99
|
-
h("span", { class: "s-search-spinner-loader" }))))),
|
|
100
|
-
h("div", { class: "s-search-search-results" },
|
|
101
|
-
this.fetchStatus === 'error' && (h("p", { class: "s-search-no-results error p-4 text-sm text-gray-text" }, this.noResultsText)),
|
|
102
|
-
this.results &&
|
|
103
|
-
this.results.map(item => {
|
|
104
|
-
return this.getProduct(item);
|
|
105
|
-
}))))))));
|
|
106
|
-
}
|
|
107
|
-
static get is() { return "salla-search"; }
|
|
108
|
-
static get properties() { return {
|
|
109
|
-
"searchPlaceholder": {
|
|
110
|
-
"type": "string",
|
|
111
|
-
"mutable": false,
|
|
112
|
-
"complexType": {
|
|
113
|
-
"original": "string",
|
|
114
|
-
"resolved": "string",
|
|
115
|
-
"references": {}
|
|
116
|
-
},
|
|
117
|
-
"required": false,
|
|
118
|
-
"optional": false,
|
|
119
|
-
"docs": {
|
|
120
|
-
"tags": [],
|
|
121
|
-
"text": "The text to overwrite search placeholder."
|
|
122
|
-
},
|
|
123
|
-
"attribute": "search-placeholder",
|
|
124
|
-
"reflect": false,
|
|
125
|
-
"defaultValue": "'Search here ...'"
|
|
126
|
-
},
|
|
127
|
-
"noResultsText": {
|
|
128
|
-
"type": "string",
|
|
129
|
-
"mutable": false,
|
|
130
|
-
"complexType": {
|
|
131
|
-
"original": "string",
|
|
132
|
-
"resolved": "string",
|
|
133
|
-
"references": {}
|
|
134
|
-
},
|
|
135
|
-
"required": false,
|
|
136
|
-
"optional": false,
|
|
137
|
-
"docs": {
|
|
138
|
-
"tags": [],
|
|
139
|
-
"text": "The text to overwrite no results text."
|
|
140
|
-
},
|
|
141
|
-
"attribute": "no-results-text",
|
|
142
|
-
"reflect": false,
|
|
143
|
-
"defaultValue": "'There are no results at the moment'"
|
|
144
|
-
}
|
|
145
|
-
}; }
|
|
146
|
-
static get states() { return {
|
|
147
|
-
"searchTerm": {},
|
|
148
|
-
"results": {},
|
|
149
|
-
"fetchStatus": {},
|
|
150
|
-
"showResult": {},
|
|
151
|
-
"showModal": {}
|
|
152
|
-
}; }
|
|
153
|
-
static get elementRef() { return "hostElement"; }
|
|
154
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { Component, Element, h } from '@stencil/core';
|
|
2
|
-
import Helper from "../../Helpers/Helper";
|
|
3
|
-
export class SallaVerify {
|
|
4
|
-
constructor() {
|
|
5
|
-
Helper.setHost(this.host);
|
|
6
|
-
salla.event.on('profile::verify.mobile', data => this.show(data));
|
|
7
|
-
}
|
|
8
|
-
show({ international_mobile: mobile, _country_iso2: country_code }) {
|
|
9
|
-
this.mobile = mobile;
|
|
10
|
-
this.country_code = country_code;
|
|
11
|
-
this.resendTimer();
|
|
12
|
-
this.otpInputs = document.querySelectorAll('.s-verify-input');
|
|
13
|
-
this.otpInputs[0].focus();
|
|
14
|
-
Helper.onKeyUp('.s-verify-input', event => {
|
|
15
|
-
var _a, _b;
|
|
16
|
-
let key = event.keyCode || event.charCode;
|
|
17
|
-
salla.helpers.digitsOnly(event.target);
|
|
18
|
-
if (event.target.value) {
|
|
19
|
-
(_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
|
|
20
|
-
}
|
|
21
|
-
else if ([8, 46].includes(key)) {
|
|
22
|
-
(_b = event.target.previousElementSibling) === null || _b === void 0 ? void 0 : _b.focus();
|
|
23
|
-
}
|
|
24
|
-
this.toggleOTPSubmit();
|
|
25
|
-
});
|
|
26
|
-
Helper.on('paste', '.s-verify-input', event => {
|
|
27
|
-
let text = event.clipboardData.getData('text').toArabicDigits().replace(/[^0-9.]/g, '').replace('..', '.');
|
|
28
|
-
this.otpInputs.forEach((input, i) => input.value = text[i] || '');
|
|
29
|
-
this.toggleOTPSubmit();
|
|
30
|
-
setTimeout(() => this.otpInputs[3].focus(), 100);
|
|
31
|
-
});
|
|
32
|
-
return this.modal.show();
|
|
33
|
-
}
|
|
34
|
-
toggleOTPSubmit() {
|
|
35
|
-
let otp = [];
|
|
36
|
-
this.otpInputs.forEach(input => input.value && otp.push(input.value));
|
|
37
|
-
this.code.value = otp.join('');
|
|
38
|
-
if (otp.length === 4) {
|
|
39
|
-
this.btn.removeAttribute('disabled');
|
|
40
|
-
this.btn.click();
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
this.btn.setAttribute('disabled', '');
|
|
44
|
-
}
|
|
45
|
-
resendTimer() {
|
|
46
|
-
Helper.showElement(this.resendMessage).hideElement(this.resend);
|
|
47
|
-
let resendAfter = 30;
|
|
48
|
-
let timerId = setInterval(() => {
|
|
49
|
-
if (resendAfter === -1) {
|
|
50
|
-
clearTimeout(timerId);
|
|
51
|
-
Helper.hideElement(this.resendMessage).showElement(this.resend);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
this.timer.innerHTML = `${resendAfter >= 10 ? resendAfter : '0' + resendAfter} : 00`;
|
|
55
|
-
resendAfter--;
|
|
56
|
-
}
|
|
57
|
-
}, 1000);
|
|
58
|
-
}
|
|
59
|
-
submit() {
|
|
60
|
-
return this.btn.load()
|
|
61
|
-
.then(() => this.btn.disable())
|
|
62
|
-
.then(() => salla.document.api.request('profile/verify-mobile', {
|
|
63
|
-
mobile: this.mobile,
|
|
64
|
-
country_code: this.country_code,
|
|
65
|
-
code: this.code.value
|
|
66
|
-
})).then(() => this.btn.stop() && this.btn.disable())
|
|
67
|
-
.then(() => this.modal.hide())
|
|
68
|
-
.then(() => window.location.reload())
|
|
69
|
-
.catch(() => this.btn.stop() && this.btn.enable());
|
|
70
|
-
}
|
|
71
|
-
resendCode() {
|
|
72
|
-
return this.btn.stop()
|
|
73
|
-
.then(() => this.btn.disable())
|
|
74
|
-
.then(() => {
|
|
75
|
-
this.otpInputs.forEach(input => input.value = '');
|
|
76
|
-
this.otpInputs[0].focus();
|
|
77
|
-
})
|
|
78
|
-
.then(() => salla.api.auth.resend({ phone: this.mobile, country_code: this.country_code }))
|
|
79
|
-
.then(() => this.resendTimer())
|
|
80
|
-
.catch(() => this.resendTimer());
|
|
81
|
-
}
|
|
82
|
-
render() {
|
|
83
|
-
return (h("salla-modal", { id: "s-verify", ref: modal => this.modal = modal, title: salla.lang.get('pages.profile.verify_title') },
|
|
84
|
-
h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }),
|
|
85
|
-
h("label", { class: "s-verify-label" }, salla.lang.get('pages.profile.verify_placeholder')),
|
|
86
|
-
h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }),
|
|
87
|
-
h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => h("input", { type: "text", maxlength: "1", class: "s-verify-input", required: true }))),
|
|
88
|
-
h("div", { slot: "footer", class: "s-verify-footer" },
|
|
89
|
-
h("salla-button", { class: "s-verify-submit", disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')),
|
|
90
|
-
h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el },
|
|
91
|
-
salla.lang.get('blocks.header.resend_after'),
|
|
92
|
-
h("b", { class: "s-verify-timer", ref: el => this.timer = el })),
|
|
93
|
-
h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit')))));
|
|
94
|
-
}
|
|
95
|
-
static get is() { return "salla-verify"; }
|
|
96
|
-
static get elementRef() { return "host"; }
|
|
97
|
-
}
|
package/dist/collection/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
var fs = require('fs');
|
|
2
|
-
var path = require('path');
|
|
3
|
-
var _ = require('lodash');
|
|
4
|
-
var components = {};
|
|
5
|
-
let componentsPath=path.resolve(__dirname,'../../components');
|
|
6
|
-
fs.readdirSync(componentsPath, {withFileTypes: true})
|
|
7
|
-
.filter(parent => parent.isDirectory())
|
|
8
|
-
.forEach(directory => {
|
|
9
|
-
try {
|
|
10
|
-
components[directory.name.replace('salla-','')] = require(path.resolve(componentsPath , directory.name, 'utilities.json'));
|
|
11
|
-
} catch (e) {
|
|
12
|
-
// ignore
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
var utilities = {};
|
|
16
|
-
|
|
17
|
-
for (const [keyComponent, value] of Object.entries(components)) {
|
|
18
|
-
console.log('> Processing ' + keyComponent + ' ...');
|
|
19
|
-
_.forEach(value, function(value, keyUtility) {
|
|
20
|
-
keyUtility = '.s-' + keyComponent + '-' + keyUtility;
|
|
21
|
-
utilities[keyUtility] = {[`@apply ${value}`]: {}};
|
|
22
|
-
});
|
|
23
|
-
console.log('✓ Processed ' + keyComponent + '');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// write the utilities for the plugin
|
|
27
|
-
console.log('> Write utilities ...');
|
|
28
|
-
fs.writeFileSync(
|
|
29
|
-
path.resolve(__dirname, 'utilities.json'),
|
|
30
|
-
JSON.stringify(utilities),
|
|
31
|
-
function(err) {
|
|
32
|
-
if (err) {
|
|
33
|
-
return console.log(err);
|
|
34
|
-
}
|
|
35
|
-
console.log('The file was saved!');
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
// write the save list css
|
|
41
|
-
console.log('> Write safe-list-css ...');
|
|
42
|
-
fs.writeFileSync(
|
|
43
|
-
path.resolve(__dirname, 'safe-list-css.txt'),
|
|
44
|
-
Object.keys(utilities).map((name) => name.replace('.','')).join('\n'),
|
|
45
|
-
function(err) {
|
|
46
|
-
if (err) {
|
|
47
|
-
return console.log(err);
|
|
48
|
-
}
|
|
49
|
-
console.log('The file was saved!');
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
console.log('✓ Done ...');
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
module.exports = require('tailwindcss/plugin').withOptions(() => {
|
|
2
|
-
return function({addUtilities}) {
|
|
3
|
-
addUtilities({
|
|
4
|
-
// TODO :: find if there are used and defined them here if its.
|
|
5
|
-
'.anime-item': {},
|
|
6
|
-
'.text-md': {},
|
|
7
|
-
'.items-top': {},
|
|
8
|
-
'.error': {},
|
|
9
|
-
'.search-box': {},
|
|
10
|
-
'.spinner-loader-wrap': {}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
// todo :: move it to global
|
|
14
|
-
addUtilities({
|
|
15
|
-
'.spinner-loader': {
|
|
16
|
-
'border-right-color': 'var(--main-color) !important',
|
|
17
|
-
'&.reverse': {
|
|
18
|
-
'border-right-color': '#9f7171 !important',
|
|
19
|
-
'background-color': '#f98181'
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
addUtilities(require('./utilities.json'));
|
|
25
|
-
};
|
|
26
|
-
});
|