@delopay/sdk 0.111.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
  }
@@ -5083,14 +5105,41 @@ var HEX_RE = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
5083
5105
  function isHexColor(value) {
5084
5106
  return HEX_RE.test(value.trim());
5085
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
+ }
5086
5139
  function isDarkSurface(color) {
5087
- const m = color.replace("#", "").trim();
5088
- if (m.length !== 3 && m.length !== 6) return false;
5089
- const full = m.length === 3 ? m.split("").map((c) => c + c).join("") : m;
5090
- const r = parseInt(full.slice(0, 2), 16);
5091
- const g = parseInt(full.slice(2, 4), 16);
5092
- const b = parseInt(full.slice(4, 6), 16);
5093
- 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;
5094
5143
  const luma = (r * 299 + g * 587 + b * 114) / 1e3;
5095
5144
  return luma < 128;
5096
5145
  }
@@ -6710,6 +6759,9 @@ export {
6710
6759
  buttonPadValue,
6711
6760
  logoDimensions,
6712
6761
  isHexColor,
6762
+ WCAG_AA_TEXT,
6763
+ WCAG_AA_UI,
6764
+ contrastRatio,
6713
6765
  isDarkSurface,
6714
6766
  DEFAULT_BADGES,
6715
6767
  DEFAULT_BADGES_DARK,
@@ -6784,4 +6836,4 @@ export {
6784
6836
  decodeNativePanes,
6785
6837
  encodeNativePanes
6786
6838
  };
6787
- //# sourceMappingURL=chunk-TS422PA3.js.map
6839
+ //# sourceMappingURL=chunk-3O5MU6FP.js.map