@rebilly/instruments 7.6.0 → 8.1.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/CHANGELOG.md +18 -0
- package/dist/index.js +98 -29
- package/dist/index.min.js +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [8.1.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v8.0.0...instruments/core-v8.1.0) (2023-11-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **rebilly-js-sdk:** Add resources for KYC face liveness session ([#2335](https://github.com/Rebilly/rebilly/issues/2335)) ([26b4280](https://github.com/Rebilly/rebilly/commit/26b4280fc09441e777873d5027ed680bb5ca70a8))
|
|
7
|
+
|
|
8
|
+
## [8.0.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v7.6.0...instruments/core-v8.0.0) (2023-11-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### ⚠ BREAKING CHANGES
|
|
12
|
+
|
|
13
|
+
* **instruments:** Rename feature flags (#2275)
|
|
14
|
+
|
|
15
|
+
### Refactors
|
|
16
|
+
|
|
17
|
+
* **instruments:** Rename feature flags ([#2275](https://github.com/Rebilly/rebilly/issues/2275)) ([7cbef64](https://github.com/Rebilly/rebilly/commit/7cbef64a69cbb7c1da39148858d2fc85c8fd58e9))
|
|
18
|
+
|
|
1
19
|
## [7.6.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v7.5.1...instruments/core-v7.6.0) (2023-11-15)
|
|
2
20
|
|
|
3
21
|
|
package/dist/index.js
CHANGED
|
@@ -5628,7 +5628,9 @@ class Collection {
|
|
|
5628
5628
|
this[header] = value ? Number(value) : null;
|
|
5629
5629
|
});
|
|
5630
5630
|
this.response = { status, statusText, headers };
|
|
5631
|
-
this.items = data.map(
|
|
5631
|
+
this.items = data.map(
|
|
5632
|
+
(member) => new Member({ data: member, status, statusText, headers })
|
|
5633
|
+
);
|
|
5632
5634
|
this.config = config;
|
|
5633
5635
|
deepFreeze(this, { exclude: ["cancelToken"] });
|
|
5634
5636
|
}
|
|
@@ -5645,7 +5647,12 @@ class File {
|
|
|
5645
5647
|
}
|
|
5646
5648
|
class RebillyError extends Error {
|
|
5647
5649
|
constructor({ error: error2, name = null }) {
|
|
5648
|
-
let {
|
|
5650
|
+
let {
|
|
5651
|
+
config = null,
|
|
5652
|
+
response = null,
|
|
5653
|
+
request = null,
|
|
5654
|
+
message = null
|
|
5655
|
+
} = error2;
|
|
5649
5656
|
let errorMessage = message || "Request Error";
|
|
5650
5657
|
if (response && response.data && response.data.error) {
|
|
5651
5658
|
errorMessage = response.data.error;
|
|
@@ -5975,7 +5982,7 @@ function cloneArrayDeep(val, instanceClone) {
|
|
|
5975
5982
|
return res;
|
|
5976
5983
|
}
|
|
5977
5984
|
var cloneDeep_1 = cloneDeep;
|
|
5978
|
-
const version = "
|
|
5985
|
+
const version = "55.0.0";
|
|
5979
5986
|
let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
5980
5987
|
let nanoid = (size2 = 21) => {
|
|
5981
5988
|
let id2 = "";
|
|
@@ -5992,7 +5999,9 @@ class CachedRequest {
|
|
|
5992
5999
|
this.cancelSource = axios$1.CancelToken.source();
|
|
5993
6000
|
this.cancel = this.cancelSource.cancel;
|
|
5994
6001
|
this.cancelToken = this.cancelSource.token;
|
|
5995
|
-
deepFreeze(this, {
|
|
6002
|
+
deepFreeze(this, {
|
|
6003
|
+
exclude: ["cancelSource", "cancelToken", "cancel"]
|
|
6004
|
+
});
|
|
5996
6005
|
}
|
|
5997
6006
|
}
|
|
5998
6007
|
class RequestsCache {
|
|
@@ -6122,21 +6131,33 @@ function createApiHandler({ options }) {
|
|
|
6122
6131
|
}
|
|
6123
6132
|
function addInterceptor(type2, { thenDelegate, catchDelegate = () => {
|
|
6124
6133
|
} }) {
|
|
6125
|
-
return isInterceptorType(type2) && instance.interceptors[interceptorTypes[type2]].use(
|
|
6134
|
+
return isInterceptorType(type2) && instance.interceptors[interceptorTypes[type2]].use(
|
|
6135
|
+
thenDelegate,
|
|
6136
|
+
catchDelegate
|
|
6137
|
+
);
|
|
6126
6138
|
}
|
|
6127
6139
|
function removeInterceptor(type2, interceptor) {
|
|
6128
6140
|
return isInterceptorType(type2) && instance.interceptors[interceptorTypes[type2]].eject(interceptor);
|
|
6129
6141
|
}
|
|
6130
6142
|
function addRequestInterceptor({ thenDelegate, catchDelegate = () => {
|
|
6131
6143
|
} }) {
|
|
6132
|
-
return addInterceptor(interceptorTypes.request, {
|
|
6144
|
+
return addInterceptor(interceptorTypes.request, {
|
|
6145
|
+
thenDelegate,
|
|
6146
|
+
catchDelegate
|
|
6147
|
+
});
|
|
6133
6148
|
}
|
|
6134
6149
|
function removeRequestInterceptor(interceptor) {
|
|
6135
6150
|
removeInterceptor(interceptorTypes.request, interceptor);
|
|
6136
6151
|
}
|
|
6137
|
-
function addResponseInterceptor({
|
|
6138
|
-
|
|
6139
|
-
|
|
6152
|
+
function addResponseInterceptor({
|
|
6153
|
+
thenDelegate,
|
|
6154
|
+
catchDelegate = () => {
|
|
6155
|
+
}
|
|
6156
|
+
}) {
|
|
6157
|
+
return addInterceptor(interceptorTypes.response, {
|
|
6158
|
+
thenDelegate,
|
|
6159
|
+
catchDelegate
|
|
6160
|
+
});
|
|
6140
6161
|
}
|
|
6141
6162
|
function removeResponseInterceptor(interceptor) {
|
|
6142
6163
|
removeInterceptor(interceptorTypes.response, interceptor);
|
|
@@ -6148,7 +6169,11 @@ function createApiHandler({ options }) {
|
|
|
6148
6169
|
const handler = async function() {
|
|
6149
6170
|
try {
|
|
6150
6171
|
const response = await request(cleanedConfig);
|
|
6151
|
-
return processResponse({
|
|
6172
|
+
return processResponse({
|
|
6173
|
+
response,
|
|
6174
|
+
isCollection,
|
|
6175
|
+
config: cleanedConfig
|
|
6176
|
+
});
|
|
6152
6177
|
} catch (error2) {
|
|
6153
6178
|
return processError({ error: error2, config: cleanedConfig });
|
|
6154
6179
|
} finally {
|
|
@@ -6192,7 +6217,9 @@ function createApiHandler({ options }) {
|
|
|
6192
6217
|
}
|
|
6193
6218
|
function cleanUpParameters(configuration) {
|
|
6194
6219
|
if (configuration.params !== void 0) {
|
|
6195
|
-
configuration.params = Object.keys(configuration.params).filter(
|
|
6220
|
+
configuration.params = Object.keys(configuration.params).filter(
|
|
6221
|
+
(key) => configuration.params[key] !== null && configuration.params[key] !== ""
|
|
6222
|
+
).reduce((cleaned, key) => {
|
|
6196
6223
|
cleaned[key] = configuration.params[key];
|
|
6197
6224
|
return cleaned;
|
|
6198
6225
|
}, {});
|
|
@@ -6262,7 +6289,9 @@ function createApiHandler({ options }) {
|
|
|
6262
6289
|
try {
|
|
6263
6290
|
const item = await get2(url);
|
|
6264
6291
|
if (item.response.status === 200) {
|
|
6265
|
-
throw new Errors.RebillyConflictError({
|
|
6292
|
+
throw new Errors.RebillyConflictError({
|
|
6293
|
+
message: "A resource already exists with this ID. Please use a different ID."
|
|
6294
|
+
});
|
|
6266
6295
|
}
|
|
6267
6296
|
} catch (error2) {
|
|
6268
6297
|
if (error2.name === "RebillyNotFoundError") {
|
|
@@ -7369,7 +7398,7 @@ function IntegrationsResource({ apiHandler }) {
|
|
|
7369
7398
|
}
|
|
7370
7399
|
};
|
|
7371
7400
|
}
|
|
7372
|
-
const pdfHeader = {
|
|
7401
|
+
const pdfHeader = { Accept: "application/pdf" };
|
|
7373
7402
|
function InvoicesResource$1({ apiHandler }) {
|
|
7374
7403
|
return {
|
|
7375
7404
|
getAll({
|
|
@@ -9204,6 +9233,19 @@ function KycDocumentsResource({ apiHandler }) {
|
|
|
9204
9233
|
}
|
|
9205
9234
|
};
|
|
9206
9235
|
}
|
|
9236
|
+
function KycLivenessSessionsResource({ apiHandler }) {
|
|
9237
|
+
return {
|
|
9238
|
+
create({ data }) {
|
|
9239
|
+
return apiHandler.post(`kyc-liveness-sessions`, data);
|
|
9240
|
+
},
|
|
9241
|
+
get({ id: id2 }) {
|
|
9242
|
+
return apiHandler.get(`kyc-liveness-sessions/${id2}`);
|
|
9243
|
+
},
|
|
9244
|
+
finish({ id: id2 }) {
|
|
9245
|
+
return apiHandler.post(`kyc-liveness-sessions/${id2}/finish`);
|
|
9246
|
+
}
|
|
9247
|
+
};
|
|
9248
|
+
}
|
|
9207
9249
|
function KycRequestsResource({ apiHandler }) {
|
|
9208
9250
|
return {
|
|
9209
9251
|
get({ id: id2, expand = null }) {
|
|
@@ -9409,6 +9451,7 @@ class StorefrontApiInstance {
|
|
|
9409
9451
|
this.depositStrategies = DepositStrategiesResource({ apiHandler });
|
|
9410
9452
|
this.invoices = InvoicesResource({ apiHandler });
|
|
9411
9453
|
this.kycDocuments = KycDocumentsResource({ apiHandler });
|
|
9454
|
+
this.kycLivenessSessions = KycLivenessSessionsResource({ apiHandler });
|
|
9412
9455
|
this.kycRequests = KycRequestsResource({ apiHandler });
|
|
9413
9456
|
this.orders = OrdersResource({ apiHandler });
|
|
9414
9457
|
this.paymentInstruments = PaymentInstrumentsResource({ apiHandler });
|
|
@@ -9456,10 +9499,14 @@ function RebillyAPI({
|
|
|
9456
9499
|
urls = baseEndpoints
|
|
9457
9500
|
} = {}) {
|
|
9458
9501
|
if (!urls.live || !urls.sandbox) {
|
|
9459
|
-
throw new Error(
|
|
9502
|
+
throw new Error(
|
|
9503
|
+
"RebillyAPI urls config must include a key for both `live` and `sandbox`"
|
|
9504
|
+
);
|
|
9460
9505
|
}
|
|
9461
9506
|
if (typeof urls.live !== "string" || typeof urls.sandbox !== "string") {
|
|
9462
|
-
throw new Error(
|
|
9507
|
+
throw new Error(
|
|
9508
|
+
"RebillyAPI urls config `live` and `sandbox` must be strings"
|
|
9509
|
+
);
|
|
9463
9510
|
}
|
|
9464
9511
|
const options = {
|
|
9465
9512
|
apiEndpoints: urls,
|
|
@@ -9473,12 +9520,22 @@ function RebillyAPI({
|
|
|
9473
9520
|
const apiHandler = createApiHandler({ options });
|
|
9474
9521
|
return createApiInstance({ apiHandler });
|
|
9475
9522
|
}
|
|
9476
|
-
function RebillyExperimentalAPI({
|
|
9523
|
+
function RebillyExperimentalAPI({
|
|
9524
|
+
apiKey = null,
|
|
9525
|
+
sandbox = false,
|
|
9526
|
+
timeout = baseTimeoutMs,
|
|
9527
|
+
organizationId = null,
|
|
9528
|
+
urls = baseEndpoints
|
|
9529
|
+
} = {}) {
|
|
9477
9530
|
if (!urls.live || !urls.sandbox) {
|
|
9478
|
-
throw new Error(
|
|
9531
|
+
throw new Error(
|
|
9532
|
+
"RebillyAPI urls config must include a key for both `live` and `sandbox`"
|
|
9533
|
+
);
|
|
9479
9534
|
}
|
|
9480
9535
|
if (typeof urls.live !== "string" || typeof urls.sandbox !== "string") {
|
|
9481
|
-
throw new Error(
|
|
9536
|
+
throw new Error(
|
|
9537
|
+
"RebillyAPI urls config `live` and `sandbox` must be strings"
|
|
9538
|
+
);
|
|
9482
9539
|
}
|
|
9483
9540
|
const options = {
|
|
9484
9541
|
apiEndpoints: urls,
|
|
@@ -9492,12 +9549,23 @@ function RebillyExperimentalAPI({ apiKey = null, sandbox = false, timeout = base
|
|
|
9492
9549
|
const apiHandler = createApiHandler({ options });
|
|
9493
9550
|
return createExperimentalApiInstance({ apiHandler });
|
|
9494
9551
|
}
|
|
9495
|
-
function RebillyStorefrontAPI({
|
|
9552
|
+
function RebillyStorefrontAPI({
|
|
9553
|
+
publishableKey = null,
|
|
9554
|
+
jwt = null,
|
|
9555
|
+
sandbox = false,
|
|
9556
|
+
timeout = baseTimeoutMs,
|
|
9557
|
+
organizationId = null,
|
|
9558
|
+
urls = baseEndpoints
|
|
9559
|
+
} = {}) {
|
|
9496
9560
|
if (!urls.live || !urls.sandbox) {
|
|
9497
|
-
throw new Error(
|
|
9561
|
+
throw new Error(
|
|
9562
|
+
"RebillyAPI urls config must include a key for both `live` and `sandbox`"
|
|
9563
|
+
);
|
|
9498
9564
|
}
|
|
9499
9565
|
if (typeof urls.live !== "string" || typeof urls.sandbox !== "string") {
|
|
9500
|
-
throw new Error(
|
|
9566
|
+
throw new Error(
|
|
9567
|
+
"RebillyAPI urls config `live` and `sandbox` must be strings"
|
|
9568
|
+
);
|
|
9501
9569
|
}
|
|
9502
9570
|
const options = {
|
|
9503
9571
|
apiEndpoints: urls,
|
|
@@ -22812,13 +22880,13 @@ const featuresSchema = {
|
|
|
22812
22880
|
type: "boolean",
|
|
22813
22881
|
default: true
|
|
22814
22882
|
}),
|
|
22815
|
-
|
|
22883
|
+
hideConfirmation: optional({
|
|
22816
22884
|
type: "boolean",
|
|
22817
|
-
default:
|
|
22885
|
+
default: false
|
|
22818
22886
|
}),
|
|
22819
|
-
|
|
22887
|
+
hideResult: optional({
|
|
22820
22888
|
type: "boolean",
|
|
22821
|
-
default:
|
|
22889
|
+
default: false
|
|
22822
22890
|
}),
|
|
22823
22891
|
fullPageRedirect: optional({
|
|
22824
22892
|
type: "boolean",
|
|
@@ -23066,7 +23134,7 @@ function handleComputedProperty(options) {
|
|
|
23066
23134
|
var _a;
|
|
23067
23135
|
return Object.assign({}, options, {
|
|
23068
23136
|
_computed: {
|
|
23069
|
-
version: "
|
|
23137
|
+
version: "8.0.0",
|
|
23070
23138
|
paymentMethodsUrl: ((_a = options._dev) == null ? void 0 : _a.paymentMethodsUrl) ?? "https://forms.secure-payments.app"
|
|
23071
23139
|
}
|
|
23072
23140
|
});
|
|
@@ -24332,6 +24400,7 @@ const properties = {
|
|
|
24332
24400
|
inputBorder: {
|
|
24333
24401
|
fallback: {
|
|
24334
24402
|
type: "func",
|
|
24403
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24335
24404
|
value: (theme2) => `1px solid ${darken(theme2.colorMutedBorder, 4)}`
|
|
24336
24405
|
}
|
|
24337
24406
|
},
|
|
@@ -26045,7 +26114,7 @@ function showResult({
|
|
|
26045
26114
|
}
|
|
26046
26115
|
const setupUserFlow = ({ state: state2 = {} }) => {
|
|
26047
26116
|
var _a, _b, _c, _d;
|
|
26048
|
-
if ((_b = (_a = state2.options) == null ? void 0 : _a.features) == null ? void 0 : _b.
|
|
26117
|
+
if (!((_b = (_a = state2 == null ? void 0 : state2.options) == null ? void 0 : _a.features) == null ? void 0 : _b.hideConfirmation)) {
|
|
26049
26118
|
on({
|
|
26050
26119
|
eventName: "instrument-ready",
|
|
26051
26120
|
callback: (payload) => {
|
|
@@ -26071,7 +26140,7 @@ const setupUserFlow = ({ state: state2 = {} }) => {
|
|
|
26071
26140
|
}
|
|
26072
26141
|
});
|
|
26073
26142
|
}
|
|
26074
|
-
if ((_d = (_c = state2.options) == null ? void 0 : _c.features) == null ? void 0 : _d.
|
|
26143
|
+
if (!((_d = (_c = state2 == null ? void 0 : state2.options) == null ? void 0 : _c.features) == null ? void 0 : _d.hideResult)) {
|
|
26075
26144
|
on({
|
|
26076
26145
|
eventName: "purchase-completed",
|
|
26077
26146
|
callback: (payload) => {
|
|
@@ -26214,7 +26283,7 @@ class RebillyInstrumentsInstance {
|
|
|
26214
26283
|
await show({ componentName, payload });
|
|
26215
26284
|
}
|
|
26216
26285
|
get version() {
|
|
26217
|
-
return `RebillyInstruments Ver.${"
|
|
26286
|
+
return `RebillyInstruments Ver.${"8.0.0"}`;
|
|
26218
26287
|
}
|
|
26219
26288
|
on(eventName, callback) {
|
|
26220
26289
|
on({ eventName, callback });
|