@delopay/sdk 0.109.0 → 0.112.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/dist/{chunk-XMFG7CPX.js → chunk-3O5MU6FP.js} +99 -11
- package/dist/chunk-3O5MU6FP.js.map +1 -0
- package/dist/index.cjs +102 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +575 -43
- package/dist/index.d.ts +575 -43
- package/dist/index.js +9 -1
- package/dist/internal.cjs +115 -10
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +89 -3
- package/dist/internal.d.ts +89 -3
- package/dist/internal.js +22 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-XMFG7CPX.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ __export(index_exports, {
|
|
|
25
25
|
ALL_CUSTOM_FIELD_TYPES: () => ALL_CUSTOM_FIELD_TYPES,
|
|
26
26
|
Analytics: () => Analytics,
|
|
27
27
|
AnalyticsDashboard: () => AnalyticsDashboard,
|
|
28
|
+
Audit: () => Audit,
|
|
28
29
|
AvailabilityOverrides: () => AvailabilityOverrides,
|
|
29
30
|
BRANDING_EXPORT_FORMAT: () => BRANDING_EXPORT_FORMAT,
|
|
30
31
|
BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
|
|
@@ -66,6 +67,8 @@ __export(index_exports, {
|
|
|
66
67
|
Search: () => Search,
|
|
67
68
|
Settlement: () => Settlement,
|
|
68
69
|
Subscriptions: () => Subscriptions,
|
|
70
|
+
WCAG_AA_TEXT: () => WCAG_AA_TEXT,
|
|
71
|
+
WCAG_AA_UI: () => WCAG_AA_UI,
|
|
69
72
|
Webhooks: () => Webhooks,
|
|
70
73
|
allOf: () => allOf,
|
|
71
74
|
anyOf: () => anyOf,
|
|
@@ -76,6 +79,7 @@ __export(index_exports, {
|
|
|
76
79
|
cloneCustomField: () => cloneCustomField,
|
|
77
80
|
cloneNativePane: () => cloneNativePane,
|
|
78
81
|
clonePane: () => clonePane,
|
|
82
|
+
contrastRatio: () => contrastRatio,
|
|
79
83
|
customFieldContextFromMetadata: () => customFieldContextFromMetadata,
|
|
80
84
|
customFieldIsTextLike: () => customFieldIsTextLike,
|
|
81
85
|
customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
|
|
@@ -3687,6 +3691,28 @@ var Analytics = class {
|
|
|
3687
3691
|
*/
|
|
3688
3692
|
async deviceTransactions(params) {
|
|
3689
3693
|
return this.request("GET", "/analytics/devices/transactions", {
|
|
3694
|
+
// A discriminated union carries no index signature, so the widening
|
|
3695
|
+
// goes via `unknown` — the union is the point.
|
|
3696
|
+
query: params
|
|
3697
|
+
});
|
|
3698
|
+
}
|
|
3699
|
+
/**
|
|
3700
|
+
* The payments behind one clicked element of the payments dashboard: a
|
|
3701
|
+
* processor-donut slice, a payment-method slice, an outcome segment of a
|
|
3702
|
+
* series bar, a series bucket, or a breakdown row — combinable, with
|
|
3703
|
+
* `target_bucket` narrowing every other target. The outcome mapping is the
|
|
3704
|
+
* one the series and donuts are folded with, expanded server-side, so the
|
|
3705
|
+
* list is what the clicked number was made of. Rows and the whole-match
|
|
3706
|
+
* `summary` carry USD figures converted with the dashboard's own rates.
|
|
3707
|
+
* Same window/scope/chip contract as `scope`; sorted per `sort_on` /
|
|
3708
|
+
* `sort_by`, `limit` rows (default 50) per page, `offset` for the next.
|
|
3709
|
+
* `GET /analytics/scope/transactions`
|
|
3710
|
+
*/
|
|
3711
|
+
async scopeTransactions(params) {
|
|
3712
|
+
return this.request("GET", "/analytics/scope/transactions", {
|
|
3713
|
+
// A discriminated union carries no index signature, so the widening
|
|
3714
|
+
// goes via `unknown` — the union is the point, and the query builder
|
|
3715
|
+
// only ever reads own enumerable keys.
|
|
3690
3716
|
query: params
|
|
3691
3717
|
});
|
|
3692
3718
|
}
|
|
@@ -4129,6 +4155,25 @@ var Subscriptions = class {
|
|
|
4129
4155
|
}
|
|
4130
4156
|
};
|
|
4131
4157
|
|
|
4158
|
+
// src/resources/audit.ts
|
|
4159
|
+
var Audit = class {
|
|
4160
|
+
constructor(request) {
|
|
4161
|
+
this.request = request;
|
|
4162
|
+
}
|
|
4163
|
+
async list(params) {
|
|
4164
|
+
return this.request("GET", "/audit", {
|
|
4165
|
+
query: params
|
|
4166
|
+
});
|
|
4167
|
+
}
|
|
4168
|
+
/**
|
|
4169
|
+
* One entry. An id belonging to another merchant answers 404, not 403 — the
|
|
4170
|
+
* endpoint does not confirm that an entry it will not serve exists.
|
|
4171
|
+
*/
|
|
4172
|
+
async retrieve(logId) {
|
|
4173
|
+
return this.request("GET", `/audit/${encodeURIComponent(logId)}`);
|
|
4174
|
+
}
|
|
4175
|
+
};
|
|
4176
|
+
|
|
4132
4177
|
// src/resources/settlement.ts
|
|
4133
4178
|
var Settlement = class {
|
|
4134
4179
|
constructor(request) {
|
|
@@ -4630,6 +4675,7 @@ var Delopay = class {
|
|
|
4630
4675
|
this.relay = new Relay(request);
|
|
4631
4676
|
this.stripeConnect = new StripeConnect(request);
|
|
4632
4677
|
this.threeDsRules = new ThreeDsRules(request);
|
|
4678
|
+
this.audit = new Audit(request);
|
|
4633
4679
|
this.settlement = new Settlement(request);
|
|
4634
4680
|
this.operationLimits = new OperationLimits(request);
|
|
4635
4681
|
this.risk = new Risk(request);
|
|
@@ -5195,14 +5241,41 @@ var HEX_RE = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
|
|
|
5195
5241
|
function isHexColor(value) {
|
|
5196
5242
|
return HEX_RE.test(value.trim());
|
|
5197
5243
|
}
|
|
5244
|
+
var CSS_HEX_RE = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
5245
|
+
var LENIENT_HEX_RE = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
5246
|
+
function parseHexChannels(value, pattern) {
|
|
5247
|
+
const match = pattern.exec(value.trim());
|
|
5248
|
+
if (!match) return null;
|
|
5249
|
+
const digits = match[1];
|
|
5250
|
+
const full = digits.length === 3 ? digits.split("").map((c) => c + c).join("") : digits;
|
|
5251
|
+
return [
|
|
5252
|
+
parseInt(full.slice(0, 2), 16),
|
|
5253
|
+
parseInt(full.slice(2, 4), 16),
|
|
5254
|
+
parseInt(full.slice(4, 6), 16)
|
|
5255
|
+
];
|
|
5256
|
+
}
|
|
5257
|
+
function relativeLuminance([r, g, b]) {
|
|
5258
|
+
const [lr, lg, lb] = [r, g, b].map((channel) => {
|
|
5259
|
+
const c = channel / 255;
|
|
5260
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
5261
|
+
});
|
|
5262
|
+
return 0.2126 * lr + 0.7152 * lg + 0.0722 * lb;
|
|
5263
|
+
}
|
|
5264
|
+
var WCAG_AA_TEXT = 4.5;
|
|
5265
|
+
var WCAG_AA_UI = 3;
|
|
5266
|
+
function contrastRatio(a, b) {
|
|
5267
|
+
const first = parseHexChannels(a, CSS_HEX_RE);
|
|
5268
|
+
const second = parseHexChannels(b, CSS_HEX_RE);
|
|
5269
|
+
if (!first || !second) return null;
|
|
5270
|
+
const [x, y] = [relativeLuminance(first), relativeLuminance(second)];
|
|
5271
|
+
const lighter = Math.max(x, y);
|
|
5272
|
+
const darker = Math.min(x, y);
|
|
5273
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
5274
|
+
}
|
|
5198
5275
|
function isDarkSurface(color) {
|
|
5199
|
-
const
|
|
5200
|
-
if (
|
|
5201
|
-
const
|
|
5202
|
-
const r = parseInt(full.slice(0, 2), 16);
|
|
5203
|
-
const g = parseInt(full.slice(2, 4), 16);
|
|
5204
|
-
const b = parseInt(full.slice(4, 6), 16);
|
|
5205
|
-
if ([r, g, b].some(Number.isNaN)) return false;
|
|
5276
|
+
const channels = parseHexChannels(color, LENIENT_HEX_RE);
|
|
5277
|
+
if (!channels) return false;
|
|
5278
|
+
const [r, g, b] = channels;
|
|
5206
5279
|
const luma = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
5207
5280
|
return luma < 128;
|
|
5208
5281
|
}
|
|
@@ -6551,7 +6624,15 @@ var PANE_ICON_KEYS = [
|
|
|
6551
6624
|
"apple",
|
|
6552
6625
|
"google",
|
|
6553
6626
|
"bnpl",
|
|
6554
|
-
"cash"
|
|
6627
|
+
"cash",
|
|
6628
|
+
// Brand marks, not category glyphs: the checkout draws PayPal's monogram,
|
|
6629
|
+
// Klarna's squircle-K and the Bitcoin mark for these, the same logos the
|
|
6630
|
+
// bespoke panes they replace already drew. Listed here so a merchant's own
|
|
6631
|
+
// dashboard can offer them; the router decides which one a tile *defaults*
|
|
6632
|
+
// to, and a router predating them simply keeps sending the old default.
|
|
6633
|
+
"paypal",
|
|
6634
|
+
"klarna",
|
|
6635
|
+
"crypto"
|
|
6555
6636
|
];
|
|
6556
6637
|
var PANE_CATEGORY_KEYS = [
|
|
6557
6638
|
"wallet",
|
|
@@ -6575,7 +6656,11 @@ function offerablePaneMethods(catalog) {
|
|
|
6575
6656
|
}
|
|
6576
6657
|
var DISPLAY_DEFAULTS_BY_KEY = {
|
|
6577
6658
|
apple_pay: { icon: "apple", category: "wallet" },
|
|
6578
|
-
google_pay: { icon: "google", category: "wallet" }
|
|
6659
|
+
google_pay: { icon: "google", category: "wallet" },
|
|
6660
|
+
paypal: { icon: "paypal", category: "wallet" },
|
|
6661
|
+
// Both the Klarna connector's own tile and Stripe's Klarna. Affirm stays on
|
|
6662
|
+
// the generic `bnpl` glyph — same rail, no mark of its own.
|
|
6663
|
+
klarna: { icon: "klarna", category: "bnpl" }
|
|
6579
6664
|
};
|
|
6580
6665
|
var DISPLAY_DEFAULTS_BY_PAYMENT_METHOD = {
|
|
6581
6666
|
wallet: { icon: "wallet", category: "wallet" },
|
|
@@ -6585,7 +6670,10 @@ var DISPLAY_DEFAULTS_BY_PAYMENT_METHOD = {
|
|
|
6585
6670
|
bank_redirect: { icon: "bank", category: "bank_redirect" },
|
|
6586
6671
|
bank_transfer: { icon: "bank", category: "bank_transfer" },
|
|
6587
6672
|
bank_debit: { icon: "bank", category: "bank_transfer" },
|
|
6588
|
-
|
|
6673
|
+
// Cryptomus and NowPayments publish the same `crypto` key on this rail, and
|
|
6674
|
+
// the router defaults both to the Bitcoin mark.
|
|
6675
|
+
crypto: { icon: "crypto", category: "crypto" },
|
|
6676
|
+
// Skinsback, which has no mark: the router defaults it to `wallet` too.
|
|
6589
6677
|
game_items: { icon: "wallet", category: "game_items" },
|
|
6590
6678
|
cash: { icon: "cash", category: "cash" },
|
|
6591
6679
|
voucher: { icon: "cash", category: "cash" }
|
|
@@ -6777,6 +6865,7 @@ var encodeNativePanes = encodePanes;
|
|
|
6777
6865
|
ALL_CUSTOM_FIELD_TYPES,
|
|
6778
6866
|
Analytics,
|
|
6779
6867
|
AnalyticsDashboard,
|
|
6868
|
+
Audit,
|
|
6780
6869
|
AvailabilityOverrides,
|
|
6781
6870
|
BRANDING_EXPORT_FORMAT,
|
|
6782
6871
|
BRANDING_EXPORT_VERSION,
|
|
@@ -6818,6 +6907,8 @@ var encodeNativePanes = encodePanes;
|
|
|
6818
6907
|
Search,
|
|
6819
6908
|
Settlement,
|
|
6820
6909
|
Subscriptions,
|
|
6910
|
+
WCAG_AA_TEXT,
|
|
6911
|
+
WCAG_AA_UI,
|
|
6821
6912
|
Webhooks,
|
|
6822
6913
|
allOf,
|
|
6823
6914
|
anyOf,
|
|
@@ -6828,6 +6919,7 @@ var encodeNativePanes = encodePanes;
|
|
|
6828
6919
|
cloneCustomField,
|
|
6829
6920
|
cloneNativePane,
|
|
6830
6921
|
clonePane,
|
|
6922
|
+
contrastRatio,
|
|
6831
6923
|
customFieldContextFromMetadata,
|
|
6832
6924
|
customFieldIsTextLike,
|
|
6833
6925
|
customFieldOperatorTakesValue,
|