@tap-payments/apple-pay-button 0.0.55-development → 0.0.56-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.
Files changed (56) hide show
  1. package/build/@types/ApplePayButtonProps.d.ts +127 -0
  2. package/build/@types/ApplePayButtonProps.js +1 -0
  3. package/build/@types/charge.d.ts +57 -0
  4. package/build/@types/charge.js +1 -0
  5. package/build/@types/checkoutProfile.d.ts +194 -0
  6. package/build/@types/checkoutProfile.js +1 -0
  7. package/build/@types/enums.d.ts +71 -0
  8. package/build/@types/enums.js +83 -0
  9. package/build/@types/index.d.ts +6 -233
  10. package/build/@types/index.js +6 -1
  11. package/build/@types/tapLocalisation.d.ts +193 -0
  12. package/build/@types/tapLocalisation.js +1 -0
  13. package/build/@types/tapTheme.d.ts +842 -0
  14. package/build/@types/tapTheme.js +1 -0
  15. package/build/api/app.service.d.ts +1 -1
  16. package/build/api/app.service.js +2 -1
  17. package/build/api/httpClient.d.ts +1 -1
  18. package/build/assets/lottie/Dark_Mode_Loader.json +255 -0
  19. package/build/assets/lottie/Light_Mode_Loader.json +255 -0
  20. package/build/components/ActionButton/ActionButton.d.ts +31 -0
  21. package/build/components/ActionButton/ActionButton.js +61 -0
  22. package/build/components/ActionButton/index.d.ts +2 -0
  23. package/build/components/ActionButton/index.js +2 -0
  24. package/build/components/InitialLoader/InitialLoader.d.ts +9 -0
  25. package/build/components/InitialLoader/InitialLoader.js +29 -0
  26. package/build/components/InitialLoader/index.d.ts +2 -0
  27. package/build/components/InitialLoader/index.js +2 -0
  28. package/build/components/Loader/Loader.d.ts +24 -0
  29. package/build/components/Loader/Loader.js +48 -0
  30. package/build/components/Loader/index.d.ts +2 -0
  31. package/build/components/Loader/index.js +2 -0
  32. package/build/components/PayButton/PayButton.d.ts +22 -0
  33. package/build/components/PayButton/PayButton.js +40 -0
  34. package/build/components/PayButton/index.d.ts +2 -0
  35. package/build/components/PayButton/index.js +2 -0
  36. package/build/components/PayButton/style.d.ts +11 -0
  37. package/build/components/PayButton/style.js +41 -0
  38. package/build/constants/index.d.ts +2 -66
  39. package/build/constants/index.js +2 -66
  40. package/build/features/ApplePayButton/ApplePayButton.js +19 -15
  41. package/build/features/ApplePayButton/style.d.ts +2 -0
  42. package/build/features/ApplePayButton/style.js +12 -0
  43. package/build/hooks/useApplePay.js +2 -1
  44. package/build/hooks/useMerchantApplePay.d.ts +1 -2
  45. package/build/hooks/useMerchantApplePay.js +1 -1
  46. package/build/hooks/useScript.d.ts +3 -1
  47. package/build/hooks/useScript.js +3 -2
  48. package/build/index.d.ts +1 -1
  49. package/build/index.js +1 -1
  50. package/build/utils/defaultValues.d.ts +8 -7
  51. package/build/utils/defaultValues.js +1 -1
  52. package/build/utils/index.d.ts +3 -0
  53. package/build/utils/index.js +3 -0
  54. package/build/utils/theme.d.ts +2 -0
  55. package/build/utils/theme.js +8 -0
  56. package/package.json +16 -10
@@ -0,0 +1,127 @@
1
+ import { CheckoutProfileResponse } from './checkoutProfile';
2
+ import { Locale, Environment, ThemeMode, Edges, Scope, MerchantCapabilities, SupportedNetworks, ButtonType } from './enums';
3
+ export interface ApplePayRequestData {
4
+ countryCode: string;
5
+ currencyCode: string;
6
+ merchantCapabilities: Array<MerchantCapabilities>;
7
+ supportedNetworks: Array<SupportedNetworks>;
8
+ billingContact?: {
9
+ phoneNumber?: string;
10
+ emailAddress?: string;
11
+ givenName: string;
12
+ familyName: string;
13
+ };
14
+ total: {
15
+ label: string;
16
+ amount: number;
17
+ };
18
+ }
19
+ export interface ApplePayDataToLunchSDKFromMerchantSide {
20
+ headers: Record<string, any>;
21
+ BASE_URL: string;
22
+ merchant: Record<string, string>;
23
+ applePayRequestData: ApplePayRequestData;
24
+ debug?: boolean;
25
+ applePaySDKVersion?: number;
26
+ }
27
+ export interface Interface {
28
+ locale?: Locale;
29
+ theme?: ThemeMode;
30
+ edges?: Edges;
31
+ type?: ButtonType;
32
+ }
33
+ export interface Customer {
34
+ id?: string;
35
+ name?: {
36
+ lang: Locale;
37
+ first: string;
38
+ last: string;
39
+ middle?: string;
40
+ }[];
41
+ contact?: {
42
+ email?: string;
43
+ phone?: {
44
+ countryCode: string;
45
+ number: string;
46
+ };
47
+ };
48
+ }
49
+ export interface Acceptance {
50
+ supportedSchemes?: Array<SupportedNetworks>;
51
+ supportedFundSource?: string[];
52
+ supportedPaymentAuthentications?: string[];
53
+ }
54
+ export interface ApplePayButtonProps {
55
+ operator: {
56
+ publicKey: string;
57
+ hashstring?: string;
58
+ };
59
+ merchant: {
60
+ id: string;
61
+ };
62
+ scope: Scope;
63
+ environment: Environment;
64
+ interface?: Interface;
65
+ customer?: Customer;
66
+ acceptance?: Acceptance;
67
+ transaction?: {
68
+ authentication?: boolean;
69
+ authorize?: {
70
+ auto: {
71
+ type: string;
72
+ time: number;
73
+ };
74
+ };
75
+ metadata?: Record<string, string>;
76
+ reference?: string;
77
+ paymentAgreement?: {
78
+ id: string;
79
+ contract?: {
80
+ id: string;
81
+ };
82
+ };
83
+ destinations?: Record<string, any>;
84
+ };
85
+ invoice?: {
86
+ id: string;
87
+ };
88
+ order: {
89
+ amount: number;
90
+ currency: string;
91
+ id?: string;
92
+ description?: string;
93
+ metadata?: Record<string, string>;
94
+ reference?: string;
95
+ };
96
+ post?: {
97
+ url: string;
98
+ };
99
+ redirect?: {
100
+ url: string;
101
+ };
102
+ onOrderCreated?: (orderId: string) => void;
103
+ onCancel?: () => void;
104
+ onError?: (error: any) => void;
105
+ onSuccess?: (data: Record<string, any>) => void;
106
+ onClick?: (data?: ApplePayDataToLunchSDKFromMerchantSide) => void;
107
+ onReady?: () => void;
108
+ metaData?: MetaData;
109
+ debug?: boolean;
110
+ integration?: 'sdk' | 'iframe';
111
+ headers?: {
112
+ mdn: string;
113
+ application: string;
114
+ };
115
+ }
116
+ export interface MerchantResponse {
117
+ id: string;
118
+ name: string;
119
+ country_code: string;
120
+ session_token: string;
121
+ [other: string]: string;
122
+ }
123
+ export interface MetaData {
124
+ merchant: MerchantResponse;
125
+ payment_options: CheckoutProfileResponse['payment_options'];
126
+ headers: Record<string, string>;
127
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,57 @@
1
+ export interface ChargeRequestBody {
2
+ source: {
3
+ id: string;
4
+ };
5
+ ipaddress?: string;
6
+ amount: number;
7
+ currency: string;
8
+ selected_amount?: number;
9
+ selected_currency?: string;
10
+ product: string;
11
+ threeDSecure?: boolean;
12
+ save_card: boolean;
13
+ fee: number;
14
+ customer: {
15
+ id?: string;
16
+ first_name?: string;
17
+ middle_name?: string;
18
+ last_name?: string;
19
+ email?: string;
20
+ phone?: {
21
+ country_code: string;
22
+ number: string;
23
+ };
24
+ };
25
+ hashstring?: string;
26
+ metadata?: Record<string, string>;
27
+ post?: {
28
+ url: string;
29
+ };
30
+ redirect?: {
31
+ url: string;
32
+ };
33
+ merchant?: {
34
+ id: string;
35
+ };
36
+ order?: {
37
+ id: string;
38
+ };
39
+ payment_agreement?: {
40
+ id: string;
41
+ contract?: {
42
+ id: string;
43
+ };
44
+ };
45
+ destinations?: Record<string, any>;
46
+ reference?: {
47
+ order?: string;
48
+ transaction?: string;
49
+ };
50
+ description?: string;
51
+ }
52
+ export interface AuthorizeRequestBody extends ChargeRequestBody {
53
+ auto?: {
54
+ type: string;
55
+ time: number;
56
+ };
57
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,194 @@
1
+ import { SupportedNetworks, ThemeMode } from '..';
2
+ export interface CheckoutProfileRequest {
3
+ supported_payment_methods: string[];
4
+ supported_currencies: string[];
5
+ transaction_mode: string;
6
+ currency: string;
7
+ merchant_id: string;
8
+ total_amount: number;
9
+ order: {
10
+ id?: string;
11
+ amount: number;
12
+ currency: string;
13
+ description?: string;
14
+ metadata?: Record<string, string>;
15
+ customer?: {
16
+ id?: string;
17
+ email?: string;
18
+ first_name?: string;
19
+ last_name?: string;
20
+ phone?: {
21
+ country_code: string;
22
+ number: string;
23
+ };
24
+ };
25
+ items: {
26
+ quantity: number;
27
+ amount: number;
28
+ currency: string;
29
+ name: string;
30
+ description: string;
31
+ }[];
32
+ merchant: {
33
+ id: string;
34
+ };
35
+ };
36
+ }
37
+ export interface CheckoutProfileResponse {
38
+ status: string;
39
+ merchant: MerchantResponse;
40
+ assests: Assests;
41
+ payment_options: Paymentoptions;
42
+ session: string;
43
+ }
44
+ interface Paymentoptions {
45
+ id: string;
46
+ object: string;
47
+ payment_methods: PaymentMethod[];
48
+ currency: string;
49
+ country: string;
50
+ settlement_currency: string;
51
+ supported_currencies: Supportedcurrency[];
52
+ api_version: string;
53
+ order: Order;
54
+ }
55
+ interface Order {
56
+ id: string;
57
+ }
58
+ interface Supportedcurrency {
59
+ symbol: string;
60
+ name: string;
61
+ flag: string;
62
+ decimal_digit: number;
63
+ selected: boolean;
64
+ rate: number;
65
+ logos: Logos2;
66
+ order_by: number;
67
+ currency: string;
68
+ amount: number;
69
+ }
70
+ interface Logos2 {
71
+ dark: Disabled;
72
+ light: Disabled;
73
+ light_mono: Disabled;
74
+ dark_colored: Disabled;
75
+ }
76
+ export interface PaymentMethod {
77
+ id: string;
78
+ name: string;
79
+ name_ar: string;
80
+ image: string;
81
+ payment_type: string;
82
+ supported_card_brands: SupportedNetworks[];
83
+ supported_currencies: string[];
84
+ order_by: number;
85
+ cc_markup: number;
86
+ asynchronous: boolean;
87
+ threeDS: string;
88
+ api_version: number;
89
+ api_version_minor: number;
90
+ logos: Logos;
91
+ payment_order_type: string;
92
+ button_style: Buttonstyle;
93
+ display_name: string;
94
+ default_currency: string;
95
+ }
96
+ interface Buttonstyle {
97
+ background: Background2;
98
+ title_asset: 'https://tap-assets.b-cdn.net/action-button/{theme}/{lang}/mastercard';
99
+ }
100
+ interface Background2 {
101
+ light: Light2;
102
+ dark: Light2;
103
+ light_mono: Light2;
104
+ dark_colored: Light2;
105
+ }
106
+ interface Light2 {
107
+ base_color: string;
108
+ background_colors: string[];
109
+ }
110
+ interface Logos {
111
+ dark: Dark2;
112
+ light: Dark2;
113
+ light_mono: Dark2;
114
+ dark_colored: Dark2;
115
+ }
116
+ interface Dark2 {
117
+ svg: string;
118
+ png: string;
119
+ disabled: Disabled;
120
+ currency_widget: Disabled;
121
+ card_icon: Disabled;
122
+ }
123
+ interface Disabled {
124
+ svg: string;
125
+ png: string;
126
+ }
127
+ interface Assests {
128
+ localisation: Localisation;
129
+ theme: Theme;
130
+ web: Theme;
131
+ }
132
+ declare type Theme = Record<ThemeMode, string> & {
133
+ card: {
134
+ light: string;
135
+ dark: string;
136
+ };
137
+ };
138
+ interface Localisation {
139
+ url: string;
140
+ card: {
141
+ url: string;
142
+ };
143
+ }
144
+ interface MerchantResponse {
145
+ id: string;
146
+ api_version: string;
147
+ live_mode: boolean;
148
+ object: string;
149
+ name: string;
150
+ country_code: string;
151
+ logo: string;
152
+ background: Background;
153
+ contact: any[];
154
+ powered_by: boolean;
155
+ sdk_settings: Sdksettings;
156
+ session_token: string;
157
+ key_type: string;
158
+ encryption_key: string;
159
+ permissions: string[];
160
+ permission: Permission;
161
+ }
162
+ interface Permission {
163
+ card_wallet: boolean;
164
+ threeDSecure: boolean;
165
+ pci_dss: boolean;
166
+ }
167
+ interface Sdksettings {
168
+ status_display_duration: number;
169
+ otp_resend_interval: number;
170
+ otp_resend_attempts: number;
171
+ }
172
+ interface Background {
173
+ url: string;
174
+ mode: string;
175
+ color: Color;
176
+ }
177
+ interface Color {
178
+ dark: Dark;
179
+ light: Light;
180
+ }
181
+ interface Light {
182
+ color: string;
183
+ rectangle: Rectangle;
184
+ image: string;
185
+ }
186
+ interface Rectangle {
187
+ background: string;
188
+ 'backdrop-filter': string;
189
+ }
190
+ interface Dark {
191
+ color: string;
192
+ image: string;
193
+ }
194
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,71 @@
1
+ export declare enum Locale {
2
+ EN = "en",
3
+ AR = "ar",
4
+ DYNAMIC = "dynamic"
5
+ }
6
+ export declare enum ThemeMode {
7
+ DARK = "dark",
8
+ LIGHT = "light",
9
+ DYNAMIC = "dynamic"
10
+ }
11
+ export declare enum Edges {
12
+ STRAIGHT = "straight",
13
+ CURVED = "curved"
14
+ }
15
+ export declare enum ColorStyle {
16
+ COLORED = "colored",
17
+ MONOCHROME = "monochrome"
18
+ }
19
+ export declare enum Environment {
20
+ Beta = "beta",
21
+ Staging = "staging",
22
+ Sandbox = "sandbox",
23
+ Production = "production",
24
+ Development = "development"
25
+ }
26
+ export declare enum Scope {
27
+ CHARGE = "charge",
28
+ AUTHORIZE = "authorize",
29
+ TAP_TOKEN = "taptoken",
30
+ APPLE_PAY_TOKEN = "applepaytoken"
31
+ }
32
+ export declare enum ButtonStyle {
33
+ Black = "black",
34
+ White = "white",
35
+ WhiteOutline = "white-outline"
36
+ }
37
+ export declare enum FullThemeMode {
38
+ DARK = "dark",
39
+ LIGHT = "light",
40
+ LIGHT_MONO = "light_mono",
41
+ DARK_COLORED = "dark_colored"
42
+ }
43
+ export declare enum ButtonType {
44
+ BOOK = "book",
45
+ BUY = "buy",
46
+ CHECK_OUT = "check-out",
47
+ PAY = "pay",
48
+ PLAIN = "plain",
49
+ SUBSCRIBE = "subscribe"
50
+ }
51
+ export declare enum CHARGE_CODE {
52
+ SUCCESS = "000",
53
+ AUTHORIZED = "001",
54
+ IN_PROGRESS = "200"
55
+ }
56
+ export declare enum MerchantCapabilities {
57
+ Supports3DS = "supports3DS",
58
+ SupportsCredit = "supportsCredit",
59
+ SupportsDebit = "supportsDebit"
60
+ }
61
+ export declare enum SupportedNetworks {
62
+ Amex = "amex",
63
+ Mada = "mada",
64
+ MasterCard = "masterCard",
65
+ Visa = "visa",
66
+ ChinaUnionPay = "chinaUnionPay",
67
+ Discover = "discover",
68
+ Electron = "electron",
69
+ Jcb = "jcb",
70
+ Maestro = "maestro"
71
+ }
@@ -0,0 +1,83 @@
1
+ export var Locale;
2
+ (function (Locale) {
3
+ Locale["EN"] = "en";
4
+ Locale["AR"] = "ar";
5
+ Locale["DYNAMIC"] = "dynamic";
6
+ })(Locale || (Locale = {}));
7
+ export var ThemeMode;
8
+ (function (ThemeMode) {
9
+ ThemeMode["DARK"] = "dark";
10
+ ThemeMode["LIGHT"] = "light";
11
+ ThemeMode["DYNAMIC"] = "dynamic";
12
+ })(ThemeMode || (ThemeMode = {}));
13
+ export var Edges;
14
+ (function (Edges) {
15
+ Edges["STRAIGHT"] = "straight";
16
+ Edges["CURVED"] = "curved";
17
+ })(Edges || (Edges = {}));
18
+ export var ColorStyle;
19
+ (function (ColorStyle) {
20
+ ColorStyle["COLORED"] = "colored";
21
+ ColorStyle["MONOCHROME"] = "monochrome";
22
+ })(ColorStyle || (ColorStyle = {}));
23
+ export var Environment;
24
+ (function (Environment) {
25
+ Environment["Beta"] = "beta";
26
+ Environment["Staging"] = "staging";
27
+ Environment["Sandbox"] = "sandbox";
28
+ Environment["Production"] = "production";
29
+ Environment["Development"] = "development";
30
+ })(Environment || (Environment = {}));
31
+ export var Scope;
32
+ (function (Scope) {
33
+ Scope["CHARGE"] = "charge";
34
+ Scope["AUTHORIZE"] = "authorize";
35
+ Scope["TAP_TOKEN"] = "taptoken";
36
+ Scope["APPLE_PAY_TOKEN"] = "applepaytoken";
37
+ })(Scope || (Scope = {}));
38
+ export var ButtonStyle;
39
+ (function (ButtonStyle) {
40
+ ButtonStyle["Black"] = "black";
41
+ ButtonStyle["White"] = "white";
42
+ ButtonStyle["WhiteOutline"] = "white-outline";
43
+ })(ButtonStyle || (ButtonStyle = {}));
44
+ export var FullThemeMode;
45
+ (function (FullThemeMode) {
46
+ FullThemeMode["DARK"] = "dark";
47
+ FullThemeMode["LIGHT"] = "light";
48
+ FullThemeMode["LIGHT_MONO"] = "light_mono";
49
+ FullThemeMode["DARK_COLORED"] = "dark_colored";
50
+ })(FullThemeMode || (FullThemeMode = {}));
51
+ export var ButtonType;
52
+ (function (ButtonType) {
53
+ ButtonType["BOOK"] = "book";
54
+ ButtonType["BUY"] = "buy";
55
+ ButtonType["CHECK_OUT"] = "check-out";
56
+ ButtonType["PAY"] = "pay";
57
+ ButtonType["PLAIN"] = "plain";
58
+ ButtonType["SUBSCRIBE"] = "subscribe";
59
+ })(ButtonType || (ButtonType = {}));
60
+ export var CHARGE_CODE;
61
+ (function (CHARGE_CODE) {
62
+ CHARGE_CODE["SUCCESS"] = "000";
63
+ CHARGE_CODE["AUTHORIZED"] = "001";
64
+ CHARGE_CODE["IN_PROGRESS"] = "200";
65
+ })(CHARGE_CODE || (CHARGE_CODE = {}));
66
+ export var MerchantCapabilities;
67
+ (function (MerchantCapabilities) {
68
+ MerchantCapabilities["Supports3DS"] = "supports3DS";
69
+ MerchantCapabilities["SupportsCredit"] = "supportsCredit";
70
+ MerchantCapabilities["SupportsDebit"] = "supportsDebit";
71
+ })(MerchantCapabilities || (MerchantCapabilities = {}));
72
+ export var SupportedNetworks;
73
+ (function (SupportedNetworks) {
74
+ SupportedNetworks["Amex"] = "amex";
75
+ SupportedNetworks["Mada"] = "mada";
76
+ SupportedNetworks["MasterCard"] = "masterCard";
77
+ SupportedNetworks["Visa"] = "visa";
78
+ SupportedNetworks["ChinaUnionPay"] = "chinaUnionPay";
79
+ SupportedNetworks["Discover"] = "discover";
80
+ SupportedNetworks["Electron"] = "electron";
81
+ SupportedNetworks["Jcb"] = "jcb";
82
+ SupportedNetworks["Maestro"] = "maestro";
83
+ })(SupportedNetworks || (SupportedNetworks = {}));