@redneckz/wildless-cms-uni-blocks 0.14.563 → 0.14.565
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/bin/migration-scripts/0.14.563.js +29 -0
- package/bundle/bundle.umd.js +36 -35
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/CalculatorDeposit/{utils.d.ts → normalize.d.ts} +1 -0
- package/dist/components/CalculatorDeposit/CalculatorDeposit.js +5 -13
- package/dist/components/CalculatorDeposit/CalculatorDeposit.js.map +1 -1
- package/dist/components/CalculatorDeposit/{utils.d.ts → normalize.d.ts} +1 -0
- package/{mobile/dist/components/CalculatorDeposit/utils.js → dist/components/CalculatorDeposit/normalize.js} +12 -2
- package/dist/components/CalculatorDeposit/normalize.js.map +1 -0
- package/dist/hooks/useForm.js +1 -1
- package/dist/hooks/useForm.js.map +1 -1
- package/lib/components/CalculatorDeposit/CalculatorDeposit.js +4 -12
- package/lib/components/CalculatorDeposit/CalculatorDeposit.js.map +1 -1
- package/{mobile/bundle/components/CalculatorDeposit/utils.d.ts → lib/components/CalculatorDeposit/normalize.d.ts} +1 -0
- package/lib/components/CalculatorDeposit/{utils.js → normalize.js} +10 -1
- package/lib/components/CalculatorDeposit/normalize.js.map +1 -0
- package/lib/hooks/useForm.js +1 -1
- package/lib/hooks/useForm.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +36 -35
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/{lib/components/CalculatorDeposit/utils.d.ts → mobile/bundle/components/CalculatorDeposit/normalize.d.ts} +1 -0
- package/mobile/dist/components/CalculatorDeposit/CalculatorDeposit.js +5 -13
- package/mobile/dist/components/CalculatorDeposit/CalculatorDeposit.js.map +1 -1
- package/mobile/dist/components/CalculatorDeposit/normalize.d.ts +18 -0
- package/{dist/components/CalculatorDeposit/utils.js → mobile/dist/components/CalculatorDeposit/normalize.js} +12 -2
- package/mobile/dist/components/CalculatorDeposit/normalize.js.map +1 -0
- package/mobile/dist/hooks/useForm.js +1 -1
- package/mobile/dist/hooks/useForm.js.map +1 -1
- package/mobile/lib/components/CalculatorDeposit/CalculatorDeposit.js +4 -12
- package/mobile/lib/components/CalculatorDeposit/CalculatorDeposit.js.map +1 -1
- package/mobile/lib/components/CalculatorDeposit/normalize.d.ts +18 -0
- package/mobile/lib/components/CalculatorDeposit/{utils.js → normalize.js} +10 -1
- package/mobile/lib/components/CalculatorDeposit/normalize.js.map +1 -0
- package/mobile/lib/hooks/useForm.js +1 -1
- package/mobile/lib/hooks/useForm.js.map +1 -1
- package/mobile/src/components/CalculatorDeposit/CalculatorDeposit.tsx +5 -23
- package/mobile/src/components/CalculatorDeposit/{utils.tsx → normalize.tsx} +11 -0
- package/mobile/src/hooks/useForm.ts +1 -1
- package/package.json +2 -2
- package/src/components/CalculatorDeposit/CalculatorDeposit.tsx +5 -23
- package/src/components/CalculatorDeposit/{utils.tsx → normalize.tsx} +11 -0
- package/src/hooks/useForm.ts +1 -1
- package/dist/components/CalculatorDeposit/utils.js.map +0 -1
- package/lib/components/CalculatorDeposit/utils.js.map +0 -1
- package/mobile/dist/components/CalculatorDeposit/utils.d.ts +0 -17
- package/mobile/dist/components/CalculatorDeposit/utils.js.map +0 -1
- package/mobile/lib/components/CalculatorDeposit/utils.d.ts +0 -17
- package/mobile/lib/components/CalculatorDeposit/utils.js.map +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const description = 'v0.14.563';
|
|
2
|
+
import { traversePageBlocks } from '../utils.js';
|
|
3
|
+
|
|
4
|
+
export default traversePageBlocks(adjustDataAttributes);
|
|
5
|
+
|
|
6
|
+
function adjustDataAttributes(block) {
|
|
7
|
+
const content = block?.content;
|
|
8
|
+
|
|
9
|
+
if (content) {
|
|
10
|
+
findAttributes(content);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function findAttributes(object) {
|
|
15
|
+
for (const [key, val] of Object.entries(object)) {
|
|
16
|
+
if (typeof val === 'object' && val !== null) {
|
|
17
|
+
findAttributes(val);
|
|
18
|
+
}
|
|
19
|
+
const mindbox = val?.find?.((_) => _?.aspectName === 'mindboxEvent');
|
|
20
|
+
const snowplow = val?.find?.((_) => _?.aspectName === 'snowplowEvent');
|
|
21
|
+
|
|
22
|
+
if (key === 'data' && mindbox && !snowplow) {
|
|
23
|
+
val.push({
|
|
24
|
+
aspectName: 'snowplowEvent',
|
|
25
|
+
params: mindbox.params,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
package/bundle/bundle.umd.js
CHANGED
|
@@ -1100,7 +1100,7 @@
|
|
|
1100
1100
|
},
|
|
1101
1101
|
];
|
|
1102
1102
|
};
|
|
1103
|
-
const shellowCompare = (a, b) => Object.keys({ ...a, ...b }).every((key) => a[key] === b[key]);
|
|
1103
|
+
const shellowCompare = (a, b) => a && b && Object.keys({ ...a, ...b }).every((key) => a[key] === b[key]);
|
|
1104
1104
|
|
|
1105
1105
|
const ApplicationFormLayout = JSX((props) => {
|
|
1106
1106
|
const { className, title, children, ...rest } = props;
|
|
@@ -3197,6 +3197,37 @@
|
|
|
3197
3197
|
|
|
3198
3198
|
const isRubles = (currency = 'rub') => currency === 'rub';
|
|
3199
3199
|
|
|
3200
|
+
const normalizeDepositParams = (rows) => (_) => !rows
|
|
3201
|
+
? _
|
|
3202
|
+
: {
|
|
3203
|
+
..._,
|
|
3204
|
+
...normalizeReplenishWithdrawn(_),
|
|
3205
|
+
...normalizeMoneyValue(_, rows),
|
|
3206
|
+
...normalizeMonthValue(_, rows),
|
|
3207
|
+
...normalizeCurrency(_, rows),
|
|
3208
|
+
};
|
|
3209
|
+
const normalizeMonthValue = (_, rows) => {
|
|
3210
|
+
const { minMonths, maxMonths } = getRangeByKeys(['minMonths', 'maxMonths'], getRows(rows, _?.currency));
|
|
3211
|
+
const monthsValue = _.monthsValue || Math.round((minMonths + maxMonths) / 2);
|
|
3212
|
+
return { monthsValue: clamp(monthsValue, minMonths, maxMonths) };
|
|
3213
|
+
};
|
|
3214
|
+
const normalizeMoneyValue = (_, rows) => {
|
|
3215
|
+
const { minSum, maxSum } = getRangeByKeys(['minSum', 'maxSum'], getRows(rows, _?.currency));
|
|
3216
|
+
const moneyValue = _.moneyValue || minSum;
|
|
3217
|
+
return { moneyValue: clamp(moneyValue, minSum, maxSum) };
|
|
3218
|
+
};
|
|
3219
|
+
const normalizeCurrency = (_, rows) => ({
|
|
3220
|
+
currency: _?.currency ?? rows?.map((row) => row.currency)?.[0],
|
|
3221
|
+
});
|
|
3222
|
+
const normalizeReplenishWithdrawn = (_) => {
|
|
3223
|
+
const _isRubles = isRubles(_?.currency?.key);
|
|
3224
|
+
return { isReplenish: _isRubles && _?.isReplenish, isWithdrawn: _isRubles && _?.isWithdrawn };
|
|
3225
|
+
};
|
|
3226
|
+
const getRows = (rows, currencyValue) => {
|
|
3227
|
+
const { rates } = rows?.find((_) => _?.currency.key === currencyValue?.key) ?? {};
|
|
3228
|
+
return rates ?? rows?.[0]?.rates;
|
|
3229
|
+
};
|
|
3230
|
+
|
|
3200
3231
|
const renderRegistrationType = (props) => renderBinaryRadioButtonGroup({
|
|
3201
3232
|
...props,
|
|
3202
3233
|
items: [
|
|
@@ -3249,28 +3280,6 @@
|
|
|
3249
3280
|
};
|
|
3250
3281
|
const renderSeparator = (isShow = false) => isShow ? jsx("div", { className: "border-b border-main-divider w-full" }) : null;
|
|
3251
3282
|
|
|
3252
|
-
const normalizeMonthValue = (_, rows) => {
|
|
3253
|
-
const { minMonths, maxMonths } = getRangeByKeys(['minMonths', 'maxMonths'], getRows(rows, _?.currency));
|
|
3254
|
-
const monthsValue = _.monthsValue || Math.round((minMonths + maxMonths) / 2);
|
|
3255
|
-
return { monthsValue: clamp(monthsValue, minMonths, maxMonths) };
|
|
3256
|
-
};
|
|
3257
|
-
const normalizeMoneyValue = (_, rows) => {
|
|
3258
|
-
const { minSum, maxSum } = getRangeByKeys(['minSum', 'maxSum'], getRows(rows, _?.currency));
|
|
3259
|
-
const moneyValue = _.moneyValue || minSum;
|
|
3260
|
-
return { moneyValue: clamp(moneyValue, minSum, maxSum) };
|
|
3261
|
-
};
|
|
3262
|
-
const normalizeCurrency = (_, rows) => ({
|
|
3263
|
-
currency: _?.currency ?? rows?.map((row) => row.currency)?.[0],
|
|
3264
|
-
});
|
|
3265
|
-
const normalizeReplenishWithdrawn = (_) => {
|
|
3266
|
-
const _isRubles = isRubles(_?.currency?.key);
|
|
3267
|
-
return { isReplenish: _isRubles && _?.isReplenish, isWithdrawn: _isRubles && _?.isWithdrawn };
|
|
3268
|
-
};
|
|
3269
|
-
const getRows = (rows, currencyValue) => {
|
|
3270
|
-
const { rates } = rows?.find((_) => _?.currency.key === currencyValue?.key) ?? {};
|
|
3271
|
-
return rates ?? rows?.[0]?.rates;
|
|
3272
|
-
};
|
|
3273
|
-
|
|
3274
3283
|
const MAP = {
|
|
3275
3284
|
isMonthlyInterestPayment: 'isMonthlyInterestPayment',
|
|
3276
3285
|
isRemoteRegistration: 'isRemoteRegistration',
|
|
@@ -3287,15 +3296,7 @@
|
|
|
3287
3296
|
const CalculatorDeposit = UniBlock(({ className, title, calcSource, buttons = [], footnote = '', paramsViewSettings, defaultParams, ...rest }) => {
|
|
3288
3297
|
const { rows } = calcSource ?? {};
|
|
3289
3298
|
const currencyOptions = rows?.map((_) => _.currency) ?? [DEFAULT_CURRENCY];
|
|
3290
|
-
const normalize = useCallback((
|
|
3291
|
-
? _
|
|
3292
|
-
: {
|
|
3293
|
-
..._,
|
|
3294
|
-
...normalizeReplenishWithdrawn(_),
|
|
3295
|
-
...normalizeMoneyValue(_, rows),
|
|
3296
|
-
...normalizeMonthValue(_, rows),
|
|
3297
|
-
...normalizeCurrency(_, rows),
|
|
3298
|
-
}, [rows]);
|
|
3299
|
+
const normalize = useCallback(normalizeDepositParams(rows), [rows]);
|
|
3299
3300
|
const [userInputParams, { field }] = useForm({
|
|
3300
3301
|
moneyValue: getMoneyDefaultValue(defaultParams, DEPOSIT_DEFAULT_SUM),
|
|
3301
3302
|
monthsValue: getMonthsDefaultValue(defaultParams, DEPOSIT_DEFAULT_MONTHS),
|
|
@@ -3311,7 +3312,7 @@
|
|
|
3311
3312
|
const row = getRows(rows, currencyValue);
|
|
3312
3313
|
const calcParams = getDepositCalculatorParams(userInputParams, row, paramsViewSettings);
|
|
3313
3314
|
const { rate, income, finalSum, type = '' } = calcParams;
|
|
3314
|
-
const handleDefaultParamsCals = () => {
|
|
3315
|
+
const handleDefaultParamsCals = useCallback(() => {
|
|
3315
3316
|
setDefaultParamsCalc({
|
|
3316
3317
|
field,
|
|
3317
3318
|
defParams: getDefaultParamsMax(row, isNewClient),
|
|
@@ -3319,7 +3320,7 @@
|
|
|
3319
3320
|
monthsValue: 'minMonths',
|
|
3320
3321
|
map: MAP,
|
|
3321
3322
|
});
|
|
3322
|
-
};
|
|
3323
|
+
}, [field, rows]);
|
|
3323
3324
|
useEffect(() => {
|
|
3324
3325
|
if (!isDefaultParams(defaultParams) && row) {
|
|
3325
3326
|
handleDefaultParamsCals();
|
|
@@ -6565,7 +6566,7 @@
|
|
|
6565
6566
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
6566
6567
|
});
|
|
6567
6568
|
|
|
6568
|
-
const packageVersion = "0.14.
|
|
6569
|
+
const packageVersion = "0.14.564";
|
|
6569
6570
|
|
|
6570
6571
|
exports.Blocks = Blocks;
|
|
6571
6572
|
exports.ContentPage = ContentPage;
|