@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/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: "
|
|
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"],
|
|
@@ -11427,6 +11569,21 @@ function withoutCredentialHeaders(extra) {
|
|
|
11427
11569
|
}
|
|
11428
11570
|
return out;
|
|
11429
11571
|
}
|
|
11572
|
+
function vaultFormQuery(params) {
|
|
11573
|
+
const look = params?.appearance;
|
|
11574
|
+
return {
|
|
11575
|
+
locale: params?.locale,
|
|
11576
|
+
form_surface: look?.surface,
|
|
11577
|
+
form_text: look?.text,
|
|
11578
|
+
form_border: look?.border,
|
|
11579
|
+
form_accent: look?.accent,
|
|
11580
|
+
form_danger: look?.danger,
|
|
11581
|
+
form_font: look?.font,
|
|
11582
|
+
form_radius: look?.radius,
|
|
11583
|
+
form_size: look?.size,
|
|
11584
|
+
form_labels: look?.labels
|
|
11585
|
+
};
|
|
11586
|
+
}
|
|
11430
11587
|
function withoutHeader(headers, name) {
|
|
11431
11588
|
const out = {};
|
|
11432
11589
|
for (const [key, value] of Object.entries(headers)) {
|
|
@@ -11846,21 +12003,31 @@ var CheckoutSession = class {
|
|
|
11846
12003
|
* `GET /payment-link/{merchantId}/{paymentId}/vault/collect-session`
|
|
11847
12004
|
*/
|
|
11848
12005
|
async vaultCollectSession(options, params) {
|
|
11849
|
-
const look = params?.appearance;
|
|
11850
12006
|
return this.client.request("GET", `${this.linkBase}/vault/collect-session`, {
|
|
11851
12007
|
...options,
|
|
11852
|
-
query:
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
12008
|
+
query: vaultFormQuery(params),
|
|
12009
|
+
headers: this.bearerHeaders(options?.headers)
|
|
12010
|
+
});
|
|
12011
|
+
}
|
|
12012
|
+
/**
|
|
12013
|
+
* The saved cards the buyer of this payment can pay with, on a shop whose
|
|
12014
|
+
* vault keeps the security code itself (Enigma Vault): the cards of the
|
|
12015
|
+
* payment's own customer that the shop's vault holds, most recently used
|
|
12016
|
+
* first. A payment without a customer answers an empty list.
|
|
12017
|
+
*
|
|
12018
|
+
* Draw saved cards from this list, not from the customer's payment-method
|
|
12019
|
+
* list: that one also carries cards the security-code form cannot open.
|
|
12020
|
+
* To pay with one, mint its form with {@link vaultSecurityCodeSession},
|
|
12021
|
+
* and confirm with its `payment_token` once the form reports the code
|
|
12022
|
+
* stored.
|
|
12023
|
+
*
|
|
12024
|
+
* A shop without a vault, and a VGS shop, answer `400`.
|
|
12025
|
+
*
|
|
12026
|
+
* `GET /payment-link/{merchantId}/{paymentId}/vault/saved-cards`
|
|
12027
|
+
*/
|
|
12028
|
+
async vaultSavedCards(options) {
|
|
12029
|
+
return this.client.request("GET", `${this.linkBase}/vault/saved-cards`, {
|
|
12030
|
+
...options,
|
|
11864
12031
|
headers: this.bearerHeaders(options?.headers)
|
|
11865
12032
|
});
|
|
11866
12033
|
}
|
|
@@ -11870,15 +12037,24 @@ var CheckoutSession = class {
|
|
|
11870
12037
|
* vault's own form, so it never reaches the checkout; confirm with the saved
|
|
11871
12038
|
* card's `payment_token` once the form reports it stored.
|
|
11872
12039
|
*
|
|
11873
|
-
* `paymentToken` is the saved card's token from
|
|
12040
|
+
* `paymentToken` is the saved card's token from {@link vaultSavedCards}. A
|
|
11874
12041
|
* VGS shop answers `400`: VGS re-collects the code with Collect.
|
|
11875
12042
|
*
|
|
12043
|
+
* `params.appearance` asks for a form styled to match the page, as on
|
|
12044
|
+
* {@link vaultCollectSession}. The styled form is the security-code field
|
|
12045
|
+
* alone, with no label: draw the label beside the frame, and size the frame
|
|
12046
|
+
* to the answer's `height`. `labels` is ignored. If the vault refuses the
|
|
12047
|
+
* styled form the answer is the plain one, without `height`.
|
|
12048
|
+
*
|
|
12049
|
+
* The form stores one code and then disables itself. After a failed
|
|
12050
|
+
* payment, mint a new form before the buyer tries again.
|
|
12051
|
+
*
|
|
11876
12052
|
* `GET /payment-link/{merchantId}/{paymentId}/vault/security-code-session`
|
|
11877
12053
|
*/
|
|
11878
|
-
async vaultSecurityCodeSession(paymentToken, options) {
|
|
12054
|
+
async vaultSecurityCodeSession(paymentToken, options, params) {
|
|
11879
12055
|
return this.client.request("GET", `${this.linkBase}/vault/security-code-session`, {
|
|
11880
12056
|
...options,
|
|
11881
|
-
query: { payment_token: paymentToken },
|
|
12057
|
+
query: { payment_token: paymentToken, ...vaultFormQuery(params) },
|
|
11882
12058
|
headers: this.bearerHeaders(options?.headers)
|
|
11883
12059
|
});
|
|
11884
12060
|
}
|
|
@@ -12611,6 +12787,11 @@ var encodeNativePanes = encodePanes;
|
|
|
12611
12787
|
WHOP_CARD_PRESETS,
|
|
12612
12788
|
WHOP_EMAIL_LABELS,
|
|
12613
12789
|
WHOP_GRAY_COLORS,
|
|
12790
|
+
WHOP_LOOKS,
|
|
12791
|
+
WHOP_LOOK_SETTINGS,
|
|
12792
|
+
WHOP_RADII,
|
|
12793
|
+
WHOP_SELECTIONS,
|
|
12794
|
+
WHOP_SHADOWS,
|
|
12614
12795
|
Webhooks,
|
|
12615
12796
|
WhopResolutionCases,
|
|
12616
12797
|
airwallexCardLayout,
|
|
@@ -12683,6 +12864,7 @@ var encodeNativePanes = encodePanes;
|
|
|
12683
12864
|
knownSectionLabelKey,
|
|
12684
12865
|
leaf,
|
|
12685
12866
|
logoDimensions,
|
|
12867
|
+
matchWhopLook,
|
|
12686
12868
|
nativePaneMethodInfo,
|
|
12687
12869
|
nearestWhopAccent,
|
|
12688
12870
|
noticeText,
|