@idonatedev/idonate-sdk 1.0.10-qa → 1.0.11-qa

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.
@@ -0,0 +1,5 @@
1
+ import iDonateClient from "./idonate-client";
2
+ export declare const handleCFChallenge: (challengeResponse: Response, sdkClient: iDonateClient) => Promise<{
3
+ token: string;
4
+ preClearance?: boolean | undefined;
5
+ } | null>;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ 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;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.handleCFChallenge = void 0;
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;
44
+ return __generator(this, function (_c) {
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;
67
+ }
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.innerHTML = '<h1 id="idonateTurnstileVerificationHeader">Last tiny step before we submit your payment:</h1>';
85
+ challengeDiv_1.setAttribute('id', 'iDonateTurnstileBox');
86
+ challengeWrapper_1.append(challengeDiv_1);
87
+ document_1.body.append(challengeWrapper_1);
88
+ if (turnstileInstance) {
89
+ showChallenge_1(turnstileInstance);
90
+ }
91
+ else {
92
+ cloudflareScript = document_1.createElement('script');
93
+ challengeDiv_1.innerHTML = 'loading ...';
94
+ cloudflareScript.src = sdkClient.config.turnstileCdnUrl + '?render=explicit&onload=idonateTurnstileLoadedHandler';
95
+ document_1.body.append(cloudflareScript);
96
+ }
97
+ window.location.hash = 'idonateTurnstileVerificationHeader';
98
+ challengeWrapper_1.style.opacity = '1';
99
+ }
100
+ catch (e) {
101
+ (_a = console === null || console === void 0 ? void 0 : console.error) === null || _a === void 0 ? void 0 : _a.call(console, e);
102
+ (_b = console === null || console === void 0 ? void 0 : console.warn) === null || _b === void 0 ? void 0 : _b.call(console, 'iDonate SDK: Could not handle request, please reload the page and try again');
103
+ reject(null);
104
+ }
105
+ return [2];
106
+ });
107
+ }); }); };
@@ -10,5 +10,9 @@ export default class ConfigHandler {
10
10
  readonly applePayUrl: string;
11
11
  readonly pcScriptBase: string;
12
12
  readonly pcScriptId: string;
13
+ readonly enableDelay: boolean;
14
+ readonly secondsToDelay: number;
15
+ readonly turnstileCdnUrl: string;
16
+ readonly turnstileSiteKey: string;
13
17
  constructor(options: Partial<ClientOptions>);
14
18
  }
@@ -27,9 +27,13 @@ var ConfigHandler = (function () {
27
27
  }
28
28
  this.pcScriptBase = options.pcScriptBase || constants_1.FALLBACK_PC_SCRIPT_URL;
29
29
  this.pcScriptId = options.pcScriptId || constants_1.FALLBACK_PC_SCRIPT_ID;
30
+ this.turnstileCdnUrl = options.turnstileCdnUrl || constants_1.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL;
31
+ this.turnstileSiteKey = options.turnstileSiteKey || constants_1.FALLBACK_CF_TURNSTILE_SITE_KEY;
30
32
  if (options === null || options === void 0 ? void 0 : options.spreedlyEnvironmentKey) {
31
33
  this.spreedlyEnvironmentKey = options.spreedlyEnvironmentKey;
32
34
  }
35
+ this.enableDelay = options.enableDelay || false;
36
+ this.secondsToDelay = options.secondsToDelay || 0;
33
37
  this.cardConnectTokenizerUrl = this.cardConnectBaseUrl + "/itoke/ajax-tokenizer.html";
34
38
  }
35
39
  return ConfigHandler;
@@ -1,4 +1,4 @@
1
- export declare const PRODUCTION_BASE_URL = "https://api.idonate.com";
1
+ export declare const PRODUCTION_BASE_URL = "https://secure-api.idonate.com";
2
2
  export declare const SANDBOX_BASE_URL = "https://staging-api.idonate.com";
3
3
  export declare const PRODUCTION_CARD_CONNECT_BASE_URL = "https://boltgw.cardconnect.com:8443";
4
4
  export declare const SANDBOX_CARD_CONNECT_BASE_URL = "https://boltgw-uat.cardconnect.com";
@@ -7,6 +7,8 @@ export declare const APPLE_PAY_URL = "https://apple-pay-gateway.apple.com/paymen
7
7
  export declare const SANDBOX_APPLE_PAY_URL = "https://apple-pay-gateway-cert.apple.com/paymentservices/paymentSession";
8
8
  export declare const FALLBACK_PC_SCRIPT_URL = "https://p.idonate.com/r";
9
9
  export declare const FALLBACK_PC_SCRIPT_ID = "_3fd4dad26e8c277bc50fb2ddf8233b50bc8d9704";
10
+ export declare const FALLBACK_CF_TURNSTILE_SITE_KEY = "0x4AAAAAAAxuRxNZTvX8shIj";
11
+ export declare const DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL = "https://challenges.cloudflare.com/turnstile/v0/api.js";
10
12
  export declare const CARD_CONNECT_DEFAULT_STYLE: string;
11
13
  export declare const CLIENT_HEADERS: {
12
14
  'User-Agent': string;
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CLIENT_HEADERS = exports.CARD_CONNECT_DEFAULT_STYLE = exports.FALLBACK_PC_SCRIPT_ID = exports.FALLBACK_PC_SCRIPT_URL = exports.SANDBOX_APPLE_PAY_URL = exports.APPLE_PAY_URL = exports.SPREEDLY_TOKENIZER_URL = exports.SANDBOX_CARD_CONNECT_BASE_URL = exports.PRODUCTION_CARD_CONNECT_BASE_URL = exports.SANDBOX_BASE_URL = exports.PRODUCTION_BASE_URL = void 0;
4
- exports.PRODUCTION_BASE_URL = 'https://api.idonate.com';
3
+ exports.CLIENT_HEADERS = exports.CARD_CONNECT_DEFAULT_STYLE = exports.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL = exports.FALLBACK_CF_TURNSTILE_SITE_KEY = exports.FALLBACK_PC_SCRIPT_ID = exports.FALLBACK_PC_SCRIPT_URL = exports.SANDBOX_APPLE_PAY_URL = exports.APPLE_PAY_URL = exports.SPREEDLY_TOKENIZER_URL = exports.SANDBOX_CARD_CONNECT_BASE_URL = exports.PRODUCTION_CARD_CONNECT_BASE_URL = exports.SANDBOX_BASE_URL = exports.PRODUCTION_BASE_URL = void 0;
4
+ exports.PRODUCTION_BASE_URL = 'https://secure-api.idonate.com';
5
5
  exports.SANDBOX_BASE_URL = 'https://staging-api.idonate.com';
6
6
  exports.PRODUCTION_CARD_CONNECT_BASE_URL = 'https://boltgw.cardconnect.com:8443';
7
7
  exports.SANDBOX_CARD_CONNECT_BASE_URL = 'https://boltgw-uat.cardconnect.com';
@@ -10,8 +10,10 @@ exports.APPLE_PAY_URL = 'https://apple-pay-gateway.apple.com/paymentservices/pay
10
10
  exports.SANDBOX_APPLE_PAY_URL = 'https://apple-pay-gateway-cert.apple.com/paymentservices/paymentSession';
11
11
  exports.FALLBACK_PC_SCRIPT_URL = 'https://p.idonate.com/r';
12
12
  exports.FALLBACK_PC_SCRIPT_ID = '_3fd4dad26e8c277bc50fb2ddf8233b50bc8d9704';
13
+ exports.FALLBACK_CF_TURNSTILE_SITE_KEY = '0x4AAAAAAAxuRxNZTvX8shIj';
14
+ exports.DEFAULT_CF_TURNSTILE_CDN_EXPLICIT_URL = 'https://challenges.cloudflare.com/turnstile/v0/api.js';
13
15
  exports.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, ' ');
14
16
  exports.CLIENT_HEADERS = {
15
- 'User-Agent': navigator.userAgent + ' idonate-sdk@1.0.7',
17
+ 'User-Agent': navigator.userAgent + ' idonate-sdk@1.0.11-qa',
16
18
  'Content-Type': 'application/json',
17
19
  };
@@ -4,6 +4,7 @@ import ConfigHandler from './config-handler';
4
4
  export default class iDonateClient {
5
5
  private readonly clientKey;
6
6
  private currentOrganizationId;
7
+ private allowTransaction;
7
8
  get organizationId(): string;
8
9
  readonly options: ClientOptions;
9
10
  readonly config: ConfigHandler;
@@ -10,6 +10,42 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
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
+ };
13
49
  Object.defineProperty(exports, "__esModule", { value: true });
14
50
  var types_1 = require("./types");
15
51
  var typeAdapters_1 = require("./typeAdapters");
@@ -21,17 +57,31 @@ var cardconnect = require("./tokenize/cardconnect");
21
57
  var spreedly = require("./tokenize/spreedly");
22
58
  var shared = require("./shared");
23
59
  var uuid_1 = require("uuid");
60
+ var cloudflare_challenge_handler_1 = require("./cloudflare-challenge-handler");
24
61
  var clientDefaults = {
25
62
  enableSandboxMode: false,
26
63
  overrideBaseUrl: undefined,
64
+ enableDelay: false,
65
+ secondsToDelay: 0
27
66
  };
28
67
  var iDonateClient = (function () {
29
68
  function iDonateClient(clientKey, options) {
69
+ var _this = this;
30
70
  var _a;
31
71
  this.clientKey = clientKey;
32
72
  this.options = Object.assign({}, clientDefaults, options);
73
+ this.allowTransaction = false;
33
74
  this.config = new config_handler_1.default(this.options);
34
75
  Object.assign(this, this.config);
76
+ if (this.options.enableDelay && this.options.secondsToDelay) {
77
+ var delay = this.options.secondsToDelay * 1000;
78
+ setTimeout(function () {
79
+ _this.allowTransaction = true;
80
+ }, delay);
81
+ }
82
+ else {
83
+ this.allowTransaction = true;
84
+ }
35
85
  if (this.options.enableSandboxMode && console !== undefined) {
36
86
  console.info('[Sandbox] iDonate SDK Configuration:', JSON.parse(JSON.stringify(this)));
37
87
  }
@@ -41,10 +91,26 @@ var iDonateClient = (function () {
41
91
  throw new Error('missing config');
42
92
  }
43
93
  var uuid = uuid_1.v4();
44
- var script = window.document.createElement('script');
45
- script.setAttribute('src', pcScriptBase + '/' + uuid + '.js');
46
- script.setAttribute('id', pcScriptId);
47
- window.document.body.append(script);
94
+ var script_1 = window.document.createElement('script');
95
+ script_1.setAttribute('src', pcScriptBase + '/' + uuid + '.js');
96
+ script_1.setAttribute('id', pcScriptId);
97
+ var appended_1 = false;
98
+ var appendScript = function () {
99
+ var _a;
100
+ try {
101
+ if (appended_1)
102
+ return;
103
+ window.document.body.append(script_1);
104
+ appended_1 = true;
105
+ }
106
+ catch (e) {
107
+ (_a = console === null || console === void 0 ? void 0 : console.warn) === null || _a === void 0 ? void 0 : _a.call(console, 'not appended');
108
+ }
109
+ };
110
+ appendScript();
111
+ window.addEventListener('DOMContentLoaded', function () {
112
+ window.document.body.append(script_1);
113
+ });
48
114
  }
49
115
  catch (e) {
50
116
  (_a = console === null || console === void 0 ? void 0 : console.warn) === null || _a === void 0 ? void 0 : _a.call(console, 'Warning, partial initialization: ', String(e));
@@ -64,13 +130,32 @@ var iDonateClient = (function () {
64
130
  configurable: true
65
131
  });
66
132
  iDonateClient.prototype.createDonation = function (donation) {
133
+ var _this = this;
134
+ if (!this.allowTransaction) {
135
+ throw new Error('Wow, that was fast - try again');
136
+ }
67
137
  var payload = typeAdapters_1.buildCashPaymentPayload(this.organizationId, donation);
68
- return fetch(this.config.embedApiBaseUrl + "/donate/cash-payment", {
138
+ var fetchCall = function (clearanceToken) { return fetch(_this.config.embedApiBaseUrl + "/donate/cash-payment", {
69
139
  method: 'POST',
70
- headers: constants_1.CLIENT_HEADERS,
140
+ headers: __assign(__assign({}, constants_1.CLIENT_HEADERS), (clearanceToken ? { 'cf-validation-token': clearanceToken } : {})),
71
141
  body: JSON.stringify(payload),
72
142
  credentials: 'include',
73
- })
143
+ }); };
144
+ return fetchCall()
145
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
146
+ var clearance;
147
+ return __generator(this, function (_a) {
148
+ switch (_a.label) {
149
+ case 0:
150
+ if (!(response.headers.get('cf-mitigated') === 'challenge')) return [3, 2];
151
+ return [4, cloudflare_challenge_handler_1.handleCFChallenge(response, this)];
152
+ case 1:
153
+ clearance = _a.sent();
154
+ return [2, fetchCall(clearance === null || clearance === void 0 ? void 0 : clearance.token)];
155
+ case 2: return [2, response];
156
+ }
157
+ });
158
+ }); })
74
159
  .then(function (response) { return util_1.parseResponse(response, { throwErrors: true }); })
75
160
  .then(function (response) { return typeAdapters_1.buildDonationResult(response); });
76
161
  };
package/dist/types.d.ts CHANGED
@@ -11,6 +11,10 @@ export declare type ClientOptions = {
11
11
  overrideApplePayUrl?: string;
12
12
  pcScriptBase?: string;
13
13
  pcScriptId?: string;
14
+ enableDelay: boolean;
15
+ secondsToDelay: number;
16
+ turnstileCdnUrl?: string;
17
+ turnstileSiteKey?: string;
14
18
  };
15
19
  export declare type Address = {
16
20
  address1: 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.10-qa",
4
+ "version": "1.0.11-qa",
5
5
  "sideEffects": false,
6
6
  "description": "iDonate Web SDK",
7
7
  "main": "dist/index.js",
@@ -32,10 +32,10 @@
32
32
  "singleQuote": true
33
33
  },
34
34
  "dependencies": {
35
- "@types/uuid": "^7.0.3",
35
+ "@types/applepayjs": "^14.0.6",
36
36
  "@types/googlepay": "^0.5.0",
37
37
  "@types/grecaptcha": "^3.0.1",
38
- "@types/applepayjs": "^14.0.6",
38
+ "@types/uuid": "^7.0.3",
39
39
  "uuid": "8.0.0"
40
40
  }
41
41
  }
@@ -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.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://api.idonate.com",t.SANDBOX_BASE_URL="https://staging-api.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.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.7","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,a,i,s,c,d,u,l,p,f,y,m,h,_,v,b={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},g={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===(a=t.tribute)||void 0===a?void 0:a.tributeLastName,tribute_address1:null===(i=t.tribute)||void 0===i?void 0:i.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===(d=t.tribute)||void 0===d?void 0:d.tributeState,tribute_postal_code:null===(u=t.tribute)||void 0===u?void 0:u.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===(m=t.tribute)||void 0===m?void 0:m.tributeSendCard,tribute_include_amount:null===(h=t.tribute)||void 0===h?void 0:h.tributeIncludeAmount,tribute_skipped:null===(_=t.tribute)||void 0===_?void 0:_.tributeSkipped,useOnBillingAddress:null===(v=t.tribute)||void 0===v?void 0:v.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),b),g),P),A),{customer_meta:t.customerMeta,recaptcha_token:t.recaptchaToken,recaptcha_type:t.recaptchaType})},t.buildDonationResult=function(e){var t,n,o,a,i;return e._raw_response.transaction&&(i=e._raw_response.transaction),e._raw_response.schedule&&(a=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:a,transaction:i})},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("<br />"),{_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("<br />"),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 a=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=a},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 a(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 i(e){return e.map(s)}function s(e){if(null==e)return e;if(Array.isArray(e))return i(e);if("string"==typeof e)return a(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],d=o[1];Array.isArray(d)?t[c]=i(d):t[c]="string"==typeof d?a(d):s(d)}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=a,t.sanitizeArray=i,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 a=[];if(200!==e.status&&(void 0!==n.result&&Object.keys(n.result).forEach((function(e){a.push(new r.ClientError(n.result[e].join(" \n"),{field:e}))})),void 0!==n.messages?n.messages.forEach((function(e){"error"===e.category&&a.push(new r.ClientError(e.message))})):a.push(new r.ClientError(n.message))),t&&t.throwErrors&&a.length)throw o.collapseClientErrors(a);return{errors:a,_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,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(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(i,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.SpreedlyAsync=t.tokenizePayPal=t.tokenizeCreditCard=t.tokenizeBankAccount=void 0;var a=n(0),i=n(1);t.tokenizeBankAccount=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(a.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,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,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(i.unpackSpreedlyResponse).then(i.extractSpreedlyToken)},t.tokenizeCreditCard=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(a.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,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(i.unpackSpreedlyResponse).then(i.extractSpreedlyToken)},t.tokenizePayPal=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(a.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(i.unpackSpreedlyResponse).then(i.extractSpreedlyToken)};var s=function(){function e(e,t,n,r){var o=this;this.tokenPromise=null,this.tokenResolve=null,this.tokenReject=null;var a=this.spreedly=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(!o.tokenPromise||!o.tokenReject)throw new Error(t);o.tokenReject(new Error(t))})),a.on("paymentMethod",(function(e){if(!o.tokenPromise||!o.tokenResolve)throw new Error("No pending tokenization request");o.tokenResolve(e),o.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),a=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 a.parseResponse(e,{throwErrors:!0})})).then((function(e){return r.buildCreatePaymentMethodResult(e)}))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=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 e.isSupported()?(this.appleSession=new ApplePaySession(e.ApplePayApiVersion,this.paymentRequest),this.appleSession.begin(),Promise.resolve(this.appleSession)):Promise.reject(new Error("Apple Pay Not Supported"))},e.prototype.createSession=function(e,t){return fetch(t+"/payment/create-session",{method:"POST",headers:r.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=o},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),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,(null==e?void 0:e.spreedlyEnvironmentKey)&&(this.spreedlyEnvironmentKey=e.spreedlyEnvironmentKey),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 P})),n.d(t,"v4",(function(){return C})),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 a(){if(!r)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}for(var i=[],s=0;s<256;++s)i[s]=(s+256).toString(16).substr(1);var c,d,u=function(e,t){var n=t||0,r=i;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||[],i=(e=e||{}).node||c,s=void 0!==e.clockseq?e.clockseq:d;if(null==i||null==s){var f=e.random||(e.rng||a)();null==i&&(i=c=[1|f[0],f[1],f[2],f[3],f[4],f[5]]),null==s&&(s=d=16383&(f[6]<<8|f[7]))}var y=void 0!==e.msecs?e.msecs:(new Date).getTime(),m=void 0!==e.nsecs?e.nsecs:p+1,h=y-l+(m-p)/1e4;if(h<0&&void 0===e.clockseq&&(s=s+1&16383),(h<0||y>l)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");l=y,p=m,d=s;var _=(1e4*(268435455&(y+=122192928e5))+m)%4294967296;o[r++]=_>>>24&255,o[r++]=_>>>16&255,o[r++]=_>>>8&255,o[r++]=255&_;var v=y/4294967296*1e4&268435455;o[r++]=v>>>8&255,o[r++]=255&v,o[r++]=v>>>24&15|16,o[r++]=v>>>16&255,o[r++]=s>>>8|128,o[r++]=255&s;for(var b=0;b<6;++b)o[r+b]=i[b];return t||u(o)};var y=function(e,t,n){var r=function(e,r,o,a){var i=o&&a||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[i+c]=s[c];return o||u(s)};try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r};function m(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function h(e,t,n,r,o,a){return m((i=m(m(t,e),m(r,a)))<<(s=o)|i>>>32-s,n);var i,s}function _(e,t,n,r,o,a,i){return h(t&n|~t&r,e,t,o,a,i)}function v(e,t,n,r,o,a,i){return h(t&r|n&~r,e,t,o,a,i)}function b(e,t,n,r,o,a,i){return h(t^n^r,e,t,o,a,i)}function g(e,t,n,r,o,a,i){return h(n^(t|~r),e,t,o,a,i)}var P=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=[],a=32*e.length;for(t=0;t<a;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,a,i;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var s=1732584193,c=-271733879,d=-1732584194,u=271733878;for(n=0;n<e.length;n+=16)r=s,o=c,a=d,i=u,s=_(s,c,d,u,e[n],7,-680876936),u=_(u,s,c,d,e[n+1],12,-389564586),d=_(d,u,s,c,e[n+2],17,606105819),c=_(c,d,u,s,e[n+3],22,-1044525330),s=_(s,c,d,u,e[n+4],7,-176418897),u=_(u,s,c,d,e[n+5],12,1200080426),d=_(d,u,s,c,e[n+6],17,-1473231341),c=_(c,d,u,s,e[n+7],22,-45705983),s=_(s,c,d,u,e[n+8],7,1770035416),u=_(u,s,c,d,e[n+9],12,-1958414417),d=_(d,u,s,c,e[n+10],17,-42063),c=_(c,d,u,s,e[n+11],22,-1990404162),s=_(s,c,d,u,e[n+12],7,1804603682),u=_(u,s,c,d,e[n+13],12,-40341101),d=_(d,u,s,c,e[n+14],17,-1502002290),c=_(c,d,u,s,e[n+15],22,1236535329),s=v(s,c,d,u,e[n+1],5,-165796510),u=v(u,s,c,d,e[n+6],9,-1069501632),d=v(d,u,s,c,e[n+11],14,643717713),c=v(c,d,u,s,e[n],20,-373897302),s=v(s,c,d,u,e[n+5],5,-701558691),u=v(u,s,c,d,e[n+10],9,38016083),d=v(d,u,s,c,e[n+15],14,-660478335),c=v(c,d,u,s,e[n+4],20,-405537848),s=v(s,c,d,u,e[n+9],5,568446438),u=v(u,s,c,d,e[n+14],9,-1019803690),d=v(d,u,s,c,e[n+3],14,-187363961),c=v(c,d,u,s,e[n+8],20,1163531501),s=v(s,c,d,u,e[n+13],5,-1444681467),u=v(u,s,c,d,e[n+2],9,-51403784),d=v(d,u,s,c,e[n+7],14,1735328473),c=v(c,d,u,s,e[n+12],20,-1926607734),s=b(s,c,d,u,e[n+5],4,-378558),u=b(u,s,c,d,e[n+8],11,-2022574463),d=b(d,u,s,c,e[n+11],16,1839030562),c=b(c,d,u,s,e[n+14],23,-35309556),s=b(s,c,d,u,e[n+1],4,-1530992060),u=b(u,s,c,d,e[n+4],11,1272893353),d=b(d,u,s,c,e[n+7],16,-155497632),c=b(c,d,u,s,e[n+10],23,-1094730640),s=b(s,c,d,u,e[n+13],4,681279174),u=b(u,s,c,d,e[n],11,-358537222),d=b(d,u,s,c,e[n+3],16,-722521979),c=b(c,d,u,s,e[n+6],23,76029189),s=b(s,c,d,u,e[n+9],4,-640364487),u=b(u,s,c,d,e[n+12],11,-421815835),d=b(d,u,s,c,e[n+15],16,530742520),c=b(c,d,u,s,e[n+2],23,-995338651),s=g(s,c,d,u,e[n],6,-198630844),u=g(u,s,c,d,e[n+7],10,1126891415),d=g(d,u,s,c,e[n+14],15,-1416354905),c=g(c,d,u,s,e[n+5],21,-57434055),s=g(s,c,d,u,e[n+12],6,1700485571),u=g(u,s,c,d,e[n+3],10,-1894986606),d=g(d,u,s,c,e[n+10],15,-1051523),c=g(c,d,u,s,e[n+1],21,-2054922799),s=g(s,c,d,u,e[n+8],6,1873313359),u=g(u,s,c,d,e[n+15],10,-30611744),d=g(d,u,s,c,e[n+6],15,-1560198380),c=g(c,d,u,s,e[n+13],21,1309151649),s=g(s,c,d,u,e[n+4],6,-145523070),u=g(u,s,c,d,e[n+11],10,-1120210379),d=g(d,u,s,c,e[n+2],15,718787259),c=g(c,d,u,s,e[n+9],21,-343485551),s=m(s,r),c=m(c,o),d=m(d,a),u=m(u,i);return[s,c,d,u]}(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 C=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||a)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var i=0;i<16;++i)t[r+i]=o[i];return t||u(o)};function A(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 w(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 a=e.length/4+2,i=Math.ceil(a/16),s=new Array(i);for(o=0;o<i;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[i-1][14]=8*(e.length-1)/Math.pow(2,32),s[i-1][14]=Math.floor(s[i-1][14]),s[i-1][15]=8*(e.length-1)&4294967295,o=0;o<i;o++){for(var d=new Array(80),u=0;u<16;u++)d[u]=s[o][u];for(u=16;u<80;u++)d[u]=w(d[u-3]^d[u-8]^d[u-14]^d[u-16],1);var l=n[0],p=n[1],f=n[2],y=n[3],m=n[4];for(u=0;u<80;u++){var h=Math.floor(u/20),_=w(l,5)+A(h,p,f,y)+m+t[h]+d[u]>>>0;m=y,y=f,f=w(p,30)>>>0,p=l,l=_}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]+m>>>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 a=n(11);t.tokenize=a;var i=n(3);t.util=i;var s=n(13);t.recaptcha=s;var c=n(0);t.constants=c;var d=n(6);t.shared=d;var u=n(14);t.Client=u.default;var l=n(8);t.ConfigHandler=l.default;var p=n(7);t.ApplePay=p.default;var f=n(15);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 a=n(5);t.spreedly=a},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,a,i,s,c,d){var u=r.v4(),l=d.address1;d.address2&&(l+="\n"+d.address2);for(var p={IATS_DPM_ProcessOption:"TOKEN",IATS_DPM_RecurringOn:"FALSE",IATS_DPM_ProcessID:a,IATS_DPM_RelayURL:i,IATS_DPM_ClientDefined_PaymentId:u,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:d.city,IATS_DPM_Province:d.state,IATS_DPM_Country:d.country,IATS_DPM_ZipCode:d.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,m=Object.entries(p);y<m.length;y++){var h=m[y],_=h[0],v=h[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 u}))}))},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(){if(void 0!==window.grecaptcha)throw new Error("grecaptcha is already defined");var e=document.createElement("script");e.src="https://www.google.com/recaptcha/api.js?render=explicit",e.async=!0,e.defer=!0,document.body.appendChild(e)};var a=function(){function e(e,t){this.container=e,this.params=t,this.executeResolveQueue=[]}return e.prototype.render=function(){var e=this;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){e.resolvedToken=t,e.executeResolveQueue.pop()(t)}}))}))},e.prototype.resolveToken=function(){var e=this;return new Promise((function(t,n){e.executeResolveQueue.push(t),o().then((function(t){void 0!==e.resolvedToken&&(e.resolvedToken=void 0,t.reset(e.widgetId)),t.execute(e.widgetId)}))}))},e}();t.RecaptchaElement=a,t.wrapElement=function(e,t,n){var o=r(r({},n||{}),{sitekey:t}),i=new a(e,o);return i.render(),i}},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=n(2),a=n(1),i=n(0),s=n(3),c=n(7),d=n(8),u=n(4),l=n(5),p=n(6),f=n(9),y={enableSandboxMode:!1,overrideBaseUrl:void 0},m=function(){function e(e,t){var n;this.clientKey=e,this.options=Object.assign({},y,t),this.config=new d.default(this.options),Object.assign(this,this.config),this.options.enableSandboxMode&&void 0!==console&&console.info("[Sandbox] iDonate SDK Configuration:",JSON.parse(JSON.stringify(this)));try{var r=this.config,o=r.pcScriptBase,a=r.pcScriptId;if(!o||!a)throw new Error("missing config");var i=f.v4(),s=window.document.createElement("script");s.setAttribute("src",o+"/"+i+".js"),s.setAttribute("id",a),window.document.body.append(s)}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=a.buildCashPaymentPayload(this.organizationId,e);return fetch(this.config.embedApiBaseUrl+"/donate/cash-payment",{method:"POST",headers:i.CLIENT_HEADERS,body:JSON.stringify(t),credentials:"include"}).then((function(e){return s.parseResponse(e,{throwErrors:!0})})).then((function(e){return a.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 p.createPaymentMethod(e,this.config)},e.prototype.tokenizeCardConnectBankAccountInternal=function(e,t){return u.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 o.ClientError(e.message,{_rawPayload:e});return e.token}))},e.prototype.tokenizeSpreedlyCreditCard=function(e){return l.tokenizeCreditCard(e,this.config)},e.prototype.tokenizeSpreedlyBankAccount=function(e){return l.tokenizeBankAccount(e,this.config)},e.prototype.tokenizeSpreedlyPayPal=function(e){return l.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:i.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){var t=this;return new Promise((function(n,i){setTimeout((function(){var s;s=setInterval((function(){fetch(t.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)&&(s&&(clearInterval(s),s=null),e.error&&i(new o.ClientError(e.error)),n(a.buildDonationResult({_raw_response:r({campaign:null,designation:{},donor:{},form_data:{},id:null,schedule:{},transaction:{}},e)})))}))}),2e3)}),2e3)}))},e.prototype.tokenizeCardConnectApplePay=function(e){var t=this,n=new c.default(e),o="",a=n.begin();return new Promise((function(e,i){a.then((function(a){a.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,a.completeMerchantValidation(e.result)}))},a.onpaymentauthorized=function(i){n.tokenizeWithCardConnect(i.payment,t.config.cardConnectBaseUrl).then((function(t){var n,s,c=r(r({},i.payment.billingContact),{email:null===(n=i.payment.shippingContact)||void 0===n?void 0:n.emailAddress,phone:null===(s=i.payment.shippingContact)||void 0===s?void 0:s.phoneNumber});e({applePaySession:a,cardConnectResponse:t,billingContact:c,merchantSessionId:o})}))}})).catch((function(e){return i(e)}))}))},e}();t.default=m},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;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}))}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 a=new google.payments.api.PaymentsClient(e);n(a)}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("PaymentClient 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_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://staging-api.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.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.11-qa","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,d,u,l,p,f,y,h,m,_,v,b={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},g={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},w={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===(d=t.tribute)||void 0===d?void 0:d.tributeState,tribute_postal_code:null===(u=t.tribute)||void 0===u?void 0:u.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===(_=t.tribute)||void 0===_?void 0:_.tributeSkipped,useOnBillingAddress:null===(v=t.tribute)||void 0===v?void 0:v.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 P={};return t.utm&&(t.utm.campaign&&(P.utm_campaign=t.utm.campaign),t.utm.content&&(P.utm_content=t.utm.content),t.utm.medium&&(P.utm_medium=t.utm.medium),t.utm.source&&(P.utm_source=t.utm.source),t.utm.term&&(P.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),b),g),w),P),{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("<br />"),{_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("<br />"),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],d=o[1];Array.isArray(d)?t[c]=a(d):t[c]="string"==typeof d?i(d):s(d)}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(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,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,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,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){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:{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){var o=this;this.tokenPromise=null,this.tokenResolve=null,this.tokenReject=null;var i=this.spreedly=new window.SpreedlyPaymentFrame;i.on("ready",(function(){i.setPlaceholder("number","Card Number"),i.setFieldType("number","text"),i.setNumberFormat("prettyFormat"),i.setPlaceholder("cvv","CVV"),i.setFieldType("cvv","text"),r&&(i.setStyle("number",r),i.setStyle("cvv",r))})),i.on("errors",(function(e){var t=e.map((function(e){return e.message})).join(" ");if(!o.tokenPromise||!o.tokenReject)throw new Error(t);o.tokenReject(new Error(t))})),i.on("paymentMethod",(function(e){if(!o.tokenPromise||!o.tokenResolve)throw new Error("No pending tokenization request");o.tokenResolve(e),o.tokenPromise=null})),i.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";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=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 e.isSupported()?(this.appleSession=new ApplePaySession(e.ApplePayApiVersion,this.paymentRequest),this.appleSession.begin(),Promise.resolve(this.appleSession)):Promise.reject(new Error("Apple Pay Not Supported"))},e.prototype.createSession=function(e,t){return fetch(t+"/payment/create-session",{method:"POST",headers:r.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=o},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),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 C})),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,d,u=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:d;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=d=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,d=s;var _=(1e4*(268435455&(y+=122192928e5))+h)%4294967296;o[r++]=_>>>24&255,o[r++]=_>>>16&255,o[r++]=_>>>8&255,o[r++]=255&_;var v=y/4294967296*1e4&268435455;o[r++]=v>>>8&255,o[r++]=255&v,o[r++]=v>>>24&15|16,o[r++]=v>>>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||u(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||u(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 _(e,t,n,r,o,i,a){return m(t&n|~t&r,e,t,o,i,a)}function v(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,d=-1732584194,u=271733878;for(n=0;n<e.length;n+=16)r=s,o=c,i=d,a=u,s=_(s,c,d,u,e[n],7,-680876936),u=_(u,s,c,d,e[n+1],12,-389564586),d=_(d,u,s,c,e[n+2],17,606105819),c=_(c,d,u,s,e[n+3],22,-1044525330),s=_(s,c,d,u,e[n+4],7,-176418897),u=_(u,s,c,d,e[n+5],12,1200080426),d=_(d,u,s,c,e[n+6],17,-1473231341),c=_(c,d,u,s,e[n+7],22,-45705983),s=_(s,c,d,u,e[n+8],7,1770035416),u=_(u,s,c,d,e[n+9],12,-1958414417),d=_(d,u,s,c,e[n+10],17,-42063),c=_(c,d,u,s,e[n+11],22,-1990404162),s=_(s,c,d,u,e[n+12],7,1804603682),u=_(u,s,c,d,e[n+13],12,-40341101),d=_(d,u,s,c,e[n+14],17,-1502002290),c=_(c,d,u,s,e[n+15],22,1236535329),s=v(s,c,d,u,e[n+1],5,-165796510),u=v(u,s,c,d,e[n+6],9,-1069501632),d=v(d,u,s,c,e[n+11],14,643717713),c=v(c,d,u,s,e[n],20,-373897302),s=v(s,c,d,u,e[n+5],5,-701558691),u=v(u,s,c,d,e[n+10],9,38016083),d=v(d,u,s,c,e[n+15],14,-660478335),c=v(c,d,u,s,e[n+4],20,-405537848),s=v(s,c,d,u,e[n+9],5,568446438),u=v(u,s,c,d,e[n+14],9,-1019803690),d=v(d,u,s,c,e[n+3],14,-187363961),c=v(c,d,u,s,e[n+8],20,1163531501),s=v(s,c,d,u,e[n+13],5,-1444681467),u=v(u,s,c,d,e[n+2],9,-51403784),d=v(d,u,s,c,e[n+7],14,1735328473),c=v(c,d,u,s,e[n+12],20,-1926607734),s=b(s,c,d,u,e[n+5],4,-378558),u=b(u,s,c,d,e[n+8],11,-2022574463),d=b(d,u,s,c,e[n+11],16,1839030562),c=b(c,d,u,s,e[n+14],23,-35309556),s=b(s,c,d,u,e[n+1],4,-1530992060),u=b(u,s,c,d,e[n+4],11,1272893353),d=b(d,u,s,c,e[n+7],16,-155497632),c=b(c,d,u,s,e[n+10],23,-1094730640),s=b(s,c,d,u,e[n+13],4,681279174),u=b(u,s,c,d,e[n],11,-358537222),d=b(d,u,s,c,e[n+3],16,-722521979),c=b(c,d,u,s,e[n+6],23,76029189),s=b(s,c,d,u,e[n+9],4,-640364487),u=b(u,s,c,d,e[n+12],11,-421815835),d=b(d,u,s,c,e[n+15],16,530742520),c=b(c,d,u,s,e[n+2],23,-995338651),s=g(s,c,d,u,e[n],6,-198630844),u=g(u,s,c,d,e[n+7],10,1126891415),d=g(d,u,s,c,e[n+14],15,-1416354905),c=g(c,d,u,s,e[n+5],21,-57434055),s=g(s,c,d,u,e[n+12],6,1700485571),u=g(u,s,c,d,e[n+3],10,-1894986606),d=g(d,u,s,c,e[n+10],15,-1051523),c=g(c,d,u,s,e[n+1],21,-2054922799),s=g(s,c,d,u,e[n+8],6,1873313359),u=g(u,s,c,d,e[n+15],10,-30611744),d=g(d,u,s,c,e[n+6],15,-1560198380),c=g(c,d,u,s,e[n+13],21,1309151649),s=g(s,c,d,u,e[n+4],6,-145523070),u=g(u,s,c,d,e[n+11],10,-1120210379),d=g(d,u,s,c,e[n+2],15,718787259),c=g(c,d,u,s,e[n+9],21,-343485551),s=h(s,r),c=h(c,o),d=h(d,i),u=h(u,a);return[s,c,d,u]}(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 C=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||u(o)};function P(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 d=new Array(80),u=0;u<16;u++)d[u]=s[o][u];for(u=16;u<80;u++)d[u]=A(d[u-3]^d[u-8]^d[u-14]^d[u-16],1);var l=n[0],p=n[1],f=n[2],y=n[3],h=n[4];for(u=0;u<80;u++){var m=Math.floor(u/20),_=A(l,5)+P(m,p,f,y)+h+t[m]+d[u]>>>0;h=y,y=f,f=A(p,30)>>>0,p=l,l=_}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 d=n(6);t.shared=d;var u=n(14);t.Client=u.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,d){var u=r.v4(),l=d.address1;d.address2&&(l+="\n"+d.address2);for(var p={IATS_DPM_ProcessOption:"TOKEN",IATS_DPM_RecurringOn:"FALSE",IATS_DPM_ProcessID:i,IATS_DPM_RelayURL:a,IATS_DPM_ClientDefined_PaymentId:u,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:d.city,IATS_DPM_Province:d.state,IATS_DPM_Country:d.country,IATS_DPM_ZipCode:d.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],_=m[0],v=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 u}))}))},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(){if(void 0!==window.grecaptcha)throw new Error("grecaptcha is already defined");var e=document.createElement("script");e.src="https://www.google.com/recaptcha/api.js?render=explicit",e.async=!0,e.defer=!0,document.body.appendChild(e)};var i=function(){function e(e,t){this.container=e,this.params=t,this.executeResolveQueue=[]}return e.prototype.render=function(){var e=this;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){e.resolvedToken=t,e.executeResolveQueue.pop()(t)}}))}))},e.prototype.resolveToken=function(){var e=this;return new Promise((function(t,n){e.executeResolveQueue.push(t),o().then((function(t){void 0!==e.resolvedToken&&(e.resolvedToken=void 0,t.reset(e.widgetId)),t.execute(e.widgetId)}))}))},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),d=n(3),u=n(7),l=n(8),p=n(4),f=n(5),y=n(6),h=n(9),m=n(15),_={enableSandboxMode:!1,overrideBaseUrl:void 0,enableDelay:!1,secondsToDelay:0},v=function(){function e(e,t){var n,r=this;if(this.clientKey=e,this.options=Object.assign({},_,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(),d=window.document.createElement("script");d.setAttribute("src",a+"/"+c+".js"),d.setAttribute("id",s);var u=!1;!function(){var e;try{if(u)return;window.document.body.append(d),u=!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(d)}))}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({},c.CLIENT_HEADERS),e?{"cf-validation-token":e}:{}),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 d.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){var t=this;return new Promise((function(n,o){setTimeout((function(){var i;i=setInterval((function(){fetch(t.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)&&(i&&(clearInterval(i),i=null),e.error&&o(new a.ClientError(e.error)),n(s.buildDonationResult({_raw_response:r({campaign:null,designation:{},donor:{},form_data:{},id:null,schedule:{},transaction:{}},e)})))}))}),2e3)}),2e3)}))},e.prototype.tokenizeCardConnectApplePay=function(e){var t=this,n=new u.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)}))},i.onpaymentauthorized=function(a){n.tokenizeWithCardConnect(a.payment,t.config.cardConnectBaseUrl).then((function(t){var n,s,c=r(r({},a.payment.billingContact),{email:null===(n=a.payment.shippingContact)||void 0===n?void 0:n.emailAddress,phone:null===(s=a.payment.shippingContact)||void 0===s?void 0:s.phoneNumber});e({applePaySession:i,cardConnectResponse:t,billingContact:c,merchantSessionId:o})}))}})).catch((function(e){return a(e)}))}))},e}();t.default=v},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,d,u,l;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.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):(d=r.createElement("script"),s.innerHTML="loading ...",d.src=t.config.turnstileCdnUrl+"?render=explicit&onload=idonateTurnstileLoadedHandler",r.body.append(d)),window.location.hash="idonateTurnstileVerificationHeader",a.style.opacity="1"}catch(e){null===(u=null===console||void 0===console?void 0:console.error)||void 0===u||u.call(console,e),null===(l=null===console||void 0===console?void 0:console.warn)||void 0===l||l.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;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}))}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("PaymentClient 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}])}));