@pelcro/react-pelcro-js 4.0.0-alpha.5 → 4.0.0-alpha.7
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 +7 -36
- package/dist/index.esm.js +7 -36
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -8098,7 +8098,6 @@ class PelcroActions {
|
|
|
8098
8098
|
} = this.get();
|
|
8099
8099
|
switchView(null);
|
|
8100
8100
|
resetState();
|
|
8101
|
-
window.sessionStorage.setItem("paywall_conversion_id", null);
|
|
8102
8101
|
});
|
|
8103
8102
|
|
|
8104
8103
|
_defineProperty$3(this, "switchToPaymentView", () => {
|
|
@@ -10911,8 +10910,6 @@ const initPaywalls = () => {
|
|
|
10911
10910
|
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
|
|
10912
10911
|
switchView("newsletter");
|
|
10913
10912
|
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
|
|
10914
|
-
const paywallId = window.Pelcro.paywall.read().id;
|
|
10915
|
-
window.sessionStorage.setItem("paywall_conversion_id", paywallId);
|
|
10916
10913
|
switchView("plan-select");
|
|
10917
10914
|
}
|
|
10918
10915
|
}
|
|
@@ -18713,23 +18710,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18713
18710
|
updateTotalAmountWithTax();
|
|
18714
18711
|
}
|
|
18715
18712
|
};
|
|
18716
|
-
|
|
18717
|
-
const trackPaywallConversion = subscriptionId => {
|
|
18718
|
-
const paywallId = window.sessionStorage.getItem("paywall_conversion_id");
|
|
18719
|
-
const userId = window.Pelcro.user.read().id;
|
|
18720
|
-
const planId = plan.id;
|
|
18721
|
-
const productId = product.id;
|
|
18722
|
-
|
|
18723
|
-
if (paywallId) {
|
|
18724
|
-
window.Pelcro.insight.track(`Paywall Conversion: ${paywallId}`, {
|
|
18725
|
-
userId,
|
|
18726
|
-
subscriptionId,
|
|
18727
|
-
planId,
|
|
18728
|
-
productId
|
|
18729
|
-
});
|
|
18730
|
-
window.sessionStorage.setItem("paywall_conversion_id", null);
|
|
18731
|
-
}
|
|
18732
|
-
};
|
|
18733
18713
|
/**
|
|
18734
18714
|
* Attempt to confirm a Stripe card payment via it's PaymentIntent.
|
|
18735
18715
|
* Only trigger method if PaymentIntent status is `requires_action`.
|
|
@@ -18750,8 +18730,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18750
18730
|
|
|
18751
18731
|
if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
18752
18732
|
stripe.confirmCardPayment(paymentIntent.client_secret).then(res => {
|
|
18753
|
-
var _response$data2;
|
|
18754
|
-
|
|
18755
18733
|
if (!isSubCreate) {
|
|
18756
18734
|
dispatch({
|
|
18757
18735
|
type: DISABLE_SUBMIT,
|
|
@@ -18775,7 +18753,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18775
18753
|
});
|
|
18776
18754
|
}
|
|
18777
18755
|
|
|
18778
|
-
trackPaywallConversion((_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.id);
|
|
18779
18756
|
onSuccess(res);
|
|
18780
18757
|
});
|
|
18781
18758
|
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
@@ -18798,14 +18775,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18798
18775
|
}
|
|
18799
18776
|
});
|
|
18800
18777
|
} else {
|
|
18801
|
-
var _response$data3;
|
|
18802
|
-
|
|
18803
|
-
trackPaywallConversion((_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.id);
|
|
18804
18778
|
onSuccess(response);
|
|
18805
18779
|
}
|
|
18806
18780
|
} else {
|
|
18807
|
-
var _response$data4;
|
|
18808
|
-
|
|
18809
18781
|
dispatch({
|
|
18810
18782
|
type: DISABLE_SUBMIT,
|
|
18811
18783
|
payload: false
|
|
@@ -18826,7 +18798,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18826
18798
|
});
|
|
18827
18799
|
}
|
|
18828
18800
|
|
|
18829
|
-
trackPaywallConversion((_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.id);
|
|
18830
18801
|
onSuccess(response);
|
|
18831
18802
|
}
|
|
18832
18803
|
};
|
|
@@ -18886,7 +18857,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18886
18857
|
});
|
|
18887
18858
|
}
|
|
18888
18859
|
|
|
18889
|
-
trackPaywallConversion(subscriptionIdToRenew);
|
|
18890
18860
|
onGiftRenewalSuccess(res);
|
|
18891
18861
|
});
|
|
18892
18862
|
} else {
|
|
@@ -18920,7 +18890,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18920
18890
|
});
|
|
18921
18891
|
}
|
|
18922
18892
|
|
|
18923
|
-
trackPaywallConversion(subscriptionIdToRenew);
|
|
18924
18893
|
onSuccess(res);
|
|
18925
18894
|
});
|
|
18926
18895
|
}
|
|
@@ -21828,13 +21797,15 @@ const MeterView = () => {
|
|
|
21828
21797
|
className: "plc-mb-2 plc-text-2xl plc-font-semibold plc-text-gray-600"
|
|
21829
21798
|
}, title), /*#__PURE__*/React__default['default'].createElement("p", {
|
|
21830
21799
|
className: "plc-text-sm plc-text-gray-600"
|
|
21831
|
-
}, subtitle, " ", /*#__PURE__*/React__default['default'].createElement(
|
|
21832
|
-
className: "plc-
|
|
21800
|
+
}, subtitle, ",", !isAuthenticated() && " or " + t("messages.alreadyHaveAccount")), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
21801
|
+
className: "plc-flex plc-mt-2"
|
|
21802
|
+
}, /*#__PURE__*/React__default['default'].createElement(Button$1, {
|
|
21803
|
+
className: "plc-w-1/2",
|
|
21833
21804
|
onClick: () => switchView("plan-select")
|
|
21834
|
-
}, t("messages.subscribeNow")), !isAuthenticated() && /*#__PURE__*/React__default['default'].createElement(
|
|
21835
|
-
className: "plc-
|
|
21805
|
+
}, t("messages.subscribeNow")), !isAuthenticated() && /*#__PURE__*/React__default['default'].createElement(Button$1, {
|
|
21806
|
+
className: "pelcro-button-ghost plc-w-1/2",
|
|
21836
21807
|
onClick: () => switchView("login")
|
|
21837
|
-
}, t("messages.loginHere"))))
|
|
21808
|
+
}, t("messages.loginHere"))));
|
|
21838
21809
|
};
|
|
21839
21810
|
|
|
21840
21811
|
// Meter view.
|
package/dist/index.esm.js
CHANGED
|
@@ -8068,7 +8068,6 @@ class PelcroActions {
|
|
|
8068
8068
|
} = this.get();
|
|
8069
8069
|
switchView(null);
|
|
8070
8070
|
resetState();
|
|
8071
|
-
window.sessionStorage.setItem("paywall_conversion_id", null);
|
|
8072
8071
|
});
|
|
8073
8072
|
|
|
8074
8073
|
_defineProperty$3(this, "switchToPaymentView", () => {
|
|
@@ -10881,8 +10880,6 @@ const initPaywalls = () => {
|
|
|
10881
10880
|
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayNewsletterPaywall()) {
|
|
10882
10881
|
switchView("newsletter");
|
|
10883
10882
|
} else if (paywallMethods !== null && paywallMethods !== void 0 && paywallMethods.displayPaywall()) {
|
|
10884
|
-
const paywallId = window.Pelcro.paywall.read().id;
|
|
10885
|
-
window.sessionStorage.setItem("paywall_conversion_id", paywallId);
|
|
10886
10883
|
switchView("plan-select");
|
|
10887
10884
|
}
|
|
10888
10885
|
}
|
|
@@ -18683,23 +18680,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18683
18680
|
updateTotalAmountWithTax();
|
|
18684
18681
|
}
|
|
18685
18682
|
};
|
|
18686
|
-
|
|
18687
|
-
const trackPaywallConversion = subscriptionId => {
|
|
18688
|
-
const paywallId = window.sessionStorage.getItem("paywall_conversion_id");
|
|
18689
|
-
const userId = window.Pelcro.user.read().id;
|
|
18690
|
-
const planId = plan.id;
|
|
18691
|
-
const productId = product.id;
|
|
18692
|
-
|
|
18693
|
-
if (paywallId) {
|
|
18694
|
-
window.Pelcro.insight.track(`Paywall Conversion: ${paywallId}`, {
|
|
18695
|
-
userId,
|
|
18696
|
-
subscriptionId,
|
|
18697
|
-
planId,
|
|
18698
|
-
productId
|
|
18699
|
-
});
|
|
18700
|
-
window.sessionStorage.setItem("paywall_conversion_id", null);
|
|
18701
|
-
}
|
|
18702
|
-
};
|
|
18703
18683
|
/**
|
|
18704
18684
|
* Attempt to confirm a Stripe card payment via it's PaymentIntent.
|
|
18705
18685
|
* Only trigger method if PaymentIntent status is `requires_action`.
|
|
@@ -18720,8 +18700,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18720
18700
|
|
|
18721
18701
|
if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_action" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
18722
18702
|
stripe.confirmCardPayment(paymentIntent.client_secret).then(res => {
|
|
18723
|
-
var _response$data2;
|
|
18724
|
-
|
|
18725
18703
|
if (!isSubCreate) {
|
|
18726
18704
|
dispatch({
|
|
18727
18705
|
type: DISABLE_SUBMIT,
|
|
@@ -18745,7 +18723,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18745
18723
|
});
|
|
18746
18724
|
}
|
|
18747
18725
|
|
|
18748
|
-
trackPaywallConversion((_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.id);
|
|
18749
18726
|
onSuccess(res);
|
|
18750
18727
|
});
|
|
18751
18728
|
} else if ((paymentIntent === null || paymentIntent === void 0 ? void 0 : paymentIntent.status) === "requires_payment_method" && paymentIntent !== null && paymentIntent !== void 0 && paymentIntent.client_secret) {
|
|
@@ -18768,14 +18745,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18768
18745
|
}
|
|
18769
18746
|
});
|
|
18770
18747
|
} else {
|
|
18771
|
-
var _response$data3;
|
|
18772
|
-
|
|
18773
|
-
trackPaywallConversion((_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.id);
|
|
18774
18748
|
onSuccess(response);
|
|
18775
18749
|
}
|
|
18776
18750
|
} else {
|
|
18777
|
-
var _response$data4;
|
|
18778
|
-
|
|
18779
18751
|
dispatch({
|
|
18780
18752
|
type: DISABLE_SUBMIT,
|
|
18781
18753
|
payload: false
|
|
@@ -18796,7 +18768,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18796
18768
|
});
|
|
18797
18769
|
}
|
|
18798
18770
|
|
|
18799
|
-
trackPaywallConversion((_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.id);
|
|
18800
18771
|
onSuccess(response);
|
|
18801
18772
|
}
|
|
18802
18773
|
};
|
|
@@ -18856,7 +18827,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18856
18827
|
});
|
|
18857
18828
|
}
|
|
18858
18829
|
|
|
18859
|
-
trackPaywallConversion(subscriptionIdToRenew);
|
|
18860
18830
|
onGiftRenewalSuccess(res);
|
|
18861
18831
|
});
|
|
18862
18832
|
} else {
|
|
@@ -18890,7 +18860,6 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
18890
18860
|
});
|
|
18891
18861
|
}
|
|
18892
18862
|
|
|
18893
|
-
trackPaywallConversion(subscriptionIdToRenew);
|
|
18894
18863
|
onSuccess(res);
|
|
18895
18864
|
});
|
|
18896
18865
|
}
|
|
@@ -21798,13 +21767,15 @@ const MeterView = () => {
|
|
|
21798
21767
|
className: "plc-mb-2 plc-text-2xl plc-font-semibold plc-text-gray-600"
|
|
21799
21768
|
}, title), /*#__PURE__*/React__default.createElement("p", {
|
|
21800
21769
|
className: "plc-text-sm plc-text-gray-600"
|
|
21801
|
-
}, subtitle, " ", /*#__PURE__*/React__default.createElement(
|
|
21802
|
-
className: "plc-
|
|
21770
|
+
}, subtitle, ",", !isAuthenticated() && " or " + t("messages.alreadyHaveAccount")), /*#__PURE__*/React__default.createElement("div", {
|
|
21771
|
+
className: "plc-flex plc-mt-2"
|
|
21772
|
+
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
|
21773
|
+
className: "plc-w-1/2",
|
|
21803
21774
|
onClick: () => switchView("plan-select")
|
|
21804
|
-
}, t("messages.subscribeNow")), !isAuthenticated() && /*#__PURE__*/React__default.createElement(
|
|
21805
|
-
className: "plc-
|
|
21775
|
+
}, t("messages.subscribeNow")), !isAuthenticated() && /*#__PURE__*/React__default.createElement(Button$1, {
|
|
21776
|
+
className: "pelcro-button-ghost plc-w-1/2",
|
|
21806
21777
|
onClick: () => switchView("login")
|
|
21807
|
-
}, t("messages.loginHere"))))
|
|
21778
|
+
}, t("messages.loginHere"))));
|
|
21808
21779
|
};
|
|
21809
21780
|
|
|
21810
21781
|
// Meter view.
|