@delopay/sdk 0.78.0 → 0.79.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-TV4YASDP.js} +237 -2
- package/dist/chunk-TV4YASDP.js.map +1 -0
- package/dist/index.cjs +246 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +226 -3
- package/dist/index.d.ts +226 -3
- package/dist/index.js +23 -1
- package/dist/internal.cjs +246 -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/index.cjs
CHANGED
|
@@ -30,6 +30,7 @@ __export(index_exports, {
|
|
|
30
30
|
BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
|
|
31
31
|
CHECKBOX_CHECKED: () => CHECKBOX_CHECKED,
|
|
32
32
|
CHECKBOX_UNCHECKED: () => CHECKBOX_UNCHECKED,
|
|
33
|
+
CHECKOUT_EVENT_KINDS: () => CHECKOUT_EVENT_KINDS,
|
|
33
34
|
CUSTOM_CSS_MAX_LENGTH: () => CUSTOM_CSS_MAX_LENGTH,
|
|
34
35
|
CUSTOM_FIELDS_MAX: () => CUSTOM_FIELDS_MAX,
|
|
35
36
|
CUSTOM_FIELD_CONDITIONS_MAX: () => CUSTOM_FIELD_CONDITIONS_MAX,
|
|
@@ -49,7 +50,11 @@ __export(index_exports, {
|
|
|
49
50
|
FeeProgramBuilder: () => FeeProgramBuilder,
|
|
50
51
|
Files: () => Files,
|
|
51
52
|
Forex: () => Forex,
|
|
53
|
+
NATIVE_PANES_MAX: () => NATIVE_PANES_MAX,
|
|
54
|
+
NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
|
|
55
|
+
NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
|
|
52
56
|
Regions: () => Regions,
|
|
57
|
+
STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
|
|
53
58
|
Search: () => Search,
|
|
54
59
|
Subscriptions: () => Subscriptions,
|
|
55
60
|
Webhooks: () => Webhooks,
|
|
@@ -60,6 +65,7 @@ __export(index_exports, {
|
|
|
60
65
|
buttonPadValue: () => buttonPadValue,
|
|
61
66
|
cloneBranding: () => cloneBranding,
|
|
62
67
|
cloneCustomField: () => cloneCustomField,
|
|
68
|
+
cloneNativePane: () => cloneNativePane,
|
|
63
69
|
customFieldContextFromMetadata: () => customFieldContextFromMetadata,
|
|
64
70
|
customFieldIsTextLike: () => customFieldIsTextLike,
|
|
65
71
|
customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
|
|
@@ -68,15 +74,19 @@ __export(index_exports, {
|
|
|
68
74
|
decodeBadges: () => decodeBadges,
|
|
69
75
|
decodeBranding: () => decodeBranding,
|
|
70
76
|
decodeCustomFields: () => decodeCustomFields,
|
|
77
|
+
decodeNativePanes: () => decodeNativePanes,
|
|
71
78
|
defaultBranding: () => defaultBranding,
|
|
72
79
|
defaultCustomFieldVisibility: () => defaultCustomFieldVisibility,
|
|
80
|
+
defaultNativePane: () => defaultNativePane,
|
|
73
81
|
defaultOperatorForSource: () => defaultOperatorForSource,
|
|
74
82
|
encodeBadges: () => encodeBadges,
|
|
75
83
|
encodeBranding: () => encodeBranding,
|
|
76
84
|
encodeCustomFields: () => encodeCustomFields,
|
|
85
|
+
encodeNativePanes: () => encodeNativePanes,
|
|
77
86
|
evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
|
|
78
87
|
evaluateCustomFieldVisibility: () => evaluateCustomFieldVisibility,
|
|
79
88
|
feeProgram: () => feeProgram,
|
|
89
|
+
focusedCheckoutUrl: () => focusedCheckoutUrl,
|
|
80
90
|
fontStack: () => fontStack,
|
|
81
91
|
fontWeightValue: () => fontWeightValue,
|
|
82
92
|
inputPadValue: () => inputPadValue,
|
|
@@ -85,6 +95,7 @@ __export(index_exports, {
|
|
|
85
95
|
isHexColor: () => isHexColor,
|
|
86
96
|
leaf: () => leaf,
|
|
87
97
|
logoDimensions: () => logoDimensions,
|
|
98
|
+
nativePaneMethodInfo: () => nativePaneMethodInfo,
|
|
88
99
|
parseCustomFieldsLoose: () => parseCustomFieldsLoose,
|
|
89
100
|
parseImportedBranding: () => parseImportedBranding,
|
|
90
101
|
programToTree: () => programToTree,
|
|
@@ -4817,6 +4828,230 @@ function shadowFor(style) {
|
|
|
4817
4828
|
return "none";
|
|
4818
4829
|
}
|
|
4819
4830
|
}
|
|
4831
|
+
|
|
4832
|
+
// src/nativePanes.ts
|
|
4833
|
+
var STRIPE_NATIVE_PANE_METHODS = [
|
|
4834
|
+
{
|
|
4835
|
+
key: "apple_pay",
|
|
4836
|
+
rail: "wallet",
|
|
4837
|
+
defaultLabel: "Apple Pay",
|
|
4838
|
+
defaultSublabel: "Pay with Apple Pay",
|
|
4839
|
+
defaultCategory: "wallet",
|
|
4840
|
+
defaultIcon: "apple"
|
|
4841
|
+
},
|
|
4842
|
+
{
|
|
4843
|
+
key: "google_pay",
|
|
4844
|
+
rail: "wallet",
|
|
4845
|
+
defaultLabel: "Google Pay",
|
|
4846
|
+
defaultSublabel: "Pay with Google Pay",
|
|
4847
|
+
defaultCategory: "wallet",
|
|
4848
|
+
defaultIcon: "google"
|
|
4849
|
+
},
|
|
4850
|
+
{
|
|
4851
|
+
key: "link",
|
|
4852
|
+
rail: "wallet",
|
|
4853
|
+
defaultLabel: "Link",
|
|
4854
|
+
defaultSublabel: "Pay with saved details",
|
|
4855
|
+
defaultCategory: "wallet",
|
|
4856
|
+
defaultIcon: "wallet"
|
|
4857
|
+
},
|
|
4858
|
+
{
|
|
4859
|
+
key: "klarna",
|
|
4860
|
+
rail: "redirect",
|
|
4861
|
+
defaultLabel: "Klarna",
|
|
4862
|
+
defaultSublabel: "Pay later or in instalments",
|
|
4863
|
+
defaultCategory: "bnpl",
|
|
4864
|
+
defaultIcon: "bnpl"
|
|
4865
|
+
},
|
|
4866
|
+
{
|
|
4867
|
+
key: "affirm",
|
|
4868
|
+
rail: "redirect",
|
|
4869
|
+
defaultLabel: "Affirm",
|
|
4870
|
+
defaultSublabel: "Pay over time",
|
|
4871
|
+
defaultCategory: "bnpl",
|
|
4872
|
+
defaultIcon: "bnpl"
|
|
4873
|
+
},
|
|
4874
|
+
{
|
|
4875
|
+
key: "ideal",
|
|
4876
|
+
rail: "redirect",
|
|
4877
|
+
defaultLabel: "iDEAL",
|
|
4878
|
+
defaultSublabel: "Pay from your bank",
|
|
4879
|
+
defaultCategory: "bank_redirect",
|
|
4880
|
+
defaultIcon: "bank"
|
|
4881
|
+
},
|
|
4882
|
+
// eps / p24 / bancontact were removed from the router catalog: Stripe
|
|
4883
|
+
// hard-requires billing fields the focused checkout never collects (full
|
|
4884
|
+
// name for EPS/Bancontact, email for Przelewy24), so their tiles could
|
|
4885
|
+
// never succeed. They may return behind billing-aware gating.
|
|
4886
|
+
{
|
|
4887
|
+
key: "alipay",
|
|
4888
|
+
rail: "redirect",
|
|
4889
|
+
defaultLabel: "Alipay",
|
|
4890
|
+
defaultSublabel: "Pay with Alipay",
|
|
4891
|
+
defaultCategory: "wallet",
|
|
4892
|
+
defaultIcon: "wallet"
|
|
4893
|
+
},
|
|
4894
|
+
{
|
|
4895
|
+
key: "revolut_pay",
|
|
4896
|
+
rail: "redirect",
|
|
4897
|
+
defaultLabel: "Revolut Pay",
|
|
4898
|
+
defaultSublabel: "Pay with Revolut",
|
|
4899
|
+
defaultCategory: "wallet",
|
|
4900
|
+
defaultIcon: "wallet"
|
|
4901
|
+
},
|
|
4902
|
+
{
|
|
4903
|
+
key: "amazon_pay",
|
|
4904
|
+
rail: "redirect",
|
|
4905
|
+
defaultLabel: "Amazon Pay",
|
|
4906
|
+
defaultSublabel: "Pay with Amazon",
|
|
4907
|
+
defaultCategory: "wallet",
|
|
4908
|
+
defaultIcon: "wallet"
|
|
4909
|
+
}
|
|
4910
|
+
];
|
|
4911
|
+
var NATIVE_PANE_ICON_KEYS = [
|
|
4912
|
+
"wallet",
|
|
4913
|
+
"card",
|
|
4914
|
+
"bank",
|
|
4915
|
+
"apple",
|
|
4916
|
+
"google",
|
|
4917
|
+
"bnpl",
|
|
4918
|
+
"cash"
|
|
4919
|
+
];
|
|
4920
|
+
var NATIVE_PANE_CATEGORY_KEYS = [
|
|
4921
|
+
"wallet",
|
|
4922
|
+
"card",
|
|
4923
|
+
"bnpl",
|
|
4924
|
+
"bank_redirect",
|
|
4925
|
+
"bank_transfer",
|
|
4926
|
+
"cash"
|
|
4927
|
+
];
|
|
4928
|
+
var NATIVE_PANES_MAX = 12;
|
|
4929
|
+
function nativePaneMethodInfo(method) {
|
|
4930
|
+
return STRIPE_NATIVE_PANE_METHODS.find((m) => m.key === method);
|
|
4931
|
+
}
|
|
4932
|
+
function defaultNativePane(method) {
|
|
4933
|
+
const info = nativePaneMethodInfo(method);
|
|
4934
|
+
return {
|
|
4935
|
+
method,
|
|
4936
|
+
enabled: true,
|
|
4937
|
+
label: "",
|
|
4938
|
+
labelTranslations: {},
|
|
4939
|
+
sublabel: null,
|
|
4940
|
+
sublabelTranslations: {},
|
|
4941
|
+
category: "",
|
|
4942
|
+
icon: info?.defaultIcon ?? "",
|
|
4943
|
+
iconSvg: "",
|
|
4944
|
+
displayOrder: 0,
|
|
4945
|
+
visibility: "always"
|
|
4946
|
+
};
|
|
4947
|
+
}
|
|
4948
|
+
function cloneNativePane(pane) {
|
|
4949
|
+
return {
|
|
4950
|
+
...pane,
|
|
4951
|
+
labelTranslations: { ...pane.labelTranslations },
|
|
4952
|
+
sublabelTranslations: { ...pane.sublabelTranslations }
|
|
4953
|
+
};
|
|
4954
|
+
}
|
|
4955
|
+
function isObject2(value) {
|
|
4956
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4957
|
+
}
|
|
4958
|
+
function parseTranslations2(raw) {
|
|
4959
|
+
if (!isObject2(raw)) return {};
|
|
4960
|
+
const out = {};
|
|
4961
|
+
for (const [locale, value] of Object.entries(raw)) {
|
|
4962
|
+
if (typeof value === "string" && value.length > 0) out[locale] = value;
|
|
4963
|
+
}
|
|
4964
|
+
return out;
|
|
4965
|
+
}
|
|
4966
|
+
function str(raw) {
|
|
4967
|
+
return typeof raw === "string" ? raw : "";
|
|
4968
|
+
}
|
|
4969
|
+
var DISPLAY_ORDER_MIN = -2147483648;
|
|
4970
|
+
var DISPLAY_ORDER_MAX = 2147483647;
|
|
4971
|
+
function clampDisplayOrder(raw) {
|
|
4972
|
+
if (!Number.isFinite(raw)) return 0;
|
|
4973
|
+
return Math.min(DISPLAY_ORDER_MAX, Math.max(DISPLAY_ORDER_MIN, Math.trunc(raw)));
|
|
4974
|
+
}
|
|
4975
|
+
function decodeNativePanes(raw) {
|
|
4976
|
+
if (!Array.isArray(raw)) return null;
|
|
4977
|
+
const decodeRow = (entry, method) => ({
|
|
4978
|
+
method,
|
|
4979
|
+
enabled: entry["enabled"] !== false,
|
|
4980
|
+
label: str(entry["label"]),
|
|
4981
|
+
labelTranslations: parseTranslations2(entry["label_translations"]),
|
|
4982
|
+
sublabel: typeof entry["sublabel"] === "string" ? entry["sublabel"] : null,
|
|
4983
|
+
sublabelTranslations: parseTranslations2(entry["sublabel_translations"]),
|
|
4984
|
+
category: str(entry["category"]),
|
|
4985
|
+
icon: str(entry["icon"]),
|
|
4986
|
+
iconSvg: str(entry["icon_svg"]),
|
|
4987
|
+
displayOrder: clampDisplayOrder(Number(entry["display_order"])),
|
|
4988
|
+
// Anything unrecognised degrades to `always` rather than dropping the row.
|
|
4989
|
+
visibility: entry["visibility"] === "embedded_only" ? "embedded_only" : "always"
|
|
4990
|
+
});
|
|
4991
|
+
const indexByMethod = /* @__PURE__ */ new Map();
|
|
4992
|
+
const out = [];
|
|
4993
|
+
for (const entry of raw) {
|
|
4994
|
+
if (out.length >= NATIVE_PANES_MAX) break;
|
|
4995
|
+
if (!isObject2(entry)) continue;
|
|
4996
|
+
const method = str(entry["method"]).trim();
|
|
4997
|
+
if (!method) continue;
|
|
4998
|
+
const kept = indexByMethod.get(method);
|
|
4999
|
+
if (kept !== void 0) {
|
|
5000
|
+
const enabled = entry["enabled"] !== false;
|
|
5001
|
+
const existing = out[kept];
|
|
5002
|
+
if (enabled && existing && !existing.enabled) out[kept] = decodeRow(entry, method);
|
|
5003
|
+
continue;
|
|
5004
|
+
}
|
|
5005
|
+
indexByMethod.set(method, out.length);
|
|
5006
|
+
out.push(decodeRow(entry, method));
|
|
5007
|
+
}
|
|
5008
|
+
return out;
|
|
5009
|
+
}
|
|
5010
|
+
function encodeNativePanes(panes) {
|
|
5011
|
+
const nonEmpty = (map) => {
|
|
5012
|
+
const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
|
|
5013
|
+
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
5014
|
+
};
|
|
5015
|
+
return panes.slice(0, NATIVE_PANES_MAX).map((pane) => {
|
|
5016
|
+
const labelTranslations = nonEmpty(pane.labelTranslations);
|
|
5017
|
+
const sublabelTranslations = nonEmpty(pane.sublabelTranslations);
|
|
5018
|
+
return {
|
|
5019
|
+
method: pane.method,
|
|
5020
|
+
enabled: pane.enabled,
|
|
5021
|
+
...pane.label.trim() ? { label: pane.label.trim() } : {},
|
|
5022
|
+
...labelTranslations ? { label_translations: labelTranslations } : {},
|
|
5023
|
+
// `null` omits the key entirely (catalog default wins); `''` is sent
|
|
5024
|
+
// as-is because that is how the merchant hides the second line.
|
|
5025
|
+
...pane.sublabel !== null ? { sublabel: pane.sublabel } : {},
|
|
5026
|
+
...sublabelTranslations ? { sublabel_translations: sublabelTranslations } : {},
|
|
5027
|
+
...pane.category.trim() ? { category: pane.category.trim() } : {},
|
|
5028
|
+
...pane.icon.trim() ? { icon: pane.icon.trim() } : {},
|
|
5029
|
+
...pane.iconSvg.trim() ? { icon_svg: pane.iconSvg.trim() } : {},
|
|
5030
|
+
// Clamped on encode too, not only decode: the router's strict i32 row
|
|
5031
|
+
// decode drops a row whole for a fractional or out-of-range value, so
|
|
5032
|
+
// writing e.g. 3.5 or Date.now() verbatim would silently delete the
|
|
5033
|
+
// pane at render while every read surface shows it healthy.
|
|
5034
|
+
display_order: clampDisplayOrder(pane.displayOrder),
|
|
5035
|
+
visibility: pane.visibility
|
|
5036
|
+
};
|
|
5037
|
+
});
|
|
5038
|
+
}
|
|
5039
|
+
function focusedCheckoutUrl(params) {
|
|
5040
|
+
const base = params.checkoutBaseUrl.replace(/\/+$/, "");
|
|
5041
|
+
const path = `${base}/pay/${encodeURIComponent(params.merchantId)}/${encodeURIComponent(
|
|
5042
|
+
params.paymentId
|
|
5043
|
+
)}`;
|
|
5044
|
+
const query = new URLSearchParams({ pane: params.method });
|
|
5045
|
+
if (params.locale) query.set("locale", params.locale);
|
|
5046
|
+
if (params.customFieldsCollected) query.set("cf", "1");
|
|
5047
|
+
return `${path}?${query.toString()}`;
|
|
5048
|
+
}
|
|
5049
|
+
var CHECKOUT_EVENT_KINDS = [
|
|
5050
|
+
"native_pane_selected",
|
|
5051
|
+
"native_pane_tab_opened",
|
|
5052
|
+
"native_pane_tab_blocked",
|
|
5053
|
+
"native_pane_abandoned"
|
|
5054
|
+
];
|
|
4820
5055
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4821
5056
|
0 && (module.exports = {
|
|
4822
5057
|
ALL_CUSTOM_FIELD_CONDITION_SOURCES,
|
|
@@ -4829,6 +5064,7 @@ function shadowFor(style) {
|
|
|
4829
5064
|
BRANDING_EXPORT_VERSION,
|
|
4830
5065
|
CHECKBOX_CHECKED,
|
|
4831
5066
|
CHECKBOX_UNCHECKED,
|
|
5067
|
+
CHECKOUT_EVENT_KINDS,
|
|
4832
5068
|
CUSTOM_CSS_MAX_LENGTH,
|
|
4833
5069
|
CUSTOM_FIELDS_MAX,
|
|
4834
5070
|
CUSTOM_FIELD_CONDITIONS_MAX,
|
|
@@ -4848,7 +5084,11 @@ function shadowFor(style) {
|
|
|
4848
5084
|
FeeProgramBuilder,
|
|
4849
5085
|
Files,
|
|
4850
5086
|
Forex,
|
|
5087
|
+
NATIVE_PANES_MAX,
|
|
5088
|
+
NATIVE_PANE_CATEGORY_KEYS,
|
|
5089
|
+
NATIVE_PANE_ICON_KEYS,
|
|
4851
5090
|
Regions,
|
|
5091
|
+
STRIPE_NATIVE_PANE_METHODS,
|
|
4852
5092
|
Search,
|
|
4853
5093
|
Subscriptions,
|
|
4854
5094
|
Webhooks,
|
|
@@ -4859,6 +5099,7 @@ function shadowFor(style) {
|
|
|
4859
5099
|
buttonPadValue,
|
|
4860
5100
|
cloneBranding,
|
|
4861
5101
|
cloneCustomField,
|
|
5102
|
+
cloneNativePane,
|
|
4862
5103
|
customFieldContextFromMetadata,
|
|
4863
5104
|
customFieldIsTextLike,
|
|
4864
5105
|
customFieldOperatorTakesValue,
|
|
@@ -4867,15 +5108,19 @@ function shadowFor(style) {
|
|
|
4867
5108
|
decodeBadges,
|
|
4868
5109
|
decodeBranding,
|
|
4869
5110
|
decodeCustomFields,
|
|
5111
|
+
decodeNativePanes,
|
|
4870
5112
|
defaultBranding,
|
|
4871
5113
|
defaultCustomFieldVisibility,
|
|
5114
|
+
defaultNativePane,
|
|
4872
5115
|
defaultOperatorForSource,
|
|
4873
5116
|
encodeBadges,
|
|
4874
5117
|
encodeBranding,
|
|
4875
5118
|
encodeCustomFields,
|
|
5119
|
+
encodeNativePanes,
|
|
4876
5120
|
evaluateCustomFieldCondition,
|
|
4877
5121
|
evaluateCustomFieldVisibility,
|
|
4878
5122
|
feeProgram,
|
|
5123
|
+
focusedCheckoutUrl,
|
|
4879
5124
|
fontStack,
|
|
4880
5125
|
fontWeightValue,
|
|
4881
5126
|
inputPadValue,
|
|
@@ -4884,6 +5129,7 @@ function shadowFor(style) {
|
|
|
4884
5129
|
isHexColor,
|
|
4885
5130
|
leaf,
|
|
4886
5131
|
logoDimensions,
|
|
5132
|
+
nativePaneMethodInfo,
|
|
4887
5133
|
parseCustomFieldsLoose,
|
|
4888
5134
|
parseImportedBranding,
|
|
4889
5135
|
programToTree,
|