@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/index.cjs CHANGED
@@ -139,6 +139,11 @@ __export(index_exports, {
139
139
  WHOP_CARD_PRESETS: () => WHOP_CARD_PRESETS,
140
140
  WHOP_EMAIL_LABELS: () => WHOP_EMAIL_LABELS,
141
141
  WHOP_GRAY_COLORS: () => WHOP_GRAY_COLORS,
142
+ WHOP_LOOKS: () => WHOP_LOOKS,
143
+ WHOP_LOOK_SETTINGS: () => WHOP_LOOK_SETTINGS,
144
+ WHOP_RADII: () => WHOP_RADII,
145
+ WHOP_SELECTIONS: () => WHOP_SELECTIONS,
146
+ WHOP_SHADOWS: () => WHOP_SHADOWS,
142
147
  Webhooks: () => Webhooks,
143
148
  WhopResolutionCases: () => WhopResolutionCases,
144
149
  airwallexCardLayout: () => airwallexCardLayout,
@@ -211,6 +216,7 @@ __export(index_exports, {
211
216
  knownSectionLabelKey: () => knownSectionLabelKey,
212
217
  leaf: () => leaf,
213
218
  logoDimensions: () => logoDimensions,
219
+ matchWhopLook: () => matchWhopLook,
214
220
  nativePaneMethodInfo: () => nativePaneMethodInfo,
215
221
  nearestWhopAccent: () => nearestWhopAccent,
216
222
  noticeText: () => noticeText,
@@ -8925,6 +8931,114 @@ var WHOP_GRAY_COLORS = [
8925
8931
  "sand"
8926
8932
  ];
8927
8933
  var WHOP_BILLING_DETAILS = ["minimal", "full"];
8934
+ var WHOP_RADII = ["checkout", "square", "small", "medium", "large"];
8935
+ var WHOP_SHADOWS = ["none", "soft"];
8936
+ var WHOP_SELECTIONS = ["radio_tint", "radio", "tint"];
8937
+ var WHOP_LOOKS = [
8938
+ "standard",
8939
+ "clean",
8940
+ "whop",
8941
+ "cards",
8942
+ "tiles",
8943
+ "soft",
8944
+ "minimal"
8945
+ ];
8946
+ var WHOP_LOOK_SETTINGS = {
8947
+ // The fewest fields Whop takes a card with, laid out as Stripe's card
8948
+ // form: the email, the number above expiry and code, then one group of
8949
+ // name, country (preselected) and postal code. Whop refuses a card without
8950
+ // any of them. The wallets are the shop's own express buttons.
8951
+ standard: {
8952
+ whopCardPreset: "card_stacked",
8953
+ whopBillingDetails: "minimal",
8954
+ whopSeparated: false,
8955
+ whopFieldChrome: "outlined",
8956
+ whopEmailLabel: "above",
8957
+ whopRadius: "checkout",
8958
+ whopShadow: "soft",
8959
+ whopMethodIcons: true,
8960
+ whopSelection: "radio_tint"
8961
+ },
8962
+ // Flat fields like the checkout's own, the method list with the chosen
8963
+ // method tinted beside its radio.
8964
+ clean: {
8965
+ whopCardPreset: "accordion",
8966
+ whopBillingDetails: "minimal",
8967
+ whopSeparated: false,
8968
+ whopFieldChrome: "outlined",
8969
+ whopEmailLabel: "above",
8970
+ whopRadius: "checkout",
8971
+ whopShadow: "none",
8972
+ whopMethodIcons: true,
8973
+ whopSelection: "radio_tint"
8974
+ },
8975
+ // Whop's own form: its corners, its soft shadow, its radio dots.
8976
+ whop: {
8977
+ whopCardPreset: "accordion",
8978
+ whopBillingDetails: "minimal",
8979
+ whopSeparated: false,
8980
+ whopFieldChrome: "outlined",
8981
+ whopEmailLabel: "above",
8982
+ whopRadius: "small",
8983
+ whopShadow: "soft",
8984
+ whopMethodIcons: true,
8985
+ whopSelection: "radio"
8986
+ },
8987
+ // Each method its own raised card, the chosen one tinted, no dots.
8988
+ cards: {
8989
+ whopCardPreset: "accordion",
8990
+ whopBillingDetails: "minimal",
8991
+ whopSeparated: true,
8992
+ whopFieldChrome: "outlined",
8993
+ whopEmailLabel: "above",
8994
+ whopRadius: "medium",
8995
+ whopShadow: "soft",
8996
+ whopMethodIcons: true,
8997
+ whopSelection: "tint"
8998
+ },
8999
+ // The methods as tiles above the card's fields.
9000
+ tiles: {
9001
+ whopCardPreset: "tiles",
9002
+ whopBillingDetails: "minimal",
9003
+ whopSeparated: false,
9004
+ whopFieldChrome: "outlined",
9005
+ whopEmailLabel: "above",
9006
+ whopRadius: "checkout",
9007
+ whopShadow: "none",
9008
+ whopMethodIcons: true,
9009
+ whopSelection: "radio_tint"
9010
+ },
9011
+ // Filled fields with the captions inside, round corners.
9012
+ soft: {
9013
+ whopCardPreset: "accordion",
9014
+ whopBillingDetails: "minimal",
9015
+ whopSeparated: false,
9016
+ whopFieldChrome: "filled",
9017
+ whopEmailLabel: "floating",
9018
+ whopRadius: "large",
9019
+ whopShadow: "none",
9020
+ whopMethodIcons: false,
9021
+ whopSelection: "radio_tint"
9022
+ },
9023
+ // The card alone on one line, underlined, captions inside.
9024
+ minimal: {
9025
+ whopCardPreset: "card_compact",
9026
+ whopBillingDetails: "minimal",
9027
+ whopSeparated: false,
9028
+ whopFieldChrome: "underline",
9029
+ whopEmailLabel: "floating",
9030
+ whopRadius: "square",
9031
+ whopShadow: "none",
9032
+ whopMethodIcons: true,
9033
+ whopSelection: "radio_tint"
9034
+ }
9035
+ };
9036
+ function matchWhopLook(settings) {
9037
+ const keys = Object.keys(WHOP_LOOK_SETTINGS.clean);
9038
+ return WHOP_LOOKS.find(
9039
+ (look) => keys.every((key) => WHOP_LOOK_SETTINGS[look][key] === settings[key])
9040
+ ) ?? null;
9041
+ }
8928
9042
 
8929
9043
  // src/branding.ts
8930
9044
  function surchargeShowsLabel(labelMode, style, position) {
@@ -9691,7 +9805,7 @@ var DEFAULT_BRANDING_BASE = {
9691
9805
  micropaymentFieldFontSize: "md",
9692
9806
  micropaymentFieldWeight: "regular",
9693
9807
  micropaymentFocusRing: "strong",
9694
- whopCardPreset: "accordion",
9808
+ whopCardPreset: "card_stacked",
9695
9809
  whopAccentColor: "auto",
9696
9810
  whopGrayColor: "auto",
9697
9811
  whopBillingDetails: "minimal",
@@ -9701,6 +9815,10 @@ var DEFAULT_BRANDING_BASE = {
9701
9815
  whopFieldFontSize: "md",
9702
9816
  whopFieldWeight: "regular",
9703
9817
  whopFocusRing: "strong",
9818
+ whopRadius: "checkout",
9819
+ whopShadow: "soft",
9820
+ whopMethodIcons: true,
9821
+ whopSelection: "radio_tint",
9704
9822
  customCss: ""
9705
9823
  };
9706
9824
  var DEFAULT_BRANDING = {
@@ -10689,6 +10807,18 @@ function decodeBranding(source) {
10689
10807
  CARD_FOCUS_RINGS,
10690
10808
  DEFAULT_BRANDING.whopFocusRing
10691
10809
  ),
10810
+ whopRadius: pickEnum(extras["whopRadius"], WHOP_RADII, DEFAULT_BRANDING.whopRadius),
10811
+ whopShadow: pickEnum(
10812
+ extras["whopShadow"],
10813
+ WHOP_SHADOWS,
10814
+ DEFAULT_BRANDING.whopShadow
10815
+ ),
10816
+ whopMethodIcons: parseBool(extras["whopMethodIcons"], DEFAULT_BRANDING.whopMethodIcons),
10817
+ whopSelection: pickEnum(
10818
+ extras["whopSelection"],
10819
+ WHOP_SELECTIONS,
10820
+ DEFAULT_BRANDING.whopSelection
10821
+ ),
10692
10822
  paypalValidTint: parseBool(extras["paypalValidTint"], DEFAULT_BRANDING.paypalValidTint),
10693
10823
  nomupayFormStyle: pickEnum(
10694
10824
  extras["nomupayFormStyle"],
@@ -10846,6 +10976,10 @@ function encodeBranding(branding, base) {
10846
10976
  whopFieldFontSize: branding.whopFieldFontSize,
10847
10977
  whopFieldWeight: branding.whopFieldWeight,
10848
10978
  whopFocusRing: branding.whopFocusRing,
10979
+ whopRadius: branding.whopRadius,
10980
+ whopShadow: branding.whopShadow,
10981
+ whopMethodIcons: String(branding.whopMethodIcons),
10982
+ whopSelection: branding.whopSelection,
10849
10983
  paypalValidTint: String(branding.paypalValidTint),
10850
10984
  nomupayFormStyle: branding.nomupayFormStyle,
10851
10985
  nomupayShowLabels: String(branding.nomupayShowLabels),
@@ -11299,6 +11433,14 @@ function parseImportedBranding(raw) {
11299
11433
  CARD_FOCUS_RINGS,
11300
11434
  dflt.whopFocusRing
11301
11435
  ),
11436
+ whopRadius: pickEnum(root["whopRadius"], WHOP_RADII, dflt.whopRadius),
11437
+ whopShadow: pickEnum(root["whopShadow"], WHOP_SHADOWS, dflt.whopShadow),
11438
+ whopMethodIcons: parseBool(root["whopMethodIcons"], dflt.whopMethodIcons),
11439
+ whopSelection: pickEnum(
11440
+ root["whopSelection"],
11441
+ WHOP_SELECTIONS,
11442
+ dflt.whopSelection
11443
+ ),
11302
11444
  paypalValidTint: parseBool(root["paypalValidTint"], dflt.paypalValidTint),
11303
11445
  nomupayFormStyle: pickEnum(
11304
11446
  root["nomupayFormStyle"],
@@ -12611,6 +12753,11 @@ var encodeNativePanes = encodePanes;
12611
12753
  WHOP_CARD_PRESETS,
12612
12754
  WHOP_EMAIL_LABELS,
12613
12755
  WHOP_GRAY_COLORS,
12756
+ WHOP_LOOKS,
12757
+ WHOP_LOOK_SETTINGS,
12758
+ WHOP_RADII,
12759
+ WHOP_SELECTIONS,
12760
+ WHOP_SHADOWS,
12614
12761
  Webhooks,
12615
12762
  WhopResolutionCases,
12616
12763
  airwallexCardLayout,
@@ -12683,6 +12830,7 @@ var encodeNativePanes = encodePanes;
12683
12830
  knownSectionLabelKey,
12684
12831
  leaf,
12685
12832
  logoDimensions,
12833
+ matchWhopLook,
12686
12834
  nativePaneMethodInfo,
12687
12835
  nearestWhopAccent,
12688
12836
  noticeText,