@pelcro/react-pelcro-js 3.4.1-beta.5 → 3.5.0-beta.1

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
@@ -7278,6 +7278,13 @@ class PelcroActions {
7278
7278
  return true;
7279
7279
  });
7280
7280
 
7281
+ _defineProperty$3(this, "setCouponCode", couponCode => {
7282
+ if (!couponCode) return console.error("invalid coupon code");
7283
+ this.set({
7284
+ couponCode
7285
+ });
7286
+ });
7287
+
7281
7288
  _defineProperty$3(this, "logout", () => {
7282
7289
  var _ReactGA$event;
7283
7290
 
@@ -7485,6 +7492,8 @@ const initialState$l = {
7485
7492
  // null | SKU[] | SKU,
7486
7493
  // invoices
7487
7494
  invoice: null,
7495
+ // couponCode
7496
+ couponCode: null,
7488
7497
  // memberships
7489
7498
  selectedMembership: null,
7490
7499
  // User
@@ -14770,7 +14779,8 @@ const PaymentMethodContainerWithoutStripe = ({
14770
14779
  const {
14771
14780
  set,
14772
14781
  order,
14773
- selectedPaymentMethodId
14782
+ selectedPaymentMethodId,
14783
+ couponCode
14774
14784
  } = usePelcro();
14775
14785
  const product = (_props$product = props.product) !== null && _props$product !== void 0 ? _props$product : pelcroStore.product;
14776
14786
  const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
@@ -14786,6 +14796,19 @@ const PaymentMethodContainerWithoutStripe = ({
14786
14796
  type: UPDATE_COUPON_CODE,
14787
14797
  payload: window.Pelcro.coupon.getFromUrl()
14788
14798
  });
14799
+ dispatch({
14800
+ type: SHOW_COUPON_FIELD,
14801
+ payload: true
14802
+ });
14803
+ } else if (couponCode) {
14804
+ dispatch({
14805
+ type: UPDATE_COUPON_CODE,
14806
+ payload: couponCode
14807
+ });
14808
+ dispatch({
14809
+ type: SHOW_COUPON_FIELD,
14810
+ payload: true
14811
+ });
14789
14812
  }
14790
14813
 
14791
14814
  dispatch({
package/dist/index.esm.js CHANGED
@@ -7248,6 +7248,13 @@ class PelcroActions {
7248
7248
  return true;
7249
7249
  });
7250
7250
 
7251
+ _defineProperty$3(this, "setCouponCode", couponCode => {
7252
+ if (!couponCode) return console.error("invalid coupon code");
7253
+ this.set({
7254
+ couponCode
7255
+ });
7256
+ });
7257
+
7251
7258
  _defineProperty$3(this, "logout", () => {
7252
7259
  var _ReactGA$event;
7253
7260
 
@@ -7455,6 +7462,8 @@ const initialState$l = {
7455
7462
  // null | SKU[] | SKU,
7456
7463
  // invoices
7457
7464
  invoice: null,
7465
+ // couponCode
7466
+ couponCode: null,
7458
7467
  // memberships
7459
7468
  selectedMembership: null,
7460
7469
  // User
@@ -14740,7 +14749,8 @@ const PaymentMethodContainerWithoutStripe = ({
14740
14749
  const {
14741
14750
  set,
14742
14751
  order,
14743
- selectedPaymentMethodId
14752
+ selectedPaymentMethodId,
14753
+ couponCode
14744
14754
  } = usePelcro();
14745
14755
  const product = (_props$product = props.product) !== null && _props$product !== void 0 ? _props$product : pelcroStore.product;
14746
14756
  const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
@@ -14756,6 +14766,19 @@ const PaymentMethodContainerWithoutStripe = ({
14756
14766
  type: UPDATE_COUPON_CODE,
14757
14767
  payload: window.Pelcro.coupon.getFromUrl()
14758
14768
  });
14769
+ dispatch({
14770
+ type: SHOW_COUPON_FIELD,
14771
+ payload: true
14772
+ });
14773
+ } else if (couponCode) {
14774
+ dispatch({
14775
+ type: UPDATE_COUPON_CODE,
14776
+ payload: couponCode
14777
+ });
14778
+ dispatch({
14779
+ type: SHOW_COUPON_FIELD,
14780
+ payload: true
14781
+ });
14759
14782
  }
14760
14783
 
14761
14784
  dispatch({
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.4.1-beta.5",
4
+ "version": "3.5.0-beta.1",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",