@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,273 +0,0 @@
1
- import { Component, Element, Event, h, Method, Prop } from '@stencil/core';
2
- import Helper from "../../Helpers/Helper";
3
- export class SallaVerify {
4
- constructor() {
5
- this.url = 'profile/verify-mobile';
6
- this.by = 'sms';
7
- this.autoReload = true;
8
- Helper.setHost(this.host);
9
- if (this.withoutModal) {
10
- this.modal = { show: () => '', hide: () => '' };
11
- }
12
- else {
13
- salla.event.on('profile::verify.mobile', data => this.show(data));
14
- }
15
- }
16
- async getCode() {
17
- return this.code.value;
18
- }
19
- async show(data) {
20
- this.data = data;
21
- this.resendTimer();
22
- this.otpInputs = document.querySelectorAll('.s-verify-input');
23
- this.otpInputs[0].focus();
24
- Helper.on('input', '.s-verify-input', e => salla.helpers.digitsOnly(e.target));
25
- Helper.onKeyUp('.s-verify-input', event => {
26
- var _a, _b, _c, _d;
27
- let key = event.keyCode || event.charCode;
28
- if (event.target.value) {
29
- (_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
30
- (_b = event.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
31
- }
32
- else if ([8, 46].includes(key)) {
33
- (_c = event.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
34
- (_d = event.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
35
- }
36
- this.toggleOTPSubmit();
37
- });
38
- Helper.on('paste', '.s-verify-input', event => {
39
- let text = event.clipboardData.getData('text').toArabicDigits().replace(/[^0-9.]/g, '').replace('..', '.');
40
- this.otpInputs.forEach((input, i) => input.value = text[i] || '');
41
- this.toggleOTPSubmit();
42
- setTimeout(() => this.otpInputs[3].focus(), 100);
43
- });
44
- return this.modal.show();
45
- }
46
- toggleOTPSubmit() {
47
- let otp = [];
48
- this.otpInputs.forEach(input => input.value && otp.push(input.value));
49
- this.code.value = otp.join('');
50
- if (otp.length === 4) {
51
- this.btn.removeAttribute('disabled');
52
- this.btn.click();
53
- return;
54
- }
55
- this.btn.setAttribute('disabled', '');
56
- }
57
- resendTimer() {
58
- Helper.showElement(this.resendMessage).hideElement(this.resend);
59
- let resendAfter = 30;
60
- let timerId = setInterval(() => {
61
- if (resendAfter === -1) {
62
- clearTimeout(timerId);
63
- Helper.hideElement(this.resendMessage).showElement(this.resend);
64
- }
65
- else {
66
- this.timer.innerHTML = `${resendAfter >= 10 ? resendAfter : '0' + resendAfter} : 00`;
67
- resendAfter--;
68
- }
69
- }, 1000);
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(Object.assign({ resend_by: this.by }, this.data)))
79
- .then(() => this.resendTimer())
80
- .catch(() => this.resendTimer());
81
- }
82
- submit() {
83
- return this.btn.load()
84
- .then(() => this.btn.disable())
85
- .then(() => salla.document.api.request(this.url, Object.assign({ code: this.code.value }, this.data)))
86
- .then(response => this.verified.emit(response))
87
- .then(() => this.btn.stop() && this.btn.disable())
88
- .then(() => this.modal.hide())
89
- .then(() => this.autoReload && window.location.reload())
90
- .catch(() => this.btn.stop() && this.btn.enable());
91
- }
92
- render() {
93
- return this.withoutModal ? this.myBody() :
94
- h("salla-modal", { id: "s-verify", ref: modal => this.modal = modal, title: salla.lang.get('pages.profile.verify_title') }, this.myBody());
95
- }
96
- myBody() {
97
- return [
98
- h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }),
99
- // <label class="s-verify-label">{salla.lang.get('pages.profile.verify_placeholder')}</label>,
100
- h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }),
101
- 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 }))),
102
- h("div", { slot: "footer", class: "s-verify-footer" },
103
- h("salla-button", { class: "s-verify-submit", disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')),
104
- h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el },
105
- salla.lang.get('blocks.header.resend_after'),
106
- h("b", { class: "s-verify-timer", ref: el => this.timer = el })),
107
- h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit')),
108
- this.backText ?
109
- h("a", { href: "#", class: "s-verify-resend", onClick: () => this.backClicked.emit() }, this.backText)
110
- : '')
111
- ];
112
- }
113
- static get is() { return "salla-verify"; }
114
- static get properties() { return {
115
- "withoutModal": {
116
- "type": "boolean",
117
- "mutable": false,
118
- "complexType": {
119
- "original": "boolean",
120
- "resolved": "boolean",
121
- "references": {}
122
- },
123
- "required": false,
124
- "optional": false,
125
- "docs": {
126
- "tags": [],
127
- "text": "Should render component without modal"
128
- },
129
- "attribute": "without-modal",
130
- "reflect": false
131
- },
132
- "url": {
133
- "type": "string",
134
- "mutable": false,
135
- "complexType": {
136
- "original": "string",
137
- "resolved": "string",
138
- "references": {}
139
- },
140
- "required": false,
141
- "optional": false,
142
- "docs": {
143
- "tags": [],
144
- "text": ""
145
- },
146
- "attribute": "url",
147
- "reflect": false,
148
- "defaultValue": "'profile/verify-mobile'"
149
- },
150
- "by": {
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": "by",
165
- "reflect": false,
166
- "defaultValue": "'sms'"
167
- },
168
- "backText": {
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": "back-text",
183
- "reflect": false
184
- },
185
- "autoReload": {
186
- "type": "boolean",
187
- "mutable": false,
188
- "complexType": {
189
- "original": "boolean",
190
- "resolved": "boolean",
191
- "references": {}
192
- },
193
- "required": false,
194
- "optional": false,
195
- "docs": {
196
- "tags": [],
197
- "text": ""
198
- },
199
- "attribute": "auto-reload",
200
- "reflect": false,
201
- "defaultValue": "true"
202
- }
203
- }; }
204
- static get events() { return [{
205
- "method": "verified",
206
- "name": "verified",
207
- "bubbles": true,
208
- "cancelable": true,
209
- "composed": true,
210
- "docs": {
211
- "tags": [],
212
- "text": ""
213
- },
214
- "complexType": {
215
- "original": "any",
216
- "resolved": "any",
217
- "references": {}
218
- }
219
- }, {
220
- "method": "backClicked",
221
- "name": "backClicked",
222
- "bubbles": true,
223
- "cancelable": true,
224
- "composed": true,
225
- "docs": {
226
- "tags": [],
227
- "text": ""
228
- },
229
- "complexType": {
230
- "original": "any",
231
- "resolved": "any",
232
- "references": {}
233
- }
234
- }]; }
235
- static get methods() { return {
236
- "getCode": {
237
- "complexType": {
238
- "signature": "() => Promise<string>",
239
- "parameters": [],
240
- "references": {
241
- "Promise": {
242
- "location": "global"
243
- }
244
- },
245
- "return": "Promise<string>"
246
- },
247
- "docs": {
248
- "text": "",
249
- "tags": []
250
- }
251
- },
252
- "show": {
253
- "complexType": {
254
- "signature": "(data: any) => Promise<any>",
255
- "parameters": [{
256
- "tags": [],
257
- "text": ""
258
- }],
259
- "references": {
260
- "Promise": {
261
- "location": "global"
262
- }
263
- },
264
- "return": "Promise<any>"
265
- },
266
- "docs": {
267
- "text": "",
268
- "tags": []
269
- }
270
- }
271
- }; }
272
- static get elementRef() { return "host"; }
273
- }
@@ -1,2 +0,0 @@
1
- export * from './components/salla-login/salla-login';
2
- export * from './components/salla-search/salla-search';
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- export * from './colors';
2
- export * from './ratio';
@@ -1 +0,0 @@
1
- export {};
@@ -1,62 +0,0 @@
1
- var fs = require('fs');
2
- var path = require('path');
3
- var _ = require('lodash');
4
- var components = {};
5
- var componentsPath = path.resolve(__dirname, '../../components');
6
-
7
- //==================== Global Salla Components Styles ====================//
8
- var utilities = {
9
- '.s-has-error': {'@apply !border-red-500 !text-red-500': {}},
10
- '.s-ltr' : {direction: 'ltr'},
11
- '.s-input' : {'@apply appearance-none form-input': {}},
12
- '.s-hidden' : {'@apply hidden': {}},
13
- '.s-block' : {'@apply block': {}},
14
- };
15
-
16
- fs.readdirSync(componentsPath, {withFileTypes: true})
17
- .filter(parent => parent.isDirectory())
18
- .forEach(directory => {
19
- try {
20
- components[directory.name.replace('salla-', '')] = require(path.resolve(componentsPath, directory.name, 'utilities.json'));
21
- } catch (e) {
22
- // ignore
23
- }
24
- });
25
-
26
- for (const [keyComponent, value] of Object.entries(components)) {
27
- console.log('> Processing ' + keyComponent + ' ...');
28
- _.forEach(value, function (value, keyUtility) {
29
- keyUtility = '.s-' + keyComponent + '-' + keyUtility;
30
- utilities[keyUtility] = {[`@apply ${value}`]: {}};
31
- });
32
- console.log('✓ Processed ' + keyComponent + '');
33
- }
34
-
35
- // write the utilities for the plugin
36
- console.log('> Write utilities ...');
37
- fs.writeFileSync(
38
- path.resolve(__dirname, 'utilities.json'),
39
- JSON.stringify(utilities),
40
- function (err) {
41
- if (err) {
42
- return console.log(err);
43
- }
44
- console.log('The file was saved!');
45
- }
46
- );
47
-
48
-
49
- // write the save list css
50
- console.log('> Write safe-list-css ...');
51
- fs.writeFileSync(
52
- path.resolve(__dirname, 'safe-list-css.txt'),
53
- Object.keys(utilities).map((name) => name.replace('.', '')).join('\n'),
54
- function (err) {
55
- if (err) {
56
- return console.log(err);
57
- }
58
- console.log('The file was saved!');
59
- }
60
- );
61
-
62
- 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(--color-main) !important',
17
- '&.reverse': {
18
- 'border-right-color': '#9f7171 !important',
19
- 'background-color' : '#f98181'
20
- }
21
- }
22
- });
23
-
24
- addUtilities(require('./utilities.json'));
25
- };
26
- });