@salla.sa/twilight-components 1.0.17 → 1.0.18

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