@delopay/sdk 0.229.0 → 0.230.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/{chunk-UVKPIUOO.js → chunk-HNQKUUSW.js} +249 -1
- package/dist/{chunk-UVKPIUOO.js.map → chunk-HNQKUUSW.js.map} +1 -1
- package/dist/index.cjs +259 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +66 -1
- package/dist/index.d.ts +66 -1
- package/dist/index.js +21 -3
- package/dist/internal.cjs +259 -2
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +21 -3
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
|
@@ -8526,6 +8526,133 @@ var GOOGLE_PAY_BUTTON_TYPES = [
|
|
|
8526
8526
|
"subscribe",
|
|
8527
8527
|
"donate"
|
|
8528
8528
|
];
|
|
8529
|
+
var WHOP_CARD_PRESETS = ["accordion", "tiles", "card_stacked", "card_compact"];
|
|
8530
|
+
function whopCardElement(preset) {
|
|
8531
|
+
switch (preset) {
|
|
8532
|
+
case "tiles":
|
|
8533
|
+
return { element: "payment", layout: "horizontal" };
|
|
8534
|
+
case "card_stacked":
|
|
8535
|
+
return { element: "card", layout: "stacked" };
|
|
8536
|
+
case "card_compact":
|
|
8537
|
+
return { element: "card", layout: "compact" };
|
|
8538
|
+
default:
|
|
8539
|
+
return { element: "payment", layout: "accordion" };
|
|
8540
|
+
}
|
|
8541
|
+
}
|
|
8542
|
+
var WHOP_ACCENT_COLORS = [
|
|
8543
|
+
"auto",
|
|
8544
|
+
"gray",
|
|
8545
|
+
"blue",
|
|
8546
|
+
"indigo",
|
|
8547
|
+
"iris",
|
|
8548
|
+
"violet",
|
|
8549
|
+
"purple",
|
|
8550
|
+
"plum",
|
|
8551
|
+
"pink",
|
|
8552
|
+
"crimson",
|
|
8553
|
+
"ruby",
|
|
8554
|
+
"red",
|
|
8555
|
+
"tomato",
|
|
8556
|
+
"orange",
|
|
8557
|
+
"amber",
|
|
8558
|
+
"yellow",
|
|
8559
|
+
"lime",
|
|
8560
|
+
"grass",
|
|
8561
|
+
"green",
|
|
8562
|
+
"jade",
|
|
8563
|
+
"teal",
|
|
8564
|
+
"cyan",
|
|
8565
|
+
"sky",
|
|
8566
|
+
"mint",
|
|
8567
|
+
"brown",
|
|
8568
|
+
"bronze",
|
|
8569
|
+
"gold"
|
|
8570
|
+
];
|
|
8571
|
+
var WHOP_ACCENT_SWATCHES = {
|
|
8572
|
+
blue: "#0090ff",
|
|
8573
|
+
indigo: "#3e63dd",
|
|
8574
|
+
iris: "#5b5bd6",
|
|
8575
|
+
violet: "#6e56cf",
|
|
8576
|
+
purple: "#8e4ec6",
|
|
8577
|
+
plum: "#ab4aba",
|
|
8578
|
+
pink: "#d6409f",
|
|
8579
|
+
crimson: "#e93d82",
|
|
8580
|
+
ruby: "#e54666",
|
|
8581
|
+
red: "#e5484d",
|
|
8582
|
+
tomato: "#e54d2e",
|
|
8583
|
+
orange: "#f76b15",
|
|
8584
|
+
amber: "#ffc53d",
|
|
8585
|
+
yellow: "#ffe629",
|
|
8586
|
+
lime: "#bdee63",
|
|
8587
|
+
grass: "#46a758",
|
|
8588
|
+
green: "#30a46c",
|
|
8589
|
+
jade: "#29a383",
|
|
8590
|
+
teal: "#12a594",
|
|
8591
|
+
cyan: "#00a2c7",
|
|
8592
|
+
sky: "#7ce2fe",
|
|
8593
|
+
mint: "#86ead4",
|
|
8594
|
+
brown: "#ad7f58",
|
|
8595
|
+
bronze: "#a18072",
|
|
8596
|
+
gold: "#978365"
|
|
8597
|
+
};
|
|
8598
|
+
function whopAccentSwatch(accent) {
|
|
8599
|
+
return accent === "gray" ? "#8d8d8d" : WHOP_ACCENT_SWATCHES[accent];
|
|
8600
|
+
}
|
|
8601
|
+
function hexRgb(hex) {
|
|
8602
|
+
const raw = hex.trim().replace(/^#/, "");
|
|
8603
|
+
const full = raw.length === 3 ? raw.replace(/./g, (c) => c + c) : raw;
|
|
8604
|
+
if (!/^[0-9a-f]{6}$/i.test(full)) return null;
|
|
8605
|
+
const n = Number.parseInt(full, 16);
|
|
8606
|
+
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
8607
|
+
}
|
|
8608
|
+
function oklab([r, g, b]) {
|
|
8609
|
+
const lin = (c) => {
|
|
8610
|
+
const v = c / 255;
|
|
8611
|
+
return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
8612
|
+
};
|
|
8613
|
+
const [lr, lg, lb] = [lin(r), lin(g), lin(b)];
|
|
8614
|
+
const l = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb);
|
|
8615
|
+
const m = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb);
|
|
8616
|
+
const s2 = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb);
|
|
8617
|
+
return [
|
|
8618
|
+
0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s2,
|
|
8619
|
+
1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s2,
|
|
8620
|
+
0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s2
|
|
8621
|
+
];
|
|
8622
|
+
}
|
|
8623
|
+
function nearestWhopAccent(hex) {
|
|
8624
|
+
const rgb = hexRgb(hex);
|
|
8625
|
+
if (!rgb) return "blue";
|
|
8626
|
+
const [L, a, b] = oklab(rgb);
|
|
8627
|
+
if (Math.hypot(a, b) < 0.04) return "gray";
|
|
8628
|
+
let best = "blue";
|
|
8629
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
8630
|
+
for (const [name, swatch] of Object.entries(WHOP_ACCENT_SWATCHES)) {
|
|
8631
|
+
const swatchRgb = hexRgb(swatch);
|
|
8632
|
+
if (!swatchRgb) continue;
|
|
8633
|
+
const [sL, sa, sb] = oklab(swatchRgb);
|
|
8634
|
+
const distance = Math.hypot((L - sL) * 0.5, a - sa, b - sb);
|
|
8635
|
+
if (distance < bestDistance) {
|
|
8636
|
+
bestDistance = distance;
|
|
8637
|
+
best = name;
|
|
8638
|
+
}
|
|
8639
|
+
}
|
|
8640
|
+
return best;
|
|
8641
|
+
}
|
|
8642
|
+
function resolveWhopAccent(accent, primaryHex) {
|
|
8643
|
+
return accent === "auto" ? nearestWhopAccent(primaryHex) : accent;
|
|
8644
|
+
}
|
|
8645
|
+
var WHOP_EMAIL_LABELS = ["above", "floating"];
|
|
8646
|
+
var WHOP_GRAY_COLORS = [
|
|
8647
|
+
"auto",
|
|
8648
|
+
"gray",
|
|
8649
|
+
"mauve",
|
|
8650
|
+
"slate",
|
|
8651
|
+
"sage",
|
|
8652
|
+
"olive",
|
|
8653
|
+
"sand"
|
|
8654
|
+
];
|
|
8655
|
+
var WHOP_BILLING_DETAILS = ["minimal", "full"];
|
|
8529
8656
|
|
|
8530
8657
|
// src/branding.ts
|
|
8531
8658
|
function surchargeShowsLabel(labelMode, style, position) {
|
|
@@ -9279,6 +9406,16 @@ var DEFAULT_BRANDING_BASE = {
|
|
|
9279
9406
|
micropaymentFieldFontSize: "md",
|
|
9280
9407
|
micropaymentFieldWeight: "regular",
|
|
9281
9408
|
micropaymentFocusRing: "strong",
|
|
9409
|
+
whopCardPreset: "accordion",
|
|
9410
|
+
whopAccentColor: "auto",
|
|
9411
|
+
whopGrayColor: "auto",
|
|
9412
|
+
whopBillingDetails: "minimal",
|
|
9413
|
+
whopSeparated: false,
|
|
9414
|
+
whopEmailLabel: "above",
|
|
9415
|
+
whopFieldChrome: "outlined",
|
|
9416
|
+
whopFieldFontSize: "md",
|
|
9417
|
+
whopFieldWeight: "regular",
|
|
9418
|
+
whopFocusRing: "strong",
|
|
9282
9419
|
customCss: ""
|
|
9283
9420
|
};
|
|
9284
9421
|
var DEFAULT_BRANDING = {
|
|
@@ -10221,6 +10358,52 @@ function decodeBranding(source) {
|
|
|
10221
10358
|
CARD_FOCUS_RINGS,
|
|
10222
10359
|
DEFAULT_BRANDING.micropaymentFocusRing
|
|
10223
10360
|
),
|
|
10361
|
+
whopCardPreset: pickEnum(
|
|
10362
|
+
extras["whopCardPreset"],
|
|
10363
|
+
WHOP_CARD_PRESETS,
|
|
10364
|
+
DEFAULT_BRANDING.whopCardPreset
|
|
10365
|
+
),
|
|
10366
|
+
whopAccentColor: pickEnum(
|
|
10367
|
+
extras["whopAccentColor"],
|
|
10368
|
+
WHOP_ACCENT_COLORS,
|
|
10369
|
+
DEFAULT_BRANDING.whopAccentColor
|
|
10370
|
+
),
|
|
10371
|
+
whopGrayColor: pickEnum(
|
|
10372
|
+
extras["whopGrayColor"],
|
|
10373
|
+
WHOP_GRAY_COLORS,
|
|
10374
|
+
DEFAULT_BRANDING.whopGrayColor
|
|
10375
|
+
),
|
|
10376
|
+
whopBillingDetails: pickEnum(
|
|
10377
|
+
extras["whopBillingDetails"],
|
|
10378
|
+
WHOP_BILLING_DETAILS,
|
|
10379
|
+
DEFAULT_BRANDING.whopBillingDetails
|
|
10380
|
+
),
|
|
10381
|
+
whopSeparated: parseBool(extras["whopSeparated"], DEFAULT_BRANDING.whopSeparated),
|
|
10382
|
+
whopEmailLabel: pickEnum(
|
|
10383
|
+
extras["whopEmailLabel"],
|
|
10384
|
+
WHOP_EMAIL_LABELS,
|
|
10385
|
+
DEFAULT_BRANDING.whopEmailLabel
|
|
10386
|
+
),
|
|
10387
|
+
whopFieldChrome: pickEnum(
|
|
10388
|
+
extras["whopFieldChrome"],
|
|
10389
|
+
CARD_FIELD_CHROMES,
|
|
10390
|
+
DEFAULT_BRANDING.whopFieldChrome
|
|
10391
|
+
),
|
|
10392
|
+
whopFieldFontSize: pickEnum(
|
|
10393
|
+
extras["whopFieldFontSize"],
|
|
10394
|
+
CARD_FIELD_FONT_SIZES,
|
|
10395
|
+
DEFAULT_BRANDING.whopFieldFontSize
|
|
10396
|
+
),
|
|
10397
|
+
whopFieldWeight: pickEnum(
|
|
10398
|
+
extras["whopFieldWeight"],
|
|
10399
|
+
CARD_FIELD_WEIGHTS,
|
|
10400
|
+
DEFAULT_BRANDING.whopFieldWeight
|
|
10401
|
+
),
|
|
10402
|
+
whopFocusRing: pickEnum(
|
|
10403
|
+
extras["whopFocusRing"],
|
|
10404
|
+
CARD_FOCUS_RINGS,
|
|
10405
|
+
DEFAULT_BRANDING.whopFocusRing
|
|
10406
|
+
),
|
|
10224
10407
|
paypalValidTint: parseBool(extras["paypalValidTint"], DEFAULT_BRANDING.paypalValidTint),
|
|
10225
10408
|
nomupayFormStyle: pickEnum(
|
|
10226
10409
|
extras["nomupayFormStyle"],
|
|
@@ -10368,6 +10551,16 @@ function encodeBranding(branding, base) {
|
|
|
10368
10551
|
micropaymentFieldFontSize: branding.micropaymentFieldFontSize,
|
|
10369
10552
|
micropaymentFieldWeight: branding.micropaymentFieldWeight,
|
|
10370
10553
|
micropaymentFocusRing: branding.micropaymentFocusRing,
|
|
10554
|
+
whopCardPreset: branding.whopCardPreset,
|
|
10555
|
+
whopAccentColor: branding.whopAccentColor,
|
|
10556
|
+
whopGrayColor: branding.whopGrayColor,
|
|
10557
|
+
whopBillingDetails: branding.whopBillingDetails,
|
|
10558
|
+
whopSeparated: String(branding.whopSeparated),
|
|
10559
|
+
whopEmailLabel: branding.whopEmailLabel,
|
|
10560
|
+
whopFieldChrome: branding.whopFieldChrome,
|
|
10561
|
+
whopFieldFontSize: branding.whopFieldFontSize,
|
|
10562
|
+
whopFieldWeight: branding.whopFieldWeight,
|
|
10563
|
+
whopFocusRing: branding.whopFocusRing,
|
|
10371
10564
|
paypalValidTint: String(branding.paypalValidTint),
|
|
10372
10565
|
nomupayFormStyle: branding.nomupayFormStyle,
|
|
10373
10566
|
nomupayShowLabels: String(branding.nomupayShowLabels),
|
|
@@ -10775,6 +10968,52 @@ function parseImportedBranding(raw) {
|
|
|
10775
10968
|
CARD_FOCUS_RINGS,
|
|
10776
10969
|
dflt.micropaymentFocusRing
|
|
10777
10970
|
),
|
|
10971
|
+
whopCardPreset: pickEnum(
|
|
10972
|
+
root["whopCardPreset"],
|
|
10973
|
+
WHOP_CARD_PRESETS,
|
|
10974
|
+
dflt.whopCardPreset
|
|
10975
|
+
),
|
|
10976
|
+
whopAccentColor: pickEnum(
|
|
10977
|
+
root["whopAccentColor"],
|
|
10978
|
+
WHOP_ACCENT_COLORS,
|
|
10979
|
+
dflt.whopAccentColor
|
|
10980
|
+
),
|
|
10981
|
+
whopGrayColor: pickEnum(
|
|
10982
|
+
root["whopGrayColor"],
|
|
10983
|
+
WHOP_GRAY_COLORS,
|
|
10984
|
+
dflt.whopGrayColor
|
|
10985
|
+
),
|
|
10986
|
+
whopBillingDetails: pickEnum(
|
|
10987
|
+
root["whopBillingDetails"],
|
|
10988
|
+
WHOP_BILLING_DETAILS,
|
|
10989
|
+
dflt.whopBillingDetails
|
|
10990
|
+
),
|
|
10991
|
+
whopSeparated: parseBool(root["whopSeparated"], dflt.whopSeparated),
|
|
10992
|
+
whopEmailLabel: pickEnum(
|
|
10993
|
+
root["whopEmailLabel"],
|
|
10994
|
+
WHOP_EMAIL_LABELS,
|
|
10995
|
+
dflt.whopEmailLabel
|
|
10996
|
+
),
|
|
10997
|
+
whopFieldChrome: pickEnum(
|
|
10998
|
+
root["whopFieldChrome"],
|
|
10999
|
+
CARD_FIELD_CHROMES,
|
|
11000
|
+
dflt.whopFieldChrome
|
|
11001
|
+
),
|
|
11002
|
+
whopFieldFontSize: pickEnum(
|
|
11003
|
+
root["whopFieldFontSize"],
|
|
11004
|
+
CARD_FIELD_FONT_SIZES,
|
|
11005
|
+
dflt.whopFieldFontSize
|
|
11006
|
+
),
|
|
11007
|
+
whopFieldWeight: pickEnum(
|
|
11008
|
+
root["whopFieldWeight"],
|
|
11009
|
+
CARD_FIELD_WEIGHTS,
|
|
11010
|
+
dflt.whopFieldWeight
|
|
11011
|
+
),
|
|
11012
|
+
whopFocusRing: pickEnum(
|
|
11013
|
+
root["whopFocusRing"],
|
|
11014
|
+
CARD_FOCUS_RINGS,
|
|
11015
|
+
dflt.whopFocusRing
|
|
11016
|
+
),
|
|
10778
11017
|
paypalValidTint: parseBool(root["paypalValidTint"], dflt.paypalValidTint),
|
|
10779
11018
|
nomupayFormStyle: pickEnum(
|
|
10780
11019
|
root["nomupayFormStyle"],
|
|
@@ -12031,6 +12270,15 @@ export {
|
|
|
12031
12270
|
GOOGLE_PAY_BUTTON_COLORS,
|
|
12032
12271
|
resolveGooglePayButtonColor,
|
|
12033
12272
|
GOOGLE_PAY_BUTTON_TYPES,
|
|
12273
|
+
WHOP_CARD_PRESETS,
|
|
12274
|
+
whopCardElement,
|
|
12275
|
+
WHOP_ACCENT_COLORS,
|
|
12276
|
+
whopAccentSwatch,
|
|
12277
|
+
nearestWhopAccent,
|
|
12278
|
+
resolveWhopAccent,
|
|
12279
|
+
WHOP_EMAIL_LABELS,
|
|
12280
|
+
WHOP_GRAY_COLORS,
|
|
12281
|
+
WHOP_BILLING_DETAILS,
|
|
12034
12282
|
surchargeShowsLabel,
|
|
12035
12283
|
surchargeFigurePlan,
|
|
12036
12284
|
readableInkOn,
|
|
@@ -12174,4 +12422,4 @@ export {
|
|
|
12174
12422
|
decodeNativePanes,
|
|
12175
12423
|
encodeNativePanes
|
|
12176
12424
|
};
|
|
12177
|
-
//# sourceMappingURL=chunk-
|
|
12425
|
+
//# sourceMappingURL=chunk-HNQKUUSW.js.map
|