@rebilly/instruments 7.5.1 → 8.0.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 +103 -33
- package/dist/index.min.js +4 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## [8.0.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v7.6.0...instruments/core-v8.0.0) (2023-11-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### ⚠ BREAKING CHANGES
|
|
5
|
+
|
|
6
|
+
* **instruments:** Rename feature flags (#2275)
|
|
7
|
+
|
|
8
|
+
### Refactors
|
|
9
|
+
|
|
10
|
+
* **instruments:** Rename feature flags ([#2275](https://github.com/Rebilly/rebilly/issues/2275)) ([7cbef64](https://github.com/Rebilly/rebilly/commit/7cbef64a69cbb7c1da39148858d2fc85c8fd58e9))
|
|
11
|
+
|
|
12
|
+
## [7.6.0](https://github.com/Rebilly/rebilly/compare/instruments/core-v7.5.1...instruments/core-v7.6.0) (2023-11-15)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **instruments:** Remove use of `storefrontEnabled` ([#2192](https://github.com/Rebilly/rebilly/issues/2192)) ([addec11](https://github.com/Rebilly/rebilly/commit/addec115c7d78cd70b44b695a82387f179d644cd))
|
|
18
|
+
|
|
1
19
|
## [7.5.1](https://github.com/Rebilly/rebilly/compare/instruments/core-v7.5.0...instruments/core-v7.5.1) (2023-11-14)
|
|
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 = "54.4.
|
|
5985
|
+
const version = "54.4.2";
|
|
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({
|
|
@@ -9456,10 +9485,14 @@ function RebillyAPI({
|
|
|
9456
9485
|
urls = baseEndpoints
|
|
9457
9486
|
} = {}) {
|
|
9458
9487
|
if (!urls.live || !urls.sandbox) {
|
|
9459
|
-
throw new Error(
|
|
9488
|
+
throw new Error(
|
|
9489
|
+
"RebillyAPI urls config must include a key for both `live` and `sandbox`"
|
|
9490
|
+
);
|
|
9460
9491
|
}
|
|
9461
9492
|
if (typeof urls.live !== "string" || typeof urls.sandbox !== "string") {
|
|
9462
|
-
throw new Error(
|
|
9493
|
+
throw new Error(
|
|
9494
|
+
"RebillyAPI urls config `live` and `sandbox` must be strings"
|
|
9495
|
+
);
|
|
9463
9496
|
}
|
|
9464
9497
|
const options = {
|
|
9465
9498
|
apiEndpoints: urls,
|
|
@@ -9473,12 +9506,22 @@ function RebillyAPI({
|
|
|
9473
9506
|
const apiHandler = createApiHandler({ options });
|
|
9474
9507
|
return createApiInstance({ apiHandler });
|
|
9475
9508
|
}
|
|
9476
|
-
function RebillyExperimentalAPI({
|
|
9509
|
+
function RebillyExperimentalAPI({
|
|
9510
|
+
apiKey = null,
|
|
9511
|
+
sandbox = false,
|
|
9512
|
+
timeout = baseTimeoutMs,
|
|
9513
|
+
organizationId = null,
|
|
9514
|
+
urls = baseEndpoints
|
|
9515
|
+
} = {}) {
|
|
9477
9516
|
if (!urls.live || !urls.sandbox) {
|
|
9478
|
-
throw new Error(
|
|
9517
|
+
throw new Error(
|
|
9518
|
+
"RebillyAPI urls config must include a key for both `live` and `sandbox`"
|
|
9519
|
+
);
|
|
9479
9520
|
}
|
|
9480
9521
|
if (typeof urls.live !== "string" || typeof urls.sandbox !== "string") {
|
|
9481
|
-
throw new Error(
|
|
9522
|
+
throw new Error(
|
|
9523
|
+
"RebillyAPI urls config `live` and `sandbox` must be strings"
|
|
9524
|
+
);
|
|
9482
9525
|
}
|
|
9483
9526
|
const options = {
|
|
9484
9527
|
apiEndpoints: urls,
|
|
@@ -9492,12 +9535,23 @@ function RebillyExperimentalAPI({ apiKey = null, sandbox = false, timeout = base
|
|
|
9492
9535
|
const apiHandler = createApiHandler({ options });
|
|
9493
9536
|
return createExperimentalApiInstance({ apiHandler });
|
|
9494
9537
|
}
|
|
9495
|
-
function RebillyStorefrontAPI({
|
|
9538
|
+
function RebillyStorefrontAPI({
|
|
9539
|
+
publishableKey = null,
|
|
9540
|
+
jwt = null,
|
|
9541
|
+
sandbox = false,
|
|
9542
|
+
timeout = baseTimeoutMs,
|
|
9543
|
+
organizationId = null,
|
|
9544
|
+
urls = baseEndpoints
|
|
9545
|
+
} = {}) {
|
|
9496
9546
|
if (!urls.live || !urls.sandbox) {
|
|
9497
|
-
throw new Error(
|
|
9547
|
+
throw new Error(
|
|
9548
|
+
"RebillyAPI urls config must include a key for both `live` and `sandbox`"
|
|
9549
|
+
);
|
|
9498
9550
|
}
|
|
9499
9551
|
if (typeof urls.live !== "string" || typeof urls.sandbox !== "string") {
|
|
9500
|
-
throw new Error(
|
|
9552
|
+
throw new Error(
|
|
9553
|
+
"RebillyAPI urls config `live` and `sandbox` must be strings"
|
|
9554
|
+
);
|
|
9501
9555
|
}
|
|
9502
9556
|
const options = {
|
|
9503
9557
|
apiEndpoints: urls,
|
|
@@ -13896,17 +13950,32 @@ function filterReadyToPay(readyToPay) {
|
|
|
13896
13950
|
const paymentMethodsMetadata = [...paymentMethods];
|
|
13897
13951
|
const EXPRESS_METHODS = ["Google Pay", "Apple Pay", "paypal"];
|
|
13898
13952
|
const BLOCKED_METHODS = [
|
|
13899
|
-
//
|
|
13953
|
+
// Requires implementation.
|
|
13900
13954
|
"echeck",
|
|
13955
|
+
// Required unique implementation
|
|
13956
|
+
// account number, routing number, and account type required
|
|
13957
|
+
"Khelocard",
|
|
13901
13958
|
// payment instrument is required
|
|
13902
13959
|
// card number is required
|
|
13903
13960
|
// card cvv is required
|
|
13904
13961
|
// expiration month is required
|
|
13905
13962
|
// expiration year is required
|
|
13906
|
-
"
|
|
13963
|
+
"Klarna",
|
|
13907
13964
|
// Klarna authorization token is required
|
|
13908
13965
|
// Klarna session ID is required
|
|
13909
|
-
|
|
13966
|
+
// Methods to ignore
|
|
13967
|
+
"Apple Pay",
|
|
13968
|
+
// Apple Pay should be used only from payment-card method
|
|
13969
|
+
"China UnionPay",
|
|
13970
|
+
// China UnionPay should not be used
|
|
13971
|
+
"Google Pay",
|
|
13972
|
+
// Google Pay should be used only from payment-card method
|
|
13973
|
+
"KakaoPay",
|
|
13974
|
+
// KakaoPay is unimplemented digital wallet
|
|
13975
|
+
"Payco",
|
|
13976
|
+
// Payco is unimplemented digital wallet
|
|
13977
|
+
"Samsung Pay"
|
|
13978
|
+
// Samsung Pay is unimplemented digital wallet
|
|
13910
13979
|
];
|
|
13911
13980
|
const isExpressMethod = ({ method, feature }) => EXPRESS_METHODS.includes(method) || EXPRESS_METHODS.includes(feature == null ? void 0 : feature.name);
|
|
13912
13981
|
return readyToPay.filter((readyData) => {
|
|
@@ -13924,7 +13993,7 @@ function filterReadyToPay(readyToPay) {
|
|
|
13924
13993
|
metadata: metadata2,
|
|
13925
13994
|
...fields
|
|
13926
13995
|
});
|
|
13927
|
-
})
|
|
13996
|
+
});
|
|
13928
13997
|
}
|
|
13929
13998
|
async function fetchReadyToPay() {
|
|
13930
13999
|
return Endpoint(async () => {
|
|
@@ -22797,13 +22866,13 @@ const featuresSchema = {
|
|
|
22797
22866
|
type: "boolean",
|
|
22798
22867
|
default: true
|
|
22799
22868
|
}),
|
|
22800
|
-
|
|
22869
|
+
hideConfirmation: optional({
|
|
22801
22870
|
type: "boolean",
|
|
22802
|
-
default:
|
|
22871
|
+
default: false
|
|
22803
22872
|
}),
|
|
22804
|
-
|
|
22873
|
+
hideResult: optional({
|
|
22805
22874
|
type: "boolean",
|
|
22806
|
-
default:
|
|
22875
|
+
default: false
|
|
22807
22876
|
}),
|
|
22808
22877
|
fullPageRedirect: optional({
|
|
22809
22878
|
type: "boolean",
|
|
@@ -23051,7 +23120,7 @@ function handleComputedProperty(options) {
|
|
|
23051
23120
|
var _a;
|
|
23052
23121
|
return Object.assign({}, options, {
|
|
23053
23122
|
_computed: {
|
|
23054
|
-
version: "7.
|
|
23123
|
+
version: "7.6.0",
|
|
23055
23124
|
paymentMethodsUrl: ((_a = options._dev) == null ? void 0 : _a.paymentMethodsUrl) ?? "https://forms.secure-payments.app"
|
|
23056
23125
|
}
|
|
23057
23126
|
});
|
|
@@ -24317,6 +24386,7 @@ const properties = {
|
|
|
24317
24386
|
inputBorder: {
|
|
24318
24387
|
fallback: {
|
|
24319
24388
|
type: "func",
|
|
24389
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24320
24390
|
value: (theme2) => `1px solid ${darken(theme2.colorMutedBorder, 4)}`
|
|
24321
24391
|
}
|
|
24322
24392
|
},
|
|
@@ -26030,7 +26100,7 @@ function showResult({
|
|
|
26030
26100
|
}
|
|
26031
26101
|
const setupUserFlow = ({ state: state2 = {} }) => {
|
|
26032
26102
|
var _a, _b, _c, _d;
|
|
26033
|
-
if ((_b = (_a = state2.options) == null ? void 0 : _a.features) == null ? void 0 : _b.
|
|
26103
|
+
if (!((_b = (_a = state2 == null ? void 0 : state2.options) == null ? void 0 : _a.features) == null ? void 0 : _b.hideConfirmation)) {
|
|
26034
26104
|
on({
|
|
26035
26105
|
eventName: "instrument-ready",
|
|
26036
26106
|
callback: (payload) => {
|
|
@@ -26056,7 +26126,7 @@ const setupUserFlow = ({ state: state2 = {} }) => {
|
|
|
26056
26126
|
}
|
|
26057
26127
|
});
|
|
26058
26128
|
}
|
|
26059
|
-
if ((_d = (_c = state2.options) == null ? void 0 : _c.features) == null ? void 0 : _d.
|
|
26129
|
+
if (!((_d = (_c = state2 == null ? void 0 : state2.options) == null ? void 0 : _c.features) == null ? void 0 : _d.hideResult)) {
|
|
26060
26130
|
on({
|
|
26061
26131
|
eventName: "purchase-completed",
|
|
26062
26132
|
callback: (payload) => {
|
|
@@ -26199,7 +26269,7 @@ class RebillyInstrumentsInstance {
|
|
|
26199
26269
|
await show({ componentName, payload });
|
|
26200
26270
|
}
|
|
26201
26271
|
get version() {
|
|
26202
|
-
return `RebillyInstruments Ver.${"7.
|
|
26272
|
+
return `RebillyInstruments Ver.${"7.6.0"}`;
|
|
26203
26273
|
}
|
|
26204
26274
|
on(eventName, callback) {
|
|
26205
26275
|
on({ eventName, callback });
|