-
Notifications
You must be signed in to change notification settings - Fork 101
/
constants.ts
42 lines (37 loc) · 1.73 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*********************************************
* Common reference to the script identifier *
*********************************************/
export const SCRIPT_ID = "data-react-paypal-script-id";
export const SDK_SETTINGS = {
DATA_CLIENT_TOKEN: "data-client-token",
DATA_USER_ID_TOKEN: "data-user-id-token",
DATA_SDK_INTEGRATION_SOURCE: "data-sdk-integration-source",
DATA_SDK_INTEGRATION_SOURCE_VALUE: "react-paypal-js",
DATA_NAMESPACE: "data-namespace",
};
export const LOAD_SCRIPT_ERROR = "Failed to load the PayPal JS SDK script.";
/****************************
* Braintree error messages *
****************************/
export const EMPTY_BRAINTREE_AUTHORIZATION_ERROR_MESSAGE =
"Invalid authorization data. Use data-client-token or data-user-id-token to authorize.";
const braintreeVersion = "3.84.0";
export const BRAINTREE_SOURCE = `https://js.braintreegateway.com/web/${braintreeVersion}/js/client.min.js`;
export const BRAINTREE_PAYPAL_CHECKOUT_SOURCE = `https://js.braintreegateway.com/web/${braintreeVersion}/js/paypal-checkout.min.js`;
/*********************
* PayPal namespaces *
*********************/
export const DEFAULT_PAYPAL_NAMESPACE = "paypal";
export const DEFAULT_BRAINTREE_NAMESPACE = "braintree";
/*****************
* Hosted Fields *
*****************/
export const HOSTED_FIELDS_CHILDREN_ERROR =
"To use HostedFields you must use it with at least 3 children with types: [number, cvv, expirationDate] includes";
export const HOSTED_FIELDS_DUPLICATE_CHILDREN_ERROR =
"Cannot use duplicate HostedFields as children";
/*******************
* Script Provider *
*******************/
export const SCRIPT_PROVIDER_REDUCER_ERROR =
"usePayPalScriptReducer must be used within a PayPalScriptProvider";