@mychoice/mychoice-sdk-store 2.1.71 → 2.1.75

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/index.js CHANGED
@@ -426,6 +426,11 @@ const globalStateReducer = redux.combineReducers({
426
426
  partnerState: partnerStateReducer,
427
427
  });
428
428
 
429
+ exports.CarBrokerTypeEnum = void 0;
430
+ (function (CarBrokerTypeEnum) {
431
+ CarBrokerTypeEnum["Youset"] = "youset";
432
+ })(exports.CarBrokerTypeEnum || (exports.CarBrokerTypeEnum = {}));
433
+
429
434
  const vehicleComprehensiveInitialState = {
430
435
  coverage: true,
431
436
  deductible: 1000,
@@ -2252,6 +2257,11 @@ const getDwellingInitialState = (type) => {
2252
2257
  }
2253
2258
  };
2254
2259
 
2260
+ exports.HomeBrokerTypeEnum = void 0;
2261
+ (function (HomeBrokerTypeEnum) {
2262
+ HomeBrokerTypeEnum["Youset"] = "youset";
2263
+ })(exports.HomeBrokerTypeEnum || (exports.HomeBrokerTypeEnum = {}));
2264
+
2255
2265
  const formHomePostalInitialState = {
2256
2266
  isReady: false,
2257
2267
  item: {
@@ -6102,6 +6112,8 @@ const useValidationCarDiscount = () => {
6102
6112
  };
6103
6113
  };
6104
6114
 
6115
+ // Module-level flag to prevent duplicate OPTA calls
6116
+ let isOPTACallInProgress = false;
6105
6117
  const useValidationAddress = () => {
6106
6118
  const { dwellingState } = useStoreFormHomeDwelling();
6107
6119
  const { dispatchAppLoaderState } = useStoreAppLoader();
@@ -6136,14 +6148,8 @@ const useValidationAddress = () => {
6136
6148
  });
6137
6149
  if (!errors.length) {
6138
6150
  if (isHomeOwner) {
6139
- try {
6140
- dispatchAppLoaderState({
6141
- type: exports.StoreConfigAppLoaderActionTypes.AppLoaderOpen,
6142
- payload: {
6143
- description: '',
6144
- },
6145
- });
6146
- await getPlaceByAddress(streetAddress, city, postalCode, provinceCode);
6151
+ // Check if OPTA call is already in progress to prevent duplicates
6152
+ if (isOPTACallInProgress) {
6147
6153
  dispatchPostalState({
6148
6154
  type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidate,
6149
6155
  payload: { inValidation: false },
@@ -6153,23 +6159,46 @@ const useValidationAddress = () => {
6153
6159
  payload: { isValid: true },
6154
6160
  });
6155
6161
  formIsValid = true;
6156
- dispatchAppLoaderState({
6157
- type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose,
6158
- });
6159
6162
  }
6160
- catch (e) {
6161
- dispatchPostalState({
6162
- type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidate,
6163
- payload: { inValidation: false },
6164
- });
6165
- dispatchPostalState({
6166
- type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidateSet,
6167
- payload: { isValid: true },
6168
- });
6169
- formIsValid = true;
6170
- dispatchAppLoaderState({
6171
- type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose,
6172
- });
6163
+ else {
6164
+ try {
6165
+ isOPTACallInProgress = true;
6166
+ dispatchAppLoaderState({
6167
+ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderOpen,
6168
+ payload: {
6169
+ description: '',
6170
+ },
6171
+ });
6172
+ await getPlaceByAddress(streetAddress, city, postalCode, provinceCode);
6173
+ isOPTACallInProgress = false;
6174
+ dispatchPostalState({
6175
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidate,
6176
+ payload: { inValidation: false },
6177
+ });
6178
+ dispatchPostalState({
6179
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidateSet,
6180
+ payload: { isValid: true },
6181
+ });
6182
+ formIsValid = true;
6183
+ dispatchAppLoaderState({
6184
+ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose,
6185
+ });
6186
+ }
6187
+ catch (e) {
6188
+ isOPTACallInProgress = false;
6189
+ dispatchPostalState({
6190
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidate,
6191
+ payload: { inValidation: false },
6192
+ });
6193
+ dispatchPostalState({
6194
+ type: exports.StoreFormHomePostalActionTypes.FormHomePostalValidateSet,
6195
+ payload: { isValid: true },
6196
+ });
6197
+ formIsValid = true;
6198
+ dispatchAppLoaderState({
6199
+ type: exports.StoreConfigAppLoaderActionTypes.AppLoaderClose,
6200
+ });
6201
+ }
6173
6202
  }
6174
6203
  }
6175
6204
  else {