summit-registration-lite 2.0.20 → 3.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.
Files changed (2) hide show
  1. package/dist/index.js +94 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -377,6 +377,8 @@ const SET_PASSWORDLESS_LOGIN = 'SET_PASSWORDLESS_LOGIN';
377
377
  const SET_PASSWORDLESS_LENGTH = 'SET_PASSWORDLESS_LENGTH';
378
378
  const SET_PASSWORDLESS_ERROR = 'SET_PASSWORDLESS_ERROR';
379
379
  const GO_TO_LOGIN = 'GO_TO_LOGIN';
380
+ const GET_MY_INVITATION = 'GET_MY_INVITATION';
381
+ const CLEAR_MY_INVITATION = 'CLEAR_MY_INVITATION';
380
382
  const startWidgetLoading = (0,actions_namespaceObject.createAction)(START_WIDGET_LOADING);
381
383
  const stopWidgetLoading = (0,actions_namespaceObject.createAction)(STOP_WIDGET_LOADING);
382
384
  const loadSession = settings => dispatch => {
@@ -387,7 +389,7 @@ const loadSession = settings => dispatch => {
387
389
  /* TICKETS */
388
390
 
389
391
  /*********************************************************************************/
390
- // api/v1/summits/{id}/ticket-types
392
+ // api/v1/summits/{id}/ticket-types/allowed
391
393
  // api/v1/summits/{id}/tax-types
392
394
 
393
395
  const getTicketTypes = summitId => async (dispatch, getState, {
@@ -401,7 +403,7 @@ const getTicketTypes = summitId => async (dispatch, getState, {
401
403
  access_token: accessToken
402
404
  };
403
405
  dispatch(startWidgetLoading());
404
- return (0,actions_namespaceObject.getRequest)(null, (0,actions_namespaceObject.createAction)(GET_TICKET_TYPES), `${apiBaseUrl}/api/v1/summits/${summitId}/ticket-types`, actions_namespaceObject.authErrorHandler)(params)(dispatch).then(() => {
406
+ return (0,actions_namespaceObject.getRequest)(null, (0,actions_namespaceObject.createAction)(GET_TICKET_TYPES), `${apiBaseUrl}/api/v1/summits/${summitId}/ticket-types/allowed`, actions_namespaceObject.authErrorHandler)(params)(dispatch).then(() => {
405
407
  dispatch(stopWidgetLoading());
406
408
  });
407
409
  } catch (e) {
@@ -628,6 +630,45 @@ const normalizeReservation = entity => {
628
630
 
629
631
  return normalizedEntity;
630
632
  };
633
+ /**
634
+ *
635
+ * @param summitId
636
+ * @returns {(function(*=, *, {apiBaseUrl: *, getAccessToken: *}): Promise<*|undefined>)|*}
637
+ */
638
+
639
+
640
+ const getMyInvitation = summitId => async (dispatch, getState, {
641
+ apiBaseUrl,
642
+ getAccessToken
643
+ }) => {
644
+ const errorHandler = (err, res) => (dispatch, state) => {
645
+ if (res && res.statusCode === 404) {
646
+ // bypass
647
+ return;
648
+ }
649
+
650
+ if (res && res.statusCode === 500) {
651
+ const msg = res.body.message;
652
+ external_sweetalert2_default().fire("Server Error", msg, "error");
653
+ return;
654
+ }
655
+
656
+ return (0,actions_namespaceObject.authErrorHandler)(err, res)(dispatch, state);
657
+ };
658
+
659
+ try {
660
+ const accessToken = await getAccessToken();
661
+ let params = {
662
+ access_token: accessToken
663
+ };
664
+ dispatch(startWidgetLoading());
665
+ return (0,actions_namespaceObject.getRequest)((0,actions_namespaceObject.createAction)(CLEAR_MY_INVITATION), (0,actions_namespaceObject.createAction)(GET_MY_INVITATION), `${apiBaseUrl}/api/v1/summits/${summitId}/registration-invitations/me`, errorHandler)(params)(dispatch).then(() => {
666
+ dispatch(stopWidgetLoading());
667
+ });
668
+ } catch (e) {
669
+ return Promise.reject();
670
+ }
671
+ };
631
672
  ;// CONCATENATED MODULE: ./src/reducer.js
632
673
  function reducer_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
633
674
 
@@ -661,6 +702,7 @@ const DEFAULT_STATE = {
661
702
  },
662
703
  ticketTypes: [],
663
704
  taxTypes: [],
705
+ invitation: null,
664
706
  settings: {
665
707
  apiBaseUrl: null,
666
708
  summitId: null,
@@ -706,6 +748,7 @@ const RegistrationLiteReducer = (state = DEFAULT_STATE, action) => {
706
748
  return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
707
749
  reservation: null,
708
750
  checkout: null,
751
+ invitation: null,
709
752
  passwordless: reducer_objectSpread({}, DEFAULT_STATE.passwordless),
710
753
  settings: reducer_objectSpread(reducer_objectSpread({}, DEFAULT_STATE.settings), {}, {
711
754
  marketingData: marketingData,
@@ -804,7 +847,22 @@ const RegistrationLiteReducer = (state = DEFAULT_STATE, action) => {
804
847
  return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
805
848
  checkout: payload.response,
806
849
  reservation: null,
807
- userProfile: null
850
+ userProfile: null,
851
+ invitation: null
852
+ });
853
+ }
854
+
855
+ case GET_MY_INVITATION:
856
+ {
857
+ return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
858
+ invitation: payload.response
859
+ });
860
+ }
861
+
862
+ case CLEAR_MY_INVITATION:
863
+ {
864
+ return reducer_objectSpread(reducer_objectSpread({}, state), {}, {
865
+ invitation: null
808
866
  });
809
867
  }
810
868
 
@@ -864,6 +922,9 @@ const getPersistor = () => {
864
922
  };
865
923
  ;// CONCATENATED MODULE: external "redux-persist/integration/react"
866
924
  const react_namespaceObject = require("redux-persist/integration/react");
925
+ ;// CONCATENATED MODULE: external "prop-types"
926
+ const external_prop_types_namespaceObject = require("prop-types");
927
+ var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
867
928
  ;// CONCATENATED MODULE: external "react-spring"
868
929
  const external_react_spring_namespaceObject = require("react-spring");
869
930
  ;// CONCATENATED MODULE: external "react-use"
@@ -899,9 +960,10 @@ const LoginComponent = ({
899
960
  allowsNativeAuth,
900
961
  allowsOtpAuthlogin,
901
962
  getLoginCode,
902
- getPasswordlessCode
963
+ getPasswordlessCode,
964
+ initialEmailValue = ''
903
965
  }) => {
904
- const [email, setEmail] = (0,external_react_namespaceObject.useState)('');
966
+ const [email, setEmail] = (0,external_react_namespaceObject.useState)(initialEmailValue);
905
967
  const [emailError, setEmailError] = (0,external_react_namespaceObject.useState)();
906
968
 
907
969
  const isValidEmail = email => {
@@ -982,8 +1044,6 @@ const LoginComponent = ({
982
1044
  };
983
1045
 
984
1046
  /* harmony default export */ const login = (LoginComponent);
985
- ;// CONCATENATED MODULE: external "prop-types"
986
- const external_prop_types_namespaceObject = require("prop-types");
987
1047
  ;// CONCATENATED MODULE: ./src/components/payment/index.module.scss
988
1048
  // extracted by mini-css-extract-plugin
989
1049
  /* harmony default export */ const payment_index_module = ({"title":"title___LksVm","form":"form___v5GIx","fieldWrapper":"fieldWrapper___Eoe61"});
@@ -1663,13 +1723,14 @@ const PersonalInfoComponent = ({
1663
1723
  summitId,
1664
1724
  handleCompanyError,
1665
1725
  formValues,
1666
- formErrors
1726
+ formErrors,
1727
+ invitation
1667
1728
  }) => {
1668
1729
  var _errors$email, _errors$email2;
1669
1730
 
1670
1731
  const [personalInfo, setPersonalInfo] = (0,external_react_namespaceObject.useState)({
1671
- firstName: userProfile.given_name || '',
1672
- lastName: userProfile.family_name || '',
1732
+ firstName: userProfile.given_name || (invitation ? invitation.first_name : ''),
1733
+ lastName: userProfile.family_name || (invitation ? invitation.last_name : ''),
1673
1734
  email: userProfile.email || '',
1674
1735
  company: {
1675
1736
  id: null,
@@ -2415,7 +2476,7 @@ const getCurrentProvider = summit => {
2415
2476
  };
2416
2477
  };
2417
2478
  ;// CONCATENATED MODULE: ./src/components/registration-lite.js
2418
- const registration_lite_excluded = ["loadSession", "setMarketingSettings", "changeStep", "removeReservedTicket", "reserveTicket", "payTicketWithProvider", "onPurchaseComplete", "getTicketTypes", "getTaxesTypes", "getLoginCode", "passwordlessLogin", "goToLogin", "loginOptions", "allowsNativeAuth", "allowsOtpAuth", "reservation", "checkout", "ticketTypes", "taxTypes", "step", "passwordlessCodeSent", "passwordlessEmail", "passwordlessCode", "getPasswordlessCode", "passwordlessCodeError", "loginWithCode", "goToExtraQuestions", "goToEvent", "goToRegistration", "profileData", "summitData", "supportEmail", "ticketOwned", "ownedTickets", "widgetLoading", "loading", "inPersonDisclaimer", "userProfile", "handleCompanyError", "stripeOptions"];
2479
+ const registration_lite_excluded = ["loadSession", "setMarketingSettings", "changeStep", "removeReservedTicket", "reserveTicket", "payTicketWithProvider", "onPurchaseComplete", "getTicketTypes", "getTaxesTypes", "getLoginCode", "passwordlessLogin", "goToLogin", "loginOptions", "allowsNativeAuth", "allowsOtpAuth", "reservation", "checkout", "ticketTypes", "taxTypes", "step", "passwordlessCodeSent", "passwordlessEmail", "passwordlessCode", "getPasswordlessCode", "passwordlessCodeError", "loginWithCode", "goToExtraQuestions", "goToEvent", "goToRegistration", "profileData", "summitData", "supportEmail", "ticketOwned", "ownedTickets", "widgetLoading", "loading", "inPersonDisclaimer", "userProfile", "handleCompanyError", "stripeOptions", "invitation", "loginInitialEmailInputValue", "getMyInvitation"];
2419
2480
 
2420
2481
  function registration_lite_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2421
2482
 
@@ -2457,6 +2518,7 @@ function registration_lite_objectWithoutPropertiesLoose(source, excluded) { if (
2457
2518
 
2458
2519
 
2459
2520
 
2521
+
2460
2522
  const RegistrationLite = _ref => {
2461
2523
  var _formValues$ticketTyp, _formValues$ticketTyp2;
2462
2524
 
@@ -2500,7 +2562,10 @@ const RegistrationLite = _ref => {
2500
2562
  inPersonDisclaimer,
2501
2563
  userProfile,
2502
2564
  handleCompanyError,
2503
- stripeOptions
2565
+ stripeOptions,
2566
+ invitation,
2567
+ loginInitialEmailInputValue,
2568
+ getMyInvitation
2504
2569
  } = _ref,
2505
2570
  rest = registration_lite_objectWithoutProperties(_ref, registration_lite_excluded);
2506
2571
 
@@ -2545,6 +2610,11 @@ const RegistrationLite = _ref => {
2545
2610
  getTicketTypes(summitData.id).then(() => getTaxesTypes(summitData.id));
2546
2611
  }
2547
2612
  }, [summitData, profileData]);
2613
+ (0,external_react_namespaceObject.useEffect)(() => {
2614
+ if (summitData && profileData) {
2615
+ getMyInvitation(summitData.id).catch(e => console.log(e));
2616
+ }
2617
+ }, [summitData, profileData]);
2548
2618
  (0,external_react_namespaceObject.useEffect)(() => {
2549
2619
  if (step === 1 && formValues !== null && formValues !== void 0 && formValues.ticketType && formValues !== null && formValues !== void 0 && formValues.personalInformation) {
2550
2620
  reserveTicket({
@@ -2614,7 +2684,8 @@ const RegistrationLite = _ref => {
2614
2684
  allowsOtpAuth: allowsOtpAuth,
2615
2685
  login: provider => rest.authUser(provider),
2616
2686
  getLoginCode: getLoginCode,
2617
- getPasswordlessCode: getPasswordlessCode
2687
+ getPasswordlessCode: getPasswordlessCode,
2688
+ initialEmailValue: loginInitialEmailInputValue
2618
2689
  }), !profileData && passwordlessCodeSent && /*#__PURE__*/external_react_default().createElement(login_passwordless, {
2619
2690
  codeLength: passwordlessCode,
2620
2691
  email: passwordlessEmail,
@@ -2638,6 +2709,7 @@ const RegistrationLite = _ref => {
2638
2709
  isActive: step === 1,
2639
2710
  reservation: reservation,
2640
2711
  userProfile: profileData,
2712
+ invitation: invitation,
2641
2713
  summitId: summitData.id,
2642
2714
  changeForm: personalInformation => setFormValues(registration_lite_objectSpread(registration_lite_objectSpread({}, formValues), {}, {
2643
2715
  personalInformation
@@ -2679,6 +2751,7 @@ const registration_lite_mapStateToProps = ({
2679
2751
  }) => ({
2680
2752
  widgetLoading: registrationLiteState.widgetLoading,
2681
2753
  reservation: registrationLiteState.reservation,
2754
+ invitation: registrationLiteState.invitation,
2682
2755
  userProfile: registrationLiteState.settings.userProfile,
2683
2756
  checkout: registrationLiteState.checkout,
2684
2757
  ticketTypes: registrationLiteState.ticketTypes,
@@ -2690,6 +2763,12 @@ const registration_lite_mapStateToProps = ({
2690
2763
  passwordlessCodeError: registrationLiteState.passwordless.error
2691
2764
  });
2692
2765
 
2766
+ RegistrationLite.defaultProps = {
2767
+ loginInitialEmailInputValue: ''
2768
+ };
2769
+ RegistrationLite.propTypes = {
2770
+ loginInitialEmailInputValue: (external_prop_types_default()).string
2771
+ };
2693
2772
  /* harmony default export */ const registration_lite = ((0,external_react_redux_namespaceObject.connect)(registration_lite_mapStateToProps, {
2694
2773
  loadSession: loadSession,
2695
2774
  changeStep: changeStep,
@@ -2700,7 +2779,8 @@ const registration_lite_mapStateToProps = ({
2700
2779
  getTaxesTypes: getTaxesTypes,
2701
2780
  getLoginCode: getLoginCode,
2702
2781
  passwordlessLogin: passwordlessLogin,
2703
- goToLogin: goToLogin
2782
+ goToLogin: goToLogin,
2783
+ getMyInvitation: getMyInvitation
2704
2784
  })(RegistrationLite));
2705
2785
  ;// CONCATENATED MODULE: ./src/summit-registration-lite.js
2706
2786
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "summit-registration-lite",
3
- "version": "2.0.20",
3
+ "version": "3.0.2",
4
4
  "description": "Summit Registration Lite",
5
5
  "main": "index.js",
6
6
  "scripts": {