@idonatedev/idonate-sdk 1.0.16 → 1.0.17

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.
@@ -1,4 +1,4 @@
1
- import iDonateClient from "./idonate-client";
1
+ import iDonateClient from './idonate-client';
2
2
  export declare const handleCFChallenge: (challengeResponse: Response, sdkClient: iDonateClient) => Promise<{
3
3
  token: string;
4
4
  preClearance?: boolean | undefined;
@@ -38,71 +38,76 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.handleCFChallenge = void 0;
40
40
  var turnstileInstance = null;
41
- exports.handleCFChallenge = function (challengeResponse, sdkClient) { return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
42
- var document_1, challengeWrapper_1, challengeDiv_1, showChallenge_1, cloudflareScript;
43
- var _a, _b, _c;
44
- return __generator(this, function (_d) {
45
- try {
46
- document_1 = window === null || window === void 0 ? void 0 : window.document;
47
- if (!document_1 || !window) {
48
- throw new Error('document is not present on window');
49
- }
50
- challengeWrapper_1 = document_1.createElement('div');
51
- challengeDiv_1 = document_1.createElement('div');
52
- showChallenge_1 = function (turnstile) {
53
- var _a;
54
- (_a = turnstile === null || turnstile === void 0 ? void 0 : turnstile.render) === null || _a === void 0 ? void 0 : _a.call(turnstile, "#iDonateTurnstileBox", {
55
- sitekey: sdkClient.config.turnstileSiteKey,
56
- callback: function (token, preClearance) {
57
- challengeWrapper_1.remove();
58
- resolve({ token: token, preClearance: preClearance });
59
- },
60
- });
61
- };
62
- window.idonateTurnstileLoadedHandler = function () {
63
- var turnstile = window.turnstile;
64
- challengeDiv_1.innerHTML = '';
65
- if (turnstile) {
66
- turnstileInstance = turnstile;
41
+ exports.handleCFChallenge = function (challengeResponse, sdkClient) {
42
+ return new Promise(function (resolve, reject) { return __awaiter(void 0, void 0, void 0, function () {
43
+ var document_1, challengeWrapper_1, challengeDiv_1, showChallenge_1, cloudflareScript;
44
+ var _a, _b, _c;
45
+ return __generator(this, function (_d) {
46
+ try {
47
+ document_1 = window === null || window === void 0 ? void 0 : window.document;
48
+ if (!document_1 || !window) {
49
+ throw new Error('document is not present on window');
50
+ }
51
+ challengeWrapper_1 = document_1.createElement('div');
52
+ challengeDiv_1 = document_1.createElement('div');
53
+ showChallenge_1 = function (turnstile) {
54
+ var _a;
55
+ (_a = turnstile === null || turnstile === void 0 ? void 0 : turnstile.render) === null || _a === void 0 ? void 0 : _a.call(turnstile, '#iDonateTurnstileBox', {
56
+ sitekey: sdkClient.config.turnstileSiteKey,
57
+ callback: function (token, preClearance) {
58
+ challengeWrapper_1.remove();
59
+ resolve({ token: token, preClearance: preClearance });
60
+ },
61
+ });
62
+ };
63
+ window.idonateTurnstileLoadedHandler = function () {
64
+ var turnstile = window.turnstile;
65
+ challengeDiv_1.innerHTML = '';
66
+ if (turnstile) {
67
+ turnstileInstance = turnstile;
68
+ }
69
+ showChallenge_1(turnstile);
70
+ };
71
+ challengeWrapper_1.setAttribute('id', 'idonateTurnstileWrapper');
72
+ challengeWrapper_1.style.position = 'fixed';
73
+ challengeWrapper_1.style.top = '0';
74
+ challengeWrapper_1.style.bottom = '0';
75
+ challengeWrapper_1.style.left = '0';
76
+ challengeWrapper_1.style.right = '0';
77
+ challengeWrapper_1.style.backgroundColor = 'rgba(0,0,0,0.9)';
78
+ challengeWrapper_1.style.transition = 'all 400ms';
79
+ challengeWrapper_1.style.display = 'flex';
80
+ challengeWrapper_1.style.flexDirection = 'column';
81
+ challengeWrapper_1.style.padding = '40px 30px';
82
+ challengeWrapper_1.style.opacity = '0';
83
+ challengeWrapper_1.style.color = 'white';
84
+ challengeWrapper_1.style.fontFamily = 'sans-serif';
85
+ challengeWrapper_1.style.zIndex = '1000';
86
+ challengeWrapper_1.innerHTML =
87
+ '<h1 id="idonateTurnstileVerificationHeader">Last tiny step before we submit your payment:</h1>';
88
+ challengeDiv_1.setAttribute('id', 'iDonateTurnstileBox');
89
+ challengeWrapper_1.append(challengeDiv_1);
90
+ document_1.body.append(challengeWrapper_1);
91
+ if (turnstileInstance) {
92
+ showChallenge_1(turnstileInstance);
93
+ }
94
+ else {
95
+ cloudflareScript = document_1.createElement('script');
96
+ challengeDiv_1.innerHTML = 'loading ...';
97
+ cloudflareScript.src =
98
+ sdkClient.config.turnstileCdnUrl +
99
+ '?render=explicit&onload=idonateTurnstileLoadedHandler';
100
+ document_1.body.append(cloudflareScript);
67
101
  }
68
- showChallenge_1(turnstile);
69
- };
70
- challengeWrapper_1.setAttribute('id', 'idonateTurnstileWrapper');
71
- challengeWrapper_1.style.position = 'fixed';
72
- challengeWrapper_1.style.top = '0';
73
- challengeWrapper_1.style.bottom = '0';
74
- challengeWrapper_1.style.left = '0';
75
- challengeWrapper_1.style.right = '0';
76
- challengeWrapper_1.style.backgroundColor = 'rgba(0,0,0,0.9)';
77
- challengeWrapper_1.style.transition = 'all 400ms';
78
- challengeWrapper_1.style.display = 'flex';
79
- challengeWrapper_1.style.flexDirection = 'column';
80
- challengeWrapper_1.style.padding = '40px 30px';
81
- challengeWrapper_1.style.opacity = '0';
82
- challengeWrapper_1.style.color = 'white';
83
- challengeWrapper_1.style.fontFamily = 'sans-serif';
84
- challengeWrapper_1.style.zIndex = '1000';
85
- challengeWrapper_1.innerHTML = '<h1 id="idonateTurnstileVerificationHeader">Last tiny step before we submit your payment:</h1>';
86
- challengeDiv_1.setAttribute('id', 'iDonateTurnstileBox');
87
- challengeWrapper_1.append(challengeDiv_1);
88
- document_1.body.append(challengeWrapper_1);
89
- if (turnstileInstance) {
90
- showChallenge_1(turnstileInstance);
102
+ (_a = challengeDiv_1.scrollIntoView) === null || _a === void 0 ? void 0 : _a.call(challengeDiv_1);
103
+ challengeWrapper_1.style.opacity = '1';
91
104
  }
92
- else {
93
- cloudflareScript = document_1.createElement('script');
94
- challengeDiv_1.innerHTML = 'loading ...';
95
- cloudflareScript.src = sdkClient.config.turnstileCdnUrl + '?render=explicit&onload=idonateTurnstileLoadedHandler';
96
- document_1.body.append(cloudflareScript);
105
+ catch (e) {
106
+ (_b = console === null || console === void 0 ? void 0 : console.error) === null || _b === void 0 ? void 0 : _b.call(console, e);
107
+ (_c = console === null || console === void 0 ? void 0 : console.warn) === null || _c === void 0 ? void 0 : _c.call(console, 'iDonate SDK: Could not handle request, please reload the page and try again');
108
+ reject(null);
97
109
  }
98
- (_a = challengeDiv_1.scrollIntoView) === null || _a === void 0 ? void 0 : _a.call(challengeDiv_1);
99
- challengeWrapper_1.style.opacity = '1';
100
- }
101
- catch (e) {
102
- (_b = console === null || console === void 0 ? void 0 : console.error) === null || _b === void 0 ? void 0 : _b.call(console, e);
103
- (_c = console === null || console === void 0 ? void 0 : console.warn) === null || _c === void 0 ? void 0 : _c.call(console, 'iDonate SDK: Could not handle request, please reload the page and try again');
104
- reject(null);
105
- }
106
- return [2];
107
- });
108
- }); }); };
110
+ return [2];
111
+ });
112
+ }); });
113
+ };
@@ -28,8 +28,10 @@ var ConfigHandler = (function () {
28
28
  }
29
29
  this.pcScriptBase = options.pcScriptBase || constants_1.FALLBACK_PC_SCRIPT_URL;
30
30
  this.pcScriptId = options.pcScriptId || constants_1.FALLBACK_PC_SCRIPT_ID;
31
- this.turnstileCdnUrl = options.turnstileCdnUrl || constants_1.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL;
32
- this.turnstileSiteKey = options.turnstileSiteKey || constants_1.FALLBACK_CF_TURNSTILE_SITE_KEY;
31
+ this.turnstileCdnUrl =
32
+ options.turnstileCdnUrl || constants_1.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL;
33
+ this.turnstileSiteKey =
34
+ options.turnstileSiteKey || constants_1.FALLBACK_CF_TURNSTILE_SITE_KEY;
33
35
  if (options === null || options === void 0 ? void 0 : options.spreedlyEnvironmentKey) {
34
36
  this.spreedlyEnvironmentKey = options.spreedlyEnvironmentKey;
35
37
  }
@@ -62,7 +62,7 @@ var clientDefaults = {
62
62
  enableSandboxMode: false,
63
63
  overrideBaseUrl: undefined,
64
64
  enableDelay: false,
65
- secondsToDelay: 0
65
+ secondsToDelay: 0,
66
66
  };
67
67
  var iDonateClient = (function () {
68
68
  function iDonateClient(clientKey, options) {
@@ -135,13 +135,15 @@ var iDonateClient = (function () {
135
135
  throw new Error('Wow, that was fast - try again');
136
136
  }
137
137
  var payload = typeAdapters_1.buildCashPaymentPayload(this.organizationId, donation);
138
- var fetchCall = function (clearanceToken) { return fetch(_this.config.embedApiBaseUrl + "/donate/cash-payment", {
139
- method: 'POST',
140
- headers: __assign(__assign(__assign({}, constants_1.CLIENT_HEADERS), (clearanceToken ? { 'cf-validation-token': clearanceToken } : {})), { 'User-Agent': constants_1.CLIENT_HEADERS['User-Agent'] + ' source:' + _this.config.client }),
141
- body: JSON.stringify(payload),
142
- credentials: 'include',
143
- }); };
144
- return fetchCall()
138
+ var fetchCall = function (clearanceToken) {
139
+ return fetch(_this.config.embedApiBaseUrl + "/donate/cash-payment", {
140
+ method: 'POST',
141
+ headers: __assign(__assign(__assign({}, constants_1.CLIENT_HEADERS), (clearanceToken ? { 'cf-validation-token': clearanceToken } : {})), { 'User-Agent': constants_1.CLIENT_HEADERS['User-Agent'] + ' source:' + _this.config.client }),
142
+ body: JSON.stringify(payload),
143
+ credentials: 'include',
144
+ });
145
+ };
146
+ return (fetchCall()
145
147
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
146
148
  var clearance;
147
149
  return __generator(this, function (_a) {
@@ -157,7 +159,7 @@ var iDonateClient = (function () {
157
159
  });
158
160
  }); })
159
161
  .then(function (response) { return util_1.parseResponse(response, { throwErrors: true }); })
160
- .then(function (response) { return typeAdapters_1.buildDonationResult(response); });
162
+ .then(function (response) { return typeAdapters_1.buildDonationResult(response); }));
161
163
  };
162
164
  iDonateClient.prototype.createTransaction = function (donation) {
163
165
  return this.createDonation(donation).then(function (result) {
@@ -213,7 +215,7 @@ var iDonateClient = (function () {
213
215
  var resolvedOptions = __assign(__assign({}, formDefaults), (formOptions || {}));
214
216
  var paramString = new URLSearchParams(resolvedOptions)
215
217
  .toString()
216
- .replace('+', '%20');
218
+ .replace(/\+/g, '%20');
217
219
  return this.config.cardConnectTokenizerUrl + "?" + paramString;
218
220
  };
219
221
  iDonateClient.prototype.waitForDonationResult = function (donationId, afterEachCheck) {
package/dist/recaptcha.js CHANGED
@@ -42,7 +42,8 @@ function injectScript(callback) {
42
42
  script.async = true;
43
43
  script.defer = true;
44
44
  script.onload = callback || null;
45
- if (document.readyState === 'interactive' || document.readyState === 'complete') {
45
+ if (document.readyState === 'interactive' ||
46
+ document.readyState === 'complete') {
46
47
  document.body.appendChild(script);
47
48
  }
48
49
  else {
@@ -76,10 +77,13 @@ var RecaptchaElement = (function () {
76
77
  RecaptchaElement.prototype.resolveToken = function () {
77
78
  var _this = this;
78
79
  return new Promise(function (resolve, reject) {
79
- resolveLib().then(function (lib) {
80
+ resolveLib()
81
+ .then(function (lib) {
80
82
  if (_this.params.size !== 'invisible') {
81
83
  var response = lib.getResponse();
82
- return response ? resolve(response) : reject(new Error('checkbox recaptcha is not checked'));
84
+ return response
85
+ ? resolve(response)
86
+ : reject(new Error('checkbox recaptcha is not checked'));
83
87
  }
84
88
  _this.executeResolveQueue.push(resolve);
85
89
  if (_this.resolvedToken !== undefined) {
@@ -87,7 +91,8 @@ var RecaptchaElement = (function () {
87
91
  lib.reset(_this.widgetId);
88
92
  }
89
93
  lib.execute(_this.widgetId);
90
- }).catch(function (e) {
94
+ })
95
+ .catch(function (e) {
91
96
  reject(e);
92
97
  });
93
98
  });
@@ -0,0 +1,82 @@
1
+ /// <reference types="jest" />
2
+ export declare const createMockFetch: (response: any, options?: {
3
+ ok?: boolean;
4
+ status?: number;
5
+ }) => jest.Mock<any, any>;
6
+ export declare const createMockFetchError: (message: string) => jest.Mock<any, any>;
7
+ export declare const createMockFetchWithImplementation: (implementation: (url: string, options?: any) => Promise<any>) => jest.Mock<any, any>;
8
+ export declare const setupFetchMock: () => jest.Mock<any, any>;
9
+ export declare const setupDocumentMock: () => {
10
+ mockScript: {
11
+ src: string;
12
+ async: boolean;
13
+ defer: boolean;
14
+ };
15
+ mockAppendChild: jest.Mock<any, any>;
16
+ mockCreateElement: jest.Mock<any, []>;
17
+ };
18
+ export declare const setupApplePayEnvironment: (options?: {
19
+ canMakePayments?: boolean;
20
+ supportsVersion?: boolean;
21
+ }) => {
22
+ mockSession: {
23
+ begin: jest.Mock<any, any>;
24
+ abort: jest.Mock<any, any>;
25
+ completeMerchantValidation: jest.Mock<any, any>;
26
+ completePayment: jest.Mock<any, any>;
27
+ };
28
+ ApplePaySessionMock: any;
29
+ };
30
+ export declare const setupGooglePayEnvironment: (options?: {
31
+ autoLoad?: boolean;
32
+ }) => {
33
+ mockPaymentsClient: {
34
+ isReadyToPay: jest.Mock<any, any>;
35
+ loadPaymentData: jest.Mock<any, any>;
36
+ };
37
+ googlePayMock: {
38
+ payments: {
39
+ api: {
40
+ PaymentsClient: jest.Mock<{
41
+ isReadyToPay: jest.Mock<any, any>;
42
+ loadPaymentData: jest.Mock<any, any>;
43
+ }, []>;
44
+ };
45
+ };
46
+ };
47
+ };
48
+ export declare const setupRecaptchaEnvironment: () => {
49
+ render: jest.Mock<any, any>;
50
+ reset: jest.Mock<any, any>;
51
+ execute: jest.Mock<any, any>;
52
+ getResponse: jest.Mock<any, any>;
53
+ };
54
+ export declare const createTestContact: (overrides?: {}) => {
55
+ salutation: string;
56
+ firstName: string;
57
+ lastName: string;
58
+ company: string;
59
+ email: string;
60
+ primaryPhone: string;
61
+ };
62
+ export declare const createTestAddress: (overrides?: {}) => {
63
+ address1: string;
64
+ address2: string;
65
+ city: string;
66
+ state: string;
67
+ zip: string;
68
+ country: string;
69
+ };
70
+ export declare const createTestCreditCard: (overrides?: {}) => {
71
+ cardNumber: string;
72
+ expirationMonth: string;
73
+ expirationYear: string;
74
+ verificationValue: string;
75
+ };
76
+ export declare const createTestBankAccount: (overrides?: {}) => {
77
+ accountNumber: string;
78
+ routingNumber: string;
79
+ accountType: "checking";
80
+ accountHolderType: "personal";
81
+ };
82
+ export declare const cleanupWindowMocks: () => void;
@@ -0,0 +1,154 @@
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.cleanupWindowMocks = exports.createTestBankAccount = exports.createTestCreditCard = exports.createTestAddress = exports.createTestContact = exports.setupRecaptchaEnvironment = exports.setupGooglePayEnvironment = exports.setupApplePayEnvironment = exports.setupDocumentMock = exports.setupFetchMock = exports.createMockFetchWithImplementation = exports.createMockFetchError = exports.createMockFetch = void 0;
51
+ exports.createMockFetch = function (response, options) {
52
+ if (options === void 0) { options = {}; }
53
+ return jest.fn().mockResolvedValue({
54
+ ok: options.ok !== false,
55
+ status: options.status || 200,
56
+ json: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
57
+ return [2, response];
58
+ }); }); },
59
+ text: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
60
+ return [2, JSON.stringify(response)];
61
+ }); }); },
62
+ });
63
+ };
64
+ exports.createMockFetchError = function (message) {
65
+ return jest.fn().mockRejectedValue(new Error(message));
66
+ };
67
+ exports.createMockFetchWithImplementation = function (implementation) {
68
+ return jest.fn().mockImplementation(implementation);
69
+ };
70
+ exports.setupFetchMock = function () {
71
+ var mockFetch = jest.fn();
72
+ global.fetch = mockFetch;
73
+ return mockFetch;
74
+ };
75
+ exports.setupDocumentMock = function () {
76
+ var mockScript = {
77
+ src: '',
78
+ async: false,
79
+ defer: false,
80
+ };
81
+ var mockAppendChild = jest.fn();
82
+ var mockCreateElement = jest.fn(function () { return mockScript; });
83
+ Object.defineProperty(document, 'createElement', {
84
+ value: mockCreateElement,
85
+ writable: true,
86
+ });
87
+ Object.defineProperty(document.body, 'appendChild', {
88
+ value: mockAppendChild,
89
+ writable: true,
90
+ });
91
+ return { mockScript: mockScript, mockAppendChild: mockAppendChild, mockCreateElement: mockCreateElement };
92
+ };
93
+ exports.setupApplePayEnvironment = function (options) {
94
+ if (options === void 0) { options = {}; }
95
+ var mockSession = {
96
+ begin: jest.fn(),
97
+ abort: jest.fn(),
98
+ completeMerchantValidation: jest.fn(),
99
+ completePayment: jest.fn(),
100
+ };
101
+ var ApplePaySessionMock = jest.fn(function () { return mockSession; });
102
+ ApplePaySessionMock.canMakePayments = jest.fn(function () { return options.canMakePayments !== false; });
103
+ ApplePaySessionMock.supportsVersion = jest.fn(function () { return options.supportsVersion !== false; });
104
+ window.ApplePaySession = ApplePaySessionMock;
105
+ return { mockSession: mockSession, ApplePaySessionMock: ApplePaySessionMock };
106
+ };
107
+ exports.setupGooglePayEnvironment = function (options) {
108
+ if (options === void 0) { options = {}; }
109
+ var mockPaymentsClient = {
110
+ isReadyToPay: jest.fn(),
111
+ loadPaymentData: jest.fn(),
112
+ };
113
+ var googlePayMock = {
114
+ payments: {
115
+ api: {
116
+ PaymentsClient: jest.fn(function () { return mockPaymentsClient; }),
117
+ },
118
+ },
119
+ };
120
+ if (options.autoLoad) {
121
+ window.google = googlePayMock;
122
+ }
123
+ return { mockPaymentsClient: mockPaymentsClient, googlePayMock: googlePayMock };
124
+ };
125
+ exports.setupRecaptchaEnvironment = function () {
126
+ var mockGrecaptcha = {
127
+ render: jest.fn().mockReturnValue(123),
128
+ reset: jest.fn(),
129
+ execute: jest.fn(),
130
+ getResponse: jest.fn().mockReturnValue(null),
131
+ };
132
+ return mockGrecaptcha;
133
+ };
134
+ exports.createTestContact = function (overrides) {
135
+ if (overrides === void 0) { overrides = {}; }
136
+ return (__assign({ salutation: 'Mr', firstName: 'John', lastName: 'Doe', company: 'Test Corp', email: 'test@example.com', primaryPhone: '555-1234' }, overrides));
137
+ };
138
+ exports.createTestAddress = function (overrides) {
139
+ if (overrides === void 0) { overrides = {}; }
140
+ return (__assign({ address1: '123 Test St', address2: 'Suite 100', city: 'Test City', state: 'NY', zip: '10001', country: 'US' }, overrides));
141
+ };
142
+ exports.createTestCreditCard = function (overrides) {
143
+ if (overrides === void 0) { overrides = {}; }
144
+ return (__assign({ cardNumber: '4111111111111111', expirationMonth: '12', expirationYear: '2025', verificationValue: '123' }, overrides));
145
+ };
146
+ exports.createTestBankAccount = function (overrides) {
147
+ if (overrides === void 0) { overrides = {}; }
148
+ return (__assign({ accountNumber: '1234567890', routingNumber: '021000021', accountType: 'checking', accountHolderType: 'personal' }, overrides));
149
+ };
150
+ exports.cleanupWindowMocks = function () {
151
+ delete window.ApplePaySession;
152
+ delete window.google;
153
+ delete window.grecaptcha;
154
+ };
@@ -1,4 +1,3 @@
1
- /// <reference types="spreedly-iframe-browser" />
2
1
  import { ACHAccount, Address, Contact, CreditCard, SpreedlyInstance } from '../types';
3
2
  import ConfigHandler from '../config-handler';
4
3
  export declare function tokenizeBankAccount(data: {
@@ -36,7 +35,7 @@ export declare class SpreedlyAsync {
36
35
  private tokenPromise;
37
36
  private tokenResolve;
38
37
  private tokenReject;
39
- constructor(environmentKey: string, numberEl: string, cvvEl: string, inputStyle?: string, PassedSPF?: typeof SpreedlyPaymentFrame);
38
+ constructor(environmentKey: string, numberEl: string, cvvEl: string, inputStyle?: string, PassedSPF?: typeof window.SpreedlyPaymentFrame);
40
39
  tokenizeCreditCard(fields: {
41
40
  first_name: string;
42
41
  last_name: string;
@@ -150,7 +150,9 @@ var SpreedlyAsync = (function () {
150
150
  this.tokenPromise = null;
151
151
  this.tokenResolve = null;
152
152
  this.tokenReject = null;
153
- var Spreedly = (this.spreedly = PassedSPF ? new PassedSPF() : new window.SpreedlyPaymentFrame());
153
+ var Spreedly = (this.spreedly = PassedSPF
154
+ ? new PassedSPF()
155
+ : new window.SpreedlyPaymentFrame());
154
156
  Spreedly.on('ready', function () {
155
157
  Spreedly.setPlaceholder('number', 'Card Number');
156
158
  Spreedly.setFieldType('number', 'text');
package/dist/types.d.ts CHANGED
@@ -48,7 +48,7 @@ export declare type ACHAccount = {
48
48
  accountType: 'checking' | 'savings';
49
49
  };
50
50
  export declare type PaymentMethodType = 'credit_card' | 'bank_account' | 'paypal' | 'apple_pay' | 'google_pay';
51
- export declare type RecaptchaType = 'v2' | 'v3' | 'invisible' | 'organization' | 'nonce';
51
+ export declare type RecaptchaType = 'v2' | 'v3' | 'invisible' | 'organization' | 'nonce' | 'bypass';
52
52
  export declare type RecaptchaSecuredRequest = {
53
53
  recaptchaType: RecaptchaType;
54
54
  recaptchaToken: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@idonatedev/idonate-sdk",
3
3
  "author": "iDonate",
4
- "version": "1.0.16",
4
+ "version": "1.0.17",
5
5
  "sideEffects": false,
6
6
  "description": "iDonate Web SDK",
7
7
  "main": "dist/index.js",
@@ -12,16 +12,21 @@
12
12
  "/umd"
13
13
  ],
14
14
  "scripts": {
15
- "test": "npx tslint 'src/**/*.ts' && jest",
15
+ "test": "jest",
16
16
  "lint": "npx tslint 'src/**/*.ts'",
17
+ "lint:fix": "npx tslint --fix 'src/**/*.ts'",
17
18
  "format": "npx prettier --write 'src/**/*.ts'",
18
19
  "build": "npx tsc && webpack",
19
- "watch": "npx tsc -w"
20
+ "watch": "npx tsc -w",
21
+ "prepare": "husky install"
20
22
  },
21
23
  "devDependencies": {
22
24
  "@types/jest": "^26.0.4",
25
+ "husky": "^8.0.3",
23
26
  "jest": "^26.1.0",
27
+ "lint-staged": "^13.2.3",
24
28
  "prettier": "^2.0.5",
29
+ "ts-jest": "^26.5.6",
25
30
  "ts-node": "^8.9.1",
26
31
  "tslint": "^6.1.2",
27
32
  "typescript": "^3.9.7",
@@ -31,6 +36,12 @@
31
36
  "prettier": {
32
37
  "singleQuote": true
33
38
  },
39
+ "lint-staged": {
40
+ "*.ts": [
41
+ "prettier --write",
42
+ "tslint --fix"
43
+ ]
44
+ },
34
45
  "dependencies": {
35
46
  "@types/applepayjs": "^14.0.6",
36
47
  "@types/googlepay": "^0.5.0",
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.idonate=t():e.idonate=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CLIENT_HEADERS=t.CARD_CONNECT_DEFAULT_STYLE=t.DEFAULT_APP_NAME=t.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL=t.FALLBACK_CF_TURNSTILE_SITE_KEY=t.FALLBACK_PC_SCRIPT_ID=t.FALLBACK_PC_SCRIPT_URL=t.SANDBOX_APPLE_PAY_URL=t.APPLE_PAY_URL=t.SPREEDLY_TOKENIZER_URL=t.SANDBOX_CARD_CONNECT_BASE_URL=t.PRODUCTION_CARD_CONNECT_BASE_URL=t.SANDBOX_BASE_URL=t.PRODUCTION_BASE_URL=void 0,t.PRODUCTION_BASE_URL="https://secure-api.idonate.com",t.SANDBOX_BASE_URL="https://api.qa-idonate.com",t.PRODUCTION_CARD_CONNECT_BASE_URL="https://boltgw.cardconnect.com:8443",t.SANDBOX_CARD_CONNECT_BASE_URL="https://boltgw-uat.cardconnect.com",t.SPREEDLY_TOKENIZER_URL="https://core.spreedly.com/v1/payment_methods.json",t.APPLE_PAY_URL="https://apple-pay-gateway.apple.com/paymentservices/paymentSession",t.SANDBOX_APPLE_PAY_URL="https://apple-pay-gateway-cert.apple.com/paymentservices/paymentSession",t.FALLBACK_PC_SCRIPT_URL="https://p.idonate.com/r",t.FALLBACK_PC_SCRIPT_ID="_3fd4dad26e8c277bc50fb2ddf8233b50bc8d9704",t.FALLBACK_CF_TURNSTILE_SITE_KEY="0x4AAAAAAAxuRxNZTvX8shIj",t.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL="https://challenges.cloudflare.com/turnstile/v0/api.js",t.DEFAULT_APP_NAME="unnamed-sdk-client",t.CARD_CONNECT_DEFAULT_STYLE="\nbody {\n margin: 0;\n}\n\nform {\n display: flex;\n}\n\nlabel#cccardlabel {\n display: none;\n}\n\nbr {\n display: none;\n}\n\nlabel#cccvvlabel {\n display: none;\n}\n\nlabel#ccexpirylabel {\n display: none;\n}\n\ninput {\n padding: 10px;\n}\n\nselect {\n padding: 10px;\n font-size: 14px;\n color: #8b959d;\n}\n\nselect#ccexpirymonth {\n margin-right: -30px;\n border: 1px solid #b6b8ba;\n border-right: 0;\n}\n\ninput#ccnumfield {\n width: 70%;\n border: 1px solid #b6b8ba;\n border-right: 0;\n border-top-left-radius: 3px;\n border-bottom-left-radius: 3px;\n font-size: 14px;\n color: #8b959d;\n}\n\nselect#ccexpiryyear {\n border: 1px solid #b6b8ba;\n border-right: 0;\n}\n\ninput#cccvvfield {\n border: 1px solid #b6b8ba;\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n font-size: 14px;\n color: #8b959d;\n}\n".replace(/\s+/gi," "),t.CLIENT_HEADERS={"User-Agent":navigator.userAgent+" idonate-sdk@1.0.16","Content-Type":"application/json"}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.extractSpreedlyToken=t.unpackSpreedlyResponse=t.buildCreatePaymentMethodResult=t.collapseClientErrors=t.buildCreatePaymentMethodPayload=t.buildDonationResult=t.buildCashPaymentPayload=void 0;var o=n(2);t.buildCashPaymentPayload=function(e,t){var n,o,i,a,s,c,u,d,l,p,f,y,h,m,v,_,b,g={country:t.billingAddress.country,address1:t.billingAddress.address1,address2:t.billingAddress.address2,city:t.billingAddress.city,state:t.billingAddress.state,zip_code:t.billingAddress.zip},w={title:t.billingContact.salutation,first_name:t.billingContact.firstName,middle_name:t.billingContact.middleName,last_name:t.billingContact.lastName,company_name:t.billingContact.company,email:t.billingContact.email,home_phone:t.billingContact.primaryPhone,timezone:(new Intl.DateTimeFormat).resolvedOptions().timeZone},P={payment_method_id:t.paymentMethodId,gateway_id:t.paymentGatewayId,amount:t.paymentAmount,type:"cash",frequency:t.recurringFrequency,start_date:t.recurringStart,end_date:t.recurringEnd,retain_on_success:t.retainPaymentMethod},C={organization_id:e,campaign_id:t.campaignId,reference_code:t.referenceCode,double_the_donation_company_id:t.corporateMatchingId,donor_id:t.donorId,hide_name:t.anonymousOptIn,show_name_to_fundraiser:t.showNameToFundraiserOptIn,email_opt_in:t.emailOptIn,donor_paid_fee:t.donorPaidFeeAmount,designation_note:t.designationNote,gift_id:t.giftId,gift_extra:t.giftExtra,gift_skipped:t.giftSkipped,p2p_fundraiser_id:t.p2pFundraiserId,p2p_fundraiser_comment:t.p2pFundraiserComment,organization_event_id:t.organizationEventId,advocate_id:t.advocateId,advocacy_program_id:t.advocacyProgramId,advocacy_team_id:t.advocacyTeamId,page_id:t.landingPageId,embed_id:t.embedId,tribute_definition_id:null===(n=t.tribute)||void 0===n?void 0:n.tributeDefinitionId,tribute_first_name:null===(o=t.tribute)||void 0===o?void 0:o.tributeFirstName,tribute_last_name:null===(i=t.tribute)||void 0===i?void 0:i.tributeLastName,tribute_address1:null===(a=t.tribute)||void 0===a?void 0:a.tributeAddress1,tribute_address2:null===(s=t.tribute)||void 0===s?void 0:s.tributeAddress2,tribute_city:null===(c=t.tribute)||void 0===c?void 0:c.tributeCity,tribute_state:null===(u=t.tribute)||void 0===u?void 0:u.tributeState,tribute_postal_code:null===(d=t.tribute)||void 0===d?void 0:d.tributePostalCode,tribute_country:null===(l=t.tribute)||void 0===l?void 0:l.tributeCountry,tribute_from_name:null===(p=t.tribute)||void 0===p?void 0:p.tributeFromName,tribute_recipient_email:null===(f=t.tribute)||void 0===f?void 0:f.tributeRecipientEmail,honorees:null===(y=t.tribute)||void 0===y?void 0:y.honorees,tribute_send_card:null===(h=t.tribute)||void 0===h?void 0:h.tributeSendCard,tribute_include_amount:null===(m=t.tribute)||void 0===m?void 0:m.tributeIncludeAmount,tribute_skipped:null===(v=t.tribute)||void 0===v?void 0:v.tributeSkipped,tribute_type:null===(_=t.tribute)||void 0===_?void 0:_.tributeType,useOnBillingAddress:null===(b=t.tribute)||void 0===b?void 0:b.useOnBillingAddress,embed_referer:window.location.href,converted_to_recurring:t.convertedToRecurring};t.designations?C.designations=t.designations:C.designations=[],t.designationId&&C.designations.push({id:t.designationId,amount:t.paymentAmount});var A={};return t.utm&&(t.utm.campaign&&(A.utm_campaign=t.utm.campaign),t.utm.content&&(A.utm_content=t.utm.content),t.utm.medium&&(A.utm_medium=t.utm.medium),t.utm.source&&(A.utm_source=t.utm.source),t.utm.term&&(A.utm_term=t.utm.term)),[1,2,3,4,5].forEach((function(e){var n="custom_note_"+e;t.customerMeta[n]&&(C[n]=t.customerMeta[n],delete t.customerMeta[n])})),r(r(r(r(r(r({},C),g),w),P),A),{customer_meta:t.customerMeta,recaptcha_token:t.recaptchaToken,recaptcha_type:t.recaptchaType})},t.buildDonationResult=function(e){var t,n,o,i,a;return e._raw_response.transaction&&(a=e._raw_response.transaction),e._raw_response.schedule&&(i=e._raw_response.schedule),e._raw_response.donor&&(o=e._raw_response.donor),e._raw_response.designation&&(n=e._raw_response.designation),e._raw_response.campaign&&(t=e._raw_response.campaign),r(r({},e),{campaign:t,designation:n,donor:o,schedule:i,transaction:a})},t.buildCreatePaymentMethodPayload=function(e){return{gateway_id:e.paymentGatewayId,backend_name:e.backendName,payment_method_type:e.paymentMethodType,payment_method_token:e.paymentMethodToken,donor_id:e.donorId,first_name:e.contact.firstName,last_name:e.contact.lastName,company:e.contact.company,email:e.contact.email,phone:e.contact.primaryPhone,country:e.address.country,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip_code:e.address.zip,recaptcha_token:e.recaptchaToken,recaptcha_type:e.recaptchaType}},t.collapseClientErrors=function(e){return new o.ClientError(e.map((function(e){return e.message})).join("\n "),{_rawPayload:e})},t.buildCreatePaymentMethodResult=function(e){return r(r({},e),{paymentMethodId:e._raw_response.result.id})},t.unpackSpreedlyResponse=function(e){return e.json().then((function(e){if(e.errors)throw new o.ClientError(e.errors.map((function(e){return e.message})).join("\n "),e);return e}))},t.extractSpreedlyToken=function(e){if(!e.transaction||!e.transaction.payment_method)throw new o.ClientError("Payment Method not tokenized.");return e.transaction.payment_method.token}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.ClientError=void 0;var i=function(e){function t(n,r){var o=e.call(this,n)||this;return o.message=n,o.details=r,Error.captureStackTrace&&Error.captureStackTrace(o,t),o}return o(t,e),t}(Error);t.ClientError=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseResponse=t.splitName=t.sanitizeObject=t.sanitizeArray=t.sanitizeString=t.receiveEmbedData=void 0;var r=n(2),o=n(1);function i(e){if(!e)return e;var t=document.createElement("div");t.innerHTML=e;for(var n=0,r=Array.from(t.getElementsByTagName("script"));n<r.length;n++){var o=r[n];o.parentNode&&o.parentNode.removeChild(o)}return t.innerHTML}function a(e){return e.map(s)}function s(e){if(null==e)return e;if(Array.isArray(e))return a(e);if("string"==typeof e)return i(e);if("object"==typeof e){for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var o=r[n],c=o[0],u=o[1];Array.isArray(u)?t[c]=a(u):t[c]="string"==typeof u?i(u):s(u)}return t}return e}t.receiveEmbedData=function(){var e;return new Promise((function(t,n){window.parent||n("Cannot receive data without parent"),e=function(e){var n;try{n=JSON.parse(e.data)}catch(e){return}n.embedData&&t(n.embedData)},window.addEventListener("message",e)})).then((function(t){return window.removeEventListener("message",e),t}))},t.sanitizeString=i,t.sanitizeArray=a,t.sanitizeObject=s,t.splitName=function(e){var t=e.split(" ");return{firstName:t.slice(0,-1).join(" ")||"NOT GIVEN",lastName:t.slice(-1).join(" ")}},t.parseResponse=function(e,t){return e.json().then((function(n){var i=[];if(200!==e.status&&(void 0!==n.result&&Object.keys(n.result).forEach((function(e){i.push(new r.ClientError(e+": "+n.result[e].join("\n "),{field:e}))})),void 0!==n.messages?n.messages.forEach((function(e){"error"===e.category&&i.push(new r.ClientError(e.message))})):i.push(new r.ClientError(n.message))),t&&t.throwErrors&&i.length)throw o.collapseClientErrors(i);return{errors:i,_raw_response:n}}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tokenizeBankAccount=void 0,t.tokenizeBankAccount=function(e,t,n){return fetch(n.cardConnectBaseUrl+"/cardsecure/api/v1/ccn/tokenize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:e+"/"+t,unique:!0})}).then((function(e){return e.json()}))}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.SpreedlyAsync=t.tokenizePayPal=t.tokenizeCreditCard=t.tokenizeBankAccount=void 0;var i=n(0),a=n(1);t.tokenizeBankAccount=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(i.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{bank_account:{first_name:e.contact.firstName||void 0,last_name:e.contact.lastName||void 0,full_name:e.contact.fullName||void 0,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country,bank_account_number:e.account.accountNumber.replace(/\s+/g,""),bank_routing_number:e.account.routingNumber.replace(/\s+/g,""),bank_account_holder_type:e.account.accountHolderType,bank_account_type:e.account.accountType}},retained:!1})}).then(a.unpackSpreedlyResponse).then(a.extractSpreedlyToken)},t.tokenizeCreditCard=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(i.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{credit_card:{first_name:e.contact.firstName,last_name:e.contact.lastName,full_name:e.contact.fullName,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country,number:e.card.cardNumber.replace(/\s+/g,""),verification_value:e.card.verificationValue,year:e.card.expirationYear,month:e.card.expirationMonth}},retained:!1})}).then(a.unpackSpreedlyResponse).then(a.extractSpreedlyToken)},t.tokenizePayPal=function(e,t){if(void 0===t.spreedlyEnvironmentKey)throw new Error("Spreedly is not configured.");return fetch(i.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{payment_method_type:"paypal",first_name:e.contact.firstName,last_name:e.contact.lastName,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country},retained:!1})}).then(a.unpackSpreedlyResponse).then(a.extractSpreedlyToken)};var s=function(){function e(e,t,n,r,o){var i=this;this.tokenPromise=null,this.tokenResolve=null,this.tokenReject=null;var a=this.spreedly=o?new o:new window.SpreedlyPaymentFrame;a.on("ready",(function(){a.setPlaceholder("number","Card Number"),a.setFieldType("number","text"),a.setNumberFormat("prettyFormat"),a.setPlaceholder("cvv","CVV"),a.setFieldType("cvv","text"),r&&(a.setStyle("number",r),a.setStyle("cvv",r))})),a.on("errors",(function(e){var t=e.map((function(e){return e.message})).join(" ");if(!i.tokenPromise||!i.tokenReject)throw new Error(t);i.tokenPromise=null,i.tokenReject(new Error(t))})),a.on("paymentMethod",(function(e){if(!i.tokenPromise||!i.tokenResolve)throw new Error("No pending tokenization request");i.tokenResolve(e),i.tokenPromise=null})),a.init(e,{numberEl:t,cvvEl:n})}return e.prototype.tokenizeCreditCard=function(e){return r(this,void 0,void 0,(function(){var t=this;return o(this,(function(n){if(this.tokenPromise)throw new Error("Tokenization already in progress");return this.tokenPromise=new Promise((function(n,r){t.tokenResolve=n,t.tokenReject=r,t.spreedly.tokenizeCreditCard(e)})),[2,this.tokenPromise]}))}))},e}();t.SpreedlyAsync=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createPaymentMethod=void 0;var r=n(1),o=n(0),i=n(3);t.createPaymentMethod=function(e,t){var n=r.buildCreatePaymentMethodPayload(e);return fetch(t.embedApiBaseUrl+"/payment/payment-methods",{method:"POST",headers:o.CLIENT_HEADERS,body:JSON.stringify(n)}).then((function(e){return i.parseResponse(e,{throwErrors:!0})})).then((function(e){return r.buildCreatePaymentMethodResult(e)}))}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),a=function(){function e(e){this.appleSession=null,this.paymentRequestDefaults={currencyCode:"USD",countryCode:"US",merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["amex","masterCard","visa","discover"],requiredBillingContactFields:["postalAddress","name"],requiredShippingContactFields:["email","phone"],total:{label:"iDonate",amount:"",type:"final"}},this.paymentRequest=Object.assign({},this.paymentRequestDefaults,e)}return e.isSupported=function(){return window.ApplePaySession&&ApplePaySession.canMakePayments()&&ApplePaySession.supportsVersion(e.ApplePayApiVersion)},e.prototype.begin=function(){return r(this,void 0,void 0,(function(){return o(this,(function(t){if(!e.isSupported())throw new Error("Apple Pay Not Supported");return this.appleSession=new ApplePaySession(e.ApplePayApiVersion,this.paymentRequest),this.appleSession.begin(),[2,this.appleSession]}))}))},e.prototype.createSession=function(e,t){return fetch(t+"/payment/create-session",{method:"POST",headers:i.CLIENT_HEADERS,body:JSON.stringify(e)}).then((function(e){return e.json()}))},e.prototype.tokenizeWithCardConnect=function(e,t){var n=e.token.paymentData,r=n.data+"&ectype=apple&ecsig="+n.signature+"&eckey="+n.header.ephemeralPublicKey+"&ectid="+n.header.transactionId+"&echash=&ecpublickeyhash="+n.header.publicKeyHash;return fetch(t+"/cardsecure/api/v1/ccn/tokenize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encryptionhandler:"EC_APPLE_PAY",devicedata:r,unique:!0})}).then((function(e){return e.json()}))},e.ApplePayApiVersion=6,e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(e){e.enableSandboxMode?(this.apiBaseUrl=r.SANDBOX_BASE_URL,this.cardConnectBaseUrl=r.SANDBOX_CARD_CONNECT_BASE_URL,this.applePayUrl=r.SANDBOX_APPLE_PAY_URL):(this.apiBaseUrl=r.PRODUCTION_BASE_URL,this.cardConnectBaseUrl=r.PRODUCTION_CARD_CONNECT_BASE_URL,this.applePayUrl=r.APPLE_PAY_URL),this.client=e.sdkClientName||r.DEFAULT_APP_NAME,e.overrideBaseUrl&&(this.apiBaseUrl=e.overrideBaseUrl),this.authApiBaseUrl=e.overrideAuthApiBaseUrl||this.apiBaseUrl+"/auth",this.donorApiBaseUrl=e.overrideDonorApiBaseUrl||this.apiBaseUrl+"/donor",this.embedApiBaseUrl=e.overrideEmbedApiBaseUrl||this.apiBaseUrl+"/embed",e.overrideApplePayUrl&&(this.applePayUrl=e.overrideApplePayUrl),this.pcScriptBase=e.pcScriptBase||r.FALLBACK_PC_SCRIPT_URL,this.pcScriptId=e.pcScriptId||r.FALLBACK_PC_SCRIPT_ID,this.turnstileCdnUrl=e.turnstileCdnUrl||r.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL,this.turnstileSiteKey=e.turnstileSiteKey||r.FALLBACK_CF_TURNSTILE_SITE_KEY,(null==e?void 0:e.spreedlyEnvironmentKey)&&(this.spreedlyEnvironmentKey=e.spreedlyEnvironmentKey),this.enableDelay=e.enableDelay||!1,this.secondsToDelay=e.secondsToDelay||0,this.cardConnectTokenizerUrl=this.cardConnectBaseUrl+"/itoke/ajax-tokenizer.html"};t.default=o},function(e,t,n){"use strict";n.r(t),n.d(t,"v1",(function(){return f})),n.d(t,"v3",(function(){return w})),n.d(t,"v4",(function(){return P})),n.d(t,"v5",(function(){return S}));var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),o=new Uint8Array(16);function i(){if(!r)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}for(var a=[],s=0;s<256;++s)a[s]=(s+256).toString(16).substr(1);var c,u,d=function(e,t){var n=t||0,r=a;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")},l=0,p=0;var f=function(e,t,n){var r=t&&n||0,o=t||[],a=(e=e||{}).node||c,s=void 0!==e.clockseq?e.clockseq:u;if(null==a||null==s){var f=e.random||(e.rng||i)();null==a&&(a=c=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==s&&(s=u=16383&(f[6]<<8|f[7]))}var y=void 0!==e.msecs?e.msecs:(new Date).getTime(),h=void 0!==e.nsecs?e.nsecs:p+1,m=y-l+(h-p)/1e4;if(m<0&&void 0===e.clockseq&&(s=s+1&16383),(m<0||y>l)&&void 0===e.nsecs&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=y,p=h,u=s;var v=(1e4*(268435455&(y+=122192928e5))+h)%4294967296;o[r++]=v>>>24&255,o[r++]=v>>>16&255,o[r++]=v>>>8&255,o[r++]=255&v;var _=y/4294967296*1e4&268435455;o[r++]=_>>>8&255,o[r++]=255&_,o[r++]=_>>>24&15|16,o[r++]=_>>>16&255,o[r++]=s>>>8|128,o[r++]=255&s;for(var b=0;b<6;++b)o[r+b]=a[b];return t||d(o)};var y=function(e,t,n){var r=function(e,r,o,i){var a=o&&i||0;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(e)),"string"==typeof r&&(r=function(e){var t=[];return e.replace(/[a-fA-F0-9]{2}/g,(function(e){t.push(parseInt(e,16))})),t}(r)),!Array.isArray(e))throw TypeError("value must be an array of bytes");if(!Array.isArray(r)||16!==r.length)throw TypeError("namespace must be uuid string or an Array of 16 byte values");var s=n(r.concat(e));if(s[6]=15&s[6]|t,s[8]=63&s[8]|128,o)for(var c=0;c<16;++c)o[a+c]=s[c];return o||d(s)};try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r};function h(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function m(e,t,n,r,o,i){return h((a=h(h(t,e),h(r,i)))<<(s=o)|a>>>32-s,n);var a,s}function v(e,t,n,r,o,i,a){return m(t&n|~t&r,e,t,o,i,a)}function _(e,t,n,r,o,i,a){return m(t&r|n&~r,e,t,o,i,a)}function b(e,t,n,r,o,i,a){return m(t^n^r,e,t,o,i,a)}function g(e,t,n,r,o,i,a){return m(n^(t|~r),e,t,o,i,a)}var w=y("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Array(t.length);for(var n=0;n<t.length;n++)e[n]=t.charCodeAt(n)}return function(e){var t,n,r,o=[],i=32*e.length;for(t=0;t<i;t+=8)n=e[t>>5]>>>t%32&255,r=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16),o.push(r);return o}(function(e,t){var n,r,o,i,a;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var s=1732584193,c=-271733879,u=-1732584194,d=271733878;for(n=0;n<e.length;n+=16)r=s,o=c,i=u,a=d,s=v(s,c,u,d,e[n],7,-680876936),d=v(d,s,c,u,e[n+1],12,-389564586),u=v(u,d,s,c,e[n+2],17,606105819),c=v(c,u,d,s,e[n+3],22,-1044525330),s=v(s,c,u,d,e[n+4],7,-176418897),d=v(d,s,c,u,e[n+5],12,1200080426),u=v(u,d,s,c,e[n+6],17,-1473231341),c=v(c,u,d,s,e[n+7],22,-45705983),s=v(s,c,u,d,e[n+8],7,1770035416),d=v(d,s,c,u,e[n+9],12,-1958414417),u=v(u,d,s,c,e[n+10],17,-42063),c=v(c,u,d,s,e[n+11],22,-1990404162),s=v(s,c,u,d,e[n+12],7,1804603682),d=v(d,s,c,u,e[n+13],12,-40341101),u=v(u,d,s,c,e[n+14],17,-1502002290),c=v(c,u,d,s,e[n+15],22,1236535329),s=_(s,c,u,d,e[n+1],5,-165796510),d=_(d,s,c,u,e[n+6],9,-1069501632),u=_(u,d,s,c,e[n+11],14,643717713),c=_(c,u,d,s,e[n],20,-373897302),s=_(s,c,u,d,e[n+5],5,-701558691),d=_(d,s,c,u,e[n+10],9,38016083),u=_(u,d,s,c,e[n+15],14,-660478335),c=_(c,u,d,s,e[n+4],20,-405537848),s=_(s,c,u,d,e[n+9],5,568446438),d=_(d,s,c,u,e[n+14],9,-1019803690),u=_(u,d,s,c,e[n+3],14,-187363961),c=_(c,u,d,s,e[n+8],20,1163531501),s=_(s,c,u,d,e[n+13],5,-1444681467),d=_(d,s,c,u,e[n+2],9,-51403784),u=_(u,d,s,c,e[n+7],14,1735328473),c=_(c,u,d,s,e[n+12],20,-1926607734),s=b(s,c,u,d,e[n+5],4,-378558),d=b(d,s,c,u,e[n+8],11,-2022574463),u=b(u,d,s,c,e[n+11],16,1839030562),c=b(c,u,d,s,e[n+14],23,-35309556),s=b(s,c,u,d,e[n+1],4,-1530992060),d=b(d,s,c,u,e[n+4],11,1272893353),u=b(u,d,s,c,e[n+7],16,-155497632),c=b(c,u,d,s,e[n+10],23,-1094730640),s=b(s,c,u,d,e[n+13],4,681279174),d=b(d,s,c,u,e[n],11,-358537222),u=b(u,d,s,c,e[n+3],16,-722521979),c=b(c,u,d,s,e[n+6],23,76029189),s=b(s,c,u,d,e[n+9],4,-640364487),d=b(d,s,c,u,e[n+12],11,-421815835),u=b(u,d,s,c,e[n+15],16,530742520),c=b(c,u,d,s,e[n+2],23,-995338651),s=g(s,c,u,d,e[n],6,-198630844),d=g(d,s,c,u,e[n+7],10,1126891415),u=g(u,d,s,c,e[n+14],15,-1416354905),c=g(c,u,d,s,e[n+5],21,-57434055),s=g(s,c,u,d,e[n+12],6,1700485571),d=g(d,s,c,u,e[n+3],10,-1894986606),u=g(u,d,s,c,e[n+10],15,-1051523),c=g(c,u,d,s,e[n+1],21,-2054922799),s=g(s,c,u,d,e[n+8],6,1873313359),d=g(d,s,c,u,e[n+15],10,-30611744),u=g(u,d,s,c,e[n+6],15,-1560198380),c=g(c,u,d,s,e[n+13],21,1309151649),s=g(s,c,u,d,e[n+4],6,-145523070),d=g(d,s,c,u,e[n+11],10,-1120210379),u=g(u,d,s,c,e[n+2],15,718787259),c=g(c,u,d,s,e[n+9],21,-343485551),s=h(s,r),c=h(c,o),u=h(u,i),d=h(d,a);return[s,c,u,d]}(function(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e[t/8])<<t%32;return n}(e),8*e.length))}));var P=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||i)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var a=0;a<16;++a)t[r+a]=o[a];return t||d(o)};function C(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function A(e,t){return e<<t|e>>>32-t}var S=y("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=new Array(r.length);for(var o=0;o<r.length;o++)e[o]=r.charCodeAt(o)}e.push(128);var i=e.length/4+2,a=Math.ceil(i/16),s=new Array(a);for(o=0;o<a;o++){s[o]=new Array(16);for(var c=0;c<16;c++)s[o][c]=e[64*o+4*c]<<24|e[64*o+4*c+1]<<16|e[64*o+4*c+2]<<8|e[64*o+4*c+3]}for(s[a-1][14]=8*(e.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(e.length-1)&4294967295,o=0;o<a;o++){for(var u=new Array(80),d=0;d<16;d++)u[d]=s[o][d];for(d=16;d<80;d++)u[d]=A(u[d-3]^u[d-8]^u[d-14]^u[d-16],1);var l=n[0],p=n[1],f=n[2],y=n[3],h=n[4];for(d=0;d<80;d++){var m=Math.floor(d/20),v=A(l,5)+C(m,p,f,y)+h+t[m]+u[d]>>>0;h=y,y=f,f=A(p,30)>>>0,p=l,l=v}n[0]=n[0]+l>>>0,n[1]=n[1]+p>>>0,n[2]=n[2]+f>>>0,n[3]=n[3]+y>>>0,n[4]=n[4]+h>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}))},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.GooglePay=t.ApplePay=t.constants=t.recaptcha=t.ConfigHandler=t.Client=t.shared=t.util=t.tokenize=void 0;var i=n(11);t.tokenize=i;var a=n(3);t.util=a;var s=n(13);t.recaptcha=s;var c=n(0);t.constants=c;var u=n(6);t.shared=u;var d=n(14);t.Client=d.default;var l=n(8);t.ConfigHandler=l.default;var p=n(7);t.ApplePay=p.default;var f=n(16);t.GooglePay=f.default,o(n(2),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.spreedly=t.iats=t.cardconnect=void 0;var r=n(4);t.cardconnect=r;var o=n(12);t.iats=o;var i=n(5);t.spreedly=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tokenizePaymentCard=t.tokenizePaymentBankUs=t.tokenizePaymentBankCanada=void 0;var r=n(9);t.tokenizePaymentBankCanada=function(e,t,n,o,i,a,s,c,u){var d=r.v4(),l=u.address1;u.address2&&(l+="\n"+u.address2);for(var p={IATS_DPM_ProcessOption:"TOKEN",IATS_DPM_RecurringOn:"FALSE",IATS_DPM_ProcessID:i,IATS_DPM_RelayURL:a,IATS_DPM_ClientDefined_PaymentId:d,IATS_DPM_ClientDefined_GatewayId:s,IATS_DPM_Title:c.salutation,IATS_DPM_FirstName:c.firstName,IATS_DPM_LastName:c.lastName,IATS_DPM_Address:l,IATS_DPM_City:u.city,IATS_DPM_Province:u.state,IATS_DPM_Country:u.country,IATS_DPM_ZipCode:u.zip,IATS_DPM_Phone:c.primaryPhone,IATS_DPM_EMAIL:c.email,IATS_DPM_AccountNumber:e+t+n,IATS_DPM_MOP:"ACHEFT",IATS_DPM_AccountType:o},f=new FormData,y=0,h=Object.entries(p);y<h.length;y++){var m=h[y],v=m[0],_=m[1];f.append(v,_)}return fetch("https://www.iatspayments.com/netgate/IATSDPMProcess.aspx",{method:"POST",mode:"no-cors",body:f}).then((function(e){return e.text().then((function(){return d}))}))},t.tokenizePaymentBankUs=function(){throw new Error("US Bank Tokenization Not Yet Implemented")},t.tokenizePaymentCard=function(){throw new Error("Card Tokenization Not Yet Implemented")}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function o(){var e=new Date;return new Promise((function(t,n){!function r(){void 0!==window.grecaptcha&&void 0!==window.grecaptcha.render?t(window.grecaptcha):(new Date).valueOf()-e.valueOf()>15e3?n(new Error("grecaptcha not loaded after 15 seconds")):setTimeout(r,250)}()}))}Object.defineProperty(t,"__esModule",{value:!0}),t.wrapElement=t.RecaptchaElement=t.injectScript=void 0,t.injectScript=function(e){if(void 0!==window.grecaptcha)throw new Error("grecaptcha is already defined");var t=document.createElement("script");t.src="https://www.google.com/recaptcha/api.js?render=explicit",t.async=!0,t.defer=!0,t.onload=e||null,"interactive"===document.readyState||"complete"===document.readyState?document.body.appendChild(t):window.addEventListener("DOMContentLoaded",(function(){document.body.appendChild(t)}))};var i=function(){function e(e,t){this.container=e,this.params=t,this.executeResolveQueue=[]}return e.prototype.render=function(){var e=this;return void 0!==this.widgetId&&console.warn("rendering an already-rendered widget"),o().then((function(t){e.widgetId=t.render(e.container,r(r({},e.params),{callback:function(t){var n;e.resolvedToken=t,null===(n=e.executeResolveQueue.pop())||void 0===n||n(t)},"expired-callback":function(){e.resolvedToken=void 0}}))}))},e.prototype.resolveToken=function(){var e=this;return new Promise((function(t,n){o().then((function(r){if("invisible"!==e.params.size){var o=r.getResponse();return o?t(o):n(new Error("checkbox recaptcha is not checked"))}e.executeResolveQueue.push(t),void 0!==e.resolvedToken&&(e.resolvedToken=void 0,r.reset(e.widgetId)),r.execute(e.widgetId)})).catch((function(e){n(e)}))}))},e}();t.RecaptchaElement=i,t.wrapElement=function(e,t,n){var o=r(r({},n||{}),{sitekey:t}),a=new i(e,o);return a.render(),a}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),s=n(1),c=n(0),u=n(3),d=n(7),l=n(8),p=n(4),f=n(5),y=n(6),h=n(9),m=n(15),v={enableSandboxMode:!1,overrideBaseUrl:void 0,enableDelay:!1,secondsToDelay:0},_=function(){function e(e,t){var n,r=this;if(this.clientKey=e,this.options=Object.assign({},v,t),this.allowTransaction=!1,this.config=new l.default(this.options),Object.assign(this,this.config),this.options.enableDelay&&this.options.secondsToDelay){var o=1e3*this.options.secondsToDelay;setTimeout((function(){r.allowTransaction=!0}),o)}else this.allowTransaction=!0;this.options.enableSandboxMode&&void 0!==console&&console.info("[Sandbox] iDonate SDK Configuration:",JSON.parse(JSON.stringify(this)));try{var i=this.config,a=i.pcScriptBase,s=i.pcScriptId;if(!a||!s)throw new Error("missing config");var c=h.v4(),u=window.document.createElement("script");u.setAttribute("src",a+"/"+c+".js"),u.setAttribute("id",s);var d=!1;!function(){var e;try{if(d)return;window.document.body.append(u),d=!0}catch(t){null===(e=null===console||void 0===console?void 0:console.warn)||void 0===e||e.call(console,"not appended")}}(),window.addEventListener("DOMContentLoaded",(function(){window.document.body.append(u)}))}catch(e){null===(n=null===console||void 0===console?void 0:console.warn)||void 0===n||n.call(console,"Warning, partial initialization: ",String(e))}this.currentOrganizationId||this.setOrganizationId(this.clientKey)}return Object.defineProperty(e.prototype,"organizationId",{get:function(){if(!this.currentOrganizationId)throw new Error("organizationId undefined");return this.currentOrganizationId},enumerable:!1,configurable:!0}),e.prototype.createDonation=function(e){var t=this;if(!this.allowTransaction)throw new Error("Wow, that was fast - try again");var n=s.buildCashPaymentPayload(this.organizationId,e),a=function(e){return fetch(t.config.embedApiBaseUrl+"/donate/cash-payment",{method:"POST",headers:r(r(r({},c.CLIENT_HEADERS),e?{"cf-validation-token":e}:{}),{"User-Agent":c.CLIENT_HEADERS["User-Agent"]+" source:"+t.config.client}),body:JSON.stringify(n),credentials:"include"})};return a().then((function(e){return o(t,void 0,void 0,(function(){var t;return i(this,(function(n){switch(n.label){case 0:return"challenge"!==e.headers.get("cf-mitigated")?[3,2]:[4,m.handleCFChallenge(e,this)];case 1:return t=n.sent(),[2,a(null==t?void 0:t.token)];case 2:return[2,e]}}))}))})).then((function(e){return u.parseResponse(e,{throwErrors:!0})})).then((function(e){return s.buildDonationResult(e)}))},e.prototype.createTransaction=function(e){return this.createDonation(e).then((function(e){var t;return{transactionId:null===(t=e.transaction)||void 0===t?void 0:t.id,_raw_response:e._raw_response}}))},e.prototype.createPaymentMethod=function(e){return y.createPaymentMethod(e,this.config)},e.prototype.tokenizeCardConnectBankAccountInternal=function(e,t){return p.tokenizeBankAccount(e,t,this.config)},e.prototype.setOrganizationId=function(e){this.currentOrganizationId=e},e.prototype.tokenizeCardConnectBankAccount=function(e){return this.tokenizeCardConnectBankAccountInternal(e.routingNumber,e.accountNumber).then((function(e){if(!e.token||0!==e.errorcode)throw new a.ClientError(e.message,{_rawPayload:e});return e.token}))},e.prototype.tokenizeSpreedlyCreditCard=function(e){return f.tokenizeCreditCard(e,this.config)},e.prototype.tokenizeSpreedlyBankAccount=function(e){return f.tokenizeBankAccount(e,this.config)},e.prototype.tokenizeSpreedlyPayPal=function(e){return f.tokenizePayPal(e,this.config)},e.prototype.generateCardConnectTokenizerUrl=function(e){var t={enhancedresponse:"true",useexpiry:"true",usecvv:"true",placeholderyear:"2020",invalidinputevent:"true",placeholder:"Card Number",placeholdercvv:"CVV",formatinput:"true",expirymonthtitle:"Month",unique:"true",css:c.CARD_CONNECT_DEFAULT_STYLE},n=r(r({},t),e||{}),o=new URLSearchParams(n).toString().replace("+","%20");return this.config.cardConnectTokenizerUrl+"?"+o},e.prototype.waitForDonationResult=function(e,t){var n=this;return new Promise((function(o,i){setTimeout((function(){var c;c=setInterval((function(){fetch(n.config.embedApiBaseUrl+"/donate/cash-payment/"+e+"/payment_status",{method:"GET",headers:{"Content-Type":"application/json"}}).then((function(e){return e.json()})).then((function(e){return e.result})).then((function(e){(function(e){return!!e.processed&&!!e.transaction})(e)&&(c&&(clearInterval(c),c=null),e.error&&i(new a.ClientError(e.error)),o(s.buildDonationResult({_raw_response:r({campaign:null,designation:{},donor:{},form_data:{},id:null,schedule:{},transaction:{}},e)}))),null==t||t()})).catch((function(e){c&&(clearInterval(c),c=null),i(e)}))}),2e3)}),2e3)}))},e.prototype.tokenizeCardConnectApplePay=function(e){var t=this,n=new d.default(e),o="",i=n.begin();return new Promise((function(e,a){i.then((function(i){i.onvalidatemerchant=function(e){var r={apple_pay_url:t.config.applePayUrl,organization_id:t.organizationId};n.createSession(r,t.config.embedApiBaseUrl).then((function(e){o=e.result.merchantSessionIdentifier,i.completeMerchantValidation(e.result)})).catch((function(e){i.abort(),a(e)}))},i.onpaymentauthorized=function(s){n.tokenizeWithCardConnect(s.payment,t.config.cardConnectBaseUrl).then((function(t){var n,a,c=r(r({},s.payment.billingContact),{email:null===(n=s.payment.shippingContact)||void 0===n?void 0:n.emailAddress,phone:null===(a=s.payment.shippingContact)||void 0===a?void 0:a.phoneNumber});e({applePaySession:i,cardConnectResponse:t,billingContact:c,merchantSessionId:o})})).catch((function(e){i.abort(),a(e)}))},i.oncancel=function(e){a(new Error("Apple Pay has been closed"))}})).catch((function(e){return a(e)}))}))},e}();t.default=_},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.handleCFChallenge=void 0;var i=null;t.handleCFChallenge=function(e,t){return new Promise((function(e,n){return r(void 0,void 0,void 0,(function(){var r,a,s,c,u,d,l,p;return o(this,(function(o){try{if(!(r=null===window||void 0===window?void 0:window.document)||!window)throw new Error("document is not present on window");a=r.createElement("div"),s=r.createElement("div"),c=function(n){var r;null===(r=null==n?void 0:n.render)||void 0===r||r.call(n,"#iDonateTurnstileBox",{sitekey:t.config.turnstileSiteKey,callback:function(t,n){a.remove(),e({token:t,preClearance:n})}})},window.idonateTurnstileLoadedHandler=function(){var e=window.turnstile;s.innerHTML="",e&&(i=e),c(e)},a.setAttribute("id","idonateTurnstileWrapper"),a.style.position="fixed",a.style.top="0",a.style.bottom="0",a.style.left="0",a.style.right="0",a.style.backgroundColor="rgba(0,0,0,0.9)",a.style.transition="all 400ms",a.style.display="flex",a.style.flexDirection="column",a.style.padding="40px 30px",a.style.opacity="0",a.style.color="white",a.style.fontFamily="sans-serif",a.style.zIndex="1000",a.innerHTML='<h1 id="idonateTurnstileVerificationHeader">Last tiny step before we submit your payment:</h1>',s.setAttribute("id","iDonateTurnstileBox"),a.append(s),r.body.append(a),i?c(i):(u=r.createElement("script"),s.innerHTML="loading ...",u.src=t.config.turnstileCdnUrl+"?render=explicit&onload=idonateTurnstileLoadedHandler",r.body.append(u)),null===(d=s.scrollIntoView)||void 0===d||d.call(s),a.style.opacity="1"}catch(e){null===(l=null===console||void 0===console?void 0:console.error)||void 0===l||l.call(console,e),null===(p=null===console||void 0===console?void 0:console.warn)||void 0===p||p.call(console,"iDonate SDK: Could not handle request, please reload the page and try again"),n(null)}return[2]}))}))}))}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e){this.baseRequest={apiVersion:2,apiVersionMinor:0},this.baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!0,billingAddressParameters:{format:"FULL",phoneNumberRequired:!0}}},this.transactionInfo={countryCode:"US",currencyCode:"USD",totalPriceStatus:"FINAL",totalPrice:""},this.tokenizationSpecification={type:"PAYMENT_GATEWAY",parameters:{gateway:"cardconnect",gatewayMerchantId:""}},this.googlePayOptions={environment:"PRODUCTION"},this.paymentRequestDefaults=r(r({},this.baseRequest),{merchantInfo:{merchantId:""},transactionInfo:this.transactionInfo,emailRequired:!0,allowedPaymentMethods:[r(r({},this.baseCardPaymentMethod),{tokenizationSpecification:this.tokenizationSpecification})]}),this.paymentsClient=null;var t=e.paymentOptions,n=e.cardConnectMerchantId,o=e.paymentDataRequest,i=e.baseCardPaymentMethodParameters,a=void 0===i?{}:i;this.tokenizationSpecification.parameters.gatewayMerchantId=n,this.paymentRequest=Object.assign({},this.paymentRequestDefaults,o),this.googlePayOptions=Object.assign({},this.googlePayOptions,r(r({},t),{merchantInfo:this.paymentRequest.merchantInfo})),this.baseCardPaymentMethod.parameters=r(r({},this.baseCardPaymentMethod.parameters),a)}return e.resolveLib=function(e){var t=new Date;return new Promise((function(n,r){!function o(){if(void 0!==window.google&&void 0!==window.google.payments){var i=new google.payments.api.PaymentsClient(e);n(i)}else{(new Date).valueOf()-t.valueOf()>15e3?r(new Error("pay.js not loaded after 15 seconds")):setTimeout(o,250)}}()}))},e.injectScript=function(){if(void 0!==window.google&&void 0!==window.google.payments)throw new Error("google payments is already injected");var e=document.createElement("script");e.src="https://pay.google.com/gp/p/js/pay.js?render=explicit",e.async=!0,e.defer=!0,document.body.appendChild(e)},e.prototype.getGoogleIsReadyToPayRequest=function(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardPaymentMethod]})},e.prototype.getGooglePaymentClient=function(){var t=this;return new Promise((function(n,r){t.paymentsClient?n(t.paymentsClient):e.resolveLib(t.googlePayOptions).then((function(e){t.paymentsClient=e,n(e)})).catch((function(e){return r(e)}))}))},e.prototype.onGooglePaymentButtonClicked=function(e){var t=this,n=this.paymentRequest;return this.transactionInfo=Object.assign({},this.transactionInfo,e),n.transactionInfo=this.transactionInfo,new Promise((function(e,r){t.paymentsClient?t.paymentsClient.loadPaymentData(n).then((function(t){e(t)})).catch((function(e){r(e)})):r(new Error("PaymentClient is not initialized"))}))},e.prototype.tokenizeWithCardConnect=function(e,t){return fetch(t+"/cardsecure/api/v1/ccn/tokenize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encryptionhandler:"EC_GOOGLE_PAY",devicedata:e,unique:!0})}).then((function(e){return e.json()}))},e}();t.default=o}])}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.idonate=t():e.idonate=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CLIENT_HEADERS=t.CARD_CONNECT_DEFAULT_STYLE=t.DEFAULT_APP_NAME=t.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL=t.FALLBACK_CF_TURNSTILE_SITE_KEY=t.FALLBACK_PC_SCRIPT_ID=t.FALLBACK_PC_SCRIPT_URL=t.SANDBOX_APPLE_PAY_URL=t.APPLE_PAY_URL=t.SPREEDLY_TOKENIZER_URL=t.SANDBOX_CARD_CONNECT_BASE_URL=t.PRODUCTION_CARD_CONNECT_BASE_URL=t.SANDBOX_BASE_URL=t.PRODUCTION_BASE_URL=void 0,t.PRODUCTION_BASE_URL="https://secure-api.idonate.com",t.SANDBOX_BASE_URL="https://api.qa-idonate.com",t.PRODUCTION_CARD_CONNECT_BASE_URL="https://boltgw.cardconnect.com:8443",t.SANDBOX_CARD_CONNECT_BASE_URL="https://boltgw-uat.cardconnect.com",t.SPREEDLY_TOKENIZER_URL="https://core.spreedly.com/v1/payment_methods.json",t.APPLE_PAY_URL="https://apple-pay-gateway.apple.com/paymentservices/paymentSession",t.SANDBOX_APPLE_PAY_URL="https://apple-pay-gateway-cert.apple.com/paymentservices/paymentSession",t.FALLBACK_PC_SCRIPT_URL="https://p.idonate.com/r",t.FALLBACK_PC_SCRIPT_ID="_3fd4dad26e8c277bc50fb2ddf8233b50bc8d9704",t.FALLBACK_CF_TURNSTILE_SITE_KEY="0x4AAAAAAAxuRxNZTvX8shIj",t.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL="https://challenges.cloudflare.com/turnstile/v0/api.js",t.DEFAULT_APP_NAME="unnamed-sdk-client",t.CARD_CONNECT_DEFAULT_STYLE="\nbody {\n margin: 0;\n}\n\nform {\n display: flex;\n}\n\nlabel#cccardlabel {\n display: none;\n}\n\nbr {\n display: none;\n}\n\nlabel#cccvvlabel {\n display: none;\n}\n\nlabel#ccexpirylabel {\n display: none;\n}\n\ninput {\n padding: 10px;\n}\n\nselect {\n padding: 10px;\n font-size: 14px;\n color: #8b959d;\n}\n\nselect#ccexpirymonth {\n margin-right: -30px;\n border: 1px solid #b6b8ba;\n border-right: 0;\n}\n\ninput#ccnumfield {\n width: 70%;\n border: 1px solid #b6b8ba;\n border-right: 0;\n border-top-left-radius: 3px;\n border-bottom-left-radius: 3px;\n font-size: 14px;\n color: #8b959d;\n}\n\nselect#ccexpiryyear {\n border: 1px solid #b6b8ba;\n border-right: 0;\n}\n\ninput#cccvvfield {\n border: 1px solid #b6b8ba;\n border-top-right-radius: 3px;\n border-bottom-right-radius: 3px;\n font-size: 14px;\n color: #8b959d;\n}\n".replace(/\s+/gi," "),t.CLIENT_HEADERS={"User-Agent":navigator.userAgent+" idonate-sdk@1.0.16","Content-Type":"application/json"}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.extractSpreedlyToken=t.unpackSpreedlyResponse=t.buildCreatePaymentMethodResult=t.collapseClientErrors=t.buildCreatePaymentMethodPayload=t.buildDonationResult=t.buildCashPaymentPayload=void 0;var o=n(2);t.buildCashPaymentPayload=function(e,t){var n,o,i,a,s,c,u,d,l,p,f,y,h,m,v,_,b,g={country:t.billingAddress.country,address1:t.billingAddress.address1,address2:t.billingAddress.address2,city:t.billingAddress.city,state:t.billingAddress.state,zip_code:t.billingAddress.zip},w={title:t.billingContact.salutation,first_name:t.billingContact.firstName,middle_name:t.billingContact.middleName,last_name:t.billingContact.lastName,company_name:t.billingContact.company,email:t.billingContact.email,home_phone:t.billingContact.primaryPhone,timezone:(new Intl.DateTimeFormat).resolvedOptions().timeZone},P={payment_method_id:t.paymentMethodId,gateway_id:t.paymentGatewayId,amount:t.paymentAmount,type:"cash",frequency:t.recurringFrequency,start_date:t.recurringStart,end_date:t.recurringEnd,retain_on_success:t.retainPaymentMethod},C={organization_id:e,campaign_id:t.campaignId,reference_code:t.referenceCode,double_the_donation_company_id:t.corporateMatchingId,donor_id:t.donorId,hide_name:t.anonymousOptIn,show_name_to_fundraiser:t.showNameToFundraiserOptIn,email_opt_in:t.emailOptIn,donor_paid_fee:t.donorPaidFeeAmount,designation_note:t.designationNote,gift_id:t.giftId,gift_extra:t.giftExtra,gift_skipped:t.giftSkipped,p2p_fundraiser_id:t.p2pFundraiserId,p2p_fundraiser_comment:t.p2pFundraiserComment,organization_event_id:t.organizationEventId,advocate_id:t.advocateId,advocacy_program_id:t.advocacyProgramId,advocacy_team_id:t.advocacyTeamId,page_id:t.landingPageId,embed_id:t.embedId,tribute_definition_id:null===(n=t.tribute)||void 0===n?void 0:n.tributeDefinitionId,tribute_first_name:null===(o=t.tribute)||void 0===o?void 0:o.tributeFirstName,tribute_last_name:null===(i=t.tribute)||void 0===i?void 0:i.tributeLastName,tribute_address1:null===(a=t.tribute)||void 0===a?void 0:a.tributeAddress1,tribute_address2:null===(s=t.tribute)||void 0===s?void 0:s.tributeAddress2,tribute_city:null===(c=t.tribute)||void 0===c?void 0:c.tributeCity,tribute_state:null===(u=t.tribute)||void 0===u?void 0:u.tributeState,tribute_postal_code:null===(d=t.tribute)||void 0===d?void 0:d.tributePostalCode,tribute_country:null===(l=t.tribute)||void 0===l?void 0:l.tributeCountry,tribute_from_name:null===(p=t.tribute)||void 0===p?void 0:p.tributeFromName,tribute_recipient_email:null===(f=t.tribute)||void 0===f?void 0:f.tributeRecipientEmail,honorees:null===(y=t.tribute)||void 0===y?void 0:y.honorees,tribute_send_card:null===(h=t.tribute)||void 0===h?void 0:h.tributeSendCard,tribute_include_amount:null===(m=t.tribute)||void 0===m?void 0:m.tributeIncludeAmount,tribute_skipped:null===(v=t.tribute)||void 0===v?void 0:v.tributeSkipped,tribute_type:null===(_=t.tribute)||void 0===_?void 0:_.tributeType,useOnBillingAddress:null===(b=t.tribute)||void 0===b?void 0:b.useOnBillingAddress,embed_referer:window.location.href,converted_to_recurring:t.convertedToRecurring};t.designations?C.designations=t.designations:C.designations=[],t.designationId&&C.designations.push({id:t.designationId,amount:t.paymentAmount});var A={};return t.utm&&(t.utm.campaign&&(A.utm_campaign=t.utm.campaign),t.utm.content&&(A.utm_content=t.utm.content),t.utm.medium&&(A.utm_medium=t.utm.medium),t.utm.source&&(A.utm_source=t.utm.source),t.utm.term&&(A.utm_term=t.utm.term)),[1,2,3,4,5].forEach((function(e){var n="custom_note_"+e;t.customerMeta[n]&&(C[n]=t.customerMeta[n],delete t.customerMeta[n])})),r(r(r(r(r(r({},C),g),w),P),A),{customer_meta:t.customerMeta,recaptcha_token:t.recaptchaToken,recaptcha_type:t.recaptchaType})},t.buildDonationResult=function(e){var t,n,o,i,a;return e._raw_response.transaction&&(a=e._raw_response.transaction),e._raw_response.schedule&&(i=e._raw_response.schedule),e._raw_response.donor&&(o=e._raw_response.donor),e._raw_response.designation&&(n=e._raw_response.designation),e._raw_response.campaign&&(t=e._raw_response.campaign),r(r({},e),{campaign:t,designation:n,donor:o,schedule:i,transaction:a})},t.buildCreatePaymentMethodPayload=function(e){return{gateway_id:e.paymentGatewayId,backend_name:e.backendName,payment_method_type:e.paymentMethodType,payment_method_token:e.paymentMethodToken,donor_id:e.donorId,first_name:e.contact.firstName,last_name:e.contact.lastName,company:e.contact.company,email:e.contact.email,phone:e.contact.primaryPhone,country:e.address.country,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip_code:e.address.zip,recaptcha_token:e.recaptchaToken,recaptcha_type:e.recaptchaType}},t.collapseClientErrors=function(e){return new o.ClientError(e.map((function(e){return e.message})).join("\n "),{_rawPayload:e})},t.buildCreatePaymentMethodResult=function(e){return r(r({},e),{paymentMethodId:e._raw_response.result.id})},t.unpackSpreedlyResponse=function(e){return e.json().then((function(e){if(e.errors)throw new o.ClientError(e.errors.map((function(e){return e.message})).join("\n "),e);return e}))},t.extractSpreedlyToken=function(e){if(!e.transaction||!e.transaction.payment_method)throw new o.ClientError("Payment Method not tokenized.");return e.transaction.payment_method.token}},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.ClientError=void 0;var i=function(e){function t(n,r){var o=e.call(this,n)||this;return o.message=n,o.details=r,Error.captureStackTrace&&Error.captureStackTrace(o,t),o}return o(t,e),t}(Error);t.ClientError=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseResponse=t.splitName=t.sanitizeObject=t.sanitizeArray=t.sanitizeString=t.receiveEmbedData=void 0;var r=n(2),o=n(1);function i(e){if(!e)return e;var t=document.createElement("div");t.innerHTML=e;for(var n=0,r=Array.from(t.getElementsByTagName("script"));n<r.length;n++){var o=r[n];o.parentNode&&o.parentNode.removeChild(o)}return t.innerHTML}function a(e){return e.map(s)}function s(e){if(null==e)return e;if(Array.isArray(e))return a(e);if("string"==typeof e)return i(e);if("object"==typeof e){for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var o=r[n],c=o[0],u=o[1];Array.isArray(u)?t[c]=a(u):t[c]="string"==typeof u?i(u):s(u)}return t}return e}t.receiveEmbedData=function(){var e;return new Promise((function(t,n){window.parent||n("Cannot receive data without parent"),e=function(e){var n;try{n=JSON.parse(e.data)}catch(e){return}n.embedData&&t(n.embedData)},window.addEventListener("message",e)})).then((function(t){return window.removeEventListener("message",e),t}))},t.sanitizeString=i,t.sanitizeArray=a,t.sanitizeObject=s,t.splitName=function(e){var t=e.split(" ");return{firstName:t.slice(0,-1).join(" ")||"NOT GIVEN",lastName:t.slice(-1).join(" ")}},t.parseResponse=function(e,t){return e.json().then((function(n){var i=[];if(200!==e.status&&(void 0!==n.result&&Object.keys(n.result).forEach((function(e){i.push(new r.ClientError(e+": "+n.result[e].join("\n "),{field:e}))})),void 0!==n.messages?n.messages.forEach((function(e){"error"===e.category&&i.push(new r.ClientError(e.message))})):i.push(new r.ClientError(n.message))),t&&t.throwErrors&&i.length)throw o.collapseClientErrors(i);return{errors:i,_raw_response:n}}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tokenizeBankAccount=void 0,t.tokenizeBankAccount=function(e,t,n){return fetch(n.cardConnectBaseUrl+"/cardsecure/api/v1/ccn/tokenize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:e+"/"+t,unique:!0})}).then((function(e){return e.json()}))}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.SpreedlyAsync=t.tokenizePayPal=t.tokenizeCreditCard=t.tokenizeBankAccount=void 0;var i=n(0),a=n(1);t.tokenizeBankAccount=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(i.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{bank_account:{first_name:e.contact.firstName||void 0,last_name:e.contact.lastName||void 0,full_name:e.contact.fullName||void 0,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country,bank_account_number:e.account.accountNumber.replace(/\s+/g,""),bank_routing_number:e.account.routingNumber.replace(/\s+/g,""),bank_account_holder_type:e.account.accountHolderType,bank_account_type:e.account.accountType}},retained:!1})}).then(a.unpackSpreedlyResponse).then(a.extractSpreedlyToken)},t.tokenizeCreditCard=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(i.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{credit_card:{first_name:e.contact.firstName,last_name:e.contact.lastName,full_name:e.contact.fullName,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country,number:e.card.cardNumber.replace(/\s+/g,""),verification_value:e.card.verificationValue,year:e.card.expirationYear,month:e.card.expirationMonth}},retained:!1})}).then(a.unpackSpreedlyResponse).then(a.extractSpreedlyToken)},t.tokenizePayPal=function(e,t){if(void 0===t.spreedlyEnvironmentKey)throw new Error("Spreedly is not configured.");return fetch(i.SPREEDLY_TOKENIZER_URL+"?"+new URLSearchParams({environment_key:t.spreedlyEnvironmentKey}),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payment_method:{payment_method_type:"paypal",first_name:e.contact.firstName,last_name:e.contact.lastName,email:e.contact.email,address1:e.address.address1,address2:e.address.address2,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country},retained:!1})}).then(a.unpackSpreedlyResponse).then(a.extractSpreedlyToken)};var s=function(){function e(e,t,n,r,o){var i=this;this.tokenPromise=null,this.tokenResolve=null,this.tokenReject=null;var a=this.spreedly=o?new o:new window.SpreedlyPaymentFrame;a.on("ready",(function(){a.setPlaceholder("number","Card Number"),a.setFieldType("number","text"),a.setNumberFormat("prettyFormat"),a.setPlaceholder("cvv","CVV"),a.setFieldType("cvv","text"),r&&(a.setStyle("number",r),a.setStyle("cvv",r))})),a.on("errors",(function(e){var t=e.map((function(e){return e.message})).join(" ");if(!i.tokenPromise||!i.tokenReject)throw new Error(t);i.tokenPromise=null,i.tokenReject(new Error(t))})),a.on("paymentMethod",(function(e){if(!i.tokenPromise||!i.tokenResolve)throw new Error("No pending tokenization request");i.tokenResolve(e),i.tokenPromise=null})),a.init(e,{numberEl:t,cvvEl:n})}return e.prototype.tokenizeCreditCard=function(e){return r(this,void 0,void 0,(function(){var t=this;return o(this,(function(n){if(this.tokenPromise)throw new Error("Tokenization already in progress");return this.tokenPromise=new Promise((function(n,r){t.tokenResolve=n,t.tokenReject=r,t.spreedly.tokenizeCreditCard(e)})),[2,this.tokenPromise]}))}))},e}();t.SpreedlyAsync=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createPaymentMethod=void 0;var r=n(1),o=n(0),i=n(3);t.createPaymentMethod=function(e,t){var n=r.buildCreatePaymentMethodPayload(e);return fetch(t.embedApiBaseUrl+"/payment/payment-methods",{method:"POST",headers:o.CLIENT_HEADERS,body:JSON.stringify(n)}).then((function(e){return i.parseResponse(e,{throwErrors:!0})})).then((function(e){return r.buildCreatePaymentMethodResult(e)}))}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),a=function(){function e(e){this.appleSession=null,this.paymentRequestDefaults={currencyCode:"USD",countryCode:"US",merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],supportedNetworks:["amex","masterCard","visa","discover"],requiredBillingContactFields:["postalAddress","name"],requiredShippingContactFields:["email","phone"],total:{label:"iDonate",amount:"",type:"final"}},this.paymentRequest=Object.assign({},this.paymentRequestDefaults,e)}return e.isSupported=function(){return window.ApplePaySession&&ApplePaySession.canMakePayments()&&ApplePaySession.supportsVersion(e.ApplePayApiVersion)},e.prototype.begin=function(){return r(this,void 0,void 0,(function(){return o(this,(function(t){if(!e.isSupported())throw new Error("Apple Pay Not Supported");return this.appleSession=new ApplePaySession(e.ApplePayApiVersion,this.paymentRequest),this.appleSession.begin(),[2,this.appleSession]}))}))},e.prototype.createSession=function(e,t){return fetch(t+"/payment/create-session",{method:"POST",headers:i.CLIENT_HEADERS,body:JSON.stringify(e)}).then((function(e){return e.json()}))},e.prototype.tokenizeWithCardConnect=function(e,t){var n=e.token.paymentData,r=n.data+"&ectype=apple&ecsig="+n.signature+"&eckey="+n.header.ephemeralPublicKey+"&ectid="+n.header.transactionId+"&echash=&ecpublickeyhash="+n.header.publicKeyHash;return fetch(t+"/cardsecure/api/v1/ccn/tokenize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encryptionhandler:"EC_APPLE_PAY",devicedata:r,unique:!0})}).then((function(e){return e.json()}))},e.ApplePayApiVersion=6,e}();t.default=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=function(e){e.enableSandboxMode?(this.apiBaseUrl=r.SANDBOX_BASE_URL,this.cardConnectBaseUrl=r.SANDBOX_CARD_CONNECT_BASE_URL,this.applePayUrl=r.SANDBOX_APPLE_PAY_URL):(this.apiBaseUrl=r.PRODUCTION_BASE_URL,this.cardConnectBaseUrl=r.PRODUCTION_CARD_CONNECT_BASE_URL,this.applePayUrl=r.APPLE_PAY_URL),this.client=e.sdkClientName||r.DEFAULT_APP_NAME,e.overrideBaseUrl&&(this.apiBaseUrl=e.overrideBaseUrl),this.authApiBaseUrl=e.overrideAuthApiBaseUrl||this.apiBaseUrl+"/auth",this.donorApiBaseUrl=e.overrideDonorApiBaseUrl||this.apiBaseUrl+"/donor",this.embedApiBaseUrl=e.overrideEmbedApiBaseUrl||this.apiBaseUrl+"/embed",e.overrideApplePayUrl&&(this.applePayUrl=e.overrideApplePayUrl),this.pcScriptBase=e.pcScriptBase||r.FALLBACK_PC_SCRIPT_URL,this.pcScriptId=e.pcScriptId||r.FALLBACK_PC_SCRIPT_ID,this.turnstileCdnUrl=e.turnstileCdnUrl||r.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL,this.turnstileSiteKey=e.turnstileSiteKey||r.FALLBACK_CF_TURNSTILE_SITE_KEY,(null==e?void 0:e.spreedlyEnvironmentKey)&&(this.spreedlyEnvironmentKey=e.spreedlyEnvironmentKey),this.enableDelay=e.enableDelay||!1,this.secondsToDelay=e.secondsToDelay||0,this.cardConnectTokenizerUrl=this.cardConnectBaseUrl+"/itoke/ajax-tokenizer.html"};t.default=o},function(e,t,n){"use strict";n.r(t),n.d(t,"v1",(function(){return f})),n.d(t,"v3",(function(){return w})),n.d(t,"v4",(function(){return P})),n.d(t,"v5",(function(){return S}));var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),o=new Uint8Array(16);function i(){if(!r)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}for(var a=[],s=0;s<256;++s)a[s]=(s+256).toString(16).substr(1);var c,u,d=function(e,t){var n=t||0,r=a;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")},l=0,p=0;var f=function(e,t,n){var r=t&&n||0,o=t||[],a=(e=e||{}).node||c,s=void 0!==e.clockseq?e.clockseq:u;if(null==a||null==s){var f=e.random||(e.rng||i)();null==a&&(a=c=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==s&&(s=u=16383&(f[6]<<8|f[7]))}var y=void 0!==e.msecs?e.msecs:(new Date).getTime(),h=void 0!==e.nsecs?e.nsecs:p+1,m=y-l+(h-p)/1e4;if(m<0&&void 0===e.clockseq&&(s=s+1&16383),(m<0||y>l)&&void 0===e.nsecs&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=y,p=h,u=s;var v=(1e4*(268435455&(y+=122192928e5))+h)%4294967296;o[r++]=v>>>24&255,o[r++]=v>>>16&255,o[r++]=v>>>8&255,o[r++]=255&v;var _=y/4294967296*1e4&268435455;o[r++]=_>>>8&255,o[r++]=255&_,o[r++]=_>>>24&15|16,o[r++]=_>>>16&255,o[r++]=s>>>8|128,o[r++]=255&s;for(var b=0;b<6;++b)o[r+b]=a[b];return t||d(o)};var y=function(e,t,n){var r=function(e,r,o,i){var a=o&&i||0;if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}(e)),"string"==typeof r&&(r=function(e){var t=[];return e.replace(/[a-fA-F0-9]{2}/g,(function(e){t.push(parseInt(e,16))})),t}(r)),!Array.isArray(e))throw TypeError("value must be an array of bytes");if(!Array.isArray(r)||16!==r.length)throw TypeError("namespace must be uuid string or an Array of 16 byte values");var s=n(r.concat(e));if(s[6]=15&s[6]|t,s[8]=63&s[8]|128,o)for(var c=0;c<16;++c)o[a+c]=s[c];return o||d(s)};try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r};function h(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function m(e,t,n,r,o,i){return h((a=h(h(t,e),h(r,i)))<<(s=o)|a>>>32-s,n);var a,s}function v(e,t,n,r,o,i,a){return m(t&n|~t&r,e,t,o,i,a)}function _(e,t,n,r,o,i,a){return m(t&r|n&~r,e,t,o,i,a)}function b(e,t,n,r,o,i,a){return m(t^n^r,e,t,o,i,a)}function g(e,t,n,r,o,i,a){return m(n^(t|~r),e,t,o,i,a)}var w=y("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Array(t.length);for(var n=0;n<t.length;n++)e[n]=t.charCodeAt(n)}return function(e){var t,n,r,o=[],i=32*e.length;for(t=0;t<i;t+=8)n=e[t>>5]>>>t%32&255,r=parseInt("0123456789abcdef".charAt(n>>>4&15)+"0123456789abcdef".charAt(15&n),16),o.push(r);return o}(function(e,t){var n,r,o,i,a;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var s=1732584193,c=-271733879,u=-1732584194,d=271733878;for(n=0;n<e.length;n+=16)r=s,o=c,i=u,a=d,s=v(s,c,u,d,e[n],7,-680876936),d=v(d,s,c,u,e[n+1],12,-389564586),u=v(u,d,s,c,e[n+2],17,606105819),c=v(c,u,d,s,e[n+3],22,-1044525330),s=v(s,c,u,d,e[n+4],7,-176418897),d=v(d,s,c,u,e[n+5],12,1200080426),u=v(u,d,s,c,e[n+6],17,-1473231341),c=v(c,u,d,s,e[n+7],22,-45705983),s=v(s,c,u,d,e[n+8],7,1770035416),d=v(d,s,c,u,e[n+9],12,-1958414417),u=v(u,d,s,c,e[n+10],17,-42063),c=v(c,u,d,s,e[n+11],22,-1990404162),s=v(s,c,u,d,e[n+12],7,1804603682),d=v(d,s,c,u,e[n+13],12,-40341101),u=v(u,d,s,c,e[n+14],17,-1502002290),c=v(c,u,d,s,e[n+15],22,1236535329),s=_(s,c,u,d,e[n+1],5,-165796510),d=_(d,s,c,u,e[n+6],9,-1069501632),u=_(u,d,s,c,e[n+11],14,643717713),c=_(c,u,d,s,e[n],20,-373897302),s=_(s,c,u,d,e[n+5],5,-701558691),d=_(d,s,c,u,e[n+10],9,38016083),u=_(u,d,s,c,e[n+15],14,-660478335),c=_(c,u,d,s,e[n+4],20,-405537848),s=_(s,c,u,d,e[n+9],5,568446438),d=_(d,s,c,u,e[n+14],9,-1019803690),u=_(u,d,s,c,e[n+3],14,-187363961),c=_(c,u,d,s,e[n+8],20,1163531501),s=_(s,c,u,d,e[n+13],5,-1444681467),d=_(d,s,c,u,e[n+2],9,-51403784),u=_(u,d,s,c,e[n+7],14,1735328473),c=_(c,u,d,s,e[n+12],20,-1926607734),s=b(s,c,u,d,e[n+5],4,-378558),d=b(d,s,c,u,e[n+8],11,-2022574463),u=b(u,d,s,c,e[n+11],16,1839030562),c=b(c,u,d,s,e[n+14],23,-35309556),s=b(s,c,u,d,e[n+1],4,-1530992060),d=b(d,s,c,u,e[n+4],11,1272893353),u=b(u,d,s,c,e[n+7],16,-155497632),c=b(c,u,d,s,e[n+10],23,-1094730640),s=b(s,c,u,d,e[n+13],4,681279174),d=b(d,s,c,u,e[n],11,-358537222),u=b(u,d,s,c,e[n+3],16,-722521979),c=b(c,u,d,s,e[n+6],23,76029189),s=b(s,c,u,d,e[n+9],4,-640364487),d=b(d,s,c,u,e[n+12],11,-421815835),u=b(u,d,s,c,e[n+15],16,530742520),c=b(c,u,d,s,e[n+2],23,-995338651),s=g(s,c,u,d,e[n],6,-198630844),d=g(d,s,c,u,e[n+7],10,1126891415),u=g(u,d,s,c,e[n+14],15,-1416354905),c=g(c,u,d,s,e[n+5],21,-57434055),s=g(s,c,u,d,e[n+12],6,1700485571),d=g(d,s,c,u,e[n+3],10,-1894986606),u=g(u,d,s,c,e[n+10],15,-1051523),c=g(c,u,d,s,e[n+1],21,-2054922799),s=g(s,c,u,d,e[n+8],6,1873313359),d=g(d,s,c,u,e[n+15],10,-30611744),u=g(u,d,s,c,e[n+6],15,-1560198380),c=g(c,u,d,s,e[n+13],21,1309151649),s=g(s,c,u,d,e[n+4],6,-145523070),d=g(d,s,c,u,e[n+11],10,-1120210379),u=g(u,d,s,c,e[n+2],15,718787259),c=g(c,u,d,s,e[n+9],21,-343485551),s=h(s,r),c=h(c,o),u=h(u,i),d=h(d,a);return[s,c,u,d]}(function(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e[t/8])<<t%32;return n}(e),8*e.length))}));var P=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||i)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var a=0;a<16;++a)t[r+a]=o[a];return t||d(o)};function C(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function A(e,t){return e<<t|e>>>32-t}var S=y("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=new Array(r.length);for(var o=0;o<r.length;o++)e[o]=r.charCodeAt(o)}e.push(128);var i=e.length/4+2,a=Math.ceil(i/16),s=new Array(a);for(o=0;o<a;o++){s[o]=new Array(16);for(var c=0;c<16;c++)s[o][c]=e[64*o+4*c]<<24|e[64*o+4*c+1]<<16|e[64*o+4*c+2]<<8|e[64*o+4*c+3]}for(s[a-1][14]=8*(e.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(e.length-1)&4294967295,o=0;o<a;o++){for(var u=new Array(80),d=0;d<16;d++)u[d]=s[o][d];for(d=16;d<80;d++)u[d]=A(u[d-3]^u[d-8]^u[d-14]^u[d-16],1);var l=n[0],p=n[1],f=n[2],y=n[3],h=n[4];for(d=0;d<80;d++){var m=Math.floor(d/20),v=A(l,5)+C(m,p,f,y)+h+t[m]+u[d]>>>0;h=y,y=f,f=A(p,30)>>>0,p=l,l=v}n[0]=n[0]+l>>>0,n[1]=n[1]+p>>>0,n[2]=n[2]+f>>>0,n[3]=n[3]+y>>>0,n[4]=n[4]+h>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}))},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.GooglePay=t.ApplePay=t.constants=t.recaptcha=t.ConfigHandler=t.Client=t.shared=t.util=t.tokenize=void 0;var i=n(11);t.tokenize=i;var a=n(3);t.util=a;var s=n(13);t.recaptcha=s;var c=n(0);t.constants=c;var u=n(6);t.shared=u;var d=n(14);t.Client=d.default;var l=n(8);t.ConfigHandler=l.default;var p=n(7);t.ApplePay=p.default;var f=n(16);t.GooglePay=f.default,o(n(2),t)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.spreedly=t.iats=t.cardconnect=void 0;var r=n(4);t.cardconnect=r;var o=n(12);t.iats=o;var i=n(5);t.spreedly=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tokenizePaymentCard=t.tokenizePaymentBankUs=t.tokenizePaymentBankCanada=void 0;var r=n(9);t.tokenizePaymentBankCanada=function(e,t,n,o,i,a,s,c,u){var d=r.v4(),l=u.address1;u.address2&&(l+="\n"+u.address2);for(var p={IATS_DPM_ProcessOption:"TOKEN",IATS_DPM_RecurringOn:"FALSE",IATS_DPM_ProcessID:i,IATS_DPM_RelayURL:a,IATS_DPM_ClientDefined_PaymentId:d,IATS_DPM_ClientDefined_GatewayId:s,IATS_DPM_Title:c.salutation,IATS_DPM_FirstName:c.firstName,IATS_DPM_LastName:c.lastName,IATS_DPM_Address:l,IATS_DPM_City:u.city,IATS_DPM_Province:u.state,IATS_DPM_Country:u.country,IATS_DPM_ZipCode:u.zip,IATS_DPM_Phone:c.primaryPhone,IATS_DPM_EMAIL:c.email,IATS_DPM_AccountNumber:e+t+n,IATS_DPM_MOP:"ACHEFT",IATS_DPM_AccountType:o},f=new FormData,y=0,h=Object.entries(p);y<h.length;y++){var m=h[y],v=m[0],_=m[1];f.append(v,_)}return fetch("https://www.iatspayments.com/netgate/IATSDPMProcess.aspx",{method:"POST",mode:"no-cors",body:f}).then((function(e){return e.text().then((function(){return d}))}))},t.tokenizePaymentBankUs=function(){throw new Error("US Bank Tokenization Not Yet Implemented")},t.tokenizePaymentCard=function(){throw new Error("Card Tokenization Not Yet Implemented")}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function o(){var e=new Date;return new Promise((function(t,n){!function r(){void 0!==window.grecaptcha&&void 0!==window.grecaptcha.render?t(window.grecaptcha):(new Date).valueOf()-e.valueOf()>15e3?n(new Error("grecaptcha not loaded after 15 seconds")):setTimeout(r,250)}()}))}Object.defineProperty(t,"__esModule",{value:!0}),t.wrapElement=t.RecaptchaElement=t.injectScript=void 0,t.injectScript=function(e){if(void 0!==window.grecaptcha)throw new Error("grecaptcha is already defined");var t=document.createElement("script");t.src="https://www.google.com/recaptcha/api.js?render=explicit",t.async=!0,t.defer=!0,t.onload=e||null,"interactive"===document.readyState||"complete"===document.readyState?document.body.appendChild(t):window.addEventListener("DOMContentLoaded",(function(){document.body.appendChild(t)}))};var i=function(){function e(e,t){this.container=e,this.params=t,this.executeResolveQueue=[]}return e.prototype.render=function(){var e=this;return void 0!==this.widgetId&&console.warn("rendering an already-rendered widget"),o().then((function(t){e.widgetId=t.render(e.container,r(r({},e.params),{callback:function(t){var n;e.resolvedToken=t,null===(n=e.executeResolveQueue.pop())||void 0===n||n(t)},"expired-callback":function(){e.resolvedToken=void 0}}))}))},e.prototype.resolveToken=function(){var e=this;return new Promise((function(t,n){o().then((function(r){if("invisible"!==e.params.size){var o=r.getResponse();return o?t(o):n(new Error("checkbox recaptcha is not checked"))}e.executeResolveQueue.push(t),void 0!==e.resolvedToken&&(e.resolvedToken=void 0,r.reset(e.widgetId)),r.execute(e.widgetId)})).catch((function(e){n(e)}))}))},e}();t.RecaptchaElement=i,t.wrapElement=function(e,t,n){var o=r(r({},n||{}),{sitekey:t}),a=new i(e,o);return a.render(),a}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),s=n(1),c=n(0),u=n(3),d=n(7),l=n(8),p=n(4),f=n(5),y=n(6),h=n(9),m=n(15),v={enableSandboxMode:!1,overrideBaseUrl:void 0,enableDelay:!1,secondsToDelay:0},_=function(){function e(e,t){var n,r=this;if(this.clientKey=e,this.options=Object.assign({},v,t),this.allowTransaction=!1,this.config=new l.default(this.options),Object.assign(this,this.config),this.options.enableDelay&&this.options.secondsToDelay){var o=1e3*this.options.secondsToDelay;setTimeout((function(){r.allowTransaction=!0}),o)}else this.allowTransaction=!0;this.options.enableSandboxMode&&void 0!==console&&console.info("[Sandbox] iDonate SDK Configuration:",JSON.parse(JSON.stringify(this)));try{var i=this.config,a=i.pcScriptBase,s=i.pcScriptId;if(!a||!s)throw new Error("missing config");var c=h.v4(),u=window.document.createElement("script");u.setAttribute("src",a+"/"+c+".js"),u.setAttribute("id",s);var d=!1;!function(){var e;try{if(d)return;window.document.body.append(u),d=!0}catch(t){null===(e=null===console||void 0===console?void 0:console.warn)||void 0===e||e.call(console,"not appended")}}(),window.addEventListener("DOMContentLoaded",(function(){window.document.body.append(u)}))}catch(e){null===(n=null===console||void 0===console?void 0:console.warn)||void 0===n||n.call(console,"Warning, partial initialization: ",String(e))}this.currentOrganizationId||this.setOrganizationId(this.clientKey)}return Object.defineProperty(e.prototype,"organizationId",{get:function(){if(!this.currentOrganizationId)throw new Error("organizationId undefined");return this.currentOrganizationId},enumerable:!1,configurable:!0}),e.prototype.createDonation=function(e){var t=this;if(!this.allowTransaction)throw new Error("Wow, that was fast - try again");var n=s.buildCashPaymentPayload(this.organizationId,e),a=function(e){return fetch(t.config.embedApiBaseUrl+"/donate/cash-payment",{method:"POST",headers:r(r(r({},c.CLIENT_HEADERS),e?{"cf-validation-token":e}:{}),{"User-Agent":c.CLIENT_HEADERS["User-Agent"]+" source:"+t.config.client}),body:JSON.stringify(n),credentials:"include"})};return a().then((function(e){return o(t,void 0,void 0,(function(){var t;return i(this,(function(n){switch(n.label){case 0:return"challenge"!==e.headers.get("cf-mitigated")?[3,2]:[4,m.handleCFChallenge(e,this)];case 1:return t=n.sent(),[2,a(null==t?void 0:t.token)];case 2:return[2,e]}}))}))})).then((function(e){return u.parseResponse(e,{throwErrors:!0})})).then((function(e){return s.buildDonationResult(e)}))},e.prototype.createTransaction=function(e){return this.createDonation(e).then((function(e){var t;return{transactionId:null===(t=e.transaction)||void 0===t?void 0:t.id,_raw_response:e._raw_response}}))},e.prototype.createPaymentMethod=function(e){return y.createPaymentMethod(e,this.config)},e.prototype.tokenizeCardConnectBankAccountInternal=function(e,t){return p.tokenizeBankAccount(e,t,this.config)},e.prototype.setOrganizationId=function(e){this.currentOrganizationId=e},e.prototype.tokenizeCardConnectBankAccount=function(e){return this.tokenizeCardConnectBankAccountInternal(e.routingNumber,e.accountNumber).then((function(e){if(!e.token||0!==e.errorcode)throw new a.ClientError(e.message,{_rawPayload:e});return e.token}))},e.prototype.tokenizeSpreedlyCreditCard=function(e){return f.tokenizeCreditCard(e,this.config)},e.prototype.tokenizeSpreedlyBankAccount=function(e){return f.tokenizeBankAccount(e,this.config)},e.prototype.tokenizeSpreedlyPayPal=function(e){return f.tokenizePayPal(e,this.config)},e.prototype.generateCardConnectTokenizerUrl=function(e){var t={enhancedresponse:"true",useexpiry:"true",usecvv:"true",placeholderyear:"2020",invalidinputevent:"true",placeholder:"Card Number",placeholdercvv:"CVV",formatinput:"true",expirymonthtitle:"Month",unique:"true",css:c.CARD_CONNECT_DEFAULT_STYLE},n=r(r({},t),e||{}),o=new URLSearchParams(n).toString().replace(/\+/g,"%20");return this.config.cardConnectTokenizerUrl+"?"+o},e.prototype.waitForDonationResult=function(e,t){var n=this;return new Promise((function(o,i){setTimeout((function(){var c;c=setInterval((function(){fetch(n.config.embedApiBaseUrl+"/donate/cash-payment/"+e+"/payment_status",{method:"GET",headers:{"Content-Type":"application/json"}}).then((function(e){return e.json()})).then((function(e){return e.result})).then((function(e){(function(e){return!!e.processed&&!!e.transaction})(e)&&(c&&(clearInterval(c),c=null),e.error&&i(new a.ClientError(e.error)),o(s.buildDonationResult({_raw_response:r({campaign:null,designation:{},donor:{},form_data:{},id:null,schedule:{},transaction:{}},e)}))),null==t||t()})).catch((function(e){c&&(clearInterval(c),c=null),i(e)}))}),2e3)}),2e3)}))},e.prototype.tokenizeCardConnectApplePay=function(e){var t=this,n=new d.default(e),o="",i=n.begin();return new Promise((function(e,a){i.then((function(i){i.onvalidatemerchant=function(e){var r={apple_pay_url:t.config.applePayUrl,organization_id:t.organizationId};n.createSession(r,t.config.embedApiBaseUrl).then((function(e){o=e.result.merchantSessionIdentifier,i.completeMerchantValidation(e.result)})).catch((function(e){i.abort(),a(e)}))},i.onpaymentauthorized=function(s){n.tokenizeWithCardConnect(s.payment,t.config.cardConnectBaseUrl).then((function(t){var n,a,c=r(r({},s.payment.billingContact),{email:null===(n=s.payment.shippingContact)||void 0===n?void 0:n.emailAddress,phone:null===(a=s.payment.shippingContact)||void 0===a?void 0:a.phoneNumber});e({applePaySession:i,cardConnectResponse:t,billingContact:c,merchantSessionId:o})})).catch((function(e){i.abort(),a(e)}))},i.oncancel=function(e){a(new Error("Apple Pay has been closed"))}})).catch((function(e){return a(e)}))}))},e}();t.default=_},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.handleCFChallenge=void 0;var i=null;t.handleCFChallenge=function(e,t){return new Promise((function(e,n){return r(void 0,void 0,void 0,(function(){var r,a,s,c,u,d,l,p;return o(this,(function(o){try{if(!(r=null===window||void 0===window?void 0:window.document)||!window)throw new Error("document is not present on window");a=r.createElement("div"),s=r.createElement("div"),c=function(n){var r;null===(r=null==n?void 0:n.render)||void 0===r||r.call(n,"#iDonateTurnstileBox",{sitekey:t.config.turnstileSiteKey,callback:function(t,n){a.remove(),e({token:t,preClearance:n})}})},window.idonateTurnstileLoadedHandler=function(){var e=window.turnstile;s.innerHTML="",e&&(i=e),c(e)},a.setAttribute("id","idonateTurnstileWrapper"),a.style.position="fixed",a.style.top="0",a.style.bottom="0",a.style.left="0",a.style.right="0",a.style.backgroundColor="rgba(0,0,0,0.9)",a.style.transition="all 400ms",a.style.display="flex",a.style.flexDirection="column",a.style.padding="40px 30px",a.style.opacity="0",a.style.color="white",a.style.fontFamily="sans-serif",a.style.zIndex="1000",a.innerHTML='<h1 id="idonateTurnstileVerificationHeader">Last tiny step before we submit your payment:</h1>',s.setAttribute("id","iDonateTurnstileBox"),a.append(s),r.body.append(a),i?c(i):(u=r.createElement("script"),s.innerHTML="loading ...",u.src=t.config.turnstileCdnUrl+"?render=explicit&onload=idonateTurnstileLoadedHandler",r.body.append(u)),null===(d=s.scrollIntoView)||void 0===d||d.call(s),a.style.opacity="1"}catch(e){null===(l=null===console||void 0===console?void 0:console.error)||void 0===l||l.call(console,e),null===(p=null===console||void 0===console?void 0:console.warn)||void 0===p||p.call(console,"iDonate SDK: Could not handle request, please reload the page and try again"),n(null)}return[2]}))}))}))}},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e){this.baseRequest={apiVersion:2,apiVersionMinor:0},this.baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!0,billingAddressParameters:{format:"FULL",phoneNumberRequired:!0}}},this.transactionInfo={countryCode:"US",currencyCode:"USD",totalPriceStatus:"FINAL",totalPrice:""},this.tokenizationSpecification={type:"PAYMENT_GATEWAY",parameters:{gateway:"cardconnect",gatewayMerchantId:""}},this.googlePayOptions={environment:"PRODUCTION"},this.paymentRequestDefaults=r(r({},this.baseRequest),{merchantInfo:{merchantId:""},transactionInfo:this.transactionInfo,emailRequired:!0,allowedPaymentMethods:[r(r({},this.baseCardPaymentMethod),{tokenizationSpecification:this.tokenizationSpecification})]}),this.paymentsClient=null;var t=e.paymentOptions,n=e.cardConnectMerchantId,o=e.paymentDataRequest,i=e.baseCardPaymentMethodParameters,a=void 0===i?{}:i;this.tokenizationSpecification.parameters.gatewayMerchantId=n,this.paymentRequest=Object.assign({},this.paymentRequestDefaults,o),this.googlePayOptions=Object.assign({},this.googlePayOptions,r(r({},t),{merchantInfo:this.paymentRequest.merchantInfo})),this.baseCardPaymentMethod.parameters=r(r({},this.baseCardPaymentMethod.parameters),a)}return e.resolveLib=function(e){var t=new Date;return new Promise((function(n,r){!function o(){if(void 0!==window.google&&void 0!==window.google.payments){var i=new google.payments.api.PaymentsClient(e);n(i)}else{(new Date).valueOf()-t.valueOf()>15e3?r(new Error("pay.js not loaded after 15 seconds")):setTimeout(o,250)}}()}))},e.injectScript=function(){if(void 0!==window.google&&void 0!==window.google.payments)throw new Error("google payments is already injected");var e=document.createElement("script");e.src="https://pay.google.com/gp/p/js/pay.js?render=explicit",e.async=!0,e.defer=!0,document.body.appendChild(e)},e.prototype.getGoogleIsReadyToPayRequest=function(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardPaymentMethod]})},e.prototype.getGooglePaymentClient=function(){var t=this;return new Promise((function(n,r){t.paymentsClient?n(t.paymentsClient):e.resolveLib(t.googlePayOptions).then((function(e){t.paymentsClient=e,n(e)})).catch((function(e){return r(e)}))}))},e.prototype.onGooglePaymentButtonClicked=function(e){var t=this,n=this.paymentRequest;return this.transactionInfo=Object.assign({},this.transactionInfo,e),n.transactionInfo=this.transactionInfo,new Promise((function(e,r){t.paymentsClient?t.paymentsClient.loadPaymentData(n).then((function(t){e(t)})).catch((function(e){r(e)})):r(new Error("PaymentClient is not initialized"))}))},e.prototype.tokenizeWithCardConnect=function(e,t){return fetch(t+"/cardsecure/api/v1/ccn/tokenize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encryptionhandler:"EC_GOOGLE_PAY",devicedata:e,unique:!0})}).then((function(e){return e.json()}))},e}();t.default=o}])}));