@idonatedev/idonate-sdk 1.0.7 → 1.0.8-dev
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 +3 -0
- package/dist/apple-pay.js +3 -3
- package/dist/config-handler.js +4 -4
- package/dist/google-pay.js +1 -1
- package/dist/idonate-client.js +7 -7
- package/dist/index.js +6 -2
- package/dist/shared.js +4 -4
- package/dist/tokenize/cardconnect.js +2 -2
- package/dist/tokenize/iats.js +1 -1
- package/dist/typeAdapters.d.ts +2 -2
- package/dist/typeAdapters.js +4 -7
- package/dist/types.d.ts +37 -36
- package/dist/types.js +3 -1
- package/dist/util.d.ts +2 -2
- package/dist/util.js +1 -1
- package/package.json +2 -2
- package/umd/idonate-sdk.js +1 -0
package/README.md
CHANGED
|
@@ -4,6 +4,9 @@ Javascript libraries for integrating with iDonate services.
|
|
|
4
4
|
A rough usage example can be found below the Changelog.
|
|
5
5
|
|
|
6
6
|
# Changes
|
|
7
|
+
## 1.0.7
|
|
8
|
+
* Add new optional transaction property `show_name_to_fundraiser` for allowing fundraiser to see the name of the anonymous donor in certain scenarios.
|
|
9
|
+
|
|
7
10
|
## 1.0.3
|
|
8
11
|
* Configure `apple_pay_url` from environment and sandbox configuration, fixing Apple Pay sandbox issues introduced
|
|
9
12
|
in 1.0.1
|
package/dist/apple-pay.js
CHANGED
|
@@ -38,7 +38,7 @@ var ApplePay = (function () {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
ApplePay.prototype.createSession = function (payload, embedApiBaseUrl) {
|
|
41
|
-
return fetch(embedApiBaseUrl
|
|
41
|
+
return fetch("".concat(embedApiBaseUrl, "/payment/create-session"), {
|
|
42
42
|
method: 'POST',
|
|
43
43
|
headers: constants_1.CLIENT_HEADERS,
|
|
44
44
|
body: JSON.stringify(payload),
|
|
@@ -52,8 +52,8 @@ var ApplePay = (function () {
|
|
|
52
52
|
var eckey = paymentData.header.ephemeralPublicKey;
|
|
53
53
|
var ectid = paymentData.header.transactionId;
|
|
54
54
|
var ecpublickeyhash = paymentData.header.publicKeyHash;
|
|
55
|
-
var dataString = token
|
|
56
|
-
return fetch(cardConnectBaseUrl
|
|
55
|
+
var dataString = "".concat(token, "&ectype=").concat(ectype, "&ecsig=").concat(ecsig, "&eckey=").concat(eckey, "&ectid=").concat(ectid, "&echash=&ecpublickeyhash=").concat(ecpublickeyhash);
|
|
56
|
+
return fetch("".concat(cardConnectBaseUrl, "/cardsecure/api/v1/ccn/tokenize"), {
|
|
57
57
|
method: 'POST',
|
|
58
58
|
headers: {
|
|
59
59
|
'Content-Type': 'application/json',
|
package/dist/config-handler.js
CHANGED
|
@@ -17,18 +17,18 @@ var ConfigHandler = (function () {
|
|
|
17
17
|
this.apiBaseUrl = options.overrideBaseUrl;
|
|
18
18
|
}
|
|
19
19
|
this.authApiBaseUrl =
|
|
20
|
-
options.overrideAuthApiBaseUrl || this.apiBaseUrl
|
|
20
|
+
options.overrideAuthApiBaseUrl || "".concat(this.apiBaseUrl, "/auth");
|
|
21
21
|
this.donorApiBaseUrl =
|
|
22
|
-
options.overrideDonorApiBaseUrl || this.apiBaseUrl
|
|
22
|
+
options.overrideDonorApiBaseUrl || "".concat(this.apiBaseUrl, "/donor");
|
|
23
23
|
this.embedApiBaseUrl =
|
|
24
|
-
options.overrideEmbedApiBaseUrl || this.apiBaseUrl
|
|
24
|
+
options.overrideEmbedApiBaseUrl || "".concat(this.apiBaseUrl, "/embed");
|
|
25
25
|
if (options.overrideApplePayUrl) {
|
|
26
26
|
this.applePayUrl = options.overrideApplePayUrl;
|
|
27
27
|
}
|
|
28
28
|
if (options === null || options === void 0 ? void 0 : options.spreedlyEnvironmentKey) {
|
|
29
29
|
this.spreedlyEnvironmentKey = options.spreedlyEnvironmentKey;
|
|
30
30
|
}
|
|
31
|
-
this.cardConnectTokenizerUrl = this.cardConnectBaseUrl
|
|
31
|
+
this.cardConnectTokenizerUrl = "".concat(this.cardConnectBaseUrl, "/itoke/ajax-tokenizer.html");
|
|
32
32
|
}
|
|
33
33
|
return ConfigHandler;
|
|
34
34
|
}());
|
package/dist/google-pay.js
CHANGED
|
@@ -138,7 +138,7 @@ var GooglePay = (function () {
|
|
|
138
138
|
});
|
|
139
139
|
};
|
|
140
140
|
GooglePay.prototype.tokenizeWithCardConnect = function (paymentToken, cardConnectBaseUrl) {
|
|
141
|
-
return fetch(cardConnectBaseUrl
|
|
141
|
+
return fetch("".concat(cardConnectBaseUrl, "/cardsecure/api/v1/ccn/tokenize"), {
|
|
142
142
|
method: 'POST',
|
|
143
143
|
headers: {
|
|
144
144
|
'Content-Type': 'application/json',
|
package/dist/idonate-client.js
CHANGED
|
@@ -42,14 +42,14 @@ var iDonateClient = (function () {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
iDonateClient.prototype.createDonation = function (donation) {
|
|
45
|
-
var payload = typeAdapters_1.buildCashPaymentPayload(this.organizationId, donation);
|
|
46
|
-
return fetch(this.embedApiBaseUrl
|
|
45
|
+
var payload = (0, typeAdapters_1.buildCashPaymentPayload)(this.organizationId, donation);
|
|
46
|
+
return fetch("".concat(this.embedApiBaseUrl, "/donate/cash-payment"), {
|
|
47
47
|
method: 'POST',
|
|
48
48
|
headers: constants_1.CLIENT_HEADERS,
|
|
49
49
|
body: JSON.stringify(payload),
|
|
50
50
|
})
|
|
51
|
-
.then(function (response) { return util_1.parseResponse(response, { throwErrors: true }); })
|
|
52
|
-
.then(function (response) { return typeAdapters_1.buildDonationResult(response); });
|
|
51
|
+
.then(function (response) { return (0, util_1.parseResponse)(response, { throwErrors: true }); })
|
|
52
|
+
.then(function (response) { return (0, typeAdapters_1.buildDonationResult)(response); });
|
|
53
53
|
};
|
|
54
54
|
iDonateClient.prototype.createTransaction = function (donation) {
|
|
55
55
|
return this.createDonation(donation).then(function (result) {
|
|
@@ -103,7 +103,7 @@ var iDonateClient = (function () {
|
|
|
103
103
|
var paramString = new URLSearchParams(resolvedOptions)
|
|
104
104
|
.toString()
|
|
105
105
|
.replace('+', '%20');
|
|
106
|
-
return this.cardConnectTokenizerUrl
|
|
106
|
+
return "".concat(this.cardConnectTokenizerUrl, "?").concat(paramString);
|
|
107
107
|
};
|
|
108
108
|
iDonateClient.prototype.waitForDonationResult = function (donationId) {
|
|
109
109
|
var _this = this;
|
|
@@ -114,7 +114,7 @@ var iDonateClient = (function () {
|
|
|
114
114
|
setTimeout(function () {
|
|
115
115
|
var pollHandle;
|
|
116
116
|
pollHandle = setInterval(function () {
|
|
117
|
-
fetch(_this.embedApiBaseUrl
|
|
117
|
+
fetch("".concat(_this.embedApiBaseUrl, "/donate/cash-payment/").concat(donationId, "/payment_status"), {
|
|
118
118
|
method: 'GET',
|
|
119
119
|
headers: {
|
|
120
120
|
'Content-Type': 'application/json',
|
|
@@ -131,7 +131,7 @@ var iDonateClient = (function () {
|
|
|
131
131
|
if (response.error) {
|
|
132
132
|
reject(new types_1.ClientError(response.error));
|
|
133
133
|
}
|
|
134
|
-
resolve(typeAdapters_1.buildDonationResult({
|
|
134
|
+
resolve((0, typeAdapters_1.buildDonationResult)({
|
|
135
135
|
_raw_response: __assign({ campaign: null, designation: {}, donor: {}, form_data: {}, id: null, schedule: {}, transaction: {} }, response),
|
|
136
136
|
}));
|
|
137
137
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
8
12
|
}));
|
|
9
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
17
|
exports.GooglePay = exports.ApplePay = exports.constants = exports.recaptcha = exports.ConfigHandler = exports.Client = exports.shared = exports.util = exports.tokenize = void 0;
|
package/dist/shared.js
CHANGED
|
@@ -5,13 +5,13 @@ var typeAdapters_1 = require("./typeAdapters");
|
|
|
5
5
|
var constants_1 = require("./constants");
|
|
6
6
|
var util_1 = require("./util");
|
|
7
7
|
function createPaymentMethod(paymentMethod, config) {
|
|
8
|
-
var payload = typeAdapters_1.buildCreatePaymentMethodPayload(paymentMethod);
|
|
9
|
-
return fetch(config.embedApiBaseUrl
|
|
8
|
+
var payload = (0, typeAdapters_1.buildCreatePaymentMethodPayload)(paymentMethod);
|
|
9
|
+
return fetch("".concat(config.embedApiBaseUrl, "/payment/payment-methods"), {
|
|
10
10
|
method: 'POST',
|
|
11
11
|
headers: constants_1.CLIENT_HEADERS,
|
|
12
12
|
body: JSON.stringify(payload),
|
|
13
13
|
})
|
|
14
|
-
.then(function (response) { return util_1.parseResponse(response, { throwErrors: true }); })
|
|
15
|
-
.then(function (response) { return typeAdapters_1.buildCreatePaymentMethodResult(response); });
|
|
14
|
+
.then(function (response) { return (0, util_1.parseResponse)(response, { throwErrors: true }); })
|
|
15
|
+
.then(function (response) { return (0, typeAdapters_1.buildCreatePaymentMethodResult)(response); });
|
|
16
16
|
}
|
|
17
17
|
exports.createPaymentMethod = createPaymentMethod;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tokenizeBankAccount = void 0;
|
|
4
4
|
function tokenizeBankAccount(routingNumber, accountNumber, config) {
|
|
5
|
-
return fetch(config.cardConnectBaseUrl
|
|
5
|
+
return fetch("".concat(config.cardConnectBaseUrl, "/cardsecure/api/v1/ccn/tokenize"), {
|
|
6
6
|
method: 'POST',
|
|
7
7
|
headers: {
|
|
8
8
|
'Content-Type': 'application/json',
|
|
9
9
|
},
|
|
10
10
|
body: JSON.stringify({
|
|
11
|
-
account: routingNumber
|
|
11
|
+
account: "".concat(routingNumber, "/").concat(accountNumber),
|
|
12
12
|
unique: true,
|
|
13
13
|
}),
|
|
14
14
|
}).then(function (response) { return response.json(); });
|
package/dist/tokenize/iats.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.tokenizePaymentCard = exports.tokenizePaymentBankUs = exports.tokenizePaymentBankCanada = void 0;
|
|
4
4
|
var uuid_1 = require("uuid");
|
|
5
5
|
function tokenizePaymentBankCanada(bankNumber, transitNumber, accountNumber, accountType, processId, relayUrl, gatewayId, contact, address) {
|
|
6
|
-
var newPaymentId = uuid_1.v4();
|
|
6
|
+
var newPaymentId = (0, uuid_1.v4)();
|
|
7
7
|
var streetAddress = address.address1;
|
|
8
8
|
if (address.address2) {
|
|
9
9
|
streetAddress += '\n' + address.address2;
|
package/dist/typeAdapters.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare function buildCashPaymentPayload(organizationId: string, input: C
|
|
|
3
3
|
export declare function buildDonationResult(response: ClientResponse): CreateDonationResult;
|
|
4
4
|
export declare function buildCreatePaymentMethodPayload(input: CreatePaymentMethodRequest): {
|
|
5
5
|
gateway_id: string | undefined;
|
|
6
|
-
backend_name: "
|
|
6
|
+
backend_name: import("./types").BackendName | undefined;
|
|
7
7
|
payment_method_type: import("./types").PaymentMethodType;
|
|
8
8
|
payment_method_token: string;
|
|
9
9
|
donor_id: string | undefined;
|
|
@@ -23,6 +23,6 @@ export declare function buildCreatePaymentMethodPayload(input: CreatePaymentMeth
|
|
|
23
23
|
};
|
|
24
24
|
export declare function collapseClientErrors(errors: ClientError[]): ClientError;
|
|
25
25
|
export declare function buildCreatePaymentMethodResult(response: ClientResponse): CreatePaymentMethodResult;
|
|
26
|
-
export
|
|
26
|
+
export type SpreedlyResponse = any;
|
|
27
27
|
export declare function unpackSpreedlyResponse(response: any): Promise<SpreedlyResponse>;
|
|
28
28
|
export declare function extractSpreedlyToken(spreedlyData: SpreedlyResponse): string;
|
package/dist/typeAdapters.js
CHANGED
|
@@ -50,6 +50,7 @@ function buildCashPaymentPayload(organizationId, input) {
|
|
|
50
50
|
double_the_donation_company_id: input.corporateMatchingId,
|
|
51
51
|
donor_id: input.donorId,
|
|
52
52
|
hide_name: input.anonymousOptIn,
|
|
53
|
+
show_name_to_fundraiser: input.showNameToFundraiserOptIn,
|
|
53
54
|
email_opt_in: input.emailOptIn,
|
|
54
55
|
donor_paid_fee: input.donorPaidFeeAmount,
|
|
55
56
|
designation_note: input.designationNote,
|
|
@@ -81,7 +82,7 @@ function buildCashPaymentPayload(organizationId, input) {
|
|
|
81
82
|
tribute_skipped: (_q = input.tribute) === null || _q === void 0 ? void 0 : _q.tributeSkipped,
|
|
82
83
|
useOnBillingAddress: (_r = input.tribute) === null || _r === void 0 ? void 0 : _r.useOnBillingAddress,
|
|
83
84
|
embed_referer: window.location.href,
|
|
84
|
-
converted_to_recurring: input.convertedToRecurring
|
|
85
|
+
converted_to_recurring: input.convertedToRecurring,
|
|
85
86
|
};
|
|
86
87
|
if (input.designations) {
|
|
87
88
|
donationOptions.designations = input.designations;
|
|
@@ -116,7 +117,7 @@ function buildCashPaymentPayload(organizationId, input) {
|
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
[1, 2, 3, 4, 5].forEach(function (customNoteIndex) {
|
|
119
|
-
var key = "custom_note_"
|
|
120
|
+
var key = "custom_note_".concat(customNoteIndex);
|
|
120
121
|
if (input.customerMeta[key]) {
|
|
121
122
|
donationOptions[key] = input.customerMeta[key];
|
|
122
123
|
delete input.customerMeta[key];
|
|
@@ -146,11 +147,7 @@ function buildDonationResult(response) {
|
|
|
146
147
|
if (response._raw_response.campaign) {
|
|
147
148
|
campaign = response._raw_response.campaign;
|
|
148
149
|
}
|
|
149
|
-
return __assign(__assign({}, response), { campaign: campaign,
|
|
150
|
-
designation: designation,
|
|
151
|
-
donor: donor,
|
|
152
|
-
schedule: schedule,
|
|
153
|
-
transaction: transaction });
|
|
150
|
+
return __assign(__assign({}, response), { campaign: campaign, designation: designation, donor: donor, schedule: schedule, transaction: transaction });
|
|
154
151
|
}
|
|
155
152
|
exports.buildDonationResult = buildDonationResult;
|
|
156
153
|
function buildCreatePaymentMethodPayload(input) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="applepayjs" />
|
|
2
2
|
/// <reference types="googlepay" />
|
|
3
|
-
export
|
|
3
|
+
export type ClientOptions = {
|
|
4
4
|
enableSandboxMode?: boolean;
|
|
5
5
|
spreedlyEnvironmentKey?: string;
|
|
6
6
|
overrideBaseUrl?: string;
|
|
@@ -10,7 +10,7 @@ export declare type ClientOptions = {
|
|
|
10
10
|
overrideCardConnectBaseUrl?: string;
|
|
11
11
|
overrideApplePayUrl?: string;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type Address = {
|
|
14
14
|
address1: string;
|
|
15
15
|
address2?: string;
|
|
16
16
|
country: string;
|
|
@@ -18,7 +18,7 @@ export declare type Address = {
|
|
|
18
18
|
state: string;
|
|
19
19
|
zip: string;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type Contact = {
|
|
22
22
|
salutation: string;
|
|
23
23
|
firstName: string;
|
|
24
24
|
middleName?: string;
|
|
@@ -27,33 +27,33 @@ export declare type Contact = {
|
|
|
27
27
|
email: string;
|
|
28
28
|
primaryPhone: string;
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export type CreditCard = {
|
|
31
31
|
cardNumber: string;
|
|
32
32
|
verificationValue?: string;
|
|
33
33
|
expirationMonth: string;
|
|
34
34
|
expirationYear: string;
|
|
35
35
|
};
|
|
36
|
-
export
|
|
36
|
+
export type ACHAccount = {
|
|
37
37
|
accountNumber: string;
|
|
38
38
|
routingNumber: string;
|
|
39
39
|
accountHolderType: 'personal' | 'business';
|
|
40
40
|
accountType: 'checking' | 'savings';
|
|
41
41
|
};
|
|
42
|
-
export
|
|
43
|
-
export
|
|
44
|
-
export
|
|
42
|
+
export type PaymentMethodType = 'credit_card' | 'bank_account' | 'paypal' | 'apple_pay' | 'google_pay';
|
|
43
|
+
export type RecaptchaType = 'v2' | 'v3' | 'invisible' | 'organization' | 'nonce';
|
|
44
|
+
export type RecaptchaSecuredRequest = {
|
|
45
45
|
recaptchaType: RecaptchaType;
|
|
46
46
|
recaptchaToken: string;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
49
|
-
export
|
|
48
|
+
export type RecurringFrequency = 'once' | 'weekly' | 'twicemonthly' | 'biweekly' | 'monthly' | 'quarterly' | 'semiannually' | 'annually';
|
|
49
|
+
export type UTMData = {
|
|
50
50
|
campaign?: string;
|
|
51
51
|
content?: string;
|
|
52
52
|
medium?: string;
|
|
53
53
|
source?: string;
|
|
54
54
|
term?: string;
|
|
55
55
|
};
|
|
56
|
-
export
|
|
56
|
+
export type TributeData = {
|
|
57
57
|
tributeDefinitionId: string;
|
|
58
58
|
tributeFirstName: string;
|
|
59
59
|
tributeLastName: string;
|
|
@@ -75,7 +75,7 @@ export declare type TributeData = {
|
|
|
75
75
|
tributeSkipped: boolean;
|
|
76
76
|
useOnBillingAddress: boolean;
|
|
77
77
|
};
|
|
78
|
-
export
|
|
78
|
+
export type CreateDonationRequest = RecaptchaSecuredRequest & {
|
|
79
79
|
paymentGatewayId: string;
|
|
80
80
|
donorId?: string;
|
|
81
81
|
paymentMethodId: string;
|
|
@@ -112,13 +112,14 @@ export declare type CreateDonationRequest = RecaptchaSecuredRequest & {
|
|
|
112
112
|
donorPaidFeeAmount?: number;
|
|
113
113
|
emailOptIn?: boolean;
|
|
114
114
|
anonymousOptIn?: boolean;
|
|
115
|
+
showNameToFundraiserOptIn?: boolean;
|
|
115
116
|
giftId?: string;
|
|
116
117
|
giftExtra?: string;
|
|
117
118
|
giftSkipped?: boolean;
|
|
118
119
|
embedId?: string;
|
|
119
120
|
convertedToRecurring?: boolean | undefined;
|
|
120
121
|
};
|
|
121
|
-
export
|
|
122
|
+
export type ClientErrorDetails = {
|
|
122
123
|
field?: string;
|
|
123
124
|
code?: string;
|
|
124
125
|
suggestion?: string;
|
|
@@ -129,18 +130,18 @@ export declare class ClientError extends Error {
|
|
|
129
130
|
details?: ClientErrorDetails | undefined;
|
|
130
131
|
constructor(message: string, details?: ClientErrorDetails | undefined);
|
|
131
132
|
}
|
|
132
|
-
export
|
|
133
|
+
export type ClientResponse = {
|
|
133
134
|
errors: ClientError[];
|
|
134
135
|
_raw_response?: any;
|
|
135
136
|
};
|
|
136
|
-
export
|
|
137
|
+
export type CreateDonationResult = ClientResponse & {
|
|
137
138
|
transaction?: Transaction;
|
|
138
139
|
schedule?: Schedule;
|
|
139
140
|
donor?: Donor;
|
|
140
141
|
designation?: Designation;
|
|
141
142
|
campaign?: Campaign;
|
|
142
143
|
};
|
|
143
|
-
export
|
|
144
|
+
export type CreatePaymentMethodRequest = RecaptchaSecuredRequest & {
|
|
144
145
|
paymentMethodType: PaymentMethodType;
|
|
145
146
|
paymentMethodToken: string;
|
|
146
147
|
donorId?: string;
|
|
@@ -149,17 +150,17 @@ export declare type CreatePaymentMethodRequest = RecaptchaSecuredRequest & {
|
|
|
149
150
|
contact: Contact;
|
|
150
151
|
address: Address;
|
|
151
152
|
};
|
|
152
|
-
export
|
|
153
|
+
export type CreatePaymentMethodResult = ClientResponse & {
|
|
153
154
|
paymentMethodId: string;
|
|
154
155
|
};
|
|
155
|
-
export
|
|
156
|
+
export type Campaign = {
|
|
156
157
|
title: string;
|
|
157
158
|
};
|
|
158
|
-
export
|
|
159
|
+
export type Designation = {
|
|
159
160
|
id: string;
|
|
160
161
|
title: string;
|
|
161
162
|
};
|
|
162
|
-
export
|
|
163
|
+
export type Donor = {
|
|
163
164
|
id: string;
|
|
164
165
|
created: string;
|
|
165
166
|
contact: {
|
|
@@ -168,56 +169,56 @@ export declare type Donor = {
|
|
|
168
169
|
title: string;
|
|
169
170
|
};
|
|
170
171
|
};
|
|
171
|
-
export
|
|
172
|
+
export type TokenizeCardConnectResult = {
|
|
172
173
|
token: string;
|
|
173
174
|
message: string;
|
|
174
175
|
errorcode: number;
|
|
175
176
|
};
|
|
176
|
-
export
|
|
177
|
-
export
|
|
177
|
+
export type BackendName = 'spreedly' | 'card_connect' | 'iats';
|
|
178
|
+
export type PaymentGateway = {
|
|
178
179
|
id: string;
|
|
179
180
|
backendName: BackendName;
|
|
180
181
|
};
|
|
181
|
-
export
|
|
182
|
+
export type PaymentMethod = {
|
|
182
183
|
id: string;
|
|
183
184
|
type: PaymentMethodType;
|
|
184
185
|
};
|
|
185
|
-
export
|
|
186
|
+
export type Schedule = {
|
|
186
187
|
id: string;
|
|
187
188
|
recurringFrequency: RecurringFrequency;
|
|
188
189
|
};
|
|
189
|
-
export
|
|
190
|
+
export type Transaction = {
|
|
190
191
|
id: string;
|
|
191
192
|
};
|
|
192
|
-
export
|
|
193
|
+
export type Donation = {
|
|
193
194
|
id: string;
|
|
194
195
|
transaction?: Transaction;
|
|
195
196
|
schedule?: Schedule;
|
|
196
197
|
};
|
|
197
|
-
export
|
|
198
|
-
export
|
|
199
|
-
export
|
|
200
|
-
export
|
|
198
|
+
export type TokenizeCardConnectBankAccountResult = TokenizeCardConnectResult;
|
|
199
|
+
export type TokenizeCardConnectApplePayResult = TokenizeCardConnectResult;
|
|
200
|
+
export type TokenizeCardConnectGooglePayResult = TokenizeCardConnectResult;
|
|
201
|
+
export type ApplePayContact = ApplePayJS.ApplePayPaymentContact & {
|
|
201
202
|
email?: string;
|
|
202
203
|
phone?: string;
|
|
203
204
|
};
|
|
204
|
-
export
|
|
205
|
+
export type TokenizeApplePayResult = {
|
|
205
206
|
applePaySession: ApplePaySession;
|
|
206
207
|
cardConnectResponse: TokenizeCardConnectApplePayResult;
|
|
207
208
|
billingContact?: ApplePayContact;
|
|
208
209
|
merchantSessionId?: string;
|
|
209
210
|
};
|
|
210
|
-
export
|
|
211
|
-
export
|
|
211
|
+
export type MerchantSession = any;
|
|
212
|
+
export type ApplePayMerchantValidationPayload = {
|
|
212
213
|
apple_pay_url: string;
|
|
213
214
|
organization_id: string;
|
|
214
215
|
};
|
|
215
|
-
export
|
|
216
|
+
export type GooglePayConfig = {
|
|
216
217
|
paymentDataRequest: Partial<google.payments.api.PaymentDataRequest>;
|
|
217
218
|
paymentOptions: google.payments.api.PaymentOptions;
|
|
218
219
|
cardConnectMerchantId: string;
|
|
219
220
|
};
|
|
220
|
-
export
|
|
221
|
+
export type GooglePayBaseCardPaymentMethodType = {
|
|
221
222
|
type: google.payments.api.PaymentMethodType;
|
|
222
223
|
parameters: google.payments.api.CardParameters;
|
|
223
224
|
};
|
package/dist/types.js
CHANGED
|
@@ -3,10 +3,12 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
3
3
|
var extendStatics = function (d, b) {
|
|
4
4
|
extendStatics = Object.setPrototypeOf ||
|
|
5
5
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
7
|
return extendStatics(d, b);
|
|
8
8
|
};
|
|
9
9
|
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
10
12
|
extendStatics(d, b);
|
|
11
13
|
function __() { this.constructor = d; }
|
|
12
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
package/dist/util.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ClientResponse } from './types';
|
|
2
2
|
export declare function receiveEmbedData(): Promise<any>;
|
|
3
3
|
export declare function sanitizeString(value: string): string;
|
|
4
|
-
|
|
4
|
+
type SanitizeableObject = {
|
|
5
5
|
[key: string]: SanitizeableObject;
|
|
6
6
|
} | string | boolean | number | SanitizeableObject[];
|
|
7
7
|
export declare function sanitizeArray(array: SanitizeableObject[]): SanitizeableObject[];
|
|
8
8
|
export declare function sanitizeObject(object: SanitizeableObject): SanitizeableObject;
|
|
9
|
-
|
|
9
|
+
type Name = {
|
|
10
10
|
firstName: string;
|
|
11
11
|
lastName: string;
|
|
12
12
|
};
|
package/dist/util.js
CHANGED
|
@@ -113,7 +113,7 @@ function parseResponse(response, opts) {
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
if (opts && opts.throwErrors && errors.length) {
|
|
116
|
-
throw typeAdapters_1.collapseClientErrors(errors);
|
|
116
|
+
throw (0, typeAdapters_1.collapseClientErrors)(errors);
|
|
117
117
|
}
|
|
118
118
|
return {
|
|
119
119
|
errors: errors,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idonatedev/idonate-sdk",
|
|
3
3
|
"author": "iDonate",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.8-dev",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "iDonate Web SDK",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"prettier": "^2.0.5",
|
|
25
25
|
"ts-node": "^8.9.1",
|
|
26
26
|
"tslint": "^6.1.2",
|
|
27
|
-
"typescript": "^
|
|
27
|
+
"typescript": "^4.4.3",
|
|
28
28
|
"webpack": "^4.43.0",
|
|
29
29
|
"webpack-cli": "^3.3.12"
|
|
30
30
|
},
|
|
@@ -0,0 +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.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,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===(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_".concat(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)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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(0,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("".concat(n.cardConnectBaseUrl,"/cardsecure/api/v1/ccn/tokenize"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({account:"".concat(e,"/").concat(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=(0,r.buildCreatePaymentMethodPayload)(e);return fetch("".concat(t.embedApiBaseUrl,"/payment/payment-methods"),{method:"POST",headers:o.CLIENT_HEADERS,body:JSON.stringify(n)}).then((function(e){return(0,a.parseResponse)(e,{throwErrors:!0})})).then((function(e){return(0,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("".concat(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,o=n.signature,a=n.header.ephemeralPublicKey,i=n.header.transactionId,s=n.header.publicKeyHash,c="".concat(r,"&ectype=").concat("apple","&ecsig=").concat(o,"&eckey=").concat(a,"&ectid=").concat(i,"&echash=&ecpublickeyhash=").concat(s);return fetch("".concat(t,"/cardsecure/api/v1/ccn/tokenize"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({encryptionhandler:"EC_APPLE_PAY",devicedata:c,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||"".concat(this.apiBaseUrl,"/auth"),this.donorApiBaseUrl=e.overrideDonorApiBaseUrl||"".concat(this.apiBaseUrl,"/donor"),this.embedApiBaseUrl=e.overrideEmbedApiBaseUrl||"".concat(this.apiBaseUrl,"/embed"),e.overrideApplePayUrl&&(this.applePayUrl=e.overrideApplePayUrl),(null==e?void 0:e.spreedlyEnvironmentKey)&&(this.spreedlyEnvironmentKey=e.spreedlyEnvironmentKey),this.cardConnectTokenizerUrl="".concat(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);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}: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||Object.prototype.hasOwnProperty.call(t,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=(0,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=(0,a.buildCashPaymentPayload)(this.organizationId,e);return fetch("".concat(this.embedApiBaseUrl,"/donate/cash-payment"),{method:"POST",headers:i.CLIENT_HEADERS,body:JSON.stringify(t)}).then((function(e){return(0,s.parseResponse)(e,{throwErrors:!0})})).then((function(e){return(0,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"".concat(this.cardConnectTokenizerUrl,"?").concat(o)},e.prototype.waitForDonationResult=function(e){var t=this;return new Promise((function(n,i){setTimeout((function(){var s;s=setInterval((function(){fetch("".concat(t.embedApiBaseUrl,"/donate/cash-payment/").concat(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((0,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("".concat(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 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("")},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 w(e,t){return e<<t|e>>>32-t}var S=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]=w(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),_=w(p,5)+A(h,l,y,f)+m+t[h]+d[u]>>>0;m=f,f=y,y=w(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]]}))}])}));
|