@idonatedev/idonate-sdk 1.0.1-alpha.3 → 1.0.3-dev1
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.
- package/README.md +77 -68
- package/dist/apple-pay.js +6 -11
- package/dist/config-handler.d.ts +1 -0
- package/dist/config-handler.js +5 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +4 -2
- package/dist/idonate-client.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/typeAdapters.js +1 -0
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/umd/idonate-sdk.js +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,83 @@
|
|
|
1
1
|
# What's this?
|
|
2
2
|
Javascript libraries for integrating with iDonate services.
|
|
3
3
|
|
|
4
|
+
A rough usage example can be found below the Changelog.
|
|
5
|
+
|
|
6
|
+
# Changes
|
|
7
|
+
## 1.0.3
|
|
8
|
+
* Configure `apple_pay_url` from environment and sandbox configuration, fixing Apple Pay sandbox issues introduced
|
|
9
|
+
in 1.0.1
|
|
10
|
+
|
|
11
|
+
## 1.0.1
|
|
12
|
+
* Compatibility fixes for Apple's `onvalidatemerchant` changes.
|
|
13
|
+
|
|
14
|
+
## 1.0.0
|
|
15
|
+
* Support Google Pay (GPay)
|
|
16
|
+
* Support UTM data
|
|
17
|
+
* Always request unique token from CardConnect
|
|
18
|
+
* Expand CreateDonationResult with donation details
|
|
19
|
+
* Schedule
|
|
20
|
+
* Donor
|
|
21
|
+
* Designation
|
|
22
|
+
* Campaign
|
|
23
|
+
* Preliminary support for Offsite Transactions (PayPal)
|
|
24
|
+
|
|
25
|
+
## 0.0.5-beta.0
|
|
26
|
+
### Breaking Changes:
|
|
27
|
+
* tokenizeCardConnectBankAccount now expects a single ACHAccount object as its parameter and will resolve with the
|
|
28
|
+
resulting token instead of a response object.
|
|
29
|
+
* ACHAccount expects accountNumber, routingNumber, accountHolderType (`"personal"` or `"business"`) and accountType
|
|
30
|
+
(`"checking"` or `"savings"`). Before this change, `"personal"` and `"checking"` were assumed.
|
|
31
|
+
* tokenizeCardConnectBankAccount will throw a ClientError on error. The raw result can still be obtained from the error
|
|
32
|
+
payload as `_rawResult`.
|
|
33
|
+
* mark `createTansaction` as deprecated - still supported, but should be replaced with `createDonation`, taking the same
|
|
34
|
+
input but capable of returning schedule data and handling schedules that do not result in an immediate transaction.
|
|
35
|
+
* `createPaymentMethod` and `createDonation` take an additional *required* option: `recaptchaType` - for most Organization
|
|
36
|
+
use cases, the value of `recaptchaType` should be `"organization"`.
|
|
37
|
+
|
|
38
|
+
### Other Notable Changes:
|
|
39
|
+
* support Apple Pay when creating PaymentMethods and purchasing with CardConnect
|
|
40
|
+
* introduce `tokenizeCardConnectApplePay` method on `Client`
|
|
41
|
+
* implement `createDonation` - a Donation may result in a Transaction and/or a Schedule. When scheduled for a future
|
|
42
|
+
time, the Donation result will not contain a Transaction at all. If `createTransaction` is used in these cases, the
|
|
43
|
+
entire result will be empty.
|
|
44
|
+
* detect and throw ClientErrors in many more cases.
|
|
45
|
+
* accept Double The Donation Company IDs directly, as corporateMatchingId (internal mappings are no longer supported)\
|
|
46
|
+
* internal support for Spreedly tokenization
|
|
47
|
+
* very rough internal support for styling CardConnect tokenizer iframes
|
|
48
|
+
* support for all Transaction parameters (tributes, gifts, and more)
|
|
49
|
+
|
|
50
|
+
## 0.0.4-alpha.13
|
|
51
|
+
* always create a unique token when calling tokenizeCardConnectBankAccount
|
|
52
|
+
|
|
53
|
+
## 0.0.4-alpha.12
|
|
54
|
+
* update sandbox configuration to prefer boltgw-uat environment.
|
|
55
|
+
|
|
56
|
+
## 0.0.4-alpha.2 through 0.0.4-alpha.11
|
|
57
|
+
* adjustments for internal applications
|
|
58
|
+
* public features diverted to v0.0.5
|
|
59
|
+
|
|
60
|
+
## 0.0.4-alpha.1
|
|
61
|
+
* rename `idonate.client` to `idonate.Client` to fit style guidelines
|
|
62
|
+
* `idonate.client` compatibility will be maintained until 0.0.6 (or equivalent) is released.
|
|
63
|
+
* Implement support for (and default to) using the Production environment for API calls.
|
|
64
|
+
* Add an `options` parameter to the Client constructor, initially with only one option: `enableSandboxMode`
|
|
65
|
+
* if `enableSandboxMode` is true, API calls will be made against the Staging environment.
|
|
66
|
+
* Add `corporateMatchingId` to the `createTransaction` payload.
|
|
67
|
+
* Enable support for 'bring-your-own reCAPTCHA', adding the `recaptchaToken` parameter to `createPaymentMethod` and `createTransaction` methods.
|
|
68
|
+
* reCAPTCHA results are valid for two minutes and the same token can be re-used within this timeframe.
|
|
69
|
+
* Update example in README to include reCAPTCHA support, trigger with a button instead of on load (example results continue to only show in the console)
|
|
70
|
+
|
|
71
|
+
## 0.0.3-alpha.3
|
|
72
|
+
* adjust README.
|
|
73
|
+
|
|
74
|
+
## 0.0.3-alpha.2
|
|
75
|
+
* start really writing this README
|
|
76
|
+
* remove organizationId from createTransaction method (determine from client)
|
|
77
|
+
* pass customerMeta to backend
|
|
78
|
+
* map transactionId in CreateTransactionResult
|
|
79
|
+
* Add CardConnect ACH tokenization helper, update demos with ACH features.
|
|
80
|
+
|
|
4
81
|
# Example: Low Level Transaction API, with reCAPTCHA
|
|
5
82
|
```html
|
|
6
83
|
<!DOCTYPE html>
|
|
@@ -124,71 +201,3 @@ Javascript libraries for integrating with iDonate services.
|
|
|
124
201
|
</script>
|
|
125
202
|
</html>
|
|
126
203
|
```
|
|
127
|
-
|
|
128
|
-
# Changes
|
|
129
|
-
## 1.0.0
|
|
130
|
-
* Support Google Pay (GPay)
|
|
131
|
-
* Support UTM data
|
|
132
|
-
* Always request unique token from CardConnect
|
|
133
|
-
* Expand CreateDonationResult with donation details
|
|
134
|
-
* Schedule
|
|
135
|
-
* Donor
|
|
136
|
-
* Designation
|
|
137
|
-
* Campaign
|
|
138
|
-
* Preliminary support for Offsite Transactions (PayPal)
|
|
139
|
-
|
|
140
|
-
## 0.0.5-beta.0
|
|
141
|
-
### Breaking Changes:
|
|
142
|
-
* tokenizeCardConnectBankAccount now expects a single ACHAccount object as its parameter and will resolve with the
|
|
143
|
-
resulting token instead of a response object.
|
|
144
|
-
* ACHAccount expects accountNumber, routingNumber, accountHolderType (`"personal"` or `"business"`) and accountType
|
|
145
|
-
(`"checking"` or `"savings"`). Before this change, `"personal"` and `"checking"` were assumed.
|
|
146
|
-
* tokenizeCardConnectBankAccount will throw a ClientError on error. The raw result can still be obtained from the error
|
|
147
|
-
payload as `_rawResult`.
|
|
148
|
-
* mark `createTansaction` as deprecated - still supported, but should be replaced with `createDonation`, taking the same
|
|
149
|
-
input but capable of returning schedule data and handling schedules that do not result in an immediate transaction.
|
|
150
|
-
* `createPaymentMethod` and `createDonation` take an additional *required* option: `recaptchaType` - for most Organization
|
|
151
|
-
use cases, the value of `recaptchaType` should be `"organization"`.
|
|
152
|
-
|
|
153
|
-
### Other Notable Changes:
|
|
154
|
-
* support Apple Pay when creating PaymentMethods and purchasing with CardConnect
|
|
155
|
-
* introduce `tokenizeCardConnectApplePay` method on `Client`
|
|
156
|
-
* implement `createDonation` - a Donation may result in a Transaction and/or a Schedule. When scheduled for a future
|
|
157
|
-
time, the Donation result will not contain a Transaction at all. If `createTransaction` is used in these cases, the
|
|
158
|
-
entire result will be empty.
|
|
159
|
-
* detect and throw ClientErrors in many more cases.
|
|
160
|
-
* accept Double The Donation Company IDs directly, as corporateMatchingId (internal mappings are no longer supported)\
|
|
161
|
-
* internal support for Spreedly tokenization
|
|
162
|
-
* very rough internal support for styling CardConnect tokenizer iframes
|
|
163
|
-
* support for all Transaction parameters (tributes, gifts, and more)
|
|
164
|
-
|
|
165
|
-
## 0.0.4-alpha.13
|
|
166
|
-
* always create a unique token when calling tokenizeCardConnectBankAccount
|
|
167
|
-
|
|
168
|
-
## 0.0.4-alpha.12
|
|
169
|
-
* update sandbox configuration to prefer boltgw-uat environment.
|
|
170
|
-
|
|
171
|
-
## 0.0.4-alpha.2 through 0.0.4-alpha.11
|
|
172
|
-
* adjustments for internal applications
|
|
173
|
-
* public features diverted to v0.0.5
|
|
174
|
-
|
|
175
|
-
## 0.0.4-alpha.1
|
|
176
|
-
* rename `idonate.client` to `idonate.Client` to fit style guidelines
|
|
177
|
-
* `idonate.client` compatibility will be maintained until 0.0.6 (or equivalent) is released.
|
|
178
|
-
* Implement support for (and default to) using the Production environment for API calls.
|
|
179
|
-
* Add an `options` parameter to the Client constructor, initially with only one option: `enableSandboxMode`
|
|
180
|
-
* if `enableSandboxMode` is true, API calls will be made against the Staging environment.
|
|
181
|
-
* Add `corporateMatchingId` to the `createTransaction` payload.
|
|
182
|
-
* Enable support for 'bring-your-own reCAPTCHA', adding the `recaptchaToken` parameter to `createPaymentMethod` and `createTransaction` methods.
|
|
183
|
-
* reCAPTCHA results are valid for two minutes and the same token can be re-used within this timeframe.
|
|
184
|
-
* Update example in README to include reCAPTCHA support, trigger with a button instead of on load (example results continue to only show in the console)
|
|
185
|
-
|
|
186
|
-
## 0.0.3-alpha.3
|
|
187
|
-
* adjust README.
|
|
188
|
-
|
|
189
|
-
## 0.0.3-alpha.2
|
|
190
|
-
* start really writing this README
|
|
191
|
-
* remove organizationId from createTransaction method (determine from client)
|
|
192
|
-
* pass customerMeta to backend
|
|
193
|
-
* map transactionId in CreateTransactionResult
|
|
194
|
-
* Add CardConnect ACH tokenization helper, update demos with ACH features.
|
package/dist/apple-pay.js
CHANGED
|
@@ -25,17 +25,12 @@ var ApplePay = (function () {
|
|
|
25
25
|
ApplePaySession.supportsVersion(ApplePay.ApplePayApiVersion));
|
|
26
26
|
};
|
|
27
27
|
ApplePay.prototype.begin = function () {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
_this.appleSession = new ApplePaySession(ApplePay.ApplePayApiVersion, _this.paymentRequest);
|
|
35
|
-
_this.appleSession.begin();
|
|
36
|
-
resolve(_this.appleSession);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
28
|
+
if (!ApplePay.isSupported()) {
|
|
29
|
+
return Promise.reject(new Error('Apple Pay Not Supported'));
|
|
30
|
+
}
|
|
31
|
+
this.appleSession = new ApplePaySession(ApplePay.ApplePayApiVersion, this.paymentRequest);
|
|
32
|
+
this.appleSession.begin();
|
|
33
|
+
return Promise.resolve(this.appleSession);
|
|
39
34
|
};
|
|
40
35
|
ApplePay.prototype.createSession = function (payload, embedApiBaseUrl) {
|
|
41
36
|
return fetch(embedApiBaseUrl + "/payment/create-session", {
|
package/dist/config-handler.d.ts
CHANGED
package/dist/config-handler.js
CHANGED
|
@@ -6,10 +6,12 @@ var ConfigHandler = (function () {
|
|
|
6
6
|
if (options.enableSandboxMode) {
|
|
7
7
|
this.apiBaseUrl = constants_1.SANDBOX_BASE_URL;
|
|
8
8
|
this.cardConnectBaseUrl = constants_1.SANDBOX_CARD_CONNECT_BASE_URL;
|
|
9
|
+
this.applePayUrl = constants_1.SANDBOX_APPLE_PAY_URL;
|
|
9
10
|
}
|
|
10
11
|
else {
|
|
11
12
|
this.apiBaseUrl = constants_1.PRODUCTION_BASE_URL;
|
|
12
13
|
this.cardConnectBaseUrl = constants_1.PRODUCTION_CARD_CONNECT_BASE_URL;
|
|
14
|
+
this.applePayUrl = constants_1.APPLE_PAY_URL;
|
|
13
15
|
}
|
|
14
16
|
if (options.overrideBaseUrl) {
|
|
15
17
|
this.apiBaseUrl = options.overrideBaseUrl;
|
|
@@ -20,6 +22,9 @@ var ConfigHandler = (function () {
|
|
|
20
22
|
options.overrideDonorApiBaseUrl || this.apiBaseUrl + "/donor";
|
|
21
23
|
this.embedApiBaseUrl =
|
|
22
24
|
options.overrideEmbedApiBaseUrl || this.apiBaseUrl + "/embed";
|
|
25
|
+
if (options.overrideApplePayUrl) {
|
|
26
|
+
this.applePayUrl = options.overrideApplePayUrl;
|
|
27
|
+
}
|
|
23
28
|
if (options === null || options === void 0 ? void 0 : options.spreedlyEnvironmentKey) {
|
|
24
29
|
this.spreedlyEnvironmentKey = options.spreedlyEnvironmentKey;
|
|
25
30
|
}
|
package/dist/constants.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ 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";
|
|
5
5
|
export declare const SPREEDLY_TOKENIZER_URL = "https://core.spreedly.com/v1/payment_methods.json";
|
|
6
|
+
export declare const APPLE_PAY_URL = "https://apple-pay-gateway.apple.com/paymentservices/paymentSession";
|
|
7
|
+
export declare const SANDBOX_APPLE_PAY_URL = "https://apple-pay-gateway-cert.apple.com/paymentservices/paymentSession";
|
|
6
8
|
export declare const CARD_CONNECT_DEFAULT_STYLE: string;
|
|
7
9
|
export declare const CLIENT_HEADERS: {
|
|
8
10
|
'User-Agent': string;
|
package/dist/constants.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLIENT_HEADERS = exports.CARD_CONNECT_DEFAULT_STYLE = 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;
|
|
3
|
+
exports.CLIENT_HEADERS = exports.CARD_CONNECT_DEFAULT_STYLE = 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
4
|
exports.PRODUCTION_BASE_URL = 'https://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';
|
|
8
8
|
exports.SPREEDLY_TOKENIZER_URL = 'https://core.spreedly.com/v1/payment_methods.json';
|
|
9
|
+
exports.APPLE_PAY_URL = 'https://apple-pay-gateway.apple.com/paymentservices/paymentSession';
|
|
10
|
+
exports.SANDBOX_APPLE_PAY_URL = 'https://apple-pay-gateway-cert.apple.com/paymentservices/paymentSession';
|
|
9
11
|
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, ' ');
|
|
10
12
|
exports.CLIENT_HEADERS = {
|
|
11
|
-
'User-Agent': navigator.userAgent + ' idonate-sdk@1.0.1-alpha.
|
|
13
|
+
'User-Agent': navigator.userAgent + ' idonate-sdk@1.0.1-alpha.4',
|
|
12
14
|
'Content-Type': 'application/json',
|
|
13
15
|
};
|
package/dist/idonate-client.js
CHANGED
|
@@ -152,7 +152,7 @@ var iDonateClient = (function () {
|
|
|
152
152
|
.then(function (session) {
|
|
153
153
|
session.onvalidatemerchant = function (event) {
|
|
154
154
|
var validationPayload = {
|
|
155
|
-
apple_pay_url:
|
|
155
|
+
apple_pay_url: _this.config.applePayUrl,
|
|
156
156
|
organization_id: _this.organizationId,
|
|
157
157
|
};
|
|
158
158
|
applePay
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ import ConfigHandler from './config-handler';
|
|
|
8
8
|
import ApplePay from './apple-pay';
|
|
9
9
|
import GooglePay from './google-pay';
|
|
10
10
|
export * from './types';
|
|
11
|
-
export { tokenize, util, shared, iDonateClient as Client,
|
|
11
|
+
export { tokenize, util, shared, iDonateClient as Client, ConfigHandler, recaptcha, constants, ApplePay, GooglePay, };
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.GooglePay = exports.ApplePay = exports.constants = exports.recaptcha = exports.ConfigHandler = exports.
|
|
13
|
+
exports.GooglePay = exports.ApplePay = exports.constants = exports.recaptcha = exports.ConfigHandler = exports.Client = exports.shared = exports.util = exports.tokenize = void 0;
|
|
14
14
|
var tokenize = require("./tokenize");
|
|
15
15
|
exports.tokenize = tokenize;
|
|
16
16
|
var util = require("./util");
|
|
@@ -23,7 +23,6 @@ var shared = require("./shared");
|
|
|
23
23
|
exports.shared = shared;
|
|
24
24
|
var idonate_client_1 = require("./idonate-client");
|
|
25
25
|
exports.Client = idonate_client_1.default;
|
|
26
|
-
exports.client = idonate_client_1.default;
|
|
27
26
|
var config_handler_1 = require("./config-handler");
|
|
28
27
|
exports.ConfigHandler = config_handler_1.default;
|
|
29
28
|
var apple_pay_1 = require("./apple-pay");
|
package/dist/typeAdapters.js
CHANGED
|
@@ -81,6 +81,7 @@ function buildCashPaymentPayload(organizationId, input) {
|
|
|
81
81
|
tribute_skipped: (_q = input.tribute) === null || _q === void 0 ? void 0 : _q.tributeSkipped,
|
|
82
82
|
useOnBillingAddress: (_r = input.tribute) === null || _r === void 0 ? void 0 : _r.useOnBillingAddress,
|
|
83
83
|
embed_referer: window.location.href,
|
|
84
|
+
converted_to_recurring: input.convertedToRecurring
|
|
84
85
|
};
|
|
85
86
|
if (input.designations) {
|
|
86
87
|
donationOptions.designations = input.designations;
|
package/dist/types.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare type ClientOptions = {
|
|
|
8
8
|
overrideEmbedApiBaseUrl?: string;
|
|
9
9
|
overrideDonorApiBaseUrl?: string;
|
|
10
10
|
overrideCardConnectBaseUrl?: string;
|
|
11
|
+
overrideApplePayUrl?: string;
|
|
11
12
|
};
|
|
12
13
|
export declare type Address = {
|
|
13
14
|
address1: string;
|
|
@@ -115,6 +116,7 @@ export declare type CreateDonationRequest = RecaptchaSecuredRequest & {
|
|
|
115
116
|
giftExtra?: string;
|
|
116
117
|
giftSkipped?: boolean;
|
|
117
118
|
embedId?: string;
|
|
119
|
+
convertedToRecurring?: boolean | undefined;
|
|
118
120
|
};
|
|
119
121
|
export declare type ClientErrorDetails = {
|
|
120
122
|
field?: string;
|
package/package.json
CHANGED
package/umd/idonate-sdk.js
CHANGED
|
@@ -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=9)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CLIENT_HEADERS=t.CARD_CONNECT_DEFAULT_STYLE=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.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.1-alpha.3","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},C={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},P={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,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};t.designations?P.designations=t.designations:P.designations=[],t.designationId&&P.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]&&(P[n]=t.customerMeta[n],delete t.customerMeta[n])})),r(r(r(r(r(r({},P),b),g),C),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";Object.defineProperty(t,"__esModule",{value:!0}),t.tokenizePayPal=t.tokenizeCreditCard=t.tokenizeBankAccount=void 0;var r=n(0),o=n(1);t.tokenizeBankAccount=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(r.SPREEDLY_TOKENIZER_URL,{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}},environment_key:t.spreedlyEnvironmentKey,retained:!1})}).then(o.unpackSpreedlyResponse).then(o.extractSpreedlyToken)},t.tokenizeCreditCard=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(r.SPREEDLY_TOKENIZER_URL,{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}},environment_key:t.spreedlyEnvironmentKey,retained:!1})}).then(o.unpackSpreedlyResponse).then(o.extractSpreedlyToken)},t.tokenizePayPal=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(r.SPREEDLY_TOKENIZER_URL,{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},environment_key:t.spreedlyEnvironmentKey,retained:!1})}).then(o.unpackSpreedlyResponse).then(o.extractSpreedlyToken)}},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(){var t=this;return new Promise((function(n,r){e.isSupported()?(t.appleSession=new ApplePaySession(e.ApplePayApiVersion,t.paymentRequest),t.appleSession.begin(),n(t.appleSession)):r(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.apiBaseUrl=r.PRODUCTION_BASE_URL,this.cardConnectBaseUrl=r.PRODUCTION_CARD_CONNECT_BASE_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",(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";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.Client=t.shared=t.util=t.tokenize=void 0;var a=n(10);t.tokenize=a;var i=n(3);t.util=i;var s=n(12);t.recaptcha=s;var c=n(0);t.constants=c;var d=n(6);t.shared=d;var u=n(13);t.Client=u.default,t.client=u.default;var l=n(8);t.ConfigHandler=l.default;var p=n(7);t.ApplePay=p.default;var f=n(14);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(11);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(15);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={enableSandboxMode:!1,overrideBaseUrl:void 0},y=function(){function e(e,t){this.clientKey=e,this.options=Object.assign({},f,t),this.organizationId=e,this.config=new d.default(this.options),this.apiBaseUrl=this.config.apiBaseUrl,this.cardConnectBaseUrl=this.config.cardConnectBaseUrl,this.authApiBaseUrl=this.config.authApiBaseUrl,this.donorApiBaseUrl=this.config.donorApiBaseUrl,this.embedApiBaseUrl=this.config.embedApiBaseUrl,this.spreedlyEnvironmentKey=this.config.spreedlyEnvironmentKey,this.cardConnectTokenizerUrl=this.config.cardConnectTokenizerUrl,this.options.enableSandboxMode&&void 0!==console&&console.info("[Sandbox] iDonate SDK Configuration:",JSON.parse(JSON.stringify(this)))}return e.prototype.createDonation=function(e){var t=a.buildCashPaymentPayload(this.organizationId,e);return fetch(this.embedApiBaseUrl+"/donate/cash-payment",{method:"POST",headers:i.CLIENT_HEADERS,body:JSON.stringify(t)}).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.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.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.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;return new Promise((function(n,o){var a=new c.default(e),i="";a.begin().then((function(e){e.onvalidatemerchant=function(n){var r={apple_pay_url:n.validationURL,organization_id:t.organizationId};a.createSession(r,t.embedApiBaseUrl).then((function(t){i=t.result.merchantSessionIdentifier,e.completeMerchantValidation(t.result)}))},e.onpaymentauthorized=function(o){a.tokenizeWithCardConnect(o.payment,t.cardConnectBaseUrl).then((function(t){var a,s,c=r(r({},o.payment.billingContact),{email:null===(a=o.payment.shippingContact)||void 0===a?void 0:a.emailAddress,phone:null===(s=o.payment.shippingContact)||void 0===s?void 0:s.phoneNumber});n({applePaySession:e,cardConnectResponse:t,billingContact:c,merchantSessionId:i})}))}})).catch((function(e){return o(e)}))}))},e}();t.default=y},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},function(e,t,n){"use strict";n.r(t),n.d(t,"v1",(function(){return f})),n.d(t,"v3",(function(){return C})),n.d(t,"v4",(function(){return P})),n.d(t,"v5",(function(){return S}));var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),o=new Uint8Array(16);function 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 C=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 P=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||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]]}))}])}));
|
|
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=9)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CLIENT_HEADERS=t.CARD_CONNECT_DEFAULT_STYLE=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.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.1-alpha.4","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,p,l,y,f,m,h,_,v,g={country:t.billingAddress.country,address1:t.billingAddress.address1,address2:t.billingAddress.address2,city:t.billingAddress.city,state:t.billingAddress.state,zip_code:t.billingAddress.zip},b={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,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===(p=t.tribute)||void 0===p?void 0:p.tributeCountry,tribute_from_name:null===(l=t.tribute)||void 0===l?void 0:l.tributeFromName,tribute_recipient_email:null===(y=t.tribute)||void 0===y?void 0:y.tributeRecipientEmail,honorees:null===(f=t.tribute)||void 0===f?void 0:f.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),g),b),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";Object.defineProperty(t,"__esModule",{value:!0}),t.tokenizePayPal=t.tokenizeCreditCard=t.tokenizeBankAccount=void 0;var r=n(0),o=n(1);t.tokenizeBankAccount=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(r.SPREEDLY_TOKENIZER_URL,{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}},environment_key:t.spreedlyEnvironmentKey,retained:!1})}).then(o.unpackSpreedlyResponse).then(o.extractSpreedlyToken)},t.tokenizeCreditCard=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(r.SPREEDLY_TOKENIZER_URL,{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}},environment_key:t.spreedlyEnvironmentKey,retained:!1})}).then(o.unpackSpreedlyResponse).then(o.extractSpreedlyToken)},t.tokenizePayPal=function(e,t){return void 0===t.spreedlyEnvironmentKey?Promise.reject(new Error("Spreedly is not configured.")):fetch(r.SPREEDLY_TOKENIZER_URL,{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},environment_key:t.spreedlyEnvironmentKey,retained:!1})}).then(o.unpackSpreedlyResponse).then(o.extractSpreedlyToken)}},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),(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";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(10);t.tokenize=a;var i=n(3);t.util=i;var s=n(12);t.recaptcha=s;var c=n(0);t.constants=c;var d=n(6);t.shared=d;var u=n(13);t.Client=u.default;var p=n(8);t.ConfigHandler=p.default;var l=n(7);t.ApplePay=l.default;var y=n(14);t.GooglePay=y.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(11);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(15);t.tokenizePaymentBankCanada=function(e,t,n,o,a,i,s,c,d){var u=r.v4(),p=d.address1;d.address2&&(p+="\n"+d.address2);for(var l={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:p,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},y=new FormData,f=0,m=Object.entries(l);f<m.length;f++){var h=m[f],_=h[0],v=h[1];y.append(_,v)}return fetch("https://www.iatspayments.com/netgate/IATSDPMProcess.aspx",{method:"POST",mode:"no-cors",body:y}).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),p=n(5),l=n(6),y={enableSandboxMode:!1,overrideBaseUrl:void 0},f=function(){function e(e,t){this.clientKey=e,this.options=Object.assign({},y,t),this.organizationId=e,this.config=new d.default(this.options),this.apiBaseUrl=this.config.apiBaseUrl,this.cardConnectBaseUrl=this.config.cardConnectBaseUrl,this.authApiBaseUrl=this.config.authApiBaseUrl,this.donorApiBaseUrl=this.config.donorApiBaseUrl,this.embedApiBaseUrl=this.config.embedApiBaseUrl,this.spreedlyEnvironmentKey=this.config.spreedlyEnvironmentKey,this.cardConnectTokenizerUrl=this.config.cardConnectTokenizerUrl,this.options.enableSandboxMode&&void 0!==console&&console.info("[Sandbox] iDonate SDK Configuration:",JSON.parse(JSON.stringify(this)))}return e.prototype.createDonation=function(e){var t=a.buildCashPaymentPayload(this.organizationId,e);return fetch(this.embedApiBaseUrl+"/donate/cash-payment",{method:"POST",headers:i.CLIENT_HEADERS,body:JSON.stringify(t)}).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 l.createPaymentMethod(e,this.config)},e.prototype.tokenizeCardConnectBankAccountInternal=function(e,t){return u.tokenizeBankAccount(e,t,this.config)},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 p.tokenizeCreditCard(e,this.config)},e.prototype.tokenizeSpreedlyBankAccount=function(e){return p.tokenizeBankAccount(e,this.config)},e.prototype.tokenizeSpreedlyPayPal=function(e){return p.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.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.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;return new Promise((function(n,o){var a=new c.default(e),i="";a.begin().then((function(e){e.onvalidatemerchant=function(n){var r={apple_pay_url:t.config.applePayUrl,organization_id:t.organizationId};a.createSession(r,t.embedApiBaseUrl).then((function(t){i=t.result.merchantSessionIdentifier,e.completeMerchantValidation(t.result)}))},e.onpaymentauthorized=function(o){a.tokenizeWithCardConnect(o.payment,t.cardConnectBaseUrl).then((function(t){var a,s,c=r(r({},o.payment.billingContact),{email:null===(a=o.payment.shippingContact)||void 0===a?void 0:a.emailAddress,phone:null===(s=o.payment.shippingContact)||void 0===s?void 0:s.phoneNumber});n({applePaySession:e,cardConnectResponse:t,billingContact:c,merchantSessionId:i})}))}})).catch((function(e){return o(e)}))}))},e}();t.default=f},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},function(e,t,n){"use strict";n.r(t),n.d(t,"v1",(function(){return y})),n.d(t,"v3",(function(){return P})),n.d(t,"v4",(function(){return C})),n.d(t,"v5",(function(){return w}));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("")},p=0,l=0;var y=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 y=e.random||(e.rng||a)();null==i&&(i=c=[1|y[0],y[1],y[2],y[3],y[4],y[5]]),null==s&&(s=d=16383&(y[6]<<8|y[7]))}var f=void 0!==e.msecs?e.msecs:(new Date).getTime(),m=void 0!==e.nsecs?e.nsecs:l+1,h=f-p+(m-l)/1e4;if(h<0&&void 0===e.clockseq&&(s=s+1&16383),(h<0||f>p)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");p=f,l=m,d=s;var _=(1e4*(268435455&(f+=122192928e5))+m)%4294967296;o[r++]=_>>>24&255,o[r++]=_>>>16&255,o[r++]=_>>>8&255,o[r++]=255&_;var v=f/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 g=0;g<6;++g)o[r+g]=i[g];return t||u(o)};var f=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 g(e,t,n,r,o,a,i){return h(t^n^r,e,t,o,a,i)}function b(e,t,n,r,o,a,i){return h(n^(t|~r),e,t,o,a,i)}var P=f("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=g(s,c,d,u,e[n+5],4,-378558),u=g(u,s,c,d,e[n+8],11,-2022574463),d=g(d,u,s,c,e[n+11],16,1839030562),c=g(c,d,u,s,e[n+14],23,-35309556),s=g(s,c,d,u,e[n+1],4,-1530992060),u=g(u,s,c,d,e[n+4],11,1272893353),d=g(d,u,s,c,e[n+7],16,-155497632),c=g(c,d,u,s,e[n+10],23,-1094730640),s=g(s,c,d,u,e[n+13],4,681279174),u=g(u,s,c,d,e[n],11,-358537222),d=g(d,u,s,c,e[n+3],16,-722521979),c=g(c,d,u,s,e[n+6],23,76029189),s=g(s,c,d,u,e[n+9],4,-640364487),u=g(u,s,c,d,e[n+12],11,-421815835),d=g(d,u,s,c,e[n+15],16,530742520),c=g(c,d,u,s,e[n+2],23,-995338651),s=b(s,c,d,u,e[n],6,-198630844),u=b(u,s,c,d,e[n+7],10,1126891415),d=b(d,u,s,c,e[n+14],15,-1416354905),c=b(c,d,u,s,e[n+5],21,-57434055),s=b(s,c,d,u,e[n+12],6,1700485571),u=b(u,s,c,d,e[n+3],10,-1894986606),d=b(d,u,s,c,e[n+10],15,-1051523),c=b(c,d,u,s,e[n+1],21,-2054922799),s=b(s,c,d,u,e[n+8],6,1873313359),u=b(u,s,c,d,e[n+15],10,-30611744),d=b(d,u,s,c,e[n+6],15,-1560198380),c=b(c,d,u,s,e[n+13],21,1309151649),s=b(s,c,d,u,e[n+4],6,-145523070),u=b(u,s,c,d,e[n+11],10,-1120210379),d=b(d,u,s,c,e[n+2],15,718787259),c=b(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 S(e,t){return e<<t|e>>>32-t}var w=f("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]=S(d[u-3]^d[u-8]^d[u-14]^d[u-16],1);var p=n[0],l=n[1],y=n[2],f=n[3],m=n[4];for(u=0;u<80;u++){var h=Math.floor(u/20),_=S(p,5)+A(h,l,y,f)+m+t[h]+d[u]>>>0;m=f,f=y,y=S(l,30)>>>0,l=p,p=_}n[0]=n[0]+p>>>0,n[1]=n[1]+l>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+f>>>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]]}))}])}));
|