@delopay/sdk 0.78.0 → 0.80.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-MX26LF5P.js → chunk-PHKXFVHZ.js} +259 -2
- package/dist/chunk-PHKXFVHZ.js.map +1 -0
- package/dist/index.cjs +268 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +290 -3
- package/dist/index.d.ts +290 -3
- package/dist/index.js +23 -1
- package/dist/internal.cjs +268 -0
- 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 +23 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-MX26LF5P.js.map +0 -1
package/dist/internal.cjs
CHANGED
|
@@ -33,6 +33,7 @@ __export(internal_exports, {
|
|
|
33
33
|
BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
|
|
34
34
|
CHECKBOX_CHECKED: () => CHECKBOX_CHECKED,
|
|
35
35
|
CHECKBOX_UNCHECKED: () => CHECKBOX_UNCHECKED,
|
|
36
|
+
CHECKOUT_EVENT_KINDS: () => CHECKOUT_EVENT_KINDS,
|
|
36
37
|
CUSTOM_CSS_MAX_LENGTH: () => CUSTOM_CSS_MAX_LENGTH,
|
|
37
38
|
CUSTOM_FIELDS_MAX: () => CUSTOM_FIELDS_MAX,
|
|
38
39
|
CUSTOM_FIELD_CONDITIONS_MAX: () => CUSTOM_FIELD_CONDITIONS_MAX,
|
|
@@ -59,9 +60,13 @@ __export(internal_exports, {
|
|
|
59
60
|
Files: () => Files,
|
|
60
61
|
Forex: () => Forex,
|
|
61
62
|
Gsm: () => Gsm,
|
|
63
|
+
NATIVE_PANES_MAX: () => NATIVE_PANES_MAX,
|
|
64
|
+
NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
|
|
65
|
+
NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
|
|
62
66
|
PlatformBilling: () => PlatformBilling,
|
|
63
67
|
PlatformFees: () => PlatformFees,
|
|
64
68
|
Regions: () => Regions,
|
|
69
|
+
STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
|
|
65
70
|
Search: () => Search,
|
|
66
71
|
Subscriptions: () => Subscriptions,
|
|
67
72
|
Webhooks: () => Webhooks,
|
|
@@ -72,6 +77,7 @@ __export(internal_exports, {
|
|
|
72
77
|
buttonPadValue: () => buttonPadValue,
|
|
73
78
|
cloneBranding: () => cloneBranding,
|
|
74
79
|
cloneCustomField: () => cloneCustomField,
|
|
80
|
+
cloneNativePane: () => cloneNativePane,
|
|
75
81
|
customFieldContextFromMetadata: () => customFieldContextFromMetadata,
|
|
76
82
|
customFieldIsTextLike: () => customFieldIsTextLike,
|
|
77
83
|
customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
|
|
@@ -80,15 +86,19 @@ __export(internal_exports, {
|
|
|
80
86
|
decodeBadges: () => decodeBadges,
|
|
81
87
|
decodeBranding: () => decodeBranding,
|
|
82
88
|
decodeCustomFields: () => decodeCustomFields,
|
|
89
|
+
decodeNativePanes: () => decodeNativePanes,
|
|
83
90
|
defaultBranding: () => defaultBranding,
|
|
84
91
|
defaultCustomFieldVisibility: () => defaultCustomFieldVisibility,
|
|
92
|
+
defaultNativePane: () => defaultNativePane,
|
|
85
93
|
defaultOperatorForSource: () => defaultOperatorForSource,
|
|
86
94
|
encodeBadges: () => encodeBadges,
|
|
87
95
|
encodeBranding: () => encodeBranding,
|
|
88
96
|
encodeCustomFields: () => encodeCustomFields,
|
|
97
|
+
encodeNativePanes: () => encodeNativePanes,
|
|
89
98
|
evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
|
|
90
99
|
evaluateCustomFieldVisibility: () => evaluateCustomFieldVisibility,
|
|
91
100
|
feeProgram: () => feeProgram,
|
|
101
|
+
focusedCheckoutUrl: () => focusedCheckoutUrl,
|
|
92
102
|
fontStack: () => fontStack,
|
|
93
103
|
fontWeightValue: () => fontWeightValue,
|
|
94
104
|
inputPadValue: () => inputPadValue,
|
|
@@ -97,6 +107,7 @@ __export(internal_exports, {
|
|
|
97
107
|
isHexColor: () => isHexColor,
|
|
98
108
|
leaf: () => leaf,
|
|
99
109
|
logoDimensions: () => logoDimensions,
|
|
110
|
+
nativePaneMethodInfo: () => nativePaneMethodInfo,
|
|
100
111
|
parseCustomFieldsLoose: () => parseCustomFieldsLoose,
|
|
101
112
|
parseImportedBranding: () => parseImportedBranding,
|
|
102
113
|
programToTree: () => programToTree,
|
|
@@ -595,6 +606,23 @@ var Connectors = class {
|
|
|
595
606
|
if (params === void 0) return this.request("POST", path);
|
|
596
607
|
return this.request("POST", path, { body: params });
|
|
597
608
|
}
|
|
609
|
+
/**
|
|
610
|
+
* Register checkout/shop domains as Stripe payment method domains, so Apple
|
|
611
|
+
* Pay renders on those pages.
|
|
612
|
+
* `POST /account/{merchantId}/connectors/{connectorId}/stripe/payment-method-domains`
|
|
613
|
+
*
|
|
614
|
+
* Stripe connectors only. One call registers against a single credential set
|
|
615
|
+
* (`environment`, default `'live'`) — call twice to cover live and sandbox.
|
|
616
|
+
* Per-URL outcomes come back in `results`; a missing sandbox credential set
|
|
617
|
+
* is a request-level 400.
|
|
618
|
+
*/
|
|
619
|
+
async registerStripePaymentMethodDomains(merchantId, connectorId, params) {
|
|
620
|
+
return this.request(
|
|
621
|
+
"POST",
|
|
622
|
+
`/account/${encodeURIComponent(merchantId)}/connectors/${encodeURIComponent(connectorId)}/stripe/payment-method-domains`,
|
|
623
|
+
{ body: params }
|
|
624
|
+
);
|
|
625
|
+
}
|
|
598
626
|
/** Get registered webhooks for a connector. `GET /account/{merchantId}/connectors/webhooks/{connectorId}` */
|
|
599
627
|
async getWebhook(merchantId, connectorId) {
|
|
600
628
|
return this.request(
|
|
@@ -4830,6 +4858,235 @@ function shadowFor(style) {
|
|
|
4830
4858
|
}
|
|
4831
4859
|
}
|
|
4832
4860
|
|
|
4861
|
+
// src/nativePanes.ts
|
|
4862
|
+
var STRIPE_NATIVE_PANE_METHODS = [
|
|
4863
|
+
{
|
|
4864
|
+
key: "apple_pay",
|
|
4865
|
+
rail: "wallet",
|
|
4866
|
+
defaultLabel: "Apple Pay",
|
|
4867
|
+
defaultSublabel: "Pay with Apple Pay",
|
|
4868
|
+
defaultCategory: "wallet",
|
|
4869
|
+
defaultIcon: "apple"
|
|
4870
|
+
},
|
|
4871
|
+
{
|
|
4872
|
+
key: "google_pay",
|
|
4873
|
+
rail: "wallet",
|
|
4874
|
+
defaultLabel: "Google Pay",
|
|
4875
|
+
defaultSublabel: "Pay with Google Pay",
|
|
4876
|
+
defaultCategory: "wallet",
|
|
4877
|
+
defaultIcon: "google"
|
|
4878
|
+
},
|
|
4879
|
+
{
|
|
4880
|
+
key: "link",
|
|
4881
|
+
rail: "wallet",
|
|
4882
|
+
defaultLabel: "Link",
|
|
4883
|
+
defaultSublabel: "Pay with saved details",
|
|
4884
|
+
defaultCategory: "wallet",
|
|
4885
|
+
defaultIcon: "wallet"
|
|
4886
|
+
},
|
|
4887
|
+
{
|
|
4888
|
+
key: "klarna",
|
|
4889
|
+
rail: "redirect",
|
|
4890
|
+
defaultLabel: "Klarna",
|
|
4891
|
+
defaultSublabel: "Pay later or in instalments",
|
|
4892
|
+
defaultCategory: "bnpl",
|
|
4893
|
+
defaultIcon: "bnpl"
|
|
4894
|
+
},
|
|
4895
|
+
{
|
|
4896
|
+
key: "affirm",
|
|
4897
|
+
rail: "redirect",
|
|
4898
|
+
defaultLabel: "Affirm",
|
|
4899
|
+
defaultSublabel: "Pay over time",
|
|
4900
|
+
defaultCategory: "bnpl",
|
|
4901
|
+
defaultIcon: "bnpl"
|
|
4902
|
+
},
|
|
4903
|
+
{
|
|
4904
|
+
key: "ideal",
|
|
4905
|
+
rail: "redirect",
|
|
4906
|
+
defaultLabel: "iDEAL",
|
|
4907
|
+
defaultSublabel: "Pay from your bank",
|
|
4908
|
+
defaultCategory: "bank_redirect",
|
|
4909
|
+
defaultIcon: "bank"
|
|
4910
|
+
},
|
|
4911
|
+
// eps / p24 / bancontact were removed from the router catalog: Stripe
|
|
4912
|
+
// hard-requires billing fields the focused checkout never collects (full
|
|
4913
|
+
// name for EPS/Bancontact, email for Przelewy24), so their tiles could
|
|
4914
|
+
// never succeed. They may return behind billing-aware gating.
|
|
4915
|
+
{
|
|
4916
|
+
key: "alipay",
|
|
4917
|
+
rail: "redirect",
|
|
4918
|
+
defaultLabel: "Alipay",
|
|
4919
|
+
defaultSublabel: "Pay with Alipay",
|
|
4920
|
+
defaultCategory: "wallet",
|
|
4921
|
+
defaultIcon: "wallet"
|
|
4922
|
+
},
|
|
4923
|
+
{
|
|
4924
|
+
key: "revolut_pay",
|
|
4925
|
+
rail: "redirect",
|
|
4926
|
+
defaultLabel: "Revolut Pay",
|
|
4927
|
+
defaultSublabel: "Pay with Revolut",
|
|
4928
|
+
defaultCategory: "wallet",
|
|
4929
|
+
defaultIcon: "wallet"
|
|
4930
|
+
},
|
|
4931
|
+
{
|
|
4932
|
+
key: "amazon_pay",
|
|
4933
|
+
rail: "redirect",
|
|
4934
|
+
defaultLabel: "Amazon Pay",
|
|
4935
|
+
defaultSublabel: "Pay with Amazon",
|
|
4936
|
+
defaultCategory: "wallet",
|
|
4937
|
+
defaultIcon: "wallet"
|
|
4938
|
+
}
|
|
4939
|
+
];
|
|
4940
|
+
var NATIVE_PANE_ICON_KEYS = [
|
|
4941
|
+
"wallet",
|
|
4942
|
+
"card",
|
|
4943
|
+
"bank",
|
|
4944
|
+
"apple",
|
|
4945
|
+
"google",
|
|
4946
|
+
"bnpl",
|
|
4947
|
+
"cash"
|
|
4948
|
+
];
|
|
4949
|
+
var NATIVE_PANE_CATEGORY_KEYS = [
|
|
4950
|
+
"wallet",
|
|
4951
|
+
"card",
|
|
4952
|
+
"bnpl",
|
|
4953
|
+
"bank_redirect",
|
|
4954
|
+
"bank_transfer",
|
|
4955
|
+
"cash"
|
|
4956
|
+
];
|
|
4957
|
+
var NATIVE_PANES_MAX = 12;
|
|
4958
|
+
function nativePaneMethodInfo(method) {
|
|
4959
|
+
return STRIPE_NATIVE_PANE_METHODS.find((m) => m.key === method);
|
|
4960
|
+
}
|
|
4961
|
+
function defaultNativePane(method) {
|
|
4962
|
+
const info = nativePaneMethodInfo(method);
|
|
4963
|
+
return {
|
|
4964
|
+
method,
|
|
4965
|
+
enabled: true,
|
|
4966
|
+
label: "",
|
|
4967
|
+
labelTranslations: {},
|
|
4968
|
+
sublabel: null,
|
|
4969
|
+
sublabelTranslations: {},
|
|
4970
|
+
category: "",
|
|
4971
|
+
icon: info?.defaultIcon ?? "",
|
|
4972
|
+
iconSvg: "",
|
|
4973
|
+
displayOrder: 0,
|
|
4974
|
+
visibility: "always",
|
|
4975
|
+
openIn: "tab"
|
|
4976
|
+
};
|
|
4977
|
+
}
|
|
4978
|
+
function cloneNativePane(pane) {
|
|
4979
|
+
return {
|
|
4980
|
+
...pane,
|
|
4981
|
+
labelTranslations: { ...pane.labelTranslations },
|
|
4982
|
+
sublabelTranslations: { ...pane.sublabelTranslations }
|
|
4983
|
+
};
|
|
4984
|
+
}
|
|
4985
|
+
function isObject2(value) {
|
|
4986
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4987
|
+
}
|
|
4988
|
+
function parseTranslations2(raw) {
|
|
4989
|
+
if (!isObject2(raw)) return {};
|
|
4990
|
+
const out = {};
|
|
4991
|
+
for (const [locale, value] of Object.entries(raw)) {
|
|
4992
|
+
if (typeof value === "string" && value.length > 0) out[locale] = value;
|
|
4993
|
+
}
|
|
4994
|
+
return out;
|
|
4995
|
+
}
|
|
4996
|
+
function str(raw) {
|
|
4997
|
+
return typeof raw === "string" ? raw : "";
|
|
4998
|
+
}
|
|
4999
|
+
var DISPLAY_ORDER_MIN = -2147483648;
|
|
5000
|
+
var DISPLAY_ORDER_MAX = 2147483647;
|
|
5001
|
+
function clampDisplayOrder(raw) {
|
|
5002
|
+
if (!Number.isFinite(raw)) return 0;
|
|
5003
|
+
return Math.min(DISPLAY_ORDER_MAX, Math.max(DISPLAY_ORDER_MIN, Math.trunc(raw)));
|
|
5004
|
+
}
|
|
5005
|
+
function decodeNativePanes(raw) {
|
|
5006
|
+
if (!Array.isArray(raw)) return null;
|
|
5007
|
+
const decodeRow = (entry, method) => ({
|
|
5008
|
+
method,
|
|
5009
|
+
enabled: entry["enabled"] !== false,
|
|
5010
|
+
label: str(entry["label"]),
|
|
5011
|
+
labelTranslations: parseTranslations2(entry["label_translations"]),
|
|
5012
|
+
sublabel: typeof entry["sublabel"] === "string" ? entry["sublabel"] : null,
|
|
5013
|
+
sublabelTranslations: parseTranslations2(entry["sublabel_translations"]),
|
|
5014
|
+
category: str(entry["category"]),
|
|
5015
|
+
icon: str(entry["icon"]),
|
|
5016
|
+
iconSvg: str(entry["icon_svg"]),
|
|
5017
|
+
displayOrder: clampDisplayOrder(Number(entry["display_order"])),
|
|
5018
|
+
// Anything unrecognised degrades to `always` rather than dropping the row.
|
|
5019
|
+
visibility: entry["visibility"] === "embedded_only" ? "embedded_only" : "always",
|
|
5020
|
+
// Same tolerance: an unknown value degrades to the default `tab`.
|
|
5021
|
+
openIn: entry["open_in"] === "popup" ? "popup" : "tab"
|
|
5022
|
+
});
|
|
5023
|
+
const indexByMethod = /* @__PURE__ */ new Map();
|
|
5024
|
+
const out = [];
|
|
5025
|
+
for (const entry of raw) {
|
|
5026
|
+
if (out.length >= NATIVE_PANES_MAX) break;
|
|
5027
|
+
if (!isObject2(entry)) continue;
|
|
5028
|
+
const method = str(entry["method"]).trim();
|
|
5029
|
+
if (!method) continue;
|
|
5030
|
+
const kept = indexByMethod.get(method);
|
|
5031
|
+
if (kept !== void 0) {
|
|
5032
|
+
const enabled = entry["enabled"] !== false;
|
|
5033
|
+
const existing = out[kept];
|
|
5034
|
+
if (enabled && existing && !existing.enabled) out[kept] = decodeRow(entry, method);
|
|
5035
|
+
continue;
|
|
5036
|
+
}
|
|
5037
|
+
indexByMethod.set(method, out.length);
|
|
5038
|
+
out.push(decodeRow(entry, method));
|
|
5039
|
+
}
|
|
5040
|
+
return out;
|
|
5041
|
+
}
|
|
5042
|
+
function encodeNativePanes(panes) {
|
|
5043
|
+
const nonEmpty = (map) => {
|
|
5044
|
+
const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
|
|
5045
|
+
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
5046
|
+
};
|
|
5047
|
+
return panes.slice(0, NATIVE_PANES_MAX).map((pane) => {
|
|
5048
|
+
const labelTranslations = nonEmpty(pane.labelTranslations);
|
|
5049
|
+
const sublabelTranslations = nonEmpty(pane.sublabelTranslations);
|
|
5050
|
+
return {
|
|
5051
|
+
method: pane.method,
|
|
5052
|
+
enabled: pane.enabled,
|
|
5053
|
+
...pane.label.trim() ? { label: pane.label.trim() } : {},
|
|
5054
|
+
...labelTranslations ? { label_translations: labelTranslations } : {},
|
|
5055
|
+
// `null` omits the key entirely (catalog default wins); `''` is sent
|
|
5056
|
+
// as-is because that is how the merchant hides the second line.
|
|
5057
|
+
...pane.sublabel !== null ? { sublabel: pane.sublabel } : {},
|
|
5058
|
+
...sublabelTranslations ? { sublabel_translations: sublabelTranslations } : {},
|
|
5059
|
+
...pane.category.trim() ? { category: pane.category.trim() } : {},
|
|
5060
|
+
...pane.icon.trim() ? { icon: pane.icon.trim() } : {},
|
|
5061
|
+
...pane.iconSvg.trim() ? { icon_svg: pane.iconSvg.trim() } : {},
|
|
5062
|
+
// Clamped on encode too, not only decode: the router's strict i32 row
|
|
5063
|
+
// decode drops a row whole for a fractional or out-of-range value, so
|
|
5064
|
+
// writing e.g. 3.5 or Date.now() verbatim would silently delete the
|
|
5065
|
+
// pane at render while every read surface shows it healthy.
|
|
5066
|
+
display_order: clampDisplayOrder(pane.displayOrder),
|
|
5067
|
+
visibility: pane.visibility,
|
|
5068
|
+
open_in: pane.openIn
|
|
5069
|
+
};
|
|
5070
|
+
});
|
|
5071
|
+
}
|
|
5072
|
+
function focusedCheckoutUrl(params) {
|
|
5073
|
+
const base = params.checkoutBaseUrl.replace(/\/+$/, "");
|
|
5074
|
+
const path = `${base}/pay/${encodeURIComponent(params.merchantId)}/${encodeURIComponent(
|
|
5075
|
+
params.paymentId
|
|
5076
|
+
)}`;
|
|
5077
|
+
const query = new URLSearchParams({ pane: params.method });
|
|
5078
|
+
if (params.locale) query.set("locale", params.locale);
|
|
5079
|
+
if (params.customFieldsCollected) query.set("cf", "1");
|
|
5080
|
+
return `${path}?${query.toString()}`;
|
|
5081
|
+
}
|
|
5082
|
+
var CHECKOUT_EVENT_KINDS = [
|
|
5083
|
+
"native_pane_selected",
|
|
5084
|
+
"native_pane_tab_opened",
|
|
5085
|
+
"native_pane_tab_blocked",
|
|
5086
|
+
"native_pane_abandoned",
|
|
5087
|
+
"native_pane_returned"
|
|
5088
|
+
];
|
|
5089
|
+
|
|
4833
5090
|
// src/internal/resources/admin.ts
|
|
4834
5091
|
var Admin = class {
|
|
4835
5092
|
constructor(request) {
|
|
@@ -5407,6 +5664,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
5407
5664
|
BRANDING_EXPORT_VERSION,
|
|
5408
5665
|
CHECKBOX_CHECKED,
|
|
5409
5666
|
CHECKBOX_UNCHECKED,
|
|
5667
|
+
CHECKOUT_EVENT_KINDS,
|
|
5410
5668
|
CUSTOM_CSS_MAX_LENGTH,
|
|
5411
5669
|
CUSTOM_FIELDS_MAX,
|
|
5412
5670
|
CUSTOM_FIELD_CONDITIONS_MAX,
|
|
@@ -5433,9 +5691,13 @@ var DelopayInternal = class extends Delopay {
|
|
|
5433
5691
|
Files,
|
|
5434
5692
|
Forex,
|
|
5435
5693
|
Gsm,
|
|
5694
|
+
NATIVE_PANES_MAX,
|
|
5695
|
+
NATIVE_PANE_CATEGORY_KEYS,
|
|
5696
|
+
NATIVE_PANE_ICON_KEYS,
|
|
5436
5697
|
PlatformBilling,
|
|
5437
5698
|
PlatformFees,
|
|
5438
5699
|
Regions,
|
|
5700
|
+
STRIPE_NATIVE_PANE_METHODS,
|
|
5439
5701
|
Search,
|
|
5440
5702
|
Subscriptions,
|
|
5441
5703
|
Webhooks,
|
|
@@ -5446,6 +5708,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
5446
5708
|
buttonPadValue,
|
|
5447
5709
|
cloneBranding,
|
|
5448
5710
|
cloneCustomField,
|
|
5711
|
+
cloneNativePane,
|
|
5449
5712
|
customFieldContextFromMetadata,
|
|
5450
5713
|
customFieldIsTextLike,
|
|
5451
5714
|
customFieldOperatorTakesValue,
|
|
@@ -5454,15 +5717,19 @@ var DelopayInternal = class extends Delopay {
|
|
|
5454
5717
|
decodeBadges,
|
|
5455
5718
|
decodeBranding,
|
|
5456
5719
|
decodeCustomFields,
|
|
5720
|
+
decodeNativePanes,
|
|
5457
5721
|
defaultBranding,
|
|
5458
5722
|
defaultCustomFieldVisibility,
|
|
5723
|
+
defaultNativePane,
|
|
5459
5724
|
defaultOperatorForSource,
|
|
5460
5725
|
encodeBadges,
|
|
5461
5726
|
encodeBranding,
|
|
5462
5727
|
encodeCustomFields,
|
|
5728
|
+
encodeNativePanes,
|
|
5463
5729
|
evaluateCustomFieldCondition,
|
|
5464
5730
|
evaluateCustomFieldVisibility,
|
|
5465
5731
|
feeProgram,
|
|
5732
|
+
focusedCheckoutUrl,
|
|
5466
5733
|
fontStack,
|
|
5467
5734
|
fontWeightValue,
|
|
5468
5735
|
inputPadValue,
|
|
@@ -5471,6 +5738,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
5471
5738
|
isHexColor,
|
|
5472
5739
|
leaf,
|
|
5473
5740
|
logoDimensions,
|
|
5741
|
+
nativePaneMethodInfo,
|
|
5474
5742
|
parseCustomFieldsLoose,
|
|
5475
5743
|
parseImportedBranding,
|
|
5476
5744
|
programToTree,
|