@mychoice/mychoice-sdk-store 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/handlers/dataHandlers/QuoteDataHandler/interfaces.d.ts +1 -0
- package/dist/cjs/index.js +41 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/states/reducers/states/formStates/FormCarState/QuoteState/actions.d.ts +2 -1
- package/dist/cjs/states/reducers/states/formStates/FormCarState/QuoteState/interfaces.d.ts +8 -0
- package/dist/cjs/states/reducers/states/formStates/FormHomeState/AddressState/interfaces.d.ts +3 -3
- package/dist/esm/handlers/dataHandlers/QuoteDataHandler/interfaces.d.ts +1 -0
- package/dist/esm/index.js +41 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/states/reducers/states/formStates/FormCarState/QuoteState/actions.d.ts +2 -1
- package/dist/esm/states/reducers/states/formStates/FormCarState/QuoteState/interfaces.d.ts +8 -0
- package/dist/esm/states/reducers/states/formStates/FormHomeState/AddressState/interfaces.d.ts +3 -3
- package/dist/index.d.ts +11 -1
- package/package.json +3 -3
|
@@ -5,5 +5,6 @@ export declare enum StoreFormCarQuoteActionTypes {
|
|
|
5
5
|
FormCarQuotesSet = "FormCarQuotesSet",
|
|
6
6
|
FormCarQuoteGetLocal = "FormCarQuoteGetLocal",
|
|
7
7
|
FormCarQuoteClear = "FormCarQuoteClear",
|
|
8
|
-
UpdateCarCallMessage = "UpdateCarCallMessage"
|
|
8
|
+
UpdateCarCallMessage = "UpdateCarCallMessage",
|
|
9
|
+
FormCarQuoteConfirmStepSet = "FormCarQuoteConfirmStepSet"
|
|
9
10
|
}
|
|
@@ -21,12 +21,14 @@ export interface CarQuoteItemInterface {
|
|
|
21
21
|
id: number | null;
|
|
22
22
|
priceMonthly: string;
|
|
23
23
|
priceYearly: string;
|
|
24
|
+
confirmQuote?: boolean;
|
|
24
25
|
}
|
|
25
26
|
export interface FormCarQuoteStateInterface {
|
|
26
27
|
items: CarQuoteItemInterface[];
|
|
27
28
|
isRequested: boolean;
|
|
28
29
|
requestDate: string;
|
|
29
30
|
showCallMessage: boolean;
|
|
31
|
+
quoteConfirm?: boolean;
|
|
30
32
|
}
|
|
31
33
|
export type FormCarQuoteStateActionType = {
|
|
32
34
|
type: StoreFormCarQuoteActionTypes.FormCarQuoteIsRequestedSet;
|
|
@@ -60,6 +62,12 @@ export type FormCarQuoteStateActionType = {
|
|
|
60
62
|
showCallMessage: boolean;
|
|
61
63
|
};
|
|
62
64
|
localIndex?: string;
|
|
65
|
+
} | {
|
|
66
|
+
type: StoreFormCarQuoteActionTypes.FormCarQuoteConfirmStepSet;
|
|
67
|
+
payload: {
|
|
68
|
+
quoteConfirm: boolean;
|
|
69
|
+
};
|
|
70
|
+
localIndex?: string;
|
|
63
71
|
};
|
|
64
72
|
export type FormCarQuoteStateReducerInterface = (state: FormCarQuoteStateInterface, action: FormCarQuoteStateActionType) => FormCarQuoteStateInterface;
|
|
65
73
|
export interface FormCarQuoteHookInterface {
|
package/dist/cjs/states/reducers/states/formStates/FormHomeState/AddressState/interfaces.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HomeOwnerTypes } from '@
|
|
1
|
+
import { HomeOwnerTypes } from '@groksmith/mychoice-sdk-components';
|
|
2
2
|
import { StoreFormHomeAddressActionTypes } from './actions';
|
|
3
3
|
import { StateBaseInterface } from '../../shared';
|
|
4
4
|
export interface FormHomeAddressStateInterface extends StateBaseInterface {
|
|
@@ -6,7 +6,7 @@ export interface FormHomeAddressStateInterface extends StateBaseInterface {
|
|
|
6
6
|
addressStreet: string;
|
|
7
7
|
unitApartmentNumber: string;
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export type FormHomeAddressStateActionType = {
|
|
10
10
|
type: StoreFormHomeAddressActionTypes.FormHomeAddressValidate;
|
|
11
11
|
payload: {
|
|
12
12
|
inValidation: boolean;
|
|
@@ -45,7 +45,7 @@ export declare type FormHomeAddressStateActionType = {
|
|
|
45
45
|
payload?: null;
|
|
46
46
|
localIndex?: string;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type FormHomeAddressStateReducerInterface = (state: FormHomeAddressStateInterface, action: FormHomeAddressStateActionType) => FormHomeAddressStateInterface;
|
|
49
49
|
export interface FormHomeAddressHookInterface {
|
|
50
50
|
addressState: FormHomeAddressStateInterface;
|
|
51
51
|
dispatchAddressState: (props: FormHomeAddressStateActionType) => void;
|
|
@@ -2,4 +2,5 @@ import { DataHandlerRequestState } from '../shared';
|
|
|
2
2
|
export type UseHandlerQuoteInterface = DataHandlerRequestState & {
|
|
3
3
|
postRequestQuoteOnliaUrl: (isLoader: boolean, redirectUrl: string) => void;
|
|
4
4
|
postRequestQuote: (isRecalc: boolean) => void;
|
|
5
|
+
postPerformLeadsAction?: () => void;
|
|
5
6
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -2013,6 +2013,7 @@ var StoreFormCarQuoteActionTypes;
|
|
|
2013
2013
|
StoreFormCarQuoteActionTypes["FormCarQuoteGetLocal"] = "FormCarQuoteGetLocal";
|
|
2014
2014
|
StoreFormCarQuoteActionTypes["FormCarQuoteClear"] = "FormCarQuoteClear";
|
|
2015
2015
|
StoreFormCarQuoteActionTypes["UpdateCarCallMessage"] = "UpdateCarCallMessage";
|
|
2016
|
+
StoreFormCarQuoteActionTypes["FormCarQuoteConfirmStepSet"] = "FormCarQuoteConfirmStepSet";
|
|
2016
2017
|
})(StoreFormCarQuoteActionTypes || (StoreFormCarQuoteActionTypes = {}));
|
|
2017
2018
|
|
|
2018
2019
|
const setQuoteStateProperty$2 = (state, name, value) => {
|
|
@@ -2039,6 +2040,8 @@ const formCarQuoteStateReducer = (state = { ...formCarQuoteInitialState }, actio
|
|
|
2039
2040
|
return setLocalQuotes$2(action.localIndex, setQuoteStateProperty$2(state, 'items', action.payload.items));
|
|
2040
2041
|
case StoreFormCarQuoteActionTypes.FormCarQuoteRequestDateSet:
|
|
2041
2042
|
return setLocalQuotes$2(action.localIndex, setQuoteStateProperty$2(state, 'requestDate', action.payload.requestDate));
|
|
2043
|
+
case StoreFormCarQuoteActionTypes.FormCarQuoteConfirmStepSet:
|
|
2044
|
+
return setLocalQuotes$2(action.localIndex, setQuoteStateProperty$2(state, 'quoteConfirm', action.payload.quoteConfirm));
|
|
2042
2045
|
case StoreFormCarQuoteActionTypes.FormCarQuoteGetLocal:
|
|
2043
2046
|
return {
|
|
2044
2047
|
...getLocalQuotes$2(action.localIndex),
|
|
@@ -5195,6 +5198,12 @@ const CarQuoteDataHandler = () => {
|
|
|
5195
5198
|
type: StoreFormCarQuoteActionTypes.FormCarQuotesSet,
|
|
5196
5199
|
payload: { items: response.data },
|
|
5197
5200
|
});
|
|
5201
|
+
if (discountState.quoterInfo.initial) {
|
|
5202
|
+
dispatchQuoteState({
|
|
5203
|
+
type: StoreFormCarQuoteActionTypes.FormCarQuoteConfirmStepSet,
|
|
5204
|
+
payload: { quoteConfirm: !!response.data?.[0]?.confirmQuote },
|
|
5205
|
+
});
|
|
5206
|
+
}
|
|
5198
5207
|
setRequestState({
|
|
5199
5208
|
type: DataHandlerActionTypes.SetSuccess,
|
|
5200
5209
|
});
|
|
@@ -5213,6 +5222,37 @@ const CarQuoteDataHandler = () => {
|
|
|
5213
5222
|
}
|
|
5214
5223
|
}
|
|
5215
5224
|
};
|
|
5225
|
+
const postPerformLeadsAction = async () => {
|
|
5226
|
+
const { firstName, lastName, phone } = discountState.quoterInfo;
|
|
5227
|
+
const requestBody = {
|
|
5228
|
+
quote_id: quoteState.items[0].id,
|
|
5229
|
+
first_name: firstName,
|
|
5230
|
+
last_name: lastName,
|
|
5231
|
+
phone,
|
|
5232
|
+
};
|
|
5233
|
+
openLoader('Please wait while we are finalizing your quote.');
|
|
5234
|
+
try {
|
|
5235
|
+
await httpRequest({
|
|
5236
|
+
url: API_FORM_CAR.POST_SEND_LEADS,
|
|
5237
|
+
method: RequestTypes.Post,
|
|
5238
|
+
data: requestBody,
|
|
5239
|
+
withoutToken: true,
|
|
5240
|
+
cancelToken,
|
|
5241
|
+
});
|
|
5242
|
+
}
|
|
5243
|
+
catch (error) {
|
|
5244
|
+
setRequestState({
|
|
5245
|
+
type: DataHandlerActionTypes.SetError,
|
|
5246
|
+
payload: 'Axios request error',
|
|
5247
|
+
});
|
|
5248
|
+
}
|
|
5249
|
+
// As precaution always reveal all quotes even if lead endpoint failed
|
|
5250
|
+
dispatchQuoteState({
|
|
5251
|
+
type: StoreFormCarQuoteActionTypes.FormCarQuoteConfirmStepSet,
|
|
5252
|
+
payload: { quoteConfirm: false },
|
|
5253
|
+
});
|
|
5254
|
+
dispatchAppLoaderState({ type: StoreConfigAppLoaderActionTypes.AppLoaderClose });
|
|
5255
|
+
};
|
|
5216
5256
|
return ({
|
|
5217
5257
|
status,
|
|
5218
5258
|
successMessage,
|
|
@@ -5222,6 +5262,7 @@ const CarQuoteDataHandler = () => {
|
|
|
5222
5262
|
responseError,
|
|
5223
5263
|
postRequestQuoteOnliaUrl,
|
|
5224
5264
|
postRequestQuote,
|
|
5265
|
+
postPerformLeadsAction,
|
|
5225
5266
|
});
|
|
5226
5267
|
};
|
|
5227
5268
|
|