@delopay/sdk 0.228.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 +121 -1
- package/dist/index.d.ts +121 -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 +18 -17
package/dist/index.cjs
CHANGED
|
@@ -134,6 +134,11 @@ __export(index_exports, {
|
|
|
134
134
|
UNKNOWN_SECTION_ORDER: () => UNKNOWN_SECTION_ORDER,
|
|
135
135
|
WCAG_AA_TEXT: () => WCAG_AA_TEXT,
|
|
136
136
|
WCAG_AA_UI: () => WCAG_AA_UI,
|
|
137
|
+
WHOP_ACCENT_COLORS: () => WHOP_ACCENT_COLORS,
|
|
138
|
+
WHOP_BILLING_DETAILS: () => WHOP_BILLING_DETAILS,
|
|
139
|
+
WHOP_CARD_PRESETS: () => WHOP_CARD_PRESETS,
|
|
140
|
+
WHOP_EMAIL_LABELS: () => WHOP_EMAIL_LABELS,
|
|
141
|
+
WHOP_GRAY_COLORS: () => WHOP_GRAY_COLORS,
|
|
137
142
|
Webhooks: () => Webhooks,
|
|
138
143
|
WhopResolutionCases: () => WhopResolutionCases,
|
|
139
144
|
airwallexCardLayout: () => airwallexCardLayout,
|
|
@@ -207,6 +212,7 @@ __export(index_exports, {
|
|
|
207
212
|
leaf: () => leaf,
|
|
208
213
|
logoDimensions: () => logoDimensions,
|
|
209
214
|
nativePaneMethodInfo: () => nativePaneMethodInfo,
|
|
215
|
+
nearestWhopAccent: () => nearestWhopAccent,
|
|
210
216
|
noticeText: () => noticeText,
|
|
211
217
|
noticesIn: () => noticesIn,
|
|
212
218
|
offerablePaneMethods: () => offerablePaneMethods,
|
|
@@ -227,6 +233,7 @@ __export(index_exports, {
|
|
|
227
233
|
resolveGooglePayButtonColor: () => resolveGooglePayButtonColor,
|
|
228
234
|
resolveNoticesAndBadges: () => resolveNoticesAndBadges,
|
|
229
235
|
resolveStripeTheme: () => resolveStripeTheme,
|
|
236
|
+
resolveWhopAccent: () => resolveWhopAccent,
|
|
230
237
|
ruleMatchToTree: () => ruleMatchToTree,
|
|
231
238
|
sanitizeCustomCss: () => sanitizeCustomCss,
|
|
232
239
|
sectionLabel: () => sectionLabel,
|
|
@@ -242,7 +249,9 @@ __export(index_exports, {
|
|
|
242
249
|
validSectionOrder: () => validSectionOrder,
|
|
243
250
|
validatePanes: () => validatePanes,
|
|
244
251
|
verticalGapValue: () => verticalGapValue,
|
|
245
|
-
visibleCustomFields: () => visibleCustomFields
|
|
252
|
+
visibleCustomFields: () => visibleCustomFields,
|
|
253
|
+
whopAccentSwatch: () => whopAccentSwatch,
|
|
254
|
+
whopCardElement: () => whopCardElement
|
|
246
255
|
});
|
|
247
256
|
module.exports = __toCommonJS(index_exports);
|
|
248
257
|
|
|
@@ -8774,6 +8783,133 @@ var GOOGLE_PAY_BUTTON_TYPES = [
|
|
|
8774
8783
|
"subscribe",
|
|
8775
8784
|
"donate"
|
|
8776
8785
|
];
|
|
8786
|
+
var WHOP_CARD_PRESETS = ["accordion", "tiles", "card_stacked", "card_compact"];
|
|
8787
|
+
function whopCardElement(preset) {
|
|
8788
|
+
switch (preset) {
|
|
8789
|
+
case "tiles":
|
|
8790
|
+
return { element: "payment", layout: "horizontal" };
|
|
8791
|
+
case "card_stacked":
|
|
8792
|
+
return { element: "card", layout: "stacked" };
|
|
8793
|
+
case "card_compact":
|
|
8794
|
+
return { element: "card", layout: "compact" };
|
|
8795
|
+
default:
|
|
8796
|
+
return { element: "payment", layout: "accordion" };
|
|
8797
|
+
}
|
|
8798
|
+
}
|
|
8799
|
+
var WHOP_ACCENT_COLORS = [
|
|
8800
|
+
"auto",
|
|
8801
|
+
"gray",
|
|
8802
|
+
"blue",
|
|
8803
|
+
"indigo",
|
|
8804
|
+
"iris",
|
|
8805
|
+
"violet",
|
|
8806
|
+
"purple",
|
|
8807
|
+
"plum",
|
|
8808
|
+
"pink",
|
|
8809
|
+
"crimson",
|
|
8810
|
+
"ruby",
|
|
8811
|
+
"red",
|
|
8812
|
+
"tomato",
|
|
8813
|
+
"orange",
|
|
8814
|
+
"amber",
|
|
8815
|
+
"yellow",
|
|
8816
|
+
"lime",
|
|
8817
|
+
"grass",
|
|
8818
|
+
"green",
|
|
8819
|
+
"jade",
|
|
8820
|
+
"teal",
|
|
8821
|
+
"cyan",
|
|
8822
|
+
"sky",
|
|
8823
|
+
"mint",
|
|
8824
|
+
"brown",
|
|
8825
|
+
"bronze",
|
|
8826
|
+
"gold"
|
|
8827
|
+
];
|
|
8828
|
+
var WHOP_ACCENT_SWATCHES = {
|
|
8829
|
+
blue: "#0090ff",
|
|
8830
|
+
indigo: "#3e63dd",
|
|
8831
|
+
iris: "#5b5bd6",
|
|
8832
|
+
violet: "#6e56cf",
|
|
8833
|
+
purple: "#8e4ec6",
|
|
8834
|
+
plum: "#ab4aba",
|
|
8835
|
+
pink: "#d6409f",
|
|
8836
|
+
crimson: "#e93d82",
|
|
8837
|
+
ruby: "#e54666",
|
|
8838
|
+
red: "#e5484d",
|
|
8839
|
+
tomato: "#e54d2e",
|
|
8840
|
+
orange: "#f76b15",
|
|
8841
|
+
amber: "#ffc53d",
|
|
8842
|
+
yellow: "#ffe629",
|
|
8843
|
+
lime: "#bdee63",
|
|
8844
|
+
grass: "#46a758",
|
|
8845
|
+
green: "#30a46c",
|
|
8846
|
+
jade: "#29a383",
|
|
8847
|
+
teal: "#12a594",
|
|
8848
|
+
cyan: "#00a2c7",
|
|
8849
|
+
sky: "#7ce2fe",
|
|
8850
|
+
mint: "#86ead4",
|
|
8851
|
+
brown: "#ad7f58",
|
|
8852
|
+
bronze: "#a18072",
|
|
8853
|
+
gold: "#978365"
|
|
8854
|
+
};
|
|
8855
|
+
function whopAccentSwatch(accent) {
|
|
8856
|
+
return accent === "gray" ? "#8d8d8d" : WHOP_ACCENT_SWATCHES[accent];
|
|
8857
|
+
}
|
|
8858
|
+
function hexRgb(hex) {
|
|
8859
|
+
const raw = hex.trim().replace(/^#/, "");
|
|
8860
|
+
const full = raw.length === 3 ? raw.replace(/./g, (c) => c + c) : raw;
|
|
8861
|
+
if (!/^[0-9a-f]{6}$/i.test(full)) return null;
|
|
8862
|
+
const n = Number.parseInt(full, 16);
|
|
8863
|
+
return [n >> 16 & 255, n >> 8 & 255, n & 255];
|
|
8864
|
+
}
|
|
8865
|
+
function oklab([r, g, b]) {
|
|
8866
|
+
const lin = (c) => {
|
|
8867
|
+
const v = c / 255;
|
|
8868
|
+
return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
|
|
8869
|
+
};
|
|
8870
|
+
const [lr, lg, lb] = [lin(r), lin(g), lin(b)];
|
|
8871
|
+
const l = Math.cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb);
|
|
8872
|
+
const m = Math.cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb);
|
|
8873
|
+
const s2 = Math.cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb);
|
|
8874
|
+
return [
|
|
8875
|
+
0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s2,
|
|
8876
|
+
1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s2,
|
|
8877
|
+
0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s2
|
|
8878
|
+
];
|
|
8879
|
+
}
|
|
8880
|
+
function nearestWhopAccent(hex) {
|
|
8881
|
+
const rgb = hexRgb(hex);
|
|
8882
|
+
if (!rgb) return "blue";
|
|
8883
|
+
const [L, a, b] = oklab(rgb);
|
|
8884
|
+
if (Math.hypot(a, b) < 0.04) return "gray";
|
|
8885
|
+
let best = "blue";
|
|
8886
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
8887
|
+
for (const [name, swatch] of Object.entries(WHOP_ACCENT_SWATCHES)) {
|
|
8888
|
+
const swatchRgb = hexRgb(swatch);
|
|
8889
|
+
if (!swatchRgb) continue;
|
|
8890
|
+
const [sL, sa, sb] = oklab(swatchRgb);
|
|
8891
|
+
const distance = Math.hypot((L - sL) * 0.5, a - sa, b - sb);
|
|
8892
|
+
if (distance < bestDistance) {
|
|
8893
|
+
bestDistance = distance;
|
|
8894
|
+
best = name;
|
|
8895
|
+
}
|
|
8896
|
+
}
|
|
8897
|
+
return best;
|
|
8898
|
+
}
|
|
8899
|
+
function resolveWhopAccent(accent, primaryHex) {
|
|
8900
|
+
return accent === "auto" ? nearestWhopAccent(primaryHex) : accent;
|
|
8901
|
+
}
|
|
8902
|
+
var WHOP_EMAIL_LABELS = ["above", "floating"];
|
|
8903
|
+
var WHOP_GRAY_COLORS = [
|
|
8904
|
+
"auto",
|
|
8905
|
+
"gray",
|
|
8906
|
+
"mauve",
|
|
8907
|
+
"slate",
|
|
8908
|
+
"sage",
|
|
8909
|
+
"olive",
|
|
8910
|
+
"sand"
|
|
8911
|
+
];
|
|
8912
|
+
var WHOP_BILLING_DETAILS = ["minimal", "full"];
|
|
8777
8913
|
|
|
8778
8914
|
// src/branding.ts
|
|
8779
8915
|
function surchargeShowsLabel(labelMode, style, position) {
|
|
@@ -9527,6 +9663,16 @@ var DEFAULT_BRANDING_BASE = {
|
|
|
9527
9663
|
micropaymentFieldFontSize: "md",
|
|
9528
9664
|
micropaymentFieldWeight: "regular",
|
|
9529
9665
|
micropaymentFocusRing: "strong",
|
|
9666
|
+
whopCardPreset: "accordion",
|
|
9667
|
+
whopAccentColor: "auto",
|
|
9668
|
+
whopGrayColor: "auto",
|
|
9669
|
+
whopBillingDetails: "minimal",
|
|
9670
|
+
whopSeparated: false,
|
|
9671
|
+
whopEmailLabel: "above",
|
|
9672
|
+
whopFieldChrome: "outlined",
|
|
9673
|
+
whopFieldFontSize: "md",
|
|
9674
|
+
whopFieldWeight: "regular",
|
|
9675
|
+
whopFocusRing: "strong",
|
|
9530
9676
|
customCss: ""
|
|
9531
9677
|
};
|
|
9532
9678
|
var DEFAULT_BRANDING = {
|
|
@@ -10469,6 +10615,52 @@ function decodeBranding(source) {
|
|
|
10469
10615
|
CARD_FOCUS_RINGS,
|
|
10470
10616
|
DEFAULT_BRANDING.micropaymentFocusRing
|
|
10471
10617
|
),
|
|
10618
|
+
whopCardPreset: pickEnum(
|
|
10619
|
+
extras["whopCardPreset"],
|
|
10620
|
+
WHOP_CARD_PRESETS,
|
|
10621
|
+
DEFAULT_BRANDING.whopCardPreset
|
|
10622
|
+
),
|
|
10623
|
+
whopAccentColor: pickEnum(
|
|
10624
|
+
extras["whopAccentColor"],
|
|
10625
|
+
WHOP_ACCENT_COLORS,
|
|
10626
|
+
DEFAULT_BRANDING.whopAccentColor
|
|
10627
|
+
),
|
|
10628
|
+
whopGrayColor: pickEnum(
|
|
10629
|
+
extras["whopGrayColor"],
|
|
10630
|
+
WHOP_GRAY_COLORS,
|
|
10631
|
+
DEFAULT_BRANDING.whopGrayColor
|
|
10632
|
+
),
|
|
10633
|
+
whopBillingDetails: pickEnum(
|
|
10634
|
+
extras["whopBillingDetails"],
|
|
10635
|
+
WHOP_BILLING_DETAILS,
|
|
10636
|
+
DEFAULT_BRANDING.whopBillingDetails
|
|
10637
|
+
),
|
|
10638
|
+
whopSeparated: parseBool(extras["whopSeparated"], DEFAULT_BRANDING.whopSeparated),
|
|
10639
|
+
whopEmailLabel: pickEnum(
|
|
10640
|
+
extras["whopEmailLabel"],
|
|
10641
|
+
WHOP_EMAIL_LABELS,
|
|
10642
|
+
DEFAULT_BRANDING.whopEmailLabel
|
|
10643
|
+
),
|
|
10644
|
+
whopFieldChrome: pickEnum(
|
|
10645
|
+
extras["whopFieldChrome"],
|
|
10646
|
+
CARD_FIELD_CHROMES,
|
|
10647
|
+
DEFAULT_BRANDING.whopFieldChrome
|
|
10648
|
+
),
|
|
10649
|
+
whopFieldFontSize: pickEnum(
|
|
10650
|
+
extras["whopFieldFontSize"],
|
|
10651
|
+
CARD_FIELD_FONT_SIZES,
|
|
10652
|
+
DEFAULT_BRANDING.whopFieldFontSize
|
|
10653
|
+
),
|
|
10654
|
+
whopFieldWeight: pickEnum(
|
|
10655
|
+
extras["whopFieldWeight"],
|
|
10656
|
+
CARD_FIELD_WEIGHTS,
|
|
10657
|
+
DEFAULT_BRANDING.whopFieldWeight
|
|
10658
|
+
),
|
|
10659
|
+
whopFocusRing: pickEnum(
|
|
10660
|
+
extras["whopFocusRing"],
|
|
10661
|
+
CARD_FOCUS_RINGS,
|
|
10662
|
+
DEFAULT_BRANDING.whopFocusRing
|
|
10663
|
+
),
|
|
10472
10664
|
paypalValidTint: parseBool(extras["paypalValidTint"], DEFAULT_BRANDING.paypalValidTint),
|
|
10473
10665
|
nomupayFormStyle: pickEnum(
|
|
10474
10666
|
extras["nomupayFormStyle"],
|
|
@@ -10616,6 +10808,16 @@ function encodeBranding(branding, base) {
|
|
|
10616
10808
|
micropaymentFieldFontSize: branding.micropaymentFieldFontSize,
|
|
10617
10809
|
micropaymentFieldWeight: branding.micropaymentFieldWeight,
|
|
10618
10810
|
micropaymentFocusRing: branding.micropaymentFocusRing,
|
|
10811
|
+
whopCardPreset: branding.whopCardPreset,
|
|
10812
|
+
whopAccentColor: branding.whopAccentColor,
|
|
10813
|
+
whopGrayColor: branding.whopGrayColor,
|
|
10814
|
+
whopBillingDetails: branding.whopBillingDetails,
|
|
10815
|
+
whopSeparated: String(branding.whopSeparated),
|
|
10816
|
+
whopEmailLabel: branding.whopEmailLabel,
|
|
10817
|
+
whopFieldChrome: branding.whopFieldChrome,
|
|
10818
|
+
whopFieldFontSize: branding.whopFieldFontSize,
|
|
10819
|
+
whopFieldWeight: branding.whopFieldWeight,
|
|
10820
|
+
whopFocusRing: branding.whopFocusRing,
|
|
10619
10821
|
paypalValidTint: String(branding.paypalValidTint),
|
|
10620
10822
|
nomupayFormStyle: branding.nomupayFormStyle,
|
|
10621
10823
|
nomupayShowLabels: String(branding.nomupayShowLabels),
|
|
@@ -11023,6 +11225,52 @@ function parseImportedBranding(raw) {
|
|
|
11023
11225
|
CARD_FOCUS_RINGS,
|
|
11024
11226
|
dflt.micropaymentFocusRing
|
|
11025
11227
|
),
|
|
11228
|
+
whopCardPreset: pickEnum(
|
|
11229
|
+
root["whopCardPreset"],
|
|
11230
|
+
WHOP_CARD_PRESETS,
|
|
11231
|
+
dflt.whopCardPreset
|
|
11232
|
+
),
|
|
11233
|
+
whopAccentColor: pickEnum(
|
|
11234
|
+
root["whopAccentColor"],
|
|
11235
|
+
WHOP_ACCENT_COLORS,
|
|
11236
|
+
dflt.whopAccentColor
|
|
11237
|
+
),
|
|
11238
|
+
whopGrayColor: pickEnum(
|
|
11239
|
+
root["whopGrayColor"],
|
|
11240
|
+
WHOP_GRAY_COLORS,
|
|
11241
|
+
dflt.whopGrayColor
|
|
11242
|
+
),
|
|
11243
|
+
whopBillingDetails: pickEnum(
|
|
11244
|
+
root["whopBillingDetails"],
|
|
11245
|
+
WHOP_BILLING_DETAILS,
|
|
11246
|
+
dflt.whopBillingDetails
|
|
11247
|
+
),
|
|
11248
|
+
whopSeparated: parseBool(root["whopSeparated"], dflt.whopSeparated),
|
|
11249
|
+
whopEmailLabel: pickEnum(
|
|
11250
|
+
root["whopEmailLabel"],
|
|
11251
|
+
WHOP_EMAIL_LABELS,
|
|
11252
|
+
dflt.whopEmailLabel
|
|
11253
|
+
),
|
|
11254
|
+
whopFieldChrome: pickEnum(
|
|
11255
|
+
root["whopFieldChrome"],
|
|
11256
|
+
CARD_FIELD_CHROMES,
|
|
11257
|
+
dflt.whopFieldChrome
|
|
11258
|
+
),
|
|
11259
|
+
whopFieldFontSize: pickEnum(
|
|
11260
|
+
root["whopFieldFontSize"],
|
|
11261
|
+
CARD_FIELD_FONT_SIZES,
|
|
11262
|
+
dflt.whopFieldFontSize
|
|
11263
|
+
),
|
|
11264
|
+
whopFieldWeight: pickEnum(
|
|
11265
|
+
root["whopFieldWeight"],
|
|
11266
|
+
CARD_FIELD_WEIGHTS,
|
|
11267
|
+
dflt.whopFieldWeight
|
|
11268
|
+
),
|
|
11269
|
+
whopFocusRing: pickEnum(
|
|
11270
|
+
root["whopFocusRing"],
|
|
11271
|
+
CARD_FOCUS_RINGS,
|
|
11272
|
+
dflt.whopFocusRing
|
|
11273
|
+
),
|
|
11026
11274
|
paypalValidTint: parseBool(root["paypalValidTint"], dflt.paypalValidTint),
|
|
11027
11275
|
nomupayFormStyle: pickEnum(
|
|
11028
11276
|
root["nomupayFormStyle"],
|
|
@@ -12311,6 +12559,11 @@ var encodeNativePanes = encodePanes;
|
|
|
12311
12559
|
UNKNOWN_SECTION_ORDER,
|
|
12312
12560
|
WCAG_AA_TEXT,
|
|
12313
12561
|
WCAG_AA_UI,
|
|
12562
|
+
WHOP_ACCENT_COLORS,
|
|
12563
|
+
WHOP_BILLING_DETAILS,
|
|
12564
|
+
WHOP_CARD_PRESETS,
|
|
12565
|
+
WHOP_EMAIL_LABELS,
|
|
12566
|
+
WHOP_GRAY_COLORS,
|
|
12314
12567
|
Webhooks,
|
|
12315
12568
|
WhopResolutionCases,
|
|
12316
12569
|
airwallexCardLayout,
|
|
@@ -12384,6 +12637,7 @@ var encodeNativePanes = encodePanes;
|
|
|
12384
12637
|
leaf,
|
|
12385
12638
|
logoDimensions,
|
|
12386
12639
|
nativePaneMethodInfo,
|
|
12640
|
+
nearestWhopAccent,
|
|
12387
12641
|
noticeText,
|
|
12388
12642
|
noticesIn,
|
|
12389
12643
|
offerablePaneMethods,
|
|
@@ -12404,6 +12658,7 @@ var encodeNativePanes = encodePanes;
|
|
|
12404
12658
|
resolveGooglePayButtonColor,
|
|
12405
12659
|
resolveNoticesAndBadges,
|
|
12406
12660
|
resolveStripeTheme,
|
|
12661
|
+
resolveWhopAccent,
|
|
12407
12662
|
ruleMatchToTree,
|
|
12408
12663
|
sanitizeCustomCss,
|
|
12409
12664
|
sectionLabel,
|
|
@@ -12419,6 +12674,8 @@ var encodeNativePanes = encodePanes;
|
|
|
12419
12674
|
validSectionOrder,
|
|
12420
12675
|
validatePanes,
|
|
12421
12676
|
verticalGapValue,
|
|
12422
|
-
visibleCustomFields
|
|
12677
|
+
visibleCustomFields,
|
|
12678
|
+
whopAccentSwatch,
|
|
12679
|
+
whopCardElement
|
|
12423
12680
|
});
|
|
12424
12681
|
//# sourceMappingURL=index.cjs.map
|