@salla.sa/twilight-components 2.14.295 → 2.14.297

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 (158) hide show
  1. package/dist/cjs/{filepond-CEfkKwxm.js → filepond-B40UxVrp.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-U5caDeXK.js → filepond-plugin-file-poster-BJ2is-CR.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-5eUt8fIA.js → filepond-plugin-file-validate-size-jaoaOCNL.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-BdNoSu6e.js → filepond-plugin-file-validate-type-CjxCZWaY.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-DFm7eyxh.js → filepond-plugin-image-edit-JEKYuBL0.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-BfH19uNR.js → filepond-plugin-image-exif-orientation-DmK-aAfe.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-BCQL6DBC.js → filepond-plugin-image-preview-BZxhd7ci.js} +1 -1
  8. package/dist/cjs/{index-CMFmTYR8.js → index-Bc1Blm9E.js} +6 -2
  9. package/dist/cjs/{index-TCPzRuQa.js → index-CYgngxgk.js} +1 -1
  10. package/dist/cjs/interfaces-CX9-6aLf.js +24 -0
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion_62.cjs.entry.js +79 -124
  13. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-cart-item-offers.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-custom-fields.cjs.entry.js +135 -0
  20. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-loyalty-program.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-review-card.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-reviews-page.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-reviews.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  46. package/dist/cjs/twilight.cjs.js +2 -2
  47. package/dist/collection/collection-manifest.json +1 -0
  48. package/dist/collection/components/salla-custom-fields/salla-custom-fields.css +3 -0
  49. package/dist/collection/components/salla-custom-fields/salla-custom-fields.js +313 -0
  50. package/dist/collection/components/salla-file-upload/salla-file-upload.js +36 -3
  51. package/dist/collection/components/salla-user-menu/salla-user-menu.js +40 -22
  52. package/dist/collection/components/salla-user-profile/salla-user-profile.js +15 -132
  53. package/dist/components/index.js +2 -2
  54. package/dist/components/interfaces.js +15 -0
  55. package/dist/components/salla-custom-fields.d.ts +11 -0
  56. package/dist/components/salla-custom-fields.js +174 -0
  57. package/dist/components/salla-file-upload2.js +13 -3
  58. package/dist/components/salla-user-menu.js +46 -22
  59. package/dist/components/salla-user-profile.js +19 -97
  60. package/dist/esm/{filepond-vl78959W.js → filepond-DjIxwPi0.js} +1 -1
  61. package/dist/esm/{filepond-plugin-file-poster-CqR_Dwed.js → filepond-plugin-file-poster-CYvspSki.js} +1 -1
  62. package/dist/esm/{filepond-plugin-file-validate-size-B6Dk56YE.js → filepond-plugin-file-validate-size-Cf09KKtA.js} +1 -1
  63. package/dist/esm/{filepond-plugin-file-validate-type-P-_BDRkR.js → filepond-plugin-file-validate-type-ByZikBAG.js} +1 -1
  64. package/dist/esm/{filepond-plugin-image-edit-DWNUa3R3.js → filepond-plugin-image-edit-DbT6_H2k.js} +1 -1
  65. package/dist/esm/{filepond-plugin-image-exif-orientation-dnXbnCGP.js → filepond-plugin-image-exif-orientation-BhEk_QOu.js} +1 -1
  66. package/dist/esm/{filepond-plugin-image-preview-CGT6aBAl.js → filepond-plugin-image-preview-Bsa9hzKo.js} +1 -1
  67. package/dist/esm/{index-DvtO64lP.js → index-CYhDRQ7q.js} +1 -1
  68. package/dist/esm/{index-Ziat6EbF.js → index-D8Ikl-5X.js} +6 -2
  69. package/dist/esm/interfaces-CBT_Nxny.js +22 -0
  70. package/dist/esm/loader.js +3 -3
  71. package/dist/esm/salla-accordion_62.entry.js +78 -123
  72. package/dist/esm/salla-advertisement.entry.js +1 -1
  73. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  74. package/dist/esm/salla-apps-icons.entry.js +1 -1
  75. package/dist/esm/salla-cart-item-offers.entry.js +1 -1
  76. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  77. package/dist/esm/salla-contacts.entry.js +1 -1
  78. package/dist/esm/salla-custom-fields.entry.js +133 -0
  79. package/dist/esm/salla-filters-widget.entry.js +1 -1
  80. package/dist/esm/salla-filters.entry.js +1 -1
  81. package/dist/esm/salla-installment.entry.js +1 -1
  82. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  83. package/dist/esm/salla-loyalty-program.entry.js +1 -1
  84. package/dist/esm/salla-metadata.entry.js +1 -1
  85. package/dist/esm/salla-notification-item.entry.js +1 -1
  86. package/dist/esm/salla-notifications.entry.js +1 -1
  87. package/dist/esm/salla-offer.entry.js +1 -1
  88. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  89. package/dist/esm/salla-order-details-options.entry.js +1 -1
  90. package/dist/esm/salla-order-details.entry.js +1 -1
  91. package/dist/esm/salla-order-summary.entry.js +1 -1
  92. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  93. package/dist/esm/salla-orders.entry.js +1 -1
  94. package/dist/esm/salla-payments.entry.js +1 -1
  95. package/dist/esm/salla-price-range.entry.js +1 -1
  96. package/dist/esm/salla-review-card.entry.js +1 -1
  97. package/dist/esm/salla-reviews-page.entry.js +1 -1
  98. package/dist/esm/salla-reviews.entry.js +1 -1
  99. package/dist/esm/salla-social.entry.js +1 -1
  100. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  101. package/dist/esm/salla-tooltip.entry.js +1 -1
  102. package/dist/esm/salla-trust-badges.entry.js +1 -1
  103. package/dist/esm/salla-verify.entry.js +1 -1
  104. package/dist/esm/salla-wallet.entry.js +1 -1
  105. package/dist/esm/twilight.js +3 -3
  106. package/dist/twilight/p-00042305.entry.js +4 -0
  107. package/dist/twilight/{p-9b480b59.entry.js → p-03907a0b.entry.js} +1 -1
  108. package/dist/twilight/{p-8cfd00b9.entry.js → p-067eafaf.entry.js} +1 -1
  109. package/dist/twilight/{p-93a27904.entry.js → p-199025a7.entry.js} +1 -1
  110. package/dist/twilight/{p-d107dc1a.entry.js → p-243e9c31.entry.js} +1 -1
  111. package/dist/twilight/{p-2b8846ae.entry.js → p-26c2b559.entry.js} +1 -1
  112. package/dist/twilight/{p-67038367.entry.js → p-28eae4bb.entry.js} +1 -1
  113. package/dist/twilight/{p-b3fafad2.entry.js → p-2a59b701.entry.js} +1 -1
  114. package/dist/twilight/{p-6822a113.entry.js → p-37249106.entry.js} +1 -1
  115. package/dist/twilight/{p-2a2a02d6.entry.js → p-3d7b61c6.entry.js} +1 -1
  116. package/dist/twilight/{p-f38b2e17.entry.js → p-3f2a0489.entry.js} +1 -1
  117. package/dist/twilight/{p-a328c3d1.entry.js → p-3fe694f7.entry.js} +1 -1
  118. package/dist/twilight/{p-bf70d878.entry.js → p-407a5e84.entry.js} +1 -1
  119. package/dist/twilight/{p-3d19d1d8.entry.js → p-4713b2c5.entry.js} +1 -1
  120. package/dist/twilight/{p-15d9e580.entry.js → p-5fe10b3f.entry.js} +1 -1
  121. package/dist/twilight/{p-415cf3e3.entry.js → p-60a1cceb.entry.js} +1 -1
  122. package/dist/twilight/{p-5f9bc177.entry.js → p-60aa330e.entry.js} +1 -1
  123. package/dist/twilight/{p-917e7e9e.entry.js → p-62b33ee4.entry.js} +1 -1
  124. package/dist/twilight/{p-ab6a475b.entry.js → p-66ccff79.entry.js} +1 -1
  125. package/dist/twilight/{p-64d30453.entry.js → p-6781caef.entry.js} +1 -1
  126. package/dist/twilight/{p-c9109a79.entry.js → p-747b3306.entry.js} +1 -1
  127. package/dist/twilight/{p-a9c627f1.entry.js → p-8713ed50.entry.js} +1 -1
  128. package/dist/twilight/{p-9c51b8d3.entry.js → p-87c26055.entry.js} +1 -1
  129. package/dist/twilight/{p-30edc8e4.entry.js → p-9bb74d00.entry.js} +1 -1
  130. package/dist/twilight/{p-Ez0e1PVX.js → p-BENXSP8S.js} +1 -1
  131. package/dist/twilight/{p-BX_7gR2g.js → p-BdPzpmIq.js} +1 -1
  132. package/dist/twilight/p-CBT_Nxny.js +4 -0
  133. package/dist/twilight/{p-hVSNpsuQ.js → p-CFX5Won9.js} +1 -1
  134. package/dist/twilight/{p-BXOeDpV2.js → p-CYIyfWLw.js} +1 -1
  135. package/dist/twilight/{p-7wg_fRFs.js → p-CdhBe5Fz.js} +1 -1
  136. package/dist/twilight/{p-C0j6-TqH.js → p-D7xuopBR.js} +1 -1
  137. package/dist/twilight/{p-Ziat6EbF.js → p-D8Ikl-5X.js} +2 -2
  138. package/dist/twilight/{p-ZreQEa1A.js → p-DQJu53PU.js} +1 -1
  139. package/dist/twilight/{p-4edf534b.entry.js → p-a608994f.entry.js} +1 -1
  140. package/dist/twilight/{p-ca431a2c.entry.js → p-ade5c1b4.entry.js} +1 -1
  141. package/dist/twilight/{p-1287dd6d.entry.js → p-c0804853.entry.js} +1 -1
  142. package/dist/twilight/{p-745e8f76.entry.js → p-dded0945.entry.js} +1 -1
  143. package/dist/twilight/p-e7b610b8.entry.js +11 -0
  144. package/dist/twilight/{p-e79994cc.entry.js → p-e82e0803.entry.js} +1 -1
  145. package/dist/twilight/{p-cd7e4279.entry.js → p-ecdb32fb.entry.js} +1 -1
  146. package/dist/twilight/{p-a9da8a2e.entry.js → p-f0267809.entry.js} +1 -1
  147. package/dist/twilight/{p-66ab7e17.entry.js → p-f30f7e03.entry.js} +1 -1
  148. package/dist/twilight/{p-f5a11fd5.entry.js → p-f8beff97.entry.js} +1 -1
  149. package/dist/twilight/{p-BBY0-pTD.js → p-fl5mSXGV.js} +1 -1
  150. package/dist/twilight/twilight.esm.js +1 -1
  151. package/dist/types/components/salla-custom-fields/salla-custom-fields.d.ts +39 -0
  152. package/dist/types/components/salla-file-upload/salla-file-upload.d.ts +4 -0
  153. package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +6 -2
  154. package/dist/types/components/salla-user-profile/interfaces.d.ts +1 -0
  155. package/dist/types/components/salla-user-profile/salla-user-profile.d.ts +1 -20
  156. package/dist/types/components.d.ts +74 -25
  157. package/package.json +5 -5
  158. package/dist/twilight/p-c6d04437.entry.js +0 -11
@@ -2,16 +2,13 @@
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
4
  import { h } from "@stencil/core";
5
- import { Genders, FormFieldTypes } from "./interfaces";
6
- import CameraIcon from "../../assets/svg/camera.svg";
5
+ import { Genders } from "./interfaces";
7
6
  /**
8
7
  * The SallaUserProfile is a versatile user profile form
9
8
  * generator within the Salla platform, offering localization support,
10
9
  * customizable fields, and seamless integration with the Salla API.
11
10
  * It dynamically fetches translated strings for labels and messages from the
12
11
  * Salla localization object, allowing for a multilingual user interface. Users
13
- * can extend the default form with custom fields through the `customFields`
14
- * property and the setCustomFields method. The component manages user data
15
12
  * retrieval from the Salla configuration and includes fields for first name,
16
13
  * last name, birthday, gender, email, mobile, and custom additions. Form
17
14
  * validation and submission are handled through various event handlers, ensuring
@@ -28,7 +25,6 @@ export class SallaUserProfile {
28
25
  /**
29
26
  * The minimum allowed age for a user. Users with a birthdate indicating an age less than this value will be considered invalid.
30
27
  * Defaults to 10.
31
- * @type {number}
32
28
  */
33
29
  this.minAge = 10;
34
30
  this.isEditable = true;
@@ -75,20 +71,13 @@ export class SallaUserProfile {
75
71
  });
76
72
  });
77
73
  }
78
- /**
79
- * Sets custom fields for the component. Can be handy for non HTML usage.
80
- *
81
- * @param fields - An array of custom fields.
82
- */
83
- async setCustomFields(fields) {
84
- this.userDefinedFields = fields;
85
- }
86
74
  // Event handler for phone number field changes
87
75
  phoneNumberFieldEventHandler(data) {
88
76
  if (!data.detail.number) {
89
- return (this.disableAction = true);
77
+ this.disableAction = true;
78
+ return;
90
79
  }
91
- this.userData.phone.number = parseInt(data.detail.number);
80
+ this.userData.phone.number = Number.parseInt(data.detail.number);
92
81
  this.userData.phone.country = data.detail.country_code;
93
82
  this.disableAction = false;
94
83
  }
@@ -104,74 +93,34 @@ export class SallaUserProfile {
104
93
  }
105
94
  }
106
95
  }
107
- // Event handler for file upload changes
108
- handleOnFileAdded(key, data) {
109
- // TODO: the key in here, shall be not have whitespace. or the key for
110
- // the field shall be provided with one of the properties of the custom field
111
- if (!data.detail.error) {
112
- this.userData[key] = data.detail.file;
113
- this.disableAction = false;
114
- }
115
- else {
116
- this.disableAction = true;
117
- }
118
- }
119
96
  // Event handler for email input changes
120
97
  handleEmailInput(key, event) {
121
98
  const emailErrorDisplaySection = document.getElementById('email-error');
122
99
  const email = event.target.value;
123
100
  if (!email) {
124
101
  this.disableAction = true;
125
- return (emailErrorDisplaySection.textContent = this.email_required_trans);
102
+ emailErrorDisplaySection.textContent = this.email_required_trans;
103
+ return;
126
104
  }
127
105
  const emailPattern = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
128
106
  if (!emailPattern.test(email)) {
129
107
  this.disableAction = true;
130
- return (emailErrorDisplaySection.textContent = this.invalid_email_trans);
108
+ emailErrorDisplaySection.textContent = this.invalid_email_trans;
131
109
  }
132
110
  emailErrorDisplaySection.textContent = '';
133
111
  this.userData[key] = email;
134
112
  this.disableAction = false;
135
113
  }
136
- // Helper method to trim language code from URL
137
- trimLanguageCodeFromUrl(url, languageCode) {
138
- const pattern = new RegExp(`^(https?://[^/]+)\\/${languageCode}(.*)`, 'i');
139
- const match = url.replace(/\/+$/, '').match(pattern);
140
- if (match && match.length >= 2) {
141
- const [, baseUrl, restOfUrl] = match;
142
- return baseUrl + restOfUrl;
143
- }
144
- return url;
145
- }
146
- // Helper method to get file upload URL
147
- getFileUploadUrl() {
148
- return `${this.trimLanguageCodeFromUrl(salla.config.get('store.url'), salla.config.get('user.language_code'))}/upload-image`;
149
- }
150
- // Render custom fields based on user-defined fields
151
- renderCustomFields() {
152
- if (!this.userDefinedFields) {
153
- return '';
154
- }
155
- return this.userDefinedFields.map((field) => {
156
- return (h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: `${field.id}`, class: "s-user-profile-field-label" }, field.label), this.renderCustomField(field)));
157
- });
158
- }
159
- renderCustomField(field) {
160
- if (field.type !== FormFieldTypes.Photo) {
161
- return (h("input", { type: field.type, id: `${field.id}`, value: field.value, onChange: event => this.handleFieldChange(`custom_fields[${field.id}]`, event), name: `custom_fields[${field.id}]`, class: "form-input", required: field.required }));
162
- }
163
- return (h("salla-file-upload", { "instant-upload": true, value: field.value, url: this.getFileUploadUrl(), name: `custom_fields[${field.id}]`, "payload-name": "image", height: "120px", onAdded: data => this.handleOnFileAdded(`custom_fields[${field.id}]`, data) }, h("div", { class: "s-user-profile-filepond-placeholder" }, h("span", { class: "s-user-profile-filepond-placeholder-icon" }, h("i", { innerHTML: CameraIcon })), h("p", { class: "s-user-profile-filepond-placeholder-text" }, this.drag_and_drop_trans), h("span", { class: "filepond--label-action" }, this.browse_trans))));
164
- }
165
114
  // Submit form method
166
115
  submitForm(event) {
167
116
  event.preventDefault();
168
117
  this.disableAction = true;
169
- let payload = Object.assign({}, this.userData);
170
- delete payload.phone;
118
+ const payload = Object.assign({}, this.userData);
119
+ payload.phone = undefined;
171
120
  //@ts-ignore
172
- payload['phone'] = this.userData.phone.number;
173
- payload['country_code'] = this.userData.phone.country;
174
- return salla.api.profile.update(payload).finally(() => (this.disableAction = false));
121
+ payload.phone = this.userData.phone.number;
122
+ payload.country_code = this.userData.phone.country;
123
+ salla.api.profile.update(payload).finally(() => { this.disableAction = false; });
175
124
  }
176
125
  getBirthDateRestriction() {
177
126
  const now = new Date();
@@ -180,19 +129,9 @@ export class SallaUserProfile {
180
129
  return now;
181
130
  }
182
131
  fetchData() {
183
- let customFields = null;
184
- // Load user-defined fields and initial user data
185
- if (this.customFields) {
186
- customFields = typeof this.customFields === 'string'
187
- ? JSON.parse(this.customFields)
188
- : this.customFields;
189
- }
190
- if (customFields && Array.isArray(customFields)) {
191
- this.userDefinedFields = customFields;
192
- }
193
132
  return salla.api.profile
194
133
  .info()
195
- .then(resp => (this.userData = resp.data))
134
+ .then(resp => { this.userData = resp.data; })
196
135
  .finally(() => {
197
136
  this.isLoading = false;
198
137
  this.isEditable = !Salla.config.get('store.features').includes('sso-login');
@@ -208,7 +147,7 @@ export class SallaUserProfile {
208
147
  if (this.isLoading) {
209
148
  return this.renderLoadingSection();
210
149
  }
211
- return (h("form", { onSubmit: event => this.submitForm(event) }, h("div", { class: "s-user-profile-wrapper" }, h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "first-name", class: "s-user-profile-field-label" }, this.first_name_trans), h("input", { disabled: !this.isEditable, type: "text", name: "first_name", value: this.userData.first_name, id: "first-name", required: true, autocomplete: "first_name", class: "form-input", onChange: event => this.handleFieldChange('first_name', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "last-name", class: "s-user-profile-field-label" }, this.last_name_trans), h("input", { disabled: !this.isEditable, type: "text", name: "last_name", value: this.userData.last_name, id: "last-name", required: true, autocomplete: "last_name", class: "form-input", onChange: event => this.handleFieldChange('last_name', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "birthday", class: "s-user-profile-field-label" }, this.birthday_trans), h("salla-datetime-picker", { disabled: !this.isEditable, dateFormat: "Y-m-d", value: this.userData.birthday, placeholder: this.birthday_placeholder_trans, required: true, maxDate: this.getBirthDateRestriction(), name: "birthday", onPicked: event => this.handleFieldChange('birthday', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "gender", class: "s-user-profile-field-label" }, this.gender_trans), h("select", { disabled: !this.isEditable, class: "form-input", name: "gender", required: true, onChange: event => this.handleFieldChange('gender', event) }, h("option", { value: "" }, this.gender_placeholder_trans), h("option", { value: Genders.Male, selected: this.userData.gender == Genders.Male }, this.male_trans), h("option", { value: Genders.Female, selected: this.userData.gender == Genders.Female }, this.female_trans))), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "email", class: "s-user-profile-field-label" }, this.email_trans), h("input", { disabled: !this.isEditable, type: "email", name: "email", value: this.userData.email, id: "email", class: "form-input", required: true, onInput: event => this.handleEmailInput('email', event) }), h("p", { id: "email-error", class: "s-user-profile-field-error" })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "international-mobile", class: "s-user-profile-field-label" }, this.mobile_trans), h("salla-tel-input", { disabled: !this.isEditable, name: "international-mobile", "country-code": this.userData.phone.country, phone: `${this.userData.phone.number}`, onPhoneEntered: data => this.phoneNumberFieldEventHandler(data) })), this.isEditable && this.renderCustomFields()), h("salla-button", { type: "submit", loading: this.disableAction, disabled: this.disableAction || !this.isEditable, "loader-position": "end", class: "s-user-profile-submit" }, this.save_btn_trans)));
150
+ return (h("form", { onSubmit: event => this.submitForm(event) }, h("div", { class: "s-user-profile-wrapper" }, h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "first-name", class: "s-user-profile-field-label" }, this.first_name_trans), h("input", { disabled: !this.isEditable, type: "text", name: "first_name", value: this.userData.first_name, id: "first-name", required: true, autocomplete: "first_name", class: "form-input", onChange: event => this.handleFieldChange('first_name', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "last-name", class: "s-user-profile-field-label" }, this.last_name_trans), h("input", { disabled: !this.isEditable, type: "text", name: "last_name", value: this.userData.last_name, id: "last-name", required: true, autocomplete: "last_name", class: "form-input", onChange: event => this.handleFieldChange('last_name', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "birthday", class: "s-user-profile-field-label" }, this.birthday_trans), h("salla-datetime-picker", { disabled: !this.isEditable, dateFormat: "Y-m-d", value: this.userData.birthday, placeholder: this.birthday_placeholder_trans, required: true, maxDate: this.getBirthDateRestriction(), name: "birthday", onPicked: event => this.handleFieldChange('birthday', event) })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "gender", class: "s-user-profile-field-label" }, this.gender_trans), h("select", { disabled: !this.isEditable, class: "form-input", name: "gender", required: true, onChange: event => this.handleFieldChange('gender', event) }, h("option", { value: "" }, this.gender_placeholder_trans), h("option", { value: Genders.Male, selected: this.userData.gender === Genders.Male }, this.male_trans), h("option", { value: Genders.Female, selected: this.userData.gender === Genders.Female }, this.female_trans))), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "email", class: "s-user-profile-field-label" }, this.email_trans), h("input", { disabled: !this.isEditable, type: "email", name: "email", value: this.userData.email, id: "email", class: "form-input", required: true, onInput: event => this.handleEmailInput('email', event) }), h("p", { id: "email-error", class: "s-user-profile-field-error" })), h("div", { class: "s-user-profile-field" }, h("label", { htmlFor: "international-mobile", class: "s-user-profile-field-label" }, this.mobile_trans), h("salla-tel-input", { disabled: !this.isEditable, name: "international-mobile", "country-code": this.userData.phone.country, phone: `${this.userData.phone.number}`, onPhoneEntered: data => this.phoneNumberFieldEventHandler(data) }))), h("salla-button", { type: "submit", loading: this.disableAction, disabled: this.disableAction || !this.isEditable, "loader-position": "end", class: "s-user-profile-submit" }, this.save_btn_trans)));
212
151
  }
213
152
  static get is() { return "salla-user-profile"; }
214
153
  static get originalStyleUrls() {
@@ -223,25 +162,6 @@ export class SallaUserProfile {
223
162
  }
224
163
  static get properties() {
225
164
  return {
226
- "customFields": {
227
- "type": "string",
228
- "attribute": "custom-fields",
229
- "mutable": false,
230
- "complexType": {
231
- "original": "string",
232
- "resolved": "string",
233
- "references": {}
234
- },
235
- "required": false,
236
- "optional": false,
237
- "docs": {
238
- "tags": [],
239
- "text": "Custome fields to be rendered in addition to the default ones."
240
- },
241
- "getter": false,
242
- "setter": false,
243
- "reflect": false
244
- },
245
165
  "minAge": {
246
166
  "type": "number",
247
167
  "attribute": "min-age",
@@ -254,10 +174,7 @@ export class SallaUserProfile {
254
174
  "required": false,
255
175
  "optional": false,
256
176
  "docs": {
257
- "tags": [{
258
- "name": "type",
259
- "text": "{number}"
260
- }],
177
+ "tags": [],
261
178
  "text": "The minimum allowed age for a user. Users with a birthdate indicating an age less than this value will be considered invalid.\nDefaults to 10."
262
179
  },
263
180
  "getter": false,
@@ -271,7 +188,6 @@ export class SallaUserProfile {
271
188
  return {
272
189
  "userData": {},
273
190
  "isEditable": {},
274
- "userDefinedFields": {},
275
191
  "disableAction": {},
276
192
  "isLoading": {},
277
193
  "first_name_trans": {},
@@ -291,37 +207,4 @@ export class SallaUserProfile {
291
207
  "invalid_email_trans": {}
292
208
  };
293
209
  }
294
- static get methods() {
295
- return {
296
- "setCustomFields": {
297
- "complexType": {
298
- "signature": "(fields: CustomField[]) => Promise<void>",
299
- "parameters": [{
300
- "name": "fields",
301
- "type": "CustomField[]",
302
- "docs": "- An array of custom fields."
303
- }],
304
- "references": {
305
- "Promise": {
306
- "location": "global",
307
- "id": "global::Promise"
308
- },
309
- "CustomField": {
310
- "location": "import",
311
- "path": "./interfaces",
312
- "id": "src/components/salla-user-profile/interfaces.ts::CustomField"
313
- }
314
- },
315
- "return": "Promise<void>"
316
- },
317
- "docs": {
318
- "text": "Sets custom fields for the component. Can be handy for non HTML usage.",
319
- "tags": [{
320
- "name": "param",
321
- "text": "fields - An array of custom fields."
322
- }]
323
- }
324
- }
325
- };
326
- }
327
210
  }