@idonatedev/idonate-sdk 1.0.16 → 1.1.0-dev0

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.
Files changed (50) hide show
  1. package/README.md +27 -0
  2. package/dist/apple-pay.d.ts +0 -1
  3. package/dist/apple-pay.js +32 -62
  4. package/dist/cloudflare-challenge-handler.d.ts +2 -2
  5. package/dist/cloudflare-challenge-handler.js +65 -92
  6. package/dist/config-handler.d.ts +3 -0
  7. package/dist/config-handler.js +16 -11
  8. package/dist/constants.d.ts +1 -0
  9. package/dist/constants.js +66 -2
  10. package/dist/google-pay.d.ts +0 -1
  11. package/dist/google-pay.js +65 -78
  12. package/dist/idonate-client.d.ts +6 -19
  13. package/dist/idonate-client.js +165 -192
  14. package/dist/index.js +40 -11
  15. package/dist/recaptcha.d.ts +0 -1
  16. package/dist/recaptcha.js +40 -49
  17. package/dist/shared.js +8 -9
  18. package/dist/test-utils.d.ts +81 -0
  19. package/dist/test-utils.js +110 -0
  20. package/dist/tokenize/CardConnectTokenizer.d.ts +43 -0
  21. package/dist/tokenize/CardConnectTokenizer.js +620 -0
  22. package/dist/tokenize/SpreedlyTokenizer.d.ts +85 -0
  23. package/dist/tokenize/SpreedlyTokenizer.js +952 -0
  24. package/dist/tokenize/Tokenizer.d.ts +32 -0
  25. package/dist/tokenize/Tokenizer.js +183 -0
  26. package/dist/tokenize/iats.js +11 -13
  27. package/dist/tokenize/index.d.ts +5 -3
  28. package/dist/tokenize/index.js +43 -6
  29. package/dist/tokenize/spreedly-secure.d.ts +8 -0
  30. package/dist/tokenize/spreedly-secure.js +43 -0
  31. package/dist/tokenize/styles.d.ts +3 -0
  32. package/dist/tokenize/styles.js +42 -0
  33. package/dist/tokenize/tokenizer-constants.d.ts +62 -0
  34. package/dist/tokenize/tokenizer-constants.js +65 -0
  35. package/dist/tokenize/tokenizer-utils.d.ts +19 -0
  36. package/dist/tokenize/tokenizer-utils.js +156 -0
  37. package/dist/tokenize/types.d.ts +149 -0
  38. package/dist/tokenize/types.js +30 -0
  39. package/dist/typeAdapters.d.ts +3 -2
  40. package/dist/typeAdapters.js +39 -48
  41. package/dist/types.d.ts +48 -41
  42. package/dist/types.js +12 -24
  43. package/dist/util.d.ts +2 -2
  44. package/dist/util.js +30 -33
  45. package/package.json +41 -18
  46. package/umd/idonate-sdk.js +1 -1
  47. package/dist/tokenize/cardconnect.d.ts +0 -3
  48. package/dist/tokenize/cardconnect.js +0 -16
  49. package/dist/tokenize/spreedly.d.ts +0 -48
  50. package/dist/tokenize/spreedly.js +0 -208
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseExpiryDate = parseExpiryDate;
4
+ exports.formatExpiryInput = formatExpiryInput;
5
+ exports.withTimeout = withTimeout;
6
+ exports.getConnectedBorderRadius = getConnectedBorderRadius;
7
+ exports.addFocusHandlers = addFocusHandlers;
8
+ exports.createFieldContainer = createFieldContainer;
9
+ exports.createInputElement = createInputElement;
10
+ exports.validateRoutingNumber = validateRoutingNumber;
11
+ exports.validateAccountNumber = validateAccountNumber;
12
+ exports.maskAccountNumber = maskAccountNumber;
13
+ exports.createAccountTypeSelect = createAccountTypeSelect;
14
+ exports.validateInstitutionNumber = validateInstitutionNumber;
15
+ exports.validateTransitNumber = validateTransitNumber;
16
+ exports.validateCanadianAccountNumber = validateCanadianAccountNumber;
17
+ exports.formatCanadianRoutingNumber = formatCanadianRoutingNumber;
18
+ function parseExpiryDate(value) {
19
+ const parts = value.split('/');
20
+ if (parts.length !== 2)
21
+ return null;
22
+ const month = parts[0];
23
+ const year = parts[1];
24
+ if (month.length !== 2 || year.length !== 2)
25
+ return null;
26
+ return {
27
+ month,
28
+ year: '20' + year,
29
+ };
30
+ }
31
+ function formatExpiryInput(value) {
32
+ let digits = value.replace(/\D/g, '');
33
+ digits = digits.substring(0, 4);
34
+ if (digits.length >= 2) {
35
+ return digits.substring(0, 2) + '/' + digits.substring(2, 4);
36
+ }
37
+ return digits;
38
+ }
39
+ function withTimeout(promise, timeoutMs, errorMessage) {
40
+ return Promise.race([
41
+ promise,
42
+ new Promise((_, reject) => setTimeout(() => reject(new Error(errorMessage)), timeoutMs)),
43
+ ]);
44
+ }
45
+ function getConnectedBorderRadius(baseRadius, position, isConnected) {
46
+ if (!isConnected)
47
+ return baseRadius;
48
+ switch (position) {
49
+ case 'left':
50
+ return `${baseRadius} 0 0 ${baseRadius}`;
51
+ case 'middle':
52
+ return '0';
53
+ case 'right':
54
+ return `0 ${baseRadius} ${baseRadius} 0`;
55
+ default:
56
+ return baseRadius;
57
+ }
58
+ }
59
+ function addFocusHandlers(element, styles, onFocus, onBlur) {
60
+ element.addEventListener('focus', () => {
61
+ if (styles.focus) {
62
+ Object.assign(element.style, styles.focus);
63
+ }
64
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus();
65
+ });
66
+ element.addEventListener('blur', () => {
67
+ element.style.borderColor = '';
68
+ element.style.outline = 'none';
69
+ element.style.boxShadow = 'none';
70
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur();
71
+ });
72
+ }
73
+ function createFieldContainer(id, flex, minWidth, maxWidth) {
74
+ const div = document.createElement('div');
75
+ div.id = id;
76
+ div.style.flex = flex;
77
+ div.style.display = 'flex';
78
+ if (minWidth)
79
+ div.style.minWidth = minWidth;
80
+ if (maxWidth)
81
+ div.style.maxWidth = maxWidth;
82
+ return div;
83
+ }
84
+ function createInputElement(id, type, placeholder, maxLength) {
85
+ const input = document.createElement('input');
86
+ input.id = id;
87
+ input.type = type;
88
+ input.placeholder = placeholder;
89
+ if (maxLength)
90
+ input.maxLength = maxLength;
91
+ return input;
92
+ }
93
+ function validateRoutingNumber(routingNumber) {
94
+ const cleaned = routingNumber.replace(/\D/g, '');
95
+ if (cleaned.length !== 9) {
96
+ return false;
97
+ }
98
+ const digits = cleaned.split('').map(Number);
99
+ const checksum = (digits[0] * 3 +
100
+ digits[1] * 7 +
101
+ digits[2] * 1 +
102
+ digits[3] * 3 +
103
+ digits[4] * 7 +
104
+ digits[5] * 1 +
105
+ digits[6] * 3 +
106
+ digits[7] * 7 +
107
+ digits[8] * 1) %
108
+ 10;
109
+ return checksum === 0;
110
+ }
111
+ function validateAccountNumber(accountNumber) {
112
+ const cleaned = accountNumber.replace(/\D/g, '');
113
+ if (cleaned.length < 4 || cleaned.length > 17) {
114
+ return false;
115
+ }
116
+ return /^\d+$/.test(cleaned);
117
+ }
118
+ function maskAccountNumber(accountNumber) {
119
+ const cleaned = accountNumber.replace(/\D/g, '');
120
+ if (cleaned.length <= 4) {
121
+ return cleaned;
122
+ }
123
+ const lastFour = cleaned.slice(-4);
124
+ const masked = '*'.repeat(cleaned.length - 4) + lastFour;
125
+ return masked;
126
+ }
127
+ function createAccountTypeSelect(id) {
128
+ const select = document.createElement('select');
129
+ select.id = id;
130
+ const checkingOption = document.createElement('option');
131
+ checkingOption.value = 'checking';
132
+ checkingOption.text = 'Checking';
133
+ const savingsOption = document.createElement('option');
134
+ savingsOption.value = 'savings';
135
+ savingsOption.text = 'Savings';
136
+ select.appendChild(checkingOption);
137
+ select.appendChild(savingsOption);
138
+ return select;
139
+ }
140
+ function validateInstitutionNumber(institutionNumber) {
141
+ const cleaned = institutionNumber.replace(/\D/g, '');
142
+ return cleaned.length === 3;
143
+ }
144
+ function validateTransitNumber(transitNumber) {
145
+ const cleaned = transitNumber.replace(/\D/g, '');
146
+ return cleaned.length === 5;
147
+ }
148
+ function validateCanadianAccountNumber(accountNumber) {
149
+ const cleaned = accountNumber.replace(/\D/g, '');
150
+ return cleaned.length >= 7;
151
+ }
152
+ function formatCanadianRoutingNumber(institutionNumber, transitNumber) {
153
+ const institution = institutionNumber.replace(/\D/g, '').padStart(3, '0');
154
+ const transit = transitNumber.replace(/\D/g, '').padStart(5, '0');
155
+ return '0' + institution + transit;
156
+ }
@@ -0,0 +1,149 @@
1
+ export type PaymentMethodType = 'credit_card' | 'bank_account' | 'paypal' | 'apple_pay' | 'google_pay';
2
+ export type PaymentMethodMode = 'credit_card' | 'bank_account';
3
+ export interface PaymentGateway {
4
+ id: string;
5
+ backend_name: string;
6
+ gateway_type?: string;
7
+ name: string;
8
+ config?: {
9
+ environment_key?: string;
10
+ base_url?: string;
11
+ merchant_id?: string;
12
+ [key: string]: any;
13
+ };
14
+ }
15
+ export interface TokenizerContainer {
16
+ containerId: string;
17
+ styling?: TokenizerStyling;
18
+ mode?: PaymentMethodMode;
19
+ bankCountry?: 'US' | 'CA';
20
+ enableTestMode?: boolean;
21
+ }
22
+ export interface TokenizerStylingComplete {
23
+ input: {
24
+ height: string;
25
+ padding: string;
26
+ fontSize: string;
27
+ fontFamily: string;
28
+ border: string;
29
+ borderRadius: string;
30
+ backgroundColor: string;
31
+ color: string;
32
+ boxSizing: string;
33
+ width: string;
34
+ lineHeight?: string;
35
+ transition: string;
36
+ };
37
+ focus: {
38
+ borderColor: string;
39
+ outline: string;
40
+ boxShadow: string;
41
+ };
42
+ error: {
43
+ borderColor: string;
44
+ color?: string;
45
+ backgroundColor?: string;
46
+ };
47
+ container: {
48
+ display: string;
49
+ gap: string;
50
+ alignItems: string;
51
+ };
52
+ }
53
+ type DeepPartial<T> = T extends object ? {
54
+ [P in keyof T]?: DeepPartial<T[P]>;
55
+ } : T;
56
+ export type TokenizerStyling = DeepPartial<TokenizerStylingComplete>;
57
+ export interface CardData {
58
+ firstName: string;
59
+ lastName: string;
60
+ expiryMonth: string;
61
+ expiryYear: string;
62
+ email?: string;
63
+ phone?: string;
64
+ address?: {
65
+ line1?: string;
66
+ line2?: string;
67
+ city?: string;
68
+ state?: string;
69
+ postalCode?: string;
70
+ country?: string;
71
+ };
72
+ }
73
+ export interface BankAccountData {
74
+ routingNumber: string;
75
+ accountNumber: string;
76
+ accountType: 'checking' | 'savings';
77
+ accountHolderType: 'personal' | 'business';
78
+ firstName: string;
79
+ lastName: string;
80
+ email?: string;
81
+ phone?: string;
82
+ address?: {
83
+ line1?: string;
84
+ line2?: string;
85
+ city?: string;
86
+ state?: string;
87
+ postalCode?: string;
88
+ country?: string;
89
+ };
90
+ }
91
+ export interface CanadianBankAccountData extends Omit<BankAccountData, 'routingNumber'> {
92
+ institutionNumber: string;
93
+ transitNumber: string;
94
+ }
95
+ export type PaymentData = CardData | BankAccountData | CanadianBankAccountData;
96
+ export interface PaymentToken {
97
+ token: string;
98
+ lastFour: string;
99
+ cardType?: CardType;
100
+ accountType?: 'checking' | 'savings';
101
+ paymentMethodType?: PaymentMethodMode;
102
+ expiresAt?: Date;
103
+ provider?: string;
104
+ }
105
+ export type CardType = 'visa' | 'mastercard' | 'amex' | 'discover' | 'diners' | 'jcb' | 'unknown';
106
+ export type TokenizerEvent = 'ready' | 'focus' | 'blur' | 'change' | 'validation' | 'cardTypeChange' | 'error' | 'tokenization';
107
+ export interface ValidationState {
108
+ isValid: boolean;
109
+ cardNumber?: {
110
+ isValid: boolean;
111
+ isEmpty: boolean;
112
+ error?: string;
113
+ };
114
+ cvv?: {
115
+ isValid: boolean;
116
+ isEmpty: boolean;
117
+ error?: string;
118
+ };
119
+ expiry?: {
120
+ isValid: boolean;
121
+ isEmpty: boolean;
122
+ error?: string;
123
+ };
124
+ routingNumber?: {
125
+ isValid: boolean;
126
+ isEmpty: boolean;
127
+ error?: string;
128
+ };
129
+ accountNumber?: {
130
+ isValid: boolean;
131
+ isEmpty: boolean;
132
+ error?: string;
133
+ };
134
+ }
135
+ export interface ValidationResult {
136
+ isValid: boolean;
137
+ errors: ValidationError[];
138
+ }
139
+ export interface ValidationError {
140
+ field: 'cardNumber' | 'cvv' | 'expiry' | 'routingNumber' | 'accountNumber';
141
+ message: string;
142
+ code?: string;
143
+ }
144
+ export declare class TokenizationError extends Error {
145
+ errors: ValidationError[];
146
+ code?: string;
147
+ constructor(errors: any[] | string, code?: string);
148
+ }
149
+ export {};
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TokenizationError = void 0;
4
+ class TokenizationError extends Error {
5
+ constructor(errors, code) {
6
+ const message = typeof errors === 'string'
7
+ ? errors
8
+ : errors.map((e) => e.message || e).join(', ');
9
+ super(message);
10
+ this.name = 'TokenizationError';
11
+ this.code = code;
12
+ if (Array.isArray(errors)) {
13
+ this.errors = errors.map((e) => ({
14
+ field: e.field || e.attribute || 'unknown',
15
+ message: e.message || e.error || String(e),
16
+ code: e.code || e.key,
17
+ }));
18
+ }
19
+ else {
20
+ this.errors = [
21
+ {
22
+ field: 'cardNumber',
23
+ message: errors,
24
+ code,
25
+ },
26
+ ];
27
+ }
28
+ }
29
+ }
30
+ exports.TokenizationError = TokenizationError;
@@ -3,7 +3,7 @@ export declare function buildCashPaymentPayload(organizationId: string, input: C
3
3
  export declare function buildDonationResult(response: ClientResponse): CreateDonationResult;
4
4
  export declare function buildCreatePaymentMethodPayload(input: CreatePaymentMethodRequest): {
5
5
  gateway_id: string | undefined;
6
- backend_name: "spreedly" | "card_connect" | "iats" | undefined;
6
+ backend_name: import("./types").BackendName | undefined;
7
7
  payment_method_type: import("./types").PaymentMethodType;
8
8
  payment_method_token: string;
9
9
  donor_id: string | undefined;
@@ -18,11 +18,12 @@ export declare function buildCreatePaymentMethodPayload(input: CreatePaymentMeth
18
18
  city: string;
19
19
  state: string;
20
20
  zip_code: string;
21
+ embed_id: string | undefined;
21
22
  recaptcha_token: string;
22
23
  recaptcha_type: import("./types").RecaptchaType;
23
24
  };
24
25
  export declare function collapseClientErrors(errors: ClientError[]): ClientError;
25
26
  export declare function buildCreatePaymentMethodResult(response: ClientResponse): CreatePaymentMethodResult;
26
- export declare type SpreedlyResponse = any;
27
+ export type SpreedlyResponse = any;
27
28
  export declare function unpackSpreedlyResponse(response: any): Promise<SpreedlyResponse>;
28
29
  export declare function extractSpreedlyToken(spreedlyData: SpreedlyResponse): string;
@@ -1,21 +1,16 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.extractSpreedlyToken = exports.unpackSpreedlyResponse = exports.buildCreatePaymentMethodResult = exports.collapseClientErrors = exports.buildCreatePaymentMethodPayload = exports.buildDonationResult = exports.buildCashPaymentPayload = void 0;
15
- var types_1 = require("./types");
3
+ exports.buildCashPaymentPayload = buildCashPaymentPayload;
4
+ exports.buildDonationResult = buildDonationResult;
5
+ exports.buildCreatePaymentMethodPayload = buildCreatePaymentMethodPayload;
6
+ exports.collapseClientErrors = collapseClientErrors;
7
+ exports.buildCreatePaymentMethodResult = buildCreatePaymentMethodResult;
8
+ exports.unpackSpreedlyResponse = unpackSpreedlyResponse;
9
+ exports.extractSpreedlyToken = extractSpreedlyToken;
10
+ const types_1 = require("./types");
16
11
  function buildCashPaymentPayload(organizationId, input) {
17
12
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
18
- var billingAddress = {
13
+ const billingAddress = {
19
14
  country: input.billingAddress.country,
20
15
  address1: input.billingAddress.address1,
21
16
  address2: input.billingAddress.address2,
@@ -23,7 +18,7 @@ function buildCashPaymentPayload(organizationId, input) {
23
18
  state: input.billingAddress.state,
24
19
  zip_code: input.billingAddress.zip,
25
20
  };
26
- var billingContact = {
21
+ const billingContact = {
27
22
  title: input.billingContact.salutation,
28
23
  first_name: input.billingContact.firstName,
29
24
  middle_name: input.billingContact.middleName,
@@ -33,7 +28,7 @@ function buildCashPaymentPayload(organizationId, input) {
33
28
  home_phone: input.billingContact.primaryPhone,
34
29
  timezone: new Intl.DateTimeFormat().resolvedOptions().timeZone,
35
30
  };
36
- var payment = {
31
+ const payment = {
37
32
  payment_method_id: input.paymentMethodId,
38
33
  gateway_id: input.paymentGatewayId,
39
34
  amount: input.paymentAmount,
@@ -43,7 +38,7 @@ function buildCashPaymentPayload(organizationId, input) {
43
38
  end_date: input.recurringEnd,
44
39
  retain_on_success: input.retainPaymentMethod,
45
40
  };
46
- var donationOptions = {
41
+ const donationOptions = {
47
42
  organization_id: organizationId,
48
43
  campaign_id: input.campaignId,
49
44
  reference_code: input.referenceCode,
@@ -97,7 +92,7 @@ function buildCashPaymentPayload(organizationId, input) {
97
92
  amount: input.paymentAmount,
98
93
  });
99
94
  }
100
- var utmFields = {};
95
+ const utmFields = {};
101
96
  if (input.utm) {
102
97
  if (input.utm.campaign) {
103
98
  utmFields.utm_campaign = input.utm.campaign;
@@ -115,22 +110,23 @@ function buildCashPaymentPayload(organizationId, input) {
115
110
  utmFields.utm_term = input.utm.term;
116
111
  }
117
112
  }
118
- [1, 2, 3, 4, 5].forEach(function (customNoteIndex) {
119
- var key = "custom_note_" + customNoteIndex;
120
- if (input.customerMeta[key]) {
121
- donationOptions[key] = input.customerMeta[key];
122
- delete input.customerMeta[key];
123
- }
124
- });
125
- return __assign(__assign(__assign(__assign(__assign(__assign({}, donationOptions), billingAddress), billingContact), payment), utmFields), { customer_meta: input.customerMeta, recaptcha_token: input.recaptchaToken, recaptcha_type: input.recaptchaType });
113
+ if (input.customerMeta) {
114
+ [1, 2, 3, 4, 5].forEach((customNoteIndex) => {
115
+ const key = `custom_note_${customNoteIndex}`;
116
+ if (input.customerMeta[key]) {
117
+ donationOptions[key] = input.customerMeta[key];
118
+ delete input.customerMeta[key];
119
+ }
120
+ });
121
+ }
122
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, donationOptions), billingAddress), billingContact), payment), utmFields), { customer_meta: input.customerMeta || {}, recaptcha_token: input.recaptchaToken, recaptcha_type: input.recaptchaType });
126
123
  }
127
- exports.buildCashPaymentPayload = buildCashPaymentPayload;
128
124
  function buildDonationResult(response) {
129
- var campaign;
130
- var designation;
131
- var donor;
132
- var schedule;
133
- var transaction;
125
+ let campaign;
126
+ let designation;
127
+ let donor;
128
+ let schedule;
129
+ let transaction;
134
130
  if (response._raw_response.transaction) {
135
131
  transaction = response._raw_response.transaction;
136
132
  }
@@ -146,13 +142,12 @@ function buildDonationResult(response) {
146
142
  if (response._raw_response.campaign) {
147
143
  campaign = response._raw_response.campaign;
148
144
  }
149
- return __assign(__assign({}, response), { campaign: campaign,
150
- designation: designation,
151
- donor: donor,
152
- schedule: schedule,
153
- transaction: transaction });
145
+ return Object.assign(Object.assign({}, response), { campaign,
146
+ designation,
147
+ donor,
148
+ schedule,
149
+ transaction });
154
150
  }
155
- exports.buildDonationResult = buildDonationResult;
156
151
  function buildCreatePaymentMethodPayload(input) {
157
152
  return {
158
153
  gateway_id: input.paymentGatewayId,
@@ -171,36 +166,32 @@ function buildCreatePaymentMethodPayload(input) {
171
166
  city: input.address.city,
172
167
  state: input.address.state,
173
168
  zip_code: input.address.zip,
169
+ embed_id: input.embedId,
174
170
  recaptcha_token: input.recaptchaToken,
175
171
  recaptcha_type: input.recaptchaType,
176
172
  };
177
173
  }
178
- exports.buildCreatePaymentMethodPayload = buildCreatePaymentMethodPayload;
179
174
  function collapseClientErrors(errors) {
180
- return new types_1.ClientError(errors.map(function (err) { return err.message; }).join("\n "), {
175
+ return new types_1.ClientError(errors.map((err) => err.message).join(`\n `), {
181
176
  _rawPayload: errors,
182
177
  });
183
178
  }
184
- exports.collapseClientErrors = collapseClientErrors;
185
179
  function buildCreatePaymentMethodResult(response) {
186
- return __assign(__assign({}, response), { paymentMethodId: response._raw_response.result.id });
180
+ return Object.assign(Object.assign({}, response), { paymentMethodId: response._raw_response.result.id });
187
181
  }
188
- exports.buildCreatePaymentMethodResult = buildCreatePaymentMethodResult;
189
182
  function unpackSpreedlyResponse(response) {
190
- return response.json().then(function (data) {
183
+ return response.json().then((data) => {
191
184
  if (data.errors) {
192
185
  throw new types_1.ClientError(data.errors
193
- .map(function (spreedlyError) { return spreedlyError.message; })
194
- .join("\n "), data);
186
+ .map((spreedlyError) => spreedlyError.message)
187
+ .join(`\n `), data);
195
188
  }
196
189
  return data;
197
190
  });
198
191
  }
199
- exports.unpackSpreedlyResponse = unpackSpreedlyResponse;
200
192
  function extractSpreedlyToken(spreedlyData) {
201
193
  if (!spreedlyData.transaction || !spreedlyData.transaction.payment_method) {
202
194
  throw new types_1.ClientError('Payment Method not tokenized.');
203
195
  }
204
196
  return spreedlyData.transaction.payment_method.token;
205
197
  }
206
- exports.extractSpreedlyToken = extractSpreedlyToken;