@salla.sa/twilight-components 1.0.71 → 1.0.73

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 (46) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{salla-tel-input.cjs.entry.js → salla-add-product-button_6.cjs.entry.js} +519 -0
  3. package/dist/cjs/salla-login-modal.cjs.entry.js +2 -2
  4. package/dist/cjs/salla-verify-modal.cjs.entry.js +4 -5
  5. package/dist/cjs/twilight-components.cjs.js +1 -1
  6. package/dist/collection/collection-manifest.json +1 -0
  7. package/dist/collection/components/salla-add-product-button/salla-add-product-button.css +3 -0
  8. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +230 -0
  9. package/dist/collection/components/salla-button/salla-button.css +1 -1
  10. package/dist/collection/components/salla-login-modal/salla-login-modal.js +2 -2
  11. package/dist/collection/components/salla-modal/salla-modal.js +1 -2
  12. package/dist/collection/components/salla-product-availability/salla-product-availability.css +1 -1
  13. package/dist/collection/components/salla-product-availability/salla-product-availability.js +5 -3
  14. package/dist/collection/components/salla-verify-modal/salla-verify-modal.js +9 -10
  15. package/dist/components/salla-add-product-button.d.ts +11 -0
  16. package/dist/components/salla-add-product-button.js +121 -0
  17. package/dist/components/salla-button2.js +1 -1
  18. package/dist/components/salla-login-modal.js +2 -2
  19. package/dist/components/salla-modal2.js +1 -2
  20. package/dist/components/salla-product-availability.js +1 -155
  21. package/dist/{esm/salla-product-availability.entry.js → components/salla-product-availability2.js} +59 -12
  22. package/dist/components/salla-verify-modal2.js +5 -6
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/{salla-tel-input.entry.js → salla-add-product-button_6.entry.js} +515 -1
  25. package/dist/esm/salla-login-modal.entry.js +2 -2
  26. package/dist/esm/salla-verify-modal.entry.js +4 -5
  27. package/dist/esm/twilight-components.js +1 -1
  28. package/dist/twilight-components/p-20a8492d.entry.js +4 -0
  29. package/dist/twilight-components/p-a970ba23.entry.js +4 -0
  30. package/dist/twilight-components/p-f8e1ea72.entry.js +4 -0
  31. package/dist/twilight-components/twilight-components.esm.js +1 -1
  32. package/dist/types/components/salla-add-product-button/salla-add-product-button.d.ts +25 -0
  33. package/dist/types/components/salla-verify-modal/salla-verify-modal.d.ts +1 -1
  34. package/dist/types/components.d.ts +43 -8
  35. package/package.json +1 -1
  36. package/dist/cjs/salla-button.cjs.entry.js +0 -122
  37. package/dist/cjs/salla-modal_2.cjs.entry.js +0 -240
  38. package/dist/cjs/salla-product-availability.cjs.entry.js +0 -119
  39. package/dist/esm/salla-button.entry.js +0 -118
  40. package/dist/esm/salla-modal_2.entry.js +0 -235
  41. package/dist/twilight-components/p-3aabd1b6.entry.js +0 -4
  42. package/dist/twilight-components/p-44910fc8.entry.js +0 -4
  43. package/dist/twilight-components/p-48c877fc.entry.js +0 -4
  44. package/dist/twilight-components/p-7580c125.entry.js +0 -4
  45. package/dist/twilight-components/p-c3b196f3.entry.js +0 -4
  46. package/dist/twilight-components/p-ca4cf691.entry.js +0 -4
@@ -0,0 +1,230 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { Component, Element, Event, Host, Prop, h } from '@stencil/core';
5
+ export class SallaAddProductButton {
6
+ constructor() {
7
+ this.hostAttributes = {};
8
+ this.hasNotText = false;
9
+ this.channels = null;
10
+ this.quantity = 1;
11
+ this.donatingAmount = 0;
12
+ this.productStatus = 'sale';
13
+ this.productType = 'product';
14
+ /**
15
+ * Is the button currently disabled
16
+ */
17
+ this.disabled = false;
18
+ }
19
+ getLabel() {
20
+ if (this.productStatus === 'sale') {
21
+ return salla.lang.get('pages.cart.add_to_cart');
22
+ }
23
+ if (this.productType === 'product') {
24
+ return salla.lang.get('pages.products.out_of_stock');
25
+ }
26
+ // donating
27
+ return salla.lang.get('pages.products.donation_exceed');
28
+ }
29
+ componentWillLoad() {
30
+ this.hasNotText = !this.host.innerHTML || this.host.innerHTML === "" || this.host.innerHTML.trim().replace(/\s/g, '').localeCompare("<!---->") === 0;
31
+ }
32
+ componentDidRender() {
33
+ if (this.buttonLabel && this.hasNotText) {
34
+ salla.event.once('languages::translations.loaded', () => {
35
+ this.buttonLabel.innerHTML = this.getLabel() || 'اضافة للسلة';
36
+ });
37
+ }
38
+ }
39
+ addProductToCart(event) {
40
+ event.preventDefault();
41
+ return salla.cart.addItem({
42
+ id: this.productId,
43
+ donating_amount: this.donatingAmount,
44
+ quantity: this.quantity
45
+ }).then((response) => this.success.emit(response))
46
+ .catch((error) => this.failed.emit(error));
47
+ }
48
+ getBtnAttributes() {
49
+ for (let i = 0; i < this.host.attributes.length; i++) {
50
+ if (!['id', 'class'].includes(this.host.attributes[i].name)) {
51
+ this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
52
+ }
53
+ }
54
+ return this.hostAttributes;
55
+ }
56
+ render() {
57
+ return (h(Host, null, this.productStatus === 'out-and-notify' && this.channels ?
58
+ h("salla-product-availability", Object.assign({}, this.getBtnAttributes()),
59
+ h("slot", null)) :
60
+ h("salla-button", Object.assign({ onClick: (event) => this.addProductToCart(event), type: "button", fill: this.productStatus === 'sale' ? 'solid' : 'outline', color: this.productStatus === 'sale' ? 'primary' : 'light', "loader-position": "center" }, this.getBtnAttributes(), { disabled: this.productStatus === 'out' }),
61
+ h("slot", null),
62
+ h("span", { ref: (el) => this.buttonLabel = el }))));
63
+ }
64
+ static get is() { return "salla-add-product-button"; }
65
+ static get originalStyleUrls() { return {
66
+ "$": ["salla-add-product-button.css"]
67
+ }; }
68
+ static get styleUrls() { return {
69
+ "$": ["salla-add-product-button.css"]
70
+ }; }
71
+ static get properties() { return {
72
+ "channels": {
73
+ "type": "string",
74
+ "mutable": false,
75
+ "complexType": {
76
+ "original": "string",
77
+ "resolved": "string",
78
+ "references": {}
79
+ },
80
+ "required": false,
81
+ "optional": false,
82
+ "docs": {
83
+ "tags": [],
84
+ "text": ""
85
+ },
86
+ "attribute": "channels",
87
+ "reflect": true,
88
+ "defaultValue": "null"
89
+ },
90
+ "quantity": {
91
+ "type": "number",
92
+ "mutable": false,
93
+ "complexType": {
94
+ "original": "number",
95
+ "resolved": "number",
96
+ "references": {}
97
+ },
98
+ "required": false,
99
+ "optional": false,
100
+ "docs": {
101
+ "tags": [],
102
+ "text": ""
103
+ },
104
+ "attribute": "quantity",
105
+ "reflect": true,
106
+ "defaultValue": "1"
107
+ },
108
+ "donatingAmount": {
109
+ "type": "number",
110
+ "mutable": false,
111
+ "complexType": {
112
+ "original": "number",
113
+ "resolved": "number",
114
+ "references": {}
115
+ },
116
+ "required": false,
117
+ "optional": false,
118
+ "docs": {
119
+ "tags": [],
120
+ "text": ""
121
+ },
122
+ "attribute": "donating-amount",
123
+ "reflect": true,
124
+ "defaultValue": "0"
125
+ },
126
+ "productId": {
127
+ "type": "any",
128
+ "mutable": false,
129
+ "complexType": {
130
+ "original": "any",
131
+ "resolved": "any",
132
+ "references": {}
133
+ },
134
+ "required": false,
135
+ "optional": false,
136
+ "docs": {
137
+ "tags": [],
138
+ "text": ""
139
+ },
140
+ "attribute": "product-id",
141
+ "reflect": true
142
+ },
143
+ "productStatus": {
144
+ "type": "string",
145
+ "mutable": false,
146
+ "complexType": {
147
+ "original": "'sale' | 'out' | 'out-and-notify'",
148
+ "resolved": "\"out\" | \"out-and-notify\" | \"sale\"",
149
+ "references": {}
150
+ },
151
+ "required": false,
152
+ "optional": false,
153
+ "docs": {
154
+ "tags": [],
155
+ "text": ""
156
+ },
157
+ "attribute": "product-status",
158
+ "reflect": true,
159
+ "defaultValue": "'sale'"
160
+ },
161
+ "productType": {
162
+ "type": "string",
163
+ "mutable": false,
164
+ "complexType": {
165
+ "original": "'product' | 'service' | 'codes' | 'digital' | 'food' | 'donating' | 'group_products'",
166
+ "resolved": "\"codes\" | \"digital\" | \"donating\" | \"food\" | \"group_products\" | \"product\" | \"service\"",
167
+ "references": {}
168
+ },
169
+ "required": false,
170
+ "optional": false,
171
+ "docs": {
172
+ "tags": [],
173
+ "text": ""
174
+ },
175
+ "attribute": "product-type",
176
+ "reflect": true,
177
+ "defaultValue": "'product'"
178
+ },
179
+ "disabled": {
180
+ "type": "boolean",
181
+ "mutable": false,
182
+ "complexType": {
183
+ "original": "boolean",
184
+ "resolved": "boolean",
185
+ "references": {}
186
+ },
187
+ "required": false,
188
+ "optional": false,
189
+ "docs": {
190
+ "tags": [],
191
+ "text": "Is the button currently disabled"
192
+ },
193
+ "attribute": "disabled",
194
+ "reflect": true,
195
+ "defaultValue": "false"
196
+ }
197
+ }; }
198
+ static get events() { return [{
199
+ "method": "success",
200
+ "name": "success",
201
+ "bubbles": true,
202
+ "cancelable": true,
203
+ "composed": true,
204
+ "docs": {
205
+ "tags": [],
206
+ "text": ""
207
+ },
208
+ "complexType": {
209
+ "original": "any",
210
+ "resolved": "any",
211
+ "references": {}
212
+ }
213
+ }, {
214
+ "method": "failed",
215
+ "name": "failed",
216
+ "bubbles": true,
217
+ "cancelable": true,
218
+ "composed": true,
219
+ "docs": {
220
+ "tags": [],
221
+ "text": ""
222
+ },
223
+ "complexType": {
224
+ "original": "any",
225
+ "resolved": "any",
226
+ "references": {}
227
+ }
228
+ }]; }
229
+ static get elementRef() { return "host"; }
230
+ }
@@ -8,7 +8,7 @@
8
8
  salla-button {
9
9
  pointer-events: none;
10
10
  }
11
- salla-button[type=submit] {
11
+ salla-button[type=submit], salla-button[type=button], salla-button[type=reset] {
12
12
  -webkit-appearance: none;
13
13
  }
14
14
  salla-button[width=wide] {
@@ -129,7 +129,7 @@ export class SallaLoginModal {
129
129
  if (salla.auth.event.getTypeActionOnVerified() !== 'redirect') {
130
130
  return;
131
131
  }
132
- if (event.data.redirect_url) {
132
+ if (event.detail.data.redirect_url) {
133
133
  return window.location.href = event.data.redirect_url;
134
134
  }
135
135
  window.location.reload();
@@ -160,7 +160,7 @@ export class SallaLoginModal {
160
160
  this.regType = tab === this.mobileTab ? 'phone' : 'email';
161
161
  }
162
162
  let isRegistrationTab = tab == this.registrationTab;
163
- isRegistrationTab && ((_a = this.firstName) === null || _a === void 0 ? void 0 : _a.focus());
163
+ (_a = tab.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus(); // focus the first input in tab
164
164
  (_b = this.modal) === null || _b === void 0 ? void 0 : _b.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
165
165
  if (!isRegistrationTab) {
166
166
  Helper.toggleElementClassIf(this.regMobileBlock, 's-hidden', 's-show', () => this.regType === 'phone')
@@ -40,8 +40,7 @@ export class SallaModal {
40
40
  Helper.setHost(this.host);
41
41
  salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.show());
42
42
  salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
43
- this.modalTitle = this.host.title;
44
- this.host.removeAttribute('modalTitle');
43
+ this.modalTitle = this.host.getAttribute('modal-title');
45
44
  }
46
45
  handleVisible(newValue) {
47
46
  if (!newValue) {
@@ -2,7 +2,7 @@
2
2
  * Global flags style [imported from Int-tel-input]
3
3
  */
4
4
  /*
5
- * Salla Product Availability Component: popup modal to notify user if the product is available,
5
+ * Salla Product Availability Component: popup modal to notify user if the product is available,
6
6
  * used in the product single page if the product isn't available.
7
7
  * You can use these classes to target the elements in the component.
8
8
  */
@@ -6,6 +6,8 @@ import Helper from "../../Helpers/Helper";
6
6
  export class SallaProductAvailability {
7
7
  constructor() {
8
8
  this.isUser = Helper.isUser();
9
+ this.mobileLabel = '555555555';
10
+ this.emailPlaceholder = 'your@email.com';
9
11
  /**
10
12
  * product id that can visitor subscribe to its availability notification
11
13
  */
@@ -48,9 +50,9 @@ export class SallaProductAvailability {
48
50
  this.subscribedMessage = salla.lang.get('pages.products.notify_availability_success');
49
51
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
50
52
  this.subTitle = salla.lang.get('pages.products.notify_availability_subtitle');
51
- this.mobileLabel = salla.lang.get('common.elements.mobile');
53
+ this.mobileLabel = salla.lang.get('common.elements.mobile') || '555555555';
52
54
  this.emailLabel = salla.lang.get('common.elements.email');
53
- this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder');
55
+ this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder') || 'your@email.com';
54
56
  this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');
55
57
  (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title_);
56
58
  (_b = this.btn) === null || _b === void 0 ? void 0 : _b.setText(salla.lang.get('common.elements.submit'));
@@ -86,7 +88,7 @@ export class SallaProductAvailability {
86
88
  field.nextElementSibling['innerText'] = '* ' + errorMsg;
87
89
  }
88
90
  render() {
89
- return (h(Host, { id: "s-product-availability" },
91
+ return (h(Host, { class: "s-product-availability-wrap" },
90
92
  this.isSubscribed || this.isVisitorSubscribed
91
93
  ? h("div", { class: "s-product-availability-subscribed" },
92
94
  h("i", { class: "sicon-bell-ring s-product-availability-subs-icon" }),
@@ -14,7 +14,7 @@ export class SallaVerifyModal {
14
14
  /**
15
15
  * Verifying method
16
16
  */
17
- this.by = 'sms';
17
+ this.type = 'mobile';
18
18
  /**
19
19
  * should auto reloading the page after success verification
20
20
  */
@@ -48,8 +48,7 @@ export class SallaVerifyModal {
48
48
  async show(data) {
49
49
  var _a;
50
50
  this.data = data;
51
- //dirty way to set the by;
52
- this.by = (data === null || data === void 0 ? void 0 : data.type) == 'mobile' ? 'sms' : (data === null || data === void 0 ? void 0 : data.type) || this.by;
51
+ this.data.type = this.data.type || this.type;
53
52
  this.resendTimer();
54
53
  this.otpInputs = this.host.querySelectorAll('.s-verify-modal-input');
55
54
  if (!this.initiated) {
@@ -117,7 +116,7 @@ export class SallaVerifyModal {
117
116
  this.otpInputs.forEach(input => input.value = '');
118
117
  this.otpInputs[0].focus();
119
118
  })
120
- .then(() => salla.api.auth.resend(Object.assign({ resend_by: this.by }, this.data)))
119
+ .then(() => salla.api.auth.resend(this.data))
121
120
  .then(() => this.resendTimer())
122
121
  .catch(() => this.resendTimer());
123
122
  }
@@ -127,7 +126,7 @@ export class SallaVerifyModal {
127
126
  .then(() => this.btn.disable())
128
127
  .then(() => this.url
129
128
  ? salla.api.auth.request(this.url, data)
130
- : salla.api.auth.verify(this.by == 'sms' ? 'mobile' : this.by, data, true))
129
+ : salla.api.auth.verify(data, true))
131
130
  .then(response => this.verified.emit(response))
132
131
  .then(() => this.btn.stop() && this.btn.disable())
133
132
  .then(() => this.modal.hide())
@@ -193,12 +192,12 @@ export class SallaVerifyModal {
193
192
  "attribute": "url",
194
193
  "reflect": true
195
194
  },
196
- "by": {
195
+ "type": {
197
196
  "type": "string",
198
197
  "mutable": false,
199
198
  "complexType": {
200
- "original": "'sms' | 'email'",
201
- "resolved": "\"email\" | \"sms\"",
199
+ "original": "'mobile' | 'email'",
200
+ "resolved": "\"email\" | \"mobile\"",
202
201
  "references": {}
203
202
  },
204
203
  "required": false,
@@ -207,9 +206,9 @@ export class SallaVerifyModal {
207
206
  "tags": [],
208
207
  "text": "Verifying method"
209
208
  },
210
- "attribute": "by",
209
+ "attribute": "type",
211
210
  "reflect": false,
212
- "defaultValue": "'sms'"
211
+ "defaultValue": "'mobile'"
213
212
  },
214
213
  "autoReload": {
215
214
  "type": "boolean",
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface SallaAddProductButton extends Components.SallaAddProductButton, HTMLElement {}
4
+ export const SallaAddProductButton: {
5
+ prototype: SallaAddProductButton;
6
+ new (): SallaAddProductButton;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,121 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
5
+ import { d as defineCustomElement$5 } from './salla-button2.js';
6
+ import { d as defineCustomElement$4 } from './salla-modal2.js';
7
+ import { d as defineCustomElement$3 } from './salla-product-availability2.js';
8
+ import { d as defineCustomElement$2 } from './salla-tel-input2.js';
9
+
10
+ const sallaAddProductButtonCss = ":host{display:block}";
11
+
12
+ const SallaAddProductButton$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
13
+ constructor() {
14
+ super();
15
+ this.__registerHost();
16
+ this.success = createEvent(this, "success", 7);
17
+ this.failed = createEvent(this, "failed", 7);
18
+ this.hostAttributes = {};
19
+ this.hasNotText = false;
20
+ this.channels = null;
21
+ this.quantity = 1;
22
+ this.donatingAmount = 0;
23
+ this.productStatus = 'sale';
24
+ this.productType = 'product';
25
+ /**
26
+ * Is the button currently disabled
27
+ */
28
+ this.disabled = false;
29
+ }
30
+ getLabel() {
31
+ if (this.productStatus === 'sale') {
32
+ return salla.lang.get('pages.cart.add_to_cart');
33
+ }
34
+ if (this.productType === 'product') {
35
+ return salla.lang.get('pages.products.out_of_stock');
36
+ }
37
+ // donating
38
+ return salla.lang.get('pages.products.donation_exceed');
39
+ }
40
+ componentWillLoad() {
41
+ this.hasNotText = !this.host.innerHTML || this.host.innerHTML === "" || this.host.innerHTML.trim().replace(/\s/g, '').localeCompare("<!---->") === 0;
42
+ }
43
+ componentDidRender() {
44
+ if (this.buttonLabel && this.hasNotText) {
45
+ salla.event.once('languages::translations.loaded', () => {
46
+ this.buttonLabel.innerHTML = this.getLabel() || 'اضافة للسلة';
47
+ });
48
+ }
49
+ }
50
+ addProductToCart(event) {
51
+ event.preventDefault();
52
+ return salla.cart.addItem({
53
+ id: this.productId,
54
+ donating_amount: this.donatingAmount,
55
+ quantity: this.quantity
56
+ }).then((response) => this.success.emit(response))
57
+ .catch((error) => this.failed.emit(error));
58
+ }
59
+ getBtnAttributes() {
60
+ for (let i = 0; i < this.host.attributes.length; i++) {
61
+ if (!['id', 'class'].includes(this.host.attributes[i].name)) {
62
+ this.hostAttributes[this.host.attributes[i].name] = this.host.attributes[i].value;
63
+ }
64
+ }
65
+ return this.hostAttributes;
66
+ }
67
+ render() {
68
+ return (h(Host, null, this.productStatus === 'out-and-notify' && this.channels ?
69
+ h("salla-product-availability", Object.assign({}, this.getBtnAttributes()), h("slot", null)) :
70
+ h("salla-button", Object.assign({ onClick: (event) => this.addProductToCart(event), type: "button", fill: this.productStatus === 'sale' ? 'solid' : 'outline', color: this.productStatus === 'sale' ? 'primary' : 'light', "loader-position": "center" }, this.getBtnAttributes(), { disabled: this.productStatus === 'out' }), h("slot", null), h("span", { ref: (el) => this.buttonLabel = el }))));
71
+ }
72
+ get host() { return this; }
73
+ static get style() { return sallaAddProductButtonCss; }
74
+ }, [4, "salla-add-product-button", {
75
+ "channels": [513],
76
+ "quantity": [514],
77
+ "donatingAmount": [514, "donating-amount"],
78
+ "productId": [520, "product-id"],
79
+ "productStatus": [513, "product-status"],
80
+ "productType": [513, "product-type"],
81
+ "disabled": [516]
82
+ }]);
83
+ function defineCustomElement$1() {
84
+ if (typeof customElements === "undefined") {
85
+ return;
86
+ }
87
+ const components = ["salla-add-product-button", "salla-button", "salla-modal", "salla-product-availability", "salla-tel-input"];
88
+ components.forEach(tagName => { switch (tagName) {
89
+ case "salla-add-product-button":
90
+ if (!customElements.get(tagName)) {
91
+ customElements.define(tagName, SallaAddProductButton$1);
92
+ }
93
+ break;
94
+ case "salla-button":
95
+ if (!customElements.get(tagName)) {
96
+ defineCustomElement$5();
97
+ }
98
+ break;
99
+ case "salla-modal":
100
+ if (!customElements.get(tagName)) {
101
+ defineCustomElement$4();
102
+ }
103
+ break;
104
+ case "salla-product-availability":
105
+ if (!customElements.get(tagName)) {
106
+ defineCustomElement$3();
107
+ }
108
+ break;
109
+ case "salla-tel-input":
110
+ if (!customElements.get(tagName)) {
111
+ defineCustomElement$2();
112
+ }
113
+ break;
114
+ } });
115
+ }
116
+ defineCustomElement$1();
117
+
118
+ const SallaAddProductButton = SallaAddProductButton$1;
119
+ const defineCustomElement = defineCustomElement$1;
120
+
121
+ export { SallaAddProductButton, defineCustomElement };
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
5
5
 
6
- const sallaButtonCss = "salla-button{pointer-events:none}salla-button[type=submit]{-webkit-appearance:none}salla-button[width=wide]{width:100%}.s-button-wrap[loading]{pointer-events:none}.s-button-wrap[loading] .s-button-element{pointer-events:none !important}.s-button-wrap[loading] .s-button-loader-center .s-button-text{opacity:0}.s-button-wrap .s-button-element[loading]{pointer-events:none !important}.s-button-wrap .s-button-element:not(:disabled){pointer-events:auto}.s-button-wrap .s-button-solid .s-button-loader:before{border-color:#fff #fff rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.2)}.s-button-wrap .s-button-outline{border:1px solid currentColor}.s-button-wrap .s-button-outline:hover{border-color:transparent}.s-button-wrap .s-button-outline .s-button-loader:before{border-top-color:currentColor;border-left-color:currentColor}.s-button-wrap .s-button-icon.s-button-large{width:56px;height:56px}.s-button-wrap .s-button-icon.s-button-small{width:24px;height:24px}.s-button-wrap .s-button-icon.s-button-small .s-button-loader:before{width:0.85rem;height:0.85rem}.s-button-wrap .s-button-loader-after .s-button-load{flex-direction:row}.s-button-wrap .s-button-loader-start.s-button-element{padding-left:32px;padding-right:32px}.s-button-wrap .s-button-loader-start .s-button-loader{position:absolute;right:8px}.s-button-wrap .s-button-loader-start .s-button-loader [dir=ltr]{left:8px;right:auto}.s-button-wrap .s-button-loader-end.s-button-element{padding-left:32px;padding-right:32px}.s-button-wrap .s-button-loader-end .s-button-loader{position:absolute;left:8px}.s-button-wrap .s-button-loader-end .s-button-loader [dir=ltr]{right:8px;left:auto}.s-button-wrap .s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);margin:0 !important}";
6
+ const sallaButtonCss = "salla-button{pointer-events:none}salla-button[type=submit],salla-button[type=button],salla-button[type=reset]{-webkit-appearance:none}salla-button[width=wide]{width:100%}.s-button-wrap[loading]{pointer-events:none}.s-button-wrap[loading] .s-button-element{pointer-events:none !important}.s-button-wrap[loading] .s-button-loader-center .s-button-text{opacity:0}.s-button-wrap .s-button-element[loading]{pointer-events:none !important}.s-button-wrap .s-button-element:not(:disabled){pointer-events:auto}.s-button-wrap .s-button-solid .s-button-loader:before{border-color:#fff #fff rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.2)}.s-button-wrap .s-button-outline{border:1px solid currentColor}.s-button-wrap .s-button-outline:hover{border-color:transparent}.s-button-wrap .s-button-outline .s-button-loader:before{border-top-color:currentColor;border-left-color:currentColor}.s-button-wrap .s-button-icon.s-button-large{width:56px;height:56px}.s-button-wrap .s-button-icon.s-button-small{width:24px;height:24px}.s-button-wrap .s-button-icon.s-button-small .s-button-loader:before{width:0.85rem;height:0.85rem}.s-button-wrap .s-button-loader-after .s-button-load{flex-direction:row}.s-button-wrap .s-button-loader-start.s-button-element{padding-left:32px;padding-right:32px}.s-button-wrap .s-button-loader-start .s-button-loader{position:absolute;right:8px}.s-button-wrap .s-button-loader-start .s-button-loader [dir=ltr]{left:8px;right:auto}.s-button-wrap .s-button-loader-end.s-button-element{padding-left:32px;padding-right:32px}.s-button-wrap .s-button-loader-end .s-button-loader{position:absolute;left:8px}.s-button-wrap .s-button-loader-end .s-button-loader [dir=ltr]{right:8px;left:auto}.s-button-wrap .s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);margin:0 !important}";
7
7
 
8
8
  const SallaButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
9
9
  constructor() {
@@ -127,7 +127,7 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
127
127
  if (salla.auth.event.getTypeActionOnVerified() !== 'redirect') {
128
128
  return;
129
129
  }
130
- if (event.data.redirect_url) {
130
+ if (event.detail.data.redirect_url) {
131
131
  return window.location.href = event.data.redirect_url;
132
132
  }
133
133
  window.location.reload();
@@ -158,7 +158,7 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
158
158
  this.regType = tab === this.mobileTab ? 'phone' : 'email';
159
159
  }
160
160
  let isRegistrationTab = tab == this.registrationTab;
161
- isRegistrationTab && ((_a = this.firstName) === null || _a === void 0 ? void 0 : _a.focus());
161
+ (_a = tab.querySelector('input')) === null || _a === void 0 ? void 0 : _a.focus(); // focus the first input in tab
162
162
  (_b = this.modal) === null || _b === void 0 ? void 0 : _b.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
163
163
  if (!isRegistrationTab) {
164
164
  Helper.toggleElementClassIf(this.regMobileBlock, 's-hidden', 's-show', () => this.regType === 'phone')
@@ -44,8 +44,7 @@ const SallaModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
44
44
  Helper.setHost(this.host);
45
45
  salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.show());
46
46
  salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
47
- this.modalTitle = this.host.title;
48
- this.host.removeAttribute('modalTitle');
47
+ this.modalTitle = this.host.getAttribute('modal-title');
49
48
  }
50
49
  handleVisible(newValue) {
51
50
  if (!newValue) {