@payrails/web-sdk 5.26.0 → 5.28.0
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/index.js +4 -4
- package/package.json +1 -1
- package/payrails-styles.css +36 -0
- package/payrails.d.ts +130 -8
- package/payrails.js +4 -4
package/package.json
CHANGED
package/payrails-styles.css
CHANGED
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
overflow: hidden;
|
|
92
92
|
border: 1px solid #888;
|
|
93
93
|
border-radius: 4px;
|
|
94
|
+
position: relative;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
#payrails-popup-background {
|
|
@@ -107,6 +108,41 @@
|
|
|
107
108
|
align-content: center;
|
|
108
109
|
}
|
|
109
110
|
|
|
111
|
+
#payrails-popup-cancel-button {
|
|
112
|
+
position: absolute;
|
|
113
|
+
top: 8px;
|
|
114
|
+
right: 8px;
|
|
115
|
+
width: 32px;
|
|
116
|
+
height: 32px;
|
|
117
|
+
background: none;
|
|
118
|
+
border: none;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
z-index: 1;
|
|
121
|
+
display: flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
justify-content: center;
|
|
124
|
+
border-radius: 50%;
|
|
125
|
+
transition: background-color 0.2s ease;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
#payrails-popup-cancel-button::before,
|
|
129
|
+
#payrails-popup-cancel-button::after {
|
|
130
|
+
content: '';
|
|
131
|
+
position: absolute;
|
|
132
|
+
width: 14px;
|
|
133
|
+
height: 2px;
|
|
134
|
+
transition: background-color 0.2s ease;
|
|
135
|
+
background-color: #667da6;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
#payrails-popup-cancel-button::before {
|
|
139
|
+
transform: rotate(45deg);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
#payrails-popup-cancel-button::after {
|
|
143
|
+
transform: rotate(-45deg);
|
|
144
|
+
}
|
|
145
|
+
|
|
110
146
|
#payrails-frame {
|
|
111
147
|
border: 0;
|
|
112
148
|
}
|
package/payrails.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ declare enum PAYMENT_METHOD_CODES {
|
|
|
7
7
|
'GOOGLE_PAY' = "googlePay",
|
|
8
8
|
'PAYPAL' = "payPal",
|
|
9
9
|
'APPLE_PAY' = "applePay",
|
|
10
|
-
'GENERIC_REDIRECT' = "genericRedirect"
|
|
10
|
+
'GENERIC_REDIRECT' = "genericRedirect",
|
|
11
|
+
'MERCADO_PAGO' = "mercadoPago",
|
|
12
|
+
'PIX' = "pix"
|
|
11
13
|
}
|
|
12
14
|
declare enum PAYMENT_INSTRUMENT_STATUS {
|
|
13
15
|
'ENABLED' = "enabled",
|
|
@@ -76,7 +78,7 @@ declare class WorkflowExecution {
|
|
|
76
78
|
static isAddressSelectorEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
|
|
77
79
|
static isPaymentInstallmentsEnabled(paymentMethod: PAYMENT_METHOD_CODES): boolean | undefined;
|
|
78
80
|
static getPaymentInstallmentOptions(paymentMethod: PAYMENT_METHOD_CODES): PaymentInstallmentsConfig;
|
|
79
|
-
|
|
81
|
+
static getStoredInstrumentForPaymentMethod<T = CardMetadata | PayPalMetadata>(paymentMethod: PAYMENT_METHOD_CODES): Array<StoredPaymentInstrument<T>>;
|
|
80
82
|
static getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
|
|
81
83
|
id: string;
|
|
82
84
|
description?: string;
|
|
@@ -305,7 +307,7 @@ declare enum RedactionType {
|
|
|
305
307
|
MASKED = "MASKED",
|
|
306
308
|
REDACTED = "REDACTED"
|
|
307
309
|
}
|
|
308
|
-
declare enum RequestMethod {
|
|
310
|
+
declare enum RequestMethod$1 {
|
|
309
311
|
GET = "GET",
|
|
310
312
|
POST = "POST",
|
|
311
313
|
PUT = "PUT",
|
|
@@ -503,7 +505,7 @@ declare class Skyflow {
|
|
|
503
505
|
static get ContainerType(): typeof ContainerType;
|
|
504
506
|
static get ElementType(): typeof ElementType$1;
|
|
505
507
|
static get RedactionType(): typeof RedactionType;
|
|
506
|
-
static get RequestMethod(): typeof RequestMethod;
|
|
508
|
+
static get RequestMethod(): typeof RequestMethod$1;
|
|
507
509
|
static get LogLevel(): typeof LogLevel;
|
|
508
510
|
static get EventName(): typeof EventName;
|
|
509
511
|
static get Env(): typeof Env;
|
|
@@ -871,14 +873,40 @@ declare class CardList extends PayrailsElement {
|
|
|
871
873
|
reset(): void;
|
|
872
874
|
}
|
|
873
875
|
|
|
874
|
-
interface
|
|
875
|
-
|
|
876
|
-
|
|
876
|
+
interface SdkConfiguration {
|
|
877
|
+
token: string;
|
|
878
|
+
amount: PayrailsAmount;
|
|
879
|
+
holderReference: string;
|
|
880
|
+
links?: {
|
|
881
|
+
binLookup?: Links;
|
|
882
|
+
instrumentDelete?: Links;
|
|
883
|
+
instrumentUpdate?: Links;
|
|
884
|
+
};
|
|
885
|
+
vaultConfiguration: {
|
|
886
|
+
cardTableName: string;
|
|
887
|
+
token: string;
|
|
888
|
+
vaultId: string;
|
|
889
|
+
vaultUrl: string;
|
|
890
|
+
providerId: string;
|
|
891
|
+
providerConfigId: string;
|
|
892
|
+
vaultType: 'Payrails' | 'Test';
|
|
893
|
+
encryptionPublicKey?: string;
|
|
894
|
+
links: {
|
|
895
|
+
saveInstrument: {
|
|
896
|
+
href: string;
|
|
897
|
+
};
|
|
898
|
+
};
|
|
899
|
+
};
|
|
900
|
+
execution?: WorkflowExecutionResponse;
|
|
877
901
|
}
|
|
878
902
|
interface PayrailsAmount {
|
|
879
903
|
value: string;
|
|
880
904
|
currency: string;
|
|
881
905
|
}
|
|
906
|
+
interface Links {
|
|
907
|
+
method: 'GET' | 'POST';
|
|
908
|
+
href: string;
|
|
909
|
+
}
|
|
882
910
|
|
|
883
911
|
interface ReturnInfo {
|
|
884
912
|
success?: string;
|
|
@@ -941,7 +969,8 @@ declare enum AuthorizationFailureReasons {
|
|
|
941
969
|
VALIDATION_FAILED = "VALIDATION_FAILED",
|
|
942
970
|
AUTHORIZATION_ERROR = "AUTHORIZATION_ERROR",
|
|
943
971
|
AUTHENTICATION_ERROR = "AUTHENTICATION_ERROR",
|
|
944
|
-
UNKNOWN_ERROR = "UNKNOWN_ERROR"
|
|
972
|
+
UNKNOWN_ERROR = "UNKNOWN_ERROR",
|
|
973
|
+
USER_CANCELLED = "USER_CANCELLED"
|
|
945
974
|
}
|
|
946
975
|
|
|
947
976
|
interface AuthFailedMsgOptions {
|
|
@@ -1257,6 +1286,74 @@ interface ContainerStyles {
|
|
|
1257
1286
|
styles?: Partial<CSSStyleDeclaration>;
|
|
1258
1287
|
}
|
|
1259
1288
|
|
|
1289
|
+
declare enum RequestMethod {
|
|
1290
|
+
GET = "GET",
|
|
1291
|
+
POST = "POST",
|
|
1292
|
+
DELETE = "DELETE",
|
|
1293
|
+
PATCH = "PATCH"
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
type Operations = {
|
|
1297
|
+
deleteInstrument: OperationConfig<void, DeleteInstrumentResponse>;
|
|
1298
|
+
updateInstrument: OperationConfig<UpdateInstrumentBody, UpdateInstrumentResponse>;
|
|
1299
|
+
};
|
|
1300
|
+
interface UpdateInstrumentBody {
|
|
1301
|
+
status?: 'enabled' | 'disabled';
|
|
1302
|
+
networkTransactionReference?: string;
|
|
1303
|
+
merchantReference?: string;
|
|
1304
|
+
paymentMethod?: 'applepay' | 'card' | 'googlepay' | 'paypal';
|
|
1305
|
+
default?: boolean;
|
|
1306
|
+
}
|
|
1307
|
+
interface UpdateInstrumentResponse {
|
|
1308
|
+
id: string;
|
|
1309
|
+
createdAt: string;
|
|
1310
|
+
holderId: string;
|
|
1311
|
+
paymentMethod: PAYMENT_METHOD_CODES;
|
|
1312
|
+
status: PAYMENT_INSTRUMENT_STATUS;
|
|
1313
|
+
data: {
|
|
1314
|
+
bin?: string;
|
|
1315
|
+
binLookup?: {
|
|
1316
|
+
bin?: string;
|
|
1317
|
+
network?: string;
|
|
1318
|
+
issuer?: string;
|
|
1319
|
+
issuerCountry?: {
|
|
1320
|
+
code?: string;
|
|
1321
|
+
name?: string;
|
|
1322
|
+
iso3?: string;
|
|
1323
|
+
};
|
|
1324
|
+
type?: string;
|
|
1325
|
+
};
|
|
1326
|
+
holderName?: string;
|
|
1327
|
+
network?: string;
|
|
1328
|
+
suffix?: string;
|
|
1329
|
+
expiryMonth?: string;
|
|
1330
|
+
expiryYear?: string;
|
|
1331
|
+
};
|
|
1332
|
+
fingerprint?: string;
|
|
1333
|
+
futureUsage?: string;
|
|
1334
|
+
}
|
|
1335
|
+
interface DeleteInstrumentResponse {
|
|
1336
|
+
success: boolean;
|
|
1337
|
+
}
|
|
1338
|
+
type RequestCreator<TReq, TOperation extends keyof Operations> = (config: ApiConfig<TReq> & {
|
|
1339
|
+
operation: TOperation;
|
|
1340
|
+
}) => {
|
|
1341
|
+
url: string;
|
|
1342
|
+
body?: TReq;
|
|
1343
|
+
};
|
|
1344
|
+
interface OperationConfig<TReq, TRes> {
|
|
1345
|
+
linkKey: keyof NonNullable<SdkConfiguration['links']>;
|
|
1346
|
+
method: RequestMethod;
|
|
1347
|
+
createRequest: RequestCreator<TReq, keyof Operations>;
|
|
1348
|
+
requestType: TReq;
|
|
1349
|
+
responseType: TRes;
|
|
1350
|
+
}
|
|
1351
|
+
interface ApiConfig<TReq> {
|
|
1352
|
+
operation: keyof Operations;
|
|
1353
|
+
resourceId?: string;
|
|
1354
|
+
body?: TReq;
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1260
1357
|
declare class SdkLoader {
|
|
1261
1358
|
private static readonly scriptMap;
|
|
1262
1359
|
static load<T = void>(sdk: ThirdPartySDK, params?: PayPalScriptConfig): Promise<T>;
|
|
@@ -1279,6 +1376,27 @@ declare enum ThirdPartySDK {
|
|
|
1279
1376
|
PayPal = "paypal-sdk"
|
|
1280
1377
|
}
|
|
1281
1378
|
|
|
1379
|
+
interface QueryDefinition<T> {
|
|
1380
|
+
path: string[];
|
|
1381
|
+
returnType: T;
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
interface ConfigurationQueryTypes {
|
|
1385
|
+
holderReference: QueryDefinition<string>;
|
|
1386
|
+
amount: QueryDefinition<PayrailsAmount>;
|
|
1387
|
+
binLookup: QueryDefinition<Links | undefined>;
|
|
1388
|
+
instrumentDelete: QueryDefinition<Links | undefined>;
|
|
1389
|
+
instrumentUpdate: QueryDefinition<Links | undefined>;
|
|
1390
|
+
executionId: QueryDefinition<string | undefined>;
|
|
1391
|
+
paymentMethodConfig: QueryDefinition<StorablePaymentCompositionOption | undefined>;
|
|
1392
|
+
paymentMethodInstruments: QueryDefinition<StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined>;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
interface InitOptions {
|
|
1396
|
+
version: string;
|
|
1397
|
+
data: string;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1282
1400
|
interface PayrailsClientOptions {
|
|
1283
1401
|
environment?: PayrailsEnvironment;
|
|
1284
1402
|
events?: ClientEvents;
|
|
@@ -1313,6 +1431,10 @@ declare class Payrails {
|
|
|
1313
1431
|
getSavedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
|
|
1314
1432
|
getSavedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1315
1433
|
getSavedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
|
|
1434
|
+
query<K extends keyof ConfigurationQueryTypes>(key: K, params?: Record<string, any>): ConfigurationQueryTypes[K]['returnType'] | null;
|
|
1435
|
+
api<TOperation extends keyof Operations>(config: ApiConfig<Operations[TOperation]['requestType']> & {
|
|
1436
|
+
operation: TOperation;
|
|
1437
|
+
}): Promise<Operations[TOperation]['responseType']>;
|
|
1316
1438
|
getStoredInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
|
|
1317
1439
|
getAvailablePaymentMethods(): PAYMENT_METHOD_CODES[];
|
|
1318
1440
|
paymentButton(options: CardPaymentButtonOptions): CardPaymentButton;
|