@pelcro/react-pelcro-js 3.26.0-beta.6 → 3.26.0-beta.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 +18 -17
- package/dist/index.esm.js +18 -17
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -21165,7 +21165,7 @@ const DonationEmail = props => /*#__PURE__*/React__default['default'].createElem
|
|
|
21165
21165
|
* @return {JSX}
|
|
21166
21166
|
*/
|
|
21167
21167
|
const ApplePayButton = _ref => {
|
|
21168
|
-
var _ref2, _ref3, _state$updatedPrice, _props$plan;
|
|
21168
|
+
var _window$Pelcro$site$r, _ref2, _ref3, _state$updatedPrice, _props$plan;
|
|
21169
21169
|
let {
|
|
21170
21170
|
onClick,
|
|
21171
21171
|
props,
|
|
@@ -21179,16 +21179,20 @@ const ApplePayButton = _ref => {
|
|
|
21179
21179
|
plan,
|
|
21180
21180
|
invoice
|
|
21181
21181
|
} = usePelcro();
|
|
21182
|
+
const {
|
|
21183
|
+
payPageId,
|
|
21184
|
+
reportGroup,
|
|
21185
|
+
apple_pay_merchant_id: ApplePayMerchantId,
|
|
21186
|
+
apple_pay_enabled: ApplePayEnabled,
|
|
21187
|
+
apple_pay_billing_agreement: ApplePayBillingAgreement
|
|
21188
|
+
} = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings;
|
|
21182
21189
|
const updatedPrice = (_ref2 = (_ref3 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : props === null || props === void 0 ? void 0 : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref3 !== void 0 ? _ref3 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref2 !== void 0 ? _ref2 : invoice.amount_remaining;
|
|
21183
21190
|
React.useEffect(() => {
|
|
21184
21191
|
if (window.ApplePaySession) {
|
|
21185
|
-
// TODO: Should not be hardcoded
|
|
21186
|
-
const merchantIdentifier = "merchant.pelcro.prelive";
|
|
21187
|
-
|
|
21188
21192
|
// Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.
|
|
21189
|
-
const promise = ApplePaySession.canMakePaymentsWithActiveCard(
|
|
21193
|
+
const promise = ApplePaySession.canMakePaymentsWithActiveCard(ApplePayMerchantId);
|
|
21190
21194
|
promise.then(function (canMakePayments) {
|
|
21191
|
-
if (canMakePayments) {
|
|
21195
|
+
if (canMakePayments && ApplePayEnabled) {
|
|
21192
21196
|
// Display Apple Pay Buttons here…
|
|
21193
21197
|
const pelcroApplyPayButton = document.getElementById("pelcro-apple-pay-button");
|
|
21194
21198
|
if (pelcroApplyPayButton) {
|
|
@@ -21227,8 +21231,8 @@ const ApplePayButton = _ref => {
|
|
|
21227
21231
|
amount: updatedPrice / 100,
|
|
21228
21232
|
paymentTiming: "recurring",
|
|
21229
21233
|
recurringPaymentStartDate: new Date().toISOString(),
|
|
21230
|
-
recurringPaymentIntervalUnit: plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21231
|
-
recurringPaymentIntervalCount: plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21234
|
+
recurringPaymentIntervalUnit: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? "day" : plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21235
|
+
recurringPaymentIntervalCount: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? (plan === null || plan === void 0 ? void 0 : plan.interval_count) * 7 : plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21232
21236
|
} : {
|
|
21233
21237
|
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
|
|
21234
21238
|
amount: updatedPrice / 100
|
|
@@ -21241,16 +21245,16 @@ const ApplePayButton = _ref => {
|
|
|
21241
21245
|
amount: updatedPrice / 100,
|
|
21242
21246
|
paymentTiming: "recurring",
|
|
21243
21247
|
recurringPaymentStartDate: new Date().toISOString(),
|
|
21244
|
-
recurringPaymentIntervalUnit: plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21245
|
-
recurringPaymentIntervalCount: plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21248
|
+
recurringPaymentIntervalUnit: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? "day" : plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21249
|
+
recurringPaymentIntervalCount: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? (plan === null || plan === void 0 ? void 0 : plan.interval_count) * 7 : plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21246
21250
|
},
|
|
21247
|
-
billingAgreement:
|
|
21251
|
+
billingAgreement: ApplePayBillingAgreement !== null && ApplePayBillingAgreement !== void 0 ? ApplePayBillingAgreement : "",
|
|
21248
21252
|
managementURL: "https://applepaydemo.apple.com",
|
|
21249
21253
|
tokenNotificationURL: "https://applepaydemo.apple.com"
|
|
21250
21254
|
}
|
|
21251
21255
|
})
|
|
21252
21256
|
};
|
|
21253
|
-
|
|
21257
|
+
console.log(ApplePayPaymentRequest);
|
|
21254
21258
|
// Create ApplePaySession
|
|
21255
21259
|
// @todo - Clarify supported version parameter
|
|
21256
21260
|
// @odo - Apple Pay demo uses version 6 (https://applepaydemo.apple.com/)
|
|
@@ -21301,8 +21305,8 @@ const ApplePayButton = _ref => {
|
|
|
21301
21305
|
amount: updatedPrice / 100,
|
|
21302
21306
|
paymentTiming: "recurring",
|
|
21303
21307
|
recurringPaymentStartDate: new Date().toISOString(),
|
|
21304
|
-
recurringPaymentIntervalUnit: plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21305
|
-
recurringPaymentIntervalCount: plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21308
|
+
recurringPaymentIntervalUnit: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? "day" : plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21309
|
+
recurringPaymentIntervalCount: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? (plan === null || plan === void 0 ? void 0 : plan.interval_count) * 7 : plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21306
21310
|
} : {
|
|
21307
21311
|
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
|
|
21308
21312
|
amount: updatedPrice / 100
|
|
@@ -21348,7 +21352,6 @@ const ApplePayButton = _ref => {
|
|
|
21348
21352
|
// };
|
|
21349
21353
|
|
|
21350
21354
|
session.onpaymentauthorized = event => {
|
|
21351
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
21352
21355
|
console.log("on payment authorized step", event);
|
|
21353
21356
|
// Define ApplePayPaymentAuthorizationResult
|
|
21354
21357
|
const result = {
|
|
@@ -21378,8 +21381,6 @@ const ApplePayButton = _ref => {
|
|
|
21378
21381
|
}
|
|
21379
21382
|
};
|
|
21380
21383
|
console.log(applePayToken);
|
|
21381
|
-
const payPageId = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings.pay_page_id;
|
|
21382
|
-
const reportGroup = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.report_group;
|
|
21383
21384
|
const orderId = `pelcro-${new Date().getTime()}`;
|
|
21384
21385
|
const eProtectRequest = {
|
|
21385
21386
|
paypageId: payPageId,
|
package/dist/index.esm.js
CHANGED
|
@@ -21135,7 +21135,7 @@ const DonationEmail = props => /*#__PURE__*/React__default.createElement(Email,
|
|
|
21135
21135
|
* @return {JSX}
|
|
21136
21136
|
*/
|
|
21137
21137
|
const ApplePayButton = _ref => {
|
|
21138
|
-
var _ref2, _ref3, _state$updatedPrice, _props$plan;
|
|
21138
|
+
var _window$Pelcro$site$r, _ref2, _ref3, _state$updatedPrice, _props$plan;
|
|
21139
21139
|
let {
|
|
21140
21140
|
onClick,
|
|
21141
21141
|
props,
|
|
@@ -21149,16 +21149,20 @@ const ApplePayButton = _ref => {
|
|
|
21149
21149
|
plan,
|
|
21150
21150
|
invoice
|
|
21151
21151
|
} = usePelcro();
|
|
21152
|
+
const {
|
|
21153
|
+
payPageId,
|
|
21154
|
+
reportGroup,
|
|
21155
|
+
apple_pay_merchant_id: ApplePayMerchantId,
|
|
21156
|
+
apple_pay_enabled: ApplePayEnabled,
|
|
21157
|
+
apple_pay_billing_agreement: ApplePayBillingAgreement
|
|
21158
|
+
} = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings;
|
|
21152
21159
|
const updatedPrice = (_ref2 = (_ref3 = (_state$updatedPrice = state.updatedPrice) !== null && _state$updatedPrice !== void 0 ? _state$updatedPrice : props === null || props === void 0 ? void 0 : (_props$plan = props.plan) === null || _props$plan === void 0 ? void 0 : _props$plan.amount) !== null && _ref3 !== void 0 ? _ref3 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref2 !== void 0 ? _ref2 : invoice.amount_remaining;
|
|
21153
21160
|
useEffect(() => {
|
|
21154
21161
|
if (window.ApplePaySession) {
|
|
21155
|
-
// TODO: Should not be hardcoded
|
|
21156
|
-
const merchantIdentifier = "merchant.pelcro.prelive";
|
|
21157
|
-
|
|
21158
21162
|
// Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.
|
|
21159
|
-
const promise = ApplePaySession.canMakePaymentsWithActiveCard(
|
|
21163
|
+
const promise = ApplePaySession.canMakePaymentsWithActiveCard(ApplePayMerchantId);
|
|
21160
21164
|
promise.then(function (canMakePayments) {
|
|
21161
|
-
if (canMakePayments) {
|
|
21165
|
+
if (canMakePayments && ApplePayEnabled) {
|
|
21162
21166
|
// Display Apple Pay Buttons here…
|
|
21163
21167
|
const pelcroApplyPayButton = document.getElementById("pelcro-apple-pay-button");
|
|
21164
21168
|
if (pelcroApplyPayButton) {
|
|
@@ -21197,8 +21201,8 @@ const ApplePayButton = _ref => {
|
|
|
21197
21201
|
amount: updatedPrice / 100,
|
|
21198
21202
|
paymentTiming: "recurring",
|
|
21199
21203
|
recurringPaymentStartDate: new Date().toISOString(),
|
|
21200
|
-
recurringPaymentIntervalUnit: plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21201
|
-
recurringPaymentIntervalCount: plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21204
|
+
recurringPaymentIntervalUnit: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? "day" : plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21205
|
+
recurringPaymentIntervalCount: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? (plan === null || plan === void 0 ? void 0 : plan.interval_count) * 7 : plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21202
21206
|
} : {
|
|
21203
21207
|
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
|
|
21204
21208
|
amount: updatedPrice / 100
|
|
@@ -21211,16 +21215,16 @@ const ApplePayButton = _ref => {
|
|
|
21211
21215
|
amount: updatedPrice / 100,
|
|
21212
21216
|
paymentTiming: "recurring",
|
|
21213
21217
|
recurringPaymentStartDate: new Date().toISOString(),
|
|
21214
|
-
recurringPaymentIntervalUnit: plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21215
|
-
recurringPaymentIntervalCount: plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21218
|
+
recurringPaymentIntervalUnit: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? "day" : plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21219
|
+
recurringPaymentIntervalCount: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? (plan === null || plan === void 0 ? void 0 : plan.interval_count) * 7 : plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21216
21220
|
},
|
|
21217
|
-
billingAgreement:
|
|
21221
|
+
billingAgreement: ApplePayBillingAgreement !== null && ApplePayBillingAgreement !== void 0 ? ApplePayBillingAgreement : "",
|
|
21218
21222
|
managementURL: "https://applepaydemo.apple.com",
|
|
21219
21223
|
tokenNotificationURL: "https://applepaydemo.apple.com"
|
|
21220
21224
|
}
|
|
21221
21225
|
})
|
|
21222
21226
|
};
|
|
21223
|
-
|
|
21227
|
+
console.log(ApplePayPaymentRequest);
|
|
21224
21228
|
// Create ApplePaySession
|
|
21225
21229
|
// @todo - Clarify supported version parameter
|
|
21226
21230
|
// @odo - Apple Pay demo uses version 6 (https://applepaydemo.apple.com/)
|
|
@@ -21271,8 +21275,8 @@ const ApplePayButton = _ref => {
|
|
|
21271
21275
|
amount: updatedPrice / 100,
|
|
21272
21276
|
paymentTiming: "recurring",
|
|
21273
21277
|
recurringPaymentStartDate: new Date().toISOString(),
|
|
21274
|
-
recurringPaymentIntervalUnit: plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21275
|
-
recurringPaymentIntervalCount: plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21278
|
+
recurringPaymentIntervalUnit: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? "day" : plan === null || plan === void 0 ? void 0 : plan.interval,
|
|
21279
|
+
recurringPaymentIntervalCount: (plan === null || plan === void 0 ? void 0 : plan.interval) === "week" ? (plan === null || plan === void 0 ? void 0 : plan.interval_count) * 7 : plan === null || plan === void 0 ? void 0 : plan.interval_count
|
|
21276
21280
|
} : {
|
|
21277
21281
|
label: (plan === null || plan === void 0 ? void 0 : plan.nickname) || `invoice #${invoice.id}`,
|
|
21278
21282
|
amount: updatedPrice / 100
|
|
@@ -21318,7 +21322,6 @@ const ApplePayButton = _ref => {
|
|
|
21318
21322
|
// };
|
|
21319
21323
|
|
|
21320
21324
|
session.onpaymentauthorized = event => {
|
|
21321
|
-
var _window$Pelcro$site$r, _window$Pelcro$site$r2;
|
|
21322
21325
|
console.log("on payment authorized step", event);
|
|
21323
21326
|
// Define ApplePayPaymentAuthorizationResult
|
|
21324
21327
|
const result = {
|
|
@@ -21348,8 +21351,6 @@ const ApplePayButton = _ref => {
|
|
|
21348
21351
|
}
|
|
21349
21352
|
};
|
|
21350
21353
|
console.log(applePayToken);
|
|
21351
|
-
const payPageId = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings.pay_page_id;
|
|
21352
|
-
const reportGroup = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.report_group;
|
|
21353
21354
|
const orderId = `pelcro-${new Date().getTime()}`;
|
|
21354
21355
|
const eProtectRequest = {
|
|
21355
21356
|
paypageId: payPageId,
|