@delopay/sdk 0.75.0 → 0.76.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-D7DPAKI2.js} +28 -8
- package/dist/{chunk-5J763YMV.js.map → chunk-D7DPAKI2.js.map} +1 -1
- package/dist/index.cjs +31 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +9 -1
- package/dist/internal.cjs +31 -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/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,
|
|
@@ -4097,8 +4101,17 @@ var ALL_CUSTOM_FIELD_TYPES = [
|
|
|
4097
4101
|
"textarea",
|
|
4098
4102
|
"password",
|
|
4099
4103
|
"email",
|
|
4100
|
-
"select"
|
|
4104
|
+
"select",
|
|
4105
|
+
"checkbox"
|
|
4101
4106
|
];
|
|
4107
|
+
var CHECKBOX_CHECKED = "true";
|
|
4108
|
+
var CHECKBOX_UNCHECKED = "false";
|
|
4109
|
+
function isCheckboxChecked(value) {
|
|
4110
|
+
return typeof value === "string" && value.trim().toLowerCase() === CHECKBOX_CHECKED;
|
|
4111
|
+
}
|
|
4112
|
+
function customFieldIsTextLike(type) {
|
|
4113
|
+
return type !== "select" && type !== "checkbox";
|
|
4114
|
+
}
|
|
4102
4115
|
var CUSTOM_FIELD_CONDITIONS_MAX = 10;
|
|
4103
4116
|
var ALL_CUSTOM_FIELD_CONDITION_SOURCES = [
|
|
4104
4117
|
"metadata",
|
|
@@ -4201,8 +4214,11 @@ function normalizeCustomField(raw, index) {
|
|
|
4201
4214
|
labelTranslations: parseTranslations(o["labelTranslations"])
|
|
4202
4215
|
};
|
|
4203
4216
|
}).filter((o) => o.value.length > 0) : [];
|
|
4204
|
-
const
|
|
4205
|
-
const
|
|
4217
|
+
const textLike = customFieldIsTextLike(type);
|
|
4218
|
+
const minLength = textLike ? parseBoundedInt(f["minLength"]) : null;
|
|
4219
|
+
const maxLength = textLike ? parseBoundedInt(f["maxLength"]) : null;
|
|
4220
|
+
const rawDefault = typeof f["defaultValue"] === "string" ? f["defaultValue"] : "";
|
|
4221
|
+
const defaultValue = type === "checkbox" ? isCheckboxChecked(rawDefault) ? CHECKBOX_CHECKED : CHECKBOX_UNCHECKED : rawDefault;
|
|
4206
4222
|
return {
|
|
4207
4223
|
id: typeof f["id"] === "string" && f["id"] ? f["id"] : `field-${index}`,
|
|
4208
4224
|
key,
|
|
@@ -4218,7 +4234,7 @@ function normalizeCustomField(raw, index) {
|
|
|
4218
4234
|
minLength,
|
|
4219
4235
|
// Guard inverted bounds at decode so consumers never see min > max.
|
|
4220
4236
|
maxLength: maxLength !== null && minLength !== null && maxLength < minLength ? null : maxLength,
|
|
4221
|
-
defaultValue
|
|
4237
|
+
defaultValue,
|
|
4222
4238
|
options,
|
|
4223
4239
|
visibility: normalizeVisibility(f["visibility"])
|
|
4224
4240
|
};
|
|
@@ -4261,9 +4277,13 @@ function encodeCustomFields(fields) {
|
|
|
4261
4277
|
...nonEmpty(f.helpTextTranslations) ? { helpTextTranslations: nonEmpty(f.helpTextTranslations) } : {},
|
|
4262
4278
|
...f.required ? { required: true } : {},
|
|
4263
4279
|
...f.enabled ? {} : { enabled: false },
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
...f.
|
|
4280
|
+
// Length bounds only exist for free-text types; a choice control that
|
|
4281
|
+
// still carries them is stale state the decoder would drop anyway.
|
|
4282
|
+
...customFieldIsTextLike(f.type) && f.minLength !== null ? { minLength: f.minLength } : {},
|
|
4283
|
+
...customFieldIsTextLike(f.type) && f.maxLength !== null ? { maxLength: f.maxLength } : {},
|
|
4284
|
+
// A checkbox persists only "starts ticked"; unticked is the decoder's
|
|
4285
|
+
// default, so writing 'false' would be noise on every such field.
|
|
4286
|
+
...f.type === "checkbox" ? isCheckboxChecked(f.defaultValue) ? { defaultValue: CHECKBOX_CHECKED } : {} : f.defaultValue ? { defaultValue: f.defaultValue } : {},
|
|
4267
4287
|
...f.type === "select" ? { options: f.options } : {},
|
|
4268
4288
|
// Omitted for unconditional fields so the stored blob (and every
|
|
4269
4289
|
// pre-feature payload) stays byte-identical to what it was.
|
|
@@ -4761,6 +4781,8 @@ function shadowFor(style) {
|
|
|
4761
4781
|
AvailabilityOverrides,
|
|
4762
4782
|
BRANDING_EXPORT_FORMAT,
|
|
4763
4783
|
BRANDING_EXPORT_VERSION,
|
|
4784
|
+
CHECKBOX_CHECKED,
|
|
4785
|
+
CHECKBOX_UNCHECKED,
|
|
4764
4786
|
CUSTOM_CSS_MAX_LENGTH,
|
|
4765
4787
|
CUSTOM_FIELDS_MAX,
|
|
4766
4788
|
CUSTOM_FIELD_CONDITIONS_MAX,
|
|
@@ -4792,6 +4814,7 @@ function shadowFor(style) {
|
|
|
4792
4814
|
cloneBranding,
|
|
4793
4815
|
cloneCustomField,
|
|
4794
4816
|
customFieldContextFromMetadata,
|
|
4817
|
+
customFieldIsTextLike,
|
|
4795
4818
|
customFieldOperatorTakesValue,
|
|
4796
4819
|
customFieldOptionLabel,
|
|
4797
4820
|
customFieldText,
|
|
@@ -4810,6 +4833,7 @@ function shadowFor(style) {
|
|
|
4810
4833
|
fontStack,
|
|
4811
4834
|
fontWeightValue,
|
|
4812
4835
|
inputPadValue,
|
|
4836
|
+
isCheckboxChecked,
|
|
4813
4837
|
isDarkSurface,
|
|
4814
4838
|
isHexColor,
|
|
4815
4839
|
leaf,
|