@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.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
ALL_CUSTOM_FIELD_TYPES,
|
|
5
5
|
Analytics,
|
|
6
6
|
AnalyticsDashboard,
|
|
7
|
+
Audit,
|
|
7
8
|
AvailabilityOverrides,
|
|
8
9
|
BRANDING_EXPORT_FORMAT,
|
|
9
10
|
BRANDING_EXPORT_VERSION,
|
|
@@ -45,6 +46,8 @@ import {
|
|
|
45
46
|
Search,
|
|
46
47
|
Settlement,
|
|
47
48
|
Subscriptions,
|
|
49
|
+
WCAG_AA_TEXT,
|
|
50
|
+
WCAG_AA_UI,
|
|
48
51
|
Webhooks,
|
|
49
52
|
allOf,
|
|
50
53
|
anyOf,
|
|
@@ -55,6 +58,7 @@ import {
|
|
|
55
58
|
cloneCustomField,
|
|
56
59
|
cloneNativePane,
|
|
57
60
|
clonePane,
|
|
61
|
+
contrastRatio,
|
|
58
62
|
customFieldContextFromMetadata,
|
|
59
63
|
customFieldIsTextLike,
|
|
60
64
|
customFieldOperatorTakesValue,
|
|
@@ -106,13 +110,14 @@ import {
|
|
|
106
110
|
validatePanes,
|
|
107
111
|
verticalGapValue,
|
|
108
112
|
visibleCustomFields
|
|
109
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-3O5MU6FP.js";
|
|
110
114
|
export {
|
|
111
115
|
ALL_CUSTOM_FIELD_CONDITION_SOURCES,
|
|
112
116
|
ALL_CUSTOM_FIELD_OPERATORS,
|
|
113
117
|
ALL_CUSTOM_FIELD_TYPES,
|
|
114
118
|
Analytics,
|
|
115
119
|
AnalyticsDashboard,
|
|
120
|
+
Audit,
|
|
116
121
|
AvailabilityOverrides,
|
|
117
122
|
BRANDING_EXPORT_FORMAT,
|
|
118
123
|
BRANDING_EXPORT_VERSION,
|
|
@@ -154,6 +159,8 @@ export {
|
|
|
154
159
|
Search,
|
|
155
160
|
Settlement,
|
|
156
161
|
Subscriptions,
|
|
162
|
+
WCAG_AA_TEXT,
|
|
163
|
+
WCAG_AA_UI,
|
|
157
164
|
Webhooks,
|
|
158
165
|
allOf,
|
|
159
166
|
anyOf,
|
|
@@ -164,6 +171,7 @@ export {
|
|
|
164
171
|
cloneCustomField,
|
|
165
172
|
cloneNativePane,
|
|
166
173
|
clonePane,
|
|
174
|
+
contrastRatio,
|
|
167
175
|
customFieldContextFromMetadata,
|
|
168
176
|
customFieldIsTextLike,
|
|
169
177
|
customFieldOperatorTakesValue,
|
package/dist/internal.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(internal_exports, {
|
|
|
27
27
|
AdminPortal: () => AdminPortal,
|
|
28
28
|
Analytics: () => Analytics,
|
|
29
29
|
AnalyticsDashboard: () => AnalyticsDashboard,
|
|
30
|
+
Audit: () => Audit,
|
|
30
31
|
AuditLogs: () => AuditLogs,
|
|
31
32
|
AvailabilityOverrides: () => AvailabilityOverrides,
|
|
32
33
|
BRANDING_EXPORT_FORMAT: () => BRANDING_EXPORT_FORMAT,
|
|
@@ -78,6 +79,8 @@ __export(internal_exports, {
|
|
|
78
79
|
Search: () => Search,
|
|
79
80
|
Settlement: () => Settlement,
|
|
80
81
|
Subscriptions: () => Subscriptions,
|
|
82
|
+
WCAG_AA_TEXT: () => WCAG_AA_TEXT,
|
|
83
|
+
WCAG_AA_UI: () => WCAG_AA_UI,
|
|
81
84
|
Webhooks: () => Webhooks,
|
|
82
85
|
allOf: () => allOf,
|
|
83
86
|
anyOf: () => anyOf,
|
|
@@ -88,6 +91,7 @@ __export(internal_exports, {
|
|
|
88
91
|
cloneCustomField: () => cloneCustomField,
|
|
89
92
|
cloneNativePane: () => cloneNativePane,
|
|
90
93
|
clonePane: () => clonePane,
|
|
94
|
+
contrastRatio: () => contrastRatio,
|
|
91
95
|
customFieldContextFromMetadata: () => customFieldContextFromMetadata,
|
|
92
96
|
customFieldIsTextLike: () => customFieldIsTextLike,
|
|
93
97
|
customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
|
|
@@ -3699,6 +3703,28 @@ var Analytics = class {
|
|
|
3699
3703
|
*/
|
|
3700
3704
|
async deviceTransactions(params) {
|
|
3701
3705
|
return this.request("GET", "/analytics/devices/transactions", {
|
|
3706
|
+
// A discriminated union carries no index signature, so the widening
|
|
3707
|
+
// goes via `unknown` — the union is the point.
|
|
3708
|
+
query: params
|
|
3709
|
+
});
|
|
3710
|
+
}
|
|
3711
|
+
/**
|
|
3712
|
+
* The payments behind one clicked element of the payments dashboard: a
|
|
3713
|
+
* processor-donut slice, a payment-method slice, an outcome segment of a
|
|
3714
|
+
* series bar, a series bucket, or a breakdown row — combinable, with
|
|
3715
|
+
* `target_bucket` narrowing every other target. The outcome mapping is the
|
|
3716
|
+
* one the series and donuts are folded with, expanded server-side, so the
|
|
3717
|
+
* list is what the clicked number was made of. Rows and the whole-match
|
|
3718
|
+
* `summary` carry USD figures converted with the dashboard's own rates.
|
|
3719
|
+
* Same window/scope/chip contract as `scope`; sorted per `sort_on` /
|
|
3720
|
+
* `sort_by`, `limit` rows (default 50) per page, `offset` for the next.
|
|
3721
|
+
* `GET /analytics/scope/transactions`
|
|
3722
|
+
*/
|
|
3723
|
+
async scopeTransactions(params) {
|
|
3724
|
+
return this.request("GET", "/analytics/scope/transactions", {
|
|
3725
|
+
// A discriminated union carries no index signature, so the widening
|
|
3726
|
+
// goes via `unknown` — the union is the point, and the query builder
|
|
3727
|
+
// only ever reads own enumerable keys.
|
|
3702
3728
|
query: params
|
|
3703
3729
|
});
|
|
3704
3730
|
}
|
|
@@ -4141,6 +4167,25 @@ var Subscriptions = class {
|
|
|
4141
4167
|
}
|
|
4142
4168
|
};
|
|
4143
4169
|
|
|
4170
|
+
// src/resources/audit.ts
|
|
4171
|
+
var Audit = class {
|
|
4172
|
+
constructor(request) {
|
|
4173
|
+
this.request = request;
|
|
4174
|
+
}
|
|
4175
|
+
async list(params) {
|
|
4176
|
+
return this.request("GET", "/audit", {
|
|
4177
|
+
query: params
|
|
4178
|
+
});
|
|
4179
|
+
}
|
|
4180
|
+
/**
|
|
4181
|
+
* One entry. An id belonging to another merchant answers 404, not 403 — the
|
|
4182
|
+
* endpoint does not confirm that an entry it will not serve exists.
|
|
4183
|
+
*/
|
|
4184
|
+
async retrieve(logId) {
|
|
4185
|
+
return this.request("GET", `/audit/${encodeURIComponent(logId)}`);
|
|
4186
|
+
}
|
|
4187
|
+
};
|
|
4188
|
+
|
|
4144
4189
|
// src/resources/settlement.ts
|
|
4145
4190
|
var Settlement = class {
|
|
4146
4191
|
constructor(request) {
|
|
@@ -4642,6 +4687,7 @@ var Delopay = class {
|
|
|
4642
4687
|
this.relay = new Relay(request);
|
|
4643
4688
|
this.stripeConnect = new StripeConnect(request);
|
|
4644
4689
|
this.threeDsRules = new ThreeDsRules(request);
|
|
4690
|
+
this.audit = new Audit(request);
|
|
4645
4691
|
this.settlement = new Settlement(request);
|
|
4646
4692
|
this.operationLimits = new OperationLimits(request);
|
|
4647
4693
|
this.risk = new Risk(request);
|
|
@@ -5207,14 +5253,41 @@ var HEX_RE = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
|
|
|
5207
5253
|
function isHexColor(value) {
|
|
5208
5254
|
return HEX_RE.test(value.trim());
|
|
5209
5255
|
}
|
|
5256
|
+
var CSS_HEX_RE = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
5257
|
+
var LENIENT_HEX_RE = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
5258
|
+
function parseHexChannels(value, pattern) {
|
|
5259
|
+
const match = pattern.exec(value.trim());
|
|
5260
|
+
if (!match) return null;
|
|
5261
|
+
const digits = match[1];
|
|
5262
|
+
const full = digits.length === 3 ? digits.split("").map((c) => c + c).join("") : digits;
|
|
5263
|
+
return [
|
|
5264
|
+
parseInt(full.slice(0, 2), 16),
|
|
5265
|
+
parseInt(full.slice(2, 4), 16),
|
|
5266
|
+
parseInt(full.slice(4, 6), 16)
|
|
5267
|
+
];
|
|
5268
|
+
}
|
|
5269
|
+
function relativeLuminance([r, g, b]) {
|
|
5270
|
+
const [lr, lg, lb] = [r, g, b].map((channel) => {
|
|
5271
|
+
const c = channel / 255;
|
|
5272
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
5273
|
+
});
|
|
5274
|
+
return 0.2126 * lr + 0.7152 * lg + 0.0722 * lb;
|
|
5275
|
+
}
|
|
5276
|
+
var WCAG_AA_TEXT = 4.5;
|
|
5277
|
+
var WCAG_AA_UI = 3;
|
|
5278
|
+
function contrastRatio(a, b) {
|
|
5279
|
+
const first = parseHexChannels(a, CSS_HEX_RE);
|
|
5280
|
+
const second = parseHexChannels(b, CSS_HEX_RE);
|
|
5281
|
+
if (!first || !second) return null;
|
|
5282
|
+
const [x, y] = [relativeLuminance(first), relativeLuminance(second)];
|
|
5283
|
+
const lighter = Math.max(x, y);
|
|
5284
|
+
const darker = Math.min(x, y);
|
|
5285
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
5286
|
+
}
|
|
5210
5287
|
function isDarkSurface(color) {
|
|
5211
|
-
const
|
|
5212
|
-
if (
|
|
5213
|
-
const
|
|
5214
|
-
const r = parseInt(full.slice(0, 2), 16);
|
|
5215
|
-
const g = parseInt(full.slice(2, 4), 16);
|
|
5216
|
-
const b = parseInt(full.slice(4, 6), 16);
|
|
5217
|
-
if ([r, g, b].some(Number.isNaN)) return false;
|
|
5288
|
+
const channels = parseHexChannels(color, LENIENT_HEX_RE);
|
|
5289
|
+
if (!channels) return false;
|
|
5290
|
+
const [r, g, b] = channels;
|
|
5218
5291
|
const luma = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
5219
5292
|
return luma < 128;
|
|
5220
5293
|
}
|
|
@@ -6563,7 +6636,15 @@ var PANE_ICON_KEYS = [
|
|
|
6563
6636
|
"apple",
|
|
6564
6637
|
"google",
|
|
6565
6638
|
"bnpl",
|
|
6566
|
-
"cash"
|
|
6639
|
+
"cash",
|
|
6640
|
+
// Brand marks, not category glyphs: the checkout draws PayPal's monogram,
|
|
6641
|
+
// Klarna's squircle-K and the Bitcoin mark for these, the same logos the
|
|
6642
|
+
// bespoke panes they replace already drew. Listed here so a merchant's own
|
|
6643
|
+
// dashboard can offer them; the router decides which one a tile *defaults*
|
|
6644
|
+
// to, and a router predating them simply keeps sending the old default.
|
|
6645
|
+
"paypal",
|
|
6646
|
+
"klarna",
|
|
6647
|
+
"crypto"
|
|
6567
6648
|
];
|
|
6568
6649
|
var PANE_CATEGORY_KEYS = [
|
|
6569
6650
|
"wallet",
|
|
@@ -6587,7 +6668,11 @@ function offerablePaneMethods(catalog) {
|
|
|
6587
6668
|
}
|
|
6588
6669
|
var DISPLAY_DEFAULTS_BY_KEY = {
|
|
6589
6670
|
apple_pay: { icon: "apple", category: "wallet" },
|
|
6590
|
-
google_pay: { icon: "google", category: "wallet" }
|
|
6671
|
+
google_pay: { icon: "google", category: "wallet" },
|
|
6672
|
+
paypal: { icon: "paypal", category: "wallet" },
|
|
6673
|
+
// Both the Klarna connector's own tile and Stripe's Klarna. Affirm stays on
|
|
6674
|
+
// the generic `bnpl` glyph — same rail, no mark of its own.
|
|
6675
|
+
klarna: { icon: "klarna", category: "bnpl" }
|
|
6591
6676
|
};
|
|
6592
6677
|
var DISPLAY_DEFAULTS_BY_PAYMENT_METHOD = {
|
|
6593
6678
|
wallet: { icon: "wallet", category: "wallet" },
|
|
@@ -6597,7 +6682,10 @@ var DISPLAY_DEFAULTS_BY_PAYMENT_METHOD = {
|
|
|
6597
6682
|
bank_redirect: { icon: "bank", category: "bank_redirect" },
|
|
6598
6683
|
bank_transfer: { icon: "bank", category: "bank_transfer" },
|
|
6599
6684
|
bank_debit: { icon: "bank", category: "bank_transfer" },
|
|
6600
|
-
|
|
6685
|
+
// Cryptomus and NowPayments publish the same `crypto` key on this rail, and
|
|
6686
|
+
// the router defaults both to the Bitcoin mark.
|
|
6687
|
+
crypto: { icon: "crypto", category: "crypto" },
|
|
6688
|
+
// Skinsback, which has no mark: the router defaults it to `wallet` too.
|
|
6601
6689
|
game_items: { icon: "wallet", category: "game_items" },
|
|
6602
6690
|
cash: { icon: "cash", category: "cash" },
|
|
6603
6691
|
voucher: { icon: "cash", category: "cash" }
|
|
@@ -6943,6 +7031,19 @@ var AdminPortal = class {
|
|
|
6943
7031
|
*/
|
|
6944
7032
|
async analyticsDeviceTransactions(params) {
|
|
6945
7033
|
return this.request("GET", "/admin-portal/analytics/devices/transactions", {
|
|
7034
|
+
// A discriminated union carries no index signature, so the widening
|
|
7035
|
+
// goes via `unknown` — the union is the point.
|
|
7036
|
+
query: params
|
|
7037
|
+
});
|
|
7038
|
+
}
|
|
7039
|
+
/**
|
|
7040
|
+
* The payments behind one clicked element of the admin payments dashboard
|
|
7041
|
+
* (processor / method slice, outcome segment, series bucket or breakdown
|
|
7042
|
+
* row), rooted at all merchants. Same contract as the merchant surface's
|
|
7043
|
+
* `analytics.scopeTransactions`. `GET /admin-portal/analytics/scope/transactions`
|
|
7044
|
+
*/
|
|
7045
|
+
async analyticsScopeTransactions(params) {
|
|
7046
|
+
return this.request("GET", "/admin-portal/analytics/scope/transactions", {
|
|
6946
7047
|
query: params
|
|
6947
7048
|
});
|
|
6948
7049
|
}
|
|
@@ -7650,6 +7751,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
7650
7751
|
AdminPortal,
|
|
7651
7752
|
Analytics,
|
|
7652
7753
|
AnalyticsDashboard,
|
|
7754
|
+
Audit,
|
|
7653
7755
|
AuditLogs,
|
|
7654
7756
|
AvailabilityOverrides,
|
|
7655
7757
|
BRANDING_EXPORT_FORMAT,
|
|
@@ -7701,6 +7803,8 @@ var DelopayInternal = class extends Delopay {
|
|
|
7701
7803
|
Search,
|
|
7702
7804
|
Settlement,
|
|
7703
7805
|
Subscriptions,
|
|
7806
|
+
WCAG_AA_TEXT,
|
|
7807
|
+
WCAG_AA_UI,
|
|
7704
7808
|
Webhooks,
|
|
7705
7809
|
allOf,
|
|
7706
7810
|
anyOf,
|
|
@@ -7711,6 +7815,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
7711
7815
|
cloneCustomField,
|
|
7712
7816
|
cloneNativePane,
|
|
7713
7817
|
clonePane,
|
|
7818
|
+
contrastRatio,
|
|
7714
7819
|
customFieldContextFromMetadata,
|
|
7715
7820
|
customFieldIsTextLike,
|
|
7716
7821
|
customFieldOperatorTakesValue,
|