@delopay/sdk 0.75.0 → 0.77.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-5J763YMV.js → chunk-RODMYISN.js} +39 -8
- package/dist/chunk-RODMYISN.js.map +1 -0
- package/dist/index.cjs +42 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -5
- package/dist/index.d.ts +46 -5
- package/dist/index.js +9 -1
- package/dist/internal.cjs +42 -7
- 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 +9 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5J763YMV.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,8 @@ __export(index_exports, {
|
|
|
28
28
|
AvailabilityOverrides: () => AvailabilityOverrides,
|
|
29
29
|
BRANDING_EXPORT_FORMAT: () => BRANDING_EXPORT_FORMAT,
|
|
30
30
|
BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
|
|
31
|
+
CHECKBOX_CHECKED: () => CHECKBOX_CHECKED,
|
|
32
|
+
CHECKBOX_UNCHECKED: () => CHECKBOX_UNCHECKED,
|
|
31
33
|
CUSTOM_CSS_MAX_LENGTH: () => CUSTOM_CSS_MAX_LENGTH,
|
|
32
34
|
CUSTOM_FIELDS_MAX: () => CUSTOM_FIELDS_MAX,
|
|
33
35
|
CUSTOM_FIELD_CONDITIONS_MAX: () => CUSTOM_FIELD_CONDITIONS_MAX,
|
|
@@ -59,6 +61,7 @@ __export(index_exports, {
|
|
|
59
61
|
cloneBranding: () => cloneBranding,
|
|
60
62
|
cloneCustomField: () => cloneCustomField,
|
|
61
63
|
customFieldContextFromMetadata: () => customFieldContextFromMetadata,
|
|
64
|
+
customFieldIsTextLike: () => customFieldIsTextLike,
|
|
62
65
|
customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
|
|
63
66
|
customFieldOptionLabel: () => customFieldOptionLabel,
|
|
64
67
|
customFieldText: () => customFieldText,
|
|
@@ -77,6 +80,7 @@ __export(index_exports, {
|
|
|
77
80
|
fontStack: () => fontStack,
|
|
78
81
|
fontWeightValue: () => fontWeightValue,
|
|
79
82
|
inputPadValue: () => inputPadValue,
|
|
83
|
+
isCheckboxChecked: () => isCheckboxChecked,
|
|
80
84
|
isDarkSurface: () => isDarkSurface,
|
|
81
85
|
isHexColor: () => isHexColor,
|
|
82
86
|
leaf: () => leaf,
|
|
@@ -1265,6 +1269,17 @@ var Payments = class {
|
|
|
1265
1269
|
* { headers: { 'Idempotency-Key': 'order_1001' } },
|
|
1266
1270
|
* );
|
|
1267
1271
|
* ```
|
|
1272
|
+
*
|
|
1273
|
+
* @example Send `test_mode` to pick the environment per payment, so a staging
|
|
1274
|
+
* deploy cannot charge real cards and a forgotten processor toggle cannot
|
|
1275
|
+
* swallow production traffic:
|
|
1276
|
+
* ```typescript
|
|
1277
|
+
* const payment = await delopay.payments.create({
|
|
1278
|
+
* amount: 5000,
|
|
1279
|
+
* currency: 'EUR',
|
|
1280
|
+
* test_mode: process.env.NODE_ENV !== 'production',
|
|
1281
|
+
* });
|
|
1282
|
+
* ```
|
|
1268
1283
|
*/
|
|
1269
1284
|
async create(params, options) {
|
|
1270
1285
|
return this.request("POST", "/payments", { body: params, ...options });
|
|
@@ -4097,8 +4112,17 @@ var ALL_CUSTOM_FIELD_TYPES = [
|
|
|
4097
4112
|
"textarea",
|
|
4098
4113
|
"password",
|
|
4099
4114
|
"email",
|
|
4100
|
-
"select"
|
|
4115
|
+
"select",
|
|
4116
|
+
"checkbox"
|
|
4101
4117
|
];
|
|
4118
|
+
var CHECKBOX_CHECKED = "true";
|
|
4119
|
+
var CHECKBOX_UNCHECKED = "false";
|
|
4120
|
+
function isCheckboxChecked(value) {
|
|
4121
|
+
return typeof value === "string" && value.trim().toLowerCase() === CHECKBOX_CHECKED;
|
|
4122
|
+
}
|
|
4123
|
+
function customFieldIsTextLike(type) {
|
|
4124
|
+
return type !== "select" && type !== "checkbox";
|
|
4125
|
+
}
|
|
4102
4126
|
var CUSTOM_FIELD_CONDITIONS_MAX = 10;
|
|
4103
4127
|
var ALL_CUSTOM_FIELD_CONDITION_SOURCES = [
|
|
4104
4128
|
"metadata",
|
|
@@ -4201,8 +4225,11 @@ function normalizeCustomField(raw, index) {
|
|
|
4201
4225
|
labelTranslations: parseTranslations(o["labelTranslations"])
|
|
4202
4226
|
};
|
|
4203
4227
|
}).filter((o) => o.value.length > 0) : [];
|
|
4204
|
-
const
|
|
4205
|
-
const
|
|
4228
|
+
const textLike = customFieldIsTextLike(type);
|
|
4229
|
+
const minLength = textLike ? parseBoundedInt(f["minLength"]) : null;
|
|
4230
|
+
const maxLength = textLike ? parseBoundedInt(f["maxLength"]) : null;
|
|
4231
|
+
const rawDefault = typeof f["defaultValue"] === "string" ? f["defaultValue"] : "";
|
|
4232
|
+
const defaultValue = type === "checkbox" ? isCheckboxChecked(rawDefault) ? CHECKBOX_CHECKED : CHECKBOX_UNCHECKED : rawDefault;
|
|
4206
4233
|
return {
|
|
4207
4234
|
id: typeof f["id"] === "string" && f["id"] ? f["id"] : `field-${index}`,
|
|
4208
4235
|
key,
|
|
@@ -4218,7 +4245,7 @@ function normalizeCustomField(raw, index) {
|
|
|
4218
4245
|
minLength,
|
|
4219
4246
|
// Guard inverted bounds at decode so consumers never see min > max.
|
|
4220
4247
|
maxLength: maxLength !== null && minLength !== null && maxLength < minLength ? null : maxLength,
|
|
4221
|
-
defaultValue
|
|
4248
|
+
defaultValue,
|
|
4222
4249
|
options,
|
|
4223
4250
|
visibility: normalizeVisibility(f["visibility"])
|
|
4224
4251
|
};
|
|
@@ -4261,9 +4288,13 @@ function encodeCustomFields(fields) {
|
|
|
4261
4288
|
...nonEmpty(f.helpTextTranslations) ? { helpTextTranslations: nonEmpty(f.helpTextTranslations) } : {},
|
|
4262
4289
|
...f.required ? { required: true } : {},
|
|
4263
4290
|
...f.enabled ? {} : { enabled: false },
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
...f.
|
|
4291
|
+
// Length bounds only exist for free-text types; a choice control that
|
|
4292
|
+
// still carries them is stale state the decoder would drop anyway.
|
|
4293
|
+
...customFieldIsTextLike(f.type) && f.minLength !== null ? { minLength: f.minLength } : {},
|
|
4294
|
+
...customFieldIsTextLike(f.type) && f.maxLength !== null ? { maxLength: f.maxLength } : {},
|
|
4295
|
+
// A checkbox persists only "starts ticked"; unticked is the decoder's
|
|
4296
|
+
// default, so writing 'false' would be noise on every such field.
|
|
4297
|
+
...f.type === "checkbox" ? isCheckboxChecked(f.defaultValue) ? { defaultValue: CHECKBOX_CHECKED } : {} : f.defaultValue ? { defaultValue: f.defaultValue } : {},
|
|
4267
4298
|
...f.type === "select" ? { options: f.options } : {},
|
|
4268
4299
|
// Omitted for unconditional fields so the stored blob (and every
|
|
4269
4300
|
// pre-feature payload) stays byte-identical to what it was.
|
|
@@ -4761,6 +4792,8 @@ function shadowFor(style) {
|
|
|
4761
4792
|
AvailabilityOverrides,
|
|
4762
4793
|
BRANDING_EXPORT_FORMAT,
|
|
4763
4794
|
BRANDING_EXPORT_VERSION,
|
|
4795
|
+
CHECKBOX_CHECKED,
|
|
4796
|
+
CHECKBOX_UNCHECKED,
|
|
4764
4797
|
CUSTOM_CSS_MAX_LENGTH,
|
|
4765
4798
|
CUSTOM_FIELDS_MAX,
|
|
4766
4799
|
CUSTOM_FIELD_CONDITIONS_MAX,
|
|
@@ -4792,6 +4825,7 @@ function shadowFor(style) {
|
|
|
4792
4825
|
cloneBranding,
|
|
4793
4826
|
cloneCustomField,
|
|
4794
4827
|
customFieldContextFromMetadata,
|
|
4828
|
+
customFieldIsTextLike,
|
|
4795
4829
|
customFieldOperatorTakesValue,
|
|
4796
4830
|
customFieldOptionLabel,
|
|
4797
4831
|
customFieldText,
|
|
@@ -4810,6 +4844,7 @@ function shadowFor(style) {
|
|
|
4810
4844
|
fontStack,
|
|
4811
4845
|
fontWeightValue,
|
|
4812
4846
|
inputPadValue,
|
|
4847
|
+
isCheckboxChecked,
|
|
4813
4848
|
isDarkSurface,
|
|
4814
4849
|
isHexColor,
|
|
4815
4850
|
leaf,
|