@redneckz/wildless-cms-uni-blocks 0.14.676 → 0.14.677

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.
Files changed (73) hide show
  1. package/bundle/api/RetailAPI/updateRefreshToken.d.ts +1 -1
  2. package/bundle/bundle.umd.js +23 -12
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/hooks/useNavigator.d.ts +8 -0
  5. package/bundle/index.d.ts +1 -0
  6. package/dist/api/RetailAPI/updateRefreshToken.d.ts +1 -1
  7. package/dist/api/RetailAPI/updateRefreshToken.js +6 -10
  8. package/dist/api/RetailAPI/updateRefreshToken.js.map +1 -1
  9. package/dist/components/CreditCardForm/CreditCardForm.js +4 -1
  10. package/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  11. package/dist/components/CreditForm/CreditForm.js +4 -1
  12. package/dist/components/CreditForm/CreditForm.js.map +1 -1
  13. package/dist/hooks/useNavigator.d.ts +8 -0
  14. package/dist/hooks/useNavigator.js +13 -0
  15. package/dist/hooks/useNavigator.js.map +1 -0
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.js +3 -1
  18. package/dist/index.js.map +1 -1
  19. package/lib/api/RetailAPI/updateRefreshToken.d.ts +1 -1
  20. package/lib/api/RetailAPI/updateRefreshToken.js +6 -10
  21. package/lib/api/RetailAPI/updateRefreshToken.js.map +1 -1
  22. package/lib/components/CreditCardForm/CreditCardForm.js +4 -1
  23. package/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  24. package/lib/components/CreditForm/CreditForm.js +4 -1
  25. package/lib/components/CreditForm/CreditForm.js.map +1 -1
  26. package/lib/hooks/useNavigator.d.ts +8 -0
  27. package/lib/hooks/useNavigator.js +10 -0
  28. package/lib/hooks/useNavigator.js.map +1 -0
  29. package/lib/index.d.ts +1 -0
  30. package/lib/index.js +1 -0
  31. package/lib/index.js.map +1 -1
  32. package/mobile/bundle/api/RetailAPI/updateRefreshToken.d.ts +1 -1
  33. package/mobile/bundle/bundle.umd.js +23 -12
  34. package/mobile/bundle/bundle.umd.min.js +1 -1
  35. package/mobile/bundle/hooks/useNavigator.d.ts +8 -0
  36. package/mobile/bundle/index.d.ts +1 -0
  37. package/mobile/dist/api/RetailAPI/updateRefreshToken.d.ts +1 -1
  38. package/mobile/dist/api/RetailAPI/updateRefreshToken.js +6 -10
  39. package/mobile/dist/api/RetailAPI/updateRefreshToken.js.map +1 -1
  40. package/mobile/dist/components/CreditCardForm/CreditCardForm.js +4 -1
  41. package/mobile/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  42. package/mobile/dist/components/CreditForm/CreditForm.js +4 -1
  43. package/mobile/dist/components/CreditForm/CreditForm.js.map +1 -1
  44. package/mobile/dist/hooks/useNavigator.d.ts +8 -0
  45. package/mobile/dist/hooks/useNavigator.js +13 -0
  46. package/mobile/dist/hooks/useNavigator.js.map +1 -0
  47. package/mobile/dist/index.d.ts +1 -0
  48. package/mobile/dist/index.js +3 -1
  49. package/mobile/dist/index.js.map +1 -1
  50. package/mobile/lib/api/RetailAPI/updateRefreshToken.d.ts +1 -1
  51. package/mobile/lib/api/RetailAPI/updateRefreshToken.js +6 -10
  52. package/mobile/lib/api/RetailAPI/updateRefreshToken.js.map +1 -1
  53. package/mobile/lib/components/CreditCardForm/CreditCardForm.js +4 -1
  54. package/mobile/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  55. package/mobile/lib/components/CreditForm/CreditForm.js +4 -1
  56. package/mobile/lib/components/CreditForm/CreditForm.js.map +1 -1
  57. package/mobile/lib/hooks/useNavigator.d.ts +8 -0
  58. package/mobile/lib/hooks/useNavigator.js +10 -0
  59. package/mobile/lib/hooks/useNavigator.js.map +1 -0
  60. package/mobile/lib/index.d.ts +1 -0
  61. package/mobile/lib/index.js +1 -0
  62. package/mobile/lib/index.js.map +1 -1
  63. package/mobile/src/api/RetailAPI/updateRefreshToken.ts +6 -12
  64. package/mobile/src/components/CreditCardForm/CreditCardForm.tsx +6 -1
  65. package/mobile/src/components/CreditForm/CreditForm.tsx +6 -1
  66. package/mobile/src/hooks/useNavigator.ts +15 -0
  67. package/mobile/src/index.ts +1 -0
  68. package/package.json +1 -1
  69. package/src/api/RetailAPI/updateRefreshToken.ts +6 -12
  70. package/src/components/CreditCardForm/CreditCardForm.tsx +6 -1
  71. package/src/components/CreditForm/CreditForm.tsx +6 -1
  72. package/src/hooks/useNavigator.ts +15 -0
  73. package/src/index.ts +1 -0
@@ -1 +1 @@
1
- export declare const updateRefreshToken: () => () => void;
1
+ export declare const updateRefreshToken: (failCallback: () => void) => () => void;
@@ -6194,14 +6194,13 @@
6194
6194
  const renderBlocks = (info) => (jsx("div", { className: "flex gap-5xl grow basis-0", children: info.map((column, i) => renderBlocksColumn({ column, i })) }));
6195
6195
  const renderBlocksColumn = ({ column, i }) => column ? (jsx("div", { className: "flex flex-col gap-xl grow basis-0", children: column.map(({ title = '', description, additionalDescription, button }, key) => (jsxs("div", { children: [jsx(Headline, { title: title, description: description, headlineVersion: "XS", align: "text-left", isEmbedded: true }), additionalDescription ? (jsx("div", { className: "mt-xs opacity-80", children: jsx(Paragraph, { size: "text-m", font: "font-light", children: additionalDescription }) })) : null, jsx("div", { className: style({ 'mt-xl': Boolean(button?.text) }), children: renderButtonsSection([button]) })] }, String(key)))) }, `col-${String(i)}`)) : null;
6196
6196
 
6197
- const PORTAL_NATURAL_URL = '/';
6198
6197
  const UPDATING_INTERVAL = 60000 * 4;
6199
- const updateRefreshToken = () => {
6198
+ const updateRefreshToken = (failCallback) => {
6200
6199
  const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
6201
6200
  const accessToken = globalThis.sessionStorage?.getItem('accessToken');
6202
6201
  const taskId = globalThis.localStorage.getItem('taskId');
6203
6202
  if (!accessToken || !refreshToken || !taskId) {
6204
- globalThis.location.href = PORTAL_NATURAL_URL;
6203
+ failCallback();
6205
6204
  return () => null;
6206
6205
  }
6207
6206
  const updateTokenRequest = async () => {
@@ -6211,8 +6210,10 @@
6211
6210
  // eslint-disable-next-line camelcase
6212
6211
  access_token: accessToken,
6213
6212
  });
6214
- if (res) {
6215
- handleStatus(res.status);
6213
+ if (res?.status == 401) {
6214
+ failCallback();
6215
+ }
6216
+ if (res?.ok) {
6216
6217
  const data = await res.json();
6217
6218
  globalThis.sessionStorage.setItem('refreshToken', data.refresh_token);
6218
6219
  globalThis.sessionStorage.setItem('accessToken', data.access_token);
@@ -6222,10 +6223,15 @@
6222
6223
  const timer = setInterval(updateTokenRequest, UPDATING_INTERVAL);
6223
6224
  return () => clearInterval(timer);
6224
6225
  };
6225
- const handleStatus = (status) => {
6226
- if (status == 401) {
6227
- globalThis.location.href = PORTAL_NATURAL_URL;
6228
- }
6226
+
6227
+ function useNavigator() {
6228
+ return useNavigator._impl();
6229
+ }
6230
+ useNavigator._impl = () => ({
6231
+ assign: (url) => globalThis.location.assign(url),
6232
+ });
6233
+ useNavigator.setup = (impl) => {
6234
+ useNavigator._impl = impl;
6229
6235
  };
6230
6236
 
6231
6237
  const ProgressBar = JSX(({ step = 10, description, showPercentage = true }) => (jsxs("div", { children: [jsx("div", { className: "h-4 w-full bg-gray relative", children: jsx("div", { className: "h-4 bg-green", style: { width: `${step}%` } }) }), jsxs("div", { className: "relative", children: [showPercentage ? jsxs("div", { className: "absolute left-2/4 text-green", children: [step, "%"] }) : null, description ? jsx("div", { className: "text-right mr-4 text-gray", children: description }) : null] })] })));
@@ -7075,6 +7081,7 @@
7075
7081
  ],
7076
7082
  ];
7077
7083
 
7084
+ const PORTAL_NATURAL_URL$1 = '/';
7078
7085
  const WIZARD_STEPS$1 = 6;
7079
7086
  const WIZARD_TITLES$1 = [
7080
7087
  'Параметры карты',
@@ -7088,7 +7095,8 @@
7088
7095
  const [step, setStep] = useState(0);
7089
7096
  const formContainerRef = useRef(null);
7090
7097
  const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
7091
- useEffect(updateRefreshToken, []);
7098
+ const navigator = useNavigator();
7099
+ useEffect(() => updateRefreshToken(() => navigator.assign(PORTAL_NATURAL_URL$1)), []);
7092
7100
  const handleNextStep = useCallback(() => {
7093
7101
  setStep((_) => Math.min(_ + 1, WIZARD_STEPS$1));
7094
7102
  scrollToTop();
@@ -7861,6 +7869,7 @@
7861
7869
  ],
7862
7870
  ];
7863
7871
 
7872
+ const PORTAL_NATURAL_URL = '/';
7864
7873
  const WIZARD_STEPS = 5;
7865
7874
  const WIZARD_TITLES = [
7866
7875
  '',
@@ -7874,7 +7883,8 @@
7874
7883
  const [step, setStep] = useState(0);
7875
7884
  const formContainerRef = useRef(null);
7876
7885
  const scrollToTop = useCallback(() => formContainerRef?.current?.scrollIntoView({ behavior: 'smooth' }), [formContainerRef]);
7877
- useEffect(updateRefreshToken, []);
7886
+ const navigator = useNavigator();
7887
+ useEffect(() => updateRefreshToken(() => navigator.assign(PORTAL_NATURAL_URL)), []);
7878
7888
  const handleNextStep = useCallback(() => {
7879
7889
  setStep((_) => Math.min(_ + 1, WIZARD_STEPS));
7880
7890
  scrollToTop();
@@ -10295,7 +10305,7 @@
10295
10305
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
10296
10306
  });
10297
10307
 
10298
- const packageVersion = "0.14.675";
10308
+ const packageVersion = "0.14.676";
10299
10309
 
10300
10310
  exports.Blocks = Blocks;
10301
10311
  exports.ContentPage = ContentPage;
@@ -10306,6 +10316,7 @@
10306
10316
  exports.setup = setup;
10307
10317
  exports.setupHooks = setupHooks;
10308
10318
  exports.url = url;
10319
+ exports.useNavigator = useNavigator;
10309
10320
  exports.useRouter = useRouter;
10310
10321
 
10311
10322
  Object.defineProperty(exports, '__esModule', { value: true });