summit-registration-lite 4.0.20 → 4.0.21

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
@@ -480,8 +480,6 @@ class LawPayProvider {
480
480
  _defineProperty(this, "payTicket", ({
481
481
  token = null
482
482
  }) => async dispatch => {
483
- var _this$userProfile, _this$userProfile2, _this$userProfile3, _this$userProfile4, _this$userProfile5, _this$userProfile6;
484
-
485
483
  // Pay using affinity lawpay
486
484
  const errorHandler = (err, res) => (dispatch, state) => {
487
485
  let code = err.status;
@@ -512,12 +510,12 @@ class LawPayProvider {
512
510
  expand: 'tickets,' + 'tickets.owner,' + 'tickets.owner.extra_questions,' + 'tickets.badge,' + 'tickets.badge.type,' + 'tickets.badge.type.access_levels,' + 'tickets.badge.type.features,' + 'tickets.ticket_type,' + 'tickets.ticket_type.taxes'
513
511
  };
514
512
  let normalizedEntity = {
515
- billing_address_1: token ? token.address1 : ((_this$userProfile = this.userProfile) === null || _this$userProfile === void 0 ? void 0 : _this$userProfile.address1) || '',
516
- billing_address_2: ((_this$userProfile2 = this.userProfile) === null || _this$userProfile2 === void 0 ? void 0 : _this$userProfile2.address2) || '',
517
- billing_address_zip_code: token ? token.postal_code : ((_this$userProfile3 = this.userProfile) === null || _this$userProfile3 === void 0 ? void 0 : _this$userProfile3.postal_code) || '',
518
- billing_address_city: ((_this$userProfile4 = this.userProfile) === null || _this$userProfile4 === void 0 ? void 0 : _this$userProfile4.locality) || '',
519
- billing_address_state: ((_this$userProfile5 = this.userProfile) === null || _this$userProfile5 === void 0 ? void 0 : _this$userProfile5.region) || '',
520
- billing_address_country: ((_this$userProfile6 = this.userProfile) === null || _this$userProfile6 === void 0 ? void 0 : _this$userProfile6.country) || ''
513
+ billing_address_1: token ? token.address1 : this.userProfile?.address1 || '',
514
+ billing_address_2: this.userProfile?.address2 || '',
515
+ billing_address_zip_code: token ? token.postal_code : this.userProfile?.postal_code || '',
516
+ billing_address_city: this.userProfile?.locality || '',
517
+ billing_address_state: this.userProfile?.region || '',
518
+ billing_address_country: this.userProfile?.country || ''
521
519
  };
522
520
 
523
521
  if (token) {
@@ -569,8 +567,6 @@ class StripeProvider {
569
567
  stripe = null,
570
568
  zipCode = null
571
569
  }) => async dispatch => {
572
- var _this$userProfile, _this$userProfile2, _this$userProfile3, _this$userProfile4, _this$userProfile5;
573
-
574
570
  const errorHandler = (err, res) => (dispatch, state) => {
575
571
  let code = err.status;
576
572
 
@@ -600,12 +596,12 @@ class StripeProvider {
600
596
  expand: 'tickets,' + 'tickets.owner,' + 'tickets.owner.extra_questions,' + 'tickets.badge,' + 'tickets.badge.type,' + 'tickets.badge.type.access_levels,' + 'tickets.badge.type.features,' + 'tickets.ticket_type,' + 'tickets.ticket_type.taxes'
601
597
  };
602
598
  let normalizedEntity = {
603
- billing_address_1: ((_this$userProfile = this.userProfile) === null || _this$userProfile === void 0 ? void 0 : _this$userProfile.address1) || '',
604
- billing_address_2: ((_this$userProfile2 = this.userProfile) === null || _this$userProfile2 === void 0 ? void 0 : _this$userProfile2.address2) || '',
599
+ billing_address_1: this.userProfile?.address1 || '',
600
+ billing_address_2: this.userProfile?.address2 || '',
605
601
  billing_address_zip_code: zipCode,
606
- billing_address_city: ((_this$userProfile3 = this.userProfile) === null || _this$userProfile3 === void 0 ? void 0 : _this$userProfile3.locality) || '',
607
- billing_address_state: ((_this$userProfile4 = this.userProfile) === null || _this$userProfile4 === void 0 ? void 0 : _this$userProfile4.region) || '',
608
- billing_address_country: ((_this$userProfile5 = this.userProfile) === null || _this$userProfile5 === void 0 ? void 0 : _this$userProfile5.country) || ''
602
+ billing_address_city: this.userProfile?.locality || '',
603
+ billing_address_state: this.userProfile?.region || '',
604
+ billing_address_country: this.userProfile?.country || ''
609
605
  };
610
606
  dispatch(startWidgetLoading());
611
607
 
@@ -1847,7 +1843,7 @@ const StripeForm = ({
1847
1843
  color: '#3486cd'
1848
1844
  }
1849
1845
  }
1850
- }, stripeOptions === null || stripeOptions === void 0 ? void 0 : stripeOptions.style);
1846
+ }, stripeOptions?.style);
1851
1847
 
1852
1848
  const onSubmit = async data => {
1853
1849
  setStripeErrors({});
@@ -1981,7 +1977,7 @@ const stripe_component_StripeProvider = ({
1981
1977
  }) => {
1982
1978
  const stripePromise = (0,external_react_.useMemo)(() => (0,stripe_js_namespaceObject.loadStripe)(providerKey), [providerKey]);
1983
1979
  const options = {
1984
- fonts: stripeOptions === null || stripeOptions === void 0 ? void 0 : stripeOptions.fonts
1980
+ fonts: stripeOptions?.fonts
1985
1981
  };
1986
1982
  return /*#__PURE__*/external_react_default().createElement(react_stripe_js_namespaceObject.Elements, {
1987
1983
  options: options,
@@ -2144,8 +2140,6 @@ const PersonalInfoComponent = ({
2144
2140
  showCompanyInput = true,
2145
2141
  companyDDLPlaceholder
2146
2142
  }) => {
2147
- var _errors$email, _errors$email2;
2148
-
2149
2143
  const [personalInfo, setPersonalInfo] = (0,external_react_.useState)({
2150
2144
  firstName: userProfile.given_name || (invitation ? invitation.first_name : ''),
2151
2145
  lastName: userProfile.family_name || (invitation ? invitation.last_name : ''),
@@ -2289,10 +2283,10 @@ const PersonalInfoComponent = ({
2289
2283
  pattern: /^\S+@\S+$/i
2290
2284
  }), {
2291
2285
  "data-testid": "email"
2292
- }))), ((_errors$email = errors.email) === null || _errors$email === void 0 ? void 0 : _errors$email.type) === 'required' && /*#__PURE__*/external_react_default().createElement("div", {
2286
+ }))), errors.email?.type === 'required' && /*#__PURE__*/external_react_default().createElement("div", {
2293
2287
  className: personal_information_index_module.fieldError,
2294
2288
  "data-testid": "email-error-required"
2295
- }, "This field is required."), ((_errors$email2 = errors.email) === null || _errors$email2 === void 0 ? void 0 : _errors$email2.type) === 'pattern' && /*#__PURE__*/external_react_default().createElement("div", {
2289
+ }, "This field is required."), errors.email?.type === 'pattern' && /*#__PURE__*/external_react_default().createElement("div", {
2296
2290
  className: personal_information_index_module.fieldError,
2297
2291
  "data-testid": "email-error-invalid"
2298
2292
  }, "The email is invalid.")), showCompanyInput && /*#__PURE__*/external_react_default().createElement("div", {
@@ -2499,9 +2493,7 @@ const TicketTypeComponent = ({
2499
2493
  }
2500
2494
  });
2501
2495
  (0,external_react_.useEffect)(() => {
2502
- var _reservation$tickets;
2503
-
2504
- if (reservation && ((_reservation$tickets = reservation.tickets) === null || _reservation$tickets === void 0 ? void 0 : _reservation$tickets.length) > 0) {
2496
+ if (reservation && reservation.tickets?.length > 0) {
2505
2497
  setTicket(ticketTypes.find(t => t.id === reservation.tickets[0].ticket_type_id));
2506
2498
  }
2507
2499
  }, []);
@@ -2531,7 +2523,7 @@ const TicketTypeComponent = ({
2531
2523
  className: ticket_type_index_module.summary
2532
2524
  }, /*#__PURE__*/external_react_default().createElement("span", null, ticket && /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, null, `${ticket.name} (${quantity}): ${formatCurrency(ticket.cost * quantity, {
2533
2525
  currency: ticket.currency
2534
- })} ${ticket.currency}`, !isActive && (reservation === null || reservation === void 0 ? void 0 : reservation.discount_amount) > 0 && /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, null, /*#__PURE__*/external_react_default().createElement("br", null), /*#__PURE__*/external_react_default().createElement("span", {
2526
+ })} ${ticket.currency}`, !isActive && reservation?.discount_amount > 0 && /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, null, /*#__PURE__*/external_react_default().createElement("br", null), /*#__PURE__*/external_react_default().createElement("span", {
2535
2527
  className: ticket_type_index_module.promoCode
2536
2528
  }, "Promo code\xA0", /*#__PURE__*/external_react_default().createElement("abbr", {
2537
2529
  title: reservation.promo_code
@@ -2541,7 +2533,7 @@ const TicketTypeComponent = ({
2541
2533
  currency: ticket.currency
2542
2534
  })} ${ticket.currency}`)), !isActive && reservation && /*#__PURE__*/external_react_default().createElement("span", {
2543
2535
  className: ticket_type_index_module.promo
2544
- }, "Subtotal: ", `${ticket === null || ticket === void 0 ? void 0 : ticket.currency_symbol} ${(((reservation === null || reservation === void 0 ? void 0 : reservation.raw_amount_in_cents) - (reservation === null || reservation === void 0 ? void 0 : reservation.discount_amount_in_cents)) / 100).toFixed(2)} ${ticket === null || ticket === void 0 ? void 0 : ticket.currency}`), !isActive && (reservation === null || reservation === void 0 ? void 0 : reservation.taxes_amount) > 0 && /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, null, reservation === null || reservation === void 0 ? void 0 : reservation.applied_taxes.map(tax => {
2536
+ }, "Subtotal: ", `${ticket?.currency_symbol} ${((reservation?.raw_amount_in_cents - reservation?.discount_amount_in_cents) / 100).toFixed(2)} ${ticket?.currency}`), !isActive && reservation?.taxes_amount > 0 && /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, null, reservation?.applied_taxes.map(tax => {
2545
2537
  return /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, {
2546
2538
  key: tax.id
2547
2539
  }, /*#__PURE__*/external_react_default().createElement("span", {
@@ -2663,11 +2655,11 @@ const ButtonBarComponent = ({
2663
2655
  disabled: !ticketType,
2664
2656
  className: `${button_bar_index_module.button} button`,
2665
2657
  onClick: () => changeStep(step + 1)
2666
- }, nextButtonText), step === 1 && (ticketType === null || ticketType === void 0 ? void 0 : ticketType.cost) === 0 && /*#__PURE__*/external_react_default().createElement("button", {
2658
+ }, nextButtonText), step === 1 && ticketType?.cost === 0 && /*#__PURE__*/external_react_default().createElement("button", {
2667
2659
  className: `${button_bar_index_module.button} button`,
2668
2660
  type: "submit",
2669
2661
  form: "personal-info-form"
2670
- }, "Get Ticket"), step === 1 && (ticketType === null || ticketType === void 0 ? void 0 : ticketType.cost) > 0 && /*#__PURE__*/external_react_default().createElement("button", {
2662
+ }, "Get Ticket"), step === 1 && ticketType?.cost > 0 && /*#__PURE__*/external_react_default().createElement("button", {
2671
2663
  className: `${button_bar_index_module.button} button`,
2672
2664
  type: "submit",
2673
2665
  form: "personal-info-form"
@@ -2711,10 +2703,8 @@ const getCurrentProvider = summit => {
2711
2703
  };
2712
2704
  };
2713
2705
  const ticketHasAccessLevel = (ticket, accessLevel) => {
2714
- var _ticket$badge, _ticket$badge$type;
2715
-
2716
2706
  if (!ticket) return false;
2717
- return (_ticket$badge = ticket.badge) === null || _ticket$badge === void 0 ? void 0 : (_ticket$badge$type = _ticket$badge.type) === null || _ticket$badge$type === void 0 ? void 0 : _ticket$badge$type.access_levels.map(al => al.name).includes(accessLevel);
2707
+ return ticket.badge?.type?.access_levels.map(al => al.name).includes(accessLevel);
2718
2708
  };
2719
2709
  const getCurrentUserLanguage = () => {
2720
2710
  let language = 'en';
@@ -2726,7 +2716,7 @@ const getCurrentUserLanguage = () => {
2726
2716
  return language;
2727
2717
  };
2728
2718
  const isEmptyString = val => {
2729
- return typeof val === 'string' && val.trim().length > 0;
2719
+ return typeof val === 'string' && val.trim().length == 0;
2730
2720
  };
2731
2721
  ;// CONCATENATED MODULE: ./src/utils/constants.js
2732
2722
  /**
@@ -2816,11 +2806,7 @@ const PurchaseComplete = _ref2 => {
2816
2806
  onPurchaseComplete(checkout);
2817
2807
  }, []);
2818
2808
  const isActive = (0,external_react_.useMemo)(() => summit.start_date <= nowUtc && summit.end_date >= nowUtc, [summit, nowUtc]);
2819
- const currentUserTicket = (0,external_react_.useMemo)(() => checkout === null || checkout === void 0 ? void 0 : checkout.tickets.find(t => {
2820
- var _t$owner;
2821
-
2822
- return (t === null || t === void 0 ? void 0 : (_t$owner = t.owner) === null || _t$owner === void 0 ? void 0 : _t$owner.email) == (user === null || user === void 0 ? void 0 : user.email);
2823
- }), [user]);
2809
+ const currentUserTicket = (0,external_react_.useMemo)(() => checkout?.tickets.find(t => t?.owner?.email == user?.email), [user]);
2824
2810
  const requireExtraQuestions = (0,external_react_.useMemo)(() => completedExtraQuestions(checkout), [user]);
2825
2811
 
2826
2812
  const _hasVirtualAccessLevel = hasVirtualAccessLevel || currentUserTicket && ticketHasAccessLevel(currentUserTicket, VirtualAccessLevel);
@@ -2831,10 +2817,10 @@ const PurchaseComplete = _ref2 => {
2831
2817
  };
2832
2818
  if (!checkout) return null;
2833
2819
  let orderCompleteButtonText = currentUserTicket && requireExtraQuestions ? rest.hasOwnProperty('initialOrderCompleteButton') && !isEmptyString(rest.initialOrderCompleteButton) ? rest.initialOrderCompleteButton : external_i18n_react_default().translate('purchase_complete_step.initial_order_complete_button') : rest.hasOwnProperty('orderCompleteButton') && !isEmptyString(rest.orderCompleteButton) ? rest.orderCompleteButton : external_i18n_react_default().translate('purchase_complete_step.order_complete_button');
2834
- let orderComplete1stParagraph = currentUserTicket ? rest.hasOwnProperty('initialOrderComplete1stParagraph') && !isEmptyString(rest.initialOrderComplete1stParagraph) ? rest.initialOrderComplete1stParagraph : external_i18n_react_default().translate('purchase_complete_step.initial_order_complete_1st_paragraph_label', {
2820
+ let orderComplete1stParagraph = currentUserTicket ? rest.hasOwnProperty('initialOrderComplete1stParagraph') && typeof rest.initialOrderComplete1stParagraph !== 'undefined' ? rest.initialOrderComplete1stParagraph : external_i18n_react_default().translate('purchase_complete_step.initial_order_complete_1st_paragraph_label', {
2835
2821
  button: orderCompleteButtonText
2836
- }) : rest.hasOwnProperty('orderComplete1stParagraph') && !isEmptyString(rest.orderComplete1stParagraph) ? rest.orderComplete1stParagraph : external_i18n_react_default().translate('purchase_complete_step.order_complete_1st_paragraph_label');
2837
- let orderComplete2ndParagraph = currentUserTicket ? rest.hasOwnProperty('initialOrderComplete2ndParagraph') && !isEmptyString(rest.initialOrderComplete2ndParagraph) ? rest.initialOrderComplete2ndParagraph : external_i18n_react_default().translate('purchase_complete_step.initial_order_footer_label') : rest.hasOwnProperty('orderComplete2ndParagraph') && !isEmptyString(rest.orderComplete2ndParagraph) ? rest.orderComplete2ndParagraph : '';
2822
+ }) : rest.hasOwnProperty('orderComplete1stParagraph') && typeof rest.orderComplete1stParagraph !== 'undefined' ? rest.orderComplete1stParagraph : external_i18n_react_default().translate('purchase_complete_step.order_complete_1st_paragraph_label');
2823
+ let orderComplete2ndParagraph = currentUserTicket ? rest.hasOwnProperty('initialOrderComplete2ndParagraph') && typeof rest.initialOrderComplete2ndParagraph !== 'undefined' ? rest.initialOrderComplete2ndParagraph : external_i18n_react_default().translate('purchase_complete_step.initial_order_footer_label') : rest.hasOwnProperty('orderComplete2ndParagraph') && typeof rest.orderComplete2ndParagraph !== 'undefined' ? rest.orderComplete2ndParagraph : '';
2838
2824
  let footerHasTicketText = `${orderComplete2ndParagraph} ${external_i18n_react_default().translate('purchase_complete_step.footer_assistance_text', {
2839
2825
  supportEmail: `${supportEmail}`
2840
2826
  })}`;
@@ -3046,8 +3032,6 @@ try {
3046
3032
  }
3047
3033
 
3048
3034
  const RegistrationLite = _ref => {
3049
- var _formValues$ticketTyp, _formValues$ticketTyp2;
3050
-
3051
3035
  let {
3052
3036
  loadSession,
3053
3037
  setMarketingSettings,
@@ -3156,10 +3140,8 @@ const RegistrationLite = _ref => {
3156
3140
  }
3157
3141
  }, [summitData, profileData]);
3158
3142
  (0,external_react_.useEffect)(() => {
3159
- var _registrationForm$val;
3160
-
3161
3143
  // check if there's personal information data and no ticket data to reset widget
3162
- if (step > 0 && !((_registrationForm$val = registrationForm.values) !== null && _registrationForm$val !== void 0 && _registrationForm$val.ticketType)) {
3144
+ if (step > 0 && !registrationForm.values?.ticketType) {
3163
3145
  changeStep(0);
3164
3146
  }
3165
3147
  }, [registrationForm.values, step]);
@@ -3174,8 +3156,8 @@ const RegistrationLite = _ref => {
3174
3156
  bounce: 0
3175
3157
  }, external_react_spring_namespaceObject.config.stiff),
3176
3158
  to: {
3177
- opacity: (formValues === null || formValues === void 0 ? void 0 : (_formValues$ticketTyp = formValues.ticketType) === null || _formValues$ticketTyp === void 0 ? void 0 : _formValues$ticketTyp.cost) === 0 ? 0 : 1,
3178
- height: (formValues === null || formValues === void 0 ? void 0 : (_formValues$ticketTyp2 = formValues.ticketType) === null || _formValues$ticketTyp2 === void 0 ? void 0 : _formValues$ticketTyp2.cost) === 0 ? 0 : height
3159
+ opacity: formValues?.ticketType?.cost === 0 ? 0 : 1,
3160
+ height: formValues?.ticketType?.cost === 0 ? 0 : height
3179
3161
  }
3180
3162
  });
3181
3163
 
@@ -3249,8 +3231,8 @@ const RegistrationLite = _ref => {
3249
3231
  onClick: handleCloseClick
3250
3232
  })), ticketTaxesError && profileData && /*#__PURE__*/external_react_default().createElement(ticket_taxes_error, {
3251
3233
  ticketTaxesErrorMessage: ticketTaxesErrorMessage,
3252
- retryTicketTaxes: () => handleGetTicketTypesAndTaxes(summitData === null || summitData === void 0 ? void 0 : summitData.id)
3253
- }), !ticketTaxesError && profileData && allowedTicketTypes.length === 0 && requestedTicketTypes && /*#__PURE__*/external_react_default().createElement(no_allowed_tickets, {
3234
+ retryTicketTaxes: () => handleGetTicketTypesAndTaxes(summitData?.id)
3235
+ }), !ticketTaxesError && profileData && allowedTicketTypes.length === 0 && requestedTicketTypes && step !== 3 && /*#__PURE__*/external_react_default().createElement(no_allowed_tickets, {
3254
3236
  noAllowedTicketsMessage: noAllowedTicketsMessage
3255
3237
  }), !ticketTaxesError && /*#__PURE__*/external_react_default().createElement("div", {
3256
3238
  className: general_module.stepsWrapper
@@ -3288,16 +3270,14 @@ const RegistrationLite = _ref => {
3288
3270
  invitation: invitation,
3289
3271
  summitId: summitData.id,
3290
3272
  changeForm: personalInformation => {
3291
- var _registrationForm$val2, _registrationForm$val3;
3292
-
3293
3273
  setFormValues(registration_lite_objectSpread(registration_lite_objectSpread({}, registrationForm.values), {}, {
3294
3274
  personalInformation
3295
3275
  }));
3296
3276
  reserveTicket({
3297
3277
  provider,
3298
3278
  personalInformation: personalInformation,
3299
- ticket: (_registrationForm$val2 = registrationForm.values) === null || _registrationForm$val2 === void 0 ? void 0 : _registrationForm$val2.ticketType,
3300
- ticketQuantity: (_registrationForm$val3 = registrationForm.values) === null || _registrationForm$val3 === void 0 ? void 0 : _registrationForm$val3.ticketQuantity
3279
+ ticket: registrationForm.values?.ticketType,
3280
+ ticketQuantity: registrationForm.values?.ticketQuantity
3301
3281
  }, {
3302
3282
  onError: (err, res) => setFormErrors(res.body.errors)
3303
3283
  }).catch(error => {