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,32 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
export const getPartInformation = async (component, generalProps, headers = {}) => {
|
|
6
|
+
const { notAvailableMessage, mockData, partNumber, scopedTimeoutRef, middlewareCallback } = generalProps;
|
|
7
|
+
const { isDev, baseUrl, queryString, abortController, networkTimeoutRef, loadedResponse } = component;
|
|
8
|
+
const handleResult = (newPartInformation) => {
|
|
9
|
+
if (networkTimeoutRef === scopedTimeoutRef) {
|
|
10
|
+
if (!newPartInformation && partNumber)
|
|
11
|
+
throw new Error(notAvailableMessage || 'wrongResponseFormat');
|
|
12
|
+
if (loadedResponse)
|
|
13
|
+
loadedResponse(newPartInformation);
|
|
14
|
+
if (middlewareCallback)
|
|
15
|
+
middlewareCallback(newPartInformation);
|
|
16
|
+
return newPartInformation;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
if (isDev) {
|
|
20
|
+
const newData = mockData[partNumber];
|
|
21
|
+
return handleResult(newData);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
if (!baseUrl)
|
|
25
|
+
throw new Error('noBaseUrl');
|
|
26
|
+
const response = await fetch(`${baseUrl}${partNumber}?${queryString}`, { signal: abortController.signal, headers: headers });
|
|
27
|
+
if (response.status === 204)
|
|
28
|
+
throw new Error('noPartsFound');
|
|
29
|
+
const newData = (await response.json());
|
|
30
|
+
return handleResult(newData);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
const vehicleRequestHeaders = {
|
|
6
|
+
cityId: 'City-Id',
|
|
7
|
+
userId: 'User-Id',
|
|
8
|
+
companyId: 'Company-Id',
|
|
9
|
+
customerName: 'Customer-Name',
|
|
10
|
+
customerPhone: 'Customer-Phone',
|
|
11
|
+
customerEmail: 'Customer-Email',
|
|
12
|
+
companyBranchId: 'Company-Branch-Id',
|
|
13
|
+
cityIntegrationId: 'City-Integration-Id',
|
|
14
|
+
brandIntegrationId: 'Brand-Integration-Id',
|
|
15
|
+
companyIntegrationId: 'Company-Integration-Id',
|
|
16
|
+
companyBranchIntegrationId: 'Company-Branch-Integration-Id',
|
|
17
|
+
};
|
|
18
|
+
export const getVehicleInformation = async (component, generalProps, headers = {}) => {
|
|
19
|
+
const { notAvailableMessage, mockData, vin, scopedTimeoutRef, middlewareCallback } = generalProps;
|
|
20
|
+
const { isDev, baseUrl, queryString, abortController, networkTimeoutRef, loadedResponse } = component;
|
|
21
|
+
const handleResult = (newVehicleInformation) => {
|
|
22
|
+
if (networkTimeoutRef === scopedTimeoutRef) {
|
|
23
|
+
if (!newVehicleInformation && vin)
|
|
24
|
+
throw new Error(notAvailableMessage || 'wrongResponseFormat');
|
|
25
|
+
if (loadedResponse)
|
|
26
|
+
loadedResponse(newVehicleInformation);
|
|
27
|
+
if (middlewareCallback)
|
|
28
|
+
middlewareCallback(newVehicleInformation);
|
|
29
|
+
return newVehicleInformation;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
if (isDev) {
|
|
33
|
+
const newData = mockData[vin];
|
|
34
|
+
return handleResult(newData);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
if (!baseUrl)
|
|
38
|
+
throw new Error('noBaseUrl');
|
|
39
|
+
const componentHeaders = Object.assign({}, headers);
|
|
40
|
+
Object.entries(vehicleRequestHeaders).forEach(([componentHeaderKey, headerField]) => {
|
|
41
|
+
if (component[componentHeaderKey])
|
|
42
|
+
componentHeaders[headerField] = component[componentHeaderKey];
|
|
43
|
+
});
|
|
44
|
+
const response = await fetch(`${baseUrl}${vin}?${queryString}`, { signal: abortController.signal, headers: componentHeaders });
|
|
45
|
+
const newData = (await response.json());
|
|
46
|
+
return handleResult(newData);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-eye">
|
|
3
|
+
<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" />
|
|
4
|
+
<circle cx="12" cy="12" r="3" />
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-loader">
|
|
3
|
+
<path d="M12 2v4" />
|
|
4
|
+
<path d="m16.2 7.8 2.9-2.9" />
|
|
5
|
+
<path d="M18 12h4" />
|
|
6
|
+
<path d="m16.2 16.2 2.9 2.9" />
|
|
7
|
+
<path d="M12 18v4" />
|
|
8
|
+
<path d="m4.9 19.1 2.9-2.9" />
|
|
9
|
+
<path d="M2 12h4" />
|
|
10
|
+
<path d="m4.9 4.9 2.9 2.9" />
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-loader">
|
|
3
|
+
<path d="M12 2v4" />
|
|
4
|
+
<path d="m16.2 7.8 2.9-2.9" />
|
|
5
|
+
<path d="M18 12h4" />
|
|
6
|
+
<path d="m16.2 16.2 2.9 2.9" />
|
|
7
|
+
<path d="M12 18v4" />
|
|
8
|
+
<path d="m4.9 19.1 2.9-2.9" />
|
|
9
|
+
<path d="M2 12h4" />
|
|
10
|
+
<path d="m4.9 4.9 2.9 2.9" />
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
export class FormHook {
|
|
6
|
+
constructor(context, schemaObject, formStateOptions) {
|
|
7
|
+
this.successAnimation = () => { };
|
|
8
|
+
this.isSubmitted = false;
|
|
9
|
+
this.cachedValues = {};
|
|
10
|
+
this.subscribers = [];
|
|
11
|
+
this.haltValidation = false;
|
|
12
|
+
this.validationType = 'onSubmit';
|
|
13
|
+
this.subscribedFields = {};
|
|
14
|
+
this.formErrors = {};
|
|
15
|
+
this.setSuccessAnimation = (newSuccessAnimation) => (this.successAnimation = newSuccessAnimation);
|
|
16
|
+
this.subscribe = (formName, formElement) => this.subscribers.push({ name: formName, context: formElement });
|
|
17
|
+
this.unsubscribe = (formName) => (this.subscribers = this.subscribers.filter(({ name }) => name !== formName));
|
|
18
|
+
this.onInput = (event) => {
|
|
19
|
+
const target = event.target;
|
|
20
|
+
if (this.onValuesUpdate)
|
|
21
|
+
this.onValuesUpdate(Object.assign(Object.assign({}, this.getValues()), { [target.name]: target.value }));
|
|
22
|
+
this.validateForm(target.name, target.value);
|
|
23
|
+
};
|
|
24
|
+
this.resetFormErrorMessage = () => (this.context.errorMessage = '');
|
|
25
|
+
this.getFormErrors = () => this.formErrors;
|
|
26
|
+
this.setCachedValues = (newValues) => {
|
|
27
|
+
this.cachedValues = newValues;
|
|
28
|
+
};
|
|
29
|
+
this.getValues = () => {
|
|
30
|
+
const formDom = this.context.el.shadowRoot || this.context.el;
|
|
31
|
+
const form = formDom.querySelector('form');
|
|
32
|
+
const formData = new FormData(form);
|
|
33
|
+
const formObject = Object.fromEntries(formData.entries());
|
|
34
|
+
return Object.assign(Object.assign({}, this.cachedValues), formObject);
|
|
35
|
+
};
|
|
36
|
+
this.focusFirstInput = (errorFields) => {
|
|
37
|
+
if (errorFields.length) {
|
|
38
|
+
const formDom = this.context.el.shadowRoot || this.context.el;
|
|
39
|
+
const domElements = errorFields.map(field => formDom.querySelector(`*[name="${field.name}"]`)).filter(dom => dom);
|
|
40
|
+
const sortedDomElements = domElements.sort((a, b) => {
|
|
41
|
+
if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
42
|
+
return -1; // a comes before b
|
|
43
|
+
if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_PRECEDING)
|
|
44
|
+
return 1; // b comes before a
|
|
45
|
+
return 0; // They are the same
|
|
46
|
+
});
|
|
47
|
+
if (sortedDomElements[0])
|
|
48
|
+
sortedDomElements[0].focus();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
this.onSubmit = (formEvent) => {
|
|
52
|
+
formEvent.preventDefault();
|
|
53
|
+
(async () => {
|
|
54
|
+
try {
|
|
55
|
+
this.isSubmitted = true;
|
|
56
|
+
this.context.isLoading = true;
|
|
57
|
+
this.signal({ isError: false, disabled: true });
|
|
58
|
+
const formObject = Object.assign(Object.assign({}, this.cachedValues), this.getValues());
|
|
59
|
+
const values = await this.schemaObject.validate(formObject, { abortEarly: false });
|
|
60
|
+
await this.context.formSubmit(values);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (error.name === 'ValidationError') {
|
|
64
|
+
this.formErrors = {};
|
|
65
|
+
const errorFields = [];
|
|
66
|
+
error.inner.forEach((element) => {
|
|
67
|
+
if (element.path) {
|
|
68
|
+
this.formErrors[element.path] = element.message;
|
|
69
|
+
if (!errorFields.find(field => field.name === element.path)) {
|
|
70
|
+
errorFields.push({
|
|
71
|
+
isError: true,
|
|
72
|
+
name: element.path,
|
|
73
|
+
errorMessage: element.message,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
this.signal(errorFields);
|
|
79
|
+
this.focusFirstInput(errorFields);
|
|
80
|
+
this.context.renderControl = {};
|
|
81
|
+
}
|
|
82
|
+
else
|
|
83
|
+
console.error('Unexpected Error:', error);
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
this.signal({ disabled: false });
|
|
87
|
+
this.context.isLoading = false;
|
|
88
|
+
}
|
|
89
|
+
})();
|
|
90
|
+
};
|
|
91
|
+
this.getInputState = (name) => {
|
|
92
|
+
const validationDescription = this.schemaObject.describe().fields[name];
|
|
93
|
+
if (!this.subscribedFields[name])
|
|
94
|
+
this.subscribedFields[name] = {
|
|
95
|
+
name,
|
|
96
|
+
isError: false,
|
|
97
|
+
disabled: false,
|
|
98
|
+
errorMessage: '',
|
|
99
|
+
continuousValidation: false,
|
|
100
|
+
isRequired: validationDescription === null || validationDescription === void 0 ? void 0 : validationDescription.tests.some(test => test.name === 'required'),
|
|
101
|
+
};
|
|
102
|
+
return this.subscribedFields[name];
|
|
103
|
+
};
|
|
104
|
+
this.signal = (partialSignal) => {
|
|
105
|
+
if (Array.isArray(partialSignal)) {
|
|
106
|
+
partialSignal.forEach(field => {
|
|
107
|
+
if (this.subscribedFields[field.name])
|
|
108
|
+
Object.assign(this.subscribedFields[field.name], field);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
Object.values(this.subscribedFields).forEach(field => Object.assign(field, partialSignal));
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
this.validateInput = (name) => {
|
|
116
|
+
const value = (this.getValues()[name] || '');
|
|
117
|
+
return this.validateForm(name, value, false);
|
|
118
|
+
};
|
|
119
|
+
this.validateForm = (name, value, strict = true) => {
|
|
120
|
+
if (strict) {
|
|
121
|
+
if (this.haltValidation)
|
|
122
|
+
return;
|
|
123
|
+
if (!this.isSubmitted && this.validationType !== 'always' && !this.subscribedFields[name].continuousValidation)
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const wasError = this.subscribedFields[name].isError;
|
|
127
|
+
try {
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
this.schemaObject.fields[name].validateSync(value);
|
|
130
|
+
this.signal([{ name, isError: false }]);
|
|
131
|
+
if (wasError !== false)
|
|
132
|
+
this.context.renderControl = {};
|
|
133
|
+
return { isError: false, errorMessage: '' };
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
if (error.message) {
|
|
137
|
+
this.signal([{ name, isError: true, errorMessage: error.message }]);
|
|
138
|
+
this.context.renderControl = {};
|
|
139
|
+
return { isError: true, errorMessage: error.message };
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
this.subscribedFields[name].continuousValidation = true;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
this.context = context;
|
|
147
|
+
this.schemaObject = schemaObject;
|
|
148
|
+
this.formController = { onSubmit: this.onSubmit, onInput: this.onInput };
|
|
149
|
+
if (formStateOptions === null || formStateOptions === void 0 ? void 0 : formStateOptions.validationType)
|
|
150
|
+
this.validationType = formStateOptions.validationType;
|
|
151
|
+
}
|
|
152
|
+
reset() {
|
|
153
|
+
this.haltValidation = true;
|
|
154
|
+
this.signal({ isError: false, disabled: false });
|
|
155
|
+
this.subscribers.forEach(subscriber => {
|
|
156
|
+
subscriber.context.reset();
|
|
157
|
+
});
|
|
158
|
+
this.isSubmitted = false;
|
|
159
|
+
this.haltValidation = false;
|
|
160
|
+
this.context.renderControl = {};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
import { Build } from "@stencil/core";
|
|
6
|
+
import { version } from "../../../package.json";
|
|
7
|
+
import { languageMapper } from "../types/locales/index";
|
|
8
|
+
const cachedLocales = {};
|
|
9
|
+
export const getLocaleLanguage = async (fileKey) => {
|
|
10
|
+
const languageFile = languageMapper[fileKey] || languageMapper.en;
|
|
11
|
+
if (cachedLocales[languageFile])
|
|
12
|
+
return await cachedLocales[languageFile];
|
|
13
|
+
let localeResponse;
|
|
14
|
+
if (Build.isDev)
|
|
15
|
+
localeResponse = fetch('../../locales/' + languageFile).then(res => res.json());
|
|
16
|
+
else
|
|
17
|
+
localeResponse = fetch(`https://cdn.jsdelivr.net/npm/adp-web-components@${version}/dist/locales/${languageFile}`).then(res => res.json());
|
|
18
|
+
cachedLocales[languageFile] = localeResponse;
|
|
19
|
+
return await localeResponse;
|
|
20
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
export function openImageViewer(context, target, imageSrc) {
|
|
6
|
+
if (context.expandedImage === imageSrc)
|
|
7
|
+
return;
|
|
8
|
+
context.originalImage = target;
|
|
9
|
+
const expandedImageRef = context.el.shadowRoot.getElementById('expanded-image');
|
|
10
|
+
expandedImageRef.src = target.src;
|
|
11
|
+
document.addEventListener('keydown', context.closeImageListener);
|
|
12
|
+
const rect = target.getBoundingClientRect();
|
|
13
|
+
document.body.style.overflow = 'hidden';
|
|
14
|
+
Object.assign(expandedImageRef.style, {
|
|
15
|
+
top: `${rect.top}px`,
|
|
16
|
+
pointerEvents: 'auto',
|
|
17
|
+
left: `${rect.left}px`,
|
|
18
|
+
transitionDuration: '0s',
|
|
19
|
+
width: `${rect.width}px`,
|
|
20
|
+
height: `${rect.height}px`,
|
|
21
|
+
});
|
|
22
|
+
setTimeout(() => {
|
|
23
|
+
const naturalWidth = target.naturalWidth;
|
|
24
|
+
const naturalHeight = target.naturalHeight;
|
|
25
|
+
const maxWidth = window.innerWidth - 160;
|
|
26
|
+
const maxHeight = window.innerHeight - 32;
|
|
27
|
+
const aspectRatio = naturalWidth / naturalHeight;
|
|
28
|
+
let width, height;
|
|
29
|
+
if (maxWidth / aspectRatio <= maxHeight) {
|
|
30
|
+
width = maxWidth;
|
|
31
|
+
height = maxWidth / aspectRatio;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
height = maxHeight;
|
|
35
|
+
width = maxHeight * aspectRatio;
|
|
36
|
+
}
|
|
37
|
+
expandedImageRef.style.transitionDuration = '0.3s';
|
|
38
|
+
Object.assign(expandedImageRef.style, {
|
|
39
|
+
opacity: '1',
|
|
40
|
+
width: `${width}px`,
|
|
41
|
+
height: `${height}px`,
|
|
42
|
+
top: `${(window.innerHeight - height) / 2}px`,
|
|
43
|
+
left: `${(window.innerWidth - width) / 2}px`,
|
|
44
|
+
});
|
|
45
|
+
context.expandedImage = imageSrc;
|
|
46
|
+
}, 200);
|
|
47
|
+
}
|
|
48
|
+
export function closeImageViewer(context, event) {
|
|
49
|
+
if (event && event.key !== 'Escape')
|
|
50
|
+
return;
|
|
51
|
+
document.removeEventListener('keydown', context.closeImageListener);
|
|
52
|
+
const expandedImageRef = context.el.shadowRoot.getElementById('expanded-image');
|
|
53
|
+
const rect = context.originalImage.getBoundingClientRect();
|
|
54
|
+
Object.assign(expandedImageRef.style, {
|
|
55
|
+
top: `${rect.top}px`,
|
|
56
|
+
pointerEvents: 'none',
|
|
57
|
+
left: `${rect.left}px`,
|
|
58
|
+
width: `${rect.width}px`,
|
|
59
|
+
height: `${rect.height}px`,
|
|
60
|
+
transitionDuration: '0.3s',
|
|
61
|
+
});
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
expandedImageRef.src = '';
|
|
64
|
+
expandedImageRef.style.opacity = '0';
|
|
65
|
+
expandedImageRef.style.transitionDuration = '0s';
|
|
66
|
+
}, 300);
|
|
67
|
+
document.body.style.overflow = '';
|
|
68
|
+
context.expandedImage = null;
|
|
69
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
(async function () {
|
|
6
|
+
if (!window['blazorInvoke']) {
|
|
7
|
+
window['blazorInvoke'] = async function (selector, functionName, ...args) {
|
|
8
|
+
const element = document.querySelector(selector);
|
|
9
|
+
if (!element) {
|
|
10
|
+
console.error(`Element with selector "${selector}" not found.`);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (typeof element[functionName] !== 'function') {
|
|
14
|
+
console.error(`Function "${functionName}" not found on the element.`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
return await element[functionName](...args);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error(`Error invoking function "${functionName}" on element "${selector}":`, error);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
window['blazorInvokeSet'] = async function (selector, field, value) {
|
|
25
|
+
const element = document.querySelector(selector);
|
|
26
|
+
if (!element) {
|
|
27
|
+
console.error(`Element with selector "${selector}" not found.`);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
return (element[field] = value);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error(`Setting field ${field} failed to set value: ${value}:`, error);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
console.log('Global blazorInvoke initialized.');
|
|
38
|
+
}
|
|
39
|
+
})();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
export const setupRecaptcha = (recaptchaKey, language = 'en', callback = () => { }) => {
|
|
6
|
+
console.log(language);
|
|
7
|
+
if (!recaptchaKey)
|
|
8
|
+
return;
|
|
9
|
+
const oldScript = document.querySelector("script[src*='recaptcha/api.js']");
|
|
10
|
+
if (oldScript) {
|
|
11
|
+
oldScript.remove();
|
|
12
|
+
console.log('Old reCAPTCHA script removed');
|
|
13
|
+
}
|
|
14
|
+
const recaptchaContainers = document.getElementsByClassName('g-recaptcha');
|
|
15
|
+
Array.from(recaptchaContainers).forEach(container => container.remove());
|
|
16
|
+
const script = document.createElement('script');
|
|
17
|
+
script.src = `https://www.google.com/recaptcha/api.js?render=explicit&hl=${language}`;
|
|
18
|
+
script.async = true;
|
|
19
|
+
script.defer = true;
|
|
20
|
+
script.onload = () => {
|
|
21
|
+
console.log(`reCAPTCHA script loaded with language: ${language}`);
|
|
22
|
+
callback();
|
|
23
|
+
};
|
|
24
|
+
document.head.appendChild(script);
|
|
25
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
function parseElement(str) {
|
|
6
|
+
const elementPart = str.split(/\.|#/)[0];
|
|
7
|
+
const classMatch = str.match(/\.(\w+)/);
|
|
8
|
+
const idMatch = str.match(/#(\w+)/);
|
|
9
|
+
return {
|
|
10
|
+
children: [],
|
|
11
|
+
element: elementPart,
|
|
12
|
+
id: idMatch ? idMatch[1] : '',
|
|
13
|
+
class: classMatch ? classMatch[1] : '',
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const recursiveParser = (structuredArray) => {
|
|
17
|
+
if (!Array.isArray(structuredArray) || !structuredArray.length)
|
|
18
|
+
throw new Error('Invalid structure');
|
|
19
|
+
let parent = { element: '', class: '', id: '', children: [] };
|
|
20
|
+
let startIndex = 0;
|
|
21
|
+
if (typeof structuredArray[0] === 'string' && structuredArray[0].startsWith('div')) {
|
|
22
|
+
parent = parseElement(structuredArray[0]);
|
|
23
|
+
startIndex++;
|
|
24
|
+
}
|
|
25
|
+
for (let idx = startIndex; idx < structuredArray.length; idx++) {
|
|
26
|
+
const child = structuredArray[idx];
|
|
27
|
+
if (typeof child === 'string')
|
|
28
|
+
parent.children.push(parseElement(child));
|
|
29
|
+
else
|
|
30
|
+
parent.children.push(recursiveParser(child));
|
|
31
|
+
}
|
|
32
|
+
return parent;
|
|
33
|
+
};
|
|
34
|
+
export const formStructureStringExample = '[["div.kodo#j7","name.name#name"], "div.d3#s2"]';
|
|
35
|
+
export const isValidStructure = (requestedStructure) => {
|
|
36
|
+
try {
|
|
37
|
+
const parsedStructure = typeof requestedStructure === 'string' ? JSON.parse(requestedStructure) : requestedStructure;
|
|
38
|
+
if (!Array.isArray(parsedStructure) || !parsedStructure.length)
|
|
39
|
+
throw new Error('Invalid structure');
|
|
40
|
+
const structuredObject = recursiveParser(parsedStructure);
|
|
41
|
+
return structuredObject;
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
console.log(error);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
export default function validateVin(vin) {
|
|
6
|
+
const TransliterationTable = {
|
|
7
|
+
0: 0,
|
|
8
|
+
1: 1,
|
|
9
|
+
2: 2,
|
|
10
|
+
3: 3,
|
|
11
|
+
4: 4,
|
|
12
|
+
5: 5,
|
|
13
|
+
6: 6,
|
|
14
|
+
7: 7,
|
|
15
|
+
8: 8,
|
|
16
|
+
9: 9,
|
|
17
|
+
A: 1,
|
|
18
|
+
B: 2,
|
|
19
|
+
C: 3,
|
|
20
|
+
D: 4,
|
|
21
|
+
E: 5,
|
|
22
|
+
F: 6,
|
|
23
|
+
G: 7,
|
|
24
|
+
H: 8,
|
|
25
|
+
J: 1,
|
|
26
|
+
K: 2,
|
|
27
|
+
L: 3,
|
|
28
|
+
M: 4,
|
|
29
|
+
N: 5,
|
|
30
|
+
P: 7,
|
|
31
|
+
R: 9,
|
|
32
|
+
S: 2,
|
|
33
|
+
T: 3,
|
|
34
|
+
U: 4,
|
|
35
|
+
V: 5,
|
|
36
|
+
W: 6,
|
|
37
|
+
X: 7,
|
|
38
|
+
Y: 8,
|
|
39
|
+
Z: 9,
|
|
40
|
+
};
|
|
41
|
+
const WeightTable = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2];
|
|
42
|
+
let sum = 0;
|
|
43
|
+
let valid = true;
|
|
44
|
+
for (let i = 0; i < vin.length; i++) {
|
|
45
|
+
const char = vin[i].toUpperCase();
|
|
46
|
+
const value = TransliterationTable[char];
|
|
47
|
+
if (value === undefined) {
|
|
48
|
+
valid = false;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
const weight = WeightTable[i];
|
|
52
|
+
const product = value * weight;
|
|
53
|
+
sum = sum + product;
|
|
54
|
+
}
|
|
55
|
+
let reminder = (sum % 11).toString();
|
|
56
|
+
if (reminder === '10')
|
|
57
|
+
reminder = 'X';
|
|
58
|
+
if (vin[8] != reminder) {
|
|
59
|
+
valid = false;
|
|
60
|
+
}
|
|
61
|
+
return valid;
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
import { object, string } from "yup";
|
|
6
|
+
export const errorsSchema = object({
|
|
7
|
+
wildCard: string().required(),
|
|
8
|
+
noBaseUrl: string().required(),
|
|
9
|
+
invalidVin: string().required(),
|
|
10
|
+
noPartsFound: string().required(),
|
|
11
|
+
vinNumberRequired: string().required(),
|
|
12
|
+
wrongFormStructure: string().required(),
|
|
13
|
+
partNumberRequired: string().required(),
|
|
14
|
+
noServiceAvailable: string().required(),
|
|
15
|
+
wrongResponseFormat: string().required(),
|
|
16
|
+
requestFailedPleaseTryAgainLater: string().required(),
|
|
17
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
import { object, string } from "yup";
|
|
6
|
+
export const contactUsSchema = object({
|
|
7
|
+
fullName: string().required(),
|
|
8
|
+
fullNameMinimum: string().required(),
|
|
9
|
+
fullNameIsRequired: string().required(),
|
|
10
|
+
emailAddress: string().required(),
|
|
11
|
+
emailAddressNotValid: string().required(),
|
|
12
|
+
city: string().required(),
|
|
13
|
+
selectCity: string().required(),
|
|
14
|
+
cityIsRequired: string().required(),
|
|
15
|
+
phoneNumber: string().required(),
|
|
16
|
+
phoneNumberIsRequired: string().required(),
|
|
17
|
+
phoneNumberFormatInvalid: string().required(),
|
|
18
|
+
inquiryType: string().required(),
|
|
19
|
+
selectInquiryType: string().required(),
|
|
20
|
+
inquiryTypeIsRequired: string().required(),
|
|
21
|
+
writeAMessage: string().required(),
|
|
22
|
+
leaveUsMessage: string().required(),
|
|
23
|
+
messageIsRequired: string().required(),
|
|
24
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
import { object, string } from "yup";
|
|
6
|
+
import { contactUsSchema } from "./contact-us-schema";
|
|
7
|
+
export const FormsSchema = object({
|
|
8
|
+
contactUs: contactUsSchema,
|
|
9
|
+
reCaptchaIsRequired: string().required(),
|
|
10
|
+
inputValueIsIncorrect: string().required(),
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by ShiftSoftware
|
|
3
|
+
* Copyright (c)
|
|
4
|
+
*/
|
|
5
|
+
import { object, string } from "yup";
|
|
6
|
+
export const generalSchema = object({
|
|
7
|
+
close: string().required(),
|
|
8
|
+
submit: string().required(),
|
|
9
|
+
noSelectOptions: string().required(),
|
|
10
|
+
formSubmittedSuccessfully: string().required(),
|
|
11
|
+
});
|