@delopay/sdk 0.351.0 → 0.358.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/internal.cjs CHANGED
@@ -80,12 +80,35 @@ __export(internal_exports, {
80
80
  DEFAULT_BADGES_DARK: () => DEFAULT_BADGES_DARK,
81
81
  DEFAULT_BRANDING: () => DEFAULT_BRANDING,
82
82
  DEFAULT_BRANDING_DARK: () => DEFAULT_BRANDING_DARK,
83
+ DEFAULT_ENIGMA_CARD_FORM: () => DEFAULT_ENIGMA_CARD_FORM,
83
84
  DEFAULT_NOTICES: () => DEFAULT_NOTICES,
84
85
  Delopay: () => Delopay,
85
86
  DelopayAuthenticationError: () => DelopayAuthenticationError,
86
87
  DelopayError: () => DelopayError,
87
88
  DelopayInternal: () => DelopayInternal,
88
89
  Diagnostic: () => Diagnostic,
90
+ ENIGMA_CLICK_FEEDBACK: () => ENIGMA_CLICK_FEEDBACK,
91
+ ENIGMA_CORNERS: () => ENIGMA_CORNERS,
92
+ ENIGMA_CUSTOM_CSS_MAX_LENGTH: () => ENIGMA_CUSTOM_CSS_MAX_LENGTH,
93
+ ENIGMA_CUSTOM_HEIGHT_DEFAULT: () => ENIGMA_CUSTOM_HEIGHT_DEFAULT,
94
+ ENIGMA_CUSTOM_HEIGHT_MAX: () => ENIGMA_CUSTOM_HEIGHT_MAX,
95
+ ENIGMA_CUSTOM_HEIGHT_MIN: () => ENIGMA_CUSTOM_HEIGHT_MIN,
96
+ ENIGMA_FIELD_CHROMES: () => ENIGMA_FIELD_CHROMES,
97
+ ENIGMA_FIELD_HEIGHTS: () => ENIGMA_FIELD_HEIGHTS,
98
+ ENIGMA_FIELD_MOTIONS: () => ENIGMA_FIELD_MOTIONS,
99
+ ENIGMA_FIELD_ORDERS: () => ENIGMA_FIELD_ORDERS,
100
+ ENIGMA_FOCUS_RINGS: () => ENIGMA_FOCUS_RINGS,
101
+ ENIGMA_LABEL_PLACEMENTS: () => ENIGMA_LABEL_PLACEMENTS,
102
+ ENIGMA_LABEL_TONES: () => ENIGMA_LABEL_TONES,
103
+ ENIGMA_LOADING_STYLES: () => ENIGMA_LOADING_STYLES,
104
+ ENIGMA_NETWORK_MARKS: () => ENIGMA_NETWORK_MARKS,
105
+ ENIGMA_OPENINGS: () => ENIGMA_OPENINGS,
106
+ ENIGMA_PAY_FEEDBACK: () => ENIGMA_PAY_FEEDBACK,
107
+ ENIGMA_REVEALS: () => ENIGMA_REVEALS,
108
+ ENIGMA_ROW_GAPS: () => ENIGMA_ROW_GAPS,
109
+ ENIGMA_STYLE_MODES: () => ENIGMA_STYLE_MODES,
110
+ ENIGMA_TEMPLATES: () => ENIGMA_TEMPLATES,
111
+ ENIGMA_TEMPLATE_PRESETS: () => ENIGMA_TEMPLATE_PRESETS,
89
112
  Export: () => Export,
90
113
  ExternalRecords: () => ExternalRecords,
91
114
  FeatureMatrix: () => FeatureMatrix,
@@ -185,6 +208,7 @@ __export(internal_exports, {
185
208
  allOf: () => allOf,
186
209
  anyOf: () => anyOf,
187
210
  applyBrandingVariables: () => applyBrandingVariables,
211
+ applyEnigmaTemplate: () => applyEnigmaTemplate,
188
212
  asAirwallexCardPreset: () => asAirwallexCardPreset,
189
213
  brandingAssetPath: () => brandingAssetPath,
190
214
  buildBrandingExport: () => buildBrandingExport,
@@ -213,6 +237,7 @@ __export(internal_exports, {
213
237
  decodeBadges: () => decodeBadges,
214
238
  decodeBranding: () => decodeBranding,
215
239
  decodeCustomFields: () => decodeCustomFields,
240
+ decodeEnigmaCardForm: () => decodeEnigmaCardForm,
216
241
  decodeMethodSectionLabels: () => decodeMethodSectionLabels,
217
242
  decodeMethodSectionOrder: () => decodeMethodSectionOrder,
218
243
  decodeNativePanes: () => decodeNativePanes,
@@ -229,11 +254,17 @@ __export(internal_exports, {
229
254
  encodeBadges: () => encodeBadges,
230
255
  encodeBranding: () => encodeBranding,
231
256
  encodeCustomFields: () => encodeCustomFields,
257
+ encodeEnigmaCardForm: () => encodeEnigmaCardForm,
232
258
  encodeMethodSectionLabels: () => encodeMethodSectionLabels,
233
259
  encodeMethodSectionOrder: () => encodeMethodSectionOrder,
234
260
  encodeNativePanes: () => encodeNativePanes,
235
261
  encodeNotices: () => encodeNotices,
236
262
  encodePanes: () => encodePanes,
263
+ enigmaCornerPx: () => enigmaCornerPx,
264
+ enigmaCustomCssProblem: () => enigmaCustomCssProblem,
265
+ enigmaDefaultFill: () => enigmaDefaultFill,
266
+ enigmaNamesInside: () => enigmaNamesInside,
267
+ enigmaTemplateChanges: () => enigmaTemplateChanges,
237
268
  evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
238
269
  evaluateCustomFieldVisibility: () => evaluateCustomFieldVisibility,
239
270
  feeProgram: () => feeProgram,
@@ -10020,7 +10051,8 @@ var Settlement = class {
10020
10051
  });
10021
10052
  }
10022
10053
  /**
10023
- * Export a statement as PDF. Returns the raw PDF bytes as a `Blob`, with
10054
+ * Export a statement as PDF, or with `format` as CSV, JSON
10055
+ * (`StatementDocument`) or XLSX. Returns the raw bytes as a `Blob`, with
10024
10056
  * the same auth, retries and error handling as every other call — persist
10025
10057
  * or object-URL it caller-side.
10026
10058
  *
@@ -10039,7 +10071,8 @@ var Settlement = class {
10039
10071
  return this.request("GET", `/settlement/statements/${encodeURIComponent(statementId)}/pdf`, {
10040
10072
  query: {
10041
10073
  currency: params?.currency,
10042
- include_transactions: params?.include_transactions
10074
+ include_transactions: params?.include_transactions,
10075
+ format: params?.format
10043
10076
  },
10044
10077
  responseType: "blob",
10045
10078
  ...options
@@ -10303,7 +10336,21 @@ var OperationLimits = class {
10303
10336
  */
10304
10337
  async retrieveUsage(params, options) {
10305
10338
  return this.request("GET", "/operation-limits/usage", {
10306
- query: { operation: params.operation },
10339
+ query: { operation: params.operation, profile_id: params.profile_id },
10340
+ ...options
10341
+ });
10342
+ }
10343
+ /**
10344
+ * The version history of the merchant's limit settings, newest first: every
10345
+ * rule created, changed (switched off or on included) or deleted, and every
10346
+ * settings change, with who made it (and who really did, under act-as) and
10347
+ * the values before and after.
10348
+ *
10349
+ * `GET /operation-limits/history`
10350
+ */
10351
+ async listHistory(params, options) {
10352
+ return this.request("GET", "/operation-limits/history", {
10353
+ query: { limit: params?.limit, before: params?.before },
10307
10354
  ...options
10308
10355
  });
10309
10356
  }
@@ -11950,9 +11997,9 @@ function resolveStripeTheme(theme, dark) {
11950
11997
  var STRIPE_INPUT_STYLES = ["spaced", "condensed"];
11951
11998
  var STRIPE_LABEL_PLACEMENTS = ["above", "floating"];
11952
11999
  var STRIPE_SPACINGS = ["compact", "comfortable", "spacious"];
11953
- function stripeSpacingValues(spacing) {
11954
- if (spacing === "compact") return { spacingUnit: "3px", gridRowSpacing: "8px" };
11955
- if (spacing === "spacious") return { spacingUnit: "5px", gridRowSpacing: "16px" };
12000
+ function stripeSpacingValues(spacing2) {
12001
+ if (spacing2 === "compact") return { spacingUnit: "3px", gridRowSpacing: "8px" };
12002
+ if (spacing2 === "spacious") return { spacingUnit: "5px", gridRowSpacing: "16px" };
11956
12003
  return { spacingUnit: "4px", gridRowSpacing: "12px" };
11957
12004
  }
11958
12005
  var PAYPAL_CARD_LAYOUTS = ["split", "stacked"];
@@ -12232,6 +12279,444 @@ function matchWhopLook(settings) {
12232
12279
  ) ?? null;
12233
12280
  }
12234
12281
 
12282
+ // src/enigmaCardForm.ts
12283
+ var ENIGMA_FIELD_CHROMES = ["outlined", "filled", "underline", "joined"];
12284
+ var ENIGMA_LABEL_PLACEMENTS = ["above", "inside"];
12285
+ var ENIGMA_LABEL_TONES = ["strong", "muted"];
12286
+ var ENIGMA_FIELD_ORDERS = ["number", "name"];
12287
+ var ENIGMA_NETWORK_MARKS = ["live", "static", "hidden"];
12288
+ var ENIGMA_FOCUS_RINGS = ["strong", "subtle"];
12289
+ var ENIGMA_FIELD_MOTIONS = ["smooth", "slow", "none"];
12290
+ var ENIGMA_FIELD_HEIGHTS = ["40", "44", "48", "52"];
12291
+ var ENIGMA_ROW_GAPS = ["8", "12", "16"];
12292
+ var ENIGMA_CORNERS = ["square", "small", "medium", "large", "pill"];
12293
+ var ENIGMA_STYLE_MODES = ["designed", "custom"];
12294
+ var ENIGMA_OPENINGS = ["place", "expand"];
12295
+ var ENIGMA_CLICK_FEEDBACK = ["both", "ring", "press", "none"];
12296
+ var ENIGMA_LOADING_STYLES = [
12297
+ "shimmer",
12298
+ "pulse",
12299
+ "dim",
12300
+ "line",
12301
+ "spinner",
12302
+ "none"
12303
+ ];
12304
+ var ENIGMA_REVEALS = ["fade", "rise", "wipe", "none"];
12305
+ var ENIGMA_PAY_FEEDBACK = ["spinner", "press", "none"];
12306
+ var ENIGMA_TEMPLATES = [
12307
+ "soft",
12308
+ "fields",
12309
+ "classic",
12310
+ "compact",
12311
+ "filled",
12312
+ "underline"
12313
+ ];
12314
+ var ENIGMA_CUSTOM_CSS_MAX_LENGTH = 950;
12315
+ var ENIGMA_CUSTOM_HEIGHT_MIN = 120;
12316
+ var ENIGMA_CUSTOM_HEIGHT_MAX = 600;
12317
+ var ENIGMA_CUSTOM_HEIGHT_DEFAULT = 260;
12318
+ var ENIGMA_TEMPLATE_PRESETS = {
12319
+ soft: {
12320
+ enigmaChrome: "outlined",
12321
+ enigmaLabels: "above",
12322
+ enigmaLabelTone: "strong",
12323
+ enigmaHints: true,
12324
+ enigmaCvcIcon: true,
12325
+ enigmaFieldOrder: "number",
12326
+ enigmaMarks: "live",
12327
+ enigmaFocusRing: "strong",
12328
+ enigmaFieldHeight: "44",
12329
+ enigmaRowGap: "12",
12330
+ enigmaCorner: "medium"
12331
+ },
12332
+ fields: {
12333
+ enigmaChrome: "outlined",
12334
+ enigmaLabels: "above",
12335
+ enigmaLabelTone: "muted",
12336
+ enigmaHints: true,
12337
+ enigmaCvcIcon: true,
12338
+ enigmaFieldOrder: "number",
12339
+ enigmaMarks: "live",
12340
+ enigmaFocusRing: "strong",
12341
+ enigmaFieldHeight: "48",
12342
+ enigmaRowGap: "12",
12343
+ enigmaCorner: "small"
12344
+ },
12345
+ classic: {
12346
+ enigmaChrome: "outlined",
12347
+ enigmaLabels: "above",
12348
+ enigmaLabelTone: "strong",
12349
+ enigmaHints: false,
12350
+ enigmaCvcIcon: true,
12351
+ enigmaFieldOrder: "number",
12352
+ enigmaMarks: "live",
12353
+ enigmaFocusRing: "strong",
12354
+ enigmaFieldHeight: "44",
12355
+ enigmaRowGap: "12",
12356
+ enigmaCorner: "medium"
12357
+ },
12358
+ compact: {
12359
+ enigmaChrome: "joined",
12360
+ enigmaLabels: "inside",
12361
+ enigmaLabelTone: "muted",
12362
+ enigmaHints: false,
12363
+ enigmaCvcIcon: true,
12364
+ enigmaFieldOrder: "number",
12365
+ enigmaMarks: "live",
12366
+ enigmaFocusRing: "strong",
12367
+ enigmaFieldHeight: "48",
12368
+ enigmaRowGap: "12",
12369
+ enigmaCorner: "medium"
12370
+ },
12371
+ filled: {
12372
+ enigmaChrome: "filled",
12373
+ enigmaLabels: "above",
12374
+ enigmaLabelTone: "strong",
12375
+ enigmaHints: false,
12376
+ enigmaCvcIcon: true,
12377
+ enigmaFieldOrder: "number",
12378
+ enigmaMarks: "live",
12379
+ enigmaFocusRing: "strong",
12380
+ enigmaFieldHeight: "44",
12381
+ enigmaRowGap: "12",
12382
+ enigmaCorner: "medium"
12383
+ },
12384
+ underline: {
12385
+ enigmaChrome: "underline",
12386
+ enigmaLabels: "above",
12387
+ enigmaLabelTone: "muted",
12388
+ enigmaHints: false,
12389
+ enigmaCvcIcon: true,
12390
+ enigmaFieldOrder: "number",
12391
+ enigmaMarks: "live",
12392
+ enigmaFocusRing: "strong",
12393
+ enigmaFieldHeight: "40",
12394
+ enigmaRowGap: "16",
12395
+ enigmaCorner: "square"
12396
+ }
12397
+ };
12398
+ var DEFAULT_ENIGMA_CARD_FORM = {
12399
+ enigmaTemplate: "soft",
12400
+ enigmaStyleMode: "designed",
12401
+ ...ENIGMA_TEMPLATE_PRESETS.soft,
12402
+ enigmaFieldMotion: "smooth",
12403
+ enigmaAccent: "",
12404
+ enigmaBorder: "",
12405
+ enigmaFill: "",
12406
+ enigmaTrustLine: true,
12407
+ enigmaAutoOpen: false,
12408
+ enigmaOpening: "place",
12409
+ enigmaClickFeedback: "both",
12410
+ enigmaLoading: "shimmer",
12411
+ enigmaReveal: "fade",
12412
+ enigmaPayFeedback: "spinner",
12413
+ enigmaCustomCss: "",
12414
+ enigmaCustomHeight: ENIGMA_CUSTOM_HEIGHT_DEFAULT
12415
+ };
12416
+ function applyEnigmaTemplate(template) {
12417
+ return { enigmaTemplate: template, ...ENIGMA_TEMPLATE_PRESETS[template] };
12418
+ }
12419
+ function enigmaTemplateChanges(settings) {
12420
+ const preset = ENIGMA_TEMPLATE_PRESETS[settings.enigmaTemplate];
12421
+ return Object.keys(preset).filter(
12422
+ (key) => settings[key] !== preset[key]
12423
+ );
12424
+ }
12425
+ function enigmaNamesInside(settings) {
12426
+ return settings.enigmaChrome === "joined" || settings.enigmaLabels === "inside";
12427
+ }
12428
+ var PSEUDO_CLASSES = [
12429
+ "focus",
12430
+ "focus-visible",
12431
+ "focus-within",
12432
+ "hover",
12433
+ "checked",
12434
+ "disabled",
12435
+ "invalid",
12436
+ "valid",
12437
+ "placeholder-shown",
12438
+ "first-child",
12439
+ "last-child"
12440
+ ];
12441
+ var HIDEABLE = ["p", "h1", "#header", "#headertext", ".timer", "#timer"];
12442
+ var PROPERTIES = [
12443
+ "color",
12444
+ "caret-color",
12445
+ "accent-color",
12446
+ "-webkit-text-fill-color",
12447
+ "background",
12448
+ "background-color",
12449
+ "border",
12450
+ "border-top",
12451
+ "border-right",
12452
+ "border-bottom",
12453
+ "border-left",
12454
+ "border-color",
12455
+ "border-width",
12456
+ "border-style",
12457
+ "border-top-color",
12458
+ "border-right-color",
12459
+ "border-bottom-color",
12460
+ "border-left-color",
12461
+ "border-top-width",
12462
+ "border-right-width",
12463
+ "border-bottom-width",
12464
+ "border-left-width",
12465
+ "border-radius",
12466
+ "border-top-left-radius",
12467
+ "border-top-right-radius",
12468
+ "border-bottom-left-radius",
12469
+ "border-bottom-right-radius",
12470
+ "box-shadow",
12471
+ "outline",
12472
+ "outline-color",
12473
+ "outline-offset",
12474
+ "font",
12475
+ "font-family",
12476
+ "font-size",
12477
+ "font-weight",
12478
+ "font-style",
12479
+ "letter-spacing",
12480
+ "line-height",
12481
+ "text-align",
12482
+ "text-transform",
12483
+ "padding",
12484
+ "padding-top",
12485
+ "padding-right",
12486
+ "padding-bottom",
12487
+ "padding-left",
12488
+ "margin",
12489
+ "margin-top",
12490
+ "margin-right",
12491
+ "margin-bottom",
12492
+ "margin-left",
12493
+ "height",
12494
+ "min-height",
12495
+ "width",
12496
+ "min-width",
12497
+ "max-width",
12498
+ "display",
12499
+ "flex-wrap",
12500
+ "gap",
12501
+ "transition",
12502
+ "box-sizing",
12503
+ "top"
12504
+ ];
12505
+ function lengthAtLeast(value, min) {
12506
+ const match = /^(-?[0-9.]+)(px|em|rem)$/.exec(value);
12507
+ if (!match) return false;
12508
+ const number = Number(match[1]) * (match[2] === "px" ? 1 : 16);
12509
+ return Number.isFinite(number) && number >= min;
12510
+ }
12511
+ function spacing(value) {
12512
+ return value.split(" ").every(
12513
+ (part) => part === "0" || part === "auto" || lengthAtLeast(part, 0) && !lengthAtLeast(part, 48.5)
12514
+ );
12515
+ }
12516
+ function width(value) {
12517
+ if (value === "auto") return true;
12518
+ if (value.endsWith("%")) return Number(value.slice(0, -1)) >= 20;
12519
+ const calc = /^calc\(([0-9.]+)% - ([0-9.]+)px\)$/.exec(value);
12520
+ if (calc) return Number(calc[1]) >= 20 && Number(calc[2]) <= 48;
12521
+ if (value.startsWith("calc(")) return false;
12522
+ return lengthAtLeast(value, 40);
12523
+ }
12524
+ function opaqueColour(value) {
12525
+ if (value.startsWith("#")) return /^#([0-9a-f]{3}|[0-9a-f]{6})$/.test(value);
12526
+ if (value.startsWith("rgb("))
12527
+ return value.endsWith(")") && value.split(",").length === 3 && !value.includes("/");
12528
+ return value !== "transparent" && /^[a-z]+$/.test(value);
12529
+ }
12530
+ function declarationProblem(selector, declaration) {
12531
+ const at = declaration.indexOf(":");
12532
+ if (at < 0) return null;
12533
+ const property = declaration.slice(0, at).trim();
12534
+ const raw = declaration.slice(at + 1).trim();
12535
+ const important = raw.endsWith("!important");
12536
+ const value = raw.replace(/!important$/, "").trim();
12537
+ if (!PROPERTIES.includes(property)) return "property";
12538
+ if (["var(", "env(", "attr("].some((fn) => value.includes(fn))) return "variable";
12539
+ let ok = true;
12540
+ switch (property) {
12541
+ case "display": {
12542
+ if (important) return "important_display";
12543
+ const hideable = selector.split(",").every((one) => {
12544
+ const subject = one.split(/[ >]/).pop() ?? one;
12545
+ return HIDEABLE.includes(subject.split(":")[0] ?? subject);
12546
+ });
12547
+ ok = ["block", "flex", "grid", "inline", "inline-block", "inline-flex"].includes(value) || value === "none" && hideable;
12548
+ break;
12549
+ }
12550
+ case "margin":
12551
+ case "margin-top":
12552
+ case "margin-right":
12553
+ case "margin-bottom":
12554
+ case "margin-left":
12555
+ case "padding":
12556
+ case "padding-top":
12557
+ case "padding-right":
12558
+ case "padding-bottom":
12559
+ case "padding-left":
12560
+ ok = spacing(value);
12561
+ break;
12562
+ case "height":
12563
+ case "min-height":
12564
+ ok = value === "auto" || lengthAtLeast(value, 20);
12565
+ break;
12566
+ case "width":
12567
+ case "min-width":
12568
+ case "max-width":
12569
+ ok = width(value);
12570
+ break;
12571
+ case "font-size":
12572
+ ok = lengthAtLeast(value, 12);
12573
+ break;
12574
+ case "font": {
12575
+ const size = value.split(/[ /]/).find((part) => part.endsWith("px") || part.endsWith("em"));
12576
+ ok = size !== void 0 && lengthAtLeast(size, 12);
12577
+ break;
12578
+ }
12579
+ case "line-height":
12580
+ ok = value === "normal" || Number(value) >= 1 || lengthAtLeast(value, 12);
12581
+ break;
12582
+ case "color":
12583
+ case "caret-color":
12584
+ ok = opaqueColour(value);
12585
+ break;
12586
+ case "top":
12587
+ ok = value === "0" || /^-?[0-9.]+px$/.test(value) && Math.abs(parseFloat(value)) <= 4;
12588
+ break;
12589
+ case "-webkit-text-fill-color":
12590
+ ok = selector.split(",").every((one) => (one.split(/[ >]/).pop() ?? "").includes(":placeholder-shown")) || opaqueColour(value);
12591
+ break;
12592
+ }
12593
+ return ok ? null : "hides_field";
12594
+ }
12595
+ function selectorProblem(selector) {
12596
+ if (!selector || !/^[a-z0-9\-_#.:,> ]+$/.test(selector) || selector.includes("::"))
12597
+ return "selector";
12598
+ const pseudoOk = selector.split(":").slice(1).every((after) => PSEUDO_CLASSES.includes(after.split(/[ >,.#]/)[0] ?? after));
12599
+ return pseudoOk ? null : "selector";
12600
+ }
12601
+ function enigmaCustomCssProblem(css) {
12602
+ if (!css.trim()) return null;
12603
+ if (css.length > ENIGMA_CUSTOM_CSS_MAX_LENGTH) return "too_long";
12604
+ if (/[^\x20-\x7e\n\r\t]/.test(css)) return "not_ascii";
12605
+ if (css.includes("<")) return "markup";
12606
+ if (css.includes("\\")) return "escape";
12607
+ const lower = css.toLowerCase();
12608
+ if (lower.includes("/*")) return "comment";
12609
+ if (["url(", "image-set(", "image(", "element(", "cross-fade(", "src(", "data:"].some(
12610
+ (needle) => lower.includes(needle)
12611
+ )) {
12612
+ return "loads_resource";
12613
+ }
12614
+ if (["expression(", "javascript:", "behavior", "-moz-binding"].some(
12615
+ (needle) => lower.includes(needle)
12616
+ )) {
12617
+ return "script";
12618
+ }
12619
+ if (/@(?!media)/.test(lower)) return "at_rule";
12620
+ const compact = lower.split(/\s+/).filter(Boolean).join(" ");
12621
+ const blocks = [];
12622
+ let text = "";
12623
+ for (const ch of compact) {
12624
+ if (ch === "{") {
12625
+ const prelude = text.trim();
12626
+ text = "";
12627
+ const media = prelude.startsWith("@media");
12628
+ if (!media) {
12629
+ const problem = selectorProblem(prelude.replace(/, /g, ","));
12630
+ if (problem) return problem;
12631
+ }
12632
+ blocks.push({ selector: prelude, media });
12633
+ } else if (ch === "}" || ch === ";") {
12634
+ const declaration = text;
12635
+ text = "";
12636
+ const top = blocks[blocks.length - 1];
12637
+ if (!top) {
12638
+ if (ch === "}") return "unbalanced";
12639
+ continue;
12640
+ }
12641
+ if (!top.media && declaration.trim()) {
12642
+ const problem = declarationProblem(top.selector.replace(/, /g, ","), declaration);
12643
+ if (problem) return problem;
12644
+ }
12645
+ if (ch === "}") blocks.pop();
12646
+ } else {
12647
+ text += ch;
12648
+ }
12649
+ }
12650
+ return blocks.length > 0 ? "unbalanced" : null;
12651
+ }
12652
+ function enigmaCornerPx(corner) {
12653
+ return { square: 0, small: 6, medium: 8, large: 12, pill: 22 }[corner];
12654
+ }
12655
+ var HEX = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
12656
+ function pick(value, allowed, fallback) {
12657
+ return typeof value === "string" && allowed.includes(value) ? value : fallback;
12658
+ }
12659
+ function bool(value, fallback) {
12660
+ if (value === true || value === "true") return true;
12661
+ if (value === false || value === "false") return false;
12662
+ return fallback;
12663
+ }
12664
+ function hexOrEmpty(value) {
12665
+ return typeof value === "string" && HEX.test(value.trim()) ? value.trim() : "";
12666
+ }
12667
+ function decodeEnigmaCardForm(source) {
12668
+ const d = DEFAULT_ENIGMA_CARD_FORM;
12669
+ const height = Number(source["enigmaCustomHeight"]);
12670
+ const css = typeof source["enigmaCustomCss"] === "string" ? source["enigmaCustomCss"] : "";
12671
+ return {
12672
+ enigmaTemplate: pick(source["enigmaTemplate"], ENIGMA_TEMPLATES, d.enigmaTemplate),
12673
+ enigmaStyleMode: pick(source["enigmaStyleMode"], ENIGMA_STYLE_MODES, d.enigmaStyleMode),
12674
+ enigmaChrome: pick(source["enigmaChrome"], ENIGMA_FIELD_CHROMES, d.enigmaChrome),
12675
+ enigmaLabels: pick(source["enigmaLabels"], ENIGMA_LABEL_PLACEMENTS, d.enigmaLabels),
12676
+ enigmaLabelTone: pick(source["enigmaLabelTone"], ENIGMA_LABEL_TONES, d.enigmaLabelTone),
12677
+ enigmaHints: bool(source["enigmaHints"], d.enigmaHints),
12678
+ enigmaCvcIcon: bool(source["enigmaCvcIcon"], d.enigmaCvcIcon),
12679
+ enigmaFieldOrder: pick(source["enigmaFieldOrder"], ENIGMA_FIELD_ORDERS, d.enigmaFieldOrder),
12680
+ enigmaMarks: pick(source["enigmaMarks"], ENIGMA_NETWORK_MARKS, d.enigmaMarks),
12681
+ enigmaFocusRing: pick(source["enigmaFocusRing"], ENIGMA_FOCUS_RINGS, d.enigmaFocusRing),
12682
+ enigmaFieldMotion: pick(source["enigmaFieldMotion"], ENIGMA_FIELD_MOTIONS, d.enigmaFieldMotion),
12683
+ enigmaFieldHeight: pick(
12684
+ String(source["enigmaFieldHeight"] ?? ""),
12685
+ ENIGMA_FIELD_HEIGHTS,
12686
+ d.enigmaFieldHeight
12687
+ ),
12688
+ enigmaRowGap: pick(String(source["enigmaRowGap"] ?? ""), ENIGMA_ROW_GAPS, d.enigmaRowGap),
12689
+ enigmaCorner: pick(source["enigmaCorner"], ENIGMA_CORNERS, d.enigmaCorner),
12690
+ enigmaAccent: hexOrEmpty(source["enigmaAccent"]),
12691
+ enigmaBorder: hexOrEmpty(source["enigmaBorder"]),
12692
+ enigmaFill: hexOrEmpty(source["enigmaFill"]),
12693
+ enigmaTrustLine: bool(source["enigmaTrustLine"], d.enigmaTrustLine),
12694
+ enigmaAutoOpen: bool(source["enigmaAutoOpen"], d.enigmaAutoOpen),
12695
+ enigmaOpening: pick(source["enigmaOpening"], ENIGMA_OPENINGS, d.enigmaOpening),
12696
+ enigmaClickFeedback: pick(
12697
+ source["enigmaClickFeedback"],
12698
+ ENIGMA_CLICK_FEEDBACK,
12699
+ d.enigmaClickFeedback
12700
+ ),
12701
+ enigmaLoading: pick(source["enigmaLoading"], ENIGMA_LOADING_STYLES, d.enigmaLoading),
12702
+ enigmaReveal: pick(source["enigmaReveal"], ENIGMA_REVEALS, d.enigmaReveal),
12703
+ enigmaPayFeedback: pick(source["enigmaPayFeedback"], ENIGMA_PAY_FEEDBACK, d.enigmaPayFeedback),
12704
+ enigmaCustomCss: css.slice(0, ENIGMA_CUSTOM_CSS_MAX_LENGTH),
12705
+ enigmaCustomHeight: Number.isInteger(height) && height >= ENIGMA_CUSTOM_HEIGHT_MIN && height <= ENIGMA_CUSTOM_HEIGHT_MAX ? height : d.enigmaCustomHeight
12706
+ };
12707
+ }
12708
+ function encodeEnigmaCardForm(settings) {
12709
+ const out = {};
12710
+ for (const key of Object.keys(DEFAULT_ENIGMA_CARD_FORM)) {
12711
+ const value = settings[key];
12712
+ if (value === DEFAULT_ENIGMA_CARD_FORM[key]) continue;
12713
+ const text = String(value);
12714
+ if (key === "enigmaCustomCss" && !text.trim()) continue;
12715
+ out[key] = text;
12716
+ }
12717
+ return out;
12718
+ }
12719
+
12235
12720
  // src/branding.ts
12236
12721
  function surchargeShowsLabel(labelMode, style, position) {
12237
12722
  if (labelMode !== "labelled") return false;
@@ -12505,18 +12990,48 @@ function inputPadValue(size) {
12505
12990
  function buttonPadValue(size) {
12506
12991
  return BUTTON_PAD[size] ?? BUTTON_PAD.md;
12507
12992
  }
12508
- function vaultFormAppearance(b, danger) {
12509
- return {
12993
+ function vaultFormAppearance(b, danger, options = {}) {
12994
+ const border = b.enigmaBorder || b.border;
12995
+ const look = {
12510
12996
  surface: b.surface,
12511
12997
  text: b.text,
12512
- border: b.border,
12513
- accent: b.primary,
12998
+ border,
12999
+ accent: b.enigmaAccent || b.primary,
12514
13000
  ...danger ? { danger } : {},
12515
13001
  font: b.fontFamily,
12516
13002
  radius: b.radiusInput,
12517
13003
  size: b.inputSize,
12518
13004
  labels: b.labelStyle
12519
13005
  };
13006
+ if (!options.designed) return look;
13007
+ return {
13008
+ ...look,
13009
+ chrome: b.enigmaChrome,
13010
+ label: enigmaNamesInside(b) ? "inside" : "above",
13011
+ hints: b.enigmaHints,
13012
+ order: b.enigmaFieldOrder,
13013
+ marks: b.enigmaMarks,
13014
+ focus: b.enigmaFocusRing,
13015
+ motion: b.enigmaFieldMotion,
13016
+ height: b.enigmaFieldHeight,
13017
+ gap: b.enigmaRowGap,
13018
+ corner: b.enigmaCorner,
13019
+ fill: b.enigmaFill || enigmaDefaultFill(b.surface, b.text),
13020
+ ...b.enigmaStyleMode === "custom" ? { custom: true } : {}
13021
+ };
13022
+ }
13023
+ function enigmaDefaultFill(surface, text) {
13024
+ const channels = (hex) => {
13025
+ const v = hex.trim().replace("#", "");
13026
+ const full = v.length === 3 ? v.replace(/./g, "$&$&") : v;
13027
+ if (!/^[0-9a-fA-F]{6}$/.test(full)) return null;
13028
+ return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16));
13029
+ };
13030
+ const s2 = channels(surface) ?? [255, 255, 255];
13031
+ const t = channels(text) ?? [30, 41, 59];
13032
+ return `#${s2.map(
13033
+ (value, i) => Math.round(value * 0.94 + (t[i] ?? 0) * 0.06).toString(16).padStart(2, "0")
13034
+ ).join("")}`;
12520
13035
  }
12521
13036
  function logoDimensions(size) {
12522
13037
  switch (size) {
@@ -13018,7 +13533,9 @@ var DEFAULT_BRANDING_BASE = {
13018
13533
  whopShadow: "soft",
13019
13534
  whopMethodIcons: true,
13020
13535
  whopSelection: "radio_tint",
13021
- customCss: ""
13536
+ customCss: "",
13537
+ // The Enigma Vault card form: the Stripe-like template.
13538
+ ...DEFAULT_ENIGMA_CARD_FORM
13022
13539
  };
13023
13540
  var DEFAULT_BRANDING = {
13024
13541
  ...DEFAULT_BRANDING_BASE,
@@ -14128,7 +14645,8 @@ function decodeBranding(source) {
14128
14645
  GOOGLE_PAY_BUTTON_TYPES,
14129
14646
  DEFAULT_BRANDING.nomupayGooglePayButtonType
14130
14647
  ),
14131
- customCss: s(extras["customCss"])
14648
+ customCss: s(extras["customCss"]),
14649
+ ...decodeEnigmaCardForm(extras)
14132
14650
  };
14133
14651
  }
14134
14652
  function encodeBranding(branding, base) {
@@ -14290,6 +14808,7 @@ function encodeBranding(branding, base) {
14290
14808
  if (support) extras["supportEmail"] = support;
14291
14809
  const css = trim(branding.customCss);
14292
14810
  if (css) extras["customCss"] = css;
14811
+ Object.assign(extras, encodeEnigmaCardForm(branding));
14293
14812
  const nextRules = {
14294
14813
  ...existingRules,
14295
14814
  [BRANDING_GROUP_KEY]: extras
@@ -14810,7 +15329,8 @@ function parseImportedBranding(raw) {
14810
15329
  GOOGLE_PAY_BUTTON_TYPES,
14811
15330
  dflt.nomupayGooglePayButtonType
14812
15331
  ),
14813
- customCss: sStr(root["customCss"], dflt.customCss).slice(0, CUSTOM_CSS_MAX_LENGTH)
15332
+ customCss: sStr(root["customCss"], dflt.customCss).slice(0, CUSTOM_CSS_MAX_LENGTH),
15333
+ ...decodeEnigmaCardForm(root)
14814
15334
  };
14815
15335
  }
14816
15336
  function isObject(v) {
@@ -14903,7 +15423,19 @@ function vaultFormQuery(params) {
14903
15423
  form_font: look?.font,
14904
15424
  form_radius: look?.radius,
14905
15425
  form_size: look?.size,
14906
- form_labels: look?.labels
15426
+ form_labels: look?.labels,
15427
+ form_chrome: look?.chrome,
15428
+ form_label: look?.label,
15429
+ form_hints: look?.hints === void 0 ? void 0 : String(look.hints),
15430
+ form_order: look?.order,
15431
+ form_marks: look?.marks,
15432
+ form_focus: look?.focus,
15433
+ form_motion: look?.motion,
15434
+ form_height: look?.height,
15435
+ form_gap: look?.gap,
15436
+ form_corner: look?.corner,
15437
+ form_fill: look?.fill,
15438
+ form_custom: look?.custom ? "true" : void 0
14907
15439
  };
14908
15440
  }
14909
15441
  function withoutHeader(headers, name) {
@@ -17455,7 +17987,8 @@ var AdminPortal = class {
17455
17987
  {
17456
17988
  query: {
17457
17989
  currency: params?.currency,
17458
- include_transactions: params?.include_transactions
17990
+ include_transactions: params?.include_transactions,
17991
+ format: params?.format
17459
17992
  },
17460
17993
  responseType: "blob",
17461
17994
  ...options
@@ -18653,12 +19186,35 @@ var DelopayInternal = class extends Delopay {
18653
19186
  DEFAULT_BADGES_DARK,
18654
19187
  DEFAULT_BRANDING,
18655
19188
  DEFAULT_BRANDING_DARK,
19189
+ DEFAULT_ENIGMA_CARD_FORM,
18656
19190
  DEFAULT_NOTICES,
18657
19191
  Delopay,
18658
19192
  DelopayAuthenticationError,
18659
19193
  DelopayError,
18660
19194
  DelopayInternal,
18661
19195
  Diagnostic,
19196
+ ENIGMA_CLICK_FEEDBACK,
19197
+ ENIGMA_CORNERS,
19198
+ ENIGMA_CUSTOM_CSS_MAX_LENGTH,
19199
+ ENIGMA_CUSTOM_HEIGHT_DEFAULT,
19200
+ ENIGMA_CUSTOM_HEIGHT_MAX,
19201
+ ENIGMA_CUSTOM_HEIGHT_MIN,
19202
+ ENIGMA_FIELD_CHROMES,
19203
+ ENIGMA_FIELD_HEIGHTS,
19204
+ ENIGMA_FIELD_MOTIONS,
19205
+ ENIGMA_FIELD_ORDERS,
19206
+ ENIGMA_FOCUS_RINGS,
19207
+ ENIGMA_LABEL_PLACEMENTS,
19208
+ ENIGMA_LABEL_TONES,
19209
+ ENIGMA_LOADING_STYLES,
19210
+ ENIGMA_NETWORK_MARKS,
19211
+ ENIGMA_OPENINGS,
19212
+ ENIGMA_PAY_FEEDBACK,
19213
+ ENIGMA_REVEALS,
19214
+ ENIGMA_ROW_GAPS,
19215
+ ENIGMA_STYLE_MODES,
19216
+ ENIGMA_TEMPLATES,
19217
+ ENIGMA_TEMPLATE_PRESETS,
18662
19218
  Export,
18663
19219
  ExternalRecords,
18664
19220
  FeatureMatrix,
@@ -18758,6 +19314,7 @@ var DelopayInternal = class extends Delopay {
18758
19314
  allOf,
18759
19315
  anyOf,
18760
19316
  applyBrandingVariables,
19317
+ applyEnigmaTemplate,
18761
19318
  asAirwallexCardPreset,
18762
19319
  brandingAssetPath,
18763
19320
  buildBrandingExport,
@@ -18786,6 +19343,7 @@ var DelopayInternal = class extends Delopay {
18786
19343
  decodeBadges,
18787
19344
  decodeBranding,
18788
19345
  decodeCustomFields,
19346
+ decodeEnigmaCardForm,
18789
19347
  decodeMethodSectionLabels,
18790
19348
  decodeMethodSectionOrder,
18791
19349
  decodeNativePanes,
@@ -18802,11 +19360,17 @@ var DelopayInternal = class extends Delopay {
18802
19360
  encodeBadges,
18803
19361
  encodeBranding,
18804
19362
  encodeCustomFields,
19363
+ encodeEnigmaCardForm,
18805
19364
  encodeMethodSectionLabels,
18806
19365
  encodeMethodSectionOrder,
18807
19366
  encodeNativePanes,
18808
19367
  encodeNotices,
18809
19368
  encodePanes,
19369
+ enigmaCornerPx,
19370
+ enigmaCustomCssProblem,
19371
+ enigmaDefaultFill,
19372
+ enigmaNamesInside,
19373
+ enigmaTemplateChanges,
18810
19374
  evaluateCustomFieldCondition,
18811
19375
  evaluateCustomFieldVisibility,
18812
19376
  feeProgram,