@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.
@@ -2830,7 +2830,10 @@ var Shops = class {
2830
2830
  * @param merchantId - The merchant account ID.
2831
2831
  * @param shopId - The shop (business profile) ID to restyle.
2832
2832
  * @param params - The new `payment_link_config` blob (full replacement).
2833
- * @returns The updated business profile.
2833
+ * @returns The saved branding — the same shape `retrieveCheckoutBranding`
2834
+ * returns, not the whole shop. A role whose only power is restyling a
2835
+ * checkout must not receive the webhook signing key or the card-vault
2836
+ * configuration back from a save.
2834
2837
  */
2835
2838
  async updateCheckoutBranding(merchantId, shopId, params, options) {
2836
2839
  return this.request(
@@ -3555,6 +3558,28 @@ var Analytics = class {
3555
3558
  */
3556
3559
  async deviceTransactions(params) {
3557
3560
  return this.request("GET", "/analytics/devices/transactions", {
3561
+ // A discriminated union carries no index signature, so the widening
3562
+ // goes via `unknown` — the union is the point.
3563
+ query: params
3564
+ });
3565
+ }
3566
+ /**
3567
+ * The payments behind one clicked element of the payments dashboard: a
3568
+ * processor-donut slice, a payment-method slice, an outcome segment of a
3569
+ * series bar, a series bucket, or a breakdown row — combinable, with
3570
+ * `target_bucket` narrowing every other target. The outcome mapping is the
3571
+ * one the series and donuts are folded with, expanded server-side, so the
3572
+ * list is what the clicked number was made of. Rows and the whole-match
3573
+ * `summary` carry USD figures converted with the dashboard's own rates.
3574
+ * Same window/scope/chip contract as `scope`; sorted per `sort_on` /
3575
+ * `sort_by`, `limit` rows (default 50) per page, `offset` for the next.
3576
+ * `GET /analytics/scope/transactions`
3577
+ */
3578
+ async scopeTransactions(params) {
3579
+ return this.request("GET", "/analytics/scope/transactions", {
3580
+ // A discriminated union carries no index signature, so the widening
3581
+ // goes via `unknown` — the union is the point, and the query builder
3582
+ // only ever reads own enumerable keys.
3558
3583
  query: params
3559
3584
  });
3560
3585
  }
@@ -5083,14 +5108,41 @@ var HEX_RE = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
5083
5108
  function isHexColor(value) {
5084
5109
  return HEX_RE.test(value.trim());
5085
5110
  }
5111
+ var CSS_HEX_RE = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
5112
+ var LENIENT_HEX_RE = /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
5113
+ function parseHexChannels(value, pattern) {
5114
+ const match = pattern.exec(value.trim());
5115
+ if (!match) return null;
5116
+ const digits = match[1];
5117
+ const full = digits.length === 3 ? digits.split("").map((c) => c + c).join("") : digits;
5118
+ return [
5119
+ parseInt(full.slice(0, 2), 16),
5120
+ parseInt(full.slice(2, 4), 16),
5121
+ parseInt(full.slice(4, 6), 16)
5122
+ ];
5123
+ }
5124
+ function relativeLuminance([r, g, b]) {
5125
+ const [lr, lg, lb] = [r, g, b].map((channel) => {
5126
+ const c = channel / 255;
5127
+ return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
5128
+ });
5129
+ return 0.2126 * lr + 0.7152 * lg + 0.0722 * lb;
5130
+ }
5131
+ var WCAG_AA_TEXT = 4.5;
5132
+ var WCAG_AA_UI = 3;
5133
+ function contrastRatio(a, b) {
5134
+ const first = parseHexChannels(a, CSS_HEX_RE);
5135
+ const second = parseHexChannels(b, CSS_HEX_RE);
5136
+ if (!first || !second) return null;
5137
+ const [x, y] = [relativeLuminance(first), relativeLuminance(second)];
5138
+ const lighter = Math.max(x, y);
5139
+ const darker = Math.min(x, y);
5140
+ return (lighter + 0.05) / (darker + 0.05);
5141
+ }
5086
5142
  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;
5143
+ const channels = parseHexChannels(color, LENIENT_HEX_RE);
5144
+ if (!channels) return false;
5145
+ const [r, g, b] = channels;
5094
5146
  const luma = (r * 299 + g * 587 + b * 114) / 1e3;
5095
5147
  return luma < 128;
5096
5148
  }
@@ -6710,6 +6762,9 @@ export {
6710
6762
  buttonPadValue,
6711
6763
  logoDimensions,
6712
6764
  isHexColor,
6765
+ WCAG_AA_TEXT,
6766
+ WCAG_AA_UI,
6767
+ contrastRatio,
6713
6768
  isDarkSurface,
6714
6769
  DEFAULT_BADGES,
6715
6770
  DEFAULT_BADGES_DARK,
@@ -6784,4 +6839,4 @@ export {
6784
6839
  decodeNativePanes,
6785
6840
  encodeNativePanes
6786
6841
  };
6787
- //# sourceMappingURL=chunk-TS422PA3.js.map
6842
+ //# sourceMappingURL=chunk-NY5O6S5X.js.map