@delopay/sdk 0.232.0 → 0.235.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-3I5BQEA4.js → chunk-FRH5BWGL.js} +194 -18
- package/dist/{chunk-3I5BQEA4.js.map → chunk-FRH5BWGL.js.map} +1 -1
- package/dist/index.cjs +199 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +103 -5
- package/dist/index.d.ts +103 -5
- package/dist/index.js +13 -1
- package/dist/internal.cjs +199 -17
- 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 +13 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
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: "
|
|
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"],
|
|
@@ -11443,6 +11585,21 @@ function withoutCredentialHeaders(extra) {
|
|
|
11443
11585
|
}
|
|
11444
11586
|
return out;
|
|
11445
11587
|
}
|
|
11588
|
+
function vaultFormQuery(params) {
|
|
11589
|
+
const look = params?.appearance;
|
|
11590
|
+
return {
|
|
11591
|
+
locale: params?.locale,
|
|
11592
|
+
form_surface: look?.surface,
|
|
11593
|
+
form_text: look?.text,
|
|
11594
|
+
form_border: look?.border,
|
|
11595
|
+
form_accent: look?.accent,
|
|
11596
|
+
form_danger: look?.danger,
|
|
11597
|
+
form_font: look?.font,
|
|
11598
|
+
form_radius: look?.radius,
|
|
11599
|
+
form_size: look?.size,
|
|
11600
|
+
form_labels: look?.labels
|
|
11601
|
+
};
|
|
11602
|
+
}
|
|
11446
11603
|
function withoutHeader(headers, name) {
|
|
11447
11604
|
const out = {};
|
|
11448
11605
|
for (const [key, value] of Object.entries(headers)) {
|
|
@@ -11862,21 +12019,31 @@ var CheckoutSession = class {
|
|
|
11862
12019
|
* `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`
|
|
11863
12020
|
*/
|
|
11864
12021
|
async vaultCollectSession(options, params) {
|
|
11865
|
-
const look = params?.appearance;
|
|
11866
12022
|
return this.client.request("GET", `${this.linkBase}/vault/collect-session`, {
|
|
11867
12023
|
...options,
|
|
11868
|
-
query:
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
12024
|
+
query: vaultFormQuery(params),
|
|
12025
|
+
headers: this.bearerHeaders(options?.headers)
|
|
12026
|
+
});
|
|
12027
|
+
}
|
|
12028
|
+
/**
|
|
12029
|
+
* The saved cards the buyer of this payment can pay with, on a shop whose
|
|
12030
|
+
* vault keeps the security code itself (Enigma Vault): the cards of the
|
|
12031
|
+
* payment's own customer that the shop's vault holds, most recently used
|
|
12032
|
+
* first. A payment without a customer answers an empty list.
|
|
12033
|
+
*
|
|
12034
|
+
* Draw saved cards from this list, not from the customer's payment-method
|
|
12035
|
+
* list: that one also carries cards the security-code form cannot open.
|
|
12036
|
+
* To pay with one, mint its form with {@link vaultSecurityCodeSession},
|
|
12037
|
+
* and confirm with its `payment_token` once the form reports the code
|
|
12038
|
+
* stored.
|
|
12039
|
+
*
|
|
12040
|
+
* A shop without a vault, and a VGS shop, answer `400`.
|
|
12041
|
+
*
|
|
12042
|
+
* `GET /payment-link/{merchantId}/{paymentId}/vault/saved-cards`
|
|
12043
|
+
*/
|
|
12044
|
+
async vaultSavedCards(options) {
|
|
12045
|
+
return this.client.request("GET", `${this.linkBase}/vault/saved-cards`, {
|
|
12046
|
+
...options,
|
|
11880
12047
|
headers: this.bearerHeaders(options?.headers)
|
|
11881
12048
|
});
|
|
11882
12049
|
}
|
|
@@ -11886,15 +12053,24 @@ var CheckoutSession = class {
|
|
|
11886
12053
|
* vault's own form, so it never reaches the checkout; confirm with the saved
|
|
11887
12054
|
* card's `payment_token` once the form reports it stored.
|
|
11888
12055
|
*
|
|
11889
|
-
* `paymentToken` is the saved card's token from
|
|
12056
|
+
* `paymentToken` is the saved card's token from {@link vaultSavedCards}. A
|
|
11890
12057
|
* VGS shop answers `400`: VGS re-collects the code with Collect.
|
|
11891
12058
|
*
|
|
12059
|
+
* `params.appearance` asks for a form styled to match the page, as on
|
|
12060
|
+
* {@link vaultCollectSession}. The styled form is the security-code field
|
|
12061
|
+
* alone, with no label: draw the label beside the frame, and size the frame
|
|
12062
|
+
* to the answer's `height`. `labels` is ignored. If the vault refuses the
|
|
12063
|
+
* styled form the answer is the plain one, without `height`.
|
|
12064
|
+
*
|
|
12065
|
+
* The form stores one code and then disables itself. After a failed
|
|
12066
|
+
* payment, mint a new form before the buyer tries again.
|
|
12067
|
+
*
|
|
11892
12068
|
* `GET /payment-link/{merchantId}/{paymentId}/vault/security-code-session`
|
|
11893
12069
|
*/
|
|
11894
|
-
async vaultSecurityCodeSession(paymentToken, options) {
|
|
12070
|
+
async vaultSecurityCodeSession(paymentToken, options, params) {
|
|
11895
12071
|
return this.client.request("GET", `${this.linkBase}/vault/security-code-session`, {
|
|
11896
12072
|
...options,
|
|
11897
|
-
query: { payment_token: paymentToken },
|
|
12073
|
+
query: { payment_token: paymentToken, ...vaultFormQuery(params) },
|
|
11898
12074
|
headers: this.bearerHeaders(options?.headers)
|
|
11899
12075
|
});
|
|
11900
12076
|
}
|
|
@@ -14202,6 +14378,11 @@ var DelopayInternal = class extends Delopay {
|
|
|
14202
14378
|
WHOP_CARD_PRESETS,
|
|
14203
14379
|
WHOP_EMAIL_LABELS,
|
|
14204
14380
|
WHOP_GRAY_COLORS,
|
|
14381
|
+
WHOP_LOOKS,
|
|
14382
|
+
WHOP_LOOK_SETTINGS,
|
|
14383
|
+
WHOP_RADII,
|
|
14384
|
+
WHOP_SELECTIONS,
|
|
14385
|
+
WHOP_SHADOWS,
|
|
14205
14386
|
Webhooks,
|
|
14206
14387
|
WhopResolutionCases,
|
|
14207
14388
|
airwallexCardLayout,
|
|
@@ -14274,6 +14455,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
14274
14455
|
knownSectionLabelKey,
|
|
14275
14456
|
leaf,
|
|
14276
14457
|
logoDimensions,
|
|
14458
|
+
matchWhopLook,
|
|
14277
14459
|
nativePaneMethodInfo,
|
|
14278
14460
|
nearestWhopAccent,
|
|
14279
14461
|
noticeText,
|