summit-registration-lite 4.0.16 → 4.0.17

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/index.js CHANGED
@@ -3153,31 +3153,13 @@ const RegistrationLite = _ref => {
3153
3153
  }
3154
3154
  }, [summitData, profileData]);
3155
3155
  (0,external_react_.useEffect)(() => {
3156
- if (step === 1 && formValues !== null && formValues !== void 0 && formValues.ticketType && formValues !== null && formValues !== void 0 && formValues.personalInformation) {
3157
- reserveTicket({
3158
- provider,
3159
- personalInformation: formValues === null || formValues === void 0 ? void 0 : formValues.personalInformation,
3160
- ticket: formValues === null || formValues === void 0 ? void 0 : formValues.ticketType,
3161
- ticketQuantity: formValues === null || formValues === void 0 ? void 0 : formValues.ticketQuantity
3162
- }, {
3163
- onError: (err, res) => setFormErrors(res.body.errors)
3164
- }).catch(error => {
3165
- let {
3166
- message
3167
- } = error;
3156
+ var _registrationForm$val;
3168
3157
 
3169
- if (message && (message.includes(constants_namespaceObject.AUTH_ERROR_MISSING_AUTH_INFO) || message.includes(constants_namespaceObject.AUTH_ERROR_MISSING_REFRESH_TOKEN) || message.includes(constants_namespaceObject.AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR))) {
3170
- // we dont have an access token, init log out process
3171
- clearWidgetState();
3172
- return authErrorCallback(error);
3173
- }
3174
- });
3175
- }
3176
-
3177
- if (step > 0 && !(formValues !== null && formValues !== void 0 && formValues.ticketType)) {
3158
+ // check if there's personal information data and no ticket data to reset widget
3159
+ if (step > 0 && !((_registrationForm$val = registrationForm.values) !== null && _registrationForm$val !== void 0 && _registrationForm$val.ticketType)) {
3178
3160
  changeStep(0);
3179
3161
  }
3180
- }, [formValues]);
3162
+ }, [registrationForm.values, step]);
3181
3163
  (0,external_react_.useEffect)(() => {
3182
3164
  setFormErrors([]);
3183
3165
  }, [step]);
@@ -3288,9 +3270,31 @@ const RegistrationLite = _ref => {
3288
3270
  userProfile: profileData,
3289
3271
  invitation: invitation,
3290
3272
  summitId: summitData.id,
3291
- changeForm: personalInformation => setFormValues(registration_lite_objectSpread(registration_lite_objectSpread({}, formValues), {}, {
3292
- personalInformation
3293
- })),
3273
+ changeForm: personalInformation => {
3274
+ var _registrationForm$val2, _registrationForm$val3;
3275
+
3276
+ setFormValues(registration_lite_objectSpread(registration_lite_objectSpread({}, registrationForm.values), {}, {
3277
+ personalInformation
3278
+ }));
3279
+ reserveTicket({
3280
+ provider,
3281
+ personalInformation: personalInformation,
3282
+ ticket: (_registrationForm$val2 = registrationForm.values) === null || _registrationForm$val2 === void 0 ? void 0 : _registrationForm$val2.ticketType,
3283
+ ticketQuantity: (_registrationForm$val3 = registrationForm.values) === null || _registrationForm$val3 === void 0 ? void 0 : _registrationForm$val3.ticketQuantity
3284
+ }, {
3285
+ onError: (err, res) => setFormErrors(res.body.errors)
3286
+ }).catch(error => {
3287
+ let {
3288
+ message
3289
+ } = error;
3290
+
3291
+ if (message && (message.includes(constants_namespaceObject.AUTH_ERROR_MISSING_AUTH_INFO) || message.includes(constants_namespaceObject.AUTH_ERROR_MISSING_REFRESH_TOKEN) || message.includes(constants_namespaceObject.AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR))) {
3292
+ // we dont have an access token, init log out process
3293
+ clearWidgetState();
3294
+ return authErrorCallback(error);
3295
+ }
3296
+ });
3297
+ },
3294
3298
  handleCompanyError: handleCompanyError,
3295
3299
  formValues: formValues,
3296
3300
  formErrors: formErrors,