@flarehr/apollo-benefits 0.1.109 → 0.3.53396

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 (216) hide show
  1. package/README.md +19 -0
  2. package/dist/assets/@splitsoftware-7d799540.js +18 -0
  3. package/dist/assets/all_tab_color-548783b9.svg +21 -0
  4. package/dist/assets/all_tab_gray-a5051313.svg +6 -0
  5. package/dist/assets/check-57fe1dcb.svg +15 -0
  6. package/dist/assets/datadog-c7ede347.js +5 -0
  7. package/dist/assets/date-fns-c5d8fbc0.js +1 -0
  8. package/dist/assets/default_backdrop-fdd955b8.png +0 -0
  9. package/dist/assets/external_link-599a0aec.svg +3 -0
  10. package/dist/assets/external_link_white-55111b2e.svg +3 -0
  11. package/dist/assets/framer-motion-bb8d6b82.js +1 -0
  12. package/dist/assets/index-87923fdc.js +35 -0
  13. package/dist/assets/index-cfa25e28.css +1 -0
  14. package/dist/assets/index-ee9d2045.js +5 -0
  15. package/dist/assets/lodash-5d893f8c.js +1 -0
  16. package/dist/assets/logo-a34e9b4b.png +0 -0
  17. package/dist/assets/oidc-client-6f6e47c2.js +101 -0
  18. package/dist/assets/padlock-8c081120.svg +26 -0
  19. package/dist/assets/suitcase-6471ad05.svg +17 -0
  20. package/dist/assets/vendor-2d0139ca.js +788 -0
  21. package/dist/assets/warning-a7f1af23.svg +14 -0
  22. package/dist/assets/welcome_image_mobile-dbde6c80.png +0 -0
  23. package/dist/assets/welcome_image_v2-869c59e4.png +0 -0
  24. package/dist/assets/wellbeing_banner-6903d615.png +0 -0
  25. package/dist/assets/workplace_link_banner_mobile-6ebaa24b.png +0 -0
  26. package/dist/assets/workplace_link_banner_v2-c81ed849.png +0 -0
  27. package/dist/config.json +14 -0
  28. package/dist/favicon.ico +0 -0
  29. package/dist/icons/android-chrome-192x192.png +0 -0
  30. package/dist/icons/android-chrome-512x512.png +0 -0
  31. package/dist/icons/apple-touch-icon.png +0 -0
  32. package/dist/icons/favicon-16x16.png +0 -0
  33. package/dist/icons/favicon-32x32.png +0 -0
  34. package/dist/index.html +114 -0
  35. package/dist/manifest.json +21 -0
  36. package/dist/sw-esm.js +16 -0
  37. package/package.json +129 -60
  38. package/LICENSE +0 -21
  39. package/dist/lib/apollo-benefits/apollo-benefits.esm.js +0 -1
  40. package/dist/lib/apollo-benefits/assets/car-placeholder.svg +0 -5
  41. package/dist/lib/apollo-benefits/assets/check.svg +0 -13
  42. package/dist/lib/apollo-benefits/index.esm.js +0 -0
  43. package/dist/lib/apollo-benefits/p-06a1f65f.js +0 -1
  44. package/dist/lib/apollo-benefits/p-077d7f8d.entry.js +0 -1
  45. package/dist/lib/apollo-benefits/p-14054f15.js +0 -1
  46. package/dist/lib/apollo-benefits/p-24a37d64.js +0 -1
  47. package/dist/lib/apollo-benefits/p-2b3f3b72.entry.js +0 -1
  48. package/dist/lib/apollo-benefits/p-3111d565.entry.js +0 -1
  49. package/dist/lib/apollo-benefits/p-327396fa.entry.js +0 -1
  50. package/dist/lib/apollo-benefits/p-3d4d2683.js +0 -1
  51. package/dist/lib/apollo-benefits/p-4474bcf8.entry.js +0 -1
  52. package/dist/lib/apollo-benefits/p-4bff99bd.entry.js +0 -1
  53. package/dist/lib/apollo-benefits/p-50fe790f.js +0 -1
  54. package/dist/lib/apollo-benefits/p-53bcbd1d.js +0 -1
  55. package/dist/lib/apollo-benefits/p-68c136da.js +0 -1
  56. package/dist/lib/apollo-benefits/p-6bd16f5b.js +0 -1
  57. package/dist/lib/apollo-benefits/p-71dbc8ff.entry.js +0 -1
  58. package/dist/lib/apollo-benefits/p-774d9bc5.entry.js +0 -1
  59. package/dist/lib/apollo-benefits/p-7a2ca86d.entry.js +0 -1
  60. package/dist/lib/apollo-benefits/p-7a572b50.js +0 -1
  61. package/dist/lib/apollo-benefits/p-7c2cd94a.entry.js +0 -1
  62. package/dist/lib/apollo-benefits/p-839493d7.entry.js +0 -1
  63. package/dist/lib/apollo-benefits/p-a24d169b.entry.js +0 -1
  64. package/dist/lib/apollo-benefits/p-b33fc683.js +0 -1
  65. package/dist/lib/apollo-benefits/p-beb8f728.entry.js +0 -1
  66. package/dist/lib/apollo-benefits/p-e241f55b.entry.js +0 -1
  67. package/dist/lib/apollo-benefits/p-e28cee25.js +0 -1
  68. package/dist/lib/apollo-benefits/p-e3cf51f1.entry.js +0 -1
  69. package/dist/lib/apollo-benefits/p-ef8ea713.entry.js +0 -1
  70. package/dist/lib/apollo-benefits/p-f0a7c9fa.entry.js +0 -1
  71. package/dist/lib/apollo-benefits/p-f603197d.js +0 -15
  72. package/dist/lib/cjs/active-router-0ecaf2b8.js +0 -75
  73. package/dist/lib/cjs/ap-ben-choose-vehicle-section_4.cjs.entry.js +0 -2708
  74. package/dist/lib/cjs/ap-ben-complete-section_4.cjs.entry.js +0 -108
  75. package/dist/lib/cjs/ap-ben-notifications-section.cjs.entry.js +0 -238
  76. package/dist/lib/cjs/apollo-benefits.cjs.js +0 -25
  77. package/dist/lib/cjs/app-globals-67583b8b.js +0 -12
  78. package/dist/lib/cjs/async-6a7926f0.js +0 -753
  79. package/dist/lib/cjs/cars-calculator-app.cjs.entry.js +0 -55
  80. package/dist/lib/cjs/cars-calculator.service-c0e51584.js +0 -904
  81. package/dist/lib/cjs/context-consumer.cjs.entry.js +0 -29
  82. package/dist/lib/cjs/datorama-akita-31d23240.js +0 -2551
  83. package/dist/lib/cjs/delay-d31618c3.js +0 -206
  84. package/dist/lib/cjs/distinctUntilChanged-e8538790.js +0 -371
  85. package/dist/lib/cjs/dom-utils-b8befdd5.js +0 -63
  86. package/dist/lib/cjs/fl-button_2.cjs.entry.js +0 -50
  87. package/dist/lib/cjs/fl-dropdown-async_2.cjs.entry.js +0 -467
  88. package/dist/lib/cjs/fl-dropdown.cjs.entry.js +0 -232
  89. package/dist/lib/cjs/fl-style-guide.cjs.entry.js +0 -91
  90. package/dist/lib/cjs/index-f1fadf90.js +0 -1735
  91. package/dist/lib/cjs/index.cjs.js +0 -2
  92. package/dist/lib/cjs/loader.cjs.js +0 -27
  93. package/dist/lib/cjs/location-utils-36fe7e5e.js +0 -237
  94. package/dist/lib/cjs/match-path-be4ea5f6.js +0 -279
  95. package/dist/lib/cjs/session.query-d61ba7ec.js +0 -1731
  96. package/dist/lib/cjs/stencil-async-content.cjs.entry.js +0 -32
  97. package/dist/lib/cjs/stencil-route-link.cjs.entry.js +0 -78
  98. package/dist/lib/cjs/stencil-route-switch.cjs.entry.js +0 -104
  99. package/dist/lib/cjs/stencil-route-title.cjs.entry.js +0 -32
  100. package/dist/lib/cjs/stencil-route.cjs.entry.js +0 -97
  101. package/dist/lib/cjs/stencil-router-prompt.cjs.entry.js +0 -59
  102. package/dist/lib/cjs/stencil-router-redirect.cjs.entry.js +0 -32
  103. package/dist/lib/cjs/stencil-router.cjs.entry.js +0 -640
  104. package/dist/lib/collection/assets/image/complete.svg +0 -122
  105. package/dist/lib/collection/collection-manifest.json +0 -53
  106. package/dist/lib/collection/components/cars-calculator-app/api/api-client.js +0 -5
  107. package/dist/lib/collection/components/cars-calculator-app/api/cars-calculator.api.js +0 -45
  108. package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.css +0 -22
  109. package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.js +0 -97
  110. package/dist/lib/collection/components/cars-calculator-app/modal-section/modal-section.css +0 -0
  111. package/dist/lib/collection/components/cars-calculator-app/modal-section/modal-section.js +0 -144
  112. package/dist/lib/collection/components/cars-calculator-app/notifications-section/notifications-section.js +0 -25
  113. package/dist/lib/collection/components/cars-calculator-app/pages/assets/car-placeholder.svg +0 -5
  114. package/dist/lib/collection/components/cars-calculator-app/pages/assets/check.svg +0 -13
  115. package/dist/lib/collection/components/cars-calculator-app/pages/choose-vehicle-section.component.js +0 -196
  116. package/dist/lib/collection/components/cars-calculator-app/pages/complete-section.component.js +0 -38
  117. package/dist/lib/collection/components/cars-calculator-app/pages/cost-breakdown-section.component.js +0 -45
  118. package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.css +0 -34
  119. package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.js +0 -85
  120. package/dist/lib/collection/components/cars-calculator-app/pages/personal-info-section.component.js +0 -66
  121. package/dist/lib/collection/components/cars-calculator-app/pages/quote-result-section.component.js +0 -86
  122. package/dist/lib/collection/components/cars-calculator-app/pages/submit-quote-section.component.js +0 -75
  123. package/dist/lib/collection/components/cars-calculator-app/services/app-configuration.service.js +0 -13
  124. package/dist/lib/collection/components/cars-calculator-app/services/cars-calculator.service.js +0 -106
  125. package/dist/lib/collection/components/cars-calculator-app/services/notifications.service.js +0 -37
  126. package/dist/lib/collection/components/cars-calculator-app/services/notifications.store.js +0 -3
  127. package/dist/lib/collection/components/cars-calculator-app/services/session.query.js +0 -35
  128. package/dist/lib/collection/components/cars-calculator-app/services/session.store.js +0 -78
  129. package/dist/lib/collection/global/config.js +0 -2
  130. package/dist/lib/collection/global/main.dev.js +0 -5
  131. package/dist/lib/collection/global/main.js +0 -5
  132. package/dist/lib/collection/index.js +0 -2
  133. package/dist/lib/collection/utils/config.js +0 -2
  134. package/dist/lib/collection/utils/index.js +0 -15
  135. package/dist/lib/collection/utils/lazy.js +0 -29
  136. package/dist/lib/esm/active-router-7c2ca849.js +0 -73
  137. package/dist/lib/esm/ap-ben-choose-vehicle-section_4.entry.js +0 -2701
  138. package/dist/lib/esm/ap-ben-complete-section_4.entry.js +0 -101
  139. package/dist/lib/esm/ap-ben-notifications-section.entry.js +0 -234
  140. package/dist/lib/esm/apollo-benefits.js +0 -23
  141. package/dist/lib/esm/app-globals-65714cca.js +0 -10
  142. package/dist/lib/esm/async-68e9cad7.js +0 -738
  143. package/dist/lib/esm/cars-calculator-app.entry.js +0 -51
  144. package/dist/lib/esm/cars-calculator.service-27826530.js +0 -897
  145. package/dist/lib/esm/context-consumer.entry.js +0 -25
  146. package/dist/lib/esm/datorama-akita-c87196a0.js +0 -2545
  147. package/dist/lib/esm/delay-115d4292.js +0 -200
  148. package/dist/lib/esm/distinctUntilChanged-bf69e0f8.js +0 -363
  149. package/dist/lib/esm/dom-utils-109a7d75.js +0 -55
  150. package/dist/lib/esm/fl-button_2.entry.js +0 -45
  151. package/dist/lib/esm/fl-dropdown-async_2.entry.js +0 -462
  152. package/dist/lib/esm/fl-dropdown.entry.js +0 -228
  153. package/dist/lib/esm/fl-style-guide.entry.js +0 -87
  154. package/dist/lib/esm/index-19c4d245.js +0 -1703
  155. package/dist/lib/esm/index.js +0 -1
  156. package/dist/lib/esm/loader.js +0 -23
  157. package/dist/lib/esm/location-utils-312665d3.js +0 -226
  158. package/dist/lib/esm/match-path-4b5c7d98.js +0 -276
  159. package/dist/lib/esm/polyfills/core-js.js +0 -11
  160. package/dist/lib/esm/polyfills/css-shim.js +0 -1
  161. package/dist/lib/esm/polyfills/dom.js +0 -79
  162. package/dist/lib/esm/polyfills/es5-html-element.js +0 -1
  163. package/dist/lib/esm/polyfills/index.js +0 -34
  164. package/dist/lib/esm/polyfills/system.js +0 -6
  165. package/dist/lib/esm/session.query-0f1c9503.js +0 -1719
  166. package/dist/lib/esm/stencil-async-content.entry.js +0 -28
  167. package/dist/lib/esm/stencil-route-link.entry.js +0 -74
  168. package/dist/lib/esm/stencil-route-switch.entry.js +0 -100
  169. package/dist/lib/esm/stencil-route-title.entry.js +0 -28
  170. package/dist/lib/esm/stencil-route.entry.js +0 -93
  171. package/dist/lib/esm/stencil-router-prompt.entry.js +0 -55
  172. package/dist/lib/esm/stencil-router-redirect.entry.js +0 -28
  173. package/dist/lib/esm/stencil-router.entry.js +0 -636
  174. package/dist/lib/index.cjs.js +0 -1
  175. package/dist/lib/index.js +0 -1
  176. package/dist/lib/loader/cdn.js +0 -3
  177. package/dist/lib/loader/index.cjs.js +0 -3
  178. package/dist/lib/loader/index.d.ts +0 -13
  179. package/dist/lib/loader/index.es2017.js +0 -3
  180. package/dist/lib/loader/index.js +0 -4
  181. package/dist/lib/loader/package.json +0 -10
  182. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/button/button.css +0 -45
  183. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown/dropdown.css +0 -9
  184. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown-async/dropdown-async.css +0 -9
  185. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/loading-indicator/loading-indicator.css +0 -141
  186. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/promise-button/promise-button.css +0 -5
  187. package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/style-guide/style-guide.css +0 -0
  188. package/dist/lib/node_modules/@stencil/router/dist/collection/components/route/route.css +0 -3
  189. package/dist/lib/types/components/cars-calculator-app/api/api-client.d.ts +0 -2
  190. package/dist/lib/types/components/cars-calculator-app/api/cars-calculator.api.d.ts +0 -99
  191. package/dist/lib/types/components/cars-calculator-app/cars-calculator-app.d.ts +0 -17
  192. package/dist/lib/types/components/cars-calculator-app/modal-section/modal-section.d.ts +0 -16
  193. package/dist/lib/types/components/cars-calculator-app/notifications-section/notifications-section.d.ts +0 -5
  194. package/dist/lib/types/components/cars-calculator-app/pages/choose-vehicle-section.component.d.ts +0 -23
  195. package/dist/lib/types/components/cars-calculator-app/pages/complete-section.component.d.ts +0 -5
  196. package/dist/lib/types/components/cars-calculator-app/pages/cost-breakdown-section.component.d.ts +0 -6
  197. package/dist/lib/types/components/cars-calculator-app/pages/model-variants-section.component.d.ts +0 -12
  198. package/dist/lib/types/components/cars-calculator-app/pages/personal-info-section.component.d.ts +0 -10
  199. package/dist/lib/types/components/cars-calculator-app/pages/quote-result-section.component.d.ts +0 -13
  200. package/dist/lib/types/components/cars-calculator-app/pages/submit-quote-section.component.d.ts +0 -10
  201. package/dist/lib/types/components/cars-calculator-app/services/app-configuration.service.d.ts +0 -7
  202. package/dist/lib/types/components/cars-calculator-app/services/cars-calculator.service.d.ts +0 -11
  203. package/dist/lib/types/components/cars-calculator-app/services/notifications.service.d.ts +0 -15
  204. package/dist/lib/types/components/cars-calculator-app/services/notifications.store.d.ts +0 -14
  205. package/dist/lib/types/components/cars-calculator-app/services/session.query.d.ts +0 -25
  206. package/dist/lib/types/components/cars-calculator-app/services/session.store.d.ts +0 -77
  207. package/dist/lib/types/components.d.ts +0 -170
  208. package/dist/lib/types/global/config.d.ts +0 -2
  209. package/dist/lib/types/global/main.d.ts +0 -1
  210. package/dist/lib/types/global/main.dev.d.ts +0 -1
  211. package/dist/lib/types/index.d.ts +0 -2
  212. package/dist/lib/types/stencil-public-runtime.d.ts +0 -1555
  213. package/dist/lib/types/utils/config.d.ts +0 -2
  214. package/dist/lib/types/utils/index.d.ts +0 -7
  215. package/dist/lib/types/utils/lazy.d.ts +0 -12
  216. package/readme.md +0 -1
@@ -1,106 +0,0 @@
1
- import * as O from 'fp-ts/Option';
2
- import { getOrError } from '../../../utils';
3
- import carsCalculatorApi from '../api/cars-calculator.api';
4
- import sessionQuery from './session.query';
5
- import sessionStore from './session.store';
6
- export class CarsCalculatorService {
7
- constructor() {
8
- sessionQuery
9
- .select(['user', 'vehicle'])
10
- .subscribe((state) => this.attemptQuoteCalculationAsync(state.user, state.vehicle));
11
- }
12
- selectVariant(variant) {
13
- sessionStore.update((state) => ({
14
- vehicle: Object.assign(Object.assign({}, state.vehicle), { selectedVariant: variant })
15
- }));
16
- }
17
- generateCarsEnquiryRequest() {
18
- const vehicle = sessionQuery.vehicle;
19
- const variant = getOrError(vehicle.selectedVariant);
20
- const result = sessionQuery.result;
21
- const details = sessionQuery.userDetails;
22
- return {
23
- chosenVariant: {
24
- variant_id: variant.variantId,
25
- short_description: variant.description,
26
- build_year: variant.buildYear,
27
- model_month: variant.modelMonth,
28
- list_price_gross: variant.listPriceGross,
29
- engine_litres: variant.engineLitres,
30
- fuel_type_translation_id: variant.fuelTypeId,
31
- transmission: variant.transmission
32
- },
33
- websiteQuote: {
34
- afterTaxEffectPerPayCycle: getOrError(result.afterTaxEffectPerPayCycle),
35
- totalTaxSavings: getOrError(result.taxSaving),
36
- residualValueGross: getOrError(result.residualValue),
37
- financedAmount: getOrError(result.financedAmount),
38
- fuel: getOrError(result.fuel),
39
- serviceAndMaintenance: getOrError(result.serviceAndMaintenance),
40
- registrationAndCtp: getOrError(result.registrationAndCtp),
41
- comprehensiveInsurance: getOrError(result.comprehensiveInsurance),
42
- managementFee: getOrError(result.managementFee)
43
- },
44
- contactDetails: {
45
- firstName: getOrError(details.userFirstName),
46
- lastName: getOrError(details.userLastName),
47
- email: getOrError(details.emailAddress),
48
- mobileNumber: getOrError(details.contactNumber),
49
- employerName: getOrError(details.employerName)
50
- }
51
- };
52
- }
53
- async attemptQuoteCalculationAsync(user, vehicle) {
54
- const isAllInformationAvailable = O.isSome(user.annualKms) &&
55
- O.isSome(user.annualSalary) &&
56
- O.isSome(user.paymentPeriod) &&
57
- O.isSome(user.state) &&
58
- O.isSome(user.term) &&
59
- O.isSome(vehicle.selectedVariant);
60
- if (!isAllInformationAvailable) {
61
- return;
62
- }
63
- sessionStore.updateQuote({
64
- afterTaxEffectPerPayCycle: O.none,
65
- taxSaving: O.none,
66
- residualValue: O.none,
67
- financedAmount: O.none,
68
- fuel: O.none,
69
- serviceAndMaintenance: O.none,
70
- registrationAndCtp: O.none,
71
- comprehensiveInsurance: O.none,
72
- managementFee: O.none,
73
- quoteState: 'Calculation pending'
74
- });
75
- const variant = getOrError(vehicle.selectedVariant);
76
- const isUsedCarRequested = getOrError(vehicle.isUsedCarRequested);
77
- const price = isUsedCarRequested
78
- ? getOrError(vehicle.approximatePrice)
79
- : variant.listPriceGross;
80
- const req = {
81
- variantId: variant.variantId,
82
- isUsedCarRequested: getOrError(vehicle.isUsedCarRequested),
83
- approximatePrice: price,
84
- annualSalaryGross: getOrError(user.annualSalary),
85
- payPeriod: getOrError(user.paymentPeriod),
86
- annualKm: getOrError(user.annualKms),
87
- state: getOrError(user.state),
88
- leaseTermInYears: getOrError(user.term)
89
- };
90
- const response = await carsCalculatorApi.postCarsQuoteResult(req);
91
- const quoteResult = {
92
- afterTaxEffectPerPayCycle: O.some(response.afterTaxEffectPerPayCycle),
93
- taxSaving: O.some(response.totalTaxSavings),
94
- residualValue: O.some(response.residualValueGross),
95
- financedAmount: O.some(response.financedAmount),
96
- fuel: O.some(response.fuel),
97
- serviceAndMaintenance: O.some(response.serviceAndMaintenance),
98
- registrationAndCtp: O.some(response.registrationAndCtp),
99
- comprehensiveInsurance: O.some(response.comprehensiveInsurance),
100
- managementFee: O.some(response.managementFee),
101
- quoteState: 'Calculated'
102
- };
103
- sessionStore.updateQuote(quoteResult);
104
- }
105
- }
106
- export default new CarsCalculatorService();
@@ -1,37 +0,0 @@
1
- import { createStore } from '@stencil/store';
2
- import { initialState } from './notifications.store';
3
- class NotificationsService {
4
- constructor() {
5
- const { state } = createStore(initialState);
6
- this._state = state;
7
- }
8
- get state() {
9
- return this._state;
10
- }
11
- closeCurrent() {
12
- const items = [...this._state.items];
13
- items.shift();
14
- this._state.items = items;
15
- }
16
- clearNotifications() {
17
- this._state.items = [];
18
- }
19
- showErrorNotification(details, priority) {
20
- this.pushNotification(details, priority !== null && priority !== void 0 ? priority : 0, 'danger');
21
- }
22
- showInfoNotification(details, priority) {
23
- this.pushNotification(details, priority !== null && priority !== void 0 ? priority : 0, 'info');
24
- }
25
- showWarningNotification(details, priority) {
26
- this.pushNotification(details, priority !== null && priority !== void 0 ? priority : 0, 'warning');
27
- }
28
- showSuccessNotification(details, priority) {
29
- this.pushNotification(details, priority !== null && priority !== void 0 ? priority : 0, 'success');
30
- }
31
- pushNotification(details, priority, type) {
32
- const items = [...this._state.items];
33
- items.push({ details, type, priority });
34
- this._state.items = items.sort((a, b) => b.priority - a.priority);
35
- }
36
- }
37
- export default new NotificationsService();
@@ -1,3 +0,0 @@
1
- export const initialState = {
2
- items: []
3
- };
@@ -1,35 +0,0 @@
1
- import { Query } from '@datorama/akita';
2
- import sessionStore from './session.store';
3
- export class SessionQuery extends Query {
4
- constructor(store) {
5
- super(store);
6
- this.store = store;
7
- this.vehicle$ = this.select((state) => state.vehicle);
8
- this.user$ = this.select((state) => state.user);
9
- this.result$ = this.select((state) => state.quote);
10
- this.userDetails$ = this.select((state) => state.userDetails);
11
- this.makeList$ = this.select((state) => state.refLists.makeList);
12
- this.modelList$ = this.select((state) => state.refLists.modelList);
13
- this.yearList$ = this.select((state) => state.refLists.yearList);
14
- this.bodyTypeList$ = this.select((state) => state.refLists.bodyTypeList);
15
- this.modelVariantsList$ = this.select((state) => state.refLists.modelVariantsList);
16
- this.selectedVariant$ = this.select((state) => state.vehicle.selectedVariant);
17
- this.quote$ = this.select((state) => state.quote);
18
- }
19
- get selectedVariant() {
20
- return this.getValue().vehicle.selectedVariant;
21
- }
22
- get vehicle() {
23
- return this.getValue().vehicle;
24
- }
25
- get user() {
26
- return this.getValue().user;
27
- }
28
- get result() {
29
- return this.getValue().quote;
30
- }
31
- get userDetails() {
32
- return this.getValue().userDetails;
33
- }
34
- }
35
- export default new SessionQuery(sessionStore);
@@ -1,78 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { Store, StoreConfig } from '@datorama/akita';
8
- import * as O from 'fp-ts/Option';
9
- export function createInitialState() {
10
- return {
11
- vehicle: {
12
- make: O.none,
13
- makeId: O.none,
14
- model: O.none,
15
- modelId: O.none,
16
- year: O.none,
17
- bodyType: O.none,
18
- bodyTypeId: O.none,
19
- selectedVariant: O.none,
20
- isUsedCarRequested: O.some(false),
21
- approximatePrice: O.none
22
- },
23
- user: {
24
- annualSalary: O.none,
25
- annualKms: O.none,
26
- paymentPeriod: O.none,
27
- state: O.none,
28
- term: O.none
29
- },
30
- quote: {
31
- afterTaxEffectPerPayCycle: O.none,
32
- taxSaving: O.none,
33
- residualValue: O.none,
34
- financedAmount: O.none,
35
- fuel: O.none,
36
- serviceAndMaintenance: O.none,
37
- registrationAndCtp: O.none,
38
- comprehensiveInsurance: O.none,
39
- managementFee: O.none,
40
- quoteState: 'Not calculated'
41
- },
42
- userDetails: {
43
- employerName: O.none,
44
- userFirstName: O.none,
45
- userLastName: O.none,
46
- contactNumber: O.none,
47
- emailAddress: O.none
48
- },
49
- refLists: {
50
- makeList: O.none,
51
- modelList: O.none,
52
- yearList: O.none,
53
- bodyTypeList: O.none,
54
- modelVariantsList: O.none
55
- }
56
- };
57
- }
58
- let SessionStore = class SessionStore extends Store {
59
- constructor() {
60
- super(createInitialState());
61
- }
62
- updateQuote(quote) {
63
- this.update({
64
- quote: quote
65
- });
66
- }
67
- setVehicleState(key, value) {
68
- this.update((state) => (Object.assign(Object.assign({}, state), { vehicle: Object.assign(Object.assign({}, state.vehicle), { [key]: value === null ? O.none : O.some(value) }) })));
69
- }
70
- updateList(name, value) {
71
- this.update((state) => (Object.assign(Object.assign({}, state), { refLists: Object.assign(Object.assign({}, state.refLists), { [name]: O.some(value) }) })));
72
- }
73
- };
74
- SessionStore = __decorate([
75
- StoreConfig({ name: 'cars-calc-session', resettable: true })
76
- ], SessionStore);
77
- export { SessionStore };
78
- export default new SessionStore();
@@ -1,2 +0,0 @@
1
- export const Environment = '__ENVIRONMENT';
2
- export const AppVersion = '__APP_VERSION';
@@ -1,5 +0,0 @@
1
- import { akitaDevtools, persistState } from '@datorama/akita';
2
- export default async function () {
3
- persistState({ storage: window.sessionStorage });
4
- akitaDevtools();
5
- }
@@ -1,5 +0,0 @@
1
- import { enableAkitaProdMode, persistState } from '@datorama/akita';
2
- export default async function () {
3
- persistState({ storage: window.sessionStorage });
4
- enableAkitaProdMode();
5
- }
@@ -1,2 +0,0 @@
1
- export * from './components';
2
- import '@stencil/router';
@@ -1,2 +0,0 @@
1
- export const Environment = '$ENVIRONMENT';
2
- export const AppVersion = '$APP_VERSION';
@@ -1,15 +0,0 @@
1
- import * as O from 'fp-ts/Option';
2
- import { pipe } from 'fp-ts/pipeable';
3
- export * from './config';
4
- export * from './lazy';
5
- export function getOrDefault(option, value) {
6
- return pipe(option, O.getOrElse(() => value));
7
- }
8
- export function getOrError(option) {
9
- return pipe(option, O.getOrElse(() => {
10
- throw new Error('Option value is none.');
11
- }));
12
- }
13
- export function toSelectInputOptionsArray(list) {
14
- return list.map((s) => ({ label: String(s), value: s }));
15
- }
@@ -1,29 +0,0 @@
1
- import * as O from 'fp-ts/Option';
2
- export class Lazy {
3
- constructor(factory) {
4
- this.factory = factory;
5
- this._value = O.none;
6
- }
7
- get value() {
8
- if (O.isSome(this._value)) {
9
- return this._value.value;
10
- }
11
- const lazyValue = this.factory();
12
- this._value = O.some(lazyValue);
13
- return lazyValue;
14
- }
15
- }
16
- export class AsyncLazy {
17
- constructor(factory) {
18
- this.factory = factory;
19
- this._value = O.none;
20
- }
21
- async getValueAsync() {
22
- if (O.isSome(this._value)) {
23
- return this._value.value;
24
- }
25
- const lazyValue = await this.factory();
26
- this._value = O.some(lazyValue);
27
- return lazyValue;
28
- }
29
- }
@@ -1,73 +0,0 @@
1
- import { h } from './index-19c4d245.js';
2
-
3
- const createProviderConsumer = (defaultState, consumerRender) => {
4
- let listeners = new Map();
5
- let currentState = defaultState;
6
- const updateListener = (fields, instance) => {
7
- if (Array.isArray(fields)) {
8
- [...fields].forEach(fieldName => {
9
- instance[fieldName] = currentState[fieldName];
10
- });
11
- }
12
- else {
13
- instance[fields] = Object.assign({}, currentState);
14
- }
15
- };
16
- const subscribe = (instance, propList) => {
17
- if (!listeners.has(instance)) {
18
- listeners.set(instance, propList);
19
- updateListener(propList, instance);
20
- }
21
- return () => {
22
- if (listeners.has(instance)) {
23
- listeners.delete(instance);
24
- }
25
- };
26
- };
27
- const Provider = ({ state }, children) => {
28
- currentState = state;
29
- listeners.forEach(updateListener);
30
- return children;
31
- };
32
- const Consumer = (props, children) => {
33
- // The casting on subscribe is to allow for crossover through the stencil compiler
34
- // In the future we should allow for generics in components.
35
- return consumerRender(subscribe, children[0]);
36
- };
37
- const injectProps = (Cstr, fieldList) => {
38
- const CstrPrototype = Cstr.prototype;
39
- const cstrConnectedCallback = CstrPrototype.connectedCallback;
40
- const cstrDisconnectedCallback = CstrPrototype.disconnectedCallback;
41
- CstrPrototype.connectedCallback = function () {
42
- subscribe(this, fieldList);
43
- if (cstrConnectedCallback) {
44
- return cstrConnectedCallback.call(this);
45
- }
46
- };
47
- CstrPrototype.disconnectedCallback = function () {
48
- listeners.delete(this);
49
- if (cstrDisconnectedCallback) {
50
- cstrDisconnectedCallback.call(this);
51
- }
52
- };
53
- };
54
- return {
55
- Provider,
56
- Consumer,
57
- injectProps
58
- };
59
- };
60
-
61
- const ActiveRouter = createProviderConsumer({
62
- historyType: 'browser',
63
- location: {
64
- pathname: '',
65
- query: {},
66
- key: ''
67
- },
68
- titleSuffix: '',
69
- root: '/',
70
- routeViewsUpdated: () => { }
71
- }, (subscribe, child) => (h("context-consumer", { subscribe: subscribe, renderer: child })));
72
-
73
- export { ActiveRouter as A };