@redneckz/wildless-cms-uni-blocks 0.14.652 → 0.14.653
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/bundle.umd.js +38 -7
- package/bundle/bundle.umd.min.js +1 -1
- 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/components/CreditForm/CreditForm.js +2 -0
- 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/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/components/CreditForm/CreditForm.js +3 -1
- 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/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/bundle.umd.js +38 -7
- package/mobile/bundle/bundle.umd.min.js +1 -1
- 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/components/CreditForm/CreditForm.js +2 -0
- 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/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/components/CreditForm/CreditForm.js +3 -1
- 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/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/components/CreditForm/CreditForm.tsx +4 -1
- package/mobile/src/components/CreditForm/CreditFormStatusTracker.tsx +3 -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/components/CreditForm/CreditForm.fixture.tsx +7 -0
- package/src/components/CreditForm/CreditForm.tsx +4 -1
- package/src/components/CreditForm/CreditFormStatusTracker.tsx +3 -0
- package/src/hooks/useInterval.ts +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const updateRefreshToken: () => () => void;
|
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
|
});
|
|
@@ -7486,6 +7516,7 @@
|
|
|
7486
7516
|
];
|
|
7487
7517
|
const CreditForm = JSX(({ className, ...rest }) => {
|
|
7488
7518
|
const [step, setStep] = useState(0);
|
|
7519
|
+
useEffect(updateRefreshToken, []);
|
|
7489
7520
|
const handleNextStep = useCallback(() => {
|
|
7490
7521
|
setStep((_) => Math.min(_ + 1, WIZARD_STEPS));
|
|
7491
7522
|
}, []);
|
|
@@ -9768,7 +9799,7 @@
|
|
|
9768
9799
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
9769
9800
|
});
|
|
9770
9801
|
|
|
9771
|
-
const packageVersion = "0.14.
|
|
9802
|
+
const packageVersion = "0.14.652";
|
|
9772
9803
|
|
|
9773
9804
|
exports.Blocks = Blocks;
|
|
9774
9805
|
exports.ContentPage = ContentPage;
|