@dartcom/ui-kit 10.2.35 → 10.3.1

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.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { CustomCardProps } from './types';
3
- declare const CustomCard: React.FC<React.PropsWithChildren<CustomCardProps>>;
2
+ import { Props } from './types';
3
+ declare const CustomCard: React.FC<React.PropsWithChildren<Props>>;
4
4
  export default CustomCard;
5
5
  //# sourceMappingURL=card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CA6BlE,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CA4BxD,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { SxFunction } from '../../lib/types';
2
- export type CustomCardProps = {
2
+ export type Props = {
3
3
  sx?: SxFunction;
4
4
  };
5
5
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/card/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,UAAU,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/card/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,CAAC,EAAE,UAAU,CAAC;CACjB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import * as yup from 'yup';
2
- export declare const getStringSchema: <T extends string>() => yup.StringSchema<T | undefined, yup.AnyObject, undefined, "">;
3
- export declare const getStringRequiredSchema: <T extends string>(message?: string) => yup.StringSchema<T, yup.AnyObject, undefined, "">;
2
+ export declare const getStringSchema: <T extends string = string>() => yup.StringSchema<T | undefined, yup.AnyObject, undefined, "">;
3
+ export declare const getStringRequiredSchema: <T extends string = string>(message?: string) => yup.StringSchema<T, yup.AnyObject, undefined, "">;
4
4
  export declare const numberSchema: yup.NumberSchema<number | undefined, yup.AnyObject, undefined, "">;
5
5
  export declare const numberRequiredSchema: yup.NumberSchema<number, yup.AnyObject, undefined, "">;
6
6
  export declare const arraySchema: yup.ArraySchema<any[] | undefined, yup.AnyObject, undefined, "">;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/constants/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAI3B,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,oEAAsB,CAAC;AACvE,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,MAAM,EACtD,gBAAyB,sDACgB,CAAC;AAE5C,eAAO,MAAM,YAAY,oEAAe,CAAC;AACzC,eAAO,MAAM,oBAAoB,wDAAyC,CAAC;AAE3E,eAAO,MAAM,WAAW,kEAAc,CAAC;AAEvC,eAAO,MAAM,UAAU,gEAAa,CAAC;AACrC,eAAO,MAAM,kBAAkB,oDAAuC,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/constants/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAI3B,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,oEAAsB,CAAC;AAChF,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,MAAM,GAAG,MAAM,EAC/D,gBAAyB,sDACgB,CAAC;AAE5C,eAAO,MAAM,YAAY,oEAAe,CAAC;AACzC,eAAO,MAAM,oBAAoB,wDAAyC,CAAC;AAE3E,eAAO,MAAM,WAAW,kEAAc,CAAC;AAEvC,eAAO,MAAM,UAAU,gEAAa,CAAC;AACrC,eAAO,MAAM,kBAAkB,oDAAuC,CAAC"}
package/dist/index.cjs CHANGED
@@ -16471,7 +16471,7 @@ const encodeString = (string) => {
16471
16471
  return encoded;
16472
16472
  };
16473
16473
  const getUrlencodedBody = (body) => {
16474
- const urlencodedBody = Object.keys(body).reduce((request, key, index) => `${request}${index === 0 ? '' : '&'}${key}=${body[key]}`, '');
16474
+ const urlencodedBody = new URLSearchParams(Object.entries(body).map(([key, value]) => [key, String(value)])).toString();
16475
16475
  return urlencodedBody;
16476
16476
  };
16477
16477
  const showSnackbar = ({ variant, message, }) => {
@@ -16531,9 +16531,30 @@ const getEntityNames = ({ entity, names, }) => {
16531
16531
  return layerNames;
16532
16532
  };
16533
16533
  const getImageSrc = (path) => {
16534
- const imageSrc = `${"https://dalganmap.ru/api-image/images"}/${path}`;
16534
+ const imageSrc = `${"$VITE_API_HOST/api-image/images"}/${path}`;
16535
16535
  return imageSrc;
16536
16536
  };
16537
+ const loadState = (name) => {
16538
+ try {
16539
+ const serializedState = localStorage.getItem(name);
16540
+ return serializedState ? JSON.parse(serializedState) : null;
16541
+ }
16542
+ catch {
16543
+ return null;
16544
+ }
16545
+ };
16546
+ const saveState = (name, state) => {
16547
+ try {
16548
+ const serializedState = JSON.stringify(state);
16549
+ localStorage.setItem(name, serializedState);
16550
+ }
16551
+ catch {
16552
+ return;
16553
+ }
16554
+ };
16555
+ const removeState = (name) => {
16556
+ localStorage.removeItem(name);
16557
+ };
16537
16558
 
16538
16559
  var niceErrors = {
16539
16560
  0: "Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",
@@ -17833,6 +17854,14 @@ function _endAction(runInfo) {
17833
17854
  }
17834
17855
  globalState.suppressReactionErrors = false;
17835
17856
  }
17857
+ function allowStateChanges(allowStateChanges, func) {
17858
+ var prev = allowStateChangesStart(allowStateChanges);
17859
+ try {
17860
+ return func();
17861
+ } finally {
17862
+ allowStateChangesEnd(prev);
17863
+ }
17864
+ }
17836
17865
  function allowStateChangesStart(allowStateChanges) {
17837
17866
  var prev = globalState.allowStateChanges;
17838
17867
  globalState.allowStateChanges = allowStateChanges;
@@ -19298,6 +19327,70 @@ function createSchedulerFromOptions(opts) {
19298
19327
  return setTimeout(f, opts.delay);
19299
19328
  } : run;
19300
19329
  }
19330
+ function reaction(expression, effect, opts) {
19331
+ var _opts$name2, _opts4, _opts5;
19332
+ if (opts === void 0) {
19333
+ opts = EMPTY_OBJECT;
19334
+ }
19335
+ if (process.env.NODE_ENV !== "production") {
19336
+ if (!isFunction$1(expression) || !isFunction$1(effect)) {
19337
+ die("First and second argument to reaction should be functions");
19338
+ }
19339
+ if (!isPlainObject$2(opts)) {
19340
+ die("Third argument of reactions should be an object");
19341
+ }
19342
+ }
19343
+ var name = (_opts$name2 = opts.name) != null ? _opts$name2 : process.env.NODE_ENV !== "production" ? "Reaction@" + getNextId() : "Reaction";
19344
+ var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect);
19345
+ var runSync = !opts.scheduler && !opts.delay;
19346
+ var scheduler = createSchedulerFromOptions(opts);
19347
+ var firstTime = true;
19348
+ var isScheduled = false;
19349
+ var value;
19350
+ var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer["default"];
19351
+ var r = new Reaction(name, function () {
19352
+ if (firstTime || runSync) {
19353
+ reactionRunner();
19354
+ } else if (!isScheduled) {
19355
+ isScheduled = true;
19356
+ scheduler(reactionRunner);
19357
+ }
19358
+ }, opts.onError, opts.requiresObservable);
19359
+ function reactionRunner() {
19360
+ isScheduled = false;
19361
+ if (r.isDisposed) {
19362
+ return;
19363
+ }
19364
+ var changed = false;
19365
+ var oldValue = value;
19366
+ r.track(function () {
19367
+ var nextValue = allowStateChanges(false, function () {
19368
+ return expression(r);
19369
+ });
19370
+ changed = firstTime || !equals(value, nextValue);
19371
+ value = nextValue;
19372
+ });
19373
+ if (firstTime && opts.fireImmediately) {
19374
+ effectAction(value, oldValue, r);
19375
+ } else if (!firstTime && changed) {
19376
+ effectAction(value, oldValue, r);
19377
+ }
19378
+ firstTime = false;
19379
+ }
19380
+ if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {
19381
+ r.schedule_();
19382
+ }
19383
+ return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);
19384
+ }
19385
+ function wrapErrorHandler(errorHandler, baseFn) {
19386
+ return function () {
19387
+ try {
19388
+ return baseFn.apply(this, arguments);
19389
+ } catch (e) {
19390
+ errorHandler.call(this, e);
19391
+ }
19392
+ };
19393
+ }
19301
19394
 
19302
19395
  var ON_BECOME_OBSERVED = "onBO";
19303
19396
  var ON_BECOME_UNOBSERVED = "onBUO";
@@ -21990,6 +22083,12 @@ const alertStore = new AlertStore();
21990
22083
  class AuthStore {
21991
22084
  constructor() {
21992
22085
  makeAutoObservable(this);
22086
+ reaction(() => this.isUnauthorized, (value) => {
22087
+ if (value) {
22088
+ removeState('access_token');
22089
+ removeState('token_type');
22090
+ }
22091
+ });
21993
22092
  }
21994
22093
  _isUnauthorized = false;
21995
22094
  get isUnauthorized() {
@@ -22053,10 +22152,14 @@ class ApiService {
22053
22152
  this.setupInterceptors();
22054
22153
  }
22055
22154
  setupInterceptors() {
22056
- // Interceptor для запросов
22057
22155
  this.client.interceptors.request.use((config) => {
22058
22156
  rootStore.authStore.isUnauthorized = false;
22059
22157
  const headers = this.config?.getHeaders?.();
22158
+ const access_token = loadState('access_token');
22159
+ const token_type = loadState('token_type');
22160
+ if (access_token && token_type) {
22161
+ config.headers['Authorization'] = `${token_type} ${access_token}`;
22162
+ }
22060
22163
  if (headers) {
22061
22164
  Object.entries(headers).forEach(([key, value]) => {
22062
22165
  config.headers[key] = value;
@@ -22070,7 +22173,6 @@ class ApiService {
22070
22173
  });
22071
22174
  return Promise.reject(error);
22072
22175
  });
22073
- // Interceptor для ответов с обработкой ошибок
22074
22176
  this.client.interceptors.response.use((response) => response, (error) => {
22075
22177
  showSnackbar({
22076
22178
  message: error.message,
@@ -24962,20 +25064,94 @@ function useMutation(options, queryClient) {
24962
25064
  }
24963
25065
 
24964
25066
  const useGetUser = () => {
24965
- return useQuery({
25067
+ const query = useQuery({
24966
25068
  queryKey: ['user'],
24967
25069
  queryFn: async () => {
24968
25070
  const response = await GlobalConfig.instance.apiService.get({
24969
25071
  url: `user/`,
25072
+ });
25073
+ return response;
25074
+ },
25075
+ });
25076
+ return query;
25077
+ };
25078
+ const useLazyGetUser = () => {
25079
+ const mutation = useMutation({
25080
+ mutationKey: ['user'],
25081
+ mutationFn: async () => {
25082
+ const response = await GlobalConfig.instance.apiService.get({
25083
+ url: `user/`,
25084
+ });
25085
+ return response;
25086
+ },
25087
+ });
25088
+ return mutation;
25089
+ };
25090
+
25091
+ const useShowSnackbar = () => {
25092
+ const { enqueueSnackbar } = useSnackbar();
25093
+ const showSnackbar = ({ variant, message, }) => {
25094
+ enqueueSnackbar({
25095
+ variant,
25096
+ message,
25097
+ anchorOrigin: {
25098
+ vertical: 'top',
25099
+ horizontal: 'right',
25100
+ },
25101
+ autoHideDuration: 3000,
25102
+ hideIconVariant: true,
25103
+ });
25104
+ };
25105
+ return showSnackbar;
25106
+ };
25107
+
25108
+ const useShowErrorSnackbar = () => {
25109
+ const showSnackbar = useShowSnackbar();
25110
+ const showErrorSnackbar = (error) => {
25111
+ const { response } = error;
25112
+ if (response) {
25113
+ const { data } = response;
25114
+ if (data) {
25115
+ const { detail } = data;
25116
+ if (detail) {
25117
+ detail.forEach((message) => {
25118
+ showSnackbar({
25119
+ variant: 'error',
25120
+ message,
25121
+ });
25122
+ });
25123
+ }
25124
+ }
25125
+ }
25126
+ };
25127
+ return showErrorSnackbar;
25128
+ };
25129
+
25130
+ const useSignIn = () => {
25131
+ const mutation = useMutation({
25132
+ mutationKey: ['sign-in-mutation'],
25133
+ mutationFn: async ({ body: { username, password } }) => {
25134
+ const body = getUrlencodedBody({
25135
+ username,
25136
+ password: encodeString(password),
25137
+ });
25138
+ const response = await GlobalConfig.instance.apiService.post({
25139
+ url: 'token',
25140
+ body,
24970
25141
  config: {
24971
- // TODO Заглушка
24972
- baseURL: 'http://89.108.118.23:2292',
25142
+ headers: {
25143
+ 'Content-Type': 'application/x-www-form-urlencoded',
25144
+ },
24973
25145
  },
24974
25146
  });
24975
25147
  return response;
24976
25148
  },
24977
- staleTime: 5 * 60 * 1000,
25149
+ onSuccess: ({ access_token, token_type }) => {
25150
+ saveState('access_token', access_token);
25151
+ saveState('token_type', token_type);
25152
+ },
24978
25153
  });
25154
+ return mutation;
24979
25155
  };
24980
25156
 
24981
25157
  if (!React.useState) {
@@ -26670,46 +26846,7 @@ const DartcomProviders = ({ children, configOptions, themeOptions }) => {
26670
26846
  return (jsxRuntime.jsx(SnackbarProvider, { children: jsxRuntime.jsx(QueryProvider, { children: jsxRuntime.jsx(DartcomMobxProvider, { children: jsxRuntime.jsx(DartcomThemeProvider, { themeOptions: themeOptions, children: jsxRuntime.jsx(Provider, { children: jsxRuntime.jsx(MapProvider, { children: jsxRuntime.jsx(DartcomInitializeProvider, { configOptions: configOptions, children: children }) }) }) }) }) }) }));
26671
26847
  };
26672
26848
 
26673
- const useShowSnackbar = () => {
26674
- const { enqueueSnackbar } = useSnackbar();
26675
- const showSnackbar = ({ variant, message, }) => {
26676
- enqueueSnackbar({
26677
- variant,
26678
- message,
26679
- anchorOrigin: {
26680
- vertical: 'top',
26681
- horizontal: 'right',
26682
- },
26683
- autoHideDuration: 3000,
26684
- hideIconVariant: true,
26685
- });
26686
- };
26687
- return showSnackbar;
26688
- };
26689
-
26690
- const useShowErrorSnackbar = () => {
26691
- const showSnackbar = useShowSnackbar();
26692
- const showErrorSnackbar = (error) => {
26693
- const { response } = error;
26694
- if (response) {
26695
- const { data } = response;
26696
- if (data) {
26697
- const { detail } = data;
26698
- if (detail) {
26699
- detail.forEach((message) => {
26700
- showSnackbar({
26701
- variant: 'error',
26702
- message,
26703
- });
26704
- });
26705
- }
26706
- }
26707
- }
26708
- };
26709
- return showErrorSnackbar;
26710
- };
26711
-
26712
- const useLogout = () => {
26849
+ const useSignOut = () => {
26713
26850
  const showErrorSnackbar = useShowErrorSnackbar();
26714
26851
  return useMutation({
26715
26852
  mutationKey: ['logout-mutation'],
@@ -26728,28 +26865,6 @@ const useLogout = () => {
26728
26865
  });
26729
26866
  };
26730
26867
 
26731
- const useSignIn = () => {
26732
- return useMutation({
26733
- mutationKey: ['sign-in-mutation'],
26734
- mutationFn: async ({ body: { username, password } }) => {
26735
- const body = getUrlencodedBody({
26736
- username,
26737
- password: encodeString(password),
26738
- });
26739
- const response = await GlobalConfig.instance.apiService.post({
26740
- url: 'token',
26741
- body,
26742
- config: {
26743
- headers: {
26744
- 'Content-Type': 'application/x-www-form-urlencoded',
26745
- },
26746
- },
26747
- });
26748
- return response;
26749
- },
26750
- });
26751
- };
26752
-
26753
26868
  exports.API_METHODS = void 0;
26754
26869
  (function (API_METHODS) {
26755
26870
  API_METHODS["GET"] = "GET";
@@ -29522,12 +29637,11 @@ var alertDialog = observer(AlertDialog);
29522
29637
 
29523
29638
  const CustomCard = ({ children, sx, ...props }) => {
29524
29639
  return (jsxRuntime.jsx(material.Box, { ...props, sx: (theme) => {
29525
- const { spacing } = theme;
29640
+ const { spacing, shadows } = theme;
29526
29641
  return {
29527
- px: spacing(2),
29528
- py: spacing(2),
29529
- borderRadius: '10px',
29530
- boxShadow: '0px 8px 24px 0px rgba(0,0,0,0.3)',
29642
+ p: spacing(2),
29643
+ borderRadius: '12px',
29644
+ boxShadow: shadows,
29531
29645
  maxHeight: '85vh',
29532
29646
  maxWidth: '85vw',
29533
29647
  overflowX: 'auto',
@@ -39317,9 +39431,9 @@ const loggerService = new LoggerService();
39317
39431
 
39318
39432
  const tile_size = 256;
39319
39433
  const sourceUrl = {
39320
- [exports.TangramSourceNames.TILE]: `${"https://dalganmap.ru/api"}/tiles/get_tile/{z}/{x}/{y}.mvt`,
39321
- [exports.TangramSourceNames.NATURE_TILE]: `${"https://dalganmap.ru/api"}/tiles/get_nature_tile/{z}/{x}/{y}.mvt`,
39322
- [exports.TangramSourceNames.MSK]: `${"$VITE_API_HOST:$VITE_API_PORT"}/tiles/get_tile/{z}/{x}/{y}.mvt`,
39434
+ [exports.TangramSourceNames.TILE]: `${"$VITE_API_HOST/api"}/tiles/get_tile/{z}/{x}/{y}.mvt`,
39435
+ [exports.TangramSourceNames.NATURE_TILE]: `${"$VITE_API_HOST/api"}/tiles/get_nature_tile/{z}/{x}/{y}.mvt`,
39436
+ [exports.TangramSourceNames.MSK]: `${"$VITE_API_HOST/api"}/tiles/get_tile/{z}/{x}/{y}.mvt`,
39323
39437
  };
39324
39438
 
39325
39439
  var data = { global:{ links:{ getIsConstruction:"function (feature) {\n const { construction } = feature;\n\n return construction;\n}\n",
@@ -46794,37 +46908,39 @@ const AuthLayout = ({ children }) => {
46794
46908
  }, children: jsxRuntime.jsx(CustomCard, { children: children }) }) }));
46795
46909
  };
46796
46910
 
46797
- const schema = create$3().shape({
46798
- username: create$6().required(),
46799
- password: create$6().required(),
46800
- });
46911
+ const defaultValues = {
46912
+ username: '',
46913
+ password: '',
46914
+ };
46801
46915
 
46802
46916
  const r$1=(t,r,o)=>{if(t&&"reportValidity"in t){const s=get(o,r);t.setCustomValidity(s&&s.message||""),t.reportValidity();}},o$1=(e,t)=>{for(const o in t.fields){const s=t.fields[o];s&&s.ref&&"reportValidity"in s.ref?r$1(s.ref,o,e):s&&s.refs&&s.refs.forEach(t=>r$1(t,o,e));}},s=(r,s)=>{s.shouldUseNativeValidation&&o$1(r,s);const n={};for(const o in r){const f=get(s.fields,o),c=Object.assign(r[o]||{},{ref:f&&f.ref});if(i(s.names||Object.keys(r),o)){const r=Object.assign({},get(n,o));set(r,"root",c),set(n,o,r);}else set(n,o,c);}return n},i=(e,t)=>{const r=n(t);return e.some(e=>n(e).match(`^${r}\\.\\d+`))};function n(e){return e.replace(/\]|\[/g,"")}
46803
46917
 
46804
46918
  function o(o,n,s$1){return void 0===s$1&&(s$1={}),function(a,i,c){try{return Promise.resolve(function(t,r){try{var u=(null!=n&&n.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(o["sync"===s$1.mode?"validateSync":"validate"](a,Object.assign({abortEarly:!1},n,{context:i}))).then(function(t){return c.shouldUseNativeValidation&&o$1({},c),{values:s$1.raw?Object.assign({},a):t,errors:{}}}));}catch(e){return r(e)}return u&&u.then?u.then(void 0,r):u}(0,function(e){if(!e.inner)throw e;return {values:{},errors:s((o=e,n=!c.shouldUseNativeValidation&&"all"===c.criteriaMode,(o.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var o=e[t.path].types,s=o&&o[t.type];e[t.path]=appendErrors(t.path,n,e,t.type,s?[].concat(s,t.message):t.message);}return e},{})),c)};var o,n;}))}catch(e){return Promise.reject(e)}}}
46805
46919
 
46806
- const AuthPage = ({ onSuccessSignIn }) => {
46807
- const logout = useLogout();
46920
+ const usernameSchema = getStringRequiredSchema();
46921
+ const passwordSchema = getStringRequiredSchema();
46922
+ const schema = create$3().shape({
46923
+ username: usernameSchema,
46924
+ password: passwordSchema,
46925
+ });
46926
+ const resolver = o(schema);
46927
+
46928
+ const AuthPage = ({ onSuccess, onError }) => {
46808
46929
  const signIn = useSignIn();
46809
46930
  const showSnackbar = useShowSnackbar();
46810
46931
  const form = useForm({
46811
- defaultValues: {
46812
- username: '',
46813
- password: '',
46814
- },
46815
- resolver: o(schema),
46932
+ defaultValues,
46933
+ resolver,
46816
46934
  });
46817
46935
  const { register, formState: { isValid }, } = form;
46818
- const onSubmit = (body) => {
46936
+ const onSubmit = React__namespace.useCallback((body) => {
46819
46937
  signIn.mutate({
46820
46938
  body,
46821
46939
  });
46822
- };
46823
- React__namespace.useEffect(() => {
46824
- logout.mutate();
46825
- }, []);
46940
+ }, [signIn]);
46826
46941
  React__namespace.useEffect(() => {
46827
46942
  if (signIn.error) {
46943
+ onError(signIn.error);
46828
46944
  const { response } = signIn.error;
46829
46945
  if (response) {
46830
46946
  const { data: { detail }, } = response;
@@ -46837,7 +46953,7 @@ const AuthPage = ({ onSuccessSignIn }) => {
46837
46953
  }, [signIn.error]);
46838
46954
  React__namespace.useEffect(() => {
46839
46955
  if (signIn.data) {
46840
- onSuccessSignIn(signIn.data);
46956
+ onSuccess(signIn.data);
46841
46957
  }
46842
46958
  }, [signIn.data]);
46843
46959
  return (jsxRuntime.jsx(AuthLayout, { children: jsxRuntime.jsxs(CustomForm, { form: form, onSubmit: onSubmit, sx: {
@@ -46845,7 +46961,7 @@ const AuthPage = ({ onSuccessSignIn }) => {
46845
46961
  justifyItems: 'center',
46846
46962
  alignContent: 'center',
46847
46963
  alignItems: 'center',
46848
- }, children: [jsxRuntime.jsx(material.Typography, { variant: "h4", children: "Authorization" }), jsxRuntime.jsx(CustomInput, { ...register('username'), label: "Login", placeholder: "Enter your login" }), jsxRuntime.jsx(CustomInput, { ...register('password'), label: "Password", placeholder: "Enter your password", type: "password" }), jsxRuntime.jsx(Button, { type: "submit", disabled: !isValid, children: "Sign in" })] }) }));
46964
+ }, children: [jsxRuntime.jsx(material.Typography, { variant: "h4", children: "\u0410\u0432\u0442\u043E\u0440\u0438\u0437\u0430\u0446\u0438\u044F" }), jsxRuntime.jsx(CustomInput, { ...register('username'), label: "\u041B\u043E\u0433\u0438\u043D", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043B\u043E\u0433\u0438\u043D" }), jsxRuntime.jsx(CustomInput, { ...register('password'), label: "\u041F\u0430\u0440\u043E\u043B\u044C", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043F\u0430\u0440\u043E\u043B\u044C", type: "password" }), jsxRuntime.jsx(Button, { type: "submit", disabled: !isValid, children: "\u0412\u043E\u0439\u0442\u0438" })] }) }));
46849
46965
  };
46850
46966
 
46851
46967
  // define() gets called for each chunk generated by the first Rollup pass.
@@ -48021,6 +48137,7 @@ exports.getUrlencodedBody = getUrlencodedBody;
48021
48137
  exports.getValidLayer = getValidLayer;
48022
48138
  exports.getWaterAreaLayers = getWaterAreaLayers;
48023
48139
  exports.getWaterLinkLayers = getWaterLinkLayers;
48140
+ exports.loadState = loadState;
48024
48141
  exports.loggerService = loggerService;
48025
48142
  exports.modalStore = modalStore;
48026
48143
  exports.modalStyle = modalStyle;
@@ -48029,7 +48146,9 @@ exports.numberSchema = numberSchema;
48029
48146
  exports.parseTrafficSignCSVFile = parseTrafficSignCSVFile;
48030
48147
  exports.pillarConfig = pillarConfig;
48031
48148
  exports.queryClient = queryClient;
48149
+ exports.removeState = removeState;
48032
48150
  exports.rootStore = rootStore;
48151
+ exports.saveState = saveState;
48033
48152
  exports.showSnackbar = showSnackbar;
48034
48153
  exports.sourceUrl = sourceUrl;
48035
48154
  exports.text_source = text_source;
@@ -48041,8 +48160,9 @@ exports.trafficSignsDop = trafficSignsDop;
48041
48160
  exports.useFormContext = useFormContext;
48042
48161
  exports.useGetLeafletLayer = useGetLeafletLayer;
48043
48162
  exports.useGetUser = useGetUser;
48044
- exports.useLogout = useLogout;
48163
+ exports.useLazyGetUser = useLazyGetUser;
48045
48164
  exports.useShowErrorSnackbar = useShowErrorSnackbar;
48046
48165
  exports.useShowSnackbar = useShowSnackbar;
48047
48166
  exports.useSignIn = useSignIn;
48167
+ exports.useSignOut = useSignOut;
48048
48168
  //# sourceMappingURL=index.cjs.map