@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.
@@ -3555,6 +3555,28 @@ var Analytics = class {
3555
3555
  */
3556
3556
  async deviceTransactions(params) {
3557
3557
  return this.request("GET", "/analytics/devices/transactions", {
3558
+ // A discriminated union carries no index signature, so the widening
3559
+ // goes via `unknown` — the union is the point.
3560
+ query: params
3561
+ });
3562
+ }
3563
+ /**
3564
+ * The payments behind one clicked element of the payments dashboard: a
3565
+ * processor-donut slice, a payment-method slice, an outcome segment of a
3566
+ * series bar, a series bucket, or a breakdown row — combinable, with
3567
+ * `target_bucket` narrowing every other target. The outcome mapping is the
3568
+ * one the series and donuts are folded with, expanded server-side, so the
3569
+ * list is what the clicked number was made of. Rows and the whole-match
3570
+ * `summary` carry USD figures converted with the dashboard's own rates.
3571
+ * Same window/scope/chip contract as `scope`; sorted per `sort_on` /
3572
+ * `sort_by`, `limit` rows (default 50) per page, `offset` for the next.
3573
+ * `GET /analytics/scope/transactions`
3574
+ */
3575
+ async scopeTransactions(params) {
3576
+ return this.request("GET", "/analytics/scope/transactions", {
3577
+ // A discriminated union carries no index signature, so the widening
3578
+ // goes via `unknown` — the union is the point, and the query builder
3579
+ // only ever reads own enumerable keys.
3558
3580
  query: params
3559
3581
  });
3560
3582
  }
@@ -3997,6 +4019,25 @@ var Subscriptions = class {
3997
4019
  }
3998
4020
  };
3999
4021
 
4022
+ // src/resources/audit.ts
4023
+ var Audit = class {
4024
+ constructor(request) {
4025
+ this.request = request;
4026
+ }
4027
+ async list(params) {
4028
+ return this.request("GET", "/audit", {
4029
+ query: params
4030
+ });
4031
+ }
4032
+ /**
4033
+ * One entry. An id belonging to another merchant answers 404, not 403 — the
4034
+ * endpoint does not confirm that an entry it will not serve exists.
4035
+ */
4036
+ async retrieve(logId) {
4037
+ return this.request("GET", `/audit/${encodeURIComponent(logId)}`);
4038
+ }
4039
+ };
4040
+
4000
4041
  // src/resources/settlement.ts
4001
4042
  var Settlement = class {
4002
4043
  constructor(request) {
@@ -4498,6 +4539,7 @@ var Delopay = class {
4498
4539
  this.relay = new Relay(request);
4499
4540
  this.stripeConnect = new StripeConnect(request);
4500
4541
  this.threeDsRules = new ThreeDsRules(request);
4542
+ this.audit = new Audit(request);
4501
4543
  this.settlement = new Settlement(request);
4502
4544
  this.operationLimits = new OperationLimits(request);
4503
4545
  this.risk = new Risk(request);
@@ -5063,14 +5105,41 @@ var HEX_RE = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
5063
5105
  function isHexColor(value) {
5064
5106
  return HEX_RE.test(value.trim());
5065
5107
  }
5108
+ var CSS_HEX_RE = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
5109
+ var LENIENT_HEX_RE = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
5110
+ function parseHexChannels(value, pattern) {
5111
+ const match = pattern.exec(value.trim());
5112
+ if (!match) return null;
5113
+ const digits = match[1];
5114
+ const full = digits.length === 3 ? digits.split("").map((c) => c + c).join("") : digits;
5115
+ return [
5116
+ parseInt(full.slice(0, 2), 16),
5117
+ parseInt(full.slice(2, 4), 16),
5118
+ parseInt(full.slice(4, 6), 16)
5119
+ ];
5120
+ }
5121
+ function relativeLuminance([r, g, b]) {
5122
+ const [lr, lg, lb] = [r, g, b].map((channel) => {
5123
+ const c = channel / 255;
5124
+ return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
5125
+ });
5126
+ return 0.2126 * lr + 0.7152 * lg + 0.0722 * lb;
5127
+ }
5128
+ var WCAG_AA_TEXT = 4.5;
5129
+ var WCAG_AA_UI = 3;
5130
+ function contrastRatio(a, b) {
5131
+ const first = parseHexChannels(a, CSS_HEX_RE);
5132
+ const second = parseHexChannels(b, CSS_HEX_RE);
5133
+ if (!first || !second) return null;
5134
+ const [x, y] = [relativeLuminance(first), relativeLuminance(second)];
5135
+ const lighter = Math.max(x, y);
5136
+ const darker = Math.min(x, y);
5137
+ return (lighter + 0.05) / (darker + 0.05);
5138
+ }
5066
5139
  function isDarkSurface(color) {
5067
- const m = color.replace("#", "").trim();
5068
- if (m.length !== 3 && m.length !== 6) return false;
5069
- const full = m.length === 3 ? m.split("").map((c) => c + c).join("") : m;
5070
- const r = parseInt(full.slice(0, 2), 16);
5071
- const g = parseInt(full.slice(2, 4), 16);
5072
- const b = parseInt(full.slice(4, 6), 16);
5073
- if ([r, g, b].some(Number.isNaN)) return false;
5140
+ const channels = parseHexChannels(color, LENIENT_HEX_RE);
5141
+ if (!channels) return false;
5142
+ const [r, g, b] = channels;
5074
5143
  const luma = (r * 299 + g * 587 + b * 114) / 1e3;
5075
5144
  return luma < 128;
5076
5145
  }
@@ -6419,7 +6488,15 @@ var PANE_ICON_KEYS = [
6419
6488
  "apple",
6420
6489
  "google",
6421
6490
  "bnpl",
6422
- "cash"
6491
+ "cash",
6492
+ // Brand marks, not category glyphs: the checkout draws PayPal's monogram,
6493
+ // Klarna's squircle-K and the Bitcoin mark for these, the same logos the
6494
+ // bespoke panes they replace already drew. Listed here so a merchant's own
6495
+ // dashboard can offer them; the router decides which one a tile *defaults*
6496
+ // to, and a router predating them simply keeps sending the old default.
6497
+ "paypal",
6498
+ "klarna",
6499
+ "crypto"
6423
6500
  ];
6424
6501
  var PANE_CATEGORY_KEYS = [
6425
6502
  "wallet",
@@ -6443,7 +6520,11 @@ function offerablePaneMethods(catalog) {
6443
6520
  }
6444
6521
  var DISPLAY_DEFAULTS_BY_KEY = {
6445
6522
  apple_pay: { icon: "apple", category: "wallet" },
6446
- google_pay: { icon: "google", category: "wallet" }
6523
+ google_pay: { icon: "google", category: "wallet" },
6524
+ paypal: { icon: "paypal", category: "wallet" },
6525
+ // Both the Klarna connector's own tile and Stripe's Klarna. Affirm stays on
6526
+ // the generic `bnpl` glyph — same rail, no mark of its own.
6527
+ klarna: { icon: "klarna", category: "bnpl" }
6447
6528
  };
6448
6529
  var DISPLAY_DEFAULTS_BY_PAYMENT_METHOD = {
6449
6530
  wallet: { icon: "wallet", category: "wallet" },
@@ -6453,7 +6534,10 @@ var DISPLAY_DEFAULTS_BY_PAYMENT_METHOD = {
6453
6534
  bank_redirect: { icon: "bank", category: "bank_redirect" },
6454
6535
  bank_transfer: { icon: "bank", category: "bank_transfer" },
6455
6536
  bank_debit: { icon: "bank", category: "bank_transfer" },
6456
- crypto: { icon: "wallet", category: "crypto" },
6537
+ // Cryptomus and NowPayments publish the same `crypto` key on this rail, and
6538
+ // the router defaults both to the Bitcoin mark.
6539
+ crypto: { icon: "crypto", category: "crypto" },
6540
+ // Skinsback, which has no mark: the router defaults it to `wallet` too.
6457
6541
  game_items: { icon: "wallet", category: "game_items" },
6458
6542
  cash: { icon: "cash", category: "cash" },
6459
6543
  voucher: { icon: "cash", category: "cash" }
@@ -6654,6 +6738,7 @@ export {
6654
6738
  Regions,
6655
6739
  AvailabilityOverrides,
6656
6740
  Subscriptions,
6741
+ Audit,
6657
6742
  Settlement,
6658
6743
  OperationLimits,
6659
6744
  Risk,
@@ -6674,6 +6759,9 @@ export {
6674
6759
  buttonPadValue,
6675
6760
  logoDimensions,
6676
6761
  isHexColor,
6762
+ WCAG_AA_TEXT,
6763
+ WCAG_AA_UI,
6764
+ contrastRatio,
6677
6765
  isDarkSurface,
6678
6766
  DEFAULT_BADGES,
6679
6767
  DEFAULT_BADGES_DARK,
@@ -6748,4 +6836,4 @@ export {
6748
6836
  decodeNativePanes,
6749
6837
  encodeNativePanes
6750
6838
  };
6751
- //# sourceMappingURL=chunk-XMFG7CPX.js.map
6839
+ //# sourceMappingURL=chunk-3O5MU6FP.js.map