@redneckz/wildless-cms-uni-blocks 0.14.652 → 0.14.654
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/bundle/api/RetailAPI/updateRefreshToken.d.ts +1 -0
- package/bundle/api/RetailAPI/updateUserTask.d.ts +7 -0
- package/bundle/bundle.umd.js +60 -8
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +3 -0
- package/bundle/components/CreditForm/getZeroStepData.d.ts +3 -0
- package/bundle/hooks/useInterval.d.ts +1 -0
- package/dist/api/RetailAPI/doRequest.js +1 -0
- package/dist/api/RetailAPI/doRequest.js.map +1 -1
- package/dist/api/RetailAPI/updateRefreshToken.d.ts +1 -0
- package/dist/api/RetailAPI/updateRefreshToken.js +31 -0
- package/dist/api/RetailAPI/updateRefreshToken.js.map +1 -0
- package/dist/api/RetailAPI/updateUserTask.d.ts +7 -0
- package/dist/api/RetailAPI/updateUserTask.js.map +1 -1
- package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +3 -0
- package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/dist/components/CreditForm/CreditForm.js +9 -1
- package/dist/components/CreditForm/CreditForm.js.map +1 -1
- package/dist/components/CreditForm/CreditFormStatusTracker.js +8 -6
- package/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/dist/components/CreditForm/getCreditFormTaskData.js +3 -0
- package/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/dist/components/CreditForm/getZeroStepData.d.ts +3 -0
- package/dist/components/CreditForm/getZeroStepData.js +16 -0
- package/dist/components/CreditForm/getZeroStepData.js.map +1 -0
- package/dist/hooks/useInterval.d.ts +1 -0
- package/dist/hooks/useInterval.js +14 -0
- package/dist/hooks/useInterval.js.map +1 -0
- package/lib/api/RetailAPI/doRequest.js +1 -0
- package/lib/api/RetailAPI/doRequest.js.map +1 -1
- package/lib/api/RetailAPI/updateRefreshToken.d.ts +1 -0
- package/lib/api/RetailAPI/updateRefreshToken.js +28 -0
- package/lib/api/RetailAPI/updateRefreshToken.js.map +1 -0
- package/lib/api/RetailAPI/updateUserTask.d.ts +7 -0
- package/lib/api/RetailAPI/updateUserTask.js.map +1 -1
- package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +3 -0
- package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/lib/components/CreditForm/CreditForm.js +10 -2
- package/lib/components/CreditForm/CreditForm.js.map +1 -1
- package/lib/components/CreditForm/CreditFormStatusTracker.js +8 -6
- package/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/lib/components/CreditForm/getCreditFormTaskData.js +3 -0
- package/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/lib/components/CreditForm/getZeroStepData.d.ts +3 -0
- package/lib/components/CreditForm/getZeroStepData.js +13 -0
- package/lib/components/CreditForm/getZeroStepData.js.map +1 -0
- package/lib/hooks/useInterval.d.ts +1 -0
- package/lib/hooks/useInterval.js +11 -0
- package/lib/hooks/useInterval.js.map +1 -0
- package/mobile/bundle/api/RetailAPI/updateRefreshToken.d.ts +1 -0
- package/mobile/bundle/api/RetailAPI/updateUserTask.d.ts +7 -0
- package/mobile/bundle/bundle.umd.js +60 -8
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +3 -0
- package/mobile/bundle/components/CreditForm/getZeroStepData.d.ts +3 -0
- package/mobile/bundle/hooks/useInterval.d.ts +1 -0
- package/mobile/dist/api/RetailAPI/doRequest.js +1 -0
- package/mobile/dist/api/RetailAPI/doRequest.js.map +1 -1
- package/mobile/dist/api/RetailAPI/updateRefreshToken.d.ts +1 -0
- package/mobile/dist/api/RetailAPI/updateRefreshToken.js +31 -0
- package/mobile/dist/api/RetailAPI/updateRefreshToken.js.map +1 -0
- package/mobile/dist/api/RetailAPI/updateUserTask.d.ts +7 -0
- package/mobile/dist/api/RetailAPI/updateUserTask.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +3 -0
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/CreditForm/CreditForm.js +9 -1
- package/mobile/dist/components/CreditForm/CreditForm.js.map +1 -1
- package/mobile/dist/components/CreditForm/CreditFormStatusTracker.js +8 -6
- package/mobile/dist/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/mobile/dist/components/CreditForm/getCreditFormTaskData.js +3 -0
- package/mobile/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/mobile/dist/components/CreditForm/getZeroStepData.d.ts +3 -0
- package/mobile/dist/components/CreditForm/getZeroStepData.js +16 -0
- package/mobile/dist/components/CreditForm/getZeroStepData.js.map +1 -0
- package/mobile/dist/hooks/useInterval.d.ts +1 -0
- package/mobile/dist/hooks/useInterval.js +14 -0
- package/mobile/dist/hooks/useInterval.js.map +1 -0
- package/mobile/lib/api/RetailAPI/doRequest.js +1 -0
- package/mobile/lib/api/RetailAPI/doRequest.js.map +1 -1
- package/mobile/lib/api/RetailAPI/updateRefreshToken.d.ts +1 -0
- package/mobile/lib/api/RetailAPI/updateRefreshToken.js +28 -0
- package/mobile/lib/api/RetailAPI/updateRefreshToken.js.map +1 -0
- package/mobile/lib/api/RetailAPI/updateUserTask.d.ts +7 -0
- package/mobile/lib/api/RetailAPI/updateUserTask.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +3 -0
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/CreditForm/CreditForm.js +10 -2
- package/mobile/lib/components/CreditForm/CreditForm.js.map +1 -1
- package/mobile/lib/components/CreditForm/CreditFormStatusTracker.js +8 -6
- package/mobile/lib/components/CreditForm/CreditFormStatusTracker.js.map +1 -1
- package/mobile/lib/components/CreditForm/getCreditFormTaskData.js +3 -0
- package/mobile/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
- package/mobile/lib/components/CreditForm/getZeroStepData.d.ts +3 -0
- package/mobile/lib/components/CreditForm/getZeroStepData.js +13 -0
- package/mobile/lib/components/CreditForm/getZeroStepData.js.map +1 -0
- package/mobile/lib/hooks/useInterval.d.ts +1 -0
- package/mobile/lib/hooks/useInterval.js +11 -0
- package/mobile/lib/hooks/useInterval.js.map +1 -0
- package/mobile/src/api/RetailAPI/doRequest.ts +1 -0
- package/mobile/src/api/RetailAPI/updateRefreshToken.ts +42 -0
- package/mobile/src/api/RetailAPI/updateUserTask.ts +8 -0
- package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +3 -0
- package/mobile/src/components/CreditForm/CreditForm.tsx +11 -2
- package/mobile/src/components/CreditForm/CreditFormStatusTracker.tsx +3 -0
- package/mobile/src/components/CreditForm/getCreditFormTaskData.ts +3 -0
- package/mobile/src/components/CreditForm/getZeroStepData.ts +17 -0
- package/mobile/src/hooks/useInterval.ts +14 -0
- package/package.json +1 -1
- package/src/api/RetailAPI/doRequest.ts +1 -0
- package/src/api/RetailAPI/updateRefreshToken.ts +42 -0
- package/src/api/RetailAPI/updateUserTask.ts +8 -0
- package/src/components/ApplicationLeadForm/getInitialFormState.tsx +3 -0
- package/src/components/CreditForm/CreditForm.fixture.tsx +7 -0
- package/src/components/CreditForm/CreditForm.tsx +11 -2
- package/src/components/CreditForm/CreditFormStatusTracker.tsx +3 -0
- package/src/components/CreditForm/getCreditFormTaskData.ts +3 -0
- package/src/components/CreditForm/getZeroStepData.ts +17 -0
- package/src/hooks/useInterval.ts +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const updateRefreshToken: () => () => void;
|
|
@@ -24,6 +24,10 @@ declare type ParticipantIncome = {
|
|
|
24
24
|
};
|
|
25
25
|
value: number;
|
|
26
26
|
};
|
|
27
|
+
export declare type PaymentType = {
|
|
28
|
+
key: 'ANNUITY' | 'DIFFERENTIAL';
|
|
29
|
+
value: string;
|
|
30
|
+
};
|
|
27
31
|
export declare type Participant = {
|
|
28
32
|
birthDate?: string;
|
|
29
33
|
id: number;
|
|
@@ -88,6 +92,9 @@ export declare type Participant = {
|
|
|
88
92
|
paymentSystemTypeCd?: string;
|
|
89
93
|
classCard?: Option;
|
|
90
94
|
codeWord?: string;
|
|
95
|
+
loanAmount?: number;
|
|
96
|
+
creditPeriod?: number;
|
|
97
|
+
paymentTypeCd?: PaymentType;
|
|
91
98
|
};
|
|
92
99
|
export declare type UpdateUserTaskBody = {
|
|
93
100
|
sendToBank: boolean;
|
package/bundle/bundle.umd.js
CHANGED
|
@@ -2261,6 +2261,7 @@
|
|
|
2261
2261
|
credentials: 'include',
|
|
2262
2262
|
body: body ? JSON.stringify(body) : null,
|
|
2263
2263
|
});
|
|
2264
|
+
// TODO: add error handling
|
|
2264
2265
|
return isJSON(response) ? response.json() : response;
|
|
2265
2266
|
}
|
|
2266
2267
|
// TODO: Need delete isJSON
|
|
@@ -6778,6 +6779,33 @@
|
|
|
6778
6779
|
return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { className: "container grid grid-cols-12", children: [isFormFinished ? null : (jsx(CreditCardFormProgress, { stepsTitles: WIZARD_TITLES$1, step: step, totalSteps: WIZARD_STEPS$1 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditCardFormStep, { step: step, inputs: inputs, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished }, String(step)) })] }) }));
|
|
6779
6780
|
});
|
|
6780
6781
|
|
|
6782
|
+
const PORTAL_NATURAL_URL = '/';
|
|
6783
|
+
const UPDATING_INTERVAL = 60000 * 4;
|
|
6784
|
+
const updateRefreshToken = () => {
|
|
6785
|
+
const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
|
|
6786
|
+
const accessToken = globalThis.sessionStorage?.getItem('accessToken');
|
|
6787
|
+
const taskId = globalThis.localStorage.getItem('taskId');
|
|
6788
|
+
if (!accessToken || !refreshToken || !taskId) {
|
|
6789
|
+
globalThis.location.href = PORTAL_NATURAL_URL;
|
|
6790
|
+
return () => null;
|
|
6791
|
+
}
|
|
6792
|
+
const timer = setInterval(async () => {
|
|
6793
|
+
const res = await doRequest('/auth/refresh', 'POST', {
|
|
6794
|
+
// eslint-disable-next-line camelcase
|
|
6795
|
+
refresh_token: refreshToken,
|
|
6796
|
+
// eslint-disable-next-line camelcase
|
|
6797
|
+
access_token: accessToken,
|
|
6798
|
+
});
|
|
6799
|
+
if (res instanceof Response) {
|
|
6800
|
+
globalThis.location.href = PORTAL_NATURAL_URL;
|
|
6801
|
+
return;
|
|
6802
|
+
}
|
|
6803
|
+
sessionStorage.setItem('refreshToken', res.refresh_token);
|
|
6804
|
+
sessionStorage.setItem('accessToken', res.access_token);
|
|
6805
|
+
}, UPDATING_INTERVAL);
|
|
6806
|
+
return () => clearInterval(timer);
|
|
6807
|
+
};
|
|
6808
|
+
|
|
6781
6809
|
const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
|
|
6782
6810
|
const progress = useMemo(() => (step / totalSteps) * 100, [step, totalSteps]);
|
|
6783
6811
|
return (jsx("div", { className: "py-lg px-5xl bg-white col-span-12", children: jsxs("div", { children: [jsxs("span", { className: "font-bold mr-s", children: ["\u0428\u0430\u0433 ", step, " \u0438\u0437 ", totalSteps, "."] }), stepsTitles[step] || null, jsx(ProgressBar, { step: progress, showPercentage: false })] }) }));
|
|
@@ -6879,13 +6907,15 @@
|
|
|
6879
6907
|
for (const signalType of SIGNAL_TYPES) {
|
|
6880
6908
|
sendSignalToProcess({ signalType, taskId });
|
|
6881
6909
|
}
|
|
6882
|
-
const trackStatus = () =>
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6910
|
+
const trackStatus = () => taskId &&
|
|
6911
|
+
getTaskStatus({ taskId }).then((res) => {
|
|
6912
|
+
if (res.statusCd && res.statusCd !== STATUS_TYPE.process) {
|
|
6913
|
+
clearInterval(pullingInterval);
|
|
6914
|
+
setStatus(res.statusCd);
|
|
6915
|
+
}
|
|
6916
|
+
});
|
|
6888
6917
|
const pullingInterval = setInterval(trackStatus, 30000);
|
|
6918
|
+
return () => clearInterval(pullingInterval);
|
|
6889
6919
|
}, []);
|
|
6890
6920
|
return renderStatus(status);
|
|
6891
6921
|
});
|
|
@@ -7096,6 +7126,19 @@
|
|
|
7096
7126
|
};
|
|
7097
7127
|
};
|
|
7098
7128
|
|
|
7129
|
+
const PAYMENT_TYPE_DATA = {
|
|
7130
|
+
annuity: { key: 'ANNUITY', value: 'Аннуитетный' },
|
|
7131
|
+
differential: { key: 'DIFFERENTIAL', value: 'Дифференцированный ' },
|
|
7132
|
+
};
|
|
7133
|
+
const getZeroStepData = (formData) => {
|
|
7134
|
+
const { moneyValue, monthsValue, isAnnuity } = formData;
|
|
7135
|
+
return {
|
|
7136
|
+
loanAmount: moneyValue,
|
|
7137
|
+
creditPeriod: monthsValue,
|
|
7138
|
+
paymentTypeCd: PAYMENT_TYPE_DATA[isAnnuity ? 'annuity' : 'differential'],
|
|
7139
|
+
};
|
|
7140
|
+
};
|
|
7141
|
+
|
|
7099
7142
|
const getCreditFormTaskData = ({ participantId, taskId, profileId, formData, step = 0, }) => ({
|
|
7100
7143
|
sendToBank: true,
|
|
7101
7144
|
taskKind: 'UNITED',
|
|
@@ -7124,6 +7167,8 @@
|
|
|
7124
7167
|
});
|
|
7125
7168
|
const getCurrentStepData = (step, formData) => {
|
|
7126
7169
|
switch (step) {
|
|
7170
|
+
case 0:
|
|
7171
|
+
return getZeroStepData(formData);
|
|
7127
7172
|
case 1:
|
|
7128
7173
|
return getFirstStepData(formData);
|
|
7129
7174
|
case 2:
|
|
@@ -7486,6 +7531,7 @@
|
|
|
7486
7531
|
];
|
|
7487
7532
|
const CreditForm = JSX(({ className, ...rest }) => {
|
|
7488
7533
|
const [step, setStep] = useState(0);
|
|
7534
|
+
useEffect(updateRefreshToken, []);
|
|
7489
7535
|
const handleNextStep = useCallback(() => {
|
|
7490
7536
|
setStep((_) => Math.min(_ + 1, WIZARD_STEPS));
|
|
7491
7537
|
}, []);
|
|
@@ -7498,7 +7544,13 @@
|
|
|
7498
7544
|
const isStartStep = step === 0;
|
|
7499
7545
|
const [isFormFinished, setIsFormFinished] = useState(false);
|
|
7500
7546
|
return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { className: "container grid grid-cols-12", children: [isStartStep || isFormFinished ? null : (jsx(CreditFormProgress, { stepsTitles: WIZARD_TITLES, step: step, totalSteps: WIZARD_STEPS })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditFormStep, { step: step, inputs: inputs, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished, renderStep: isStartStep
|
|
7501
|
-
? ({ registerSubmit }) => (jsx(CalculatorCredit, { ...{
|
|
7547
|
+
? ({ registerSubmit, field }) => (jsx(CalculatorCredit, { ...{
|
|
7548
|
+
// TODO: Remove "as never"
|
|
7549
|
+
defaultParams: {
|
|
7550
|
+
sum: field('moneyValue').value,
|
|
7551
|
+
period: field('monthsValue').value,
|
|
7552
|
+
isAnnuity: field('isAnnuity').value,
|
|
7553
|
+
},
|
|
7502
7554
|
title: 'Калькулятор кредита',
|
|
7503
7555
|
footnote: 'Расчёт является предварительным. Точные условия будут предоставлены в отделении Банка.',
|
|
7504
7556
|
calcSource: {
|
|
@@ -9768,7 +9820,7 @@
|
|
|
9768
9820
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
9769
9821
|
});
|
|
9770
9822
|
|
|
9771
|
-
const packageVersion = "0.14.
|
|
9823
|
+
const packageVersion = "0.14.653";
|
|
9772
9824
|
|
|
9773
9825
|
exports.Blocks = Blocks;
|
|
9774
9826
|
exports.ContentPage = ContentPage;
|