adp-web-components 0.0.27 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/dist/cjs/{Loading-14fca13b.js → Loading-6f4f0127.js} +1 -1
  2. package/dist/cjs/dead-stock-lookup.cjs.entry.js +5 -5
  3. package/dist/cjs/distributor-lookup.cjs.entry.js +5 -5
  4. package/dist/cjs/dynamic-claim_6.cjs.entry.js +139 -71
  5. package/dist/cjs/dynamic-redeem.cjs.entry.js +21 -9
  6. package/dist/cjs/form-input.cjs.entry.js +1 -1
  7. package/dist/cjs/general-inquiry-form.cjs.entry.js +5 -2131
  8. package/dist/cjs/get-local-language-42973450.js +153 -0
  9. package/dist/cjs/{index-97b8da6d.js → index-846c93d2.js} +6 -1
  10. package/dist/cjs/index.esm-c628daeb.js +2135 -0
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/manufacturer-lookup.cjs.entry.js +5 -5
  13. package/dist/cjs/{partInformation-07651204.js → partInformation-2b4e0593.js} +1 -1
  14. package/dist/cjs/shift-components.cjs.js +2 -2
  15. package/dist/cjs/vehicle-lookup.cjs.entry.js +6 -5
  16. package/dist/collection/components/part-lookup/dead-stock-lookup.js +2 -2
  17. package/dist/collection/components/part-lookup/distributor-lookup.js +2 -2
  18. package/dist/collection/components/part-lookup/manufacturer-lookup.js +2 -2
  19. package/dist/collection/components/vehicle-lookup/components/CardsContainer.js +3 -2
  20. package/dist/collection/components/vehicle-lookup/components/SSCTable.js +3 -2
  21. package/dist/collection/components/vehicle-lookup/components/StatusCard.js +2 -2
  22. package/dist/collection/components/vehicle-lookup/dynamic-claim.css +1 -1
  23. package/dist/collection/components/vehicle-lookup/dynamic-claim.js +53 -13
  24. package/dist/collection/components/vehicle-lookup/dynamic-redeem.css +1 -1
  25. package/dist/collection/components/vehicle-lookup/dynamic-redeem.js +49 -10
  26. package/dist/collection/components/vehicle-lookup/paint-thickness.js +47 -8
  27. package/dist/collection/components/vehicle-lookup/service-history.js +42 -3
  28. package/dist/collection/components/vehicle-lookup/vehicle-accessories.js +48 -9
  29. package/dist/collection/components/vehicle-lookup/vehicle-lookup.js +44 -19
  30. package/dist/collection/components/vehicle-lookup/vehicle-specification.js +42 -3
  31. package/dist/collection/components/vehicle-lookup/warranty-details.js +76 -38
  32. package/dist/collection/global/api/partInformation.js +1 -1
  33. package/dist/collection/global/api/vehicleInformation.js +2 -2
  34. package/dist/collection/global/lib/get-local-language.js +19 -0
  35. package/dist/collection/global/types/locales/error-schema.js +9 -0
  36. package/dist/collection/global/types/locales/index.js +22 -0
  37. package/dist/collection/global/types/locales/vehicle-lookup/accessories-schema.js +13 -0
  38. package/dist/collection/global/types/locales/vehicle-lookup/dynamic-claim-schema.js +21 -0
  39. package/dist/collection/global/types/locales/vehicle-lookup/dynamic-redeem-schema.js +28 -0
  40. package/dist/collection/global/types/locales/vehicle-lookup/index.js +21 -0
  41. package/dist/collection/global/types/locales/vehicle-lookup/paint-thickness-schema.js +14 -0
  42. package/dist/collection/global/types/locales/vehicle-lookup/service-history-schema.js +15 -0
  43. package/dist/collection/global/types/locales/vehicle-lookup/specification-schema.js +14 -0
  44. package/dist/collection/global/types/locales/vehicle-lookup/warranty-schema.js +23 -0
  45. package/dist/components/dead-stock-lookup.js +1 -1
  46. package/dist/components/distributor-lookup.js +1 -1
  47. package/dist/components/dynamic-claim.js +1 -1
  48. package/dist/components/dynamic-redeem.js +1 -1
  49. package/dist/components/form-input.js +1 -1
  50. package/dist/components/general-inquiry-form.js +1 -1
  51. package/dist/components/index.js +1 -1
  52. package/dist/components/manufacturer-lookup.js +1 -1
  53. package/dist/components/p-0ae60f32.js +5 -0
  54. package/dist/components/p-1a626dfd.js +5 -0
  55. package/dist/components/{p-4bf4435e.js → p-1d80419b.js} +1 -1
  56. package/dist/components/p-1ea3089a.js +5 -0
  57. package/dist/components/p-2e747eb3.js +5 -0
  58. package/dist/components/p-4f99745c.js +5 -0
  59. package/dist/components/{p-c4fad245.js → p-609c2470.js} +1 -1
  60. package/dist/components/p-6c064413.js +5 -0
  61. package/dist/components/p-7360f9b1.js +5 -0
  62. package/dist/components/p-79ea7639.js +5 -0
  63. package/dist/components/p-a21e2e2e.js +5 -0
  64. package/dist/components/{p-be0a5ab5.js → p-b2051f01.js} +1 -1
  65. package/dist/components/p-e446fb9d.js +5 -0
  66. package/dist/components/p-eb89583a.js +5 -0
  67. package/dist/components/{p-b90fd51c.js → p-f001d15b.js} +1 -1
  68. package/dist/components/p-f691e103.js +5 -0
  69. package/dist/components/paint-thickness.js +1 -1
  70. package/dist/components/service-history.js +1 -1
  71. package/dist/components/vehicle-accessories.js +1 -1
  72. package/dist/components/vehicle-lookup.js +1 -1
  73. package/dist/components/vehicle-specification.js +1 -1
  74. package/dist/components/warranty-details.js +1 -1
  75. package/dist/esm/{Loading-2b8a745c.js → Loading-f4d666ee.js} +1 -1
  76. package/dist/esm/dead-stock-lookup.entry.js +5 -5
  77. package/dist/esm/distributor-lookup.entry.js +5 -5
  78. package/dist/esm/dynamic-claim_6.entry.js +139 -71
  79. package/dist/esm/dynamic-redeem.entry.js +21 -9
  80. package/dist/esm/form-input.entry.js +1 -1
  81. package/dist/esm/general-inquiry-form.entry.js +2 -2128
  82. package/dist/esm/get-local-language-85ed0b3b.js +150 -0
  83. package/dist/esm/{index-ff1dab22.js → index-33ae6859.js} +6 -1
  84. package/dist/esm/index.esm-46e0cdad.js +2132 -0
  85. package/dist/esm/loader.js +3 -3
  86. package/dist/esm/manufacturer-lookup.entry.js +5 -5
  87. package/dist/esm/{partInformation-096a8f55.js → partInformation-f40b1fe6.js} +1 -1
  88. package/dist/esm/shift-components.js +3 -3
  89. package/dist/esm/vehicle-lookup.entry.js +6 -5
  90. package/dist/locales/ar.json +105 -0
  91. package/dist/locales/en.json +105 -0
  92. package/dist/locales/ku.json +105 -0
  93. package/dist/shift-components/p-062cd94b.entry.js +5 -0
  94. package/dist/shift-components/p-0e0b69a1.entry.js +5 -0
  95. package/dist/shift-components/{p-f37b60d5.js → p-0f0e54c1.js} +2 -2
  96. package/dist/shift-components/p-10aae582.entry.js +5 -0
  97. package/dist/shift-components/p-1de8531d.entry.js +5 -0
  98. package/dist/shift-components/p-2e747eb3.js +5 -0
  99. package/dist/shift-components/{p-fad254c9.entry.js → p-496a721b.entry.js} +1 -1
  100. package/dist/shift-components/p-832fd942.entry.js +5 -0
  101. package/dist/shift-components/p-9120c049.entry.js +5 -0
  102. package/dist/shift-components/{p-e35e44a4.js → p-99d314b5.js} +1 -1
  103. package/dist/shift-components/p-c4efbdc3.js +5 -0
  104. package/dist/shift-components/p-d49f73db.entry.js +5 -0
  105. package/dist/shift-components/p-e446fb9d.js +5 -0
  106. package/dist/shift-components/shift-components.esm.js +1 -1
  107. package/dist/types/components/vehicle-lookup/components/CardsContainer.d.ts +3 -1
  108. package/dist/types/components/vehicle-lookup/components/SSCTable.d.ts +3 -1
  109. package/dist/types/components/vehicle-lookup/components/StatusCard.d.ts +3 -1
  110. package/dist/types/components/vehicle-lookup/dynamic-claim.d.ts +10 -5
  111. package/dist/types/components/vehicle-lookup/dynamic-redeem.d.ts +10 -5
  112. package/dist/types/components/vehicle-lookup/paint-thickness.d.ts +6 -1
  113. package/dist/types/components/vehicle-lookup/service-history.d.ts +6 -1
  114. package/dist/types/components/vehicle-lookup/vehicle-accessories.d.ts +6 -1
  115. package/dist/types/components/vehicle-lookup/vehicle-lookup.d.ts +5 -3
  116. package/dist/types/components/vehicle-lookup/vehicle-specification.d.ts +6 -1
  117. package/dist/types/components/vehicle-lookup/warranty-details.d.ts +10 -5
  118. package/dist/types/components.d.ts +18 -0
  119. package/dist/types/global/lib/get-local-language.d.ts +2 -0
  120. package/dist/types/global/types/locales/error-schema.d.ts +7 -0
  121. package/dist/types/global/types/locales/index.d.ts +220 -0
  122. package/dist/types/global/types/locales/vehicle-lookup/accessories-schema.d.ts +15 -0
  123. package/dist/types/global/types/locales/vehicle-lookup/dynamic-claim-schema.d.ts +31 -0
  124. package/dist/types/global/types/locales/vehicle-lookup/dynamic-redeem-schema.d.ts +45 -0
  125. package/dist/types/global/types/locales/vehicle-lookup/index.d.ts +189 -0
  126. package/dist/types/global/types/locales/vehicle-lookup/paint-thickness-schema.d.ts +17 -0
  127. package/dist/types/global/types/locales/vehicle-lookup/service-history-schema.d.ts +19 -0
  128. package/dist/types/global/types/locales/vehicle-lookup/specification-schema.d.ts +17 -0
  129. package/dist/types/global/types/locales/vehicle-lookup/warranty-schema.d.ts +35 -0
  130. package/package.json +9 -4
  131. package/dist/components/p-2741b156.js +0 -5
  132. package/dist/components/p-2ea90585.js +0 -5
  133. package/dist/components/p-4f08bcb8.js +0 -5
  134. package/dist/components/p-514c4736.js +0 -5
  135. package/dist/components/p-6ffb4e5d.js +0 -5
  136. package/dist/components/p-9245caae.js +0 -5
  137. package/dist/components/p-c62be897.js +0 -5
  138. package/dist/components/p-d4718f3b.js +0 -5
  139. package/dist/components/p-d999f3c4.js +0 -5
  140. package/dist/shift-components/p-1719e164.entry.js +0 -5
  141. package/dist/shift-components/p-26b9d31a.entry.js +0 -5
  142. package/dist/shift-components/p-33e4c335.entry.js +0 -5
  143. package/dist/shift-components/p-4f08bcb8.js +0 -5
  144. package/dist/shift-components/p-9f58a33b.entry.js +0 -5
  145. package/dist/shift-components/p-d03dade1.entry.js +0 -5
  146. package/dist/shift-components/p-d1ffe0eb.entry.js +0 -5
  147. package/dist/shift-components/p-f6764fb5.entry.js +0 -5
@@ -3,11 +3,13 @@
3
3
  * Copyright (c)
4
4
  */
5
5
  import { Host, h } from "@stencil/core";
6
+ import { localeSchema } from "../../global/types/locales/index";
6
7
  import { getVehicleInformation } from "../../global/api/vehicleInformation";
7
8
  import cn from "../../global/lib/cn";
8
- import Loading from "../components/Loading";
9
- import Eye from "~assets/eye.svg";
9
+ import { getLocaleLanguage } from "../../global/lib/get-local-language";
10
10
  import { closeImageViewer, openImageViewer } from "../../global/lib/image-expansion";
11
+ import Eye from "~assets/eye.svg";
12
+ import Loading from "../components/Loading";
11
13
  let mockData = {};
12
14
  export class VehicleAccessories {
13
15
  constructor() {
@@ -23,14 +25,22 @@ export class VehicleAccessories {
23
25
  this.baseUrl = '';
24
26
  this.isDev = false;
25
27
  this.queryString = '';
28
+ this.language = 'en';
26
29
  this.loadingStateChange = undefined;
27
30
  this.loadedResponse = undefined;
31
+ this.locale = localeSchema.getDefault();
28
32
  this.state = 'idle';
29
33
  this.externalVin = null;
30
- this.errorMessage = null;
31
34
  this.expandedImage = null;
35
+ this.errorMessage = null;
32
36
  this.vehicleInformation = undefined;
33
37
  }
38
+ async componentWillLoad() {
39
+ await this.changeLanguage(this.language);
40
+ }
41
+ async changeLanguage(newLanguage) {
42
+ this.locale = await getLocaleLanguage(newLanguage);
43
+ }
34
44
  handleSettingData(response) {
35
45
  if (!response.accessories || !Array.isArray(response.accessories))
36
46
  response.accessories = [];
@@ -62,7 +72,7 @@ export class VehicleAccessories {
62
72
  const vehicleResponse = isVinRequest ? await getVehicleInformation(this, { scopedTimeoutRef, vin, mockData }, headers) : newData;
63
73
  if (this.networkTimeoutRef === scopedTimeoutRef) {
64
74
  if (!vehicleResponse)
65
- throw new Error('Wrong response format');
75
+ throw new Error('wrongResponseFormat');
66
76
  this.handleSettingData(vehicleResponse);
67
77
  }
68
78
  this.errorMessage = null;
@@ -88,8 +98,9 @@ export class VehicleAccessories {
88
98
  }
89
99
  render() {
90
100
  var _a, _b;
101
+ const texts = this.locale.vehicleLookup.accessories;
91
102
  const accessories = (this === null || this === void 0 ? void 0 : this.vehicleInformation) ? (_a = this.vehicleInformation) === null || _a === void 0 ? void 0 : _a.accessories : [];
92
- return (h(Host, { key: '809010a784fce81c13a9f653768bcb2f792b2a8b' }, h("div", { key: '68da5c8fccf4b24c2d3a42cf4cc3fefb7dd560ab', class: "min-h-[100px] relative transition-all duration-300 overflow-hidden" }, h("div", { key: '947bbad37c5117df4f79f2c896936a22f00b0531' }, h(Loading, { key: '855aa5567d59bbfac43495c5baba708fb5600c1c', isLoading: this.state.includes('loading') }), h("div", { key: '1fe9e47793a7f58b8b0f4251ced6f7ff49f93240', class: cn('transition-all duration-700', { 'scale-0': this.state.includes('loading') || this.state === 'idle', 'opacity-0': this.state.includes('loading') }) }, h("div", { key: '7ed9356bf45e5b27c4c5ad032d44d3fdbf60631a', class: cn('text-center pt-[4px] text-[20px]', { 'text-red-600': !!this.errorMessage }) }, (_b = this.vehicleInformation) === null || _b === void 0 ? void 0 : _b.vin), ['error', 'error-loading'].includes(this.state) && (h("div", { key: 'dd349e9113ddde6a1447dd7b56d1045db29eecb6', class: "py-[16px]" }, h("div", { key: '0d720a59842a2f1e4adfdcf82bd2b443625d9c14', class: " px-[16px] py-[8px] border reject-card text-[20px] rounded-[8px] w-fit mx-auto" }, this.errorMessage))), ['data', 'data-loading'].includes(this.state) && (h("div", { key: '48030f4b6938c6174df0e80cea90221efcd80135', class: "flex mt-[12px] max-h-[70dvh] overflow-hidden rounded-[4px] flex-col border border-[#d6d8dc]" }, h("div", { key: 'be06d52f77788855c3763833868bf8c5aa9fa259', class: "w-full h-[40px] flex shrink-0 justify-center text-[18px] items-center text-[#383c43] text-center bg-[#e1e3e5]" }, "Vehicle Accessories"), h("div", { key: 'e38e31796058e2094531f1b364339dfbe6acdf77', class: "h-0 overflow-auto flex-1" }, !accessories.length && h("div", { key: 'f95c52c80f0a2dab3f0ee7e439c100b6b94a21b0', class: "h-[80px] flex items-center justify-center text-[18px]" }, "No data is available."), !!accessories.length && (h("table", { key: 'a207dd43d39984d701a654550040224866bf583b', class: "w-full overflow-auto relative border-collapse" }, h("thead", { key: 'ce3b75261934c67c9297a818fe8cfa7feaaa936c', class: "top-0 font-bold z-40 sticky bg-white" }, h("tr", { key: 'ab5f928cd658c193f9464974392dac8f937150b4' }, ['Part Number', 'Description', 'Image'].map(title => (h("th", { key: title, class: "px-[10px] py-[20px] text-center whitespace-nowrap border-b border-[#d6d8dc]" }, title))))), h("tbody", { key: '359c90cabf19855f2fc0464c04899bdbf3890afa' }, accessories.map((accessory, idx) => {
103
+ return (h(Host, { key: '5b676008ffd07cf3c30f6a1dbef540aeddec5650' }, h("div", { key: '936db932754ee0c5774bb9bbadcab9acdf0bd8f1', dir: this.locale.direction, class: "min-h-[100px] relative transition-all duration-300 overflow-hidden" }, h("div", { key: '46029b531877e9641e0797a08449c446d6acb41d' }, h(Loading, { key: 'c831c9e7b6ae7e3c7748ec20a531fc653570d7a1', isLoading: this.state.includes('loading') }), h("div", { key: 'eb7b7864b47ab00025c7634995a2f3d868f379df', class: cn('transition-all duration-700', { 'scale-0': this.state.includes('loading') || this.state === 'idle', 'opacity-0': this.state.includes('loading') }) }, h("div", { key: 'fdb1c1e9673a300a974e1ade26079063e5a6780e', class: cn('text-center pt-[4px] text-[20px]', { 'text-red-600': !!this.errorMessage }) }, (_b = this.vehicleInformation) === null || _b === void 0 ? void 0 : _b.vin), ['error', 'error-loading'].includes(this.state) && (h("div", { key: '5b777e9dabe4b1caac03d4ff4c77bc52eacafd0a', class: "py-[16px]" }, h("div", { key: 'e92c8f26bba943508ec0536f404bbf9b46b5ffef', class: " px-[16px] py-[8px] border reject-card text-[20px] rounded-[8px] w-fit mx-auto" }, this.locale.errors[this.errorMessage] || this.errorMessage))), ['data', 'data-loading'].includes(this.state) && (h("div", { key: '7e3e5c940b3b52538c58cec0f6e9befcc8b20d85', class: "flex mt-[12px] max-h-[70dvh] overflow-hidden rounded-[4px] flex-col border border-[#d6d8dc]" }, h("div", { key: 'fd6b52beb280f25ef122ca1616b3dc85ba868aac', class: "w-full h-[40px] flex shrink-0 justify-center text-[18px] items-center text-[#383c43] text-center bg-[#e1e3e5]" }, texts.vehicleAccessories), h("div", { key: 'df4343fae41a6118c73aadf8b2451c1ed55f0b24', class: "h-0 overflow-auto flex-1" }, !accessories.length && h("div", { key: 'c634537217daeb171ba9120b75baeec052727606', class: "h-[80px] flex items-center justify-center text-[18px]" }, texts.noData), !!accessories.length && (h("table", { key: '800b8700d5d7d96cccc3c0774b7c0c6d48411e51', class: "w-full overflow-auto relative border-collapse" }, h("thead", { key: '338f1360f25eeb71b0c766bc6995dc2d794694b0', class: "top-0 font-bold z-40 sticky bg-white" }, h("tr", { key: '4d7be4a922493d6e93b9a72a6de63932bb94f642' }, ['partNumber', 'description', 'image'].map(title => (h("th", { key: title, class: "px-[10px] py-[20px] text-center whitespace-nowrap border-b border-[#d6d8dc]" }, texts[title]))))), h("tbody", { key: 'eb798dcea38261093bc5fdfe5b015b79f3e6d6e9' }, accessories.map((accessory, idx) => {
93
104
  var _a;
94
105
  return (h("tr", { class: "transition-colors duration-100 hover:bg-slate-100", key: accessory.partNumber }, ['partNumber', 'description'].map(key => {
95
106
  var _a;
@@ -98,10 +109,10 @@ export class VehicleAccessories {
98
109
  }) }, accessory[key] || '...'));
99
110
  }), h("td", { class: cn('px-[10px] py-[10px] text-center whitespace-nowrap border-b border-[#d6d8dc]', {
100
111
  '!border-none': idx === ((_a = this.vehicleInformation) === null || _a === void 0 ? void 0 : _a.serviceHistory.length) - 1,
101
- }) }, h("button", { onClick: ({ target }) => this.openImage(target, accessory.image), class: "shrink-0 relative ring-0 outline-none w-fit mx-auto [&_img]:hover:shadow-lg [&_div]:hover:!opacity-100 cursor-pointer" }, h("div", { class: "absolute flex-col justify-center gap-[4px] size-full flex items-center pointer-events-none hover:opacity-100 rounded-lg opacity-0 bg-black/40 transition-all duration-300" }, h("img", { src: Eye }), h("span", { class: "text-white" }, "Expand")), h("img", { class: "w-auto h-auto max-w-[133px] max-h-[133px] cursor-pointer shadow-sm rounded-lg transition-all duration-300", src: accessory.image })))));
102
- })), h("div", { key: '8dbd610b0699e78ff72321b3542d8a5bebaac697', onClick: () => this.closeImage(), style: { backdropFilter: this.expandedImage ? 'blur(3px)' : 'blur(0px)' }, class: cn('pointer-events-none w-[100dvw] h-[100dvh] fixed top-0 z-50 left-0 opacity-0 bg-black/40 transition-all duration-400', {
112
+ }) }, h("button", { onClick: ({ target }) => this.openImage(target, accessory.image), class: "shrink-0 relative ring-0 outline-none w-fit mx-auto [&_img]:hover:shadow-lg [&_div]:hover:!opacity-100 cursor-pointer" }, h("div", { class: "absolute flex-col justify-center gap-[4px] size-full flex items-center pointer-events-none hover:opacity-100 rounded-lg opacity-0 bg-black/40 transition-all duration-300" }, h("img", { src: Eye }), h("span", { class: "text-white" }, texts.expand)), h("img", { class: "w-auto h-auto max-w-[133px] max-h-[133px] cursor-pointer shadow-sm rounded-lg transition-all duration-300", src: accessory.image })))));
113
+ })), h("div", { key: 'bb875932b3315b24afd3589948936dd3b471bc56', onClick: () => this.closeImage(), style: { backdropFilter: this.expandedImage ? 'blur(3px)' : 'blur(0px)' }, class: cn('pointer-events-none w-[100dvw] h-[100dvh] fixed top-0 z-50 left-0 opacity-0 bg-black/40 transition-all duration-400', {
103
114
  'pointer-events-auto opacity-100 delay-200': this.expandedImage,
104
- }) }, h("button", { key: '504e17f2df3bbffe428e75e71b44fde9a681084e', class: "flex flex-col mt-[16px] items-center justify-center size-12 float-right mr-[16px]", onClick: () => this.closeImage() }, h("div", { key: 'ea82b4f6759a5593d057a42a18f7e116d86ee921', class: "h-1 w-12 rounded-full rotate-45 absolute bg-white" }), h("div", { key: '6aabdfaf3e10b744c6ade52e12a5b1c9bc81f5f7', class: "h-1 w-12 rounded-full -rotate-45 absolute bg-white" }))), h("img", { key: 'b0d0a64346461b81c2113f4928bb2de08abeb440', alt: "", id: "expanded-image", class: "fixed opacity-0 z-50 transition-all rounded-lg" })))))))))));
115
+ }) }, h("button", { key: '9b6a9934ecd43a4988978772d3f9ec032fc2366d', class: "flex flex-col mt-[16px] items-center justify-center size-12 float-right mr-[16px]", onClick: () => this.closeImage() }, h("div", { key: 'fc59bcd946d47fab25522506e1362ab92580efa8', class: "h-1 w-12 rounded-full rotate-45 absolute bg-white" }), h("div", { key: 'baf4b47120f23081e6f150ee3aacb8410e964c51', class: "h-1 w-12 rounded-full -rotate-45 absolute bg-white" }))), h("img", { key: '8dfbdb6402ba212b864fb7e6324db06b28e6b8b2', alt: "", id: "expanded-image", class: "fixed opacity-0 z-50 transition-all rounded-lg" })))))))))));
105
116
  }
106
117
  static get is() { return "vehicle-accessories"; }
107
118
  static get encapsulation() { return "shadow"; }
@@ -171,6 +182,30 @@ export class VehicleAccessories {
171
182
  "reflect": false,
172
183
  "defaultValue": "''"
173
184
  },
185
+ "language": {
186
+ "type": "string",
187
+ "mutable": false,
188
+ "complexType": {
189
+ "original": "LanguageKeys",
190
+ "resolved": "\"ar\" | \"en\" | \"ku\"",
191
+ "references": {
192
+ "LanguageKeys": {
193
+ "location": "import",
194
+ "path": "~types/locales",
195
+ "id": "src/global/types/locales/index.ts::LanguageKeys"
196
+ }
197
+ }
198
+ },
199
+ "required": false,
200
+ "optional": false,
201
+ "docs": {
202
+ "tags": [],
203
+ "text": ""
204
+ },
205
+ "attribute": "language",
206
+ "reflect": false,
207
+ "defaultValue": "'en'"
208
+ },
174
209
  "loadingStateChange": {
175
210
  "type": "unknown",
176
211
  "mutable": false,
@@ -211,10 +246,11 @@ export class VehicleAccessories {
211
246
  }
212
247
  static get states() {
213
248
  return {
249
+ "locale": {},
214
250
  "state": {},
215
251
  "externalVin": {},
216
- "errorMessage": {},
217
252
  "expandedImage": {},
253
+ "errorMessage": {},
218
254
  "vehicleInformation": {}
219
255
  };
220
256
  }
@@ -315,6 +351,9 @@ export class VehicleAccessories {
315
351
  static get elementRef() { return "el"; }
316
352
  static get watchers() {
317
353
  return [{
354
+ "propName": "language",
355
+ "methodName": "changeLanguage"
356
+ }, {
318
357
  "propName": "state",
319
358
  "methodName": "loadingListener"
320
359
  }];
@@ -11,11 +11,12 @@ export class VehicleLookup {
11
11
  this.baseUrl = '';
12
12
  this.isDev = false;
13
13
  this.queryString = '';
14
- this.loadingStateChanged = undefined;
14
+ this.language = 'en';
15
+ this.blazorErrorStateListener = '';
15
16
  this.blazorOnLoadingStateChange = '';
16
- this.wrapperErrorState = '';
17
17
  this.errorStateListener = undefined;
18
- this.blazorErrorStateListener = '';
18
+ this.loadingStateChanged = undefined;
19
+ this.wrapperErrorState = '';
19
20
  this.blazorRef = undefined;
20
21
  }
21
22
  async componentDidLoad() {
@@ -94,7 +95,7 @@ export class VehicleLookup {
94
95
  });
95
96
  }
96
97
  render() {
97
- return (h(Host, { key: 'c0ae0086435cd2bfc4a4838223c29796960bbbf6' }, h("div", { key: 'c989c8199a556448887c2018cae79eed02813f46', class: cn('w-full', { hidden: this.activeElement !== 'vehicle-specification' }) }, h("vehicle-specification", { key: 'dc99a0489d6a8c0306cb7aaef7749997553e023b', isDev: this.isDev, "base-url": this.baseUrl, "query-string": this.queryString })), h("div", { key: 'c8a8a7eec552f9fd0234dab9d85df14e43102041', class: cn('w-full', { hidden: this.activeElement !== 'vehicle-accessories' }) }, h("vehicle-accessories", { key: '624acb4beb19b22e82d79250594e350a21e7f8bf', isDev: this.isDev, "base-url": this.baseUrl, "query-string": this.queryString })), h("div", { key: '834807eace640d41d904f7511003ede16b2bfc95', class: cn('w-full', { hidden: this.activeElement !== 'warranty-details' }) }, h("warranty-details", { key: 'a74777497db827ce84dcea65823f467af80fa5fa', "show-ssc": "true", "show-warranty": "true", isDev: this.isDev, "base-url": this.baseUrl, "query-string": this.queryString }, h("slot", { key: 'c4f0f9387d20481c503d6fe9c38532ede6f71a95' }))), h("div", { key: '33b0b26eb268027789d8d8cecc00247f073a333a', class: cn('w-full', { hidden: this.activeElement !== 'service-history' }) }, h("service-history", { key: '2d4315c0e2091666e4514ce3b24c8f9f3120850c', isDev: this.isDev, "base-url": this.baseUrl, "query-string": this.queryString })), h("div", { key: '21620c7e04ade2da21a8d4aee3c28eb1f8d1e8fa', class: cn('w-full', { hidden: this.activeElement !== 'paint-thickness' }) }, h("paint-thickness", { key: '93e0597fbf83490189fa448fd9765b6fa76cf214', isDev: this.isDev, "base-url": this.baseUrl, "query-string": this.queryString })), h("div", { key: 'd5b2313cb8faac74fc9304c1e4c311b766c57259', class: cn('w-full', { hidden: this.activeElement !== 'dynamic-claim' }) }, h("dynamic-claim", { key: '10e9015d5288618f10fd92e5a72774ac0d8a7f59', isDev: this.isDev, "base-url": this.baseUrl, "query-string": this.queryString }))));
98
+ return (h(Host, { key: '1b02080c791eaabac9cdefc01d99222cc2d74754' }, h("div", { key: '0063278f8b621592ac4242f347f3f17757fdde46', class: cn('w-full', { hidden: this.activeElement !== 'vehicle-specification' }) }, h("vehicle-specification", { key: 'dd2416d8d2765ceeaca2c568d2e8137c8b4f0533', language: this.language, isDev: this.isDev, "base-url": this.baseUrl, "query-string": this.queryString })), h("div", { key: 'db672d3a1dcc4fbb9f859aee47a997163c55cc56', class: cn('w-full', { hidden: this.activeElement !== 'vehicle-accessories' }) }, h("vehicle-accessories", { key: '32a98a8bf3facadbf9a4b4b90f163ffe7ee737de', language: this.language, isDev: this.isDev, "base-url": this.baseUrl, "query-string": this.queryString })), h("div", { key: 'a889c95b168a6dba09f416d1c9b2926abf150098', class: cn('w-full', { hidden: this.activeElement !== 'warranty-details' }) }, h("warranty-details", { key: '7f55dbf1cedd8e867dafb514b1c02a829fd98b9d', language: this.language, isDev: this.isDev, "show-ssc": "true", "show-warranty": "true", "base-url": this.baseUrl, "query-string": this.queryString }, h("slot", { key: 'eb734db1e996237f410070ada9583c6ec2cfafc0' }))), h("div", { key: 'fd4431e0b5f13283ab391e32400ae40f4f0c265c', class: cn('w-full', { hidden: this.activeElement !== 'service-history' }) }, h("service-history", { key: '65879ee4ba28485f9f17816874636f4f157f3567', language: this.language, isDev: this.isDev, "base-url": this.baseUrl, "query-string": this.queryString })), h("div", { key: 'c5129bb7d63c138c770fcce25889860382c1208e', class: cn('w-full', { hidden: this.activeElement !== 'paint-thickness' }) }, h("paint-thickness", { key: 'd75617d35eda2727687c53f2f562f687dbec7acc', language: this.language, isDev: this.isDev, "base-url": this.baseUrl, "query-string": this.queryString })), h("div", { key: 'c9deade0eff8f18b32a4327691f4dc2f01f82848', class: cn('w-full', { hidden: this.activeElement !== 'dynamic-claim' }) }, h("dynamic-claim", { key: '638665a4596224088cffd4d28b43aa86f15dfddc', language: this.language, isDev: this.isDev, "base-url": this.baseUrl, "query-string": this.queryString }))));
98
99
  }
99
100
  static get is() { return "vehicle-lookup"; }
100
101
  static get originalStyleUrls() {
@@ -187,20 +188,47 @@ export class VehicleLookup {
187
188
  "reflect": false,
188
189
  "defaultValue": "''"
189
190
  },
190
- "loadingStateChanged": {
191
- "type": "unknown",
191
+ "language": {
192
+ "type": "string",
192
193
  "mutable": false,
193
194
  "complexType": {
194
- "original": "(isLoading: boolean) => void",
195
- "resolved": "(isLoading: boolean) => void",
195
+ "original": "LanguageKeys",
196
+ "resolved": "\"ar\" | \"en\" | \"ku\"",
197
+ "references": {
198
+ "LanguageKeys": {
199
+ "location": "import",
200
+ "path": "~types/locales",
201
+ "id": "src/global/types/locales/index.ts::LanguageKeys"
202
+ }
203
+ }
204
+ },
205
+ "required": false,
206
+ "optional": false,
207
+ "docs": {
208
+ "tags": [],
209
+ "text": ""
210
+ },
211
+ "attribute": "language",
212
+ "reflect": false,
213
+ "defaultValue": "'en'"
214
+ },
215
+ "blazorErrorStateListener": {
216
+ "type": "string",
217
+ "mutable": false,
218
+ "complexType": {
219
+ "original": "string",
220
+ "resolved": "string",
196
221
  "references": {}
197
222
  },
198
223
  "required": false,
199
- "optional": true,
224
+ "optional": false,
200
225
  "docs": {
201
226
  "tags": [],
202
227
  "text": ""
203
- }
228
+ },
229
+ "attribute": "blazor-error-state-listener",
230
+ "reflect": false,
231
+ "defaultValue": "''"
204
232
  },
205
233
  "blazorOnLoadingStateChange": {
206
234
  "type": "string",
@@ -235,23 +263,20 @@ export class VehicleLookup {
235
263
  "text": ""
236
264
  }
237
265
  },
238
- "blazorErrorStateListener": {
239
- "type": "string",
266
+ "loadingStateChanged": {
267
+ "type": "unknown",
240
268
  "mutable": false,
241
269
  "complexType": {
242
- "original": "string",
243
- "resolved": "string",
270
+ "original": "(isLoading: boolean) => void",
271
+ "resolved": "(isLoading: boolean) => void",
244
272
  "references": {}
245
273
  },
246
274
  "required": false,
247
- "optional": false,
275
+ "optional": true,
248
276
  "docs": {
249
277
  "tags": [],
250
278
  "text": ""
251
- },
252
- "attribute": "blazor-error-state-listener",
253
- "reflect": false,
254
- "defaultValue": "''"
279
+ }
255
280
  }
256
281
  };
257
282
  }
@@ -3,22 +3,32 @@
3
3
  * Copyright (c)
4
4
  */
5
5
  import { Host, h } from "@stencil/core";
6
- import Loading from "../components/Loading";
6
+ import { localeSchema } from "../../global/types/locales/index";
7
7
  import cn from "../../global/lib/cn";
8
+ import { getLocaleLanguage } from "../../global/lib/get-local-language";
8
9
  import { getVehicleInformation } from "../../global/api/vehicleInformation";
10
+ import Loading from "../components/Loading";
9
11
  let mockData = {};
10
12
  export class VehicleSpecification {
11
13
  constructor() {
12
14
  this.baseUrl = '';
13
15
  this.isDev = false;
14
16
  this.queryString = '';
17
+ this.language = 'en';
15
18
  this.loadingStateChange = undefined;
16
19
  this.loadedResponse = undefined;
20
+ this.locale = localeSchema.getDefault();
17
21
  this.state = 'idle';
18
22
  this.externalVin = null;
19
23
  this.errorMessage = null;
20
24
  this.vehicleInformation = undefined;
21
25
  }
26
+ async componentWillLoad() {
27
+ await this.changeLanguage(this.language);
28
+ }
29
+ async changeLanguage(newLanguage) {
30
+ this.locale = await getLocaleLanguage(newLanguage);
31
+ }
22
32
  async setData(newData, headers = {}) {
23
33
  clearTimeout(this.networkTimeoutRef);
24
34
  if (this.abortController)
@@ -45,7 +55,7 @@ export class VehicleSpecification {
45
55
  const vehicleResponse = isVinRequest ? await getVehicleInformation(this, { scopedTimeoutRef, vin, mockData }, headers) : newData;
46
56
  if (this.networkTimeoutRef === scopedTimeoutRef) {
47
57
  if (!vehicleResponse)
48
- throw new Error('Wrong response format');
58
+ throw new Error('wrongResponseFormat');
49
59
  this.vehicleInformation = vehicleResponse;
50
60
  }
51
61
  this.errorMessage = null;
@@ -71,7 +81,8 @@ export class VehicleSpecification {
71
81
  }
72
82
  render() {
73
83
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
74
- return (h(Host, { key: 'e96ba82b8f58b3812bfb539e6e20020635d17c13' }, h("div", { key: '65896e18a4b328b657dc7ae37506f3f090be58ef', class: "min-h-[100px] relative transition-all duration-300 overflow-hidden" }, h("div", { key: '85b32b58705d8ede8161f4bf429e4eea2eeab113' }, h(Loading, { key: '102144466024234e3b3d67f40a2ed613d8decb8f', isLoading: this.state.includes('loading') }), h("div", { key: 'ea3201bce6b9471c1c1b3cf2336bb4d3d820345a', class: cn('transition-all duration-700', { 'scale-0': this.state.includes('loading') || this.state === 'idle', 'opacity-0': this.state.includes('loading') }) }, h("div", { key: '063a8e9ae6202a207ee9e03bb8e21c8d269f105f', class: cn('text-center pt-[4px] text-[20px]', { 'text-red-600': !!this.errorMessage }) }, (_a = this.vehicleInformation) === null || _a === void 0 ? void 0 : _a.vin), ['error', 'error-loading'].includes(this.state) && (h("div", { key: '5b6e0c8f594a4609ebe476e39c607ddd16221c2a', class: "py-4" }, h("div", { key: 'cd11ab7ea9c2b17b870bce21b793b06707b729ea', class: " px-[16px] py-[8px] border reject-card text-[20px] rounded-[8px] w-fit mx-auto" }, this.errorMessage))), ['data', 'data-loading'].includes(this.state) && (h("div", { key: '9afcbe4ffc5e11f39c2ff6f284d2f0b6b9f24df4', class: "flex mt-[12px] max-h-[70dvh] overflow-hidden rounded-[4px] flex-col border border-[#d6d8dc]" }, h("div", { key: '324be66504bbe49d03d3e777d5fa5b14c8129975', class: "w-full h-[40px] flex shrink-0 justify-center text-[18px] items-center text-[#383c43] text-center bg-[#e1e3e5]" }, "Vehicle Specifications"), h("div", { key: '0875021cb9dcf017b98d516e5898c05b5803a1ba', class: "h-0 overflow-auto flex-1" }, !((_b = this.vehicleInformation) === null || _b === void 0 ? void 0 : _b.vehicleSpecification) && h("div", { key: '9132eb142b5f67fbb5310936bfba4517174eafcf', class: "h-[80px] flex items-center justify-center text-[18px]" }, "No data is available."), !!((_c = this.vehicleInformation) === null || _c === void 0 ? void 0 : _c.vehicleSpecification) && (h("table", { key: 'ed324bef37bc05379b5bf9f7c2e86b9a45ec732e', class: "w-full overflow-auto relative border-collapse" }, h("thead", { key: '1fc091f01a228617523d213dcdf295368f875279', class: "top-0 font-bold sticky bg-white" }, h("tr", { key: '308569c58472d2680c5e7b9ed444d0e7360948f5' }, ['Model', 'Variant', 'Katashiki', 'Model Year', 'SFX'].map(title => (h("th", { key: title, class: "px-[10px] py-[20px] text-center whitespace-nowrap border-b border-[#d6d8dc]" }, title))))), h("tbody", { key: '9d44d2b25f0cd37603d10d4632c1adf78cbaabeb' }, h("tr", { key: 'ce399b783d636d8f7e4cb5dac62ef08ca0e2383c' }, h("td", { key: '2f3fdaac2635377722caea73a05d097686606cb7', class: "px-[10px] py-[20px] text-center whitespace-nowrap" }, ((_e = (_d = this === null || this === void 0 ? void 0 : this.vehicleInformation) === null || _d === void 0 ? void 0 : _d.vehicleVariantInfo) === null || _e === void 0 ? void 0 : _e.modelCode) || '...', " ", h("br", { key: 'f7b14609c4be0a16414311c9c42f594f37bf9a5d', class: "my-2" }), ((_g = (_f = this === null || this === void 0 ? void 0 : this.vehicleInformation) === null || _f === void 0 ? void 0 : _f.vehicleSpecification) === null || _g === void 0 ? void 0 : _g.modelDesc) || '...'), h("td", { key: 'a20ed93430b4d33734e068b4495623ea0cbc1872', class: "px-[10px] py-[20px] text-center whitespace-nowrap" }, ((_j = (_h = this === null || this === void 0 ? void 0 : this.vehicleInformation) === null || _h === void 0 ? void 0 : _h.identifiers) === null || _j === void 0 ? void 0 : _j.variant) || '...', " ", h("br", { key: '8b77dac46b0161eca0b5d1806f643d72d787b821' }), ((_l = (_k = this === null || this === void 0 ? void 0 : this.vehicleInformation) === null || _k === void 0 ? void 0 : _k.vehicleSpecification) === null || _l === void 0 ? void 0 : _l.variantDesc) || '...'), ['identifiers.katashiki', 'vehicleVariantInfo.modelYear', 'vehicleVariantInfo.sfx'].map(infoPath => {
84
+ const texts = this.locale.vehicleLookup.specification;
85
+ return (h(Host, { key: '610f4bab084478eb7f60133ed6498fc6b53a6844' }, h("div", { key: '5d25c90dd19ae1fdf84d6484881b3fceeada61c4', dir: this.locale.direction, class: "min-h-[100px] relative transition-all duration-300 overflow-hidden" }, h("div", { key: 'bd3643977e70e46e86b7516a9407679209a7d4fa' }, h(Loading, { key: '9064190a3698c0534e36e8bc018bbaec3b08709a', isLoading: this.state.includes('loading') }), h("div", { key: '56426c064d0a0b1273f62e78b64cca65020c72c8', class: cn('transition-all duration-700', { 'scale-0': this.state.includes('loading') || this.state === 'idle', 'opacity-0': this.state.includes('loading') }) }, h("div", { key: 'ec8f12b6d2372053c097a057ba71d072d75e4fdc', class: cn('text-center pt-[4px] text-[20px]', { 'text-red-600': !!this.errorMessage }) }, (_a = this.vehicleInformation) === null || _a === void 0 ? void 0 : _a.vin), ['error', 'error-loading'].includes(this.state) && (h("div", { key: '285ac738ecc896feeda7caf81f8a41c9a99cea19', class: "py-4" }, h("div", { key: 'a29855571fcc97bc19f3196427fdf67d9cadb501', class: " px-[16px] py-[8px] border reject-card text-[20px] rounded-[8px] w-fit mx-auto" }, this.locale.errors[this.errorMessage] || this.errorMessage))), ['data', 'data-loading'].includes(this.state) && (h("div", { key: '021f7bb6c6a1c9b44ebc112c48e4789aca7d387c', class: "flex mt-[12px] max-h-[70dvh] overflow-hidden rounded-[4px] flex-col border border-[#d6d8dc]" }, h("div", { key: '43e4399b5064de1023a8e3d27fdd2632f75b3338', class: "w-full h-[40px] flex shrink-0 justify-center text-[18px] items-center text-[#383c43] text-center bg-[#e1e3e5]" }, texts.vehicleSpecification), h("div", { key: 'f0fa3e15cb9336be3a4061821438d82d9e73587c', class: "h-0 overflow-auto flex-1" }, !((_b = this.vehicleInformation) === null || _b === void 0 ? void 0 : _b.vehicleSpecification) && h("div", { key: '12d0257e9d94573a09fecda9c4fcc3e093c08f16', class: "h-[80px] flex items-center justify-center text-[18px]" }, texts.noData), !!((_c = this.vehicleInformation) === null || _c === void 0 ? void 0 : _c.vehicleSpecification) && (h("table", { key: 'ecc72141ecfb0b1ca2eeb4825eb6c90119089395', class: "w-full overflow-auto relative border-collapse" }, h("thead", { key: '01eeb96a4dc8c721d720f34b535cc1b917c53b3a', class: "top-0 font-bold sticky bg-white" }, h("tr", { key: '956677dd3a6a94a4fec8d9d784567aa3fdd62a16' }, ['model', 'variant', 'katashiki', 'modelYear', 'sfx'].map(title => (h("th", { key: title, class: "px-[10px] py-[20px] text-center whitespace-nowrap border-b border-[#d6d8dc]" }, texts[title]))))), h("tbody", { key: 'e62c17cb6047d082191913821426e6e1e928d9fc' }, h("tr", { key: '71a09174b51e10d070723c00b8db14499707bdc3' }, h("td", { key: '6fd71363e86b19311907a42348cee324e4137e43', class: "px-[10px] py-[20px] text-center whitespace-nowrap" }, ((_e = (_d = this === null || this === void 0 ? void 0 : this.vehicleInformation) === null || _d === void 0 ? void 0 : _d.vehicleVariantInfo) === null || _e === void 0 ? void 0 : _e.modelCode) || '...', " ", h("br", { key: '759a2b9072f60aa917a001b39b91e38fc91e4b5a', class: "my-2" }), ((_g = (_f = this === null || this === void 0 ? void 0 : this.vehicleInformation) === null || _f === void 0 ? void 0 : _f.vehicleSpecification) === null || _g === void 0 ? void 0 : _g.modelDesc) || '...'), h("td", { key: '3c634e53ec8955bcf1af66667a6fe004d6e46f01', class: "px-[10px] py-[20px] text-center whitespace-nowrap" }, ((_j = (_h = this === null || this === void 0 ? void 0 : this.vehicleInformation) === null || _h === void 0 ? void 0 : _h.identifiers) === null || _j === void 0 ? void 0 : _j.variant) || '...', " ", h("br", { key: 'b81065d744067f06f60e6b34e31f219c6c58d373' }), ((_l = (_k = this === null || this === void 0 ? void 0 : this.vehicleInformation) === null || _k === void 0 ? void 0 : _k.vehicleSpecification) === null || _l === void 0 ? void 0 : _l.variantDesc) || '...'), ['identifiers.katashiki', 'vehicleVariantInfo.modelYear', 'vehicleVariantInfo.sfx'].map(infoPath => {
75
86
  var _a;
76
87
  const [place, field] = infoPath.split('.');
77
88
  const cellValue = (_a = this === null || this === void 0 ? void 0 : this.vehicleInformation) === null || _a === void 0 ? void 0 : _a[place][field].toString();
@@ -146,6 +157,30 @@ export class VehicleSpecification {
146
157
  "reflect": false,
147
158
  "defaultValue": "''"
148
159
  },
160
+ "language": {
161
+ "type": "string",
162
+ "mutable": false,
163
+ "complexType": {
164
+ "original": "LanguageKeys",
165
+ "resolved": "\"ar\" | \"en\" | \"ku\"",
166
+ "references": {
167
+ "LanguageKeys": {
168
+ "location": "import",
169
+ "path": "~types/locales",
170
+ "id": "src/global/types/locales/index.ts::LanguageKeys"
171
+ }
172
+ }
173
+ },
174
+ "required": false,
175
+ "optional": false,
176
+ "docs": {
177
+ "tags": [],
178
+ "text": ""
179
+ },
180
+ "attribute": "language",
181
+ "reflect": false,
182
+ "defaultValue": "'en'"
183
+ },
149
184
  "loadingStateChange": {
150
185
  "type": "unknown",
151
186
  "mutable": false,
@@ -186,6 +221,7 @@ export class VehicleSpecification {
186
221
  }
187
222
  static get states() {
188
223
  return {
224
+ "locale": {},
189
225
  "state": {},
190
226
  "externalVin": {},
191
227
  "errorMessage": {},
@@ -289,6 +325,9 @@ export class VehicleSpecification {
289
325
  static get elementRef() { return "el"; }
290
326
  static get watchers() {
291
327
  return [{
328
+ "propName": "language",
329
+ "methodName": "changeLanguage"
330
+ }, {
292
331
  "propName": "state",
293
332
  "methodName": "loadingListener"
294
333
  }];
@@ -3,24 +3,27 @@
3
3
  * Copyright (c)
4
4
  */
5
5
  import { Host, h } from "@stencil/core";
6
+ import Loader from "~assets/loader.svg";
6
7
  import Loading from "./components/Loading";
8
+ import SSCTable from "./components/SSCTable";
7
9
  import StatusCard from "./components/StatusCard";
8
- import Loader from "~assets/loader.svg";
9
10
  import CardsContainer from "./components/CardsContainer";
10
- import SSCTable from "./components/SSCTable";
11
11
  import cn from "../../global/lib/cn";
12
+ import { getLocaleLanguage } from "../../global/lib/get-local-language";
13
+ import { localeSchema } from "../../global/types/locales/index";
12
14
  import { getVehicleInformation } from "../../global/api/vehicleInformation";
13
15
  let mockData = {};
14
16
  export class WarrantyDetails {
15
17
  constructor() {
16
18
  this.baseUrl = '';
17
- this.unauthorizedSscLookupBaseUrl = '';
18
19
  this.isDev = false;
19
20
  this.showSsc = false;
20
21
  this.queryString = '';
21
- this.unauthorizedSscLookupQueryString = '';
22
22
  this.recaptchaKey = '';
23
+ this.language = 'en';
23
24
  this.showWarranty = false;
25
+ this.unauthorizedSscLookupBaseUrl = '';
26
+ this.unauthorizedSscLookupQueryString = '';
24
27
  this.cityId = null;
25
28
  this.cityIntegrationId = null;
26
29
  this.companyId = null;
@@ -36,13 +39,20 @@ export class WarrantyDetails {
36
39
  this.loadedResponse = undefined;
37
40
  this.state = 'idle';
38
41
  this.externalVin = null;
39
- this.errorMessage = null;
40
42
  this.showRecaptcha = false;
43
+ this.errorMessage = null;
41
44
  this.unInvoicedByBrokerName = null;
42
45
  this.vehicleInformation = undefined;
43
46
  this.checkingUnauthorizedSSC = false;
44
47
  this.recaptchaRes = null;
45
48
  this.headers = {};
49
+ this.locale = localeSchema.getDefault();
50
+ }
51
+ async componentWillLoad() {
52
+ await this.changeLanguage(this.language);
53
+ }
54
+ async changeLanguage(newLanguage) {
55
+ this.locale = await getLocaleLanguage(newLanguage);
46
56
  }
47
57
  handleSettingData(response) {
48
58
  var _a, _b, _c;
@@ -80,7 +90,7 @@ export class WarrantyDetails {
80
90
  const hasPendingSSC = Math.random() < 0.5 ? false : true;
81
91
  this.recaptchaRes = {
82
92
  hasSSC: hasPendingSSC,
83
- message: hasPendingSSC ? 'This Vehicle has a Pending SSC' : 'No Pending SSC',
93
+ message: hasPendingSSC ? 'pendingSSC' : 'noPendingSSC',
84
94
  };
85
95
  }
86
96
  else {
@@ -97,11 +107,11 @@ export class WarrantyDetails {
97
107
  const hasPendingSSC = vinResponse.sscLookupStatus === 1;
98
108
  this.recaptchaRes = {
99
109
  hasSSC: hasPendingSSC,
100
- message: hasPendingSSC ? 'This Vehicle has a Pending SSC' : 'No Pending SSC',
110
+ message: hasPendingSSC ? 'pendingSSC' : 'noPendingSSC',
101
111
  };
102
112
  }
103
113
  else
104
- throw new Error('Wrong response format');
114
+ throw new Error('wrongResponseFormat');
105
115
  }
106
116
  }
107
117
  }, 500);
@@ -140,7 +150,7 @@ export class WarrantyDetails {
140
150
  const vehicleResponse = isVinRequest ? await getVehicleInformation(this, { scopedTimeoutRef, vin, mockData }, headers) : newData;
141
151
  if (this.networkTimeoutRef === scopedTimeoutRef) {
142
152
  if (!vehicleResponse)
143
- throw new Error('Wrong response format');
153
+ throw new Error('wrongResponseFormat');
144
154
  this.handleSettingData(vehicleResponse);
145
155
  this.handleInitializingRecaptcha(vin, scopedTimeoutRef);
146
156
  }
@@ -177,7 +187,7 @@ export class WarrantyDetails {
177
187
  }
178
188
  render() {
179
189
  var _a, _b, _c, _d, _e;
180
- return (h(Host, { key: '590b86e8c3fc8993794c24edabf8169c7e8105a4' }, h("div", { key: 'a3f2b266e72f75c6aecec054d0eef277a16807f7', class: "min-h-[100px] warranty" }, h("div", { key: 'a272392f3848b40df31b2f3ea47665e9d9b6fab6' }, h(Loading, { key: '9651e47db177da1e7097f037e63dcc208bee4ff6', isLoading: this.state.includes('loading') }), h("div", { key: 'f06b83e2903199b624780923a83ce3c005cc4e04', class: "transition duration-700", style: { transform: this.state.includes('loading') || this.state === 'idle' ? 'scale(0)' : 'scale(1)', opacity: this.state.includes('loading') ? '0' : '1' } }, (this.showSsc || this.showWarranty) && (h("div", { key: '09086f9a3e4d301fa2c0283de6c4a458a1f37bfa', style: { color: !!this.errorMessage ? 'red' : 'black' }, class: "warranty-vin" }, (_a = this.vehicleInformation) === null || _a === void 0 ? void 0 : _a.vin)), ['error', 'error-loading'].includes(this.state) && (h("div", { key: 'd781b9b96fe9151fdc711127fd6e95eec3d2c27a', class: "py-4" }, h(StatusCard, { key: '2d5056b842c7c5276dd9068a9c15f7b4c3934271', desc: this.errorMessage, className: "mx-auto reject-card max-w-500" }), ' ')), this.showWarranty && ['data', 'data-loading'].includes(this.state) && (h(CardsContainer, { key: '3e3fe57c08277d0c4b113638f5c7b1c8bf67c1da', isAuthorized: (_b = this.vehicleInformation) === null || _b === void 0 ? void 0 : _b.isAuthorized, unInvoicedByBrokerName: this.unInvoicedByBrokerName, warranty: (_c = this.vehicleInformation) === null || _c === void 0 ? void 0 : _c.warranty })), h("div", { key: '45b368d2f868d6968bc378933dbcb43ed3f769b8', style: Object.assign({}, (this.showRecaptcha ? { height: 'auto', padding: '16px 16px 0px 16px' } : { height: '0px' })), class: "recaptcha-container" }, h("slot", { key: '18cc24a9b1432f305e3af6e08a166e4418d2074d' })), ['data', 'data-loading'].includes(this.state) && this.recaptchaRes && (h("div", { key: 'db95680aa9342d5c19413520d743ac27954601cc', class: cn('recaptcha-response', !this.recaptchaRes.hasSSC ? 'success-card' : 'reject-card ') }, this.recaptchaRes.message)), this.checkingUnauthorizedSSC && (h("div", { key: 'a2874a0311723a32f2c4ace8ac59e6eca21c068d', class: "loading-spinner", style: { marginTop: '20px', flexDirection: 'column' } }, h("div", { key: '5e8a3b3db4bed8820ba077c829ae1ba02acc69b1' }, h("strong", { key: '945a36e3f1c7a814924d36356699b22149693f1f' }, "Checking TMC")), h("img", { key: 'fe2abdbb699dc69083e439b56e336534d2b29e34', class: "spin", src: Loader }))), this.showSsc && ['data', 'data-loading'].includes(this.state) && ((_d = this.vehicleInformation) === null || _d === void 0 ? void 0 : _d.ssc) !== null && !!((_e = this.vehicleInformation) === null || _e === void 0 ? void 0 : _e.ssc.length) && (h(SSCTable, { key: '2c536e2020a6bbf952e43f1f93df185c44b4ce2e', ssc: this.vehicleInformation.ssc })))))));
190
+ return (h(Host, { key: '5976b28e5ddc465d0ae79b7882d40b4f7105ffdf' }, h("div", { key: '1c5623799b6fbfb7a343a78c6b96b027f4416d10', dir: this.locale.direction, class: "min-h-[100px] warranty" }, h("div", { key: '5dde3a2e0886f5ececd0e8d556abef41d167942d' }, h(Loading, { key: '7f8b0a8ed8b2f07fbbc2e7d5a5162ae7aca02a14', isLoading: this.state.includes('loading') }), h("div", { key: '240a44eefa85d905e3bf1900772524e4a660feca', class: "transition duration-700", style: { transform: this.state.includes('loading') || this.state === 'idle' ? 'scale(0)' : 'scale(1)', opacity: this.state.includes('loading') ? '0' : '1' } }, (this.showSsc || this.showWarranty) && (h("div", { key: '3d7488bbd306a360094636adc2732cf00aa4b877', style: { color: !!this.errorMessage ? 'red' : 'black' }, class: "warranty-vin" }, (_a = this.vehicleInformation) === null || _a === void 0 ? void 0 : _a.vin)), ['error', 'error-loading'].includes(this.state) && (h("div", { key: '8f186a25db18cd00449ce68cf7261870b7996dc7', class: "py-4" }, h(StatusCard, { key: '5de5ac8872b809ef344440b6bc9fad956c744620', desc: this.locale.errors[this.errorMessage] || this.errorMessage, className: "mx-auto reject-card max-w-500" }), ' ')), this.showWarranty && ['data', 'data-loading'].includes(this.state) && (h(CardsContainer, { key: 'df36bf0f0e4906b662d11a3db6cf7cd40dabbae9', locale: this.locale, isAuthorized: (_b = this.vehicleInformation) === null || _b === void 0 ? void 0 : _b.isAuthorized, unInvoicedByBrokerName: this.unInvoicedByBrokerName, warranty: (_c = this.vehicleInformation) === null || _c === void 0 ? void 0 : _c.warranty })), h("div", { key: '00d93ce17bfc3868709d67a74fa80983e5e9d312', style: Object.assign({}, (this.showRecaptcha ? { height: 'auto', padding: '16px 16px 0px 16px' } : { height: '0px' })), class: "recaptcha-container" }, h("slot", { key: 'b3cb909a47adb872390d3afca1c6eefd167d1b01' })), ['data', 'data-loading'].includes(this.state) && this.recaptchaRes && (h("div", { key: '067dacd8f980da721272ffc03a15d6b5740580d9', class: cn('recaptcha-response', !this.recaptchaRes.hasSSC ? 'success-card' : 'reject-card ') }, this.locale.vehicleLookup.warranty[this.recaptchaRes.message])), this.checkingUnauthorizedSSC && (h("div", { key: '36564f7464cea7804439f58397b84d5554e19dd1', class: "loading-spinner", style: { marginTop: '20px', flexDirection: 'column' } }, h("div", { key: '92d1d9d3141f719a67e47e7187e65af814b93aa9' }, h("strong", { key: 'd93a6f157cd67de2fe8c93cf50c84aa6ba143a87' }, this.locale.vehicleLookup.warranty.checkingTMC)), h("img", { key: 'bb95bb4cc9f3d9dd5d1cf0a3f68f4af86a56b6d2', class: "spin", src: Loader }))), this.showSsc && ['data', 'data-loading'].includes(this.state) && ((_d = this.vehicleInformation) === null || _d === void 0 ? void 0 : _d.ssc) !== null && !!((_e = this.vehicleInformation) === null || _e === void 0 ? void 0 : _e.ssc.length) && (h(SSCTable, { key: '02190f90bcf06693545848545013353e99baad12', locale: this.locale, ssc: this.vehicleInformation.ssc })))))));
181
191
  }
182
192
  static get is() { return "warranty-details"; }
183
193
  static get encapsulation() { return "shadow"; }
@@ -211,24 +221,6 @@ export class WarrantyDetails {
211
221
  "reflect": false,
212
222
  "defaultValue": "''"
213
223
  },
214
- "unauthorizedSscLookupBaseUrl": {
215
- "type": "string",
216
- "mutable": false,
217
- "complexType": {
218
- "original": "string",
219
- "resolved": "string",
220
- "references": {}
221
- },
222
- "required": false,
223
- "optional": false,
224
- "docs": {
225
- "tags": [],
226
- "text": ""
227
- },
228
- "attribute": "unauthorized-ssc-lookup-base-url",
229
- "reflect": false,
230
- "defaultValue": "''"
231
- },
232
224
  "isDev": {
233
225
  "type": "boolean",
234
226
  "mutable": false,
@@ -283,7 +275,7 @@ export class WarrantyDetails {
283
275
  "reflect": false,
284
276
  "defaultValue": "''"
285
277
  },
286
- "unauthorizedSscLookupQueryString": {
278
+ "recaptchaKey": {
287
279
  "type": "string",
288
280
  "mutable": false,
289
281
  "complexType": {
@@ -297,17 +289,23 @@ export class WarrantyDetails {
297
289
  "tags": [],
298
290
  "text": ""
299
291
  },
300
- "attribute": "unauthorized-ssc-lookup-query-string",
292
+ "attribute": "recaptcha-key",
301
293
  "reflect": false,
302
294
  "defaultValue": "''"
303
295
  },
304
- "recaptchaKey": {
296
+ "language": {
305
297
  "type": "string",
306
298
  "mutable": false,
307
299
  "complexType": {
308
- "original": "string",
309
- "resolved": "string",
310
- "references": {}
300
+ "original": "LanguageKeys",
301
+ "resolved": "\"ar\" | \"en\" | \"ku\"",
302
+ "references": {
303
+ "LanguageKeys": {
304
+ "location": "import",
305
+ "path": "~types/locales",
306
+ "id": "src/global/types/locales/index.ts::LanguageKeys"
307
+ }
308
+ }
311
309
  },
312
310
  "required": false,
313
311
  "optional": false,
@@ -315,9 +313,9 @@ export class WarrantyDetails {
315
313
  "tags": [],
316
314
  "text": ""
317
315
  },
318
- "attribute": "recaptcha-key",
316
+ "attribute": "language",
319
317
  "reflect": false,
320
- "defaultValue": "''"
318
+ "defaultValue": "'en'"
321
319
  },
322
320
  "showWarranty": {
323
321
  "type": "boolean",
@@ -337,6 +335,42 @@ export class WarrantyDetails {
337
335
  "reflect": false,
338
336
  "defaultValue": "false"
339
337
  },
338
+ "unauthorizedSscLookupBaseUrl": {
339
+ "type": "string",
340
+ "mutable": false,
341
+ "complexType": {
342
+ "original": "string",
343
+ "resolved": "string",
344
+ "references": {}
345
+ },
346
+ "required": false,
347
+ "optional": false,
348
+ "docs": {
349
+ "tags": [],
350
+ "text": ""
351
+ },
352
+ "attribute": "unauthorized-ssc-lookup-base-url",
353
+ "reflect": false,
354
+ "defaultValue": "''"
355
+ },
356
+ "unauthorizedSscLookupQueryString": {
357
+ "type": "string",
358
+ "mutable": false,
359
+ "complexType": {
360
+ "original": "string",
361
+ "resolved": "string",
362
+ "references": {}
363
+ },
364
+ "required": false,
365
+ "optional": false,
366
+ "docs": {
367
+ "tags": [],
368
+ "text": ""
369
+ },
370
+ "attribute": "unauthorized-ssc-lookup-query-string",
371
+ "reflect": false,
372
+ "defaultValue": "''"
373
+ },
340
374
  "cityId": {
341
375
  "type": "string",
342
376
  "mutable": false,
@@ -577,13 +611,14 @@ export class WarrantyDetails {
577
611
  return {
578
612
  "state": {},
579
613
  "externalVin": {},
580
- "errorMessage": {},
581
614
  "showRecaptcha": {},
615
+ "errorMessage": {},
582
616
  "unInvoicedByBrokerName": {},
583
617
  "vehicleInformation": {},
584
618
  "checkingUnauthorizedSSC": {},
585
619
  "recaptchaRes": {},
586
- "headers": {}
620
+ "headers": {},
621
+ "locale": {}
587
622
  };
588
623
  }
589
624
  static get methods() {
@@ -683,6 +718,9 @@ export class WarrantyDetails {
683
718
  static get elementRef() { return "el"; }
684
719
  static get watchers() {
685
720
  return [{
721
+ "propName": "language",
722
+ "methodName": "changeLanguage"
723
+ }, {
686
724
  "propName": "state",
687
725
  "methodName": "loadingListener"
688
726
  }];
@@ -8,7 +8,7 @@ export const getPartInformation = async (component, generalProps, headers = {})
8
8
  const handleResult = (newPartInformation) => {
9
9
  if (networkTimeoutRef === scopedTimeoutRef) {
10
10
  if (!newPartInformation && partNumber)
11
- throw new Error(notAvailableMessage || 'Wrong response format');
11
+ throw new Error(notAvailableMessage || 'wrongResponseFormat');
12
12
  if (loadedResponse)
13
13
  loadedResponse(newPartInformation);
14
14
  if (middlewareCallback)