summit-registration-lite 4.0.15 → 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
@@ -786,13 +786,11 @@ const customErrorHandler = (err, res) => (dispatch, state) => {
786
786
  const getTicketTypesAndTaxes = summitId => async dispatch => {
787
787
  dispatch(startWidgetLoading());
788
788
  return Promise.all([dispatch(getTicketTypes(summitId)), dispatch(getTaxesTypes(summitId))]).then(values => {
789
- dispatch(stopWidgetLoading());
790
789
  return values;
791
790
  }).catch(err => {
792
- dispatch(stopWidgetLoading());
793
791
  console.log(err);
794
792
  return Promise.reject(err);
795
- });
793
+ }).finally(() => dispatch(stopWidgetLoading()));
796
794
  };
797
795
  /**
798
796
  * @param summitId
@@ -3151,40 +3149,17 @@ const RegistrationLite = _ref => {
3151
3149
  }, []);
3152
3150
  (0,external_react_.useEffect)(() => {
3153
3151
  if (summitData && profileData) {
3154
- handleGetTicketTypesAndTaxes(summitData.id);
3155
- }
3156
- }, [summitData, profileData]);
3157
- (0,external_react_.useEffect)(() => {
3158
- if (summitData && profileData) {
3159
- getMyInvitation(summitData.id).catch(e => console.log(e));
3152
+ getMyInvitation(summitData.id).catch(e => console.log(e)).finally(() => handleGetTicketTypesAndTaxes(summitData.id));
3160
3153
  }
3161
3154
  }, [summitData, profileData]);
3162
3155
  (0,external_react_.useEffect)(() => {
3163
- if (step === 1 && formValues !== null && formValues !== void 0 && formValues.ticketType && formValues !== null && formValues !== void 0 && formValues.personalInformation) {
3164
- reserveTicket({
3165
- provider,
3166
- personalInformation: formValues === null || formValues === void 0 ? void 0 : formValues.personalInformation,
3167
- ticket: formValues === null || formValues === void 0 ? void 0 : formValues.ticketType,
3168
- ticketQuantity: formValues === null || formValues === void 0 ? void 0 : formValues.ticketQuantity
3169
- }, {
3170
- onError: (err, res) => setFormErrors(res.body.errors)
3171
- }).catch(error => {
3172
- let {
3173
- message
3174
- } = error;
3175
-
3176
- 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))) {
3177
- // we dont have an access token, init log out process
3178
- clearWidgetState();
3179
- return authErrorCallback(error);
3180
- }
3181
- });
3182
- }
3156
+ var _registrationForm$val;
3183
3157
 
3184
- 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)) {
3185
3160
  changeStep(0);
3186
3161
  }
3187
- }, [formValues]);
3162
+ }, [registrationForm.values, step]);
3188
3163
  (0,external_react_.useEffect)(() => {
3189
3164
  setFormErrors([]);
3190
3165
  }, [step]);
@@ -3295,9 +3270,31 @@ const RegistrationLite = _ref => {
3295
3270
  userProfile: profileData,
3296
3271
  invitation: invitation,
3297
3272
  summitId: summitData.id,
3298
- changeForm: personalInformation => setFormValues(registration_lite_objectSpread(registration_lite_objectSpread({}, formValues), {}, {
3299
- personalInformation
3300
- })),
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
+ },
3301
3298
  handleCompanyError: handleCompanyError,
3302
3299
  formValues: formValues,
3303
3300
  formErrors: formErrors,