adp-web-components 0.0.65 → 0.0.66
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.
- package/dist/cjs/app-globals-4aa8f46f.js +46 -0
- package/dist/cjs/cn-f559f9e5.js +2588 -0
- package/dist/cjs/contact-us-form.cjs.entry.js +209 -0
- package/dist/cjs/dead-stock-lookup_3.cjs.entry.js +445 -0
- package/dist/cjs/dynamic-claim_6.cjs.entry.js +1179 -0
- package/dist/cjs/dynamic-redeem.cjs.entry.js +156 -0
- package/dist/cjs/form-dialog_8.cjs.entry.js +503 -0
- package/dist/cjs/get-local-language-1bd9662d.js +2381 -0
- package/dist/cjs/index-603d8f32.js +1610 -0
- package/dist/cjs/index.cjs.js +6 -0
- package/dist/cjs/loader-baf2418b.js +9 -0
- package/dist/cjs/loader.cjs.js +19 -0
- package/dist/cjs/loading-spinner.cjs.entry.js +27 -0
- package/dist/cjs/part-lookup.cjs.entry.js +129 -0
- package/dist/cjs/service-booking-form.cjs.entry.js +209 -0
- package/dist/cjs/shift-components.cjs.js +29 -0
- package/dist/cjs/urls-9077b31c.js +4874 -0
- package/dist/cjs/vehicle-lookup.cjs.entry.js +202 -0
- package/dist/collection/collection-manifest.json +35 -0
- package/dist/collection/components/components/loading-spinner.css +1 -0
- package/dist/collection/components/components/loading-spinner.js +47 -0
- package/dist/collection/components/form-elements/form-dialog.css +1 -0
- package/dist/collection/components/form-elements/form-dialog.js +137 -0
- package/dist/collection/components/form-elements/form-input.css +1 -0
- package/dist/collection/components/form-elements/form-input.js +323 -0
- package/dist/collection/components/form-elements/form-select.css +1 -0
- package/dist/collection/components/form-elements/form-select.js +400 -0
- package/dist/collection/components/form-elements/form-shadow-input.css +1 -0
- package/dist/collection/components/form-elements/form-shadow-input.js +100 -0
- package/dist/collection/components/form-elements/form-structure-error.css +1 -0
- package/dist/collection/components/form-elements/form-structure-error.js +72 -0
- package/dist/collection/components/form-elements/form-structure.css +1 -0
- package/dist/collection/components/form-elements/form-structure.js +269 -0
- package/dist/collection/components/form-elements/form-submit.css +1 -0
- package/dist/collection/components/form-elements/form-submit.js +140 -0
- package/dist/collection/components/form-elements/form-text-area.css +1 -0
- package/dist/collection/components/form-elements/form-text-area.js +264 -0
- package/dist/collection/components/forms/contact-us/element-mapper.js +87 -0
- package/dist/collection/components/forms/contact-us/form.css +1 -0
- package/dist/collection/components/forms/contact-us/validations.js +19 -0
- package/dist/collection/components/forms/contact-us-form.js +280 -0
- package/dist/collection/components/forms/service-booking/element-mapper.js +87 -0
- package/dist/collection/components/forms/service-booking/form.css +1 -0
- package/dist/collection/components/forms/service-booking/validations.js +19 -0
- package/dist/collection/components/forms/service-booking-form.js +280 -0
- package/dist/collection/components/part-lookup/dead-stock-lookup.css +1 -0
- package/dist/collection/components/part-lookup/dead-stock-lookup.js +405 -0
- package/dist/collection/components/part-lookup/distributor-lookup.css +1 -0
- package/dist/collection/components/part-lookup/distributor-lookup.js +470 -0
- package/dist/collection/components/part-lookup/manufacturer-lookup.css +1 -0
- package/dist/collection/components/part-lookup/manufacturer-lookup.js +468 -0
- package/dist/collection/components/part-lookup/part-lookup.css +1 -0
- package/dist/collection/components/part-lookup/part-lookup.js +376 -0
- package/dist/collection/components/vehicle-lookup/assets/cancelled.svg +8 -0
- package/dist/collection/components/vehicle-lookup/assets/check.svg +4 -0
- package/dist/collection/components/vehicle-lookup/assets/expired.svg +9 -0
- package/dist/collection/components/vehicle-lookup/assets/loader.svg +11 -0
- package/dist/collection/components/vehicle-lookup/assets/pending.svg +9 -0
- package/dist/collection/components/vehicle-lookup/assets/processed.svg +9 -0
- package/dist/collection/components/vehicle-lookup/assets/x-mark.svg +4 -0
- package/dist/collection/components/vehicle-lookup/components/CardsContainer.js +13 -0
- package/dist/collection/components/vehicle-lookup/components/Loading.js +10 -0
- package/dist/collection/components/vehicle-lookup/components/SSCTable.js +16 -0
- package/dist/collection/components/vehicle-lookup/components/StatusCard.js +11 -0
- package/dist/collection/components/vehicle-lookup/dynamic-claim.css +1 -0
- package/dist/collection/components/vehicle-lookup/dynamic-claim.js +625 -0
- package/dist/collection/components/vehicle-lookup/dynamic-redeem.css +1 -0
- package/dist/collection/components/vehicle-lookup/dynamic-redeem.js +373 -0
- package/dist/collection/components/vehicle-lookup/paint-thickness.css +1 -0
- package/dist/collection/components/vehicle-lookup/paint-thickness.js +410 -0
- package/dist/collection/components/vehicle-lookup/service-history.css +1 -0
- package/dist/collection/components/vehicle-lookup/service-history.js +393 -0
- package/dist/collection/components/vehicle-lookup/vehicle-accessories.css +1 -0
- package/dist/collection/components/vehicle-lookup/vehicle-accessories.js +414 -0
- package/dist/collection/components/vehicle-lookup/vehicle-lookup.css +1 -0
- package/dist/collection/components/vehicle-lookup/vehicle-lookup.js +405 -0
- package/dist/collection/components/vehicle-lookup/vehicle-specification.css +1 -0
- package/dist/collection/components/vehicle-lookup/vehicle-specification.js +405 -0
- package/dist/collection/components/vehicle-lookup/warranty-details.css +1 -0
- package/dist/collection/components/vehicle-lookup/warranty-details.js +780 -0
- package/dist/collection/global/api/partInformation.js +32 -0
- package/dist/collection/global/api/urls.js +6 -0
- package/dist/collection/global/api/vehicleInformation.js +48 -0
- package/dist/collection/global/assets/eye.svg +5 -0
- package/dist/collection/global/assets/loader.svg +11 -0
- package/dist/collection/global/assets/white-loader.svg +11 -0
- package/dist/collection/global/lib/cn.js +9 -0
- package/dist/collection/global/lib/form-hook.js +162 -0
- package/dist/collection/global/lib/general.js +9 -0
- package/dist/collection/global/lib/get-local-language.js +20 -0
- package/dist/collection/global/lib/image-expansion.js +69 -0
- package/dist/collection/global/lib/middleware.js +39 -0
- package/dist/collection/global/lib/recaptcha.js +25 -0
- package/dist/collection/global/lib/utils.js +7 -0
- package/dist/collection/global/lib/validate-form-structure.js +47 -0
- package/dist/collection/global/lib/validate-vin.js +62 -0
- package/dist/collection/global/types/components.js +1 -0
- package/dist/collection/global/types/forms.js +1 -0
- package/dist/collection/global/types/general.js +1 -0
- package/dist/collection/global/types/locales/error-schema.js +17 -0
- package/dist/collection/global/types/locales/forms/contact-us-schema.js +24 -0
- package/dist/collection/global/types/locales/forms/index.js +11 -0
- package/dist/collection/global/types/locales/general.js +11 -0
- package/dist/collection/global/types/locales/index.js +33 -0
- package/dist/collection/global/types/locales/inquiryTypes.js +15 -0
- package/dist/collection/global/types/locales/part-lookup/dead-stock-schema.js +10 -0
- package/dist/collection/global/types/locales/part-lookup/distributor-schema.js +21 -0
- package/dist/collection/global/types/locales/part-lookup/index.js +13 -0
- package/dist/collection/global/types/locales/part-lookup/manufacturer-schema.js +22 -0
- package/dist/collection/global/types/locales/vehicle-lookup/accessories-schema.js +13 -0
- package/dist/collection/global/types/locales/vehicle-lookup/dynamic-claim-schema.js +21 -0
- package/dist/collection/global/types/locales/vehicle-lookup/dynamic-redeem-schema.js +19 -0
- package/dist/collection/global/types/locales/vehicle-lookup/index.js +21 -0
- package/dist/collection/global/types/locales/vehicle-lookup/paint-thickness-schema.js +14 -0
- package/dist/collection/global/types/locales/vehicle-lookup/service-history-schema.js +15 -0
- package/dist/collection/global/types/locales/vehicle-lookup/specification-schema.js +15 -0
- package/dist/collection/global/types/locales/vehicle-lookup/warranty-schema.js +23 -0
- package/dist/collection/global/types/part-information.js +1 -0
- package/dist/collection/global/types/vehicle-information.js +5 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/templates/part-lookup/mock-data.js +199 -0
- package/dist/collection/templates/vehicle-lookup/mock-data.js +4165 -0
- package/dist/collection/templates/vehicle-lookup/vehicle-lookup.js +285 -0
- package/dist/collection/templates/vehicle-lookup/warranty-mock-data.js +3064 -0
- package/dist/components/contact-us-form.d.ts +11 -0
- package/dist/components/contact-us-form.js +5 -0
- package/dist/components/dead-stock-lookup.d.ts +11 -0
- package/dist/components/dead-stock-lookup.js +5 -0
- package/dist/components/distributor-lookup.d.ts +11 -0
- package/dist/components/distributor-lookup.js +5 -0
- package/dist/components/dynamic-claim.d.ts +11 -0
- package/dist/components/dynamic-claim.js +5 -0
- package/dist/components/dynamic-redeem.d.ts +11 -0
- package/dist/components/dynamic-redeem.js +5 -0
- package/dist/components/form-dialog.d.ts +11 -0
- package/dist/components/form-dialog.js +5 -0
- package/dist/components/form-input.d.ts +11 -0
- package/dist/components/form-input.js +5 -0
- package/dist/components/form-select.d.ts +11 -0
- package/dist/components/form-select.js +5 -0
- package/dist/components/form-shadow-input.d.ts +11 -0
- package/dist/components/form-shadow-input.js +5 -0
- package/dist/components/form-structure-error.d.ts +11 -0
- package/dist/components/form-structure-error.js +5 -0
- package/dist/components/form-structure.d.ts +11 -0
- package/dist/components/form-structure.js +5 -0
- package/dist/components/form-submit.d.ts +11 -0
- package/dist/components/form-submit.js +5 -0
- package/dist/components/form-text-area.d.ts +11 -0
- package/dist/components/form-text-area.js +5 -0
- package/dist/components/index.d.ts +33 -0
- package/dist/components/index.js +5 -0
- package/dist/components/loading-spinner.d.ts +11 -0
- package/dist/components/loading-spinner.js +5 -0
- package/dist/components/manufacturer-lookup.d.ts +11 -0
- package/dist/components/manufacturer-lookup.js +5 -0
- package/dist/components/p-052096ca.js +5 -0
- package/dist/components/p-1e0220d8.js +5 -0
- package/dist/components/p-276072d6.js +5 -0
- package/dist/components/p-2ecc6382.js +5 -0
- package/dist/components/p-2f40bc45.js +5 -0
- package/dist/components/p-3115916e.js +5 -0
- package/dist/components/p-687e3edf.js +5 -0
- package/dist/components/p-68905104.js +5 -0
- package/dist/components/p-696dc6e8.js +5 -0
- package/dist/components/p-6d9d89d2.js +5 -0
- package/dist/components/p-6e258875.js +5 -0
- package/dist/components/p-75476014.js +5 -0
- package/dist/components/p-8175feb0.js +5 -0
- package/dist/components/p-853de183.js +5 -0
- package/dist/components/p-8b1d90d7.js +5 -0
- package/dist/components/p-8f9c80ed.js +5 -0
- package/dist/components/p-927296bb.js +5 -0
- package/dist/components/p-932ff922.js +5 -0
- package/dist/components/p-96455129.js +5 -0
- package/dist/components/p-980e2b72.js +5 -0
- package/dist/components/p-98d9e7ab.js +5 -0
- package/dist/components/p-a21e2e2e.js +5 -0
- package/dist/components/p-a3455344.js +5 -0
- package/dist/components/p-b0e5a9a2.js +5 -0
- package/dist/components/p-b173a699.js +5 -0
- package/dist/components/p-d5ff7544.js +5 -0
- package/dist/components/p-fab97ac7.js +5 -0
- package/dist/components/paint-thickness.d.ts +11 -0
- package/dist/components/paint-thickness.js +5 -0
- package/dist/components/part-lookup.d.ts +11 -0
- package/dist/components/part-lookup.js +5 -0
- package/dist/components/service-booking-form.d.ts +11 -0
- package/dist/components/service-booking-form.js +5 -0
- package/dist/components/service-history.d.ts +11 -0
- package/dist/components/service-history.js +5 -0
- package/dist/components/vehicle-accessories.d.ts +11 -0
- package/dist/components/vehicle-accessories.js +5 -0
- package/dist/components/vehicle-lookup.d.ts +11 -0
- package/dist/components/vehicle-lookup.js +5 -0
- package/dist/components/vehicle-specification.d.ts +11 -0
- package/dist/components/vehicle-specification.js +5 -0
- package/dist/components/warranty-details.d.ts +11 -0
- package/dist/components/warranty-details.js +5 -0
- package/dist/esm/app-globals-68faa233.js +44 -0
- package/dist/esm/cn-cc419b94.js +2586 -0
- package/dist/esm/contact-us-form.entry.js +205 -0
- package/dist/esm/dead-stock-lookup_3.entry.js +439 -0
- package/dist/esm/dynamic-claim_6.entry.js +1170 -0
- package/dist/esm/dynamic-redeem.entry.js +152 -0
- package/dist/esm/form-dialog_8.entry.js +492 -0
- package/dist/esm/get-local-language-b7774134.js +2376 -0
- package/dist/esm/index-cac905b0.js +1581 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/loader-027b88af.js +7 -0
- package/dist/esm/loader.js +15 -0
- package/dist/esm/loading-spinner.entry.js +23 -0
- package/dist/esm/part-lookup.entry.js +125 -0
- package/dist/esm/service-booking-form.entry.js +205 -0
- package/dist/esm/shift-components.js +24 -0
- package/dist/esm/urls-e22234f9.js +4870 -0
- package/dist/esm/vehicle-lookup.entry.js +198 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/locales/ar.json +185 -0
- package/dist/locales/en.json +185 -0
- package/dist/locales/ku.json +185 -0
- package/dist/locales/ru.json +185 -0
- package/dist/shift-components/index.esm.js +4 -0
- package/dist/shift-components/p-3601fde1.entry.js +5 -0
- package/dist/shift-components/p-446d908d.js +5 -0
- package/dist/shift-components/p-65102e7a.js +6 -0
- package/dist/shift-components/p-6b5de2b4.entry.js +5 -0
- package/dist/shift-components/p-7a95ce0a.entry.js +5 -0
- package/dist/shift-components/p-932ff922.js +5 -0
- package/dist/shift-components/p-98d9e7ab.js +5 -0
- package/dist/shift-components/p-9b664248.entry.js +5 -0
- package/dist/shift-components/p-a21e2e2e.js +5 -0
- package/dist/shift-components/p-ade77e74.entry.js +5 -0
- package/dist/shift-components/p-b43b884e.entry.js +5 -0
- package/dist/shift-components/p-c451136b.entry.js +5 -0
- package/dist/shift-components/p-d2a71388.entry.js +5 -0
- package/dist/shift-components/p-d5a81c37.entry.js +5 -0
- package/dist/shift-components/p-f0d94591.js +5 -0
- package/dist/shift-components/shift-components.esm.js +5 -0
- package/dist/types/components/components/loading-spinner.d.ts +4 -0
- package/dist/types/components/form-elements/form-dialog.d.ts +13 -0
- package/dist/types/components/form-elements/form-input.d.ts +28 -0
- package/dist/types/components/form-elements/form-select.d.ts +39 -0
- package/dist/types/components/form-elements/form-shadow-input.d.ts +9 -0
- package/dist/types/components/form-elements/form-structure-error.d.ts +8 -0
- package/dist/types/components/form-elements/form-structure.d.ts +23 -0
- package/dist/types/components/form-elements/form-submit.d.ts +12 -0
- package/dist/types/components/form-elements/form-text-area.d.ts +24 -0
- package/dist/types/components/forms/contact-us/element-mapper.d.ts +3 -0
- package/dist/types/components/forms/contact-us/validations.d.ts +26 -0
- package/dist/types/components/forms/contact-us-form.d.ts +32 -0
- package/dist/types/components/forms/service-booking/element-mapper.d.ts +3 -0
- package/dist/types/components/forms/service-booking/validations.d.ts +26 -0
- package/dist/types/components/forms/service-booking-form.d.ts +32 -0
- package/dist/types/components/part-lookup/dead-stock-lookup.d.ts +31 -0
- package/dist/types/components/part-lookup/distributor-lookup.d.ts +32 -0
- package/dist/types/components/part-lookup/manufacturer-lookup.d.ts +33 -0
- package/dist/types/components/part-lookup/part-lookup.d.ts +43 -0
- package/dist/types/components/vehicle-lookup/components/CardsContainer.d.ts +10 -0
- package/dist/types/components/vehicle-lookup/components/Loading.d.ts +5 -0
- package/dist/types/components/vehicle-lookup/components/SSCTable.d.ts +8 -0
- package/dist/types/components/vehicle-lookup/components/StatusCard.d.ts +12 -0
- package/dist/types/components/vehicle-lookup/dynamic-claim.d.ts +55 -0
- package/dist/types/components/vehicle-lookup/dynamic-redeem.d.ts +39 -0
- package/dist/types/components/vehicle-lookup/paint-thickness.d.ts +35 -0
- package/dist/types/components/vehicle-lookup/service-history.d.ts +30 -0
- package/dist/types/components/vehicle-lookup/vehicle-accessories.d.ts +35 -0
- package/dist/types/components/vehicle-lookup/vehicle-lookup.d.ts +53 -0
- package/dist/types/components/vehicle-lookup/vehicle-specification.d.ts +29 -0
- package/dist/types/components/vehicle-lookup/warranty-details.d.ts +57 -0
- package/dist/types/components.d.ts +760 -0
- package/dist/types/global/api/partInformation.d.ts +19 -0
- package/dist/types/global/api/urls.d.ts +2 -0
- package/dist/types/global/api/vehicleInformation.d.ts +33 -0
- package/dist/types/global/lib/cn.d.ts +2 -0
- package/dist/types/global/lib/form-hook.d.ts +47 -0
- package/dist/types/global/lib/general.d.ts +1 -0
- package/dist/types/global/lib/get-local-language.d.ts +2 -0
- package/dist/types/global/lib/image-expansion.d.ts +9 -0
- package/dist/types/global/lib/middleware.d.ts +0 -0
- package/dist/types/global/lib/recaptcha.d.ts +16 -0
- package/dist/types/global/lib/utils.d.ts +1 -0
- package/dist/types/global/lib/validate-form-structure.d.ts +3 -0
- package/dist/types/global/lib/validate-vin.d.ts +1 -0
- package/dist/types/global/types/components.d.ts +7 -0
- package/dist/types/global/types/forms.d.ts +63 -0
- package/dist/types/global/types/general.d.ts +23 -0
- package/dist/types/global/types/locales/error-schema.d.ts +23 -0
- package/dist/types/global/types/locales/forms/contact-us-schema.d.ts +37 -0
- package/dist/types/global/types/locales/forms/index.d.ts +45 -0
- package/dist/types/global/types/locales/general.d.ts +11 -0
- package/dist/types/global/types/locales/index.d.ts +382 -0
- package/dist/types/global/types/locales/inquiryTypes.d.ts +19 -0
- package/dist/types/global/types/locales/part-lookup/dead-stock-schema.d.ts +9 -0
- package/dist/types/global/types/locales/part-lookup/distributor-schema.d.ts +31 -0
- package/dist/types/global/types/locales/part-lookup/index.d.ts +79 -0
- package/dist/types/global/types/locales/part-lookup/manufacturer-schema.d.ts +33 -0
- package/dist/types/global/types/locales/vehicle-lookup/accessories-schema.d.ts +15 -0
- package/dist/types/global/types/locales/vehicle-lookup/dynamic-claim-schema.d.ts +31 -0
- package/dist/types/global/types/locales/vehicle-lookup/dynamic-redeem-schema.d.ts +27 -0
- package/dist/types/global/types/locales/vehicle-lookup/index.d.ts +173 -0
- package/dist/types/global/types/locales/vehicle-lookup/paint-thickness-schema.d.ts +17 -0
- package/dist/types/global/types/locales/vehicle-lookup/service-history-schema.d.ts +19 -0
- package/dist/types/global/types/locales/vehicle-lookup/specification-schema.d.ts +19 -0
- package/dist/types/global/types/locales/vehicle-lookup/warranty-schema.d.ts +35 -0
- package/dist/types/global/types/part-information.d.ts +53 -0
- package/dist/types/global/types/vehicle-information.d.ts +172 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/stencil-public-runtime.d.ts +1680 -0
- package/loader/cdn.js +5 -0
- package/loader/index.cjs.js +5 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +5 -0
- package/loader/index.js +6 -0
- package/loader/package.json +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
import { Host, h } from "@stencil/core";
|
|
6
|
+
import cn from "../../global/lib/cn";
|
|
7
|
+
import { FormHook } from "../../global/lib/form-hook";
|
|
8
|
+
import { contactUsSchema } from "./contact-us/validations";
|
|
9
|
+
import themes from "./contact-us/themes.json";
|
|
10
|
+
import { contactUsElements } from "./contact-us/element-mapper";
|
|
11
|
+
export class ContactUsForm {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.recaptchaWidget = null;
|
|
14
|
+
this.form = new FormHook(this, contactUsSchema);
|
|
15
|
+
this.theme = undefined;
|
|
16
|
+
this.baseUrl = undefined;
|
|
17
|
+
this.brandId = undefined;
|
|
18
|
+
this.queryString = '';
|
|
19
|
+
this.language = 'en';
|
|
20
|
+
this.structure = '["submit.Submit"]';
|
|
21
|
+
this.recaptchaKey = '6Lehq6IpAAAAAETTDS2Zh60nHIT1a8oVkRtJ2WsA';
|
|
22
|
+
this.errorCallback = undefined;
|
|
23
|
+
this.successCallback = undefined;
|
|
24
|
+
this.loadingChanges = undefined;
|
|
25
|
+
this.isLoading = undefined;
|
|
26
|
+
this.renderControl = {};
|
|
27
|
+
this.errorMessage = undefined;
|
|
28
|
+
}
|
|
29
|
+
async componentDidLoad() {
|
|
30
|
+
try {
|
|
31
|
+
if (this.recaptchaKey) {
|
|
32
|
+
const script = document.createElement('script');
|
|
33
|
+
script.src = `https://www.google.com/recaptcha/api.js?render=${this.recaptchaKey}&hl=${this.language}`;
|
|
34
|
+
script.async = true;
|
|
35
|
+
script.defer = true;
|
|
36
|
+
document.head.appendChild(script);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.log(error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async formSubmit(formValues) {
|
|
44
|
+
try {
|
|
45
|
+
if (this.loadingChanges)
|
|
46
|
+
this.loadingChanges(true);
|
|
47
|
+
const token = await grecaptcha.execute(this.recaptchaKey, { action: 'submit' });
|
|
48
|
+
const response = await fetch(`${this.baseUrl}?${this.queryString}`, {
|
|
49
|
+
method: 'post',
|
|
50
|
+
body: JSON.stringify(formValues),
|
|
51
|
+
headers: {
|
|
52
|
+
'Brand': this.brandId,
|
|
53
|
+
'Recaptcha-Token': token,
|
|
54
|
+
'Accept-Language': this.language,
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const data = await response.json();
|
|
59
|
+
if (this.successCallback)
|
|
60
|
+
this.successCallback(data);
|
|
61
|
+
this.form.successAnimation();
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
this.form.reset();
|
|
64
|
+
}, 1000);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.error(error);
|
|
68
|
+
if (this.errorCallback)
|
|
69
|
+
this.errorCallback(error);
|
|
70
|
+
if (error === null || error === void 0 ? void 0 : error.message)
|
|
71
|
+
this.errorMessage = error.message;
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
if (this.loadingChanges)
|
|
75
|
+
this.loadingChanges(false);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
render() {
|
|
79
|
+
return (h(Host, { key: '3712c418776cd3a7369579b13976e723aa278017', class: cn({
|
|
80
|
+
[`contact-us-${this.theme}`]: this.theme,
|
|
81
|
+
}) }, h("form-structure", { key: 'e36959c4001f84f065e089910ef33f00616eb4d6', themes: themes, form: this.form, theme: this.theme, language: this.language, isLoading: this.isLoading, errorMessage: this.errorMessage, renderControl: this.renderControl, formElementMapper: contactUsElements }, h("slot", { key: '1a173c59f33dbb28a378ab6702f513ae7e061b55' }))));
|
|
82
|
+
}
|
|
83
|
+
static get is() { return "contact-us-form"; }
|
|
84
|
+
static get originalStyleUrls() {
|
|
85
|
+
return {
|
|
86
|
+
"$": ["contact-us/form.css"]
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
static get styleUrls() {
|
|
90
|
+
return {
|
|
91
|
+
"$": ["contact-us/form.css"]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
static get properties() {
|
|
95
|
+
return {
|
|
96
|
+
"theme": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"mutable": false,
|
|
99
|
+
"complexType": {
|
|
100
|
+
"original": "string",
|
|
101
|
+
"resolved": "string",
|
|
102
|
+
"references": {}
|
|
103
|
+
},
|
|
104
|
+
"required": false,
|
|
105
|
+
"optional": false,
|
|
106
|
+
"docs": {
|
|
107
|
+
"tags": [],
|
|
108
|
+
"text": ""
|
|
109
|
+
},
|
|
110
|
+
"attribute": "theme",
|
|
111
|
+
"reflect": false
|
|
112
|
+
},
|
|
113
|
+
"baseUrl": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"mutable": false,
|
|
116
|
+
"complexType": {
|
|
117
|
+
"original": "string",
|
|
118
|
+
"resolved": "string",
|
|
119
|
+
"references": {}
|
|
120
|
+
},
|
|
121
|
+
"required": false,
|
|
122
|
+
"optional": false,
|
|
123
|
+
"docs": {
|
|
124
|
+
"tags": [],
|
|
125
|
+
"text": ""
|
|
126
|
+
},
|
|
127
|
+
"attribute": "base-url",
|
|
128
|
+
"reflect": false
|
|
129
|
+
},
|
|
130
|
+
"brandId": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"mutable": false,
|
|
133
|
+
"complexType": {
|
|
134
|
+
"original": "string",
|
|
135
|
+
"resolved": "string",
|
|
136
|
+
"references": {}
|
|
137
|
+
},
|
|
138
|
+
"required": false,
|
|
139
|
+
"optional": false,
|
|
140
|
+
"docs": {
|
|
141
|
+
"tags": [],
|
|
142
|
+
"text": ""
|
|
143
|
+
},
|
|
144
|
+
"attribute": "brand-id",
|
|
145
|
+
"reflect": false
|
|
146
|
+
},
|
|
147
|
+
"queryString": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"mutable": false,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "string",
|
|
152
|
+
"resolved": "string",
|
|
153
|
+
"references": {}
|
|
154
|
+
},
|
|
155
|
+
"required": false,
|
|
156
|
+
"optional": false,
|
|
157
|
+
"docs": {
|
|
158
|
+
"tags": [],
|
|
159
|
+
"text": ""
|
|
160
|
+
},
|
|
161
|
+
"attribute": "query-string",
|
|
162
|
+
"reflect": false,
|
|
163
|
+
"defaultValue": "''"
|
|
164
|
+
},
|
|
165
|
+
"language": {
|
|
166
|
+
"type": "string",
|
|
167
|
+
"mutable": false,
|
|
168
|
+
"complexType": {
|
|
169
|
+
"original": "LanguageKeys",
|
|
170
|
+
"resolved": "\"ar\" | \"en\" | \"ku\" | \"ru\"",
|
|
171
|
+
"references": {
|
|
172
|
+
"LanguageKeys": {
|
|
173
|
+
"location": "import",
|
|
174
|
+
"path": "~types/locales",
|
|
175
|
+
"id": "src/global/types/locales/index.ts::LanguageKeys"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"required": false,
|
|
180
|
+
"optional": false,
|
|
181
|
+
"docs": {
|
|
182
|
+
"tags": [],
|
|
183
|
+
"text": ""
|
|
184
|
+
},
|
|
185
|
+
"attribute": "language",
|
|
186
|
+
"reflect": false,
|
|
187
|
+
"defaultValue": "'en'"
|
|
188
|
+
},
|
|
189
|
+
"structure": {
|
|
190
|
+
"type": "string",
|
|
191
|
+
"mutable": false,
|
|
192
|
+
"complexType": {
|
|
193
|
+
"original": "string",
|
|
194
|
+
"resolved": "string",
|
|
195
|
+
"references": {}
|
|
196
|
+
},
|
|
197
|
+
"required": false,
|
|
198
|
+
"optional": false,
|
|
199
|
+
"docs": {
|
|
200
|
+
"tags": [],
|
|
201
|
+
"text": ""
|
|
202
|
+
},
|
|
203
|
+
"attribute": "structure",
|
|
204
|
+
"reflect": false,
|
|
205
|
+
"defaultValue": "'[\"submit.Submit\"]'"
|
|
206
|
+
},
|
|
207
|
+
"recaptchaKey": {
|
|
208
|
+
"type": "string",
|
|
209
|
+
"mutable": false,
|
|
210
|
+
"complexType": {
|
|
211
|
+
"original": "string",
|
|
212
|
+
"resolved": "string",
|
|
213
|
+
"references": {}
|
|
214
|
+
},
|
|
215
|
+
"required": false,
|
|
216
|
+
"optional": false,
|
|
217
|
+
"docs": {
|
|
218
|
+
"tags": [],
|
|
219
|
+
"text": ""
|
|
220
|
+
},
|
|
221
|
+
"attribute": "recaptcha-key",
|
|
222
|
+
"reflect": false,
|
|
223
|
+
"defaultValue": "'6Lehq6IpAAAAAETTDS2Zh60nHIT1a8oVkRtJ2WsA'"
|
|
224
|
+
},
|
|
225
|
+
"errorCallback": {
|
|
226
|
+
"type": "unknown",
|
|
227
|
+
"mutable": false,
|
|
228
|
+
"complexType": {
|
|
229
|
+
"original": "(error: any) => void",
|
|
230
|
+
"resolved": "(error: any) => void",
|
|
231
|
+
"references": {}
|
|
232
|
+
},
|
|
233
|
+
"required": false,
|
|
234
|
+
"optional": false,
|
|
235
|
+
"docs": {
|
|
236
|
+
"tags": [],
|
|
237
|
+
"text": ""
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"successCallback": {
|
|
241
|
+
"type": "unknown",
|
|
242
|
+
"mutable": false,
|
|
243
|
+
"complexType": {
|
|
244
|
+
"original": "(values: any) => void",
|
|
245
|
+
"resolved": "(values: any) => void",
|
|
246
|
+
"references": {}
|
|
247
|
+
},
|
|
248
|
+
"required": false,
|
|
249
|
+
"optional": false,
|
|
250
|
+
"docs": {
|
|
251
|
+
"tags": [],
|
|
252
|
+
"text": ""
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"loadingChanges": {
|
|
256
|
+
"type": "unknown",
|
|
257
|
+
"mutable": false,
|
|
258
|
+
"complexType": {
|
|
259
|
+
"original": "(loading: boolean) => void",
|
|
260
|
+
"resolved": "(loading: boolean) => void",
|
|
261
|
+
"references": {}
|
|
262
|
+
},
|
|
263
|
+
"required": false,
|
|
264
|
+
"optional": false,
|
|
265
|
+
"docs": {
|
|
266
|
+
"tags": [],
|
|
267
|
+
"text": ""
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
static get states() {
|
|
273
|
+
return {
|
|
274
|
+
"isLoading": {},
|
|
275
|
+
"renderControl": {},
|
|
276
|
+
"errorMessage": {}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
static get elementRef() { return "el"; }
|
|
280
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
import { h } from "@stencil/core";
|
|
6
|
+
import { phoneValidator } from "./validations";
|
|
7
|
+
import { getLocaleLanguage } from "../../../global/lib/get-local-language";
|
|
8
|
+
import { CITY_ENDPOINT } from "../../../global/api/urls";
|
|
9
|
+
export const contactUsElements = {
|
|
10
|
+
submit: formContext => {
|
|
11
|
+
return h("form-submit", Object.assign({}, formContext));
|
|
12
|
+
},
|
|
13
|
+
name: ({ form, language, structureElement }) => {
|
|
14
|
+
const { disabled, errorMessage, isError, isRequired, name } = form.getInputState('name');
|
|
15
|
+
const inputParams = {
|
|
16
|
+
name,
|
|
17
|
+
disabled,
|
|
18
|
+
type: 'text',
|
|
19
|
+
placeholder: 'fullName',
|
|
20
|
+
};
|
|
21
|
+
return (h("form-input", { form: form, label: "fullName", isError: isError, language: language, isRequired: isRequired, inputParams: inputParams, formLocaleName: "contactUs", errorMessage: errorMessage, wrapperId: structureElement.id, wrapperClass: structureElement.class }));
|
|
22
|
+
},
|
|
23
|
+
email: ({ form, language, structureElement }) => {
|
|
24
|
+
const { disabled, errorMessage, isError, isRequired, name } = form.getInputState('email');
|
|
25
|
+
const inputParams = {
|
|
26
|
+
name,
|
|
27
|
+
disabled,
|
|
28
|
+
type: 'email',
|
|
29
|
+
placeholder: 'emailAddress',
|
|
30
|
+
};
|
|
31
|
+
return (h("form-input", { form: form, isError: isError, language: language, label: "emailAddress", isRequired: isRequired, inputParams: inputParams, formLocaleName: "contactUs", errorMessage: errorMessage, wrapperId: structureElement.id, wrapperClass: structureElement.class }));
|
|
32
|
+
},
|
|
33
|
+
phone: ({ form, language, structureElement }) => {
|
|
34
|
+
const { disabled, errorMessage, isError, isRequired, name } = form.getInputState('phone');
|
|
35
|
+
const inputParams = {
|
|
36
|
+
name,
|
|
37
|
+
disabled,
|
|
38
|
+
type: 'text',
|
|
39
|
+
placeholder: 'phoneNumber',
|
|
40
|
+
defaultValue: phoneValidator.default,
|
|
41
|
+
onInput: (event) => {
|
|
42
|
+
const target = event.target;
|
|
43
|
+
phoneValidator.reset();
|
|
44
|
+
target.value = phoneValidator.input(target.value);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
return (h("form-input", { form: form, numberDirection: true, isError: isError, language: language, label: "phoneNumber", isRequired: isRequired, inputParams: inputParams, formLocaleName: "contactUs", errorMessage: errorMessage, wrapperId: structureElement.id, wrapperClass: structureElement.class }));
|
|
48
|
+
},
|
|
49
|
+
message: ({ form, language, structureElement }) => {
|
|
50
|
+
const { disabled, errorMessage, isError, isRequired, name } = form.getInputState('message');
|
|
51
|
+
const inputParams = {
|
|
52
|
+
name,
|
|
53
|
+
disabled,
|
|
54
|
+
type: 'email',
|
|
55
|
+
placeholder: 'leaveUsMessage',
|
|
56
|
+
};
|
|
57
|
+
return (h("form-text-area", { form: form, isError: isError, language: language, label: "writeAMessage", isRequired: isRequired, inputParams: inputParams, formLocaleName: "contactUs", errorMessage: errorMessage, wrapperId: structureElement.id, wrapperClass: structureElement.class }));
|
|
58
|
+
},
|
|
59
|
+
generalTicketType: ({ form, language, structureElement }) => {
|
|
60
|
+
const { disabled, errorMessage, isError, isRequired, name } = form.getInputState('generalTicketType');
|
|
61
|
+
const fetcher = async (language, _) => {
|
|
62
|
+
const ticketTypes = (await getLocaleLanguage(language)).generalTicketTypes;
|
|
63
|
+
const generalInquiryTypes = [
|
|
64
|
+
{
|
|
65
|
+
value: 'GeneralInquiry',
|
|
66
|
+
label: ticketTypes.GeneralInquiry,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
value: 'Complaint',
|
|
70
|
+
label: ticketTypes.Complaint,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
return generalInquiryTypes;
|
|
74
|
+
};
|
|
75
|
+
return (h("form-select", { name: name, form: form, fetcher: fetcher, isError: isError, disabled: disabled, language: language, label: "inquiryType", isRequired: isRequired, formLocaleName: "contactUs", errorMessage: errorMessage, placeholder: "selectInquiryType", wrapperId: structureElement.id, wrapperClass: structureElement.class }));
|
|
76
|
+
},
|
|
77
|
+
cityId: ({ form, language, structureElement }) => {
|
|
78
|
+
const { disabled, errorMessage, isError, isRequired, name } = form.getInputState('cityId');
|
|
79
|
+
const fetcher = async (language, signal) => {
|
|
80
|
+
const response = await fetch(CITY_ENDPOINT, { signal, headers: { 'Accept-Language': language } });
|
|
81
|
+
const arrayRes = (await response.json());
|
|
82
|
+
const selectItems = arrayRes.map(item => ({ label: item.Name, value: item.ID }));
|
|
83
|
+
return selectItems;
|
|
84
|
+
};
|
|
85
|
+
return (h("form-select", { name: name, form: form, label: "city", fetcher: fetcher, isError: isError, disabled: disabled, language: language, isRequired: isRequired, placeholder: "selectCity", formLocaleName: "contactUs", errorMessage: errorMessage, wrapperId: structureElement.id, wrapperClass: structureElement.class }));
|
|
86
|
+
},
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.15 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.mx-auto{margin-left:auto;margin-right:auto}.mb-\[24px\]{margin-bottom:24px}.block{display:block}.flex{display:flex}.max-w-\[700px\]{max-width:700px}.flex-col{flex-direction:column}.gap-\[24px\]{gap:24px}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}:host{all:initial!important;display:block}*{font-family:Arial}.contact-us-tiq #container{margin-left:auto;margin-right:auto;max-width:700px}.contact-us-tiq #inputs_wrapper{display:flex;flex-direction:column;gap:24px;margin-bottom:24px}@media (min-width:640px){.contact-us-tiq #inputs_wrapper{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}}.contact-us-tiq #message{margin-bottom:24px}@media (min-width:640px){.sm\:grid{display:grid}}.static{position:static}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
import { AsYouType } from "libphonenumber-js";
|
|
6
|
+
import { object, string } from "yup";
|
|
7
|
+
export const phoneValidator = new AsYouType('IQ');
|
|
8
|
+
phoneValidator.default = '+' + phoneValidator.metadata.numberingPlan.metadata[0];
|
|
9
|
+
phoneValidator.input(phoneValidator.default);
|
|
10
|
+
export const contactUsSchema = object({
|
|
11
|
+
cityId: string(),
|
|
12
|
+
email: string().email('emailAddressNotValid'),
|
|
13
|
+
message: string().required('messageIsRequired'),
|
|
14
|
+
generalTicketType: string().required('inquiryTypeIsRequired'),
|
|
15
|
+
name: string().required('fullNameIsRequired').min(3, 'fullNameMinimum'),
|
|
16
|
+
phone: string()
|
|
17
|
+
.required('phoneNumberIsRequired')
|
|
18
|
+
.test('libphonenumber-validation', 'phoneNumberFormatInvalid', () => phoneValidator.isValid()),
|
|
19
|
+
});
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
import { Host, h } from "@stencil/core";
|
|
6
|
+
import cn from "../../global/lib/cn";
|
|
7
|
+
import { FormHook } from "../../global/lib/form-hook";
|
|
8
|
+
import { contactUsSchema } from "./service-booking/validations";
|
|
9
|
+
import themes from "./service-booking/themes.json";
|
|
10
|
+
import { contactUsElements } from "./service-booking/element-mapper";
|
|
11
|
+
export class ContactUsForm {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.recaptchaWidget = null;
|
|
14
|
+
this.form = new FormHook(this, contactUsSchema);
|
|
15
|
+
this.theme = undefined;
|
|
16
|
+
this.baseUrl = undefined;
|
|
17
|
+
this.brandId = undefined;
|
|
18
|
+
this.queryString = '';
|
|
19
|
+
this.language = 'en';
|
|
20
|
+
this.structure = '["submit.Submit"]';
|
|
21
|
+
this.recaptchaKey = '6Lehq6IpAAAAAETTDS2Zh60nHIT1a8oVkRtJ2WsA';
|
|
22
|
+
this.errorCallback = undefined;
|
|
23
|
+
this.successCallback = undefined;
|
|
24
|
+
this.loadingChanges = undefined;
|
|
25
|
+
this.isLoading = undefined;
|
|
26
|
+
this.renderControl = {};
|
|
27
|
+
this.errorMessage = undefined;
|
|
28
|
+
}
|
|
29
|
+
async componentDidLoad() {
|
|
30
|
+
try {
|
|
31
|
+
if (this.recaptchaKey) {
|
|
32
|
+
const script = document.createElement('script');
|
|
33
|
+
script.src = `https://www.google.com/recaptcha/api.js?render=${this.recaptchaKey}&hl=${this.language}`;
|
|
34
|
+
script.async = true;
|
|
35
|
+
script.defer = true;
|
|
36
|
+
document.head.appendChild(script);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.log(error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async formSubmit(formValues) {
|
|
44
|
+
try {
|
|
45
|
+
if (this.loadingChanges)
|
|
46
|
+
this.loadingChanges(true);
|
|
47
|
+
const token = await grecaptcha.execute(this.recaptchaKey, { action: 'submit' });
|
|
48
|
+
const response = await fetch(`${this.baseUrl}?${this.queryString}`, {
|
|
49
|
+
method: 'post',
|
|
50
|
+
body: JSON.stringify(formValues),
|
|
51
|
+
headers: {
|
|
52
|
+
'Brand': this.brandId,
|
|
53
|
+
'Recaptcha-Token': token,
|
|
54
|
+
'Accept-Language': this.language,
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
const data = await response.json();
|
|
59
|
+
if (this.successCallback)
|
|
60
|
+
this.successCallback(data);
|
|
61
|
+
this.form.successAnimation();
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
this.form.reset();
|
|
64
|
+
}, 1000);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.error(error);
|
|
68
|
+
if (this.errorCallback)
|
|
69
|
+
this.errorCallback(error);
|
|
70
|
+
if (error === null || error === void 0 ? void 0 : error.message)
|
|
71
|
+
this.errorMessage = error.message;
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
if (this.loadingChanges)
|
|
75
|
+
this.loadingChanges(false);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
render() {
|
|
79
|
+
return (h(Host, { key: '6d0c7079cbd60c5d8b2b4c69b7e51e419acb9406', class: cn({
|
|
80
|
+
[`contact-us-${this.theme}`]: this.theme,
|
|
81
|
+
}) }, h("form-structure", { key: '4ac5d3221865299bdef99589b2739a9217a49637', themes: themes, form: this.form, theme: this.theme, language: this.language, isLoading: this.isLoading, errorMessage: this.errorMessage, renderControl: this.renderControl, formElementMapper: contactUsElements }, h("slot", { key: '8f5e8f3deb58296c8b9bcad18a9d9b6e80df012d' }))));
|
|
82
|
+
}
|
|
83
|
+
static get is() { return "service-booking-form"; }
|
|
84
|
+
static get originalStyleUrls() {
|
|
85
|
+
return {
|
|
86
|
+
"$": ["service-booking/form.css"]
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
static get styleUrls() {
|
|
90
|
+
return {
|
|
91
|
+
"$": ["service-booking/form.css"]
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
static get properties() {
|
|
95
|
+
return {
|
|
96
|
+
"theme": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"mutable": false,
|
|
99
|
+
"complexType": {
|
|
100
|
+
"original": "string",
|
|
101
|
+
"resolved": "string",
|
|
102
|
+
"references": {}
|
|
103
|
+
},
|
|
104
|
+
"required": false,
|
|
105
|
+
"optional": false,
|
|
106
|
+
"docs": {
|
|
107
|
+
"tags": [],
|
|
108
|
+
"text": ""
|
|
109
|
+
},
|
|
110
|
+
"attribute": "theme",
|
|
111
|
+
"reflect": false
|
|
112
|
+
},
|
|
113
|
+
"baseUrl": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"mutable": false,
|
|
116
|
+
"complexType": {
|
|
117
|
+
"original": "string",
|
|
118
|
+
"resolved": "string",
|
|
119
|
+
"references": {}
|
|
120
|
+
},
|
|
121
|
+
"required": false,
|
|
122
|
+
"optional": false,
|
|
123
|
+
"docs": {
|
|
124
|
+
"tags": [],
|
|
125
|
+
"text": ""
|
|
126
|
+
},
|
|
127
|
+
"attribute": "base-url",
|
|
128
|
+
"reflect": false
|
|
129
|
+
},
|
|
130
|
+
"brandId": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"mutable": false,
|
|
133
|
+
"complexType": {
|
|
134
|
+
"original": "string",
|
|
135
|
+
"resolved": "string",
|
|
136
|
+
"references": {}
|
|
137
|
+
},
|
|
138
|
+
"required": false,
|
|
139
|
+
"optional": false,
|
|
140
|
+
"docs": {
|
|
141
|
+
"tags": [],
|
|
142
|
+
"text": ""
|
|
143
|
+
},
|
|
144
|
+
"attribute": "brand-id",
|
|
145
|
+
"reflect": false
|
|
146
|
+
},
|
|
147
|
+
"queryString": {
|
|
148
|
+
"type": "string",
|
|
149
|
+
"mutable": false,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "string",
|
|
152
|
+
"resolved": "string",
|
|
153
|
+
"references": {}
|
|
154
|
+
},
|
|
155
|
+
"required": false,
|
|
156
|
+
"optional": false,
|
|
157
|
+
"docs": {
|
|
158
|
+
"tags": [],
|
|
159
|
+
"text": ""
|
|
160
|
+
},
|
|
161
|
+
"attribute": "query-string",
|
|
162
|
+
"reflect": false,
|
|
163
|
+
"defaultValue": "''"
|
|
164
|
+
},
|
|
165
|
+
"language": {
|
|
166
|
+
"type": "string",
|
|
167
|
+
"mutable": false,
|
|
168
|
+
"complexType": {
|
|
169
|
+
"original": "LanguageKeys",
|
|
170
|
+
"resolved": "\"ar\" | \"en\" | \"ku\" | \"ru\"",
|
|
171
|
+
"references": {
|
|
172
|
+
"LanguageKeys": {
|
|
173
|
+
"location": "import",
|
|
174
|
+
"path": "~types/locales",
|
|
175
|
+
"id": "src/global/types/locales/index.ts::LanguageKeys"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"required": false,
|
|
180
|
+
"optional": false,
|
|
181
|
+
"docs": {
|
|
182
|
+
"tags": [],
|
|
183
|
+
"text": ""
|
|
184
|
+
},
|
|
185
|
+
"attribute": "language",
|
|
186
|
+
"reflect": false,
|
|
187
|
+
"defaultValue": "'en'"
|
|
188
|
+
},
|
|
189
|
+
"structure": {
|
|
190
|
+
"type": "string",
|
|
191
|
+
"mutable": false,
|
|
192
|
+
"complexType": {
|
|
193
|
+
"original": "string",
|
|
194
|
+
"resolved": "string",
|
|
195
|
+
"references": {}
|
|
196
|
+
},
|
|
197
|
+
"required": false,
|
|
198
|
+
"optional": false,
|
|
199
|
+
"docs": {
|
|
200
|
+
"tags": [],
|
|
201
|
+
"text": ""
|
|
202
|
+
},
|
|
203
|
+
"attribute": "structure",
|
|
204
|
+
"reflect": false,
|
|
205
|
+
"defaultValue": "'[\"submit.Submit\"]'"
|
|
206
|
+
},
|
|
207
|
+
"recaptchaKey": {
|
|
208
|
+
"type": "string",
|
|
209
|
+
"mutable": false,
|
|
210
|
+
"complexType": {
|
|
211
|
+
"original": "string",
|
|
212
|
+
"resolved": "string",
|
|
213
|
+
"references": {}
|
|
214
|
+
},
|
|
215
|
+
"required": false,
|
|
216
|
+
"optional": false,
|
|
217
|
+
"docs": {
|
|
218
|
+
"tags": [],
|
|
219
|
+
"text": ""
|
|
220
|
+
},
|
|
221
|
+
"attribute": "recaptcha-key",
|
|
222
|
+
"reflect": false,
|
|
223
|
+
"defaultValue": "'6Lehq6IpAAAAAETTDS2Zh60nHIT1a8oVkRtJ2WsA'"
|
|
224
|
+
},
|
|
225
|
+
"errorCallback": {
|
|
226
|
+
"type": "unknown",
|
|
227
|
+
"mutable": false,
|
|
228
|
+
"complexType": {
|
|
229
|
+
"original": "(error: any) => void",
|
|
230
|
+
"resolved": "(error: any) => void",
|
|
231
|
+
"references": {}
|
|
232
|
+
},
|
|
233
|
+
"required": false,
|
|
234
|
+
"optional": false,
|
|
235
|
+
"docs": {
|
|
236
|
+
"tags": [],
|
|
237
|
+
"text": ""
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"successCallback": {
|
|
241
|
+
"type": "unknown",
|
|
242
|
+
"mutable": false,
|
|
243
|
+
"complexType": {
|
|
244
|
+
"original": "(values: any) => void",
|
|
245
|
+
"resolved": "(values: any) => void",
|
|
246
|
+
"references": {}
|
|
247
|
+
},
|
|
248
|
+
"required": false,
|
|
249
|
+
"optional": false,
|
|
250
|
+
"docs": {
|
|
251
|
+
"tags": [],
|
|
252
|
+
"text": ""
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"loadingChanges": {
|
|
256
|
+
"type": "unknown",
|
|
257
|
+
"mutable": false,
|
|
258
|
+
"complexType": {
|
|
259
|
+
"original": "(loading: boolean) => void",
|
|
260
|
+
"resolved": "(loading: boolean) => void",
|
|
261
|
+
"references": {}
|
|
262
|
+
},
|
|
263
|
+
"required": false,
|
|
264
|
+
"optional": false,
|
|
265
|
+
"docs": {
|
|
266
|
+
"tags": [],
|
|
267
|
+
"text": ""
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
static get states() {
|
|
273
|
+
return {
|
|
274
|
+
"isLoading": {},
|
|
275
|
+
"renderControl": {},
|
|
276
|
+
"errorMessage": {}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
static get elementRef() { return "el"; }
|
|
280
|
+
}
|