@tap-payments/apple-pay-button 0.0.90-development → 0.0.92-development
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/LICENSE +21 -21
- package/README.md +240 -240
- package/build/@types/ApplePayButtonProps.d.ts +56 -56
- package/build/@types/ApplePayButtonProps.js +1 -1
- package/build/@types/charge.d.ts +56 -56
- package/build/@types/charge.js +1 -1
- package/build/@types/checkoutProfile.d.ts +216 -216
- package/build/@types/checkoutProfile.js +1 -1
- package/build/@types/enums.d.ts +44 -45
- package/build/@types/enums.js +51 -52
- package/build/@types/index.d.ts +6 -6
- package/build/@types/index.js +6 -6
- package/build/@types/tapLocalisation.d.ts +193 -193
- package/build/@types/tapLocalisation.js +1 -1
- package/build/@types/tapTheme.d.ts +842 -842
- package/build/@types/tapTheme.js +1 -1
- package/build/api.d.ts +31 -31
- package/build/api.js +236 -236
- package/build/constants/index.d.ts +3 -3
- package/build/constants/index.js +3 -3
- package/build/features/ApplePayButton/ApplePayButton.d.ts +4 -4
- package/build/features/ApplePayButton/ApplePayButton.js +48 -48
- package/build/features/ApplePayButton/index.d.ts +3 -3
- package/build/features/ApplePayButton/index.js +2 -2
- package/build/hooks/index.d.ts +1 -1
- package/build/hooks/index.js +1 -1
- package/build/hooks/useApplePay.d.ts +81 -81
- package/build/hooks/useApplePay.js +424 -425
- package/build/hooks/useMerchantApplePay.d.ts +22 -22
- package/build/hooks/useMerchantApplePay.js +190 -190
- package/build/index.d.ts +5 -5
- package/build/index.js +14 -14
- package/build/utils/config.d.ts +14 -14
- package/build/utils/config.js +59 -57
- package/build/utils/defaultValues.d.ts +2 -2
- package/build/utils/defaultValues.js +27 -27
- package/build/utils/index.d.ts +3 -3
- package/build/utils/index.js +3 -3
- package/build/utils/theme.d.ts +13 -13
- package/build/utils/theme.js +62 -62
- package/package.json +109 -109
package/build/utils/config.js
CHANGED
|
@@ -1,57 +1,59 @@
|
|
|
1
|
-
import { getMerchantCapabilities } from './defaultValues';
|
|
2
|
-
import { getPaymentMethod } from '@tap-payments/acceptance-sdk';
|
|
3
|
-
export var PAYMENT_METHOD_KEY = 'apple_pay';
|
|
4
|
-
export var validateSupportedNetworks = function (supportedNetworksOptions, merchantSupportedNetworks) {
|
|
5
|
-
var toLowerCase = function (item) { return item.toLowerCase(); };
|
|
6
|
-
if (!supportedNetworksOptions)
|
|
7
|
-
throw new Error("There is no supported networks available in your acceptance object");
|
|
8
|
-
if (!merchantSupportedNetworks)
|
|
9
|
-
return supportedNetworksOptions.map(toLowerCase);
|
|
10
|
-
if (merchantSupportedNetworks.length === 0)
|
|
11
|
-
return supportedNetworksOptions.map(toLowerCase);
|
|
12
|
-
var supportedNetworks = supportedNetworksOptions.filter(function (item) {
|
|
13
|
-
return merchantSupportedNetworks.find(function (network) { return network.toLowerCase() === item.toLowerCase(); });
|
|
14
|
-
});
|
|
15
|
-
if (supportedNetworks.length === 0) {
|
|
16
|
-
throw new Error("It seems that there is no supported networks available in based on your acceptance object");
|
|
17
|
-
}
|
|
18
|
-
return supportedNetworks.map(toLowerCase);
|
|
19
|
-
};
|
|
20
|
-
export var getApplePayRequest = function (_a) {
|
|
21
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
22
|
-
var order = _a.order, customer = _a.customer, supportedNetworks = _a.supportedNetworks, merchantCapabilities = _a.merchantCapabilities, countryCode = _a.countryCode, name = _a.name;
|
|
23
|
-
return {
|
|
24
|
-
countryCode: countryCode,
|
|
25
|
-
currencyCode: order.currency,
|
|
26
|
-
merchantCapabilities: merchantCapabilities,
|
|
27
|
-
supportedNetworks: supportedNetworks,
|
|
28
|
-
billingContact: customer && {
|
|
29
|
-
phoneNumber: ((_c = (_b = customer.contact) === null || _b === void 0 ? void 0 : _b.phone) === null || _c === void 0 ? void 0 : _c.countryCode) || '' + ((_e = (_d = customer.contact) === null || _d === void 0 ? void 0 : _d.phone) === null || _e === void 0 ? void 0 : _e.number),
|
|
30
|
-
emailAddress: (_f = customer.contact) === null || _f === void 0 ? void 0 : _f.email,
|
|
31
|
-
givenName: ((_g = customer.name) === null || _g === void 0 ? void 0 : _g.length) ? (_h = customer.name[0]) === null || _h === void 0 ? void 0 : _h.first : '',
|
|
32
|
-
familyName: ((_j = customer.name) === null || _j === void 0 ? void 0 : _j.length) ? (_k = customer.name[0]) === null || _k === void 0 ? void 0 : _k.last : ''
|
|
33
|
-
},
|
|
34
|
-
total: {
|
|
35
|
-
amount: Number(
|
|
36
|
-
label: name
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export var prepareApplePayRequest = function (_a) {
|
|
41
|
-
var payment_options = _a.payment_options, merchant = _a.merchant, order = _a.order, customer = _a.customer, acceptance = _a.acceptance;
|
|
42
|
-
var paymentMethod = getPaymentMethod(payment_options.payment_methods || [], PAYMENT_METHOD_KEY);
|
|
43
|
-
var supportedNetworks = validateSupportedNetworks(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.supported_card_brands, acceptance === null || acceptance === void 0 ? void 0 : acceptance.supportedSchemes);
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
import { getMerchantCapabilities } from './defaultValues';
|
|
2
|
+
import { getPaymentMethod, getSelectedCurrency } from '@tap-payments/acceptance-sdk';
|
|
3
|
+
export var PAYMENT_METHOD_KEY = 'apple_pay';
|
|
4
|
+
export var validateSupportedNetworks = function (supportedNetworksOptions, merchantSupportedNetworks) {
|
|
5
|
+
var toLowerCase = function (item) { return item.toLowerCase(); };
|
|
6
|
+
if (!supportedNetworksOptions)
|
|
7
|
+
throw new Error("There is no supported networks available in your acceptance object");
|
|
8
|
+
if (!merchantSupportedNetworks)
|
|
9
|
+
return supportedNetworksOptions.map(toLowerCase);
|
|
10
|
+
if (merchantSupportedNetworks.length === 0)
|
|
11
|
+
return supportedNetworksOptions.map(toLowerCase);
|
|
12
|
+
var supportedNetworks = supportedNetworksOptions.filter(function (item) {
|
|
13
|
+
return merchantSupportedNetworks.find(function (network) { return network.toLowerCase() === item.toLowerCase(); });
|
|
14
|
+
});
|
|
15
|
+
if (supportedNetworks.length === 0) {
|
|
16
|
+
throw new Error("It seems that there is no supported networks available in based on your acceptance object");
|
|
17
|
+
}
|
|
18
|
+
return supportedNetworks.map(toLowerCase);
|
|
19
|
+
};
|
|
20
|
+
export var getApplePayRequest = function (_a) {
|
|
21
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
22
|
+
var order = _a.order, customer = _a.customer, supportedNetworks = _a.supportedNetworks, merchantCapabilities = _a.merchantCapabilities, countryCode = _a.countryCode, name = _a.name;
|
|
23
|
+
return {
|
|
24
|
+
countryCode: countryCode,
|
|
25
|
+
currencyCode: order.currency,
|
|
26
|
+
merchantCapabilities: merchantCapabilities,
|
|
27
|
+
supportedNetworks: supportedNetworks,
|
|
28
|
+
billingContact: customer && {
|
|
29
|
+
phoneNumber: ((_c = (_b = customer.contact) === null || _b === void 0 ? void 0 : _b.phone) === null || _c === void 0 ? void 0 : _c.countryCode) || '' + ((_e = (_d = customer.contact) === null || _d === void 0 ? void 0 : _d.phone) === null || _e === void 0 ? void 0 : _e.number),
|
|
30
|
+
emailAddress: (_f = customer.contact) === null || _f === void 0 ? void 0 : _f.email,
|
|
31
|
+
givenName: ((_g = customer.name) === null || _g === void 0 ? void 0 : _g.length) ? (_h = customer.name[0]) === null || _h === void 0 ? void 0 : _h.first : '',
|
|
32
|
+
familyName: ((_j = customer.name) === null || _j === void 0 ? void 0 : _j.length) ? (_k = customer.name[0]) === null || _k === void 0 ? void 0 : _k.last : ''
|
|
33
|
+
},
|
|
34
|
+
total: {
|
|
35
|
+
amount: Number(order.amount),
|
|
36
|
+
label: name
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export var prepareApplePayRequest = function (_a) {
|
|
41
|
+
var payment_options = _a.payment_options, merchant = _a.merchant, order = _a.order, customer = _a.customer, acceptance = _a.acceptance;
|
|
42
|
+
var paymentMethod = getPaymentMethod(payment_options.payment_methods || [], PAYMENT_METHOD_KEY);
|
|
43
|
+
var supportedNetworks = validateSupportedNetworks(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.supported_card_brands, acceptance === null || acceptance === void 0 ? void 0 : acceptance.supportedSchemes);
|
|
44
|
+
var applypayMethod = getPaymentMethod(payment_options.payment_methods || [], PAYMENT_METHOD_KEY);
|
|
45
|
+
var supportedCurrency = getSelectedCurrency(payment_options.supported_currencies || [], order, applypayMethod);
|
|
46
|
+
var request = getApplePayRequest({
|
|
47
|
+
countryCode: merchant.country_code,
|
|
48
|
+
order: supportedCurrency,
|
|
49
|
+
customer: customer,
|
|
50
|
+
supportedNetworks: supportedNetworks,
|
|
51
|
+
merchantCapabilities: getMerchantCapabilities(acceptance === null || acceptance === void 0 ? void 0 : acceptance.supportedFundSource),
|
|
52
|
+
name: merchant.name
|
|
53
|
+
});
|
|
54
|
+
return { applePaySessionRequest: request, paymentMethod: paymentMethod };
|
|
55
|
+
};
|
|
56
|
+
export var shallRenderApplePay = function () {
|
|
57
|
+
var https = window.location.protocol === 'https:';
|
|
58
|
+
return https;
|
|
59
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MerchantCapabilities } from '../@types/enums';
|
|
2
|
-
export declare const getMerchantCapabilities: (supportedCards?: Array<string>) => MerchantCapabilities[];
|
|
1
|
+
import { MerchantCapabilities } from '../@types/enums';
|
|
2
|
+
export declare const getMerchantCapabilities: (supportedCards?: Array<string>) => MerchantCapabilities[];
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
|
-
import { MerchantCapabilities } from '../@types/enums';
|
|
11
|
-
export var getMerchantCapabilities = function (supportedCards) {
|
|
12
|
-
var merchantCapabilities = [MerchantCapabilities.Supports3DS];
|
|
13
|
-
if (!supportedCards) {
|
|
14
|
-
merchantCapabilities = __spreadArray(__spreadArray([], merchantCapabilities, true), [
|
|
15
|
-
MerchantCapabilities.SupportsCredit,
|
|
16
|
-
MerchantCapabilities.SupportsDebit
|
|
17
|
-
], false);
|
|
18
|
-
return merchantCapabilities;
|
|
19
|
-
}
|
|
20
|
-
if (supportedCards.includes('CREDIT')) {
|
|
21
|
-
merchantCapabilities.push(MerchantCapabilities.SupportsCredit);
|
|
22
|
-
}
|
|
23
|
-
if (supportedCards.includes('DEBIT')) {
|
|
24
|
-
merchantCapabilities.push(MerchantCapabilities.SupportsDebit);
|
|
25
|
-
}
|
|
26
|
-
return merchantCapabilities;
|
|
27
|
-
};
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
+
};
|
|
10
|
+
import { MerchantCapabilities } from '../@types/enums';
|
|
11
|
+
export var getMerchantCapabilities = function (supportedCards) {
|
|
12
|
+
var merchantCapabilities = [MerchantCapabilities.Supports3DS];
|
|
13
|
+
if (!supportedCards) {
|
|
14
|
+
merchantCapabilities = __spreadArray(__spreadArray([], merchantCapabilities, true), [
|
|
15
|
+
MerchantCapabilities.SupportsCredit,
|
|
16
|
+
MerchantCapabilities.SupportsDebit
|
|
17
|
+
], false);
|
|
18
|
+
return merchantCapabilities;
|
|
19
|
+
}
|
|
20
|
+
if (supportedCards.includes('CREDIT')) {
|
|
21
|
+
merchantCapabilities.push(MerchantCapabilities.SupportsCredit);
|
|
22
|
+
}
|
|
23
|
+
if (supportedCards.includes('DEBIT')) {
|
|
24
|
+
merchantCapabilities.push(MerchantCapabilities.SupportsDebit);
|
|
25
|
+
}
|
|
26
|
+
return merchantCapabilities;
|
|
27
|
+
};
|
package/build/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './theme';
|
|
2
|
-
export * from './config';
|
|
3
|
-
export * from './defaultValues';
|
|
1
|
+
export * from './theme';
|
|
2
|
+
export * from './config';
|
|
3
|
+
export * from './defaultValues';
|
package/build/utils/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './theme';
|
|
2
|
-
export * from './config';
|
|
3
|
-
export * from './defaultValues';
|
|
1
|
+
export * from './theme';
|
|
2
|
+
export * from './config';
|
|
3
|
+
export * from './defaultValues';
|
package/build/utils/theme.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { TapThemeResponse } from '../@types';
|
|
2
|
-
import { FullThemeMode } from '../@types/enums';
|
|
3
|
-
import { ApplePayButtonProps } from '..';
|
|
4
|
-
import { ColorStyle, Locale, ThemeMode } from '@tap-payments/acceptance-sdk';
|
|
5
|
-
export declare const mappingInterface: (interfaceParam?: ApplePayButtonProps['interface']) => ApplePayButtonProps['interface'];
|
|
6
|
-
export declare const getDefaultThemeMode: (themeMode?: ThemeMode) => ThemeMode;
|
|
7
|
-
export declare const getDefaultLocale: (locale?: Locale) => Locale;
|
|
8
|
-
export declare const getFullThemeMode: (themeMode?: ThemeMode, colorStyle?: ColorStyle) => FullThemeMode;
|
|
9
|
-
export declare const appendColors: (colors: Record<string, string>) => void;
|
|
10
|
-
export declare const getTapThemeValue: ({ tapTheme, value }: {
|
|
11
|
-
tapTheme: TapThemeResponse | null;
|
|
12
|
-
value?: string | undefined;
|
|
13
|
-
}) => string;
|
|
1
|
+
import { TapThemeResponse } from '../@types';
|
|
2
|
+
import { FullThemeMode } from '../@types/enums';
|
|
3
|
+
import { ApplePayButtonProps } from '..';
|
|
4
|
+
import { ColorStyle, Locale, ThemeMode } from '@tap-payments/acceptance-sdk';
|
|
5
|
+
export declare const mappingInterface: (interfaceParam?: ApplePayButtonProps['interface']) => ApplePayButtonProps['interface'];
|
|
6
|
+
export declare const getDefaultThemeMode: (themeMode?: ThemeMode) => ThemeMode;
|
|
7
|
+
export declare const getDefaultLocale: (locale?: Locale) => Locale;
|
|
8
|
+
export declare const getFullThemeMode: (themeMode?: ThemeMode, colorStyle?: ColorStyle) => FullThemeMode;
|
|
9
|
+
export declare const appendColors: (colors: Record<string, string>) => void;
|
|
10
|
+
export declare const getTapThemeValue: ({ tapTheme, value }: {
|
|
11
|
+
tapTheme: TapThemeResponse | null;
|
|
12
|
+
value?: string | undefined;
|
|
13
|
+
}) => string;
|
package/build/utils/theme.js
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { FullThemeMode } from '../@types/enums';
|
|
13
|
-
import { ColorStyle, Edges, Locale, ThemeMode } from '@tap-payments/acceptance-sdk';
|
|
14
|
-
export var mappingInterface = function (interfaceParam) {
|
|
15
|
-
return __assign(__assign({ edges: Edges.CURVED, colorStyle: ColorStyle.COLORED, loader: true }, interfaceParam), { locale: getDefaultLocale(interfaceParam === null || interfaceParam === void 0 ? void 0 : interfaceParam.locale), theme: getDefaultThemeMode(interfaceParam === null || interfaceParam === void 0 ? void 0 : interfaceParam.theme) });
|
|
16
|
-
};
|
|
17
|
-
export var getDefaultThemeMode = function (themeMode) {
|
|
18
|
-
return themeMode === ThemeMode.DYNAMIC || themeMode === undefined
|
|
19
|
-
? window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
20
|
-
? ThemeMode.DARK
|
|
21
|
-
: ThemeMode.LIGHT
|
|
22
|
-
: themeMode;
|
|
23
|
-
};
|
|
24
|
-
export var getDefaultLocale = function (locale) {
|
|
25
|
-
var _a;
|
|
26
|
-
return locale === Locale.DYNAMIC || locale === undefined
|
|
27
|
-
? (_a = window.navigator.language.split('-')) === null || _a === void 0 ? void 0 : _a[0]
|
|
28
|
-
: locale;
|
|
29
|
-
};
|
|
30
|
-
export var getFullThemeMode = function (themeMode, colorStyle) {
|
|
31
|
-
var themeModeValue = getDefaultThemeMode(themeMode);
|
|
32
|
-
if (themeModeValue === ThemeMode.DARK) {
|
|
33
|
-
return colorStyle === ColorStyle.MONOCHROME ? FullThemeMode.DARK : FullThemeMode.DARK_COLORED;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
return colorStyle === ColorStyle.MONOCHROME ? FullThemeMode.LIGHT_MONO : FullThemeMode.LIGHT;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
export var appendColors = function (colors) {
|
|
40
|
-
try {
|
|
41
|
-
var root_1 = document.documentElement;
|
|
42
|
-
Object.entries(colors).forEach(function (_a) {
|
|
43
|
-
var key = _a[0], value = _a[1];
|
|
44
|
-
root_1.style.setProperty("--".concat(key), value);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
catch (e) {
|
|
48
|
-
throw e;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
export var getTapThemeValue = function (_a) {
|
|
52
|
-
var tapTheme = _a.tapTheme, value = _a.value;
|
|
53
|
-
if (!tapTheme)
|
|
54
|
-
return '';
|
|
55
|
-
if (!value)
|
|
56
|
-
return '';
|
|
57
|
-
if (value[0] === '#')
|
|
58
|
-
return value;
|
|
59
|
-
var colorsObject = tapTheme === null || tapTheme === void 0 ? void 0 : tapTheme.GlobalValues.Colors;
|
|
60
|
-
var valueFromGlobalColors = colorsObject === null || colorsObject === void 0 ? void 0 : colorsObject[value];
|
|
61
|
-
return valueFromGlobalColors !== null && valueFromGlobalColors !== void 0 ? valueFromGlobalColors : '';
|
|
62
|
-
};
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { FullThemeMode } from '../@types/enums';
|
|
13
|
+
import { ColorStyle, Edges, Locale, ThemeMode } from '@tap-payments/acceptance-sdk';
|
|
14
|
+
export var mappingInterface = function (interfaceParam) {
|
|
15
|
+
return __assign(__assign({ edges: Edges.CURVED, colorStyle: ColorStyle.COLORED, loader: true }, interfaceParam), { locale: getDefaultLocale(interfaceParam === null || interfaceParam === void 0 ? void 0 : interfaceParam.locale), theme: getDefaultThemeMode(interfaceParam === null || interfaceParam === void 0 ? void 0 : interfaceParam.theme) });
|
|
16
|
+
};
|
|
17
|
+
export var getDefaultThemeMode = function (themeMode) {
|
|
18
|
+
return themeMode === ThemeMode.DYNAMIC || themeMode === undefined
|
|
19
|
+
? window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
20
|
+
? ThemeMode.DARK
|
|
21
|
+
: ThemeMode.LIGHT
|
|
22
|
+
: themeMode;
|
|
23
|
+
};
|
|
24
|
+
export var getDefaultLocale = function (locale) {
|
|
25
|
+
var _a;
|
|
26
|
+
return locale === Locale.DYNAMIC || locale === undefined
|
|
27
|
+
? (_a = window.navigator.language.split('-')) === null || _a === void 0 ? void 0 : _a[0]
|
|
28
|
+
: locale;
|
|
29
|
+
};
|
|
30
|
+
export var getFullThemeMode = function (themeMode, colorStyle) {
|
|
31
|
+
var themeModeValue = getDefaultThemeMode(themeMode);
|
|
32
|
+
if (themeModeValue === ThemeMode.DARK) {
|
|
33
|
+
return colorStyle === ColorStyle.MONOCHROME ? FullThemeMode.DARK : FullThemeMode.DARK_COLORED;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return colorStyle === ColorStyle.MONOCHROME ? FullThemeMode.LIGHT_MONO : FullThemeMode.LIGHT;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export var appendColors = function (colors) {
|
|
40
|
+
try {
|
|
41
|
+
var root_1 = document.documentElement;
|
|
42
|
+
Object.entries(colors).forEach(function (_a) {
|
|
43
|
+
var key = _a[0], value = _a[1];
|
|
44
|
+
root_1.style.setProperty("--".concat(key), value);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
throw e;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export var getTapThemeValue = function (_a) {
|
|
52
|
+
var tapTheme = _a.tapTheme, value = _a.value;
|
|
53
|
+
if (!tapTheme)
|
|
54
|
+
return '';
|
|
55
|
+
if (!value)
|
|
56
|
+
return '';
|
|
57
|
+
if (value[0] === '#')
|
|
58
|
+
return value;
|
|
59
|
+
var colorsObject = tapTheme === null || tapTheme === void 0 ? void 0 : tapTheme.GlobalValues.Colors;
|
|
60
|
+
var valueFromGlobalColors = colorsObject === null || colorsObject === void 0 ? void 0 : colorsObject[value];
|
|
61
|
+
return valueFromGlobalColors !== null && valueFromGlobalColors !== void 0 ? valueFromGlobalColors : '';
|
|
62
|
+
};
|
package/package.json
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tap-payments/apple-pay-button",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Apple Pay Button React Component",
|
|
5
|
-
"main": "build/index.js",
|
|
6
|
-
"module": "build/index.js",
|
|
7
|
-
"types": "build/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"build",
|
|
10
|
-
"README.md"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"start": "cross-env NODE_ENV=development webpack serve",
|
|
14
|
-
"prepare": "npx husky install",
|
|
15
|
-
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
|
|
16
|
-
"prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
|
|
17
|
-
"lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
|
|
18
|
-
"lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
|
|
19
|
-
"build": "cross-env NODE_ENV=production webpack",
|
|
20
|
-
"copy:files": "copyfiles -u 1 src/**/*.gif build/ && copyfiles -u 1 src/**/*.css build/",
|
|
21
|
-
"tsc:alias": "tsc-alias -p tsconfig.json",
|
|
22
|
-
"ts:build": "rm -rf build && tsc && yarn tsc:alias && yarn copy:files",
|
|
23
|
-
"push": "npm publish --access public --tag development"
|
|
24
|
-
},
|
|
25
|
-
"keywords": [],
|
|
26
|
-
"author": {
|
|
27
|
-
"name": "Ahmed Elsharkawy",
|
|
28
|
-
"email": "a.elsharkawy@tap.company"
|
|
29
|
-
},
|
|
30
|
-
"license": "ISC",
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"@tap-payments/acceptance-sdk": "0.0.
|
|
33
|
-
"@tap-payments/browser-info": "^1.0.2",
|
|
34
|
-
"@tap-payments/web-error-handing": "^1.0.1",
|
|
35
|
-
"axios": "^1.2.2",
|
|
36
|
-
"framer-motion": "^10.16.5",
|
|
37
|
-
"jsencrypt": "^3.3.2",
|
|
38
|
-
"lottie-react": "^2.4.0",
|
|
39
|
-
"react": "^18.2.0",
|
|
40
|
-
"react-dom": "^18.2.0"
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@babel/core": "^7.18.6",
|
|
44
|
-
"@babel/preset-env": "^7.18.6",
|
|
45
|
-
"@babel/preset-react": "^7.18.6",
|
|
46
|
-
"@babel/preset-typescript": "^7.18.6",
|
|
47
|
-
"@types/applepayjs": "^14.0.3",
|
|
48
|
-
"@types/crypto-js": "^4.1.1",
|
|
49
|
-
"@types/react": "^18.0.15",
|
|
50
|
-
"@types/react-dom": "^18.0.6",
|
|
51
|
-
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
52
|
-
"@typescript-eslint/parser": "^5.30.5",
|
|
53
|
-
"babel-loader": "^8.2.5",
|
|
54
|
-
"copyfiles": "^2.4.1",
|
|
55
|
-
"cross-env": "^7.0.3",
|
|
56
|
-
"css-loader": "^6.7.1",
|
|
57
|
-
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
58
|
-
"eslint": "^8.19.0",
|
|
59
|
-
"eslint-config-airbnb": "^19.0.4",
|
|
60
|
-
"eslint-config-prettier": "^8.5.0",
|
|
61
|
-
"eslint-plugin-import": "^2.26.0",
|
|
62
|
-
"eslint-plugin-jsx-a11y": "^6.6.0",
|
|
63
|
-
"eslint-plugin-node": "^11.1.0",
|
|
64
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
65
|
-
"eslint-plugin-react": "^7.30.1",
|
|
66
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
67
|
-
"file-loader": "^6.2.0",
|
|
68
|
-
"fork-ts-checker-webpack-plugin": "^7.2.12",
|
|
69
|
-
"html-loader": "^3.1.2",
|
|
70
|
-
"html-webpack-plugin": "^5.5.0",
|
|
71
|
-
"husky": "^8.0.1",
|
|
72
|
-
"lint-staged": "^13.0.3",
|
|
73
|
-
"mini-css-extract-plugin": "^2.6.1",
|
|
74
|
-
"prettier": "^2.7.1",
|
|
75
|
-
"sass": "^1.53.0",
|
|
76
|
-
"sass-loader": "^13.0.2",
|
|
77
|
-
"style-loader": "^3.3.1",
|
|
78
|
-
"terser-webpack-plugin": "^5.3.3",
|
|
79
|
-
"tsc-alias": "^1.6.11",
|
|
80
|
-
"typescript": "^4.7.4",
|
|
81
|
-
"webpack": "^5.73.0",
|
|
82
|
-
"webpack-cli": "^4.10.0",
|
|
83
|
-
"webpack-dev-server": "^4.9.3",
|
|
84
|
-
"webpack-merge": "^5.8.0"
|
|
85
|
-
},
|
|
86
|
-
"peerDependencies": {
|
|
87
|
-
"react": ">=17.0.2",
|
|
88
|
-
"react-dom": ">=17.0.2"
|
|
89
|
-
},
|
|
90
|
-
"lint-staged": {
|
|
91
|
-
"src/**/*.{ts,tsx,json,js,jsx}": [
|
|
92
|
-
"yarn run prettier:fix",
|
|
93
|
-
"yarn run lint",
|
|
94
|
-
"git add ."
|
|
95
|
-
]
|
|
96
|
-
},
|
|
97
|
-
"browserslist": {
|
|
98
|
-
"production": [
|
|
99
|
-
">0.2%",
|
|
100
|
-
"not dead",
|
|
101
|
-
"not op_mini all"
|
|
102
|
-
],
|
|
103
|
-
"development": [
|
|
104
|
-
"last 1 chrome version",
|
|
105
|
-
"last 1 firefox version",
|
|
106
|
-
"last 1 safari version"
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tap-payments/apple-pay-button",
|
|
3
|
+
"version": "0.0.92-development",
|
|
4
|
+
"description": "Apple Pay Button React Component",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"module": "build/index.js",
|
|
7
|
+
"types": "build/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"build",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"start": "cross-env NODE_ENV=development webpack serve",
|
|
14
|
+
"prepare": "npx husky install",
|
|
15
|
+
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
|
|
16
|
+
"prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
|
|
17
|
+
"lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
|
|
18
|
+
"lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
|
|
19
|
+
"build": "cross-env NODE_ENV=production webpack",
|
|
20
|
+
"copy:files": "copyfiles -u 1 src/**/*.gif build/ && copyfiles -u 1 src/**/*.css build/",
|
|
21
|
+
"tsc:alias": "tsc-alias -p tsconfig.json",
|
|
22
|
+
"ts:build": "rm -rf build && tsc && yarn tsc:alias && yarn copy:files",
|
|
23
|
+
"push": "npm publish --access public --tag development"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [],
|
|
26
|
+
"author": {
|
|
27
|
+
"name": "Ahmed Elsharkawy",
|
|
28
|
+
"email": "a.elsharkawy@tap.company"
|
|
29
|
+
},
|
|
30
|
+
"license": "ISC",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@tap-payments/acceptance-sdk": "0.0.64",
|
|
33
|
+
"@tap-payments/browser-info": "^1.0.2",
|
|
34
|
+
"@tap-payments/web-error-handing": "^1.0.1",
|
|
35
|
+
"axios": "^1.2.2",
|
|
36
|
+
"framer-motion": "^10.16.5",
|
|
37
|
+
"jsencrypt": "^3.3.2",
|
|
38
|
+
"lottie-react": "^2.4.0",
|
|
39
|
+
"react": "^18.2.0",
|
|
40
|
+
"react-dom": "^18.2.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@babel/core": "^7.18.6",
|
|
44
|
+
"@babel/preset-env": "^7.18.6",
|
|
45
|
+
"@babel/preset-react": "^7.18.6",
|
|
46
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
47
|
+
"@types/applepayjs": "^14.0.3",
|
|
48
|
+
"@types/crypto-js": "^4.1.1",
|
|
49
|
+
"@types/react": "^18.0.15",
|
|
50
|
+
"@types/react-dom": "^18.0.6",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
52
|
+
"@typescript-eslint/parser": "^5.30.5",
|
|
53
|
+
"babel-loader": "^8.2.5",
|
|
54
|
+
"copyfiles": "^2.4.1",
|
|
55
|
+
"cross-env": "^7.0.3",
|
|
56
|
+
"css-loader": "^6.7.1",
|
|
57
|
+
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
58
|
+
"eslint": "^8.19.0",
|
|
59
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
60
|
+
"eslint-config-prettier": "^8.5.0",
|
|
61
|
+
"eslint-plugin-import": "^2.26.0",
|
|
62
|
+
"eslint-plugin-jsx-a11y": "^6.6.0",
|
|
63
|
+
"eslint-plugin-node": "^11.1.0",
|
|
64
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
65
|
+
"eslint-plugin-react": "^7.30.1",
|
|
66
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
67
|
+
"file-loader": "^6.2.0",
|
|
68
|
+
"fork-ts-checker-webpack-plugin": "^7.2.12",
|
|
69
|
+
"html-loader": "^3.1.2",
|
|
70
|
+
"html-webpack-plugin": "^5.5.0",
|
|
71
|
+
"husky": "^8.0.1",
|
|
72
|
+
"lint-staged": "^13.0.3",
|
|
73
|
+
"mini-css-extract-plugin": "^2.6.1",
|
|
74
|
+
"prettier": "^2.7.1",
|
|
75
|
+
"sass": "^1.53.0",
|
|
76
|
+
"sass-loader": "^13.0.2",
|
|
77
|
+
"style-loader": "^3.3.1",
|
|
78
|
+
"terser-webpack-plugin": "^5.3.3",
|
|
79
|
+
"tsc-alias": "^1.6.11",
|
|
80
|
+
"typescript": "^4.7.4",
|
|
81
|
+
"webpack": "^5.73.0",
|
|
82
|
+
"webpack-cli": "^4.10.0",
|
|
83
|
+
"webpack-dev-server": "^4.9.3",
|
|
84
|
+
"webpack-merge": "^5.8.0"
|
|
85
|
+
},
|
|
86
|
+
"peerDependencies": {
|
|
87
|
+
"react": ">=17.0.2",
|
|
88
|
+
"react-dom": ">=17.0.2"
|
|
89
|
+
},
|
|
90
|
+
"lint-staged": {
|
|
91
|
+
"src/**/*.{ts,tsx,json,js,jsx}": [
|
|
92
|
+
"yarn run prettier:fix",
|
|
93
|
+
"yarn run lint",
|
|
94
|
+
"git add ."
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"browserslist": {
|
|
98
|
+
"production": [
|
|
99
|
+
">0.2%",
|
|
100
|
+
"not dead",
|
|
101
|
+
"not op_mini all"
|
|
102
|
+
],
|
|
103
|
+
"development": [
|
|
104
|
+
"last 1 chrome version",
|
|
105
|
+
"last 1 firefox version",
|
|
106
|
+
"last 1 safari version"
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
}
|