@salla.sa/twilight-components 1.0.10 → 1.0.12

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 (86) hide show
  1. package/dist/cjs/Helper-8852feaa.js +23 -0
  2. package/dist/cjs/index-23da2c6b.js +1601 -0
  3. package/dist/cjs/index.cjs.js +12 -0
  4. package/dist/cjs/loader.cjs.js +21 -0
  5. package/dist/cjs/multi-warehouse_4.cjs.entry.js +242 -0
  6. package/dist/cjs/salla-localization.cjs.entry.js +76 -0
  7. package/dist/cjs/salla-login-476fb312.js +14 -0
  8. package/dist/cjs/salla-product-availability.cjs.entry.js +78 -0
  9. package/dist/cjs/salla-rating.cjs.entry.js +299 -0
  10. package/dist/cjs/salla-search-f9e00be9.js +97 -0
  11. package/dist/cjs/salla-search.cjs.entry.js +10 -0
  12. package/dist/cjs/salla-verify.cjs.entry.js +96 -0
  13. package/dist/cjs/twilight-components.cjs.js +19 -0
  14. package/dist/collection/Helpers/Helper.js +19 -0
  15. package/dist/collection/collection-manifest.json +20 -0
  16. package/dist/collection/components/generate-summary.js +35 -0
  17. package/dist/collection/components/multi-warehouse/multi-warehouse.css +13 -0
  18. package/dist/collection/components/multi-warehouse/multi-warehouse.js +238 -0
  19. package/dist/collection/components/salla-button/salla-button.css +3 -0
  20. package/dist/collection/components/salla-button/salla-button.js +219 -0
  21. package/dist/collection/components/salla-localization/salla-localization.js +201 -0
  22. package/dist/collection/components/salla-login/salla-login.js +31 -0
  23. package/dist/collection/components/salla-modal/salla-modal.js +316 -0
  24. package/dist/collection/components/salla-product-availability/salla-product-availability.js +316 -0
  25. package/dist/collection/components/salla-rating/salla-rating.css +3 -0
  26. package/dist/collection/components/salla-rating/salla-rating.js +484 -0
  27. package/dist/collection/components/salla-search/salla-search.js +155 -0
  28. package/dist/collection/components/salla-verify/salla-verify.js +99 -0
  29. package/dist/collection/index.js +2 -0
  30. package/dist/collection/interfaces/colors.js +1 -0
  31. package/dist/collection/interfaces/index.js +2 -0
  32. package/dist/collection/interfaces/ratio.js +1 -0
  33. package/dist/collection/plugins/tailwind-theme/generator.js +53 -0
  34. package/dist/collection/plugins/tailwind-theme/index.js +26 -0
  35. package/dist/{twilight-components/Helper-23b2de40.js → esm/Helper-81ac9a8c.js} +3 -0
  36. package/dist/esm/index-643344dc.js +1573 -0
  37. package/dist/esm/index.js +3 -0
  38. package/dist/esm/loader.js +17 -0
  39. package/dist/esm/multi-warehouse_4.entry.js +235 -0
  40. package/dist/esm/polyfills/core-js.js +11 -0
  41. package/dist/esm/polyfills/css-shim.js +1 -0
  42. package/dist/esm/polyfills/dom.js +79 -0
  43. package/dist/esm/polyfills/es5-html-element.js +1 -0
  44. package/dist/esm/polyfills/index.js +34 -0
  45. package/dist/esm/polyfills/system.js +6 -0
  46. package/dist/esm/salla-localization.entry.js +72 -0
  47. package/dist/{twilight-components/salla-login-97e0a9ab.js → esm/salla-login-0e85b2d8.js} +1 -1
  48. package/dist/{twilight-components → esm}/salla-product-availability.entry.js +38 -19
  49. package/dist/esm/salla-rating.entry.js +295 -0
  50. package/dist/{twilight-components/salla-search-df1c9b54.js → esm/salla-search-615b8f94.js} +1 -1
  51. package/dist/esm/salla-search.entry.js +2 -0
  52. package/dist/{twilight-components → esm}/salla-verify.entry.js +2 -2
  53. package/dist/esm/twilight-components.js +17 -0
  54. package/dist/index.cjs.js +1 -0
  55. package/dist/index.js +1 -0
  56. package/dist/twilight-components/index.esm.js +1 -3
  57. package/dist/twilight-components/p-2b8a5fa4.entry.js +1 -0
  58. package/dist/twilight-components/p-36c87e2e.js +1 -0
  59. package/dist/twilight-components/p-4e37a6cb.entry.js +1 -0
  60. package/dist/twilight-components/p-751643d8.entry.js +1 -0
  61. package/dist/twilight-components/p-8a2410e6.js +1 -0
  62. package/dist/twilight-components/p-94b18718.entry.js +1 -0
  63. package/dist/twilight-components/p-9bc28e0c.js +1 -0
  64. package/dist/twilight-components/p-bb503365.entry.js +1 -0
  65. package/dist/twilight-components/p-d1ef2268.js +1 -0
  66. package/dist/twilight-components/p-d34bbfc4.entry.js +1 -0
  67. package/dist/twilight-components/twilight-components.esm.js +1 -125
  68. package/dist/types/Helpers/Helper.d.ts +1 -0
  69. package/dist/types/components/salla-button/salla-button.d.ts +2 -1
  70. package/dist/types/components/salla-localization/salla-localization.d.ts +9 -2
  71. package/dist/types/components/salla-product-availability/salla-product-availability.d.ts +6 -3
  72. package/dist/types/components/{order-rating/order-rating.d.ts → salla-rating/salla-rating.d.ts} +13 -4
  73. package/dist/types/components.d.ts +40 -24
  74. package/package.json +1 -1
  75. package/dist/twilight-components/app-globals-0f993ce5.js +0 -3
  76. package/dist/twilight-components/css-shim-a64b8820.js +0 -4
  77. package/dist/twilight-components/dom-d08ba8aa.js +0 -73
  78. package/dist/twilight-components/index-8cf58712.js +0 -3010
  79. package/dist/twilight-components/multi-warehouse.entry.js +0 -86
  80. package/dist/twilight-components/order-rating.entry.js +0 -257
  81. package/dist/twilight-components/salla-button.entry.js +0 -57
  82. package/dist/twilight-components/salla-localization.entry.js +0 -48
  83. package/dist/twilight-components/salla-login.entry.js +0 -2
  84. package/dist/twilight-components/salla-modal.entry.js +0 -84
  85. package/dist/twilight-components/salla-search.entry.js +0 -2
  86. package/dist/twilight-components/shadow-css-bc14d9fd.js +0 -389
@@ -1,86 +0,0 @@
1
- import { r as registerInstance, h, g as getElement } from './index-8cf58712.js';
2
-
3
- // import Helper from "../../Helpers/Helper";
4
- let engine = require('store/src/store-engine');
5
- let storages = require('store/storages/sessionStorage');
6
- let sessionStore = engine.createStore(storages);
7
- const MultiWarehouse = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- this.open = false;
11
- this.isOpenedBefore = sessionStore.get("multi-warehouse-opened-before");
12
- this.displayAs = 'default';
13
- this.browseProductsFrom = 'all';
14
- this.branches = [
15
- { id: 1, name: 'فرع الرياض', open: true, available: true, limited: false, tag: 'متوفر' },
16
- { id: 2, name: 'فرع جدة', open: false, available: false, limited: false, tag: 'غير متوفر' },
17
- { id: 3, name: 'فرع مكة', open: true, available: true, limited: false, tag: 'متوفر' },
18
- { id: 4, name: 'فرع المدينة', open: true, available: true, limited: false, tag: 'متوفر' },
19
- { id: 5, name: 'فرع جازان', open: true, available: true, limited: true, tag: 'الكمية محدودة' }
20
- ];
21
- this.current = 1;
22
- this.currentBranch = (prop) => {
23
- return this.branches.filter((el) => el.id == this.current)[0][prop];
24
- };
25
- this.statusColor = (branch = null) => {
26
- return branch ?
27
- branch.limited ? 'text-red-400' : branch.available ? 'text-green-500' : 'text-gray-400'
28
- :
29
- this.currentBranch('limited') ? 'text-red-400' : this.currentBranch('available') ? 'text-green-500' : 'text-gray-400';
30
- };
31
- this.isChoiceable = () => {
32
- return (this.browseProductsFrom !== 'all' && this.position == 'single') || this.position == 'header';
33
- };
34
- this.formTitle = () => {
35
- return this.isChoiceable() ?
36
- 'توفر المنتج في الفروع الآخرى'
37
- : 'التسوق من فرع آخر';
38
- };
39
- salla.event.on('branches::show', () => this.show());
40
- }
41
- async show() {
42
- return this.modal.show();
43
- }
44
- async hide() {
45
- return this.modal.hide();
46
- }
47
- handelChange(event) {
48
- this.selected = event.target.value;
49
- }
50
- handleSubmit() {
51
- this.btn.load().then(() => {
52
- setTimeout(() => location.reload(), 2000);
53
- });
54
- sessionStore.set("multi-warehouse-opened-before", true);
55
- this.show();
56
- setTimeout(() => {
57
- this.current = this.selected;
58
- }, 300);
59
- }
60
- render() {
61
- return (h("salla-modal", { "is-closable": !this.isOpenedBefore && this.displayAs == 'popup' ? 'false' : 'true', ref: modal => this.modal = modal, "modal-width": "w-116", class: "hidden" }, h("slot", { name: "header" }, h("div", { slot: "header" })), h("div", null, h("div", { class: "text-right" }, h("div", { class: "flex items-center mb-8" }, h("div", { class: "flex-shrink-0 sm:mb-0 me-4" }, h("div", { class: "h-16 w-16 border border-gray-200 bg-white text-primary rounded-full flex justify-center items-center" }, h("span", { class: "sicon-store-alt" }))), h("div", null, h("p", { class: "mt-1 text-xs text-gray-400" }, "\u0623\u0646\u062A \u0627\u0644\u0622\u0646 \u062A\u062A\u0635\u0641\u062D \u0627\u0644\u0645\u062A\u062C\u0631 \u0645\u0646"), h("h4", { class: "text-base" }, "\u0641\u0631\u0639 \u0627\u0644\u0631\u064A\u0627\u0636"))), h("fieldset", { class: "mt-4" }, h("h4", { class: "text-sm text-gray-600 mb-6" }, this.formTitle()), h("legend", { class: "sr-only" }, this.formTitle()), this.branches.length <= 5 ?
62
- h("div", { class: "space-y-5" }, this.branches.map((branch) => h("div", { class: "flex items-center" }, h("input", { id: this.position + '_branch_' + branch.id, disabled: !branch.open && this.isChoiceable(), name: "lang", type: "radio", value: branch.id, onChange: (event) => this.handelChange(event), class: {
63
- 'me-3 focus:ring-primary h-4 w-4 text-primary border-gray-300': true,
64
- 'opacity-50': !branch.open,
65
- 'hidden': !this.isChoiceable()
66
- }, checked: this.current == branch.id }), h("label", { htmlFor: this.position + '_branch_' + branch.id, class: {
67
- 'flex items-center justify-between text-sm font-medium text-gray-700 flex-grow': true,
68
- 'cursor-pointer': this.isChoiceable()
69
- } }, h("span", { class: { 'opacity-50': !branch.open } }, branch.name), this.isChoiceable() ?
70
- h("small", { class: "text-red-400" }, branch.open ? '' : 'مُغلق')
71
- :
72
- h("span", { class: this.statusColor(branch) }, branch.tag)))))
73
- :
74
- h("select", { class: "w-full h-10 transition-colors duration-300 focus:ring-transparent focus:border-primary sm:text-sm border-gray-200 rounded-md appearance-none visibility_condition px-4", onInput: (event) => this.handelChange(event) }, this.branches.map(branch => (h("option", { value: branch.id, disabled: !branch.open, selected: this.selected == branch.id }, branch.name, " ", branch.open ? '' : '- مُغلق'))))))), this.isChoiceable() ?
75
- h("div", { slot: "footer", class: "mt-6" }, h("slot", { name: "footer" }, h("salla-button", { loading: true, ref: btn => this.btn = btn, onClick: () => this.handleSubmit(), class: "w-full" }, salla.lang.get('common.elements.ok'))))
76
- : ''));
77
- }
78
- componentDidRender() {
79
- if (!this.isOpenedBefore && this.displayAs == 'popup') {
80
- this.show();
81
- }
82
- }
83
- get host() { return getElement(this); }
84
- };
85
-
86
- export { MultiWarehouse as multi_warehouse };
@@ -1,257 +0,0 @@
1
- import { r as registerInstance, h, g as getElement } from './index-8cf58712.js';
2
- import { H as Helper } from './Helper-23b2de40.js';
3
-
4
- const orderRatingCss = ":host{display:block}";
5
-
6
- const OrderRating = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.stars = [1, 2, 3, 4, 5];
10
- this.order = {
11
- shipping: { id: 5622 },
12
- order_id: "179794",
13
- products: [
14
- // {
15
- // "title": "ميكروفون عالى الجودة",
16
- // "image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/pMdEEyMVpZFj4L1Hrdm2g48AuiSx0TrKULBiOnPo.jpg",
17
- // "price": "‏10,978.00 ر.س",
18
- // "qty": "‏2",
19
- // "totalBefore": "‏1120 ر.س",
20
- // "discount": "-5%",
21
- // "total": "‏1064 ر.س",
22
- // "id": "2314513454",
23
- // "getOptimusRouteKey": "7351233357"
24
- // },
25
- // {
26
- // "title": "وحدة تحكم لمشغل العاب",
27
- // "image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/NOa4kHvOkd1hBWHk3JIgAo1602oVACfuWGFz3vXv.jpg",
28
- // "price": "‏10,978.00 ر.س",
29
- // "qty": "‏2",
30
- // "totalBefore": "‏1120 ر.س",
31
- // "discount": "-5%",
32
- // "total": "‏1064 ر.س",
33
- // "id": "9842833",
34
- // "getOptimusRouteKey": "735152357"
35
- // },
36
- {
37
- "title": "ساعة ذكية بنظام اندرويد",
38
- "image": "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/T4kTqYNuPAZmPMLw1bx92RnjVMZyFszVXOUZQsFJ.jpg",
39
- "price": "‏10,978.00 ر.س",
40
- "qty": "‏2",
41
- "totalBefore": "‏1120 ر.س",
42
- "discount": "-5%",
43
- "total": "‏1064 ر.س",
44
- "id": "679822376",
45
- "getOptimusRouteKey": "73233357"
46
- }
47
- ],
48
- settings: {
49
- isProductsRating: true,
50
- isStoreRating: true,
51
- isShippingRating: true,
52
- }
53
- };
54
- this.ratingChain = Promise.resolve();
55
- this.stepsCount = 3;
56
- salla.event.on('order-rating::show', () => this.show());
57
- }
58
- async show() {
59
- return this.modal.show();
60
- }
61
- async hide() {
62
- return this.modal.hide();
63
- }
64
- componentDidRender() {
65
- this.show();
66
- this.initiateRating();
67
- }
68
- initiateRating() {
69
- this.highlightSelectedStars();
70
- this.starsRating();
71
- this.handleWizard();
72
- salla.event.on('submit::order-rating', () => this.sendRating().then(() => {
73
- Helper.toggle('.rating-wizard', 'hidden', 'is-closed', () => true);
74
- Helper.toggle('.thankyou-view', 'is-opened', 'hidden', () => true);
75
- // window.location.reload()
76
- }));
77
- }
78
- // handle wizard
79
- handleWizard() {
80
- let currentIndex = 0, steps = document.querySelectorAll(".step"), dots = document.querySelectorAll(".step-dot");
81
- Helper.onClick("#prev-btn", () => {
82
- currentIndex > 0 && currentIndex--;
83
- this.showActiveStep(steps, dots, currentIndex);
84
- currentIndex == 0 && Helper.toggle('#prev-btn', 'hidden', 'block', () => true);
85
- });
86
- Helper.onClick("#next-btn", () => {
87
- this.ratingValidation();
88
- currentIndex == this.stepsCount - 1 && salla.event.dispatch("submit::order-rating");
89
- currentIndex < this.stepsCount - 1 && currentIndex++;
90
- this.showActiveStep(steps, dots, currentIndex);
91
- Helper.toggle('#prev-btn', 'block', 'hidden', () => true);
92
- });
93
- }
94
- showActiveStep(steps, dots, currentIndex) {
95
- Helper.toggle('.step', 'hidden', 'active', () => true);
96
- Helper.toggle('.step-dot', 'bg-gray-200', 'bg-primay', () => true);
97
- Helper.toggleElement(steps[currentIndex], 'active', 'hidden', () => true);
98
- Helper.toggleElement(dots[currentIndex], 'bg-primary', 'bg-gray-200', () => true);
99
- }
100
- // send feedback rating and validation
101
- sendRating() {
102
- Helper.all('.rating-section', ratingSection => {
103
- let type = ratingSection.dataset.type;
104
- let formsData = [];
105
- ratingSection.querySelectorAll('.rating-outer-form')
106
- .forEach((form) => {
107
- let formData = {};
108
- form.querySelectorAll('[name]')
109
- .forEach(function (input) {
110
- let inputData = salla.helpers.inputData(input.name, input.value, formData);
111
- formData[inputData.name] = inputData.value;
112
- });
113
- formsData = [];
114
- formsData.push(formData);
115
- this.sendFeedback(type, formsData);
116
- });
117
- });
118
- return this.ratingChain;
119
- }
120
- sendFeedback(type, formsData) {
121
- if (!formsData || formsData.length == 0) {
122
- return;
123
- }
124
- salla.config.canLeave = false;
125
- this.ratingChain = salla.feedback.api[type](formsData[0])
126
- .then(function () {
127
- salla.config.canLeave = true;
128
- }).catch(() => salla.config.canLeave = true);
129
- }
130
- ratingValidation() {
131
- let errorMsg = '';
132
- document.querySelectorAll('.rating-section.active')
133
- .forEach((ratingSection) => {
134
- ratingSection.querySelectorAll('.rating-outer-form')
135
- .forEach((rating) => {
136
- let ratingInput = rating.querySelector('.rating_hidden_input');
137
- let commentInput = rating.querySelector('.comment');
138
- // let sectionTitle = rating.querySelector('.section-title');
139
- let validationMessage = rating.querySelector('.validation-message');
140
- if (ratingInput.value && commentInput.value && commentInput.value.length > 3) {
141
- commentInput.classList.remove('has-error');
142
- // sectionTitle?.classList.remove('has-error', 'text-red-400');
143
- validationMessage.innerHTML = '';
144
- return;
145
- }
146
- else if (commentInput.value && commentInput.value.length > 3) {
147
- commentInput.classList.remove('has-error');
148
- }
149
- else {
150
- commentInput.classList.add('has-error');
151
- }
152
- // sectionTitle?.classList.add('has-error', 'text-red-400');
153
- errorMsg = ratingInput.value
154
- ? (salla.lang.get('common.errors.not_less_than_chars', { chars: 4 }) + ' ' + commentInput.getAttribute('placeholder'))
155
- : (rating.dataset.starsError || salla.lang.get('pages.rating.rate_store_stars'));
156
- validationMessage.innerHTML = errorMsg;
157
- });
158
- });
159
- //Fire error to prevent sending rating
160
- if (errorMsg) {
161
- // scroll to first error
162
- let ratingErrors = document.querySelectorAll('.has-error');
163
- if (ratingErrors.length) {
164
- let firstError = ratingErrors[0].offsetTop;
165
- window.scrollTo({ top: firstError - 80 }); // 80 = fixed nav height
166
- }
167
- throw new Error(errorMsg);
168
- }
169
- }
170
- // handle star rating
171
- starsRating() {
172
- let selectedClasses = ['selected', 'text-theme-yellow'];
173
- // Listen for form submissions
174
- salla.document.event.onSubmit('.rate-element', function (event) {
175
- // Prevent form from submitting
176
- event.preventDefault();
177
- // Get the selected star - activeElement is not supported in safari
178
- var activeStars = event.target.querySelectorAll('.btn--star.hovered');
179
- var selected = activeStars[activeStars.length - 1];
180
- if (!selected)
181
- return;
182
- var selectedIndex = parseInt(selected.dataset.star, 10);
183
- event.target.querySelector('.rating_hidden_input').value = selectedIndex;
184
- // Get all stars in this form (only search in the form, not the whole document)
185
- // Loop through each star, and add or remove the `.selected` class to toggle highlighting
186
- event.target
187
- .querySelectorAll('.btn--star')
188
- .forEach(function (star, index) {
189
- if (index < selectedIndex) {
190
- // Selected star or before it, Add highlighting
191
- star.classList.add(...selectedClasses);
192
- return;
193
- }
194
- // After selected star, Remove highlight
195
- star.classList.remove(...selectedClasses);
196
- });
197
- // Remove aria-pressed from any previously selected star
198
- var previousRating = event.target.querySelector('.star[aria-pressed="true"]');
199
- if (previousRating) {
200
- previousRating.removeAttribute('aria-pressed');
201
- }
202
- // Add aria-pressed role to the selected button
203
- selected.setAttribute('aria-pressed', true);
204
- });
205
- }
206
- highlightSelectedStars() {
207
- let hover = ['hovered', 'text-theme-yellow'];
208
- Helper.all('.rate-element', el => {
209
- let starElements = el.querySelectorAll('.btn--star');
210
- // remove hovered state from stars ---
211
- el.addEventListener('mouseout', () => el.querySelectorAll('.btn--star').forEach(star => star.classList.remove(...hover)));
212
- starElements.forEach((starElement, index) => {
213
- starElement.addEventListener('mouseover', () => {
214
- starElement.classList.add(...hover);
215
- if (index <= 1) {
216
- starElement.previousElementSibling.tagName === 'BUTTON' ? starElement.previousElementSibling.classList.add(...hover) : null;
217
- }
218
- else {
219
- for (let i = 0; i < index; i++) {
220
- starElements[i].classList.add(...hover);
221
- }
222
- }
223
- });
224
- starElement.addEventListener('mouseout', () => {
225
- starElement.classList.contains(...hover) ? starElement.classList.remove(...hover) : null;
226
- });
227
- });
228
- });
229
- }
230
- // render
231
- render() {
232
- var _a;
233
- return (h("salla-modal", { id: "order-rating", class: "hidden", "modal-width": "w-200", ref: modal => this.modal = modal }, h("slot", { name: "header" }, h("div", { slot: "header", class: "font-bold text-lg" }, "\u062A\u0642\u064A\u064A\u0645 \u0627\u0644\u0637\u0644\u0628 (#13259046)")), h("div", { class: "rating-wizard pannel__body transition-all" }, this.order.settings.isStoreRating && this.renderStoreRating(), this.order.settings.isProductsRating && this.renderProductsRating(), this.order.settings.isShippingRating && this.renderShippingRating()), this.renderThanksView(), h("slot", { name: "footer" }, h("div", { slot: "footer", class: "pannel__footer relative flex justify-between items-center" }, h("button", { id: "prev-btn", class: "font-bold text-sm text-primary hidden" }, "\u0627\u0644\u0633\u0627\u0628\u0642"), h("ul", { class: "flex justify-center text-center space-s-1.5 flex-1" }, (_a = [...Array(this.stepsCount)]) === null || _a === void 0 ? void 0 : _a.map((item, index) => h("li", { class: `${index == 0 ? 'bg-primary' : 'bg-gray-200'} step-dot cursor-pointer w-2.5 h-2.5 rounded-full transition-colors duration-300` }))), h("button", { id: "next-btn", class: "btn btn-primary h-10 px-8 flex-none" }, "\u0627\u0644\u062A\u0627\u0644\u064A")))));
234
- }
235
- renderStoreRating() {
236
- return (h("section", { class: "step rating-section bg-white my-10 p-5 rounded-md mb-5 active", "data-type": "store" }, h("div", { class: "rating-outer-form text-center", "data-stars-error": "\u064A\u0631\u062C\u0649 \u062A\u0642\u064A\u064A\u0645 \u0627\u0644\u0645\u062A\u062C\u0631 \u0628\u0648\u0627\u0633\u0637\u0629 \u0627\u0644\u0646\u062C\u0645\u0627\u062A" }, h("input", { type: "hidden", name: "order_id", value: this.order.order_id }), h("input", { type: "hidden", name: "type", value: "store" }), h("div", { class: "flex flex-col items-center " }, h("div", { class: "w-28 h-28 border border-gray-200 rounded-full flex items-center justify-center mb-4" }, h("img", { src: "https://salla-dev.s3.eu-central-1.amazonaws.com/Mvyk/X3NKcY7nhaFQlR7kBBHvfDpMY48cerunKrmDA1gi.png", alt: "store name", class: "w-12 object-contain" })), h("h2", { class: "section-title text-lg font-bold mb-7" }, "\u0643\u064A\u0641 \u0643\u0627\u0646\u062A \u062A\u062C\u0631\u0628\u062A\u0643 \u0645\u0639 \u0627\u0644\u0645\u062A\u062C\u0631 \u0647\u0630\u0647 \u0627\u0644\u0645\u0631\u0629")), h("div", { class: "mb-2" }, h("textarea", { id: "storeReview", name: "comment", class: "form-input comment h-20", placeholder: "\u0627\u0636\u0641 \u0631\u0623\u064A\u0643 \u0639\u0646 \u0627\u0644\u0645\u062A\u062C\u0631.." })), h("div", { class: "rating-wrap flex items-center space-s-4 flex justify-center" }, h("form", { class: "rate-element rate-element--has-label" }, this.getStarsRating())), h("small", { class: "text-red-400 validation-message" }))));
237
- }
238
- renderProductsRating() {
239
- return (h("section", { class: "step rating-section products-section hidden", "data-type": "product" }, h("div", { class: "bg-white mb-5 rounded-md overflow-hidden mb-10 pt-14" }, this.order.products.map((item, index) => {
240
- var _a;
241
- return h("div", { class: "rating-outer-form", "data-stars-error": `يرجى تقييم (${item.title}) بواسطة النجمات` }, h("div", { class: "product-item mb-4" }, h("div", { class: "mb-5" }, h("div", { class: "flex space-s-5 mb-8" }, h("img", { src: item.image, alt: item.title, class: "w-18 h-14 object-cover rounded-md" }), h("div", { class: "flex-1" }, h("h3", { class: "section-title leading-5 mb-1.5 font-bold md:text-sm" }, " ", item.title), h("div", { class: "rw-product-entry__rate" }, h("div", { class: "rating-wrap flex items-center space-s-4" }, h("form", { class: "rate-element rate-element--has-label" }, this.getStarsRating())), h("input", { type: "hidden", name: "order_id", value: (_a = this.order) === null || _a === void 0 ? void 0 : _a.order_id }), h("input", { type: "hidden", name: `products[${index}][product_id]`, value: item.getOptimusRouteKey }), h("input", { type: "hidden", name: "type", value: "products" }), h("textarea", { "data-product-id": item.id, name: `products[${index}][comment]`, id: `productReview_${item.id}`, class: "comment form-input h-20 product-review", placeholder: `اضف رأيك عن المنتج (${item.title})` }), h("small", { class: "text-red-400 validation-message" })))))));
242
- }))));
243
- }
244
- renderShippingRating() {
245
- return (h("section", { class: "step rating-section bg-white my-10 p-5 rounded-md mb-5 hidden", "data-type": "shipping" }, h("div", { class: "rating-outer-form text-center", "data-stars-error": "\u064A\u0631\u062C\u0649 \u062A\u0642\u064A\u064A\u0645 \u0634\u0631\u0643\u0629 \u0627\u0644\u0634\u062D\u0646 \u0628\u0648\u0627\u0633\u0637\u0629 \u0627\u0644\u0646\u062C\u0645\u0627\u062A" }, h("input", { type: "hidden", name: "order_id", value: this.order.order_id }), h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.id }), h("input", { type: "hidden", name: "type", value: "shipping" }), h("div", { class: "flex flex-col items-center " }, h("div", { class: "w-28 h-28 overflow-hidden border border-gray-200 rounded-full flex items-center justify-center mb-4" }, h("img", { src: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcScPt4R6KaKDldrXb-9pUljFwL3m6A72BhN6p1qZJKprwC6VbCWC_8ASZgiJAoL_l7DepM&usqp=CAU", alt: "company name", class: "w-full h-full object-contain" })), h("h2", { class: "section-title text-lg font-bold mb-7" }, "\u0627\u062E\u0628\u0631\u0646\u0627 \u0639\u0646 \u062A\u062C\u0631\u0628\u062A\u0643 \u0645\u0639 \u0634\u0631\u0643\u0629 \u0627\u0644\u0634\u062D\u0646 \u0627\u0631\u0627\u0645\u0643\u0633")), h("div", { class: "mb-2" }, h("textarea", { id: "shippingReview", name: "comment", class: "form-input comment h-20 mb-2", placeholder: "\u0627\u0636\u0641 \u0631\u0623\u064A\u0643 \u0639\u0646 \u0634\u0631\u0643\u0629 \u0627\u0644\u0634\u062D\u0646" })), h("div", { class: "rating-wrap flex items-center space-s-4 flex justify-center" }, h("form", { class: "rate-element ratFeedbackPresentere-element--has-label" }, this.getStarsRating())), h("small", { class: "text-red-400 validation-message" }))));
246
- }
247
- renderThanksView() {
248
- return (h("div", { class: "thankyou-view py-32 px-8 text-center hidden" }, h("span", { class: "w-20 h-20 text-4xl inline-flex justify-center items-center bg-gray-50 rounded-full text-primary sicon-check-circle2" }), h("div", { class: "mt-4 mb-6" }, h("h3", { class: "font-bold" }, "\u062A\u0645 \u062A\u0642\u064A\u064A\u0645 \u0627\u0644\u0637\u0644\u0628 \u0628\u0646\u062C\u0627\u062D"), h("p", { class: "text-gray-400 text-sm" }, "\u0634\u0643\u0631\u0627 \u0644\u062A\u0642\u064A\u064A\u0645\u0643 \u0648 \u0645\u0633\u0627\u0639\u062F\u062A\u0646\u0627 \u0641\u064A \u062A\u062D\u0633\u064A\u0646 \u062A\u062C\u0631\u0628\u062A\u0646\u0627 \u0644\u062A\u0642\u062F\u064A\u0645 \u0627\u0644\u0623\u0641\u0636\u0644 \u0644\u0643\u0645")), h("a", { href: "#!", onClick: () => this.hide(), class: "btn btn-primary h-10 flex-none px-8" }, "\u0639\u0648\u062F\u0629 \u0625\u0644\u064A \u062A\u0641\u0627\u0635\u064A\u0644 \u0627\u0644\u0637\u0644\u0628")));
249
- }
250
- getStarsRating() {
251
- return (h("div", { class: "mb-1" }, h("input", { type: "hidden", class: "rating_hidden_input", name: "rating", value: "" }), this.stars.map((star) => h("button", { type: "submit", class: "btn btn--transparent px-1 text-2xl text-gray-400 btn--star", "data-star": star }, h("i", { class: "sicon-star2" })))));
252
- }
253
- get host() { return getElement(this); }
254
- };
255
- OrderRating.style = orderRatingCss;
256
-
257
- export { OrderRating as order_rating };
@@ -1,57 +0,0 @@
1
- import { r as registerInstance, h, g as getElement } from './index-8cf58712.js';
2
- import { H as Helper } from './Helper-23b2de40.js';
3
-
4
- const sallaButtonCss = ":host{display:block}";
5
-
6
- const SallaButton = class {
7
- constructor(hostRef) {
8
- registerInstance(this, hostRef);
9
- this.color = 'primary'; // outline,primary-outline,danger
10
- this.loading = false;
11
- this.disabled = false;
12
- this.hostAttributes = {};
13
- //============= Initiate Button Attributes =============//
14
- for (let i = 0; i < this.host.attributes.length; i++) {
15
- this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
16
- }
17
- this.hostAttributes.type = this.hostAttributes.type || 'button';
18
- this.hostAttributes.class = (this.hostAttributes.class || '') + ' s-button-btn btn--has-loading btn-' + this.color;
19
- // if(this.hostAttributes.onclick){
20
- // this.hostAttributes.onclick=eval(this.hostAttributes.onclick);
21
- // }
22
- delete this.hostAttributes['color'];
23
- delete this.hostAttributes['id'];
24
- }
25
- async load() {
26
- this.host.setAttribute('loading', '');
27
- return this.host;
28
- }
29
- async stop() {
30
- this.host.removeAttribute('loading');
31
- return this.host;
32
- }
33
- async disable() {
34
- this.host.setAttribute('disabled', '');
35
- }
36
- async enable() {
37
- this.host.removeAttribute('disabled');
38
- }
39
- handleVisible(newKind, oldKind) {
40
- this.btn.classList.remove('btn-' + oldKind);
41
- this.btn.classList.add('btn-' + newKind);
42
- }
43
- handleLoading(newVal) {
44
- Helper.toggleElement(this.btn, 'btn--is-loading', 'btn--no-loading', () => newVal);
45
- }
46
- render() {
47
- return (h("button", Object.assign({ ref: btn => this.btn = btn, disabled: this.disabled }, this.hostAttributes), h("slot", null), this.loading ? h("span", { class: "loader loader--small s-button-loader" }) : ''));
48
- }
49
- get host() { return getElement(this); }
50
- static get watchers() { return {
51
- "color": ["handleVisible"],
52
- "loading": ["handleLoading"]
53
- }; }
54
- };
55
- SallaButton.style = sallaButtonCss;
56
-
57
- export { SallaButton as salla_button };
@@ -1,48 +0,0 @@
1
- import { r as registerInstance, h, g as getElement } from './index-8cf58712.js';
2
- import { H as Helper } from './Helper-23b2de40.js';
3
-
4
- const SallaLocalization = class {
5
- constructor(hostRef) {
6
- registerInstance(this, hostRef);
7
- Helper.setHost(this.host);
8
- salla.event.on('localization::show', () => this.show());
9
- }
10
- async show() {
11
- return this.modal.show();
12
- }
13
- async hide() {
14
- return this.modal.hide();
15
- }
16
- setCurrentLanguage(language) {
17
- this.language = language;
18
- }
19
- setCurrentCurrency(currency) {
20
- this.currency = currency;
21
- }
22
- async submit() {
23
- let url;
24
- this.btn.load()
25
- .then(() => {
26
- if (this.currency && this.currency.code !== salla.config.currency.code) {
27
- url = window.location.href;
28
- return salla.currency.api.change(this.currency.code);
29
- }
30
- }).then(() => {
31
- if (this.language && this.language.code !== salla.config.language.code) {
32
- url = this.language.url;
33
- }
34
- }).then(() => this.btn.stop())
35
- .then(() => this.hide())
36
- .then(() => url && (window.location.href = url));
37
- }
38
- render() {
39
- return (h("salla-modal", { id: "salla-localization", class: "hidden", ref: modal => this.modal = modal }, h("slot", { name: "header" }, h("div", { slot: "header" })), h("div", { class: "s-localization-inner" }, salla.config.languages
40
- ? h("div", { class: "s-localization-section" }, h("label", { class: "s-localization-title" }, salla.lang.get('common.titles.language')), h("fieldset", { class: "s-localization-fieldset" }, h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_language')), h("div", { class: "s-localization-section-inner" }, salla.config.languages.map(lang => h("div", { class: "flex items-center" }, h("input", { class: "s-localization-input", checked: salla.config.language.code == lang.code, onChange: () => this.setCurrentLanguage(lang), id: 'lang-' + lang.code.toLowerCase(), name: "language", type: "radio", value: lang.code }), h("label", { htmlFor: 'lang-' + lang.code.toLowerCase(), class: "s-localization-label" }, h("span", null, lang.name), h("div", { class: 's-localization-flag flag iti__flag iti__' + lang.country_code })))))))
41
- : '', salla.config.currencies
42
- ? h("div", { class: "s-localization-section" }, h("label", { class: "s-localization-title" }, salla.lang.get('common.titles.currency')), h("fieldset", { class: "s-localization-fieldset" }, h("legend", { class: "sr-only" }, salla.lang.get('blocks.header.change_currency')), h("div", { class: "s-localization-section-inner" }, salla.config.currencies.map(currency => h("div", { class: "s-localization-item" }, h("input", { class: "s-localization-input", checked: salla.config.currency.code == currency.code, onChange: () => this.setCurrentCurrency(currency), id: 'currency-' + currency.code, name: "currency", type: "radio", value: currency.code }), h("label", { class: "s-localization-label", htmlFor: 'currency-' + currency.code }, h("span", null, currency.name), h("small", { class: "s-localization-currency" }, currency.code)))))))
43
- : ''), h("p", { slot: "footer" }, h("slot", { name: "footer" }, h("salla-button", { ref: btn => this.btn = btn, onClick: () => this.submit(), class: "w-full" }, salla.lang.get('common.elements.ok'))))));
44
- }
45
- get host() { return getElement(this); }
46
- };
47
-
48
- export { SallaLocalization as salla_localization };
@@ -1,2 +0,0 @@
1
- export { S as salla_login } from './salla-login-97e0a9ab.js';
2
- import './index-8cf58712.js';
@@ -1,84 +0,0 @@
1
- import { r as registerInstance, f as createEvent, h, e as Host, g as getElement } from './index-8cf58712.js';
2
- import { H as Helper } from './Helper-23b2de40.js';
3
-
4
- const SallaModal = class {
5
- constructor(hostRef) {
6
- registerInstance(this, hostRef);
7
- this.ready = createEvent(this, "ready", 7);
8
- this.close = createEvent(this, "close", 7);
9
- this.error = false;
10
- this.success = false;
11
- this.isClosable = true;
12
- this.modalWidth = 'w-96'; //todo use friendly names
13
- this.visible = false;
14
- this.subTitle = '';
15
- this.icon = 'sicon-cancel';
16
- salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.show());
17
- salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
18
- this.title = this.host.title;
19
- this.host.removeAttribute('title');
20
- }
21
- handleVisible(newValue) {
22
- if (!newValue) {
23
- this.toggleModal(false);
24
- this.close.emit();
25
- return;
26
- }
27
- this.host.classList.remove('hidden');
28
- setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
29
- this.ready.emit();
30
- }
31
- async show() {
32
- this.host.setAttribute('visible', '');
33
- return this.host;
34
- }
35
- async hide() {
36
- this.host.removeAttribute('visible');
37
- return this.host;
38
- }
39
- async setTitle(title) {
40
- this.title = title;
41
- return this.host;
42
- }
43
- toggleModal(isOpen) {
44
- //todo:: use ref
45
- Helper.toggleElement(this.host.querySelector('.s-modal-overlay'), 'ease-out duration-300 opacity-100', 'opacity-0', () => isOpen)
46
- .toggleElement(this.host.querySelector('.s-modal-body'), 'ease-out duration-300 opacity-100 translate-y-0 sm:scale-100', //add these classes
47
- 'opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95', //remove these classes
48
- () => isOpen)
49
- .toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
50
- if (!isOpen) {
51
- setTimeout(() => this.host.classList.add('hidden'), 350);
52
- }
53
- }
54
- closeModal() {
55
- if (!this.isClosable) {
56
- return;
57
- }
58
- this.host.removeAttribute('visible');
59
- }
60
- //todo:: pref for each modal
61
- render() {
62
- this.host.id = this.host.id || 'salla-modal';
63
- return (h(Host, { class: 's-modal-container hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-wrapper" }, h("div", { class: "s-modal-overlay", onClick: () => this.closeModal() }), h("span", { class: "s-modal-spacer" }, "\u200B"), h("div", { class: 's-modal-body ' + this.modalWidth }, h("slot", { name: "header" }, h("div", { class: "s-modal-header" }, this.isClosable ?
64
- h("button", { class: "s-modal-close cursor-pointer", onClick: () => this.closeModal(), type: "button" }, h("span", { class: "sicon-cancel" }))
65
- : '', this.error || this.success || this.icon
66
- ? h("div", { class: {
67
- 's-modal-icon': true,
68
- 's-modal-bg-error': this.error,
69
- 's-modal-bg-success': this.success,
70
- 's-modal-bg-normal': !this.error && !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
- : '', h("div", { class: "s-modal-title", innerHTML: this.title }), h("p", { class: "s-modal-sub-title", innerHTML: this.subTitle }))), h("slot", null), h("slot", { name: "footer" })))));
77
- }
78
- get host() { return getElement(this); }
79
- static get watchers() { return {
80
- "visible": ["handleVisible"]
81
- }; }
82
- };
83
-
84
- export { SallaModal as salla_modal };
@@ -1,2 +0,0 @@
1
- export { S as salla_search } from './salla-search-df1c9b54.js';
2
- import './index-8cf58712.js';