@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/index.cjs CHANGED
@@ -70,10 +70,33 @@ __export(index_exports, {
70
70
  DEFAULT_BADGES_DARK: () => DEFAULT_BADGES_DARK,
71
71
  DEFAULT_BRANDING: () => DEFAULT_BRANDING,
72
72
  DEFAULT_BRANDING_DARK: () => DEFAULT_BRANDING_DARK,
73
+ DEFAULT_ENIGMA_CARD_FORM: () => DEFAULT_ENIGMA_CARD_FORM,
73
74
  DEFAULT_NOTICES: () => DEFAULT_NOTICES,
74
75
  Delopay: () => Delopay,
75
76
  DelopayAuthenticationError: () => DelopayAuthenticationError,
76
77
  DelopayError: () => DelopayError,
78
+ ENIGMA_CLICK_FEEDBACK: () => ENIGMA_CLICK_FEEDBACK,
79
+ ENIGMA_CORNERS: () => ENIGMA_CORNERS,
80
+ ENIGMA_CUSTOM_CSS_MAX_LENGTH: () => ENIGMA_CUSTOM_CSS_MAX_LENGTH,
81
+ ENIGMA_CUSTOM_HEIGHT_DEFAULT: () => ENIGMA_CUSTOM_HEIGHT_DEFAULT,
82
+ ENIGMA_CUSTOM_HEIGHT_MAX: () => ENIGMA_CUSTOM_HEIGHT_MAX,
83
+ ENIGMA_CUSTOM_HEIGHT_MIN: () => ENIGMA_CUSTOM_HEIGHT_MIN,
84
+ ENIGMA_FIELD_CHROMES: () => ENIGMA_FIELD_CHROMES,
85
+ ENIGMA_FIELD_HEIGHTS: () => ENIGMA_FIELD_HEIGHTS,
86
+ ENIGMA_FIELD_MOTIONS: () => ENIGMA_FIELD_MOTIONS,
87
+ ENIGMA_FIELD_ORDERS: () => ENIGMA_FIELD_ORDERS,
88
+ ENIGMA_FOCUS_RINGS: () => ENIGMA_FOCUS_RINGS,
89
+ ENIGMA_LABEL_PLACEMENTS: () => ENIGMA_LABEL_PLACEMENTS,
90
+ ENIGMA_LABEL_TONES: () => ENIGMA_LABEL_TONES,
91
+ ENIGMA_LOADING_STYLES: () => ENIGMA_LOADING_STYLES,
92
+ ENIGMA_NETWORK_MARKS: () => ENIGMA_NETWORK_MARKS,
93
+ ENIGMA_OPENINGS: () => ENIGMA_OPENINGS,
94
+ ENIGMA_PAY_FEEDBACK: () => ENIGMA_PAY_FEEDBACK,
95
+ ENIGMA_REVEALS: () => ENIGMA_REVEALS,
96
+ ENIGMA_ROW_GAPS: () => ENIGMA_ROW_GAPS,
97
+ ENIGMA_STYLE_MODES: () => ENIGMA_STYLE_MODES,
98
+ ENIGMA_TEMPLATES: () => ENIGMA_TEMPLATES,
99
+ ENIGMA_TEMPLATE_PRESETS: () => ENIGMA_TEMPLATE_PRESETS,
77
100
  Export: () => Export,
78
101
  ExternalRecords: () => ExternalRecords,
79
102
  FeatureMatrix: () => FeatureMatrix,
@@ -167,6 +190,7 @@ __export(index_exports, {
167
190
  allOf: () => allOf,
168
191
  anyOf: () => anyOf,
169
192
  applyBrandingVariables: () => applyBrandingVariables,
193
+ applyEnigmaTemplate: () => applyEnigmaTemplate,
170
194
  asAirwallexCardPreset: () => asAirwallexCardPreset,
171
195
  brandingAssetPath: () => brandingAssetPath,
172
196
  buildBrandingExport: () => buildBrandingExport,
@@ -195,6 +219,7 @@ __export(index_exports, {
195
219
  decodeBadges: () => decodeBadges,
196
220
  decodeBranding: () => decodeBranding,
197
221
  decodeCustomFields: () => decodeCustomFields,
222
+ decodeEnigmaCardForm: () => decodeEnigmaCardForm,
198
223
  decodeMethodSectionLabels: () => decodeMethodSectionLabels,
199
224
  decodeMethodSectionOrder: () => decodeMethodSectionOrder,
200
225
  decodeNativePanes: () => decodeNativePanes,
@@ -211,11 +236,17 @@ __export(index_exports, {
211
236
  encodeBadges: () => encodeBadges,
212
237
  encodeBranding: () => encodeBranding,
213
238
  encodeCustomFields: () => encodeCustomFields,
239
+ encodeEnigmaCardForm: () => encodeEnigmaCardForm,
214
240
  encodeMethodSectionLabels: () => encodeMethodSectionLabels,
215
241
  encodeMethodSectionOrder: () => encodeMethodSectionOrder,
216
242
  encodeNativePanes: () => encodeNativePanes,
217
243
  encodeNotices: () => encodeNotices,
218
244
  encodePanes: () => encodePanes,
245
+ enigmaCornerPx: () => enigmaCornerPx,
246
+ enigmaCustomCssProblem: () => enigmaCustomCssProblem,
247
+ enigmaDefaultFill: () => enigmaDefaultFill,
248
+ enigmaNamesInside: () => enigmaNamesInside,
249
+ enigmaTemplateChanges: () => enigmaTemplateChanges,
219
250
  evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
220
251
  evaluateCustomFieldVisibility: () => evaluateCustomFieldVisibility,
221
252
  feeProgram: () => feeProgram,
@@ -10002,7 +10033,8 @@ var Settlement = class {
10002
10033
  });
10003
10034
  }
10004
10035
  /**
10005
- * Export a statement as PDF. Returns the raw PDF bytes as a `Blob`, with
10036
+ * Export a statement as PDF, or with `format` as CSV, JSON
10037
+ * (`StatementDocument`) or XLSX. Returns the raw bytes as a `Blob`, with
10006
10038
  * the same auth, retries and error handling as every other call — persist
10007
10039
  * or object-URL it caller-side.
10008
10040
  *
@@ -10021,7 +10053,8 @@ var Settlement = class {
10021
10053
  return this.request("GET", `/settlement/statements/${encodeURIComponent(statementId)}/pdf`, {
10022
10054
  query: {
10023
10055
  currency: params?.currency,
10024
- include_transactions: params?.include_transactions
10056
+ include_transactions: params?.include_transactions,
10057
+ format: params?.format
10025
10058
  },
10026
10059
  responseType: "blob",
10027
10060
  ...options
@@ -10285,7 +10318,21 @@ var OperationLimits = class {
10285
10318
  */
10286
10319
  async retrieveUsage(params, options) {
10287
10320
  return this.request("GET", "/operation-limits/usage", {
10288
- query: { operation: params.operation },
10321
+ query: { operation: params.operation, profile_id: params.profile_id },
10322
+ ...options
10323
+ });
10324
+ }
10325
+ /**
10326
+ * The version history of the merchant's limit settings, newest first: every
10327
+ * rule created, changed (switched off or on included) or deleted, and every
10328
+ * settings change, with who made it (and who really did, under act-as) and
10329
+ * the values before and after.
10330
+ *
10331
+ * `GET /operation-limits/history`
10332
+ */
10333
+ async listHistory(params, options) {
10334
+ return this.request("GET", "/operation-limits/history", {
10335
+ query: { limit: params?.limit, before: params?.before },
10289
10336
  ...options
10290
10337
  });
10291
10338
  }
@@ -11932,9 +11979,9 @@ function resolveStripeTheme(theme, dark) {
11932
11979
  var STRIPE_INPUT_STYLES = ["spaced", "condensed"];
11933
11980
  var STRIPE_LABEL_PLACEMENTS = ["above", "floating"];
11934
11981
  var STRIPE_SPACINGS = ["compact", "comfortable", "spacious"];
11935
- function stripeSpacingValues(spacing) {
11936
- if (spacing === "compact") return { spacingUnit: "3px", gridRowSpacing: "8px" };
11937
- if (spacing === "spacious") return { spacingUnit: "5px", gridRowSpacing: "16px" };
11982
+ function stripeSpacingValues(spacing2) {
11983
+ if (spacing2 === "compact") return { spacingUnit: "3px", gridRowSpacing: "8px" };
11984
+ if (spacing2 === "spacious") return { spacingUnit: "5px", gridRowSpacing: "16px" };
11938
11985
  return { spacingUnit: "4px", gridRowSpacing: "12px" };
11939
11986
  }
11940
11987
  var PAYPAL_CARD_LAYOUTS = ["split", "stacked"];
@@ -12214,6 +12261,444 @@ function matchWhopLook(settings) {
12214
12261
  ) ?? null;
12215
12262
  }
12216
12263
 
12264
+ // src/enigmaCardForm.ts
12265
+ var ENIGMA_FIELD_CHROMES = ["outlined", "filled", "underline", "joined"];
12266
+ var ENIGMA_LABEL_PLACEMENTS = ["above", "inside"];
12267
+ var ENIGMA_LABEL_TONES = ["strong", "muted"];
12268
+ var ENIGMA_FIELD_ORDERS = ["number", "name"];
12269
+ var ENIGMA_NETWORK_MARKS = ["live", "static", "hidden"];
12270
+ var ENIGMA_FOCUS_RINGS = ["strong", "subtle"];
12271
+ var ENIGMA_FIELD_MOTIONS = ["smooth", "slow", "none"];
12272
+ var ENIGMA_FIELD_HEIGHTS = ["40", "44", "48", "52"];
12273
+ var ENIGMA_ROW_GAPS = ["8", "12", "16"];
12274
+ var ENIGMA_CORNERS = ["square", "small", "medium", "large", "pill"];
12275
+ var ENIGMA_STYLE_MODES = ["designed", "custom"];
12276
+ var ENIGMA_OPENINGS = ["place", "expand"];
12277
+ var ENIGMA_CLICK_FEEDBACK = ["both", "ring", "press", "none"];
12278
+ var ENIGMA_LOADING_STYLES = [
12279
+ "shimmer",
12280
+ "pulse",
12281
+ "dim",
12282
+ "line",
12283
+ "spinner",
12284
+ "none"
12285
+ ];
12286
+ var ENIGMA_REVEALS = ["fade", "rise", "wipe", "none"];
12287
+ var ENIGMA_PAY_FEEDBACK = ["spinner", "press", "none"];
12288
+ var ENIGMA_TEMPLATES = [
12289
+ "soft",
12290
+ "fields",
12291
+ "classic",
12292
+ "compact",
12293
+ "filled",
12294
+ "underline"
12295
+ ];
12296
+ var ENIGMA_CUSTOM_CSS_MAX_LENGTH = 950;
12297
+ var ENIGMA_CUSTOM_HEIGHT_MIN = 120;
12298
+ var ENIGMA_CUSTOM_HEIGHT_MAX = 600;
12299
+ var ENIGMA_CUSTOM_HEIGHT_DEFAULT = 260;
12300
+ var ENIGMA_TEMPLATE_PRESETS = {
12301
+ soft: {
12302
+ enigmaChrome: "outlined",
12303
+ enigmaLabels: "above",
12304
+ enigmaLabelTone: "strong",
12305
+ enigmaHints: true,
12306
+ enigmaCvcIcon: true,
12307
+ enigmaFieldOrder: "number",
12308
+ enigmaMarks: "live",
12309
+ enigmaFocusRing: "strong",
12310
+ enigmaFieldHeight: "44",
12311
+ enigmaRowGap: "12",
12312
+ enigmaCorner: "medium"
12313
+ },
12314
+ fields: {
12315
+ enigmaChrome: "outlined",
12316
+ enigmaLabels: "above",
12317
+ enigmaLabelTone: "muted",
12318
+ enigmaHints: true,
12319
+ enigmaCvcIcon: true,
12320
+ enigmaFieldOrder: "number",
12321
+ enigmaMarks: "live",
12322
+ enigmaFocusRing: "strong",
12323
+ enigmaFieldHeight: "48",
12324
+ enigmaRowGap: "12",
12325
+ enigmaCorner: "small"
12326
+ },
12327
+ classic: {
12328
+ enigmaChrome: "outlined",
12329
+ enigmaLabels: "above",
12330
+ enigmaLabelTone: "strong",
12331
+ enigmaHints: false,
12332
+ enigmaCvcIcon: true,
12333
+ enigmaFieldOrder: "number",
12334
+ enigmaMarks: "live",
12335
+ enigmaFocusRing: "strong",
12336
+ enigmaFieldHeight: "44",
12337
+ enigmaRowGap: "12",
12338
+ enigmaCorner: "medium"
12339
+ },
12340
+ compact: {
12341
+ enigmaChrome: "joined",
12342
+ enigmaLabels: "inside",
12343
+ enigmaLabelTone: "muted",
12344
+ enigmaHints: false,
12345
+ enigmaCvcIcon: true,
12346
+ enigmaFieldOrder: "number",
12347
+ enigmaMarks: "live",
12348
+ enigmaFocusRing: "strong",
12349
+ enigmaFieldHeight: "48",
12350
+ enigmaRowGap: "12",
12351
+ enigmaCorner: "medium"
12352
+ },
12353
+ filled: {
12354
+ enigmaChrome: "filled",
12355
+ enigmaLabels: "above",
12356
+ enigmaLabelTone: "strong",
12357
+ enigmaHints: false,
12358
+ enigmaCvcIcon: true,
12359
+ enigmaFieldOrder: "number",
12360
+ enigmaMarks: "live",
12361
+ enigmaFocusRing: "strong",
12362
+ enigmaFieldHeight: "44",
12363
+ enigmaRowGap: "12",
12364
+ enigmaCorner: "medium"
12365
+ },
12366
+ underline: {
12367
+ enigmaChrome: "underline",
12368
+ enigmaLabels: "above",
12369
+ enigmaLabelTone: "muted",
12370
+ enigmaHints: false,
12371
+ enigmaCvcIcon: true,
12372
+ enigmaFieldOrder: "number",
12373
+ enigmaMarks: "live",
12374
+ enigmaFocusRing: "strong",
12375
+ enigmaFieldHeight: "40",
12376
+ enigmaRowGap: "16",
12377
+ enigmaCorner: "square"
12378
+ }
12379
+ };
12380
+ var DEFAULT_ENIGMA_CARD_FORM = {
12381
+ enigmaTemplate: "soft",
12382
+ enigmaStyleMode: "designed",
12383
+ ...ENIGMA_TEMPLATE_PRESETS.soft,
12384
+ enigmaFieldMotion: "smooth",
12385
+ enigmaAccent: "",
12386
+ enigmaBorder: "",
12387
+ enigmaFill: "",
12388
+ enigmaTrustLine: true,
12389
+ enigmaAutoOpen: false,
12390
+ enigmaOpening: "place",
12391
+ enigmaClickFeedback: "both",
12392
+ enigmaLoading: "shimmer",
12393
+ enigmaReveal: "fade",
12394
+ enigmaPayFeedback: "spinner",
12395
+ enigmaCustomCss: "",
12396
+ enigmaCustomHeight: ENIGMA_CUSTOM_HEIGHT_DEFAULT
12397
+ };
12398
+ function applyEnigmaTemplate(template) {
12399
+ return { enigmaTemplate: template, ...ENIGMA_TEMPLATE_PRESETS[template] };
12400
+ }
12401
+ function enigmaTemplateChanges(settings) {
12402
+ const preset = ENIGMA_TEMPLATE_PRESETS[settings.enigmaTemplate];
12403
+ return Object.keys(preset).filter(
12404
+ (key) => settings[key] !== preset[key]
12405
+ );
12406
+ }
12407
+ function enigmaNamesInside(settings) {
12408
+ return settings.enigmaChrome === "joined" || settings.enigmaLabels === "inside";
12409
+ }
12410
+ var PSEUDO_CLASSES = [
12411
+ "focus",
12412
+ "focus-visible",
12413
+ "focus-within",
12414
+ "hover",
12415
+ "checked",
12416
+ "disabled",
12417
+ "invalid",
12418
+ "valid",
12419
+ "placeholder-shown",
12420
+ "first-child",
12421
+ "last-child"
12422
+ ];
12423
+ var HIDEABLE = ["p", "h1", "#header", "#headertext", ".timer", "#timer"];
12424
+ var PROPERTIES = [
12425
+ "color",
12426
+ "caret-color",
12427
+ "accent-color",
12428
+ "-webkit-text-fill-color",
12429
+ "background",
12430
+ "background-color",
12431
+ "border",
12432
+ "border-top",
12433
+ "border-right",
12434
+ "border-bottom",
12435
+ "border-left",
12436
+ "border-color",
12437
+ "border-width",
12438
+ "border-style",
12439
+ "border-top-color",
12440
+ "border-right-color",
12441
+ "border-bottom-color",
12442
+ "border-left-color",
12443
+ "border-top-width",
12444
+ "border-right-width",
12445
+ "border-bottom-width",
12446
+ "border-left-width",
12447
+ "border-radius",
12448
+ "border-top-left-radius",
12449
+ "border-top-right-radius",
12450
+ "border-bottom-left-radius",
12451
+ "border-bottom-right-radius",
12452
+ "box-shadow",
12453
+ "outline",
12454
+ "outline-color",
12455
+ "outline-offset",
12456
+ "font",
12457
+ "font-family",
12458
+ "font-size",
12459
+ "font-weight",
12460
+ "font-style",
12461
+ "letter-spacing",
12462
+ "line-height",
12463
+ "text-align",
12464
+ "text-transform",
12465
+ "padding",
12466
+ "padding-top",
12467
+ "padding-right",
12468
+ "padding-bottom",
12469
+ "padding-left",
12470
+ "margin",
12471
+ "margin-top",
12472
+ "margin-right",
12473
+ "margin-bottom",
12474
+ "margin-left",
12475
+ "height",
12476
+ "min-height",
12477
+ "width",
12478
+ "min-width",
12479
+ "max-width",
12480
+ "display",
12481
+ "flex-wrap",
12482
+ "gap",
12483
+ "transition",
12484
+ "box-sizing",
12485
+ "top"
12486
+ ];
12487
+ function lengthAtLeast(value, min) {
12488
+ const match = /^(-?[0-9.]+)(px|em|rem)$/.exec(value);
12489
+ if (!match) return false;
12490
+ const number = Number(match[1]) * (match[2] === "px" ? 1 : 16);
12491
+ return Number.isFinite(number) && number >= min;
12492
+ }
12493
+ function spacing(value) {
12494
+ return value.split(" ").every(
12495
+ (part) => part === "0" || part === "auto" || lengthAtLeast(part, 0) && !lengthAtLeast(part, 48.5)
12496
+ );
12497
+ }
12498
+ function width(value) {
12499
+ if (value === "auto") return true;
12500
+ if (value.endsWith("%")) return Number(value.slice(0, -1)) >= 20;
12501
+ const calc = /^calc\(([0-9.]+)% - ([0-9.]+)px\)$/.exec(value);
12502
+ if (calc) return Number(calc[1]) >= 20 && Number(calc[2]) <= 48;
12503
+ if (value.startsWith("calc(")) return false;
12504
+ return lengthAtLeast(value, 40);
12505
+ }
12506
+ function opaqueColour(value) {
12507
+ if (value.startsWith("#")) return /^#([0-9a-f]{3}|[0-9a-f]{6})$/.test(value);
12508
+ if (value.startsWith("rgb("))
12509
+ return value.endsWith(")") && value.split(",").length === 3 && !value.includes("/");
12510
+ return value !== "transparent" && /^[a-z]+$/.test(value);
12511
+ }
12512
+ function declarationProblem(selector, declaration) {
12513
+ const at = declaration.indexOf(":");
12514
+ if (at < 0) return null;
12515
+ const property = declaration.slice(0, at).trim();
12516
+ const raw = declaration.slice(at + 1).trim();
12517
+ const important = raw.endsWith("!important");
12518
+ const value = raw.replace(/!important$/, "").trim();
12519
+ if (!PROPERTIES.includes(property)) return "property";
12520
+ if (["var(", "env(", "attr("].some((fn) => value.includes(fn))) return "variable";
12521
+ let ok = true;
12522
+ switch (property) {
12523
+ case "display": {
12524
+ if (important) return "important_display";
12525
+ const hideable = selector.split(",").every((one) => {
12526
+ const subject = one.split(/[ >]/).pop() ?? one;
12527
+ return HIDEABLE.includes(subject.split(":")[0] ?? subject);
12528
+ });
12529
+ ok = ["block", "flex", "grid", "inline", "inline-block", "inline-flex"].includes(value) || value === "none" && hideable;
12530
+ break;
12531
+ }
12532
+ case "margin":
12533
+ case "margin-top":
12534
+ case "margin-right":
12535
+ case "margin-bottom":
12536
+ case "margin-left":
12537
+ case "padding":
12538
+ case "padding-top":
12539
+ case "padding-right":
12540
+ case "padding-bottom":
12541
+ case "padding-left":
12542
+ ok = spacing(value);
12543
+ break;
12544
+ case "height":
12545
+ case "min-height":
12546
+ ok = value === "auto" || lengthAtLeast(value, 20);
12547
+ break;
12548
+ case "width":
12549
+ case "min-width":
12550
+ case "max-width":
12551
+ ok = width(value);
12552
+ break;
12553
+ case "font-size":
12554
+ ok = lengthAtLeast(value, 12);
12555
+ break;
12556
+ case "font": {
12557
+ const size = value.split(/[ /]/).find((part) => part.endsWith("px") || part.endsWith("em"));
12558
+ ok = size !== void 0 && lengthAtLeast(size, 12);
12559
+ break;
12560
+ }
12561
+ case "line-height":
12562
+ ok = value === "normal" || Number(value) >= 1 || lengthAtLeast(value, 12);
12563
+ break;
12564
+ case "color":
12565
+ case "caret-color":
12566
+ ok = opaqueColour(value);
12567
+ break;
12568
+ case "top":
12569
+ ok = value === "0" || /^-?[0-9.]+px$/.test(value) && Math.abs(parseFloat(value)) <= 4;
12570
+ break;
12571
+ case "-webkit-text-fill-color":
12572
+ ok = selector.split(",").every((one) => (one.split(/[ >]/).pop() ?? "").includes(":placeholder-shown")) || opaqueColour(value);
12573
+ break;
12574
+ }
12575
+ return ok ? null : "hides_field";
12576
+ }
12577
+ function selectorProblem(selector) {
12578
+ if (!selector || !/^[a-z0-9\-_#.:,> ]+$/.test(selector) || selector.includes("::"))
12579
+ return "selector";
12580
+ const pseudoOk = selector.split(":").slice(1).every((after) => PSEUDO_CLASSES.includes(after.split(/[ >,.#]/)[0] ?? after));
12581
+ return pseudoOk ? null : "selector";
12582
+ }
12583
+ function enigmaCustomCssProblem(css) {
12584
+ if (!css.trim()) return null;
12585
+ if (css.length > ENIGMA_CUSTOM_CSS_MAX_LENGTH) return "too_long";
12586
+ if (/[^\x20-\x7e\n\r\t]/.test(css)) return "not_ascii";
12587
+ if (css.includes("<")) return "markup";
12588
+ if (css.includes("\\")) return "escape";
12589
+ const lower = css.toLowerCase();
12590
+ if (lower.includes("/*")) return "comment";
12591
+ if (["url(", "image-set(", "image(", "element(", "cross-fade(", "src(", "data:"].some(
12592
+ (needle) => lower.includes(needle)
12593
+ )) {
12594
+ return "loads_resource";
12595
+ }
12596
+ if (["expression(", "javascript:", "behavior", "-moz-binding"].some(
12597
+ (needle) => lower.includes(needle)
12598
+ )) {
12599
+ return "script";
12600
+ }
12601
+ if (/@(?!media)/.test(lower)) return "at_rule";
12602
+ const compact = lower.split(/\s+/).filter(Boolean).join(" ");
12603
+ const blocks = [];
12604
+ let text = "";
12605
+ for (const ch of compact) {
12606
+ if (ch === "{") {
12607
+ const prelude = text.trim();
12608
+ text = "";
12609
+ const media = prelude.startsWith("@media");
12610
+ if (!media) {
12611
+ const problem = selectorProblem(prelude.replace(/, /g, ","));
12612
+ if (problem) return problem;
12613
+ }
12614
+ blocks.push({ selector: prelude, media });
12615
+ } else if (ch === "}" || ch === ";") {
12616
+ const declaration = text;
12617
+ text = "";
12618
+ const top = blocks[blocks.length - 1];
12619
+ if (!top) {
12620
+ if (ch === "}") return "unbalanced";
12621
+ continue;
12622
+ }
12623
+ if (!top.media && declaration.trim()) {
12624
+ const problem = declarationProblem(top.selector.replace(/, /g, ","), declaration);
12625
+ if (problem) return problem;
12626
+ }
12627
+ if (ch === "}") blocks.pop();
12628
+ } else {
12629
+ text += ch;
12630
+ }
12631
+ }
12632
+ return blocks.length > 0 ? "unbalanced" : null;
12633
+ }
12634
+ function enigmaCornerPx(corner) {
12635
+ return { square: 0, small: 6, medium: 8, large: 12, pill: 22 }[corner];
12636
+ }
12637
+ var HEX = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
12638
+ function pick(value, allowed, fallback) {
12639
+ return typeof value === "string" && allowed.includes(value) ? value : fallback;
12640
+ }
12641
+ function bool(value, fallback) {
12642
+ if (value === true || value === "true") return true;
12643
+ if (value === false || value === "false") return false;
12644
+ return fallback;
12645
+ }
12646
+ function hexOrEmpty(value) {
12647
+ return typeof value === "string" && HEX.test(value.trim()) ? value.trim() : "";
12648
+ }
12649
+ function decodeEnigmaCardForm(source) {
12650
+ const d = DEFAULT_ENIGMA_CARD_FORM;
12651
+ const height = Number(source["enigmaCustomHeight"]);
12652
+ const css = typeof source["enigmaCustomCss"] === "string" ? source["enigmaCustomCss"] : "";
12653
+ return {
12654
+ enigmaTemplate: pick(source["enigmaTemplate"], ENIGMA_TEMPLATES, d.enigmaTemplate),
12655
+ enigmaStyleMode: pick(source["enigmaStyleMode"], ENIGMA_STYLE_MODES, d.enigmaStyleMode),
12656
+ enigmaChrome: pick(source["enigmaChrome"], ENIGMA_FIELD_CHROMES, d.enigmaChrome),
12657
+ enigmaLabels: pick(source["enigmaLabels"], ENIGMA_LABEL_PLACEMENTS, d.enigmaLabels),
12658
+ enigmaLabelTone: pick(source["enigmaLabelTone"], ENIGMA_LABEL_TONES, d.enigmaLabelTone),
12659
+ enigmaHints: bool(source["enigmaHints"], d.enigmaHints),
12660
+ enigmaCvcIcon: bool(source["enigmaCvcIcon"], d.enigmaCvcIcon),
12661
+ enigmaFieldOrder: pick(source["enigmaFieldOrder"], ENIGMA_FIELD_ORDERS, d.enigmaFieldOrder),
12662
+ enigmaMarks: pick(source["enigmaMarks"], ENIGMA_NETWORK_MARKS, d.enigmaMarks),
12663
+ enigmaFocusRing: pick(source["enigmaFocusRing"], ENIGMA_FOCUS_RINGS, d.enigmaFocusRing),
12664
+ enigmaFieldMotion: pick(source["enigmaFieldMotion"], ENIGMA_FIELD_MOTIONS, d.enigmaFieldMotion),
12665
+ enigmaFieldHeight: pick(
12666
+ String(source["enigmaFieldHeight"] ?? ""),
12667
+ ENIGMA_FIELD_HEIGHTS,
12668
+ d.enigmaFieldHeight
12669
+ ),
12670
+ enigmaRowGap: pick(String(source["enigmaRowGap"] ?? ""), ENIGMA_ROW_GAPS, d.enigmaRowGap),
12671
+ enigmaCorner: pick(source["enigmaCorner"], ENIGMA_CORNERS, d.enigmaCorner),
12672
+ enigmaAccent: hexOrEmpty(source["enigmaAccent"]),
12673
+ enigmaBorder: hexOrEmpty(source["enigmaBorder"]),
12674
+ enigmaFill: hexOrEmpty(source["enigmaFill"]),
12675
+ enigmaTrustLine: bool(source["enigmaTrustLine"], d.enigmaTrustLine),
12676
+ enigmaAutoOpen: bool(source["enigmaAutoOpen"], d.enigmaAutoOpen),
12677
+ enigmaOpening: pick(source["enigmaOpening"], ENIGMA_OPENINGS, d.enigmaOpening),
12678
+ enigmaClickFeedback: pick(
12679
+ source["enigmaClickFeedback"],
12680
+ ENIGMA_CLICK_FEEDBACK,
12681
+ d.enigmaClickFeedback
12682
+ ),
12683
+ enigmaLoading: pick(source["enigmaLoading"], ENIGMA_LOADING_STYLES, d.enigmaLoading),
12684
+ enigmaReveal: pick(source["enigmaReveal"], ENIGMA_REVEALS, d.enigmaReveal),
12685
+ enigmaPayFeedback: pick(source["enigmaPayFeedback"], ENIGMA_PAY_FEEDBACK, d.enigmaPayFeedback),
12686
+ enigmaCustomCss: css.slice(0, ENIGMA_CUSTOM_CSS_MAX_LENGTH),
12687
+ enigmaCustomHeight: Number.isInteger(height) && height >= ENIGMA_CUSTOM_HEIGHT_MIN && height <= ENIGMA_CUSTOM_HEIGHT_MAX ? height : d.enigmaCustomHeight
12688
+ };
12689
+ }
12690
+ function encodeEnigmaCardForm(settings) {
12691
+ const out = {};
12692
+ for (const key of Object.keys(DEFAULT_ENIGMA_CARD_FORM)) {
12693
+ const value = settings[key];
12694
+ if (value === DEFAULT_ENIGMA_CARD_FORM[key]) continue;
12695
+ const text = String(value);
12696
+ if (key === "enigmaCustomCss" && !text.trim()) continue;
12697
+ out[key] = text;
12698
+ }
12699
+ return out;
12700
+ }
12701
+
12217
12702
  // src/branding.ts
12218
12703
  function surchargeShowsLabel(labelMode, style, position) {
12219
12704
  if (labelMode !== "labelled") return false;
@@ -12487,18 +12972,48 @@ function inputPadValue(size) {
12487
12972
  function buttonPadValue(size) {
12488
12973
  return BUTTON_PAD[size] ?? BUTTON_PAD.md;
12489
12974
  }
12490
- function vaultFormAppearance(b, danger) {
12491
- return {
12975
+ function vaultFormAppearance(b, danger, options = {}) {
12976
+ const border = b.enigmaBorder || b.border;
12977
+ const look = {
12492
12978
  surface: b.surface,
12493
12979
  text: b.text,
12494
- border: b.border,
12495
- accent: b.primary,
12980
+ border,
12981
+ accent: b.enigmaAccent || b.primary,
12496
12982
  ...danger ? { danger } : {},
12497
12983
  font: b.fontFamily,
12498
12984
  radius: b.radiusInput,
12499
12985
  size: b.inputSize,
12500
12986
  labels: b.labelStyle
12501
12987
  };
12988
+ if (!options.designed) return look;
12989
+ return {
12990
+ ...look,
12991
+ chrome: b.enigmaChrome,
12992
+ label: enigmaNamesInside(b) ? "inside" : "above",
12993
+ hints: b.enigmaHints,
12994
+ order: b.enigmaFieldOrder,
12995
+ marks: b.enigmaMarks,
12996
+ focus: b.enigmaFocusRing,
12997
+ motion: b.enigmaFieldMotion,
12998
+ height: b.enigmaFieldHeight,
12999
+ gap: b.enigmaRowGap,
13000
+ corner: b.enigmaCorner,
13001
+ fill: b.enigmaFill || enigmaDefaultFill(b.surface, b.text),
13002
+ ...b.enigmaStyleMode === "custom" ? { custom: true } : {}
13003
+ };
13004
+ }
13005
+ function enigmaDefaultFill(surface, text) {
13006
+ const channels = (hex) => {
13007
+ const v = hex.trim().replace("#", "");
13008
+ const full = v.length === 3 ? v.replace(/./g, "$&$&") : v;
13009
+ if (!/^[0-9a-fA-F]{6}$/.test(full)) return null;
13010
+ return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16));
13011
+ };
13012
+ const s2 = channels(surface) ?? [255, 255, 255];
13013
+ const t = channels(text) ?? [30, 41, 59];
13014
+ return `#${s2.map(
13015
+ (value, i) => Math.round(value * 0.94 + (t[i] ?? 0) * 0.06).toString(16).padStart(2, "0")
13016
+ ).join("")}`;
12502
13017
  }
12503
13018
  function logoDimensions(size) {
12504
13019
  switch (size) {
@@ -13000,7 +13515,9 @@ var DEFAULT_BRANDING_BASE = {
13000
13515
  whopShadow: "soft",
13001
13516
  whopMethodIcons: true,
13002
13517
  whopSelection: "radio_tint",
13003
- customCss: ""
13518
+ customCss: "",
13519
+ // The Enigma Vault card form: the Stripe-like template.
13520
+ ...DEFAULT_ENIGMA_CARD_FORM
13004
13521
  };
13005
13522
  var DEFAULT_BRANDING = {
13006
13523
  ...DEFAULT_BRANDING_BASE,
@@ -14110,7 +14627,8 @@ function decodeBranding(source) {
14110
14627
  GOOGLE_PAY_BUTTON_TYPES,
14111
14628
  DEFAULT_BRANDING.nomupayGooglePayButtonType
14112
14629
  ),
14113
- customCss: s(extras["customCss"])
14630
+ customCss: s(extras["customCss"]),
14631
+ ...decodeEnigmaCardForm(extras)
14114
14632
  };
14115
14633
  }
14116
14634
  function encodeBranding(branding, base) {
@@ -14272,6 +14790,7 @@ function encodeBranding(branding, base) {
14272
14790
  if (support) extras["supportEmail"] = support;
14273
14791
  const css = trim(branding.customCss);
14274
14792
  if (css) extras["customCss"] = css;
14793
+ Object.assign(extras, encodeEnigmaCardForm(branding));
14275
14794
  const nextRules = {
14276
14795
  ...existingRules,
14277
14796
  [BRANDING_GROUP_KEY]: extras
@@ -14792,7 +15311,8 @@ function parseImportedBranding(raw) {
14792
15311
  GOOGLE_PAY_BUTTON_TYPES,
14793
15312
  dflt.nomupayGooglePayButtonType
14794
15313
  ),
14795
- customCss: sStr(root["customCss"], dflt.customCss).slice(0, CUSTOM_CSS_MAX_LENGTH)
15314
+ customCss: sStr(root["customCss"], dflt.customCss).slice(0, CUSTOM_CSS_MAX_LENGTH),
15315
+ ...decodeEnigmaCardForm(root)
14796
15316
  };
14797
15317
  }
14798
15318
  function isObject(v) {
@@ -14885,7 +15405,19 @@ function vaultFormQuery(params) {
14885
15405
  form_font: look?.font,
14886
15406
  form_radius: look?.radius,
14887
15407
  form_size: look?.size,
14888
- form_labels: look?.labels
15408
+ form_labels: look?.labels,
15409
+ form_chrome: look?.chrome,
15410
+ form_label: look?.label,
15411
+ form_hints: look?.hints === void 0 ? void 0 : String(look.hints),
15412
+ form_order: look?.order,
15413
+ form_marks: look?.marks,
15414
+ form_focus: look?.focus,
15415
+ form_motion: look?.motion,
15416
+ form_height: look?.height,
15417
+ form_gap: look?.gap,
15418
+ form_corner: look?.corner,
15419
+ form_fill: look?.fill,
15420
+ form_custom: look?.custom ? "true" : void 0
14889
15421
  };
14890
15422
  }
14891
15423
  function withoutHeader(headers, name) {
@@ -16431,10 +16963,33 @@ var encodeNativePanes = encodePanes;
16431
16963
  DEFAULT_BADGES_DARK,
16432
16964
  DEFAULT_BRANDING,
16433
16965
  DEFAULT_BRANDING_DARK,
16966
+ DEFAULT_ENIGMA_CARD_FORM,
16434
16967
  DEFAULT_NOTICES,
16435
16968
  Delopay,
16436
16969
  DelopayAuthenticationError,
16437
16970
  DelopayError,
16971
+ ENIGMA_CLICK_FEEDBACK,
16972
+ ENIGMA_CORNERS,
16973
+ ENIGMA_CUSTOM_CSS_MAX_LENGTH,
16974
+ ENIGMA_CUSTOM_HEIGHT_DEFAULT,
16975
+ ENIGMA_CUSTOM_HEIGHT_MAX,
16976
+ ENIGMA_CUSTOM_HEIGHT_MIN,
16977
+ ENIGMA_FIELD_CHROMES,
16978
+ ENIGMA_FIELD_HEIGHTS,
16979
+ ENIGMA_FIELD_MOTIONS,
16980
+ ENIGMA_FIELD_ORDERS,
16981
+ ENIGMA_FOCUS_RINGS,
16982
+ ENIGMA_LABEL_PLACEMENTS,
16983
+ ENIGMA_LABEL_TONES,
16984
+ ENIGMA_LOADING_STYLES,
16985
+ ENIGMA_NETWORK_MARKS,
16986
+ ENIGMA_OPENINGS,
16987
+ ENIGMA_PAY_FEEDBACK,
16988
+ ENIGMA_REVEALS,
16989
+ ENIGMA_ROW_GAPS,
16990
+ ENIGMA_STYLE_MODES,
16991
+ ENIGMA_TEMPLATES,
16992
+ ENIGMA_TEMPLATE_PRESETS,
16438
16993
  Export,
16439
16994
  ExternalRecords,
16440
16995
  FeatureMatrix,
@@ -16528,6 +17083,7 @@ var encodeNativePanes = encodePanes;
16528
17083
  allOf,
16529
17084
  anyOf,
16530
17085
  applyBrandingVariables,
17086
+ applyEnigmaTemplate,
16531
17087
  asAirwallexCardPreset,
16532
17088
  brandingAssetPath,
16533
17089
  buildBrandingExport,
@@ -16556,6 +17112,7 @@ var encodeNativePanes = encodePanes;
16556
17112
  decodeBadges,
16557
17113
  decodeBranding,
16558
17114
  decodeCustomFields,
17115
+ decodeEnigmaCardForm,
16559
17116
  decodeMethodSectionLabels,
16560
17117
  decodeMethodSectionOrder,
16561
17118
  decodeNativePanes,
@@ -16572,11 +17129,17 @@ var encodeNativePanes = encodePanes;
16572
17129
  encodeBadges,
16573
17130
  encodeBranding,
16574
17131
  encodeCustomFields,
17132
+ encodeEnigmaCardForm,
16575
17133
  encodeMethodSectionLabels,
16576
17134
  encodeMethodSectionOrder,
16577
17135
  encodeNativePanes,
16578
17136
  encodeNotices,
16579
17137
  encodePanes,
17138
+ enigmaCornerPx,
17139
+ enigmaCustomCssProblem,
17140
+ enigmaDefaultFill,
17141
+ enigmaNamesInside,
17142
+ enigmaTemplateChanges,
16580
17143
  evaluateCustomFieldCondition,
16581
17144
  evaluateCustomFieldVisibility,
16582
17145
  feeProgram,