@tap-payments/apple-pay-button 1.0.20 → 1.1.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.
@@ -72,7 +72,7 @@ export interface ApplePayButtonProps {
72
72
  features: Features;
73
73
  onCancel?: () => void;
74
74
  onError?: (error: any) => void;
75
- onSuccess?: (data: Record<string, any>) => Promise<void>;
75
+ onSuccess?: (data: Record<string, any>, event?: Record<string, any>) => Promise<void>;
76
76
  onClick?: () => void;
77
77
  onReady?: () => void;
78
78
  onMerchantValidation?: (status: 'initiated' | 'completed' | 'error') => void;
@@ -207,7 +207,7 @@ export var useApplePay = function (_a) {
207
207
  });
208
208
  }); };
209
209
  session_1.onpaymentauthorized = function (event) { return __awaiter(void 0, void 0, void 0, function () {
210
- var _a, data, error_2;
210
+ var newEvent, _a, data, error_2;
211
211
  return __generator(this, function (_b) {
212
212
  switch (_b.label) {
213
213
  case 0:
@@ -217,13 +217,15 @@ export var useApplePay = function (_a) {
217
217
  _b.label = 1;
218
218
  case 1:
219
219
  _b.trys.push([1, 9, 10, 11]);
220
+ newEvent = __assign({}, event);
221
+ delete newEvent.payment.token;
220
222
  _a = scope;
221
223
  switch (_a) {
222
224
  case 'AppleToken': return [3, 2];
223
225
  case 'TapToken': return [3, 4];
224
226
  }
225
227
  return [3, 7];
226
- case 2: return [4, (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event.payment.token.paymentData))];
228
+ case 2: return [4, (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event.payment.token.paymentData, newEvent))];
227
229
  case 3:
228
230
  _b.sent();
229
231
  session_1.completePayment({ status: ApplePaySession.STATUS_SUCCESS });
@@ -231,7 +233,7 @@ export var useApplePay = function (_a) {
231
233
  case 4: return [4, appService.tapTokenization(event.payment.token.paymentData)];
232
234
  case 5:
233
235
  data = _b.sent();
234
- return [4, (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data))];
236
+ return [4, (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data, newEvent))];
235
237
  case 6:
236
238
  _b.sent();
237
239
  session_1.completePayment({ status: ApplePaySession.STATUS_SUCCESS });
@@ -20,7 +20,7 @@ export declare const getDefaultValues: (mainObject: ApplePayButtonProps) => {
20
20
  features: import("../@types").Features;
21
21
  onCancel?: (() => void) | undefined;
22
22
  onError?: ((error: any) => void) | undefined;
23
- onSuccess?: ((data: Record<string, any>) => Promise<void>) | undefined;
23
+ onSuccess?: ((data: Record<string, any>, event?: Record<string, any> | undefined) => Promise<void>) | undefined;
24
24
  onClick?: (() => void) | undefined;
25
25
  onReady?: (() => void) | undefined;
26
26
  onMerchantValidation?: ((status: "initiated" | "completed" | "error") => void) | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/apple-pay-button",
3
- "version": "1.0.20",
3
+ "version": "1.1.1",
4
4
  "description": "Apple Pay Button React Component",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",