@tap-payments/apple-pay-button 1.1.1 → 1.1.2

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.
@@ -80,8 +80,8 @@ export interface ApplePayButtonProps {
80
80
  onShippingContactSelected?: (shippingContact: ApplePayPaymentContact) => Promise<ApplePayUpdateData>;
81
81
  onPaymentMethodSelected?: (paymentMethod: ApplePayPaymentMethod) => Promise<ApplePayUpdateData>;
82
82
  onCouponChanged?: (couponCode: string) => Promise<ApplePayUpdateData>;
83
- metaData?: MetaData;
84
83
  debug?: boolean;
84
+ metaData?: MetaData;
85
85
  }
86
86
  export interface MerchantResponse {
87
87
  id: string;
@@ -45,6 +45,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __rest = (this && this.__rest) || function (s, e) {
49
+ var t = {};
50
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
51
+ t[p] = s[p];
52
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
53
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
54
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
55
+ t[p[i]] = s[p[i]];
56
+ }
57
+ return t;
58
+ };
48
59
  import { useCallback, useEffect, useState } from 'react';
49
60
  import appService from '../api/app.service';
50
61
  import { ApplePayVersion } from '../constants';
@@ -207,45 +218,46 @@ export var useApplePay = function (_a) {
207
218
  });
208
219
  }); };
209
220
  session_1.onpaymentauthorized = function (event) { return __awaiter(void 0, void 0, void 0, function () {
210
- var newEvent, _a, data, error_2;
211
- return __generator(this, function (_b) {
212
- switch (_b.label) {
221
+ var _a, token, rest, newEvent, _b, data, error_2;
222
+ var _c;
223
+ return __generator(this, function (_d) {
224
+ switch (_d.label) {
213
225
  case 0:
214
226
  setLoading(true);
215
227
  if (debug)
216
228
  console.info('onpaymentauthorized event', event);
217
- _b.label = 1;
229
+ _d.label = 1;
218
230
  case 1:
219
- _b.trys.push([1, 9, 10, 11]);
220
- newEvent = __assign({}, event);
221
- delete newEvent.payment.token;
222
- _a = scope;
223
- switch (_a) {
231
+ _d.trys.push([1, 9, 10, 11]);
232
+ _a = (_c = event.payment) !== null && _c !== void 0 ? _c : {}, token = _a.token, rest = __rest(_a, ["token"]);
233
+ newEvent = { payment: rest };
234
+ _b = scope;
235
+ switch (_b) {
224
236
  case 'AppleToken': return [3, 2];
225
237
  case 'TapToken': return [3, 4];
226
238
  }
227
239
  return [3, 7];
228
240
  case 2: return [4, (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event.payment.token.paymentData, newEvent))];
229
241
  case 3:
230
- _b.sent();
242
+ _d.sent();
231
243
  session_1.completePayment({ status: ApplePaySession.STATUS_SUCCESS });
232
244
  return [3, 8];
233
245
  case 4: return [4, appService.tapTokenization(event.payment.token.paymentData)];
234
246
  case 5:
235
- data = _b.sent();
247
+ data = _d.sent();
236
248
  return [4, (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data, newEvent))];
237
249
  case 6:
238
- _b.sent();
250
+ _d.sent();
239
251
  session_1.completePayment({ status: ApplePaySession.STATUS_SUCCESS });
240
252
  return [3, 8];
241
253
  case 7:
242
254
  console.error('We only support AppleToken and TapToken for now');
243
255
  console.info('Completing payment with status: STATUS_FAILURE');
244
256
  session_1.completePayment({ status: ApplePaySession.STATUS_FAILURE });
245
- _b.label = 8;
257
+ _d.label = 8;
246
258
  case 8: return [3, 11];
247
259
  case 9:
248
- error_2 = _b.sent();
260
+ error_2 = _d.sent();
249
261
  if (debug)
250
262
  console.error('error in onpaymentauthorized', error_2);
251
263
  session_1.completePayment({ status: ApplePaySession.STATUS_FAILURE });
@@ -28,7 +28,7 @@ export declare const getDefaultValues: (mainObject: ApplePayButtonProps) => {
28
28
  onShippingContactSelected?: ((shippingContact: import("../@types").ApplePayPaymentContact) => Promise<import("../@types").ApplePayUpdateData>) | undefined;
29
29
  onPaymentMethodSelected?: ((paymentMethod: import("../@types").ApplePayPaymentMethod) => Promise<import("../@types").ApplePayUpdateData>) | undefined;
30
30
  onCouponChanged?: ((couponCode: string) => Promise<import("../@types").ApplePayUpdateData>) | undefined;
31
- metaData?: import("../@types").MetaData | undefined;
32
31
  debug?: boolean | undefined;
32
+ metaData?: import("../@types").MetaData | undefined;
33
33
  };
34
34
  export declare const getMerchantCapaplities: (supportedCards?: Array<string>) => ("supports3DS" | "supportsCredit" | "supportsDebit")[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/apple-pay-button",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Apple Pay Button React Component",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.js",