@pelcro/react-pelcro-js 3.26.0-beta.64 → 3.26.0-beta.66

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
  }
@@ -20675,7 +20723,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20675
20723
  gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
20676
20724
  gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
20677
20725
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
20678
- address_id: product.address_required ? selectedAddressId : null
20726
+ address_id: product.address_required ? selectedAddressId : null,
20727
+ metadata: props === null || props === void 0 ? void 0 : props.subCreateMetadata
20679
20728
  }, (err, res) => {
20680
20729
  var _res$data;
20681
20730
  if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.setup_intent) {
@@ -23119,7 +23168,8 @@ function PaymentMethodView(_ref) {
23119
23168
  showSubscriptionButton,
23120
23169
  showOrderButton,
23121
23170
  showApplePayButton,
23122
- order
23171
+ order,
23172
+ subCreateMetadata
23123
23173
  } = _ref;
23124
23174
  const {
23125
23175
  t
@@ -23162,7 +23212,8 @@ function PaymentMethodView(_ref) {
23162
23212
  onSuccess: onSuccess,
23163
23213
  onGiftRenewalSuccess: onGiftRenewalSuccess,
23164
23214
  onFailure: onFailure,
23165
- freeOrders: showOrderButton
23215
+ freeOrders: showOrderButton,
23216
+ subCreateMetadata: subCreateMetadata
23166
23217
  }, /*#__PURE__*/React__default['default'].createElement(AlertWithContext, {
23167
23218
  className: "plc-mb-2"
23168
23219
  }), showSubscriptionButton && /*#__PURE__*/React__default['default'].createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default['default'].createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement(BankRedirection, null), /*#__PURE__*/React__default['default'].createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default['default'].createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -24742,7 +24793,8 @@ const SubscriptionCreateView = _ref => {
24742
24793
  var _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
24743
24794
  let {
24744
24795
  onSuccess = () => {},
24745
- onFailure = () => {}
24796
+ onFailure = () => {},
24797
+ ...otherProps
24746
24798
  } = _ref;
24747
24799
  const {
24748
24800
  t
@@ -24785,7 +24837,7 @@ const SubscriptionCreateView = _ref => {
24785
24837
  className: "plc-text-2xl plc-font-semibold "
24786
24838
  }, (_product$paywall$subs = product === null || product === void 0 ? void 0 : (_product$paywall = product.paywall) === null || _product$paywall === void 0 ? void 0 : _product$paywall.subscribe_title) !== null && _product$paywall$subs !== void 0 ? _product$paywall$subs : (_window$Pelcro$paywal = window.Pelcro.paywall.read()) === null || _window$Pelcro$paywal === void 0 ? void 0 : _window$Pelcro$paywal.subscribe_title), " ", /*#__PURE__*/React__default['default'].createElement("p", null, (_product$paywall$subs2 = product === null || product === void 0 ? void 0 : (_product$paywall2 = product.paywall) === null || _product$paywall2 === void 0 ? void 0 : _product$paywall2.subscribe_subtitle) !== null && _product$paywall$subs2 !== void 0 ? _product$paywall$subs2 : (_window$Pelcro$paywal2 = window.Pelcro.paywall.read()) === null || _window$Pelcro$paywal2 === void 0 ? void 0 : _window$Pelcro$paywal2.subscribe_subtitle), /*#__PURE__*/React__default['default'].createElement("div", {
24787
24839
  className: "plc-w-full plc-p-2 plc-mt-2 plc-font-semibold plc-text-center plc-text-gray-900 plc-bg-gray-100 plc-border plc-border-gray-200"
24788
- }, plan && getPricingText(plan))), /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, {
24840
+ }, plan && getPricingText(plan))), /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, Object.assign({
24789
24841
  type: "createPayment",
24790
24842
  showCoupon: true,
24791
24843
  showExternalPaymentMethods: true,
@@ -24793,7 +24845,7 @@ const SubscriptionCreateView = _ref => {
24793
24845
  onSuccess: onSuccess,
24794
24846
  onFailure: onFailure,
24795
24847
  showSubscriptionButton: showSubscriptionButton
24796
- }));
24848
+ }, otherProps)));
24797
24849
  };
24798
24850
 
24799
24851
  /**
@@ -24807,20 +24859,37 @@ function SubscriptionCreateModal(_ref) {
24807
24859
  } = _ref;
24808
24860
  useTranslation("common");
24809
24861
  const {
24810
- switchView
24862
+ switchView,
24863
+ product,
24864
+ plan
24811
24865
  } = usePelcro();
24812
24866
  const onSuccess = res => {
24813
24867
  var _otherProps$onSuccess;
24814
24868
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
24815
24869
  trackSubscriptionOnGA();
24870
+ document.dispatchEvent(submitPaymentForm({
24871
+ submissionSuccess: true
24872
+ }));
24816
24873
  return switchView("subscription-success");
24817
24874
  };
24875
+ const onFailure = () => {
24876
+ return document.dispatchEvent(submitPaymentForm({
24877
+ submissionSuccess: false
24878
+ }));
24879
+ };
24880
+ React.useEffect(() => {
24881
+ document.dispatchEvent(displayPaymentForm({
24882
+ product,
24883
+ plan
24884
+ }));
24885
+ }, []);
24818
24886
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
24819
24887
  id: "pelcro-subscription-create-modal",
24820
24888
  onDisplay: onDisplay,
24821
24889
  onClose: onClose
24822
24890
  }, /*#__PURE__*/React__default['default'].createElement(ModalBody, null, /*#__PURE__*/React__default['default'].createElement(SubscriptionCreateView, Object.assign({}, otherProps, {
24823
- onSuccess: onSuccess
24891
+ onSuccess: onSuccess,
24892
+ onFailure: onFailure
24824
24893
  }))), /*#__PURE__*/React__default['default'].createElement(ModalFooter, null, /*#__PURE__*/React__default['default'].createElement(Authorship, null)));
24825
24894
  }
24826
24895
  SubscriptionCreateModal.viewId = "subscription-create";
@@ -26201,12 +26270,18 @@ const AddressCreateContainer = _ref => {
26201
26270
  content: getErrorMessages(err)
26202
26271
  }
26203
26272
  });
26273
+ document.dispatchEvent(submitAddressCreate({
26274
+ submissionSuccess: false
26275
+ }));
26204
26276
  onFailure(err);
26205
26277
  return dispatch({
26206
26278
  type: LOADING,
26207
26279
  payload: false
26208
26280
  });
26209
26281
  }
26282
+ document.dispatchEvent(submitAddressCreate({
26283
+ submissionSuccess: true
26284
+ }));
26210
26285
  const newAddressId = String(getNewlyCreatedAddress(res.data.addresses).id);
26211
26286
  if (selectedMembership) {
26212
26287
  dispatch({
@@ -26827,7 +26902,9 @@ const AddressCreateModal = _ref => {
26827
26902
  const {
26828
26903
  switchView,
26829
26904
  switchToPaymentView,
26830
- resetView
26905
+ resetView,
26906
+ product,
26907
+ plan
26831
26908
  } = usePelcro();
26832
26909
  const onSuccess = newAddressId => {
26833
26910
  var _otherProps$onSuccess;
@@ -26846,6 +26923,12 @@ const AddressCreateModal = _ref => {
26846
26923
  (_otherProps$onMembers = otherProps.onMembershipAdressUpdateSuccess) === null || _otherProps$onMembers === void 0 ? void 0 : _otherProps$onMembers.call(otherProps);
26847
26924
  resetView();
26848
26925
  };
26926
+ React.useEffect(() => {
26927
+ document.dispatchEvent(displayAddressCreate({
26928
+ product,
26929
+ plan
26930
+ }));
26931
+ }, []);
26849
26932
  return /*#__PURE__*/React__default['default'].createElement(Modal, {
26850
26933
  id: "pelcro-address-create-modal",
26851
26934
  onDisplay: onDisplay,
@@ -29776,6 +29859,9 @@ const AddressSelectContainer = _ref => {
29776
29859
  return onGiftRedemptionSuccess(res);
29777
29860
  });
29778
29861
  }
29862
+ document.dispatchEvent(submitAddressSelect({
29863
+ submissionSuccess: true
29864
+ }));
29779
29865
  onSuccess(selectedAddressId);
29780
29866
  };
29781
29867
  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
  }
@@ -20645,7 +20693,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
20645
20693
  gift_recipient_last_name: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.lastName,
20646
20694
  gift_start_date: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.startDate,
20647
20695
  gift_message: giftRecipient === null || giftRecipient === void 0 ? void 0 : giftRecipient.giftMessage,
20648
- address_id: product.address_required ? selectedAddressId : null
20696
+ address_id: product.address_required ? selectedAddressId : null,
20697
+ metadata: props === null || props === void 0 ? void 0 : props.subCreateMetadata
20649
20698
  }, (err, res) => {
20650
20699
  var _res$data;
20651
20700
  if (res !== null && res !== void 0 && (_res$data = res.data) !== null && _res$data !== void 0 && _res$data.setup_intent) {
@@ -23089,7 +23138,8 @@ function PaymentMethodView(_ref) {
23089
23138
  showSubscriptionButton,
23090
23139
  showOrderButton,
23091
23140
  showApplePayButton,
23092
- order
23141
+ order,
23142
+ subCreateMetadata
23093
23143
  } = _ref;
23094
23144
  const {
23095
23145
  t
@@ -23132,7 +23182,8 @@ function PaymentMethodView(_ref) {
23132
23182
  onSuccess: onSuccess,
23133
23183
  onGiftRenewalSuccess: onGiftRenewalSuccess,
23134
23184
  onFailure: onFailure,
23135
- freeOrders: showOrderButton
23185
+ freeOrders: showOrderButton,
23186
+ subCreateMetadata: subCreateMetadata
23136
23187
  }, /*#__PURE__*/React__default.createElement(AlertWithContext, {
23137
23188
  className: "plc-mb-2"
23138
23189
  }), showSubscriptionButton && /*#__PURE__*/React__default.createElement(SubscriptionCreateFreePlanButton, null), showOrderButton && /*#__PURE__*/React__default.createElement(OrderCreateFreeButton, null), !showSubscriptionButton && !showOrderButton && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(BankRedirection, null), /*#__PURE__*/React__default.createElement(BankAuthenticationSuccess, null), /*#__PURE__*/React__default.createElement(SelectedPaymentMethod, null), supportsTap && (!isUserFirstName || !isUserLastName || !isUserPhone) && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
@@ -24712,7 +24763,8 @@ const SubscriptionCreateView = _ref => {
24712
24763
  var _window$Pelcro, _window$Pelcro$uiSett, _product$paywall$subs, _product$paywall, _window$Pelcro$paywal, _product$paywall$subs2, _product$paywall2, _window$Pelcro$paywal2;
24713
24764
  let {
24714
24765
  onSuccess = () => {},
24715
- onFailure = () => {}
24766
+ onFailure = () => {},
24767
+ ...otherProps
24716
24768
  } = _ref;
24717
24769
  const {
24718
24770
  t
@@ -24755,7 +24807,7 @@ const SubscriptionCreateView = _ref => {
24755
24807
  className: "plc-text-2xl plc-font-semibold "
24756
24808
  }, (_product$paywall$subs = product === null || product === void 0 ? void 0 : (_product$paywall = product.paywall) === null || _product$paywall === void 0 ? void 0 : _product$paywall.subscribe_title) !== null && _product$paywall$subs !== void 0 ? _product$paywall$subs : (_window$Pelcro$paywal = window.Pelcro.paywall.read()) === null || _window$Pelcro$paywal === void 0 ? void 0 : _window$Pelcro$paywal.subscribe_title), " ", /*#__PURE__*/React__default.createElement("p", null, (_product$paywall$subs2 = product === null || product === void 0 ? void 0 : (_product$paywall2 = product.paywall) === null || _product$paywall2 === void 0 ? void 0 : _product$paywall2.subscribe_subtitle) !== null && _product$paywall$subs2 !== void 0 ? _product$paywall$subs2 : (_window$Pelcro$paywal2 = window.Pelcro.paywall.read()) === null || _window$Pelcro$paywal2 === void 0 ? void 0 : _window$Pelcro$paywal2.subscribe_subtitle), /*#__PURE__*/React__default.createElement("div", {
24757
24809
  className: "plc-w-full plc-p-2 plc-mt-2 plc-font-semibold plc-text-center plc-text-gray-900 plc-bg-gray-100 plc-border plc-border-gray-200"
24758
- }, plan && getPricingText(plan))), /*#__PURE__*/React__default.createElement(PaymentMethodView, {
24810
+ }, plan && getPricingText(plan))), /*#__PURE__*/React__default.createElement(PaymentMethodView, Object.assign({
24759
24811
  type: "createPayment",
24760
24812
  showCoupon: true,
24761
24813
  showExternalPaymentMethods: true,
@@ -24763,7 +24815,7 @@ const SubscriptionCreateView = _ref => {
24763
24815
  onSuccess: onSuccess,
24764
24816
  onFailure: onFailure,
24765
24817
  showSubscriptionButton: showSubscriptionButton
24766
- }));
24818
+ }, otherProps)));
24767
24819
  };
24768
24820
 
24769
24821
  /**
@@ -24777,20 +24829,37 @@ function SubscriptionCreateModal(_ref) {
24777
24829
  } = _ref;
24778
24830
  useTranslation("common");
24779
24831
  const {
24780
- switchView
24832
+ switchView,
24833
+ product,
24834
+ plan
24781
24835
  } = usePelcro();
24782
24836
  const onSuccess = res => {
24783
24837
  var _otherProps$onSuccess;
24784
24838
  (_otherProps$onSuccess = otherProps.onSuccess) === null || _otherProps$onSuccess === void 0 ? void 0 : _otherProps$onSuccess.call(otherProps, res);
24785
24839
  trackSubscriptionOnGA();
24840
+ document.dispatchEvent(submitPaymentForm({
24841
+ submissionSuccess: true
24842
+ }));
24786
24843
  return switchView("subscription-success");
24787
24844
  };
24845
+ const onFailure = () => {
24846
+ return document.dispatchEvent(submitPaymentForm({
24847
+ submissionSuccess: false
24848
+ }));
24849
+ };
24850
+ useEffect(() => {
24851
+ document.dispatchEvent(displayPaymentForm({
24852
+ product,
24853
+ plan
24854
+ }));
24855
+ }, []);
24788
24856
  return /*#__PURE__*/React__default.createElement(Modal, {
24789
24857
  id: "pelcro-subscription-create-modal",
24790
24858
  onDisplay: onDisplay,
24791
24859
  onClose: onClose
24792
24860
  }, /*#__PURE__*/React__default.createElement(ModalBody, null, /*#__PURE__*/React__default.createElement(SubscriptionCreateView, Object.assign({}, otherProps, {
24793
- onSuccess: onSuccess
24861
+ onSuccess: onSuccess,
24862
+ onFailure: onFailure
24794
24863
  }))), /*#__PURE__*/React__default.createElement(ModalFooter, null, /*#__PURE__*/React__default.createElement(Authorship, null)));
24795
24864
  }
24796
24865
  SubscriptionCreateModal.viewId = "subscription-create";
@@ -26171,12 +26240,18 @@ const AddressCreateContainer = _ref => {
26171
26240
  content: getErrorMessages(err)
26172
26241
  }
26173
26242
  });
26243
+ document.dispatchEvent(submitAddressCreate({
26244
+ submissionSuccess: false
26245
+ }));
26174
26246
  onFailure(err);
26175
26247
  return dispatch({
26176
26248
  type: LOADING,
26177
26249
  payload: false
26178
26250
  });
26179
26251
  }
26252
+ document.dispatchEvent(submitAddressCreate({
26253
+ submissionSuccess: true
26254
+ }));
26180
26255
  const newAddressId = String(getNewlyCreatedAddress(res.data.addresses).id);
26181
26256
  if (selectedMembership) {
26182
26257
  dispatch({
@@ -26797,7 +26872,9 @@ const AddressCreateModal = _ref => {
26797
26872
  const {
26798
26873
  switchView,
26799
26874
  switchToPaymentView,
26800
- resetView
26875
+ resetView,
26876
+ product,
26877
+ plan
26801
26878
  } = usePelcro();
26802
26879
  const onSuccess = newAddressId => {
26803
26880
  var _otherProps$onSuccess;
@@ -26816,6 +26893,12 @@ const AddressCreateModal = _ref => {
26816
26893
  (_otherProps$onMembers = otherProps.onMembershipAdressUpdateSuccess) === null || _otherProps$onMembers === void 0 ? void 0 : _otherProps$onMembers.call(otherProps);
26817
26894
  resetView();
26818
26895
  };
26896
+ useEffect(() => {
26897
+ document.dispatchEvent(displayAddressCreate({
26898
+ product,
26899
+ plan
26900
+ }));
26901
+ }, []);
26819
26902
  return /*#__PURE__*/React__default.createElement(Modal, {
26820
26903
  id: "pelcro-address-create-modal",
26821
26904
  onDisplay: onDisplay,
@@ -29746,6 +29829,9 @@ const AddressSelectContainer = _ref => {
29746
29829
  return onGiftRedemptionSuccess(res);
29747
29830
  });
29748
29831
  }
29832
+ document.dispatchEvent(submitAddressSelect({
29833
+ submissionSuccess: true
29834
+ }));
29749
29835
  onSuccess(selectedAddressId);
29750
29836
  };
29751
29837
  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.64",
4
+ "version": "3.26.0-beta.66",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",