@pelcro/react-pelcro-js 3.26.0-beta.65 → 3.26.0-beta.67

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.cjs.js CHANGED
@@ -7647,6 +7647,7 @@ function _defineProperty$3(obj, key, value) {
7647
7647
  return obj;
7648
7648
  }
7649
7649
 
7650
+ /* eslint-disable valid-jsdoc */
7650
7651
  // Polyfill
7651
7652
  (() => {
7652
7653
  if (typeof window.CustomEvent === "function") return false;
@@ -7678,6 +7679,17 @@ const cartItemAdded = detail => createCustomEvent("PelcroElementsCartItemAdded",
7678
7679
  * Should fire when an item removed from the cart and expects the removed item to be sent
7679
7680
  */
7680
7681
  const cartItemRemoved = detail => createCustomEvent("PelcroElementsCartItemRemoved", detail);
7682
+ const displayLogin = detail => createCustomEvent("PelcroLoginDisplayed", detail);
7683
+ const displayRegister = detail => createCustomEvent("PelcroRegisterDisplayed", detail);
7684
+ const displaySelect = detail => createCustomEvent("PelcroSelectDisplayed", detail);
7685
+ const displayAddressCreate = detail => createCustomEvent("PelcroAddressCreateDisplayed", detail);
7686
+ const displayPaymentForm = detail => createCustomEvent("PelcroPaymentFormDisplayed", detail);
7687
+ const submitLogin = detail => createCustomEvent("PelcroLoginSubmitted", detail);
7688
+ const submitRegister = detail => createCustomEvent("PelcroRegisterSubmitted", detail);
7689
+ const submitSelect = detail => createCustomEvent("PelcroSelectSubmitted", detail);
7690
+ const submitAddressCreate = detail => createCustomEvent("PelcroAddressCreateSubmitted", detail);
7691
+ const submitAddressSelect = detail => createCustomEvent("PelcroAddressSelectSubmitted", detail);
7692
+ const submitPaymentForm = detail => createCustomEvent("PelcroPaymentFormSubmitted", detail);
7681
7693
 
7682
7694
  /**
7683
7695
  * Check if the browser support custom events
@@ -13119,8 +13131,14 @@ const LoginContainer = _ref => {
13119
13131
  content: getErrorMessages(err)
13120
13132
  }
13121
13133
  });
13134
+ document.dispatchEvent(submitLogin({
13135
+ submissionSuccess: false
13136
+ }));
13122
13137
  onFailure(err);
13123
13138
  } else {
13139
+ document.dispatchEvent(submitLogin({
13140
+ submissionSuccess: true
13141
+ }));
13124
13142
  onSuccess(res);
13125
13143
  if (enableReactGA4) {
13126
13144
  ReactGA4.event("Logged in", {
@@ -13801,8 +13819,14 @@ const RegisterContainer = _ref => {
13801
13819
  content: getErrorMessages(err)
13802
13820
  }
13803
13821
  });
13822
+ document.dispatchEvent(submitRegister({
13823
+ submissionSuccess: false
13824
+ }));
13804
13825
  onFailure(err);
13805
13826
  } else {
13827
+ document.dispatchEvent(submitRegister({
13828
+ submissionSuccess: true
13829
+ }));
13806
13830
  onSuccess(res);
13807
13831
  }
13808
13832
  });
@@ -14632,6 +14656,12 @@ function LoginModal(_ref) {
14632
14656
  const onPasswordlessRequest = () => {
14633
14657
  switchView("passwordless-request");
14634
14658
  };
14659
+ React.useEffect(() => {
14660
+ document.dispatchEvent(displayLogin({
14661
+ product,
14662
+ plan
14663
+ }));
14664
+ }, []);
14635
14665
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
14636
14666
  id: "pelcro-login-modal",
14637
14667
  onDisplay: onDisplay,
@@ -15248,6 +15278,12 @@ function RegisterModal(props) {
15248
15278
  }
15249
15279
  return resetView();
15250
15280
  };
15281
+ React.useEffect(() => {
15282
+ document.dispatchEvent(displayRegister({
15283
+ product,
15284
+ plan
15285
+ }));
15286
+ }, []);
15251
15287
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
15252
15288
  id: "pelcro-register-modal",
15253
15289
  onDisplay: props === null || props === void 0 ? void 0 : props.onDisplay,
@@ -15320,6 +15356,12 @@ function SelectModalWithHook(props) {
15320
15356
  } = usePelcro();
15321
15357
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
15322
15358
  const entitlements = entitlementsProtectedElements.length > 0 ? getEntitlementsFromElem(entitlementsProtectedElements[0]) : null;
15359
+ React.useEffect(() => {
15360
+ document.dispatchEvent(displaySelect({
15361
+ product,
15362
+ plan
15363
+ }));
15364
+ }, []);
15323
15365
  return /*#__PURE__*/React__default['default'].createElement(SelectModalWithTrans, {
15324
15366
  isGift: isGift,
15325
15367
  disableGifting: isRenewingGift,
@@ -15605,7 +15647,8 @@ class SelectModal extends React.Component {
15605
15647
  this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift);
15606
15648
  const {
15607
15649
  product,
15608
- isGift
15650
+ isGift,
15651
+ plan
15609
15652
  } = this.state;
15610
15653
  const {
15611
15654
  setView
@@ -15615,6 +15658,11 @@ class SelectModal extends React.Component {
15615
15658
  switchToAddressView,
15616
15659
  switchToPaymentView
15617
15660
  } = usePelcro.getStore();
15661
+ document.dispatchEvent(submitSelect({
15662
+ submissionSuccess: true,
15663
+ product,
15664
+ plan
15665
+ }));
15618
15666
  if (!isAuthenticated) {
15619
15667
  return setView("register");
15620
15668
  }
@@ -23079,7 +23127,7 @@ function PaymentMethodUpdateSetDefault(props) {
23079
23127
  paymentMethodToEdit
23080
23128
  } = usePelcro();
23081
23129
  React.useEffect(() => {
23082
- if (paymentMethodToEdit !== null && paymentMethodToEdit !== void 0 && paymentMethodToEdit.is_default) {
23130
+ if (paymentMethodToEdit !== null && paymentMethodToEdit !== void 0 && paymentMethodToEdit.is_default || props !== null && props !== void 0 && props.paymentMethodDefaultChecked) {
23083
23131
  dispatch({
23084
23132
  type: SET_IS_DEFAULT_PAYMENT_METHOD,
23085
23133
  payload: {
@@ -23087,7 +23135,7 @@ function PaymentMethodUpdateSetDefault(props) {
23087
23135
  }
23088
23136
  });
23089
23137
  }
23090
- }, [paymentMethodToEdit]); // eslint-disable-line react-hooks/exhaustive-deps
23138
+ }, [paymentMethodToEdit, props === null || props === void 0 ? void 0 : props.paymentMethodDefaultChecked]); // eslint-disable-line react-hooks/exhaustive-deps
23091
23139
 
23092
23140
  const handleCheckboxChange = e => {
23093
23141
  dispatch({
@@ -23121,7 +23169,8 @@ function PaymentMethodView(_ref) {
23121
23169
  showOrderButton,
23122
23170
  showApplePayButton,
23123
23171
  order,
23124
- subCreateMetadata
23172
+ subCreateMetadata,
23173
+ ...props
23125
23174
  } = _ref;
23126
23175
  const {
23127
23176
  t
@@ -23196,10 +23245,10 @@ function PaymentMethodView(_ref) {
23196
23245
  type: type
23197
23246
  }), showCoupon && /*#__PURE__*/React__default['default'].createElement("div", {
23198
23247
  className: "plc-mb-2"
23199
- }, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement(TaxAmount, null), type === "updatePaymentSource" && /*#__PURE__*/React__default['default'].createElement(PaymentMethodUpdateSetDefault, {
23248
+ }, /*#__PURE__*/React__default['default'].createElement(CouponCode, null), /*#__PURE__*/React__default['default'].createElement(DiscountedPrice, null)), /*#__PURE__*/React__default['default'].createElement(TaxAmount, null), type === "updatePaymentSource" && /*#__PURE__*/React__default['default'].createElement(PaymentMethodUpdateSetDefault, Object.assign({
23200
23249
  id: "pelcro-input-is-default",
23201
23250
  label: t("labels.isDefault")
23202
- }), /*#__PURE__*/React__default['default'].createElement("div", {
23251
+ }, props)), /*#__PURE__*/React__default['default'].createElement("div", {
23203
23252
  className: "plc-grid plc-mt-4 plc-gap-y-2"
23204
23253
  }, /*#__PURE__*/React__default['default'].createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(PaypalSubscribeButton, null)) : null, showApplePayButton && supportsVantiv ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(ApplePayButton, null)) : null)))));
23205
23254
  }
@@ -24811,20 +24860,37 @@ function SubscriptionCreateModal(_ref) {
24811
24860
  } = _ref;
24812
24861
  useTranslation("common");
24813
24862
  const {
24814
- switchView
24863
+ switchView,
24864
+ product,
24865
+ plan
24815
24866
  } = usePelcro();
24816
24867
  const onSuccess = res => {
24817
24868
  var _otherProps$onSuccess;
24818
24869
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
24819
24870
  trackSubscriptionOnGA();
24871
+ document.dispatchEvent(submitPaymentForm({
24872
+ submissionSuccess: true
24873
+ }));
24820
24874
  return switchView("subscription-success");
24821
24875
  };
24876
+ const onFailure = () => {
24877
+ return document.dispatchEvent(submitPaymentForm({
24878
+ submissionSuccess: false
24879
+ }));
24880
+ };
24881
+ React.useEffect(() => {
24882
+ document.dispatchEvent(displayPaymentForm({
24883
+ product,
24884
+ plan
24885
+ }));
24886
+ }, []);
24822
24887
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
24823
24888
  id: "pelcro-subscription-create-modal",
24824
24889
  onDisplay: onDisplay,
24825
24890
  onClose: onClose
24826
24891
  }, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(SubscriptionCreateView, Object.assign({}, otherProps, {
24827
- onSuccess: onSuccess
24892
+ onSuccess: onSuccess,
24893
+ onFailure: onFailure
24828
24894
  }))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
24829
24895
  }
24830
24896
  SubscriptionCreateModal.viewId = "subscription-create";
@@ -26205,12 +26271,18 @@ const AddressCreateContainer = _ref => {
26205
26271
  content: getErrorMessages(err)
26206
26272
  }
26207
26273
  });
26274
+ document.dispatchEvent(submitAddressCreate({
26275
+ submissionSuccess: false
26276
+ }));
26208
26277
  onFailure(err);
26209
26278
  return dispatch({
26210
26279
  type: LOADING,
26211
26280
  payload: false
26212
26281
  });
26213
26282
  }
26283
+ document.dispatchEvent(submitAddressCreate({
26284
+ submissionSuccess: true
26285
+ }));
26214
26286
  const newAddressId = String(getNewlyCreatedAddress(res.data.addresses).id);
26215
26287
  if (selectedMembership) {
26216
26288
  dispatch({
@@ -26831,7 +26903,9 @@ const AddressCreateModal = _ref => {
26831
26903
  const {
26832
26904
  switchView,
26833
26905
  switchToPaymentView,
26834
- resetView
26906
+ resetView,
26907
+ product,
26908
+ plan
26835
26909
  } = usePelcro();
26836
26910
  const onSuccess = newAddressId => {
26837
26911
  var _otherProps$onSuccess;
@@ -26850,6 +26924,12 @@ const AddressCreateModal = _ref => {
26850
26924
  (_otherProps$onMembers = otherProps.onMembershipAdressUpdateSuccess) === null || _otherProps$onMembers === void 0 ? void 0 : _otherProps$onMembers.call(otherProps);
26851
26925
  resetView();
26852
26926
  };
26927
+ React.useEffect(() => {
26928
+ document.dispatchEvent(displayAddressCreate({
26929
+ product,
26930
+ plan
26931
+ }));
26932
+ }, []);
26853
26933
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
26854
26934
  id: "pelcro-address-create-modal",
26855
26935
  onDisplay: onDisplay,
@@ -27544,7 +27624,7 @@ function PaymentMethodUpdateView(props) {
27544
27624
  className: "plc-mb-2 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
27545
27625
  }, /*#__PURE__*/React__default['default'].createElement("h4", {
27546
27626
  className: "plc-text-2xl plc-font-semibold "
27547
- }, t("update.title")), /*#__PURE__*/React__default['default'].createElement("p", null, t("update.subtitle"))), /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, {
27627
+ }, t("update.title")), /*#__PURE__*/React__default['default'].createElement("p", null, t("update.subtitle"))), /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, Object.assign({
27548
27628
  type: "updatePaymentSource",
27549
27629
  showCoupon: false,
27550
27630
  showExternalPaymentMethods: false,
@@ -27552,7 +27632,7 @@ function PaymentMethodUpdateView(props) {
27552
27632
  onDisplay: props.onDisplay,
27553
27633
  onFailure: props.onFailure,
27554
27634
  onSuccess: props.onSuccess
27555
- }));
27635
+ }, props)));
27556
27636
  }
27557
27637
 
27558
27638
  const PaymentMethodUpdateModal = props => {
@@ -29780,6 +29860,9 @@ const AddressSelectContainer = _ref => {
29780
29860
  return onGiftRedemptionSuccess(res);
29781
29861
  });
29782
29862
  }
29863
+ document.dispatchEvent(submitAddressSelect({
29864
+ submissionSuccess: true
29865
+ }));
29783
29866
  onSuccess(selectedAddressId);
29784
29867
  };
29785
29868
  const [state, dispatch] = useReducerWithSideEffects((state, action) => {
package/dist/index.esm.js CHANGED
@@ -7617,6 +7617,7 @@ function _defineProperty$3(obj, key, value) {
7617
7617
  return obj;
7618
7618
  }
7619
7619
 
7620
+ /* eslint-disable valid-jsdoc */
7620
7621
  // Polyfill
7621
7622
  (() => {
7622
7623
  if (typeof window.CustomEvent === "function") return false;
@@ -7648,6 +7649,17 @@ const cartItemAdded = detail => createCustomEvent("PelcroElementsCartItemAdded",
7648
7649
  * Should fire when an item removed from the cart and expects the removed item to be sent
7649
7650
  */
7650
7651
  const cartItemRemoved = detail => createCustomEvent("PelcroElementsCartItemRemoved", detail);
7652
+ const displayLogin = detail => createCustomEvent("PelcroLoginDisplayed", detail);
7653
+ const displayRegister = detail => createCustomEvent("PelcroRegisterDisplayed", detail);
7654
+ const displaySelect = detail => createCustomEvent("PelcroSelectDisplayed", detail);
7655
+ const displayAddressCreate = detail => createCustomEvent("PelcroAddressCreateDisplayed", detail);
7656
+ const displayPaymentForm = detail => createCustomEvent("PelcroPaymentFormDisplayed", detail);
7657
+ const submitLogin = detail => createCustomEvent("PelcroLoginSubmitted", detail);
7658
+ const submitRegister = detail => createCustomEvent("PelcroRegisterSubmitted", detail);
7659
+ const submitSelect = detail => createCustomEvent("PelcroSelectSubmitted", detail);
7660
+ const submitAddressCreate = detail => createCustomEvent("PelcroAddressCreateSubmitted", detail);
7661
+ const submitAddressSelect = detail => createCustomEvent("PelcroAddressSelectSubmitted", detail);
7662
+ const submitPaymentForm = detail => createCustomEvent("PelcroPaymentFormSubmitted", detail);
7651
7663
 
7652
7664
  /**
7653
7665
  * Check if the browser support custom events
@@ -13089,8 +13101,14 @@ const LoginContainer = _ref => {
13089
13101
  content: getErrorMessages(err)
13090
13102
  }
13091
13103
  });
13104
+ document.dispatchEvent(submitLogin({
13105
+ submissionSuccess: false
13106
+ }));
13092
13107
  onFailure(err);
13093
13108
  } else {
13109
+ document.dispatchEvent(submitLogin({
13110
+ submissionSuccess: true
13111
+ }));
13094
13112
  onSuccess(res);
13095
13113
  if (enableReactGA4) {
13096
13114
  ReactGA4.event("Logged in", {
@@ -13771,8 +13789,14 @@ const RegisterContainer = _ref => {
13771
13789
  content: getErrorMessages(err)
13772
13790
  }
13773
13791
  });
13792
+ document.dispatchEvent(submitRegister({
13793
+ submissionSuccess: false
13794
+ }));
13774
13795
  onFailure(err);
13775
13796
  } else {
13797
+ document.dispatchEvent(submitRegister({
13798
+ submissionSuccess: true
13799
+ }));
13776
13800
  onSuccess(res);
13777
13801
  }
13778
13802
  });
@@ -14602,6 +14626,12 @@ function LoginModal(_ref) {
14602
14626
  const onPasswordlessRequest = () => {
14603
14627
  switchView("passwordless-request");
14604
14628
  };
14629
+ useEffect(() => {
14630
+ document.dispatchEvent(displayLogin({
14631
+ product,
14632
+ plan
14633
+ }));
14634
+ }, []);
14605
14635
  return /*#__PURE__*/React__default.createElement(Modal, {
14606
14636
  id: "pelcro-login-modal",
14607
14637
  onDisplay: onDisplay,
@@ -15218,6 +15248,12 @@ function RegisterModal(props) {
15218
15248
  }
15219
15249
  return resetView();
15220
15250
  };
15251
+ useEffect(() => {
15252
+ document.dispatchEvent(displayRegister({
15253
+ product,
15254
+ plan
15255
+ }));
15256
+ }, []);
15221
15257
  return /*#__PURE__*/React__default.createElement(Modal, {
15222
15258
  id: "pelcro-register-modal",
15223
15259
  onDisplay: props === null || props === void 0 ? void 0 : props.onDisplay,
@@ -15290,6 +15326,12 @@ function SelectModalWithHook(props) {
15290
15326
  } = usePelcro();
15291
15327
  const entitlementsProtectedElements = document.querySelectorAll("[data-pelcro-entitlements]");
15292
15328
  const entitlements = entitlementsProtectedElements.length > 0 ? getEntitlementsFromElem(entitlementsProtectedElements[0]) : null;
15329
+ useEffect(() => {
15330
+ document.dispatchEvent(displaySelect({
15331
+ product,
15332
+ plan
15333
+ }));
15334
+ }, []);
15293
15335
  return /*#__PURE__*/React__default.createElement(SelectModalWithTrans, {
15294
15336
  isGift: isGift,
15295
15337
  disableGifting: isRenewingGift,
@@ -15575,7 +15617,8 @@ class SelectModal extends Component {
15575
15617
  this.props.setProductAndPlan(this.state.product, this.state.plan, this.state.isGift);
15576
15618
  const {
15577
15619
  product,
15578
- isGift
15620
+ isGift,
15621
+ plan
15579
15622
  } = this.state;
15580
15623
  const {
15581
15624
  setView
@@ -15585,6 +15628,11 @@ class SelectModal extends Component {
15585
15628
  switchToAddressView,
15586
15629
  switchToPaymentView
15587
15630
  } = usePelcro.getStore();
15631
+ document.dispatchEvent(submitSelect({
15632
+ submissionSuccess: true,
15633
+ product,
15634
+ plan
15635
+ }));
15588
15636
  if (!isAuthenticated) {
15589
15637
  return setView("register");
15590
15638
  }
@@ -23049,7 +23097,7 @@ function PaymentMethodUpdateSetDefault(props) {
23049
23097
  paymentMethodToEdit
23050
23098
  } = usePelcro();
23051
23099
  useEffect(() => {
23052
- if (paymentMethodToEdit !== null && paymentMethodToEdit !== void 0 && paymentMethodToEdit.is_default) {
23100
+ if (paymentMethodToEdit !== null && paymentMethodToEdit !== void 0 && paymentMethodToEdit.is_default || props !== null && props !== void 0 && props.paymentMethodDefaultChecked) {
23053
23101
  dispatch({
23054
23102
  type: SET_IS_DEFAULT_PAYMENT_METHOD,
23055
23103
  payload: {
@@ -23057,7 +23105,7 @@ function PaymentMethodUpdateSetDefault(props) {
23057
23105
  }
23058
23106
  });
23059
23107
  }
23060
- }, [paymentMethodToEdit]); // eslint-disable-line react-hooks/exhaustive-deps
23108
+ }, [paymentMethodToEdit, props === null || props === void 0 ? void 0 : props.paymentMethodDefaultChecked]); // eslint-disable-line react-hooks/exhaustive-deps
23061
23109
 
23062
23110
  const handleCheckboxChange = e => {
23063
23111
  dispatch({
@@ -23091,7 +23139,8 @@ function PaymentMethodView(_ref) {
23091
23139
  showOrderButton,
23092
23140
  showApplePayButton,
23093
23141
  order,
23094
- subCreateMetadata
23142
+ subCreateMetadata,
23143
+ ...props
23095
23144
  } = _ref;
23096
23145
  const {
23097
23146
  t
@@ -23166,10 +23215,10 @@ function PaymentMethodView(_ref) {
23166
23215
  type: type
23167
23216
  }), showCoupon && /*#__PURE__*/React__default.createElement("div", {
23168
23217
  className: "plc-mb-2"
23169
- }, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), type === "updatePaymentSource" && /*#__PURE__*/React__default.createElement(PaymentMethodUpdateSetDefault, {
23218
+ }, /*#__PURE__*/React__default.createElement(CouponCode, null), /*#__PURE__*/React__default.createElement(DiscountedPrice, null)), /*#__PURE__*/React__default.createElement(TaxAmount, null), type === "updatePaymentSource" && /*#__PURE__*/React__default.createElement(PaymentMethodUpdateSetDefault, Object.assign({
23170
23219
  id: "pelcro-input-is-default",
23171
23220
  label: t("labels.isDefault")
23172
- }), /*#__PURE__*/React__default.createElement("div", {
23221
+ }, props)), /*#__PURE__*/React__default.createElement("div", {
23173
23222
  className: "plc-grid plc-mt-4 plc-gap-y-2"
23174
23223
  }, /*#__PURE__*/React__default.createElement(SubmitPaymentMethod, null), showExternalPaymentMethods && !supportsVantiv && !supportsCybersource && !supportsTap ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PelcroPaymentRequestButton, null), /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : showExternalPaymentMethods && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PaypalSubscribeButton, null)) : null, showApplePayButton && supportsVantiv ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ApplePayButton, null)) : null)))));
23175
23224
  }
@@ -24781,20 +24830,37 @@ function SubscriptionCreateModal(_ref) {
24781
24830
  } = _ref;
24782
24831
  useTranslation("common");
24783
24832
  const {
24784
- switchView
24833
+ switchView,
24834
+ product,
24835
+ plan
24785
24836
  } = usePelcro();
24786
24837
  const onSuccess = res => {
24787
24838
  var _otherProps$onSuccess;
24788
24839
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
24789
24840
  trackSubscriptionOnGA();
24841
+ document.dispatchEvent(submitPaymentForm({
24842
+ submissionSuccess: true
24843
+ }));
24790
24844
  return switchView("subscription-success");
24791
24845
  };
24846
+ const onFailure = () => {
24847
+ return document.dispatchEvent(submitPaymentForm({
24848
+ submissionSuccess: false
24849
+ }));
24850
+ };
24851
+ useEffect(() => {
24852
+ document.dispatchEvent(displayPaymentForm({
24853
+ product,
24854
+ plan
24855
+ }));
24856
+ }, []);
24792
24857
  return /*#__PURE__*/React__default.createElement(Modal, {
24793
24858
  id: "pelcro-subscription-create-modal",
24794
24859
  onDisplay: onDisplay,
24795
24860
  onClose: onClose
24796
24861
  }, /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(SubscriptionCreateView, Object.assign({}, otherProps, {
24797
- onSuccess: onSuccess
24862
+ onSuccess: onSuccess,
24863
+ onFailure: onFailure
24798
24864
  }))), /*#__PURE__*/React__default.createElement(ModalFooter, null, /*#__PURE__*/React__default.createElement(Authorship, null)));
24799
24865
  }
24800
24866
  SubscriptionCreateModal.viewId = "subscription-create";
@@ -26175,12 +26241,18 @@ const AddressCreateContainer = _ref => {
26175
26241
  content: getErrorMessages(err)
26176
26242
  }
26177
26243
  });
26244
+ document.dispatchEvent(submitAddressCreate({
26245
+ submissionSuccess: false
26246
+ }));
26178
26247
  onFailure(err);
26179
26248
  return dispatch({
26180
26249
  type: LOADING,
26181
26250
  payload: false
26182
26251
  });
26183
26252
  }
26253
+ document.dispatchEvent(submitAddressCreate({
26254
+ submissionSuccess: true
26255
+ }));
26184
26256
  const newAddressId = String(getNewlyCreatedAddress(res.data.addresses).id);
26185
26257
  if (selectedMembership) {
26186
26258
  dispatch({
@@ -26801,7 +26873,9 @@ const AddressCreateModal = _ref => {
26801
26873
  const {
26802
26874
  switchView,
26803
26875
  switchToPaymentView,
26804
- resetView
26876
+ resetView,
26877
+ product,
26878
+ plan
26805
26879
  } = usePelcro();
26806
26880
  const onSuccess = newAddressId => {
26807
26881
  var _otherProps$onSuccess;
@@ -26820,6 +26894,12 @@ const AddressCreateModal = _ref => {
26820
26894
  (_otherProps$onMembers = otherProps.onMembershipAdressUpdateSuccess) === null || _otherProps$onMembers === void 0 ? void 0 : _otherProps$onMembers.call(otherProps);
26821
26895
  resetView();
26822
26896
  };
26897
+ useEffect(() => {
26898
+ document.dispatchEvent(displayAddressCreate({
26899
+ product,
26900
+ plan
26901
+ }));
26902
+ }, []);
26823
26903
  return /*#__PURE__*/React__default.createElement(Modal, {
26824
26904
  id: "pelcro-address-create-modal",
26825
26905
  onDisplay: onDisplay,
@@ -27514,7 +27594,7 @@ function PaymentMethodUpdateView(props) {
27514
27594
  className: "plc-mb-2 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
27515
27595
  }, /*#__PURE__*/React__default.createElement("h4", {
27516
27596
  className: "plc-text-2xl plc-font-semibold "
27517
- }, t("update.title")), /*#__PURE__*/React__default.createElement("p", null, t("update.subtitle"))), /*#__PURE__*/React__default.createElement(PaymentMethodView, {
27597
+ }, t("update.title")), /*#__PURE__*/React__default.createElement("p", null, t("update.subtitle"))), /*#__PURE__*/React__default.createElement(PaymentMethodView, Object.assign({
27518
27598
  type: "updatePaymentSource",
27519
27599
  showCoupon: false,
27520
27600
  showExternalPaymentMethods: false,
@@ -27522,7 +27602,7 @@ function PaymentMethodUpdateView(props) {
27522
27602
  onDisplay: props.onDisplay,
27523
27603
  onFailure: props.onFailure,
27524
27604
  onSuccess: props.onSuccess
27525
- }));
27605
+ }, props)));
27526
27606
  }
27527
27607
 
27528
27608
  const PaymentMethodUpdateModal = props => {
@@ -29750,6 +29830,9 @@ const AddressSelectContainer = _ref => {
29750
29830
  return onGiftRedemptionSuccess(res);
29751
29831
  });
29752
29832
  }
29833
+ document.dispatchEvent(submitAddressSelect({
29834
+ submissionSuccess: true
29835
+ }));
29753
29836
  onSuccess(selectedAddressId);
29754
29837
  };
29755
29838
  const [state, dispatch] = useReducerWithSideEffects((state, action) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.26.0-beta.65",
4
+ "version": "3.26.0-beta.67",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",