@delopay/sdk 0.232.0 → 0.234.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
@@ -155,6 +155,11 @@ __export(internal_exports, {
155
155
  WHOP_CARD_PRESETS: () => WHOP_CARD_PRESETS,
156
156
  WHOP_EMAIL_LABELS: () => WHOP_EMAIL_LABELS,
157
157
  WHOP_GRAY_COLORS: () => WHOP_GRAY_COLORS,
158
+ WHOP_LOOKS: () => WHOP_LOOKS,
159
+ WHOP_LOOK_SETTINGS: () => WHOP_LOOK_SETTINGS,
160
+ WHOP_RADII: () => WHOP_RADII,
161
+ WHOP_SELECTIONS: () => WHOP_SELECTIONS,
162
+ WHOP_SHADOWS: () => WHOP_SHADOWS,
158
163
  Webhooks: () => Webhooks,
159
164
  WhopResolutionCases: () => WhopResolutionCases,
160
165
  airwallexCardLayout: () => airwallexCardLayout,
@@ -227,6 +232,7 @@ __export(internal_exports, {
227
232
  knownSectionLabelKey: () => knownSectionLabelKey,
228
233
  leaf: () => leaf,
229
234
  logoDimensions: () => logoDimensions,
235
+ matchWhopLook: () => matchWhopLook,
230
236
  nativePaneMethodInfo: () => nativePaneMethodInfo,
231
237
  nearestWhopAccent: () => nearestWhopAccent,
232
238
  noticeText: () => noticeText,
@@ -8941,6 +8947,114 @@ var WHOP_GRAY_COLORS = [
8941
8947
  "sand"
8942
8948
  ];
8943
8949
  var WHOP_BILLING_DETAILS = ["minimal", "full"];
8950
+ var WHOP_RADII = ["checkout", "square", "small", "medium", "large"];
8951
+ var WHOP_SHADOWS = ["none", "soft"];
8952
+ var WHOP_SELECTIONS = ["radio_tint", "radio", "tint"];
8953
+ var WHOP_LOOKS = [
8954
+ "standard",
8955
+ "clean",
8956
+ "whop",
8957
+ "cards",
8958
+ "tiles",
8959
+ "soft",
8960
+ "minimal"
8961
+ ];
8962
+ var WHOP_LOOK_SETTINGS = {
8963
+ // The fewest fields Whop takes a card with, laid out as Stripe's card
8964
+ // form: the email, the number above expiry and code, then one group of
8965
+ // name, country (preselected) and postal code. Whop refuses a card without
8966
+ // any of them. The wallets are the shop's own express buttons.
8967
+ standard: {
8968
+ whopCardPreset: "card_stacked",
8969
+ whopBillingDetails: "minimal",
8970
+ whopSeparated: false,
8971
+ whopFieldChrome: "outlined",
8972
+ whopEmailLabel: "above",
8973
+ whopRadius: "checkout",
8974
+ whopShadow: "soft",
8975
+ whopMethodIcons: true,
8976
+ whopSelection: "radio_tint"
8977
+ },
8978
+ // Flat fields like the checkout's own, the method list with the chosen
8979
+ // method tinted beside its radio.
8980
+ clean: {
8981
+ whopCardPreset: "accordion",
8982
+ whopBillingDetails: "minimal",
8983
+ whopSeparated: false,
8984
+ whopFieldChrome: "outlined",
8985
+ whopEmailLabel: "above",
8986
+ whopRadius: "checkout",
8987
+ whopShadow: "none",
8988
+ whopMethodIcons: true,
8989
+ whopSelection: "radio_tint"
8990
+ },
8991
+ // Whop's own form: its corners, its soft shadow, its radio dots.
8992
+ whop: {
8993
+ whopCardPreset: "accordion",
8994
+ whopBillingDetails: "minimal",
8995
+ whopSeparated: false,
8996
+ whopFieldChrome: "outlined",
8997
+ whopEmailLabel: "above",
8998
+ whopRadius: "small",
8999
+ whopShadow: "soft",
9000
+ whopMethodIcons: true,
9001
+ whopSelection: "radio"
9002
+ },
9003
+ // Each method its own raised card, the chosen one tinted, no dots.
9004
+ cards: {
9005
+ whopCardPreset: "accordion",
9006
+ whopBillingDetails: "minimal",
9007
+ whopSeparated: true,
9008
+ whopFieldChrome: "outlined",
9009
+ whopEmailLabel: "above",
9010
+ whopRadius: "medium",
9011
+ whopShadow: "soft",
9012
+ whopMethodIcons: true,
9013
+ whopSelection: "tint"
9014
+ },
9015
+ // The methods as tiles above the card's fields.
9016
+ tiles: {
9017
+ whopCardPreset: "tiles",
9018
+ whopBillingDetails: "minimal",
9019
+ whopSeparated: false,
9020
+ whopFieldChrome: "outlined",
9021
+ whopEmailLabel: "above",
9022
+ whopRadius: "checkout",
9023
+ whopShadow: "none",
9024
+ whopMethodIcons: true,
9025
+ whopSelection: "radio_tint"
9026
+ },
9027
+ // Filled fields with the captions inside, round corners.
9028
+ soft: {
9029
+ whopCardPreset: "accordion",
9030
+ whopBillingDetails: "minimal",
9031
+ whopSeparated: false,
9032
+ whopFieldChrome: "filled",
9033
+ whopEmailLabel: "floating",
9034
+ whopRadius: "large",
9035
+ whopShadow: "none",
9036
+ whopMethodIcons: false,
9037
+ whopSelection: "radio_tint"
9038
+ },
9039
+ // The card alone on one line, underlined, captions inside.
9040
+ minimal: {
9041
+ whopCardPreset: "card_compact",
9042
+ whopBillingDetails: "minimal",
9043
+ whopSeparated: false,
9044
+ whopFieldChrome: "underline",
9045
+ whopEmailLabel: "floating",
9046
+ whopRadius: "square",
9047
+ whopShadow: "none",
9048
+ whopMethodIcons: true,
9049
+ whopSelection: "radio_tint"
9050
+ }
9051
+ };
9052
+ function matchWhopLook(settings) {
9053
+ const keys = Object.keys(WHOP_LOOK_SETTINGS.clean);
9054
+ return WHOP_LOOKS.find(
9055
+ (look) => keys.every((key) => WHOP_LOOK_SETTINGS[look][key] === settings[key])
9056
+ ) ?? null;
9057
+ }
8944
9058
 
8945
9059
  // src/branding.ts
8946
9060
  function surchargeShowsLabel(labelMode, style, position) {
@@ -9707,7 +9821,7 @@ var DEFAULT_BRANDING_BASE = {
9707
9821
  micropaymentFieldFontSize: "md",
9708
9822
  micropaymentFieldWeight: "regular",
9709
9823
  micropaymentFocusRing: "strong",
9710
- whopCardPreset: "accordion",
9824
+ whopCardPreset: "card_stacked",
9711
9825
  whopAccentColor: "auto",
9712
9826
  whopGrayColor: "auto",
9713
9827
  whopBillingDetails: "minimal",
@@ -9717,6 +9831,10 @@ var DEFAULT_BRANDING_BASE = {
9717
9831
  whopFieldFontSize: "md",
9718
9832
  whopFieldWeight: "regular",
9719
9833
  whopFocusRing: "strong",
9834
+ whopRadius: "checkout",
9835
+ whopShadow: "soft",
9836
+ whopMethodIcons: true,
9837
+ whopSelection: "radio_tint",
9720
9838
  customCss: ""
9721
9839
  };
9722
9840
  var DEFAULT_BRANDING = {
@@ -10705,6 +10823,18 @@ function decodeBranding(source) {
10705
10823
  CARD_FOCUS_RINGS,
10706
10824
  DEFAULT_BRANDING.whopFocusRing
10707
10825
  ),
10826
+ whopRadius: pickEnum(extras["whopRadius"], WHOP_RADII, DEFAULT_BRANDING.whopRadius),
10827
+ whopShadow: pickEnum(
10828
+ extras["whopShadow"],
10829
+ WHOP_SHADOWS,
10830
+ DEFAULT_BRANDING.whopShadow
10831
+ ),
10832
+ whopMethodIcons: parseBool(extras["whopMethodIcons"], DEFAULT_BRANDING.whopMethodIcons),
10833
+ whopSelection: pickEnum(
10834
+ extras["whopSelection"],
10835
+ WHOP_SELECTIONS,
10836
+ DEFAULT_BRANDING.whopSelection
10837
+ ),
10708
10838
  paypalValidTint: parseBool(extras["paypalValidTint"], DEFAULT_BRANDING.paypalValidTint),
10709
10839
  nomupayFormStyle: pickEnum(
10710
10840
  extras["nomupayFormStyle"],
@@ -10862,6 +10992,10 @@ function encodeBranding(branding, base) {
10862
10992
  whopFieldFontSize: branding.whopFieldFontSize,
10863
10993
  whopFieldWeight: branding.whopFieldWeight,
10864
10994
  whopFocusRing: branding.whopFocusRing,
10995
+ whopRadius: branding.whopRadius,
10996
+ whopShadow: branding.whopShadow,
10997
+ whopMethodIcons: String(branding.whopMethodIcons),
10998
+ whopSelection: branding.whopSelection,
10865
10999
  paypalValidTint: String(branding.paypalValidTint),
10866
11000
  nomupayFormStyle: branding.nomupayFormStyle,
10867
11001
  nomupayShowLabels: String(branding.nomupayShowLabels),
@@ -11315,6 +11449,14 @@ function parseImportedBranding(raw) {
11315
11449
  CARD_FOCUS_RINGS,
11316
11450
  dflt.whopFocusRing
11317
11451
  ),
11452
+ whopRadius: pickEnum(root["whopRadius"], WHOP_RADII, dflt.whopRadius),
11453
+ whopShadow: pickEnum(root["whopShadow"], WHOP_SHADOWS, dflt.whopShadow),
11454
+ whopMethodIcons: parseBool(root["whopMethodIcons"], dflt.whopMethodIcons),
11455
+ whopSelection: pickEnum(
11456
+ root["whopSelection"],
11457
+ WHOP_SELECTIONS,
11458
+ dflt.whopSelection
11459
+ ),
11318
11460
  paypalValidTint: parseBool(root["paypalValidTint"], dflt.paypalValidTint),
11319
11461
  nomupayFormStyle: pickEnum(
11320
11462
  root["nomupayFormStyle"],
@@ -14202,6 +14344,11 @@ var DelopayInternal = class extends Delopay {
14202
14344
  WHOP_CARD_PRESETS,
14203
14345
  WHOP_EMAIL_LABELS,
14204
14346
  WHOP_GRAY_COLORS,
14347
+ WHOP_LOOKS,
14348
+ WHOP_LOOK_SETTINGS,
14349
+ WHOP_RADII,
14350
+ WHOP_SELECTIONS,
14351
+ WHOP_SHADOWS,
14205
14352
  Webhooks,
14206
14353
  WhopResolutionCases,
14207
14354
  airwallexCardLayout,
@@ -14274,6 +14421,7 @@ var DelopayInternal = class extends Delopay {
14274
14421
  knownSectionLabelKey,
14275
14422
  leaf,
14276
14423
  logoDimensions,
14424
+ matchWhopLook,
14277
14425
  nativePaneMethodInfo,
14278
14426
  nearestWhopAccent,
14279
14427
  noticeText,