@flarehr/apollo-benefits 0.1.106 → 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.
- package/README.md +19 -0
- package/dist/assets/@splitsoftware-7d799540.js +18 -0
- package/dist/assets/all_tab_color-548783b9.svg +21 -0
- package/dist/assets/all_tab_gray-a5051313.svg +6 -0
- package/dist/assets/check-57fe1dcb.svg +15 -0
- package/dist/assets/datadog-c7ede347.js +5 -0
- package/dist/assets/date-fns-c5d8fbc0.js +1 -0
- package/dist/assets/default_backdrop-fdd955b8.png +0 -0
- package/dist/assets/external_link-599a0aec.svg +3 -0
- package/dist/assets/external_link_white-55111b2e.svg +3 -0
- package/dist/assets/framer-motion-bb8d6b82.js +1 -0
- package/dist/assets/index-87923fdc.js +35 -0
- package/dist/assets/index-cfa25e28.css +1 -0
- package/dist/assets/index-ee9d2045.js +5 -0
- package/dist/assets/lodash-5d893f8c.js +1 -0
- package/dist/assets/logo-a34e9b4b.png +0 -0
- package/dist/assets/oidc-client-6f6e47c2.js +101 -0
- package/dist/assets/padlock-8c081120.svg +26 -0
- package/dist/assets/suitcase-6471ad05.svg +17 -0
- package/dist/assets/vendor-2d0139ca.js +788 -0
- package/dist/assets/warning-a7f1af23.svg +14 -0
- package/dist/assets/welcome_image_mobile-dbde6c80.png +0 -0
- package/dist/assets/welcome_image_v2-869c59e4.png +0 -0
- package/dist/assets/wellbeing_banner-6903d615.png +0 -0
- package/dist/assets/workplace_link_banner_mobile-6ebaa24b.png +0 -0
- package/dist/assets/workplace_link_banner_v2-c81ed849.png +0 -0
- package/dist/config.json +14 -0
- package/dist/favicon.ico +0 -0
- package/dist/icons/android-chrome-192x192.png +0 -0
- package/dist/icons/android-chrome-512x512.png +0 -0
- package/dist/icons/apple-touch-icon.png +0 -0
- package/dist/icons/favicon-16x16.png +0 -0
- package/dist/icons/favicon-32x32.png +0 -0
- package/dist/index.html +114 -0
- package/dist/manifest.json +21 -0
- package/dist/sw-esm.js +16 -0
- package/package.json +129 -60
- package/LICENSE +0 -21
- package/dist/lib/apollo-benefits/apollo-benefits.esm.js +0 -1
- package/dist/lib/apollo-benefits/assets/car-placeholder.svg +0 -5
- package/dist/lib/apollo-benefits/assets/check.svg +0 -13
- package/dist/lib/apollo-benefits/index.esm.js +0 -0
- package/dist/lib/apollo-benefits/p-06a1f65f.js +0 -1
- package/dist/lib/apollo-benefits/p-077d7f8d.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-0a21a709.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-14054f15.js +0 -1
- package/dist/lib/apollo-benefits/p-24a37d64.js +0 -1
- package/dist/lib/apollo-benefits/p-2b3f3b72.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-3111d565.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-327396fa.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-3af26279.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-3d4d2683.js +0 -1
- package/dist/lib/apollo-benefits/p-4474bcf8.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-50fe790f.js +0 -1
- package/dist/lib/apollo-benefits/p-53bcbd1d.js +0 -1
- package/dist/lib/apollo-benefits/p-64a2b03a.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-68c136da.js +0 -1
- package/dist/lib/apollo-benefits/p-6bd16f5b.js +0 -1
- package/dist/lib/apollo-benefits/p-71dbc8ff.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-774d9bc5.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-7a2ca86d.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-7a572b50.js +0 -1
- package/dist/lib/apollo-benefits/p-7c2cd94a.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-839493d7.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-acf61bdc.js +0 -1
- package/dist/lib/apollo-benefits/p-b33fc683.js +0 -1
- package/dist/lib/apollo-benefits/p-beb8f728.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-d7bea1d9.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-ddb176cb.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-e241f55b.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-ef8ea713.entry.js +0 -1
- package/dist/lib/apollo-benefits/p-f603197d.js +0 -15
- package/dist/lib/cjs/active-router-0ecaf2b8.js +0 -75
- package/dist/lib/cjs/ap-ben-choose-vehicle-section_4.cjs.entry.js +0 -2684
- package/dist/lib/cjs/ap-ben-complete-section_4.cjs.entry.js +0 -108
- package/dist/lib/cjs/ap-ben-notifications-section.cjs.entry.js +0 -238
- package/dist/lib/cjs/apollo-benefits.cjs.js +0 -25
- package/dist/lib/cjs/app-globals-67583b8b.js +0 -12
- package/dist/lib/cjs/async-6a7926f0.js +0 -753
- package/dist/lib/cjs/cars-calculator-app.cjs.entry.js +0 -52
- package/dist/lib/cjs/cars-calculator.service-11b0cd88.js +0 -901
- package/dist/lib/cjs/context-consumer.cjs.entry.js +0 -29
- package/dist/lib/cjs/datorama-akita-31d23240.js +0 -2551
- package/dist/lib/cjs/delay-d31618c3.js +0 -206
- package/dist/lib/cjs/distinctUntilChanged-e8538790.js +0 -371
- package/dist/lib/cjs/dom-utils-b8befdd5.js +0 -63
- package/dist/lib/cjs/fl-button.cjs.entry.js +0 -30
- package/dist/lib/cjs/fl-dropdown-async_2.cjs.entry.js +0 -467
- package/dist/lib/cjs/fl-dropdown.cjs.entry.js +0 -232
- package/dist/lib/cjs/fl-loading-indicator.cjs.entry.js +0 -26
- package/dist/lib/cjs/fl-style-guide.cjs.entry.js +0 -91
- package/dist/lib/cjs/index-f1fadf90.js +0 -1735
- package/dist/lib/cjs/index.cjs.js +0 -2
- package/dist/lib/cjs/loader.cjs.js +0 -27
- package/dist/lib/cjs/location-utils-36fe7e5e.js +0 -237
- package/dist/lib/cjs/match-path-be4ea5f6.js +0 -279
- package/dist/lib/cjs/session.query-d61ba7ec.js +0 -1731
- package/dist/lib/cjs/stencil-async-content.cjs.entry.js +0 -32
- package/dist/lib/cjs/stencil-route-link.cjs.entry.js +0 -78
- package/dist/lib/cjs/stencil-route-switch.cjs.entry.js +0 -104
- package/dist/lib/cjs/stencil-route-title.cjs.entry.js +0 -32
- package/dist/lib/cjs/stencil-route.cjs.entry.js +0 -97
- package/dist/lib/cjs/stencil-router-prompt.cjs.entry.js +0 -59
- package/dist/lib/cjs/stencil-router-redirect.cjs.entry.js +0 -32
- package/dist/lib/cjs/stencil-router.cjs.entry.js +0 -640
- package/dist/lib/collection/assets/image/complete.svg +0 -122
- package/dist/lib/collection/collection-manifest.json +0 -53
- package/dist/lib/collection/components/cars-calculator-app/api/api-client.js +0 -5
- package/dist/lib/collection/components/cars-calculator-app/api/cars-calculator.api.js +0 -45
- package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.css +0 -22
- package/dist/lib/collection/components/cars-calculator-app/cars-calculator-app.js +0 -93
- package/dist/lib/collection/components/cars-calculator-app/modal-section/modal-section.css +0 -0
- package/dist/lib/collection/components/cars-calculator-app/modal-section/modal-section.js +0 -144
- package/dist/lib/collection/components/cars-calculator-app/notifications-section/notifications-section.js +0 -25
- package/dist/lib/collection/components/cars-calculator-app/pages/assets/car-placeholder.svg +0 -5
- package/dist/lib/collection/components/cars-calculator-app/pages/assets/check.svg +0 -13
- package/dist/lib/collection/components/cars-calculator-app/pages/choose-vehicle-section.component.js +0 -193
- package/dist/lib/collection/components/cars-calculator-app/pages/complete-section.component.js +0 -38
- package/dist/lib/collection/components/cars-calculator-app/pages/cost-breakdown-section.component.js +0 -47
- package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.css +0 -34
- package/dist/lib/collection/components/cars-calculator-app/pages/model-variants-section.component.js +0 -64
- package/dist/lib/collection/components/cars-calculator-app/pages/personal-info-section.component.js +0 -66
- package/dist/lib/collection/components/cars-calculator-app/pages/quote-result-section.component.js +0 -86
- package/dist/lib/collection/components/cars-calculator-app/pages/submit-quote-section.component.js +0 -75
- package/dist/lib/collection/components/cars-calculator-app/services/app-configuration.service.js +0 -13
- package/dist/lib/collection/components/cars-calculator-app/services/cars-calculator.service.js +0 -103
- package/dist/lib/collection/components/cars-calculator-app/services/notifications.service.js +0 -37
- package/dist/lib/collection/components/cars-calculator-app/services/notifications.store.js +0 -3
- package/dist/lib/collection/components/cars-calculator-app/services/session.query.js +0 -35
- package/dist/lib/collection/components/cars-calculator-app/services/session.store.js +0 -78
- package/dist/lib/collection/global/config.js +0 -2
- package/dist/lib/collection/global/main.dev.js +0 -5
- package/dist/lib/collection/global/main.js +0 -5
- package/dist/lib/collection/index.js +0 -2
- package/dist/lib/collection/utils/config.js +0 -2
- package/dist/lib/collection/utils/index.js +0 -15
- package/dist/lib/collection/utils/lazy.js +0 -29
- package/dist/lib/esm/active-router-7c2ca849.js +0 -73
- package/dist/lib/esm/ap-ben-choose-vehicle-section_4.entry.js +0 -2677
- package/dist/lib/esm/ap-ben-complete-section_4.entry.js +0 -101
- package/dist/lib/esm/ap-ben-notifications-section.entry.js +0 -234
- package/dist/lib/esm/apollo-benefits.js +0 -23
- package/dist/lib/esm/app-globals-65714cca.js +0 -10
- package/dist/lib/esm/async-68e9cad7.js +0 -738
- package/dist/lib/esm/cars-calculator-app.entry.js +0 -48
- package/dist/lib/esm/cars-calculator.service-2cde6288.js +0 -894
- package/dist/lib/esm/context-consumer.entry.js +0 -25
- package/dist/lib/esm/datorama-akita-c87196a0.js +0 -2545
- package/dist/lib/esm/delay-115d4292.js +0 -200
- package/dist/lib/esm/distinctUntilChanged-bf69e0f8.js +0 -363
- package/dist/lib/esm/dom-utils-109a7d75.js +0 -55
- package/dist/lib/esm/fl-button.entry.js +0 -26
- package/dist/lib/esm/fl-dropdown-async_2.entry.js +0 -462
- package/dist/lib/esm/fl-dropdown.entry.js +0 -228
- package/dist/lib/esm/fl-loading-indicator.entry.js +0 -22
- package/dist/lib/esm/fl-style-guide.entry.js +0 -87
- package/dist/lib/esm/index-19c4d245.js +0 -1703
- package/dist/lib/esm/index.js +0 -1
- package/dist/lib/esm/loader.js +0 -23
- package/dist/lib/esm/location-utils-312665d3.js +0 -226
- package/dist/lib/esm/match-path-4b5c7d98.js +0 -276
- package/dist/lib/esm/polyfills/core-js.js +0 -11
- package/dist/lib/esm/polyfills/css-shim.js +0 -1
- package/dist/lib/esm/polyfills/dom.js +0 -79
- package/dist/lib/esm/polyfills/es5-html-element.js +0 -1
- package/dist/lib/esm/polyfills/index.js +0 -34
- package/dist/lib/esm/polyfills/system.js +0 -6
- package/dist/lib/esm/session.query-0f1c9503.js +0 -1719
- package/dist/lib/esm/stencil-async-content.entry.js +0 -28
- package/dist/lib/esm/stencil-route-link.entry.js +0 -74
- package/dist/lib/esm/stencil-route-switch.entry.js +0 -100
- package/dist/lib/esm/stencil-route-title.entry.js +0 -28
- package/dist/lib/esm/stencil-route.entry.js +0 -93
- package/dist/lib/esm/stencil-router-prompt.entry.js +0 -55
- package/dist/lib/esm/stencil-router-redirect.entry.js +0 -28
- package/dist/lib/esm/stencil-router.entry.js +0 -636
- package/dist/lib/index.cjs.js +0 -1
- package/dist/lib/index.js +0 -1
- package/dist/lib/loader/cdn.js +0 -3
- package/dist/lib/loader/index.cjs.js +0 -3
- package/dist/lib/loader/index.d.ts +0 -13
- package/dist/lib/loader/index.es2017.js +0 -3
- package/dist/lib/loader/index.js +0 -4
- package/dist/lib/loader/package.json +0 -10
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/button/button.css +0 -45
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown/dropdown.css +0 -9
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/dropdown-async/dropdown-async.css +0 -9
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/loading-indicator/loading-indicator.css +0 -141
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/promise-button/promise-button.css +0 -5
- package/dist/lib/node_modules/@flarehr/beacon/dist/collection/components/style-guide/style-guide.css +0 -0
- package/dist/lib/node_modules/@stencil/router/dist/collection/components/route/route.css +0 -3
- package/dist/lib/types/components/cars-calculator-app/api/api-client.d.ts +0 -2
- package/dist/lib/types/components/cars-calculator-app/api/cars-calculator.api.d.ts +0 -96
- package/dist/lib/types/components/cars-calculator-app/cars-calculator-app.d.ts +0 -15
- package/dist/lib/types/components/cars-calculator-app/modal-section/modal-section.d.ts +0 -16
- package/dist/lib/types/components/cars-calculator-app/notifications-section/notifications-section.d.ts +0 -5
- package/dist/lib/types/components/cars-calculator-app/pages/choose-vehicle-section.component.d.ts +0 -23
- package/dist/lib/types/components/cars-calculator-app/pages/complete-section.component.d.ts +0 -5
- package/dist/lib/types/components/cars-calculator-app/pages/cost-breakdown-section.component.d.ts +0 -6
- package/dist/lib/types/components/cars-calculator-app/pages/model-variants-section.component.d.ts +0 -12
- package/dist/lib/types/components/cars-calculator-app/pages/personal-info-section.component.d.ts +0 -10
- package/dist/lib/types/components/cars-calculator-app/pages/quote-result-section.component.d.ts +0 -13
- package/dist/lib/types/components/cars-calculator-app/pages/submit-quote-section.component.d.ts +0 -10
- package/dist/lib/types/components/cars-calculator-app/services/app-configuration.service.d.ts +0 -7
- package/dist/lib/types/components/cars-calculator-app/services/cars-calculator.service.d.ts +0 -11
- package/dist/lib/types/components/cars-calculator-app/services/notifications.service.d.ts +0 -15
- package/dist/lib/types/components/cars-calculator-app/services/notifications.store.d.ts +0 -14
- package/dist/lib/types/components/cars-calculator-app/services/session.query.d.ts +0 -25
- package/dist/lib/types/components/cars-calculator-app/services/session.store.d.ts +0 -74
- package/dist/lib/types/components.d.ts +0 -170
- package/dist/lib/types/global/config.d.ts +0 -2
- package/dist/lib/types/global/main.d.ts +0 -1
- package/dist/lib/types/global/main.dev.d.ts +0 -1
- package/dist/lib/types/index.d.ts +0 -2
- package/dist/lib/types/stencil-public-runtime.d.ts +0 -1555
- package/dist/lib/types/utils/config.d.ts +0 -2
- package/dist/lib/types/utils/index.d.ts +0 -7
- package/dist/lib/types/utils/lazy.d.ts +0 -12
- package/readme.md +0 -1
package/dist/lib/collection/components/cars-calculator-app/services/cars-calculator.service.js
DELETED
|
@@ -1,103 +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
|
-
},
|
|
30
|
-
websiteQuote: {
|
|
31
|
-
afterTaxEffectPerPayCycle: getOrError(result.afterTaxEffectPerPayCycle),
|
|
32
|
-
totalTaxSavings: getOrError(result.taxSaving),
|
|
33
|
-
residualValueGross: getOrError(result.residualValue),
|
|
34
|
-
financedAmount: getOrError(result.financedAmount),
|
|
35
|
-
fuel: getOrError(result.fuel),
|
|
36
|
-
serviceAndMaintenance: getOrError(result.serviceAndMaintenance),
|
|
37
|
-
registrationAndCtp: getOrError(result.registrationAndCtp),
|
|
38
|
-
comprehensiveInsurance: getOrError(result.comprehensiveInsurance),
|
|
39
|
-
managementFee: getOrError(result.managementFee)
|
|
40
|
-
},
|
|
41
|
-
contactDetails: {
|
|
42
|
-
firstName: getOrError(details.userFirstName),
|
|
43
|
-
lastName: getOrError(details.userLastName),
|
|
44
|
-
email: getOrError(details.emailAddress),
|
|
45
|
-
mobileNumber: getOrError(details.contactNumber),
|
|
46
|
-
employerName: getOrError(details.employerName)
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
async attemptQuoteCalculationAsync(user, vehicle) {
|
|
51
|
-
const isAllInformationAvailable = O.isSome(user.annualKms) &&
|
|
52
|
-
O.isSome(user.annualSalary) &&
|
|
53
|
-
O.isSome(user.paymentPeriod) &&
|
|
54
|
-
O.isSome(user.state) &&
|
|
55
|
-
O.isSome(user.term) &&
|
|
56
|
-
O.isSome(vehicle.selectedVariant);
|
|
57
|
-
if (!isAllInformationAvailable) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
sessionStore.updateQuote({
|
|
61
|
-
afterTaxEffectPerPayCycle: O.none,
|
|
62
|
-
taxSaving: O.none,
|
|
63
|
-
residualValue: O.none,
|
|
64
|
-
financedAmount: O.none,
|
|
65
|
-
fuel: O.none,
|
|
66
|
-
serviceAndMaintenance: O.none,
|
|
67
|
-
registrationAndCtp: O.none,
|
|
68
|
-
comprehensiveInsurance: O.none,
|
|
69
|
-
managementFee: O.none,
|
|
70
|
-
quoteState: 'Calculation pending'
|
|
71
|
-
});
|
|
72
|
-
const variant = getOrError(vehicle.selectedVariant);
|
|
73
|
-
const isUsedCarRequested = getOrError(vehicle.isUsedCarRequested);
|
|
74
|
-
const price = isUsedCarRequested
|
|
75
|
-
? getOrError(vehicle.approximatePrice)
|
|
76
|
-
: variant.listPriceGross;
|
|
77
|
-
const req = {
|
|
78
|
-
variantId: variant.variantId,
|
|
79
|
-
isUsedCarRequested: getOrError(vehicle.isUsedCarRequested),
|
|
80
|
-
approximatePrice: price,
|
|
81
|
-
annualSalaryGross: getOrError(user.annualSalary),
|
|
82
|
-
payPeriod: getOrError(user.paymentPeriod),
|
|
83
|
-
annualKm: getOrError(user.annualKms),
|
|
84
|
-
state: getOrError(user.state),
|
|
85
|
-
leaseTermInYears: getOrError(user.term)
|
|
86
|
-
};
|
|
87
|
-
const response = await carsCalculatorApi.postCarsQuoteResult(req);
|
|
88
|
-
const quoteResult = {
|
|
89
|
-
afterTaxEffectPerPayCycle: O.some(response.afterTaxEffectPerPayCycle),
|
|
90
|
-
taxSaving: O.some(response.totalTaxSavings),
|
|
91
|
-
residualValue: O.some(response.residualValueGross),
|
|
92
|
-
financedAmount: O.some(response.financedAmount),
|
|
93
|
-
fuel: O.some(response.fuel),
|
|
94
|
-
serviceAndMaintenance: O.some(response.serviceAndMaintenance),
|
|
95
|
-
registrationAndCtp: O.some(response.registrationAndCtp),
|
|
96
|
-
comprehensiveInsurance: O.some(response.comprehensiveInsurance),
|
|
97
|
-
managementFee: O.some(response.managementFee),
|
|
98
|
-
quoteState: 'Calculated'
|
|
99
|
-
};
|
|
100
|
-
sessionStore.updateQuote(quoteResult);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
export default new CarsCalculatorService();
|
package/dist/lib/collection/components/cars-calculator-app/services/notifications.service.js
DELETED
|
@@ -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,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,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 };
|