@salla.sa/twilight-components 1.0.19 → 1.0.21

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.
Files changed (92) hide show
  1. package/dist/{esm → twilight-components}/Helper-d07ebbc7.js +0 -0
  2. package/dist/twilight-components/app-globals-0f993ce5.js +3 -0
  3. package/dist/twilight-components/css-shim-a64b8820.js +4 -0
  4. package/dist/twilight-components/dom-d08ba8aa.js +73 -0
  5. package/dist/twilight-components/index-9c087700.js +3010 -0
  6. package/dist/twilight-components/index.esm.js +4 -1
  7. package/dist/{esm → twilight-components}/salla-branches.entry.js +1 -1
  8. package/dist/twilight-components/salla-button.entry.js +75 -0
  9. package/dist/{esm → twilight-components}/salla-localization.entry.js +1 -1
  10. package/dist/{esm/salla-login-38586400.js → twilight-components/salla-login-57b18c2c.js} +1 -1
  11. package/dist/twilight-components/salla-login.entry.js +3 -0
  12. package/dist/twilight-components/salla-modal.entry.js +113 -0
  13. package/dist/twilight-components/salla-offer.entry.js +75 -0
  14. package/dist/{esm → twilight-components}/salla-product-availability.entry.js +1 -1
  15. package/dist/twilight-components/salla-rating.entry.js +228 -0
  16. package/dist/{esm/salla-search-ca856aab.js → twilight-components/salla-search-30fec1e8.js} +1 -1
  17. package/dist/twilight-components/salla-search.entry.js +3 -0
  18. package/dist/{esm/salla-button_5.entry.js → twilight-components/salla-tel-input.entry.js} +33 -294
  19. package/dist/twilight-components/salla-verify.entry.js +114 -0
  20. package/dist/twilight-components/shadow-css-bc14d9fd.js +389 -0
  21. package/dist/twilight-components/twilight-components.css +3 -1
  22. package/dist/twilight-components/twilight-components.esm.js +125 -1
  23. package/dist/types/components/salla-offer/offer-schema.d.ts +47 -0
  24. package/dist/types/components/salla-offer/salla-offer.d.ts +13 -48
  25. package/dist/types/components/salla-rating/order-feedback-response.d.ts +62 -0
  26. package/dist/types/components/salla-rating/salla-rating.d.ts +25 -23
  27. package/dist/types/components.d.ts +2 -10
  28. package/package.json +1 -1
  29. package/dist/cjs/Helper-fcea994c.js +0 -23
  30. package/dist/cjs/index-4b8b3ffe.js +0 -1696
  31. package/dist/cjs/index.cjs.js +0 -13
  32. package/dist/cjs/loader.cjs.js +0 -21
  33. package/dist/cjs/salla-branches.cjs.entry.js +0 -92
  34. package/dist/cjs/salla-button_5.cjs.entry.js +0 -1686
  35. package/dist/cjs/salla-localization.cjs.entry.js +0 -82
  36. package/dist/cjs/salla-login-008cc893.js +0 -125
  37. package/dist/cjs/salla-offer.cjs.entry.js +0 -50
  38. package/dist/cjs/salla-product-availability.cjs.entry.js +0 -75
  39. package/dist/cjs/salla-rating.cjs.entry.js +0 -300
  40. package/dist/cjs/salla-search-c7aad59a.js +0 -81
  41. package/dist/cjs/salla-search.cjs.entry.js +0 -11
  42. package/dist/cjs/twilight-components.cjs.js +0 -19
  43. package/dist/collection/Helpers/Helper.js +0 -19
  44. package/dist/collection/collection-manifest.json +0 -22
  45. package/dist/collection/components/generate-summary.js +0 -35
  46. package/dist/collection/components/salla-branches/salla-branches.css +0 -12
  47. package/dist/collection/components/salla-branches/salla-branches.js +0 -233
  48. package/dist/collection/components/salla-button/salla-button.css +0 -3
  49. package/dist/collection/components/salla-button/salla-button.js +0 -246
  50. package/dist/collection/components/salla-localization/salla-localization.js +0 -208
  51. package/dist/collection/components/salla-login/salla-login.css +0 -3
  52. package/dist/collection/components/salla-login/salla-login.js +0 -378
  53. package/dist/collection/components/salla-modal/salla-modal.js +0 -459
  54. package/dist/collection/components/salla-offer/salla-offer.js +0 -81
  55. package/dist/collection/components/salla-product-availability/salla-product-availability.js +0 -331
  56. package/dist/collection/components/salla-rating/salla-rating.css +0 -7
  57. package/dist/collection/components/salla-rating/salla-rating.js +0 -483
  58. package/dist/collection/components/salla-search/salla-search.js +0 -132
  59. package/dist/collection/components/salla-tel-input/salla-tel-input.js +0 -14
  60. package/dist/collection/components/salla-verify/salla-verify.js +0 -273
  61. package/dist/collection/index.js +0 -2
  62. package/dist/collection/interfaces/colors.js +0 -1
  63. package/dist/collection/interfaces/index.js +0 -2
  64. package/dist/collection/interfaces/ratio.js +0 -1
  65. package/dist/collection/plugins/tailwind-theme/generator.js +0 -62
  66. package/dist/collection/plugins/tailwind-theme/index.js +0 -26
  67. package/dist/esm/index-092659c7.js +0 -1668
  68. package/dist/esm/index.js +0 -4
  69. package/dist/esm/loader.js +0 -17
  70. package/dist/esm/polyfills/core-js.js +0 -11
  71. package/dist/esm/polyfills/css-shim.js +0 -1
  72. package/dist/esm/polyfills/dom.js +0 -79
  73. package/dist/esm/polyfills/es5-html-element.js +0 -1
  74. package/dist/esm/polyfills/index.js +0 -34
  75. package/dist/esm/polyfills/system.js +0 -6
  76. package/dist/esm/salla-offer.entry.js +0 -46
  77. package/dist/esm/salla-rating.entry.js +0 -296
  78. package/dist/esm/salla-search.entry.js +0 -3
  79. package/dist/esm/twilight-components.js +0 -17
  80. package/dist/index.cjs.js +0 -1
  81. package/dist/index.js +0 -1
  82. package/dist/twilight-components/p-03d0ec44.entry.js +0 -1
  83. package/dist/twilight-components/p-13a55257.entry.js +0 -1
  84. package/dist/twilight-components/p-160062c6.js +0 -1
  85. package/dist/twilight-components/p-47f17d3b.js +0 -1
  86. package/dist/twilight-components/p-5307c7b5.entry.js +0 -1
  87. package/dist/twilight-components/p-6a1f43c6.entry.js +0 -1
  88. package/dist/twilight-components/p-7088e517.entry.js +0 -1
  89. package/dist/twilight-components/p-924e3c88.js +0 -1
  90. package/dist/twilight-components/p-e8965b01.js +0 -1
  91. package/dist/twilight-components/p-ecb1b6cc.entry.js +0 -1
  92. package/dist/twilight-components/p-f11b401a.entry.js +0 -1
@@ -1,378 +0,0 @@
1
- import { Component, Element, h, Listen, Method, Prop } from '@stencil/core';
2
- import Helper from "../../Helpers/Helper";
3
- export class SallaLogin {
4
- constructor() {
5
- this.regType = 'sms';
6
- this.isLoginByMail = true;
7
- this.loginTypeTitle = salla.lang.get('blocks.header.select_login_way');
8
- this.loginText = salla.lang.get('blocks.header.login');
9
- this.smsLabel = salla.lang.get('blocks.header.sms');
10
- this.mobileLabel = salla.lang.get('common.elements.mobile');
11
- this.emailLabel = salla.lang.get('common.elements.email');
12
- this.enterText = salla.lang.get('blocks.header.enter');
13
- this.bySMSText = salla.lang.get('blocks.header.login_by_sms');
14
- this.byEmailText = salla.lang.get('blocks.header.login_by_email');
15
- this.backText = salla.lang.get('common.elements.back');
16
- this.title = this.host.title || salla.lang.get('blocks.header.login');
17
- this.host.removeAttribute('title');
18
- salla.auth.event.onVerificationFailed(() => {
19
- //
20
- });
21
- }
22
- /**
23
- * @param {CustomEvent|{details:{case:'new_customer'|'authenticated', redirect_url:string|null}}} event
24
- */
25
- onVerified(event) {
26
- if (!event.detail.case) {
27
- console.log('verified but without case!');
28
- return;
29
- }
30
- if (event.detail.case === "new_customer") {
31
- return this.showTab(this.tab5);
32
- }
33
- //TODO::It looks that is this workaround🤔
34
- if (salla.auth.event.getTypeActionOnVerified() !== 'redirect') {
35
- return;
36
- }
37
- if (event.redirect_url) {
38
- return window.location.href = event.redirect_url;
39
- }
40
- window.location.reload();
41
- }
42
- onbackClicked() {
43
- this.regType == 'sms' ? this.showTab(this.tab2) : this.showTab(this.tab3);
44
- }
45
- async show() {
46
- this.showTab(this.isLoginByMail ? this.tab1 : this.tab2);
47
- return this.modal.show();
48
- }
49
- showTab(tab) {
50
- [this.tab1, this.tab2, this.tab3, this.tab4, this.tab5].map(el => Helper.toggleElement(el, 'visible', 'hidden', () => el == tab));
51
- setTimeout(() => { [this.tab1, this.tab2, this.tab3, this.tab4, this.tab5].map(el => Helper.toggleElement(el, 's-login-active', 's-login-unactive', () => el == tab)); }, 200);
52
- setTimeout(() => { this.host.querySelector('.s-login-wrapper').setAttribute('style', 'height:' + (tab === null || tab === void 0 ? void 0 : tab.scrollHeight) + 'px'); });
53
- if ([this.tab2, this.tab3].includes(tab)) {
54
- this.regType = tab === this.tab2 ? 'sms' : 'email';
55
- }
56
- let isRegistrationTab = tab == this.tab5;
57
- this.modal.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
58
- if (!isRegistrationTab) {
59
- Helper.toggleElement(this.regMobileBlock, 's-hidden', 's-block', () => this.regType === 'sms')
60
- .toggleElement(this.regEmailBlock, 's-hidden', 's-block', () => this.regType === 'email');
61
- }
62
- return this;
63
- }
64
- loginByEmail() {
65
- if (!Helper.isValidEmail(this.email.value)) {
66
- this.email.classList.add('s-has-error');
67
- this.email.nextElementSibling['innerText'] = '* ' + salla.lang.get('common.elements.email_is_valid');
68
- return;
69
- }
70
- this.email.nextElementSibling['innerText'] = '';
71
- this.email.classList.remove('s-has-error');
72
- salla.auth.api.login({ type: 'email', email: this.email.value })
73
- .then(() => this.showTab(this.tab4))
74
- .then(() => (this.tab4.by = 'email') && (this.tab4.url = 'auth/email/verify'))
75
- .then(() => this.tab4.show({ email: this.email.value }));
76
- }
77
- loginBySMS() {
78
- if (this.mobile.value.length < 6) {
79
- this.mobile.classList.add('s-has-error');
80
- this.mobile.nextElementSibling['innerText'] = '* ' + salla.lang.get('mobile_app.strings.incorrect_mobile');
81
- return;
82
- }
83
- this.mobile.nextElementSibling['innerText'] = '';
84
- this.mobile.classList.remove('s-has-error');
85
- salla.auth.api.login({ type: 'sms', mobile: this.mobile.value })
86
- .then(() => this.showTab(this.tab4))
87
- .then(() => (this.tab4.by = 'sms') && (this.tab4.url = 'auth/mobile/verify'))
88
- .then(() => this.tab4.show({ mobile: this.mobile.value, country_code: 'SA' }));
89
- }
90
- //TODO:: if it's enter, go submit
91
- typing({ target }) {
92
- target.type === 'tel' && salla.helpers.digitsOnly(target);
93
- target.classList.remove('s-has-error');
94
- target.nextElementSibling.innerText = '';
95
- }
96
- newUser() {
97
- this.tab4.getCode()
98
- .then(code => salla.auth.api.register({
99
- first_name: this.firstName.value,
100
- last_name: this.lastName.value,
101
- phone: this.regMobile.value || this.mobile.value,
102
- email: this.regEmail.value || this.email.value,
103
- country_code: '',
104
- country_key: '',
105
- code: code,
106
- verified_by: this.regType,
107
- }));
108
- }
109
- render() {
110
- return (h("salla-modal", { id: "salla-login", title: this.title, ref: modal => this.modal = modal, width: "xs" },
111
- h("div", { class: "s-login-wrapper" },
112
- this.isLoginByMail ?
113
- h("div", { class: "s-login-tab", ref: tab => this.tab1 = tab },
114
- h("p", { class: "s-login-sub-title" }, this.loginTypeTitle),
115
- h("a", { href: "#", class: "s-login-main-btn", onClick: () => this.showTab(this.tab2) },
116
- h("i", { class: "s-login-main-btn-icon sicon-phone" }),
117
- h("span", { class: "s-login-main-btn-text" }, this.smsLabel),
118
- h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })),
119
- h("a", { href: "#", class: "s-login-main-btn", onClick: () => this.showTab(this.tab3) },
120
- h("i", { class: "s-login-main-btn-icon sicon-mail" }),
121
- h("span", { class: "s-login-main-btn-text" }, this.emailLabel),
122
- h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })))
123
- : '',
124
- h("div", { class: "s-login-tab", ref: tab => this.tab2 = tab },
125
- h("label", { class: "s-login-label" }, this.mobileLabel),
126
- h("salla-tel-input", null),
127
- h("input", { onChange: () => this.loginBySMS(), type: "tel", ref: el => this.mobile = el, onInput: this.typing, placeholder: "5xx xxx xxx", class: "s-login-input tel-input s-ltr" }),
128
- h("span", { class: "s-login-error-message" }),
129
- h("salla-button", { wide: true, onClick: () => this.loginBySMS() }, this.enterText),
130
- this.isLoginByMail ? h("a", { href: "#", onClick: () => this.showTab(this.tab3), class: "s-login-link" }, this.byEmailText) : ''),
131
- this.isLoginByMail ?
132
- h("div", { class: "s-login-tab", ref: tab => this.tab3 = tab },
133
- h("label", { class: "s-login-label" }, this.emailLabel),
134
- h("input", { onChange: () => this.loginByEmail(), type: "email", ref: el => this.email = el, onInput: this.typing, placeholder: "your@email.com", class: "s-login-input s-ltr" }),
135
- h("span", { class: "s-login-error-message" }),
136
- h("salla-button", { wide: true, onClick: () => this.loginByEmail() }, this.enterText),
137
- h("a", { href: "#", onClick: () => this.showTab(this.tab2), class: "s-login-link" }, this.bySMSText)) : '',
138
- h("salla-verify", { "without-modal": true, ref: tab => this.tab4 = tab, autoReload: false, "back-text": this.backText }),
139
- h("div", { ref: tab => this.tab5 = tab },
140
- h("label", { class: "s-login-label" }, salla.lang.get('blocks.header.your_name')),
141
- h("input", { type: "text", class: "s-login-input", ref: el => this.firstName = el, placeholder: salla.lang.get('pages.profile.first_name') }),
142
- h("label", { class: "s-login-label" }, salla.lang.get('pages.profile.last_name')),
143
- h("input", { type: "text", class: "s-login-input", ref: el => this.lastName = el, placeholder: salla.lang.get('pages.profile.last_name') }),
144
- h("div", { ref: el => this.regMobileBlock = el },
145
- h("label", { class: "s-login-label" }, this.mobileLabel),
146
- h("input", { type: "tel", ref: el => this.regMobile = el, onInput: this.typing, placeholder: "5xx xxx xxx", class: "s-login-input s-ltr" }),
147
- h("span", { class: "s-login-error-message" })),
148
- h("div", { ref: el => this.regEmailBlock = el },
149
- h("label", { class: "s-login-label" }, this.emailLabel),
150
- h("input", { type: "email", ref: el => this.regEmail = el, onInput: this.typing, placeholder: "your@email.com", class: "s-login-input s-ltr" }),
151
- h("span", { class: "s-login-error-message" })),
152
- h("salla-button", { wide: true, onClick: () => this.newUser() }, salla.lang.get('blocks.header.register'))))));
153
- }
154
- static get is() { return "salla-login"; }
155
- static get originalStyleUrls() { return {
156
- "$": ["salla-login.css"]
157
- }; }
158
- static get styleUrls() { return {
159
- "$": ["salla-login.css"]
160
- }; }
161
- static get properties() { return {
162
- "isLoginByMail": {
163
- "type": "boolean",
164
- "mutable": false,
165
- "complexType": {
166
- "original": "boolean",
167
- "resolved": "boolean",
168
- "references": {}
169
- },
170
- "required": false,
171
- "optional": false,
172
- "docs": {
173
- "tags": [],
174
- "text": ""
175
- },
176
- "attribute": "is-login-by-mail",
177
- "reflect": false,
178
- "defaultValue": "true"
179
- },
180
- "loginTypeTitle": {
181
- "type": "string",
182
- "mutable": false,
183
- "complexType": {
184
- "original": "string",
185
- "resolved": "string",
186
- "references": {}
187
- },
188
- "required": false,
189
- "optional": false,
190
- "docs": {
191
- "tags": [],
192
- "text": ""
193
- },
194
- "attribute": "login-type-title",
195
- "reflect": false,
196
- "defaultValue": "salla.lang.get('blocks.header.select_login_way')"
197
- },
198
- "loginText": {
199
- "type": "string",
200
- "mutable": false,
201
- "complexType": {
202
- "original": "string",
203
- "resolved": "string",
204
- "references": {}
205
- },
206
- "required": false,
207
- "optional": false,
208
- "docs": {
209
- "tags": [],
210
- "text": ""
211
- },
212
- "attribute": "login-text",
213
- "reflect": false,
214
- "defaultValue": "salla.lang.get('blocks.header.login')"
215
- },
216
- "smsLabel": {
217
- "type": "string",
218
- "mutable": false,
219
- "complexType": {
220
- "original": "string",
221
- "resolved": "string",
222
- "references": {}
223
- },
224
- "required": false,
225
- "optional": false,
226
- "docs": {
227
- "tags": [],
228
- "text": ""
229
- },
230
- "attribute": "sms-label",
231
- "reflect": false,
232
- "defaultValue": "salla.lang.get('blocks.header.sms')"
233
- },
234
- "mobileLabel": {
235
- "type": "string",
236
- "mutable": false,
237
- "complexType": {
238
- "original": "string",
239
- "resolved": "string",
240
- "references": {}
241
- },
242
- "required": false,
243
- "optional": false,
244
- "docs": {
245
- "tags": [],
246
- "text": ""
247
- },
248
- "attribute": "mobile-label",
249
- "reflect": false,
250
- "defaultValue": "salla.lang.get('common.elements.mobile')"
251
- },
252
- "emailLabel": {
253
- "type": "string",
254
- "mutable": false,
255
- "complexType": {
256
- "original": "string",
257
- "resolved": "string",
258
- "references": {}
259
- },
260
- "required": false,
261
- "optional": false,
262
- "docs": {
263
- "tags": [],
264
- "text": ""
265
- },
266
- "attribute": "email-label",
267
- "reflect": false,
268
- "defaultValue": "salla.lang.get('common.elements.email')"
269
- },
270
- "enterText": {
271
- "type": "string",
272
- "mutable": false,
273
- "complexType": {
274
- "original": "string",
275
- "resolved": "string",
276
- "references": {}
277
- },
278
- "required": false,
279
- "optional": false,
280
- "docs": {
281
- "tags": [],
282
- "text": ""
283
- },
284
- "attribute": "enter-text",
285
- "reflect": false,
286
- "defaultValue": "salla.lang.get('blocks.header.enter')"
287
- },
288
- "bySMSText": {
289
- "type": "string",
290
- "mutable": false,
291
- "complexType": {
292
- "original": "string",
293
- "resolved": "string",
294
- "references": {}
295
- },
296
- "required": false,
297
- "optional": false,
298
- "docs": {
299
- "tags": [],
300
- "text": ""
301
- },
302
- "attribute": "by-s-m-s-text",
303
- "reflect": false,
304
- "defaultValue": "salla.lang.get('blocks.header.login_by_sms')"
305
- },
306
- "byEmailText": {
307
- "type": "string",
308
- "mutable": false,
309
- "complexType": {
310
- "original": "string",
311
- "resolved": "string",
312
- "references": {}
313
- },
314
- "required": false,
315
- "optional": false,
316
- "docs": {
317
- "tags": [],
318
- "text": ""
319
- },
320
- "attribute": "by-email-text",
321
- "reflect": false,
322
- "defaultValue": "salla.lang.get('blocks.header.login_by_email')"
323
- },
324
- "backText": {
325
- "type": "string",
326
- "mutable": false,
327
- "complexType": {
328
- "original": "string",
329
- "resolved": "string",
330
- "references": {}
331
- },
332
- "required": false,
333
- "optional": false,
334
- "docs": {
335
- "tags": [],
336
- "text": ""
337
- },
338
- "attribute": "back-text",
339
- "reflect": false,
340
- "defaultValue": "salla.lang.get('common.elements.back')"
341
- }
342
- }; }
343
- static get methods() { return {
344
- "show": {
345
- "complexType": {
346
- "signature": "() => Promise<HTMLElement>",
347
- "parameters": [],
348
- "references": {
349
- "Promise": {
350
- "location": "global"
351
- },
352
- "HTMLElement": {
353
- "location": "global"
354
- }
355
- },
356
- "return": "Promise<HTMLElement>"
357
- },
358
- "docs": {
359
- "text": "",
360
- "tags": []
361
- }
362
- }
363
- }; }
364
- static get elementRef() { return "host"; }
365
- static get listeners() { return [{
366
- "name": "verified",
367
- "method": "onVerified",
368
- "target": undefined,
369
- "capture": false,
370
- "passive": false
371
- }, {
372
- "name": "backClicked",
373
- "method": "onbackClicked",
374
- "target": undefined,
375
- "capture": false,
376
- "passive": false
377
- }]; }
378
- }