@delopay/sdk 0.350.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.
@@ -5898,6 +5898,51 @@ var IdentityVerifications = class {
5898
5898
  options
5899
5899
  );
5900
5900
  }
5901
+ /**
5902
+ * Whether an account rates the buyer addresses of its shop's payments.
5903
+ * Needs permission to read connectors.
5904
+ *
5905
+ * `GET /identity-verifications/accounts/{merchant_connector_id}/connection-check`
5906
+ */
5907
+ async connectionCheckSetting(merchantConnectorId, options) {
5908
+ return this.request(
5909
+ "GET",
5910
+ `/identity-verifications/accounts/${encodeURIComponent(merchantConnectorId)}/connection-check`,
5911
+ options
5912
+ );
5913
+ }
5914
+ /**
5915
+ * Switch the connection check of the account's shop. Switched on, the
5916
+ * buyer address of every payment the shop confirms is rated by the
5917
+ * provider, once per payment and address, before authorization. A `high`
5918
+ * or `very_high` rating counts as an anonymising connection (the `proxy`
5919
+ * network class) in the buyer risk score and the buyer blocklist. A check
5920
+ * never holds or refuses a payment by itself. Switching on asks the
5921
+ * provider nothing, since every check is billed. A shop has at most one
5922
+ * connection check account. Needs permission to edit connectors.
5923
+ *
5924
+ * `PUT /identity-verifications/accounts/{merchant_connector_id}/connection-check`
5925
+ */
5926
+ async updateConnectionCheckSetting(merchantConnectorId, params, options) {
5927
+ return this.request(
5928
+ "PUT",
5929
+ `/identity-verifications/accounts/${encodeURIComponent(merchantConnectorId)}/connection-check`,
5930
+ { body: params, ...options }
5931
+ );
5932
+ }
5933
+ /**
5934
+ * A payment's connection checks, newest first; empty when none ran. Needs
5935
+ * permission to read payments.
5936
+ *
5937
+ * `GET /identity-verifications/connection-checks/{payment_id}`
5938
+ */
5939
+ async connectionChecks(paymentId, options) {
5940
+ return this.request(
5941
+ "GET",
5942
+ `/identity-verifications/connection-checks/${encodeURIComponent(paymentId)}`,
5943
+ options
5944
+ );
5945
+ }
5901
5946
  };
5902
5947
 
5903
5948
  // src/resources/webhooks.ts
@@ -9669,7 +9714,8 @@ var Settlement = class {
9669
9714
  });
9670
9715
  }
9671
9716
  /**
9672
- * Export a statement as PDF. Returns the raw PDF bytes as a `Blob`, with
9717
+ * Export a statement as PDF, or with `format` as CSV, JSON
9718
+ * (`StatementDocument`) or XLSX. Returns the raw bytes as a `Blob`, with
9673
9719
  * the same auth, retries and error handling as every other call — persist
9674
9720
  * or object-URL it caller-side.
9675
9721
  *
@@ -9688,7 +9734,8 @@ var Settlement = class {
9688
9734
  return this.request("GET", `/settlement/statements/${encodeURIComponent(statementId)}/pdf`, {
9689
9735
  query: {
9690
9736
  currency: params?.currency,
9691
- include_transactions: params?.include_transactions
9737
+ include_transactions: params?.include_transactions,
9738
+ format: params?.format
9692
9739
  },
9693
9740
  responseType: "blob",
9694
9741
  ...options
@@ -9952,7 +9999,21 @@ var OperationLimits = class {
9952
9999
  */
9953
10000
  async retrieveUsage(params, options) {
9954
10001
  return this.request("GET", "/operation-limits/usage", {
9955
- query: { operation: params.operation },
10002
+ query: { operation: params.operation, profile_id: params.profile_id },
10003
+ ...options
10004
+ });
10005
+ }
10006
+ /**
10007
+ * The version history of the merchant's limit settings, newest first: every
10008
+ * rule created, changed (switched off or on included) or deleted, and every
10009
+ * settings change, with who made it (and who really did, under act-as) and
10010
+ * the values before and after.
10011
+ *
10012
+ * `GET /operation-limits/history`
10013
+ */
10014
+ async listHistory(params, options) {
10015
+ return this.request("GET", "/operation-limits/history", {
10016
+ query: { limit: params?.limit, before: params?.before },
9956
10017
  ...options
9957
10018
  });
9958
10019
  }
@@ -11599,9 +11660,9 @@ function resolveStripeTheme(theme, dark) {
11599
11660
  var STRIPE_INPUT_STYLES = ["spaced", "condensed"];
11600
11661
  var STRIPE_LABEL_PLACEMENTS = ["above", "floating"];
11601
11662
  var STRIPE_SPACINGS = ["compact", "comfortable", "spacious"];
11602
- function stripeSpacingValues(spacing) {
11603
- if (spacing === "compact") return { spacingUnit: "3px", gridRowSpacing: "8px" };
11604
- if (spacing === "spacious") return { spacingUnit: "5px", gridRowSpacing: "16px" };
11663
+ function stripeSpacingValues(spacing2) {
11664
+ if (spacing2 === "compact") return { spacingUnit: "3px", gridRowSpacing: "8px" };
11665
+ if (spacing2 === "spacious") return { spacingUnit: "5px", gridRowSpacing: "16px" };
11605
11666
  return { spacingUnit: "4px", gridRowSpacing: "12px" };
11606
11667
  }
11607
11668
  var PAYPAL_CARD_LAYOUTS = ["split", "stacked"];
@@ -11881,6 +11942,444 @@ function matchWhopLook(settings) {
11881
11942
  ) ?? null;
11882
11943
  }
11883
11944
 
11945
+ // src/enigmaCardForm.ts
11946
+ var ENIGMA_FIELD_CHROMES = ["outlined", "filled", "underline", "joined"];
11947
+ var ENIGMA_LABEL_PLACEMENTS = ["above", "inside"];
11948
+ var ENIGMA_LABEL_TONES = ["strong", "muted"];
11949
+ var ENIGMA_FIELD_ORDERS = ["number", "name"];
11950
+ var ENIGMA_NETWORK_MARKS = ["live", "static", "hidden"];
11951
+ var ENIGMA_FOCUS_RINGS = ["strong", "subtle"];
11952
+ var ENIGMA_FIELD_MOTIONS = ["smooth", "slow", "none"];
11953
+ var ENIGMA_FIELD_HEIGHTS = ["40", "44", "48", "52"];
11954
+ var ENIGMA_ROW_GAPS = ["8", "12", "16"];
11955
+ var ENIGMA_CORNERS = ["square", "small", "medium", "large", "pill"];
11956
+ var ENIGMA_STYLE_MODES = ["designed", "custom"];
11957
+ var ENIGMA_OPENINGS = ["place", "expand"];
11958
+ var ENIGMA_CLICK_FEEDBACK = ["both", "ring", "press", "none"];
11959
+ var ENIGMA_LOADING_STYLES = [
11960
+ "shimmer",
11961
+ "pulse",
11962
+ "dim",
11963
+ "line",
11964
+ "spinner",
11965
+ "none"
11966
+ ];
11967
+ var ENIGMA_REVEALS = ["fade", "rise", "wipe", "none"];
11968
+ var ENIGMA_PAY_FEEDBACK = ["spinner", "press", "none"];
11969
+ var ENIGMA_TEMPLATES = [
11970
+ "soft",
11971
+ "fields",
11972
+ "classic",
11973
+ "compact",
11974
+ "filled",
11975
+ "underline"
11976
+ ];
11977
+ var ENIGMA_CUSTOM_CSS_MAX_LENGTH = 950;
11978
+ var ENIGMA_CUSTOM_HEIGHT_MIN = 120;
11979
+ var ENIGMA_CUSTOM_HEIGHT_MAX = 600;
11980
+ var ENIGMA_CUSTOM_HEIGHT_DEFAULT = 260;
11981
+ var ENIGMA_TEMPLATE_PRESETS = {
11982
+ soft: {
11983
+ enigmaChrome: "outlined",
11984
+ enigmaLabels: "above",
11985
+ enigmaLabelTone: "strong",
11986
+ enigmaHints: true,
11987
+ enigmaCvcIcon: true,
11988
+ enigmaFieldOrder: "number",
11989
+ enigmaMarks: "live",
11990
+ enigmaFocusRing: "strong",
11991
+ enigmaFieldHeight: "44",
11992
+ enigmaRowGap: "12",
11993
+ enigmaCorner: "medium"
11994
+ },
11995
+ fields: {
11996
+ enigmaChrome: "outlined",
11997
+ enigmaLabels: "above",
11998
+ enigmaLabelTone: "muted",
11999
+ enigmaHints: true,
12000
+ enigmaCvcIcon: true,
12001
+ enigmaFieldOrder: "number",
12002
+ enigmaMarks: "live",
12003
+ enigmaFocusRing: "strong",
12004
+ enigmaFieldHeight: "48",
12005
+ enigmaRowGap: "12",
12006
+ enigmaCorner: "small"
12007
+ },
12008
+ classic: {
12009
+ enigmaChrome: "outlined",
12010
+ enigmaLabels: "above",
12011
+ enigmaLabelTone: "strong",
12012
+ enigmaHints: false,
12013
+ enigmaCvcIcon: true,
12014
+ enigmaFieldOrder: "number",
12015
+ enigmaMarks: "live",
12016
+ enigmaFocusRing: "strong",
12017
+ enigmaFieldHeight: "44",
12018
+ enigmaRowGap: "12",
12019
+ enigmaCorner: "medium"
12020
+ },
12021
+ compact: {
12022
+ enigmaChrome: "joined",
12023
+ enigmaLabels: "inside",
12024
+ enigmaLabelTone: "muted",
12025
+ enigmaHints: false,
12026
+ enigmaCvcIcon: true,
12027
+ enigmaFieldOrder: "number",
12028
+ enigmaMarks: "live",
12029
+ enigmaFocusRing: "strong",
12030
+ enigmaFieldHeight: "48",
12031
+ enigmaRowGap: "12",
12032
+ enigmaCorner: "medium"
12033
+ },
12034
+ filled: {
12035
+ enigmaChrome: "filled",
12036
+ enigmaLabels: "above",
12037
+ enigmaLabelTone: "strong",
12038
+ enigmaHints: false,
12039
+ enigmaCvcIcon: true,
12040
+ enigmaFieldOrder: "number",
12041
+ enigmaMarks: "live",
12042
+ enigmaFocusRing: "strong",
12043
+ enigmaFieldHeight: "44",
12044
+ enigmaRowGap: "12",
12045
+ enigmaCorner: "medium"
12046
+ },
12047
+ underline: {
12048
+ enigmaChrome: "underline",
12049
+ enigmaLabels: "above",
12050
+ enigmaLabelTone: "muted",
12051
+ enigmaHints: false,
12052
+ enigmaCvcIcon: true,
12053
+ enigmaFieldOrder: "number",
12054
+ enigmaMarks: "live",
12055
+ enigmaFocusRing: "strong",
12056
+ enigmaFieldHeight: "40",
12057
+ enigmaRowGap: "16",
12058
+ enigmaCorner: "square"
12059
+ }
12060
+ };
12061
+ var DEFAULT_ENIGMA_CARD_FORM = {
12062
+ enigmaTemplate: "soft",
12063
+ enigmaStyleMode: "designed",
12064
+ ...ENIGMA_TEMPLATE_PRESETS.soft,
12065
+ enigmaFieldMotion: "smooth",
12066
+ enigmaAccent: "",
12067
+ enigmaBorder: "",
12068
+ enigmaFill: "",
12069
+ enigmaTrustLine: true,
12070
+ enigmaAutoOpen: false,
12071
+ enigmaOpening: "place",
12072
+ enigmaClickFeedback: "both",
12073
+ enigmaLoading: "shimmer",
12074
+ enigmaReveal: "fade",
12075
+ enigmaPayFeedback: "spinner",
12076
+ enigmaCustomCss: "",
12077
+ enigmaCustomHeight: ENIGMA_CUSTOM_HEIGHT_DEFAULT
12078
+ };
12079
+ function applyEnigmaTemplate(template) {
12080
+ return { enigmaTemplate: template, ...ENIGMA_TEMPLATE_PRESETS[template] };
12081
+ }
12082
+ function enigmaTemplateChanges(settings) {
12083
+ const preset = ENIGMA_TEMPLATE_PRESETS[settings.enigmaTemplate];
12084
+ return Object.keys(preset).filter(
12085
+ (key) => settings[key] !== preset[key]
12086
+ );
12087
+ }
12088
+ function enigmaNamesInside(settings) {
12089
+ return settings.enigmaChrome === "joined" || settings.enigmaLabels === "inside";
12090
+ }
12091
+ var PSEUDO_CLASSES = [
12092
+ "focus",
12093
+ "focus-visible",
12094
+ "focus-within",
12095
+ "hover",
12096
+ "checked",
12097
+ "disabled",
12098
+ "invalid",
12099
+ "valid",
12100
+ "placeholder-shown",
12101
+ "first-child",
12102
+ "last-child"
12103
+ ];
12104
+ var HIDEABLE = ["p", "h1", "#header", "#headertext", ".timer", "#timer"];
12105
+ var PROPERTIES = [
12106
+ "color",
12107
+ "caret-color",
12108
+ "accent-color",
12109
+ "-webkit-text-fill-color",
12110
+ "background",
12111
+ "background-color",
12112
+ "border",
12113
+ "border-top",
12114
+ "border-right",
12115
+ "border-bottom",
12116
+ "border-left",
12117
+ "border-color",
12118
+ "border-width",
12119
+ "border-style",
12120
+ "border-top-color",
12121
+ "border-right-color",
12122
+ "border-bottom-color",
12123
+ "border-left-color",
12124
+ "border-top-width",
12125
+ "border-right-width",
12126
+ "border-bottom-width",
12127
+ "border-left-width",
12128
+ "border-radius",
12129
+ "border-top-left-radius",
12130
+ "border-top-right-radius",
12131
+ "border-bottom-left-radius",
12132
+ "border-bottom-right-radius",
12133
+ "box-shadow",
12134
+ "outline",
12135
+ "outline-color",
12136
+ "outline-offset",
12137
+ "font",
12138
+ "font-family",
12139
+ "font-size",
12140
+ "font-weight",
12141
+ "font-style",
12142
+ "letter-spacing",
12143
+ "line-height",
12144
+ "text-align",
12145
+ "text-transform",
12146
+ "padding",
12147
+ "padding-top",
12148
+ "padding-right",
12149
+ "padding-bottom",
12150
+ "padding-left",
12151
+ "margin",
12152
+ "margin-top",
12153
+ "margin-right",
12154
+ "margin-bottom",
12155
+ "margin-left",
12156
+ "height",
12157
+ "min-height",
12158
+ "width",
12159
+ "min-width",
12160
+ "max-width",
12161
+ "display",
12162
+ "flex-wrap",
12163
+ "gap",
12164
+ "transition",
12165
+ "box-sizing",
12166
+ "top"
12167
+ ];
12168
+ function lengthAtLeast(value, min) {
12169
+ const match = /^(-?[0-9.]+)(px|em|rem)$/.exec(value);
12170
+ if (!match) return false;
12171
+ const number = Number(match[1]) * (match[2] === "px" ? 1 : 16);
12172
+ return Number.isFinite(number) && number >= min;
12173
+ }
12174
+ function spacing(value) {
12175
+ return value.split(" ").every(
12176
+ (part) => part === "0" || part === "auto" || lengthAtLeast(part, 0) && !lengthAtLeast(part, 48.5)
12177
+ );
12178
+ }
12179
+ function width(value) {
12180
+ if (value === "auto") return true;
12181
+ if (value.endsWith("%")) return Number(value.slice(0, -1)) >= 20;
12182
+ const calc = /^calc\(([0-9.]+)% - ([0-9.]+)px\)$/.exec(value);
12183
+ if (calc) return Number(calc[1]) >= 20 && Number(calc[2]) <= 48;
12184
+ if (value.startsWith("calc(")) return false;
12185
+ return lengthAtLeast(value, 40);
12186
+ }
12187
+ function opaqueColour(value) {
12188
+ if (value.startsWith("#")) return /^#([0-9a-f]{3}|[0-9a-f]{6})$/.test(value);
12189
+ if (value.startsWith("rgb("))
12190
+ return value.endsWith(")") && value.split(",").length === 3 && !value.includes("/");
12191
+ return value !== "transparent" && /^[a-z]+$/.test(value);
12192
+ }
12193
+ function declarationProblem(selector, declaration) {
12194
+ const at = declaration.indexOf(":");
12195
+ if (at < 0) return null;
12196
+ const property = declaration.slice(0, at).trim();
12197
+ const raw = declaration.slice(at + 1).trim();
12198
+ const important = raw.endsWith("!important");
12199
+ const value = raw.replace(/!important$/, "").trim();
12200
+ if (!PROPERTIES.includes(property)) return "property";
12201
+ if (["var(", "env(", "attr("].some((fn) => value.includes(fn))) return "variable";
12202
+ let ok = true;
12203
+ switch (property) {
12204
+ case "display": {
12205
+ if (important) return "important_display";
12206
+ const hideable = selector.split(",").every((one) => {
12207
+ const subject = one.split(/[ >]/).pop() ?? one;
12208
+ return HIDEABLE.includes(subject.split(":")[0] ?? subject);
12209
+ });
12210
+ ok = ["block", "flex", "grid", "inline", "inline-block", "inline-flex"].includes(value) || value === "none" && hideable;
12211
+ break;
12212
+ }
12213
+ case "margin":
12214
+ case "margin-top":
12215
+ case "margin-right":
12216
+ case "margin-bottom":
12217
+ case "margin-left":
12218
+ case "padding":
12219
+ case "padding-top":
12220
+ case "padding-right":
12221
+ case "padding-bottom":
12222
+ case "padding-left":
12223
+ ok = spacing(value);
12224
+ break;
12225
+ case "height":
12226
+ case "min-height":
12227
+ ok = value === "auto" || lengthAtLeast(value, 20);
12228
+ break;
12229
+ case "width":
12230
+ case "min-width":
12231
+ case "max-width":
12232
+ ok = width(value);
12233
+ break;
12234
+ case "font-size":
12235
+ ok = lengthAtLeast(value, 12);
12236
+ break;
12237
+ case "font": {
12238
+ const size = value.split(/[ /]/).find((part) => part.endsWith("px") || part.endsWith("em"));
12239
+ ok = size !== void 0 && lengthAtLeast(size, 12);
12240
+ break;
12241
+ }
12242
+ case "line-height":
12243
+ ok = value === "normal" || Number(value) >= 1 || lengthAtLeast(value, 12);
12244
+ break;
12245
+ case "color":
12246
+ case "caret-color":
12247
+ ok = opaqueColour(value);
12248
+ break;
12249
+ case "top":
12250
+ ok = value === "0" || /^-?[0-9.]+px$/.test(value) && Math.abs(parseFloat(value)) <= 4;
12251
+ break;
12252
+ case "-webkit-text-fill-color":
12253
+ ok = selector.split(",").every((one) => (one.split(/[ >]/).pop() ?? "").includes(":placeholder-shown")) || opaqueColour(value);
12254
+ break;
12255
+ }
12256
+ return ok ? null : "hides_field";
12257
+ }
12258
+ function selectorProblem(selector) {
12259
+ if (!selector || !/^[a-z0-9\-_#.:,> ]+$/.test(selector) || selector.includes("::"))
12260
+ return "selector";
12261
+ const pseudoOk = selector.split(":").slice(1).every((after) => PSEUDO_CLASSES.includes(after.split(/[ >,.#]/)[0] ?? after));
12262
+ return pseudoOk ? null : "selector";
12263
+ }
12264
+ function enigmaCustomCssProblem(css) {
12265
+ if (!css.trim()) return null;
12266
+ if (css.length > ENIGMA_CUSTOM_CSS_MAX_LENGTH) return "too_long";
12267
+ if (/[^\x20-\x7e\n\r\t]/.test(css)) return "not_ascii";
12268
+ if (css.includes("<")) return "markup";
12269
+ if (css.includes("\\")) return "escape";
12270
+ const lower = css.toLowerCase();
12271
+ if (lower.includes("/*")) return "comment";
12272
+ if (["url(", "image-set(", "image(", "element(", "cross-fade(", "src(", "data:"].some(
12273
+ (needle) => lower.includes(needle)
12274
+ )) {
12275
+ return "loads_resource";
12276
+ }
12277
+ if (["expression(", "javascript:", "behavior", "-moz-binding"].some(
12278
+ (needle) => lower.includes(needle)
12279
+ )) {
12280
+ return "script";
12281
+ }
12282
+ if (/@(?!media)/.test(lower)) return "at_rule";
12283
+ const compact = lower.split(/\s+/).filter(Boolean).join(" ");
12284
+ const blocks = [];
12285
+ let text = "";
12286
+ for (const ch of compact) {
12287
+ if (ch === "{") {
12288
+ const prelude = text.trim();
12289
+ text = "";
12290
+ const media = prelude.startsWith("@media");
12291
+ if (!media) {
12292
+ const problem = selectorProblem(prelude.replace(/, /g, ","));
12293
+ if (problem) return problem;
12294
+ }
12295
+ blocks.push({ selector: prelude, media });
12296
+ } else if (ch === "}" || ch === ";") {
12297
+ const declaration = text;
12298
+ text = "";
12299
+ const top = blocks[blocks.length - 1];
12300
+ if (!top) {
12301
+ if (ch === "}") return "unbalanced";
12302
+ continue;
12303
+ }
12304
+ if (!top.media && declaration.trim()) {
12305
+ const problem = declarationProblem(top.selector.replace(/, /g, ","), declaration);
12306
+ if (problem) return problem;
12307
+ }
12308
+ if (ch === "}") blocks.pop();
12309
+ } else {
12310
+ text += ch;
12311
+ }
12312
+ }
12313
+ return blocks.length > 0 ? "unbalanced" : null;
12314
+ }
12315
+ function enigmaCornerPx(corner) {
12316
+ return { square: 0, small: 6, medium: 8, large: 12, pill: 22 }[corner];
12317
+ }
12318
+ var HEX = /^#[0-9a-fA-F]{3}([0-9a-fA-F]{3})?$/;
12319
+ function pick(value, allowed, fallback) {
12320
+ return typeof value === "string" && allowed.includes(value) ? value : fallback;
12321
+ }
12322
+ function bool(value, fallback) {
12323
+ if (value === true || value === "true") return true;
12324
+ if (value === false || value === "false") return false;
12325
+ return fallback;
12326
+ }
12327
+ function hexOrEmpty(value) {
12328
+ return typeof value === "string" && HEX.test(value.trim()) ? value.trim() : "";
12329
+ }
12330
+ function decodeEnigmaCardForm(source) {
12331
+ const d = DEFAULT_ENIGMA_CARD_FORM;
12332
+ const height = Number(source["enigmaCustomHeight"]);
12333
+ const css = typeof source["enigmaCustomCss"] === "string" ? source["enigmaCustomCss"] : "";
12334
+ return {
12335
+ enigmaTemplate: pick(source["enigmaTemplate"], ENIGMA_TEMPLATES, d.enigmaTemplate),
12336
+ enigmaStyleMode: pick(source["enigmaStyleMode"], ENIGMA_STYLE_MODES, d.enigmaStyleMode),
12337
+ enigmaChrome: pick(source["enigmaChrome"], ENIGMA_FIELD_CHROMES, d.enigmaChrome),
12338
+ enigmaLabels: pick(source["enigmaLabels"], ENIGMA_LABEL_PLACEMENTS, d.enigmaLabels),
12339
+ enigmaLabelTone: pick(source["enigmaLabelTone"], ENIGMA_LABEL_TONES, d.enigmaLabelTone),
12340
+ enigmaHints: bool(source["enigmaHints"], d.enigmaHints),
12341
+ enigmaCvcIcon: bool(source["enigmaCvcIcon"], d.enigmaCvcIcon),
12342
+ enigmaFieldOrder: pick(source["enigmaFieldOrder"], ENIGMA_FIELD_ORDERS, d.enigmaFieldOrder),
12343
+ enigmaMarks: pick(source["enigmaMarks"], ENIGMA_NETWORK_MARKS, d.enigmaMarks),
12344
+ enigmaFocusRing: pick(source["enigmaFocusRing"], ENIGMA_FOCUS_RINGS, d.enigmaFocusRing),
12345
+ enigmaFieldMotion: pick(source["enigmaFieldMotion"], ENIGMA_FIELD_MOTIONS, d.enigmaFieldMotion),
12346
+ enigmaFieldHeight: pick(
12347
+ String(source["enigmaFieldHeight"] ?? ""),
12348
+ ENIGMA_FIELD_HEIGHTS,
12349
+ d.enigmaFieldHeight
12350
+ ),
12351
+ enigmaRowGap: pick(String(source["enigmaRowGap"] ?? ""), ENIGMA_ROW_GAPS, d.enigmaRowGap),
12352
+ enigmaCorner: pick(source["enigmaCorner"], ENIGMA_CORNERS, d.enigmaCorner),
12353
+ enigmaAccent: hexOrEmpty(source["enigmaAccent"]),
12354
+ enigmaBorder: hexOrEmpty(source["enigmaBorder"]),
12355
+ enigmaFill: hexOrEmpty(source["enigmaFill"]),
12356
+ enigmaTrustLine: bool(source["enigmaTrustLine"], d.enigmaTrustLine),
12357
+ enigmaAutoOpen: bool(source["enigmaAutoOpen"], d.enigmaAutoOpen),
12358
+ enigmaOpening: pick(source["enigmaOpening"], ENIGMA_OPENINGS, d.enigmaOpening),
12359
+ enigmaClickFeedback: pick(
12360
+ source["enigmaClickFeedback"],
12361
+ ENIGMA_CLICK_FEEDBACK,
12362
+ d.enigmaClickFeedback
12363
+ ),
12364
+ enigmaLoading: pick(source["enigmaLoading"], ENIGMA_LOADING_STYLES, d.enigmaLoading),
12365
+ enigmaReveal: pick(source["enigmaReveal"], ENIGMA_REVEALS, d.enigmaReveal),
12366
+ enigmaPayFeedback: pick(source["enigmaPayFeedback"], ENIGMA_PAY_FEEDBACK, d.enigmaPayFeedback),
12367
+ enigmaCustomCss: css.slice(0, ENIGMA_CUSTOM_CSS_MAX_LENGTH),
12368
+ enigmaCustomHeight: Number.isInteger(height) && height >= ENIGMA_CUSTOM_HEIGHT_MIN && height <= ENIGMA_CUSTOM_HEIGHT_MAX ? height : d.enigmaCustomHeight
12369
+ };
12370
+ }
12371
+ function encodeEnigmaCardForm(settings) {
12372
+ const out = {};
12373
+ for (const key of Object.keys(DEFAULT_ENIGMA_CARD_FORM)) {
12374
+ const value = settings[key];
12375
+ if (value === DEFAULT_ENIGMA_CARD_FORM[key]) continue;
12376
+ const text = String(value);
12377
+ if (key === "enigmaCustomCss" && !text.trim()) continue;
12378
+ out[key] = text;
12379
+ }
12380
+ return out;
12381
+ }
12382
+
11884
12383
  // src/branding.ts
11885
12384
  function surchargeShowsLabel(labelMode, style, position) {
11886
12385
  if (labelMode !== "labelled") return false;
@@ -12154,18 +12653,48 @@ function inputPadValue(size) {
12154
12653
  function buttonPadValue(size) {
12155
12654
  return BUTTON_PAD[size] ?? BUTTON_PAD.md;
12156
12655
  }
12157
- function vaultFormAppearance(b, danger) {
12158
- return {
12656
+ function vaultFormAppearance(b, danger, options = {}) {
12657
+ const border = b.enigmaBorder || b.border;
12658
+ const look = {
12159
12659
  surface: b.surface,
12160
12660
  text: b.text,
12161
- border: b.border,
12162
- accent: b.primary,
12661
+ border,
12662
+ accent: b.enigmaAccent || b.primary,
12163
12663
  ...danger ? { danger } : {},
12164
12664
  font: b.fontFamily,
12165
12665
  radius: b.radiusInput,
12166
12666
  size: b.inputSize,
12167
12667
  labels: b.labelStyle
12168
12668
  };
12669
+ if (!options.designed) return look;
12670
+ return {
12671
+ ...look,
12672
+ chrome: b.enigmaChrome,
12673
+ label: enigmaNamesInside(b) ? "inside" : "above",
12674
+ hints: b.enigmaHints,
12675
+ order: b.enigmaFieldOrder,
12676
+ marks: b.enigmaMarks,
12677
+ focus: b.enigmaFocusRing,
12678
+ motion: b.enigmaFieldMotion,
12679
+ height: b.enigmaFieldHeight,
12680
+ gap: b.enigmaRowGap,
12681
+ corner: b.enigmaCorner,
12682
+ fill: b.enigmaFill || enigmaDefaultFill(b.surface, b.text),
12683
+ ...b.enigmaStyleMode === "custom" ? { custom: true } : {}
12684
+ };
12685
+ }
12686
+ function enigmaDefaultFill(surface, text) {
12687
+ const channels = (hex) => {
12688
+ const v = hex.trim().replace("#", "");
12689
+ const full = v.length === 3 ? v.replace(/./g, "$&$&") : v;
12690
+ if (!/^[0-9a-fA-F]{6}$/.test(full)) return null;
12691
+ return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16));
12692
+ };
12693
+ const s2 = channels(surface) ?? [255, 255, 255];
12694
+ const t = channels(text) ?? [30, 41, 59];
12695
+ return `#${s2.map(
12696
+ (value, i) => Math.round(value * 0.94 + (t[i] ?? 0) * 0.06).toString(16).padStart(2, "0")
12697
+ ).join("")}`;
12169
12698
  }
12170
12699
  function logoDimensions(size) {
12171
12700
  switch (size) {
@@ -12667,7 +13196,9 @@ var DEFAULT_BRANDING_BASE = {
12667
13196
  whopShadow: "soft",
12668
13197
  whopMethodIcons: true,
12669
13198
  whopSelection: "radio_tint",
12670
- customCss: ""
13199
+ customCss: "",
13200
+ // The Enigma Vault card form: the Stripe-like template.
13201
+ ...DEFAULT_ENIGMA_CARD_FORM
12671
13202
  };
12672
13203
  var DEFAULT_BRANDING = {
12673
13204
  ...DEFAULT_BRANDING_BASE,
@@ -13777,7 +14308,8 @@ function decodeBranding(source) {
13777
14308
  GOOGLE_PAY_BUTTON_TYPES,
13778
14309
  DEFAULT_BRANDING.nomupayGooglePayButtonType
13779
14310
  ),
13780
- customCss: s(extras["customCss"])
14311
+ customCss: s(extras["customCss"]),
14312
+ ...decodeEnigmaCardForm(extras)
13781
14313
  };
13782
14314
  }
13783
14315
  function encodeBranding(branding, base) {
@@ -13939,6 +14471,7 @@ function encodeBranding(branding, base) {
13939
14471
  if (support) extras["supportEmail"] = support;
13940
14472
  const css = trim(branding.customCss);
13941
14473
  if (css) extras["customCss"] = css;
14474
+ Object.assign(extras, encodeEnigmaCardForm(branding));
13942
14475
  const nextRules = {
13943
14476
  ...existingRules,
13944
14477
  [BRANDING_GROUP_KEY]: extras
@@ -14459,7 +14992,8 @@ function parseImportedBranding(raw) {
14459
14992
  GOOGLE_PAY_BUTTON_TYPES,
14460
14993
  dflt.nomupayGooglePayButtonType
14461
14994
  ),
14462
- customCss: sStr(root["customCss"], dflt.customCss).slice(0, CUSTOM_CSS_MAX_LENGTH)
14995
+ customCss: sStr(root["customCss"], dflt.customCss).slice(0, CUSTOM_CSS_MAX_LENGTH),
14996
+ ...decodeEnigmaCardForm(root)
14463
14997
  };
14464
14998
  }
14465
14999
  function isObject(v) {
@@ -14552,7 +15086,19 @@ function vaultFormQuery(params) {
14552
15086
  form_font: look?.font,
14553
15087
  form_radius: look?.radius,
14554
15088
  form_size: look?.size,
14555
- form_labels: look?.labels
15089
+ form_labels: look?.labels,
15090
+ form_chrome: look?.chrome,
15091
+ form_label: look?.label,
15092
+ form_hints: look?.hints === void 0 ? void 0 : String(look.hints),
15093
+ form_order: look?.order,
15094
+ form_marks: look?.marks,
15095
+ form_focus: look?.focus,
15096
+ form_motion: look?.motion,
15097
+ form_height: look?.height,
15098
+ form_gap: look?.gap,
15099
+ form_corner: look?.corner,
15100
+ form_fill: look?.fill,
15101
+ form_custom: look?.custom ? "true" : void 0
14556
15102
  };
14557
15103
  }
14558
15104
  function withoutHeader(headers, name) {
@@ -16158,6 +16704,36 @@ export {
16158
16704
  WHOP_LOOKS,
16159
16705
  WHOP_LOOK_SETTINGS,
16160
16706
  matchWhopLook,
16707
+ ENIGMA_FIELD_CHROMES,
16708
+ ENIGMA_LABEL_PLACEMENTS,
16709
+ ENIGMA_LABEL_TONES,
16710
+ ENIGMA_FIELD_ORDERS,
16711
+ ENIGMA_NETWORK_MARKS,
16712
+ ENIGMA_FOCUS_RINGS,
16713
+ ENIGMA_FIELD_MOTIONS,
16714
+ ENIGMA_FIELD_HEIGHTS,
16715
+ ENIGMA_ROW_GAPS,
16716
+ ENIGMA_CORNERS,
16717
+ ENIGMA_STYLE_MODES,
16718
+ ENIGMA_OPENINGS,
16719
+ ENIGMA_CLICK_FEEDBACK,
16720
+ ENIGMA_LOADING_STYLES,
16721
+ ENIGMA_REVEALS,
16722
+ ENIGMA_PAY_FEEDBACK,
16723
+ ENIGMA_TEMPLATES,
16724
+ ENIGMA_CUSTOM_CSS_MAX_LENGTH,
16725
+ ENIGMA_CUSTOM_HEIGHT_MIN,
16726
+ ENIGMA_CUSTOM_HEIGHT_MAX,
16727
+ ENIGMA_CUSTOM_HEIGHT_DEFAULT,
16728
+ ENIGMA_TEMPLATE_PRESETS,
16729
+ DEFAULT_ENIGMA_CARD_FORM,
16730
+ applyEnigmaTemplate,
16731
+ enigmaTemplateChanges,
16732
+ enigmaNamesInside,
16733
+ enigmaCustomCssProblem,
16734
+ enigmaCornerPx,
16735
+ decodeEnigmaCardForm,
16736
+ encodeEnigmaCardForm,
16161
16737
  surchargeShowsLabel,
16162
16738
  surchargeFigurePlan,
16163
16739
  readableInkOn,
@@ -16195,6 +16771,7 @@ export {
16195
16771
  inputPadValue,
16196
16772
  buttonPadValue,
16197
16773
  vaultFormAppearance,
16774
+ enigmaDefaultFill,
16198
16775
  logoDimensions,
16199
16776
  isHexColor,
16200
16777
  WCAG_AA_TEXT,
@@ -16315,4 +16892,4 @@ export {
16315
16892
  decodeNativePanes,
16316
16893
  encodeNativePanes
16317
16894
  };
16318
- //# sourceMappingURL=chunk-WQVV25OT.js.map
16895
+ //# sourceMappingURL=chunk-E7CYYHZ3.js.map