adp-web-components 0.0.11

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 (196) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/Loading-ee1a2ceb.js +16 -0
  3. package/dist/cjs/app-globals-3813fb46.js +9 -0
  4. package/dist/cjs/cn-f559f9e5.js +2588 -0
  5. package/dist/cjs/dead-stock-lookup.cjs.entry.js +103 -0
  6. package/dist/cjs/distributor-lookup.cjs.entry.js +109 -0
  7. package/dist/cjs/dynamic-claim.cjs.entry.js +306 -0
  8. package/dist/cjs/dynamic-redeem.cjs.entry.js +145 -0
  9. package/dist/cjs/form-input.cjs.entry.js +36 -0
  10. package/dist/cjs/general-inquiry-form.cjs.entry.js +2280 -0
  11. package/dist/cjs/image-expansion-a9c9c6f7.js +77 -0
  12. package/dist/cjs/index-d4b5214c.js +1331 -0
  13. package/dist/cjs/index.cjs.js +6 -0
  14. package/dist/cjs/loader-baf2418b.js +9 -0
  15. package/dist/cjs/loader.cjs.js +19 -0
  16. package/dist/cjs/manufacturer-lookup.cjs.entry.js +109 -0
  17. package/dist/cjs/paint-thickness.cjs.entry.js +131 -0
  18. package/dist/cjs/partInformation-2a6a018b.js +34 -0
  19. package/dist/cjs/service-history.cjs.entry.js +116 -0
  20. package/dist/cjs/shift-components.cjs.js +29 -0
  21. package/dist/cjs/vehicle-accessories.cjs.entry.js +135 -0
  22. package/dist/cjs/vehicle-specification.cjs.entry.js +111 -0
  23. package/dist/cjs/vehicleInformation-4c1dcaf2.js +52 -0
  24. package/dist/cjs/warranty-details.cjs.entry.js +281 -0
  25. package/dist/collection/collection-manifest.json +23 -0
  26. package/dist/collection/components/dynamic-claim/dynamic-claim.css +1 -0
  27. package/dist/collection/components/dynamic-claim/dynamic-claim.js +521 -0
  28. package/dist/collection/components/dynamic-claim/icons/cancelled.svg +8 -0
  29. package/dist/collection/components/dynamic-claim/icons/expired.svg +9 -0
  30. package/dist/collection/components/dynamic-claim/icons/pending.svg +9 -0
  31. package/dist/collection/components/dynamic-claim/icons/processed.svg +9 -0
  32. package/dist/collection/components/dynamic-redeem/dynamic-redeem.css +1 -0
  33. package/dist/collection/components/dynamic-redeem/dynamic-redeem.js +334 -0
  34. package/dist/collection/components/form-input/form-input.css +1 -0
  35. package/dist/collection/components/form-input/form-input.js +209 -0
  36. package/dist/collection/components/general-inquiry-form/general-inquiry-form.css +1 -0
  37. package/dist/collection/components/general-inquiry-form/general-inquiry-form.js +46 -0
  38. package/dist/collection/components/paint-thickness/paint-thickness.css +1 -0
  39. package/dist/collection/components/paint-thickness/paint-thickness.js +323 -0
  40. package/dist/collection/components/part-lookup/dead-stock-lookup.css +1 -0
  41. package/dist/collection/components/part-lookup/dead-stock-lookup.js +294 -0
  42. package/dist/collection/components/part-lookup/distributor-lookup.css +1 -0
  43. package/dist/collection/components/part-lookup/distributor-lookup.js +299 -0
  44. package/dist/collection/components/part-lookup/manufacturer-lookup.css +1 -0
  45. package/dist/collection/components/part-lookup/manufacturer-lookup.js +317 -0
  46. package/dist/collection/components/parts/Loading.js +10 -0
  47. package/dist/collection/components/service-history/service-history.css +1 -0
  48. package/dist/collection/components/service-history/service-history.js +306 -0
  49. package/dist/collection/components/vehicle-accessories/vehicle-accessories.css +1 -0
  50. package/dist/collection/components/vehicle-accessories/vehicle-accessories.js +327 -0
  51. package/dist/collection/components/vehicle-specification/vehicle-specification.css +1 -0
  52. package/dist/collection/components/vehicle-specification/vehicle-specification.js +301 -0
  53. package/dist/collection/components/warranty-details/assets/check.svg +4 -0
  54. package/dist/collection/components/warranty-details/assets/loader.svg +11 -0
  55. package/dist/collection/components/warranty-details/assets/x-mark.svg +4 -0
  56. package/dist/collection/components/warranty-details/components/CardsContainer.js +9 -0
  57. package/dist/collection/components/warranty-details/components/Loading.js +10 -0
  58. package/dist/collection/components/warranty-details/components/SSCTable.js +13 -0
  59. package/dist/collection/components/warranty-details/components/StatusCard.js +11 -0
  60. package/dist/collection/components/warranty-details/warranty-details.css +1 -0
  61. package/dist/collection/components/warranty-details/warranty-details.js +709 -0
  62. package/dist/collection/global/api/partInformation.js +30 -0
  63. package/dist/collection/global/api/vehicleInformation.js +48 -0
  64. package/dist/collection/global/assets/eye.svg +5 -0
  65. package/dist/collection/global/assets/loader.svg +11 -0
  66. package/dist/collection/global/lib/cn.js +9 -0
  67. package/dist/collection/global/lib/form-hook.js +118 -0
  68. package/dist/collection/global/lib/image-expansion.js +69 -0
  69. package/dist/collection/global/lib/utils.js +7 -0
  70. package/dist/collection/global/types/components.js +1 -0
  71. package/dist/collection/global/types/part-information.js +1 -0
  72. package/dist/collection/global/types/vehicle-information.js +5 -0
  73. package/dist/collection/index.js +1 -0
  74. package/dist/collection/templates/mock-data.js +4132 -0
  75. package/dist/collection/templates/parts/mock-data.js +221 -0
  76. package/dist/collection/templates/vehicle-lookup.js +218 -0
  77. package/dist/collection/templates/warranty-mock-data.js +2982 -0
  78. package/dist/components/dead-stock-lookup.d.ts +11 -0
  79. package/dist/components/dead-stock-lookup.js +5 -0
  80. package/dist/components/distributor-lookup.d.ts +11 -0
  81. package/dist/components/distributor-lookup.js +5 -0
  82. package/dist/components/dynamic-claim.d.ts +11 -0
  83. package/dist/components/dynamic-claim.js +5 -0
  84. package/dist/components/dynamic-redeem.d.ts +11 -0
  85. package/dist/components/dynamic-redeem.js +5 -0
  86. package/dist/components/form-input.d.ts +11 -0
  87. package/dist/components/form-input.js +5 -0
  88. package/dist/components/general-inquiry-form.d.ts +11 -0
  89. package/dist/components/general-inquiry-form.js +5 -0
  90. package/dist/components/index.d.ts +33 -0
  91. package/dist/components/index.js +5 -0
  92. package/dist/components/manufacturer-lookup.d.ts +11 -0
  93. package/dist/components/manufacturer-lookup.js +5 -0
  94. package/dist/components/p-2b0cc0c6.js +5 -0
  95. package/dist/components/p-4dc47f5f.js +5 -0
  96. package/dist/components/p-50f73226.js +5 -0
  97. package/dist/components/p-5df9bc5f.js +5 -0
  98. package/dist/components/p-8375923d.js +5 -0
  99. package/dist/components/p-98d9e7ab.js +5 -0
  100. package/dist/components/p-a454210b.js +5 -0
  101. package/dist/components/p-d265c109.js +5 -0
  102. package/dist/components/p-d5ff7544.js +5 -0
  103. package/dist/components/paint-thickness.d.ts +11 -0
  104. package/dist/components/paint-thickness.js +5 -0
  105. package/dist/components/service-history.d.ts +11 -0
  106. package/dist/components/service-history.js +5 -0
  107. package/dist/components/vehicle-accessories.d.ts +11 -0
  108. package/dist/components/vehicle-accessories.js +5 -0
  109. package/dist/components/vehicle-specification.d.ts +11 -0
  110. package/dist/components/vehicle-specification.js +5 -0
  111. package/dist/components/warranty-details.d.ts +11 -0
  112. package/dist/components/warranty-details.js +5 -0
  113. package/dist/esm/Loading-61648252.js +14 -0
  114. package/dist/esm/app-globals-8befa224.js +7 -0
  115. package/dist/esm/cn-cc419b94.js +2586 -0
  116. package/dist/esm/dead-stock-lookup.entry.js +99 -0
  117. package/dist/esm/distributor-lookup.entry.js +105 -0
  118. package/dist/esm/dynamic-claim.entry.js +302 -0
  119. package/dist/esm/dynamic-redeem.entry.js +141 -0
  120. package/dist/esm/form-input.entry.js +32 -0
  121. package/dist/esm/general-inquiry-form.entry.js +2276 -0
  122. package/dist/esm/image-expansion-08c4bf0d.js +73 -0
  123. package/dist/esm/index-ef54644b.js +1302 -0
  124. package/dist/esm/index.js +4 -0
  125. package/dist/esm/loader-027b88af.js +7 -0
  126. package/dist/esm/loader.js +15 -0
  127. package/dist/esm/manufacturer-lookup.entry.js +105 -0
  128. package/dist/esm/paint-thickness.entry.js +127 -0
  129. package/dist/esm/partInformation-73ece994.js +32 -0
  130. package/dist/esm/service-history.entry.js +112 -0
  131. package/dist/esm/shift-components.js +24 -0
  132. package/dist/esm/vehicle-accessories.entry.js +131 -0
  133. package/dist/esm/vehicle-specification.entry.js +107 -0
  134. package/dist/esm/vehicleInformation-f1081f83.js +50 -0
  135. package/dist/esm/warranty-details.entry.js +277 -0
  136. package/dist/index.cjs.js +1 -0
  137. package/dist/index.js +1 -0
  138. package/dist/shift-components/index.esm.js +4 -0
  139. package/dist/shift-components/p-15f86441.entry.js +5 -0
  140. package/dist/shift-components/p-1ae3a61f.entry.js +5 -0
  141. package/dist/shift-components/p-517b3e04.js +5 -0
  142. package/dist/shift-components/p-5df9bc5f.js +5 -0
  143. package/dist/shift-components/p-65e6ab8e.js +5 -0
  144. package/dist/shift-components/p-894e7518.entry.js +5 -0
  145. package/dist/shift-components/p-8c261972.entry.js +5 -0
  146. package/dist/shift-components/p-8e818568.entry.js +5 -0
  147. package/dist/shift-components/p-98d9e7ab.js +5 -0
  148. package/dist/shift-components/p-9bd4471c.entry.js +5 -0
  149. package/dist/shift-components/p-9f790b14.entry.js +5 -0
  150. package/dist/shift-components/p-a21e2e2e.js +5 -0
  151. package/dist/shift-components/p-c113792c.entry.js +5 -0
  152. package/dist/shift-components/p-d265c109.js +5 -0
  153. package/dist/shift-components/p-d5ff7544.js +5 -0
  154. package/dist/shift-components/p-dc9845ed.entry.js +5 -0
  155. package/dist/shift-components/p-e32b0798.entry.js +5 -0
  156. package/dist/shift-components/p-e97316d2.js +6 -0
  157. package/dist/shift-components/p-f759c597.entry.js +5 -0
  158. package/dist/shift-components/p-feb3df85.entry.js +5 -0
  159. package/dist/shift-components/shift-components.esm.js +5 -0
  160. package/dist/types/components/dynamic-claim/dynamic-claim.d.ts +48 -0
  161. package/dist/types/components/dynamic-redeem/dynamic-redeem.d.ts +34 -0
  162. package/dist/types/components/form-input/form-input.d.ts +14 -0
  163. package/dist/types/components/general-inquiry-form/general-inquiry-form.d.ts +21 -0
  164. package/dist/types/components/paint-thickness/paint-thickness.d.ts +28 -0
  165. package/dist/types/components/part-lookup/dead-stock-lookup.d.ts +25 -0
  166. package/dist/types/components/part-lookup/distributor-lookup.d.ts +23 -0
  167. package/dist/types/components/part-lookup/manufacturer-lookup.d.ts +24 -0
  168. package/dist/types/components/parts/Loading.d.ts +5 -0
  169. package/dist/types/components/service-history/service-history.d.ts +23 -0
  170. package/dist/types/components/vehicle-accessories/vehicle-accessories.d.ts +28 -0
  171. package/dist/types/components/vehicle-specification/vehicle-specification.d.ts +22 -0
  172. package/dist/types/components/warranty-details/components/CardsContainer.d.ts +8 -0
  173. package/dist/types/components/warranty-details/components/Loading.d.ts +5 -0
  174. package/dist/types/components/warranty-details/components/SSCTable.d.ts +6 -0
  175. package/dist/types/components/warranty-details/components/StatusCard.d.ts +10 -0
  176. package/dist/types/components/warranty-details/warranty-details.d.ts +51 -0
  177. package/dist/types/components.d.ts +388 -0
  178. package/dist/types/global/api/partInformation.d.ts +19 -0
  179. package/dist/types/global/api/vehicleInformation.d.ts +33 -0
  180. package/dist/types/global/lib/cn.d.ts +2 -0
  181. package/dist/types/global/lib/form-hook.d.ts +54 -0
  182. package/dist/types/global/lib/image-expansion.d.ts +9 -0
  183. package/dist/types/global/lib/utils.d.ts +1 -0
  184. package/dist/types/global/types/components.d.ts +4 -0
  185. package/dist/types/global/types/part-information.d.ts +30 -0
  186. package/dist/types/global/types/vehicle-information.d.ts +162 -0
  187. package/dist/types/index.d.ts +10 -0
  188. package/dist/types/stencil-public-runtime.d.ts +1680 -0
  189. package/loader/cdn.js +5 -0
  190. package/loader/index.cjs.js +5 -0
  191. package/loader/index.d.ts +24 -0
  192. package/loader/index.es2017.js +5 -0
  193. package/loader/index.js +6 -0
  194. package/loader/package.json +11 -0
  195. package/package.json +61 -0
  196. package/readme.md +104 -0
@@ -0,0 +1,221 @@
1
+ const mockData = {
2
+ "T5245160030": {
3
+ "partNumber": "T5245160030",
4
+ "tmcPart": {
5
+ "partDescription": "GUARD, RR BUMPER ",
6
+ "group": "C"
7
+ },
8
+ "stockParts": [
9
+ {
10
+ "partDescription": "GUARD, RR BUMPER",
11
+ "supersededTo": " ",
12
+ "supersededFrom": " ",
13
+ "quantityLookUpResult": "LookupIsSkipped",
14
+ "price": 122.27,
15
+ "group": "C",
16
+ "locationID": "1-1",
17
+ "locationName": "Location #1"
18
+ },
19
+ {
20
+ "partDescription": "GUARD, RR BUMPER",
21
+ "supersededTo": " ",
22
+ "supersededFrom": " ",
23
+ "quantityLookUpResult": "LookupIsSkipped",
24
+ "price": 122.27,
25
+ "group": "C",
26
+ "locationID": "2-2",
27
+ "locationName": "Location #2"
28
+ },
29
+ {
30
+ "partDescription": "GUARD, RR BUMPER",
31
+ "supersededTo": " ",
32
+ "supersededFrom": " ",
33
+ "quantityLookUpResult": "LookupIsSkipped",
34
+ "price": 122.27,
35
+ "group": "C",
36
+ "locationID": "3-3",
37
+ "locationName": "Location #3"
38
+ }
39
+ ],
40
+ "deadStock": [
41
+ {
42
+ "companyIntegrationID": "1",
43
+ "companyName": "Dealer 1",
44
+ "branchDeadStock": [
45
+ {
46
+ "companyBranchIntegrationID": "4",
47
+ "companyBranchName": "Location #1",
48
+ "quantity": 10
49
+ },
50
+ {
51
+ "companyBranchIntegrationID": "2",
52
+ "companyBranchName": "Location #2",
53
+ "quantity": 2
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "companyIntegrationID": "2",
59
+ "companyName": "Dealer 2",
60
+ "branchDeadStock": [
61
+ {
62
+ "companyBranchIntegrationID": "5",
63
+ "companyBranchName": "Location #3",
64
+ "quantity": 6
65
+ },
66
+ {
67
+ "companyBranchIntegrationID": "9",
68
+ "companyBranchName": "Location #5",
69
+ "quantity": 5
70
+ }
71
+ ]
72
+ }
73
+ ]
74
+ },
75
+ "T5245160030/1": {
76
+ "partNumber": "T5245160030",
77
+ "tmcPart": {
78
+ "partDescription": "GUARD, RR BUMPER ",
79
+ "group": "C"
80
+ },
81
+ "stockParts": [
82
+ {
83
+ "partDescription": "GUARD, RR BUMPER",
84
+ "supersededTo": " ",
85
+ "supersededFrom": " ",
86
+ "quantityLookUpResult": "NotAvailable",
87
+ "price": 122.27,
88
+ "group": "C",
89
+ "locationID": "1-1",
90
+ "locationName": "Location #1"
91
+ },
92
+ {
93
+ "partDescription": "GUARD, RR BUMPER",
94
+ "supersededTo": " ",
95
+ "supersededFrom": " ",
96
+ "quantityLookUpResult": "PartiallyAvailable",
97
+ "price": 122.27,
98
+ "group": "C",
99
+ "locationID": "2-2",
100
+ "locationName": "Location #2"
101
+ },
102
+ {
103
+ "partDescription": "GUARD, RR BUMPER",
104
+ "supersededTo": " ",
105
+ "supersededFrom": " ",
106
+ "quantityLookUpResult": "Available",
107
+ "price": 122.27,
108
+ "group": "C",
109
+ "locationID": "3-3",
110
+ "locationName": "Location #3"
111
+ }
112
+ ],
113
+ "deadStock": [
114
+ {
115
+ "companyIntegrationID": "1",
116
+ "companyName": "Dealer 1",
117
+ "branchDeadStock": [
118
+ {
119
+ "companyBranchIntegrationID": "4",
120
+ "companyBranchName": "Location #1",
121
+ "quantity": 10
122
+ },
123
+ {
124
+ "companyBranchIntegrationID": "2",
125
+ "companyBranchName": "Location #2",
126
+ "quantity": 2
127
+ }
128
+ ]
129
+ },
130
+ {
131
+ "companyIntegrationID": "2",
132
+ "companyName": "Dealer 2",
133
+ "branchDeadStock": [
134
+ {
135
+ "companyBranchIntegrationID": "5",
136
+ "companyBranchName": "Location #3",
137
+ "quantity": 6
138
+ },
139
+ {
140
+ "companyBranchIntegrationID": "9",
141
+ "companyBranchName": "Location #5",
142
+ "quantity": 5
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ },
148
+ "T5245160030/11": {
149
+ "partNumber": "T5245160030",
150
+ "tmcPart": {
151
+ "partDescription": "GUARD, RR BUMPER ",
152
+ "group": "C"
153
+ },
154
+ "stockParts": [
155
+ {
156
+ "partDescription": "GUARD, RR BUMPER",
157
+ "supersededTo": " ",
158
+ "supersededFrom": " ",
159
+ "quantityLookUpResult": "QuantityNotWithinLookupThreshold",
160
+ "price": 122.27,
161
+ "group": "C",
162
+ "locationID": "1-1",
163
+ "locationName": "Location #1"
164
+ },
165
+ {
166
+ "partDescription": "GUARD, RR BUMPER",
167
+ "supersededTo": " ",
168
+ "supersededFrom": " ",
169
+ "quantityLookUpResult": "QuantityNotWithinLookupThreshold",
170
+ "price": 122.27,
171
+ "group": "C",
172
+ "locationID": "2-2",
173
+ "locationName": "Location #2"
174
+ },
175
+ {
176
+ "partDescription": "GUARD, RR BUMPER",
177
+ "supersededTo": " ",
178
+ "supersededFrom": " ",
179
+ "quantityLookUpResult": "QuantityNotWithinLookupThreshold",
180
+ "price": 122.27,
181
+ "group": "C",
182
+ "locationID": "3-3",
183
+ "locationName": "Location #3"
184
+ }
185
+ ],
186
+ "deadStock": [
187
+ {
188
+ "companyIntegrationID": "1",
189
+ "companyName": "Dealer 1",
190
+ "branchDeadStock": [
191
+ {
192
+ "companyBranchIntegrationID": "4",
193
+ "companyBranchName": "Location #1",
194
+ "quantity": 10
195
+ },
196
+ {
197
+ "companyBranchIntegrationID": "2",
198
+ "companyBranchName": "Location #2",
199
+ "quantity": 2
200
+ }
201
+ ]
202
+ },
203
+ {
204
+ "companyIntegrationID": "2",
205
+ "companyName": "Dealer 2",
206
+ "branchDeadStock": [
207
+ {
208
+ "companyBranchIntegrationID": "5",
209
+ "companyBranchName": "Location #3",
210
+ "quantity": 6
211
+ },
212
+ {
213
+ "companyBranchIntegrationID": "9",
214
+ "companyBranchName": "Location #5",
215
+ "quantity": 5
216
+ }
217
+ ]
218
+ }
219
+ ]
220
+ },
221
+ };
@@ -0,0 +1,218 @@
1
+ const vehicleSpecification = document.getElementById('vehicle-specification');
2
+ const vehicleAccessories = document.getElementById('vehicle-accessories');
3
+ const warranty = document.getElementById('warranty');
4
+ const serviceHistory = document.getElementById('service-history');
5
+ const paintThickness = document.getElementById('paint-thickness');
6
+ const dynamicClaim = document.getElementById('dynamic-claim');
7
+
8
+ const componentsList = [vehicleSpecification, warranty, serviceHistory, dynamicClaim, paintThickness, vehicleAccessories];
9
+
10
+ const input = document.getElementById('vinInput');
11
+ const error = document.getElementsByClassName('error-message')[0];
12
+ const searchIcon = document.getElementById('search-icon');
13
+ const spinnerIcon = document.getElementById('spinner-icon');
14
+ const searchText = document.getElementById('search-text');
15
+ const searchButton = document.getElementById('search-button');
16
+
17
+ const franchiseSelector = document.getElementById('franchise-selector');
18
+ const franchiseSelectorError = document.getElementById('franchise-selector-error-message');
19
+
20
+ var lastLookupResult = null;
21
+
22
+ function handleLoadingState(isLoading) {
23
+ if (isLoading) {
24
+ $("li:not('.active')").addClass('disabled');
25
+
26
+ searchIcon.style.display = 'none';
27
+ spinnerIcon.style.display = 'inline-block';
28
+ searchText.innerHTML = 'Searching...';
29
+ input.readOnly = true;
30
+ input.classList.add('disabled');
31
+ } else {
32
+ $("li:not('.active')").removeClass('disabled');
33
+ searchIcon.style.display = 'inline-block';
34
+ spinnerIcon.style.display = 'none';
35
+ searchText.innerHTML = 'Search';
36
+ input.readOnly = false;
37
+ input.classList.remove('disabled');
38
+ searching = false;
39
+ }
40
+ }
41
+
42
+ function handleLoadData(newResponse, activeElement) {
43
+ componentsList.forEach(element => {
44
+ if (element !== null && element !== activeElement && newResponse) element.setData(newResponse);
45
+ });
46
+ }
47
+
48
+ document.onreadystatechange = function (e) {
49
+ $('#vehicle-info-tab a').click(function (e) {
50
+ e.preventDefault();
51
+ $(this).tab('show');
52
+ });
53
+
54
+ $('#search-button').click(function () {
55
+ search();
56
+ });
57
+
58
+ componentsList.forEach(element => {
59
+ if (element === null) return;
60
+
61
+ element.loadingStateChange = handleLoadingState;
62
+ element.loadedResponse = newResponse => handleLoadData(newResponse, element);
63
+ });
64
+
65
+ $(input).keydown(function (e) {
66
+ if (e.keyCode == 13) {
67
+ e.preventDefault();
68
+ search();
69
+ }
70
+ });
71
+ };
72
+
73
+ var searching = false;
74
+ function search() {
75
+ if (searching) return;
76
+
77
+ searching = true;
78
+
79
+ input.classList.remove('error_bg');
80
+ error.innerHTML = '';
81
+
82
+ if (franchiseSelector) {
83
+ franchiseSelector.classList.remove('error_bg');
84
+
85
+ franchiseSelectorError.innerHTML = '';
86
+ }
87
+
88
+ var vin = input.value;
89
+
90
+ if (vin == '') {
91
+ input.classList.add('error_bg');
92
+
93
+ error.innerHTML = 'VIN is required';
94
+
95
+ searching = false;
96
+
97
+ return;
98
+ }
99
+
100
+ if (!validateVin(vin)) {
101
+ input.classList.add('error_bg');
102
+
103
+ error.innerHTML = 'Invalid VIN';
104
+
105
+ searching = false;
106
+
107
+ return;
108
+ }
109
+
110
+ if (franchiseSelector) {
111
+ var franchise = franchiseSelector.value;
112
+
113
+ warranty.setAttribute('brand-integration-id', franchise);
114
+
115
+ if (franchise == '') {
116
+ franchiseSelector.classList.add('error_bg');
117
+
118
+ franchiseSelectorError.innerHTML = 'Please Select';
119
+
120
+ searching = false;
121
+
122
+ return;
123
+ }
124
+ }
125
+
126
+ if ($(vehicleSpecification).is(':visible')) {
127
+ vehicleSpecification.fetchData(vin);
128
+ }
129
+ if ($(warranty).is(':visible')) {
130
+ warranty.fetchData(vin);
131
+ }
132
+ if ($(serviceHistory).is(':visible')) {
133
+ serviceHistory.fetchData(vin);
134
+ }
135
+ if ($(dynamicClaim).is(':visible')) {
136
+ dynamicClaim.fetchData(vin);
137
+ }
138
+ if ($(paintThickness).is(':visible')) {
139
+ paintThickness.fetchData(vin);
140
+ }
141
+ if ($(vehicleAccessories).is(':visible')) {
142
+ vehicleAccessories.fetchData(vin);
143
+ }
144
+ }
145
+
146
+ function validateVin(vin) {
147
+ var TransliterationTable = {
148
+ 0: 0,
149
+ 1: 1,
150
+ 2: 2,
151
+ 3: 3,
152
+ 4: 4,
153
+ 5: 5,
154
+ 6: 6,
155
+ 7: 7,
156
+ 8: 8,
157
+ 9: 9,
158
+
159
+ A: 1,
160
+ B: 2,
161
+ C: 3,
162
+ D: 4,
163
+ E: 5,
164
+ F: 6,
165
+ G: 7,
166
+ H: 8,
167
+
168
+ J: 1,
169
+ K: 2,
170
+ L: 3,
171
+ M: 4,
172
+ N: 5,
173
+ P: 7,
174
+ R: 9,
175
+
176
+ S: 2,
177
+ T: 3,
178
+ U: 4,
179
+ V: 5,
180
+ W: 6,
181
+ X: 7,
182
+ Y: 8,
183
+ Z: 9,
184
+ };
185
+
186
+ var WeightTable = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2];
187
+
188
+ var sum = 0;
189
+
190
+ var valid = true;
191
+
192
+ for (var i = 0; i < vin.length; i++) {
193
+ var char = vin[i].toUpperCase();
194
+
195
+ var value = TransliterationTable[char];
196
+
197
+ if (value === undefined) {
198
+ valid = false;
199
+ break;
200
+ }
201
+
202
+ var weight = WeightTable[i];
203
+
204
+ var product = value * weight;
205
+
206
+ sum = sum + product;
207
+ }
208
+
209
+ var reminder = (sum % 11).toString();
210
+
211
+ if (reminder === '10') reminder = 'X';
212
+
213
+ if (vin[8] != reminder) {
214
+ valid = false;
215
+ }
216
+
217
+ return valid;
218
+ }