@pelcro/react-pelcro-js 3.26.0-beta.70 → 3.26.0-beta.72
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 +81 -9
- package/dist/index.esm.js +81 -9
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -3343,6 +3343,7 @@ var common_en = {
|
|
|
3343
3343
|
var update$3 = {
|
|
3344
3344
|
title: "Update your payment information",
|
|
3345
3345
|
subtitle: "Enter the fields below to update your credit card information",
|
|
3346
|
+
selectSubtitle: "Select a payment method to update",
|
|
3346
3347
|
required: "Required",
|
|
3347
3348
|
success: "Your payment information has been updated",
|
|
3348
3349
|
secure: "You're safe - PCI compliant 128 SSL by"
|
|
@@ -4310,6 +4311,7 @@ var common_fr = {
|
|
|
4310
4311
|
var update$2 = {
|
|
4311
4312
|
title: "Mettre à jour vos informations de paiement",
|
|
4312
4313
|
subtitle: "Entrez les champs ci-dessous pour mettre à jour les informations de votre carte de crédit",
|
|
4314
|
+
selectSubtitle: "Sélectionnez un mode de paiement à mettre à jour",
|
|
4313
4315
|
required: "Champs obligatoires",
|
|
4314
4316
|
success: "Vos informations de paiement ont été mises à jour",
|
|
4315
4317
|
secure: "Vous êtes en sécurité - 128 SSL conforme à la norme PCI"
|
|
@@ -5260,6 +5262,7 @@ var common_ko = {
|
|
|
5260
5262
|
var update$1 = {
|
|
5261
5263
|
title: "결제 정보 업데이트",
|
|
5262
5264
|
subtitle: "신용카드 정보를 업데이트하려면 아래 항목을 입력하십시오.",
|
|
5265
|
+
selectSubtitle: "업데이트할 결제 수단을 선택하세요",
|
|
5263
5266
|
required: "필수 항목",
|
|
5264
5267
|
success: "귀하의 결제 정보가 업데이트되었습니다.",
|
|
5265
5268
|
secure: "PCI 준수 128비트 SSL 인증서로 보호됩니다. 제공: "
|
|
@@ -6315,6 +6318,7 @@ var common_es = {
|
|
|
6315
6318
|
var update = {
|
|
6316
6319
|
title: "Actualiza tu información de pago",
|
|
6317
6320
|
subtitle: "Rellena los campos a continuación para actualizar la información de tu tarjeta de crédito",
|
|
6321
|
+
selectSubtitle: "Selecciona un método de pago para actualizar",
|
|
6318
6322
|
required: "Obligatorio",
|
|
6319
6323
|
success: "Tu información de pago se ha actualizado",
|
|
6320
6324
|
secure: "Estás seguro - PCI compliance 128 SSL por"
|
|
@@ -27678,21 +27682,83 @@ const PaymentMethodUpdateContainer = props => {
|
|
|
27678
27682
|
*/
|
|
27679
27683
|
function PaymentMethodUpdateView(props) {
|
|
27680
27684
|
const [t] = useTranslation("paymentMethod");
|
|
27685
|
+
const {
|
|
27686
|
+
paymentMethodToEdit,
|
|
27687
|
+
setPaymentMethodToEdit
|
|
27688
|
+
} = usePelcro();
|
|
27689
|
+
const [isLoading, setIsLoading] = React.useState(false);
|
|
27690
|
+
const [sources, setSources] = React.useState([]);
|
|
27691
|
+
React.useEffect(() => {
|
|
27692
|
+
setIsLoading(true);
|
|
27693
|
+
window.Pelcro.paymentMethods.list({
|
|
27694
|
+
auth_token: window.Pelcro.user.read().auth_token
|
|
27695
|
+
}, (err, res) => {
|
|
27696
|
+
if (err) {
|
|
27697
|
+
setIsLoading(false);
|
|
27698
|
+
return console.error(err);
|
|
27699
|
+
}
|
|
27700
|
+
if (res) {
|
|
27701
|
+
setIsLoading(false);
|
|
27702
|
+
setSources(res.data);
|
|
27703
|
+
}
|
|
27704
|
+
});
|
|
27705
|
+
}, []);
|
|
27706
|
+
const handleEditPaymentMethod = source => {
|
|
27707
|
+
setPaymentMethodToEdit(source.id);
|
|
27708
|
+
};
|
|
27709
|
+
const renderSources = () => {
|
|
27710
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
27711
|
+
className: "plc-flex plc-flex-col plc-items-center"
|
|
27712
|
+
}, sources.map((source, index) => {
|
|
27713
|
+
var _source$properties, _source$properties2;
|
|
27714
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
27715
|
+
key: source.id,
|
|
27716
|
+
className: "plc-flex plc-flex-grow plc-items-center plc-justify-between plc-max-w-xs plc-p-4 plc-mb-2 plc-text-white plc-bg-gray-800 plc-rounded-md plc-h-14 plc-w-full plc-cursor-pointer",
|
|
27717
|
+
onClick: () => handleEditPaymentMethod(source)
|
|
27718
|
+
}, /*#__PURE__*/React__default['default'].createElement("span", null, getPaymentCardIcon$1(source === null || source === void 0 ? void 0 : (_source$properties = source.properties) === null || _source$properties === void 0 ? void 0 : _source$properties.brand)), /*#__PURE__*/React__default['default'].createElement("span", {
|
|
27719
|
+
className: "plc-ml-1 plc-text-lg plc-tracking-widest plc-flex-grow plc-text-center"
|
|
27720
|
+
}, "\u2022\u2022\u2022\u2022 ", source === null || source === void 0 ? void 0 : (_source$properties2 = source.properties) === null || _source$properties2 === void 0 ? void 0 : _source$properties2.last4), /*#__PURE__*/React__default['default'].createElement(Button, {
|
|
27721
|
+
id: "pelcro-button-update-source-" + index,
|
|
27722
|
+
variant: "icon",
|
|
27723
|
+
className: "plc-text-white",
|
|
27724
|
+
icon: /*#__PURE__*/React__default['default'].createElement(SvgEdit, null),
|
|
27725
|
+
"data-key": source.id,
|
|
27726
|
+
onClick: () => handleEditPaymentMethod(source)
|
|
27727
|
+
}));
|
|
27728
|
+
}));
|
|
27729
|
+
};
|
|
27730
|
+
const renderContent = () => {
|
|
27731
|
+
if (isLoading) {
|
|
27732
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
27733
|
+
className: "plc-w-full plc-h-20 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
27734
|
+
});
|
|
27735
|
+
}
|
|
27736
|
+
if ((sources === null || sources === void 0 ? void 0 : sources.length) > 0 && !paymentMethodToEdit) {
|
|
27737
|
+
return renderSources();
|
|
27738
|
+
}
|
|
27739
|
+
return /*#__PURE__*/React__default['default'].createElement(PaymentMethodView, Object.assign({
|
|
27740
|
+
type: "updatePaymentSource",
|
|
27741
|
+
showCoupon: false,
|
|
27742
|
+
showExternalPaymentMethods: false,
|
|
27743
|
+
showApplePayButton: false,
|
|
27744
|
+
onDisplay: props.onDisplay,
|
|
27745
|
+
onFailure: props.onFailure,
|
|
27746
|
+
onSuccess: props.onSuccess
|
|
27747
|
+
}, props));
|
|
27748
|
+
};
|
|
27749
|
+
const renderSubtitle = () => {
|
|
27750
|
+
if ((sources === null || sources === void 0 ? void 0 : sources.length) > 0 && !paymentMethodToEdit) {
|
|
27751
|
+
return t("update.selectSubtitle");
|
|
27752
|
+
}
|
|
27753
|
+
return t("update.subtitle");
|
|
27754
|
+
};
|
|
27681
27755
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
27682
27756
|
id: "pelcro-payment-method-update-view"
|
|
27683
27757
|
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
27684
27758
|
className: "plc-mb-2 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
27685
27759
|
}, /*#__PURE__*/React__default['default'].createElement("h4", {
|
|
27686
27760
|
className: "plc-text-2xl plc-font-semibold "
|
|
27687
|
-
}, t("update.title")),
|
|
27688
|
-
type: "updatePaymentSource",
|
|
27689
|
-
showCoupon: false,
|
|
27690
|
-
showExternalPaymentMethods: false,
|
|
27691
|
-
showApplePayButton: false,
|
|
27692
|
-
onDisplay: props.onDisplay,
|
|
27693
|
-
onFailure: props.onFailure,
|
|
27694
|
-
onSuccess: props.onSuccess
|
|
27695
|
-
}, props)));
|
|
27761
|
+
}, t("update.title")), renderSubtitle()), renderContent());
|
|
27696
27762
|
}
|
|
27697
27763
|
|
|
27698
27764
|
const PaymentMethodUpdateModal = props => {
|
|
@@ -33168,6 +33234,9 @@ function DashboardWithHook(props) {
|
|
|
33168
33234
|
}),
|
|
33169
33235
|
setPaymentMethodToEdit: setPaymentMethodToEdit,
|
|
33170
33236
|
setPaymentMethodToDelete: setPaymentMethodToDelete
|
|
33237
|
+
// used for custom event when clicking on the new subscription button
|
|
33238
|
+
,
|
|
33239
|
+
onNewSubscriptionClick: props.onNewSubscriptionClick
|
|
33171
33240
|
});
|
|
33172
33241
|
}
|
|
33173
33242
|
DashboardWithHook.viewId = "dashboard";
|
|
@@ -33318,6 +33387,9 @@ class Dashboard extends React.Component {
|
|
|
33318
33387
|
let {
|
|
33319
33388
|
isGift
|
|
33320
33389
|
} = _ref;
|
|
33390
|
+
if (this.props.onNewSubscriptionClick && !isGift) {
|
|
33391
|
+
return this.props.onNewSubscriptionClick();
|
|
33392
|
+
}
|
|
33321
33393
|
if (isGift) {
|
|
33322
33394
|
this.props.setProductAndPlan(null, null, true);
|
|
33323
33395
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -3313,6 +3313,7 @@ var common_en = {
|
|
|
3313
3313
|
var update$3 = {
|
|
3314
3314
|
title: "Update your payment information",
|
|
3315
3315
|
subtitle: "Enter the fields below to update your credit card information",
|
|
3316
|
+
selectSubtitle: "Select a payment method to update",
|
|
3316
3317
|
required: "Required",
|
|
3317
3318
|
success: "Your payment information has been updated",
|
|
3318
3319
|
secure: "You're safe - PCI compliant 128 SSL by"
|
|
@@ -4280,6 +4281,7 @@ var common_fr = {
|
|
|
4280
4281
|
var update$2 = {
|
|
4281
4282
|
title: "Mettre à jour vos informations de paiement",
|
|
4282
4283
|
subtitle: "Entrez les champs ci-dessous pour mettre à jour les informations de votre carte de crédit",
|
|
4284
|
+
selectSubtitle: "Sélectionnez un mode de paiement à mettre à jour",
|
|
4283
4285
|
required: "Champs obligatoires",
|
|
4284
4286
|
success: "Vos informations de paiement ont été mises à jour",
|
|
4285
4287
|
secure: "Vous êtes en sécurité - 128 SSL conforme à la norme PCI"
|
|
@@ -5230,6 +5232,7 @@ var common_ko = {
|
|
|
5230
5232
|
var update$1 = {
|
|
5231
5233
|
title: "결제 정보 업데이트",
|
|
5232
5234
|
subtitle: "신용카드 정보를 업데이트하려면 아래 항목을 입력하십시오.",
|
|
5235
|
+
selectSubtitle: "업데이트할 결제 수단을 선택하세요",
|
|
5233
5236
|
required: "필수 항목",
|
|
5234
5237
|
success: "귀하의 결제 정보가 업데이트되었습니다.",
|
|
5235
5238
|
secure: "PCI 준수 128비트 SSL 인증서로 보호됩니다. 제공: "
|
|
@@ -6285,6 +6288,7 @@ var common_es = {
|
|
|
6285
6288
|
var update = {
|
|
6286
6289
|
title: "Actualiza tu información de pago",
|
|
6287
6290
|
subtitle: "Rellena los campos a continuación para actualizar la información de tu tarjeta de crédito",
|
|
6291
|
+
selectSubtitle: "Selecciona un método de pago para actualizar",
|
|
6288
6292
|
required: "Obligatorio",
|
|
6289
6293
|
success: "Tu información de pago se ha actualizado",
|
|
6290
6294
|
secure: "Estás seguro - PCI compliance 128 SSL por"
|
|
@@ -27648,21 +27652,83 @@ const PaymentMethodUpdateContainer = props => {
|
|
|
27648
27652
|
*/
|
|
27649
27653
|
function PaymentMethodUpdateView(props) {
|
|
27650
27654
|
const [t] = useTranslation("paymentMethod");
|
|
27655
|
+
const {
|
|
27656
|
+
paymentMethodToEdit,
|
|
27657
|
+
setPaymentMethodToEdit
|
|
27658
|
+
} = usePelcro();
|
|
27659
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
27660
|
+
const [sources, setSources] = useState([]);
|
|
27661
|
+
useEffect(() => {
|
|
27662
|
+
setIsLoading(true);
|
|
27663
|
+
window.Pelcro.paymentMethods.list({
|
|
27664
|
+
auth_token: window.Pelcro.user.read().auth_token
|
|
27665
|
+
}, (err, res) => {
|
|
27666
|
+
if (err) {
|
|
27667
|
+
setIsLoading(false);
|
|
27668
|
+
return console.error(err);
|
|
27669
|
+
}
|
|
27670
|
+
if (res) {
|
|
27671
|
+
setIsLoading(false);
|
|
27672
|
+
setSources(res.data);
|
|
27673
|
+
}
|
|
27674
|
+
});
|
|
27675
|
+
}, []);
|
|
27676
|
+
const handleEditPaymentMethod = source => {
|
|
27677
|
+
setPaymentMethodToEdit(source.id);
|
|
27678
|
+
};
|
|
27679
|
+
const renderSources = () => {
|
|
27680
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
27681
|
+
className: "plc-flex plc-flex-col plc-items-center"
|
|
27682
|
+
}, sources.map((source, index) => {
|
|
27683
|
+
var _source$properties, _source$properties2;
|
|
27684
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
27685
|
+
key: source.id,
|
|
27686
|
+
className: "plc-flex plc-flex-grow plc-items-center plc-justify-between plc-max-w-xs plc-p-4 plc-mb-2 plc-text-white plc-bg-gray-800 plc-rounded-md plc-h-14 plc-w-full plc-cursor-pointer",
|
|
27687
|
+
onClick: () => handleEditPaymentMethod(source)
|
|
27688
|
+
}, /*#__PURE__*/React__default.createElement("span", null, getPaymentCardIcon$1(source === null || source === void 0 ? void 0 : (_source$properties = source.properties) === null || _source$properties === void 0 ? void 0 : _source$properties.brand)), /*#__PURE__*/React__default.createElement("span", {
|
|
27689
|
+
className: "plc-ml-1 plc-text-lg plc-tracking-widest plc-flex-grow plc-text-center"
|
|
27690
|
+
}, "\u2022\u2022\u2022\u2022 ", source === null || source === void 0 ? void 0 : (_source$properties2 = source.properties) === null || _source$properties2 === void 0 ? void 0 : _source$properties2.last4), /*#__PURE__*/React__default.createElement(Button, {
|
|
27691
|
+
id: "pelcro-button-update-source-" + index,
|
|
27692
|
+
variant: "icon",
|
|
27693
|
+
className: "plc-text-white",
|
|
27694
|
+
icon: /*#__PURE__*/React__default.createElement(SvgEdit, null),
|
|
27695
|
+
"data-key": source.id,
|
|
27696
|
+
onClick: () => handleEditPaymentMethod(source)
|
|
27697
|
+
}));
|
|
27698
|
+
}));
|
|
27699
|
+
};
|
|
27700
|
+
const renderContent = () => {
|
|
27701
|
+
if (isLoading) {
|
|
27702
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
27703
|
+
className: "plc-w-full plc-h-20 plc-bg-gray-300 plc-rounded-md plc-animate-pulse"
|
|
27704
|
+
});
|
|
27705
|
+
}
|
|
27706
|
+
if ((sources === null || sources === void 0 ? void 0 : sources.length) > 0 && !paymentMethodToEdit) {
|
|
27707
|
+
return renderSources();
|
|
27708
|
+
}
|
|
27709
|
+
return /*#__PURE__*/React__default.createElement(PaymentMethodView, Object.assign({
|
|
27710
|
+
type: "updatePaymentSource",
|
|
27711
|
+
showCoupon: false,
|
|
27712
|
+
showExternalPaymentMethods: false,
|
|
27713
|
+
showApplePayButton: false,
|
|
27714
|
+
onDisplay: props.onDisplay,
|
|
27715
|
+
onFailure: props.onFailure,
|
|
27716
|
+
onSuccess: props.onSuccess
|
|
27717
|
+
}, props));
|
|
27718
|
+
};
|
|
27719
|
+
const renderSubtitle = () => {
|
|
27720
|
+
if ((sources === null || sources === void 0 ? void 0 : sources.length) > 0 && !paymentMethodToEdit) {
|
|
27721
|
+
return t("update.selectSubtitle");
|
|
27722
|
+
}
|
|
27723
|
+
return t("update.subtitle");
|
|
27724
|
+
};
|
|
27651
27725
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
27652
27726
|
id: "pelcro-payment-method-update-view"
|
|
27653
27727
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
27654
27728
|
className: "plc-mb-2 plc-text-center plc-text-gray-900 pelcro-title-wrapper"
|
|
27655
27729
|
}, /*#__PURE__*/React__default.createElement("h4", {
|
|
27656
27730
|
className: "plc-text-2xl plc-font-semibold "
|
|
27657
|
-
}, t("update.title")),
|
|
27658
|
-
type: "updatePaymentSource",
|
|
27659
|
-
showCoupon: false,
|
|
27660
|
-
showExternalPaymentMethods: false,
|
|
27661
|
-
showApplePayButton: false,
|
|
27662
|
-
onDisplay: props.onDisplay,
|
|
27663
|
-
onFailure: props.onFailure,
|
|
27664
|
-
onSuccess: props.onSuccess
|
|
27665
|
-
}, props)));
|
|
27731
|
+
}, t("update.title")), renderSubtitle()), renderContent());
|
|
27666
27732
|
}
|
|
27667
27733
|
|
|
27668
27734
|
const PaymentMethodUpdateModal = props => {
|
|
@@ -33138,6 +33204,9 @@ function DashboardWithHook(props) {
|
|
|
33138
33204
|
}),
|
|
33139
33205
|
setPaymentMethodToEdit: setPaymentMethodToEdit,
|
|
33140
33206
|
setPaymentMethodToDelete: setPaymentMethodToDelete
|
|
33207
|
+
// used for custom event when clicking on the new subscription button
|
|
33208
|
+
,
|
|
33209
|
+
onNewSubscriptionClick: props.onNewSubscriptionClick
|
|
33141
33210
|
});
|
|
33142
33211
|
}
|
|
33143
33212
|
DashboardWithHook.viewId = "dashboard";
|
|
@@ -33288,6 +33357,9 @@ class Dashboard extends Component {
|
|
|
33288
33357
|
let {
|
|
33289
33358
|
isGift
|
|
33290
33359
|
} = _ref;
|
|
33360
|
+
if (this.props.onNewSubscriptionClick && !isGift) {
|
|
33361
|
+
return this.props.onNewSubscriptionClick();
|
|
33362
|
+
}
|
|
33291
33363
|
if (isGift) {
|
|
33292
33364
|
this.props.setProductAndPlan(null, null, true);
|
|
33293
33365
|
}
|