@delopay/sdk 0.111.0 → 0.113.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-TS422PA3.js → chunk-NY5O6S5X.js} +64 -9
- package/dist/chunk-NY5O6S5X.js.map +1 -0
- package/dist/index.cjs +66 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +451 -47
- package/dist/index.d.ts +451 -47
- package/dist/index.js +7 -1
- package/dist/internal.cjs +89 -8
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +60 -3
- package/dist/internal.d.ts +60 -3
- package/dist/internal.js +30 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-TS422PA3.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -67,6 +67,8 @@ __export(index_exports, {
|
|
|
67
67
|
Search: () => Search,
|
|
68
68
|
Settlement: () => Settlement,
|
|
69
69
|
Subscriptions: () => Subscriptions,
|
|
70
|
+
WCAG_AA_TEXT: () => WCAG_AA_TEXT,
|
|
71
|
+
WCAG_AA_UI: () => WCAG_AA_UI,
|
|
70
72
|
Webhooks: () => Webhooks,
|
|
71
73
|
allOf: () => allOf,
|
|
72
74
|
anyOf: () => anyOf,
|
|
@@ -77,6 +79,7 @@ __export(index_exports, {
|
|
|
77
79
|
cloneCustomField: () => cloneCustomField,
|
|
78
80
|
cloneNativePane: () => cloneNativePane,
|
|
79
81
|
clonePane: () => clonePane,
|
|
82
|
+
contrastRatio: () => contrastRatio,
|
|
80
83
|
customFieldContextFromMetadata: () => customFieldContextFromMetadata,
|
|
81
84
|
customFieldIsTextLike: () => customFieldIsTextLike,
|
|
82
85
|
customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
|
|
@@ -2963,7 +2966,10 @@ var Shops = class {
|
|
|
2963
2966
|
* @param merchantId - The merchant account ID.
|
|
2964
2967
|
* @param shopId - The shop (business profile) ID to restyle.
|
|
2965
2968
|
* @param params - The new `payment_link_config` blob (full replacement).
|
|
2966
|
-
* @returns The
|
|
2969
|
+
* @returns The saved branding — the same shape `retrieveCheckoutBranding`
|
|
2970
|
+
* returns, not the whole shop. A role whose only power is restyling a
|
|
2971
|
+
* checkout must not receive the webhook signing key or the card-vault
|
|
2972
|
+
* configuration back from a save.
|
|
2967
2973
|
*/
|
|
2968
2974
|
async updateCheckoutBranding(merchantId, shopId, params, options) {
|
|
2969
2975
|
return this.request(
|
|
@@ -3688,6 +3694,28 @@ var Analytics = class {
|
|
|
3688
3694
|
*/
|
|
3689
3695
|
async deviceTransactions(params) {
|
|
3690
3696
|
return this.request("GET", "/analytics/devices/transactions", {
|
|
3697
|
+
// A discriminated union carries no index signature, so the widening
|
|
3698
|
+
// goes via `unknown` — the union is the point.
|
|
3699
|
+
query: params
|
|
3700
|
+
});
|
|
3701
|
+
}
|
|
3702
|
+
/**
|
|
3703
|
+
* The payments behind one clicked element of the payments dashboard: a
|
|
3704
|
+
* processor-donut slice, a payment-method slice, an outcome segment of a
|
|
3705
|
+
* series bar, a series bucket, or a breakdown row — combinable, with
|
|
3706
|
+
* `target_bucket` narrowing every other target. The outcome mapping is the
|
|
3707
|
+
* one the series and donuts are folded with, expanded server-side, so the
|
|
3708
|
+
* list is what the clicked number was made of. Rows and the whole-match
|
|
3709
|
+
* `summary` carry USD figures converted with the dashboard's own rates.
|
|
3710
|
+
* Same window/scope/chip contract as `scope`; sorted per `sort_on` /
|
|
3711
|
+
* `sort_by`, `limit` rows (default 50) per page, `offset` for the next.
|
|
3712
|
+
* `GET /analytics/scope/transactions`
|
|
3713
|
+
*/
|
|
3714
|
+
async scopeTransactions(params) {
|
|
3715
|
+
return this.request("GET", "/analytics/scope/transactions", {
|
|
3716
|
+
// A discriminated union carries no index signature, so the widening
|
|
3717
|
+
// goes via `unknown` — the union is the point, and the query builder
|
|
3718
|
+
// only ever reads own enumerable keys.
|
|
3691
3719
|
query: params
|
|
3692
3720
|
});
|
|
3693
3721
|
}
|
|
@@ -5216,14 +5244,41 @@ var HEX_RE = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
|
|
|
5216
5244
|
function isHexColor(value) {
|
|
5217
5245
|
return HEX_RE.test(value.trim());
|
|
5218
5246
|
}
|
|
5247
|
+
var CSS_HEX_RE = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
5248
|
+
var LENIENT_HEX_RE = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
|
|
5249
|
+
function parseHexChannels(value, pattern) {
|
|
5250
|
+
const match = pattern.exec(value.trim());
|
|
5251
|
+
if (!match) return null;
|
|
5252
|
+
const digits = match[1];
|
|
5253
|
+
const full = digits.length === 3 ? digits.split("").map((c) => c + c).join("") : digits;
|
|
5254
|
+
return [
|
|
5255
|
+
parseInt(full.slice(0, 2), 16),
|
|
5256
|
+
parseInt(full.slice(2, 4), 16),
|
|
5257
|
+
parseInt(full.slice(4, 6), 16)
|
|
5258
|
+
];
|
|
5259
|
+
}
|
|
5260
|
+
function relativeLuminance([r, g, b]) {
|
|
5261
|
+
const [lr, lg, lb] = [r, g, b].map((channel) => {
|
|
5262
|
+
const c = channel / 255;
|
|
5263
|
+
return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
|
|
5264
|
+
});
|
|
5265
|
+
return 0.2126 * lr + 0.7152 * lg + 0.0722 * lb;
|
|
5266
|
+
}
|
|
5267
|
+
var WCAG_AA_TEXT = 4.5;
|
|
5268
|
+
var WCAG_AA_UI = 3;
|
|
5269
|
+
function contrastRatio(a, b) {
|
|
5270
|
+
const first = parseHexChannels(a, CSS_HEX_RE);
|
|
5271
|
+
const second = parseHexChannels(b, CSS_HEX_RE);
|
|
5272
|
+
if (!first || !second) return null;
|
|
5273
|
+
const [x, y] = [relativeLuminance(first), relativeLuminance(second)];
|
|
5274
|
+
const lighter = Math.max(x, y);
|
|
5275
|
+
const darker = Math.min(x, y);
|
|
5276
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
5277
|
+
}
|
|
5219
5278
|
function isDarkSurface(color) {
|
|
5220
|
-
const
|
|
5221
|
-
if (
|
|
5222
|
-
const
|
|
5223
|
-
const r = parseInt(full.slice(0, 2), 16);
|
|
5224
|
-
const g = parseInt(full.slice(2, 4), 16);
|
|
5225
|
-
const b = parseInt(full.slice(4, 6), 16);
|
|
5226
|
-
if ([r, g, b].some(Number.isNaN)) return false;
|
|
5279
|
+
const channels = parseHexChannels(color, LENIENT_HEX_RE);
|
|
5280
|
+
if (!channels) return false;
|
|
5281
|
+
const [r, g, b] = channels;
|
|
5227
5282
|
const luma = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
5228
5283
|
return luma < 128;
|
|
5229
5284
|
}
|
|
@@ -6855,6 +6910,8 @@ var encodeNativePanes = encodePanes;
|
|
|
6855
6910
|
Search,
|
|
6856
6911
|
Settlement,
|
|
6857
6912
|
Subscriptions,
|
|
6913
|
+
WCAG_AA_TEXT,
|
|
6914
|
+
WCAG_AA_UI,
|
|
6858
6915
|
Webhooks,
|
|
6859
6916
|
allOf,
|
|
6860
6917
|
anyOf,
|
|
@@ -6865,6 +6922,7 @@ var encodeNativePanes = encodePanes;
|
|
|
6865
6922
|
cloneCustomField,
|
|
6866
6923
|
cloneNativePane,
|
|
6867
6924
|
clonePane,
|
|
6925
|
+
contrastRatio,
|
|
6868
6926
|
customFieldContextFromMetadata,
|
|
6869
6927
|
customFieldIsTextLike,
|
|
6870
6928
|
customFieldOperatorTakesValue,
|