@redneckz/wildless-cms-uni-blocks 0.14.674 → 0.14.676
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/EventBus/EventBus.d.ts +1 -8
- package/bundle/EventBus/defaultEventBus.d.ts +0 -9
- package/bundle/bundle.umd.js +406 -136
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/hooks/useLocation.d.ts +4 -1
- package/bundle/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/dist/EventBus/EventBus.d.ts +1 -8
- package/dist/EventBus/EventBus.js +2 -28
- package/dist/EventBus/EventBus.js.map +1 -1
- package/dist/EventBus/defaultEventBus.d.ts +0 -9
- package/dist/EventBus/defaultEventBus.js.map +1 -1
- package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +1 -1
- package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/dist/components/ContentPage/ContentPage.js +2 -0
- package/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/dist/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
- package/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
- package/dist/components/Header/HeaderSecondaryMenu.js +1 -1
- package/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/dist/components/OfficesAtmsMap/AtmsMap.js +1 -1
- package/dist/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
- package/dist/components/OfficesAtmsMap/OfficesMap.js +1 -1
- package/dist/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/dist/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
- package/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/dist/hooks/useLocation.d.ts +4 -1
- package/dist/hooks/useLocation.js +16 -34
- package/dist/hooks/useLocation.js.map +1 -1
- package/dist/hooks/useRegions.js +3 -1
- package/dist/hooks/useRegions.js.map +1 -1
- package/dist/ui-kit/DialogManager/useDialogsList.js +3 -0
- package/dist/ui-kit/DialogManager/useDialogsList.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/AddressFactField.js +1 -1
- package/dist/ui-kit/FormField/Fields/AddressFactField.js.map +1 -1
- package/dist/ui-kit/FormField/validators.js +3 -2
- package/dist/ui-kit/FormField/validators.js.map +1 -1
- package/dist/ui-kit/Input/InputControl.js +4 -1
- package/dist/ui-kit/Input/InputControl.js.map +1 -1
- package/dist/ui-kit/LocationDialog/LocationDialog.js +11 -14
- package/dist/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
- package/dist/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/dist/ui-kit/LocationDialog/SelectedLocation.js +15 -0
- package/dist/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
- package/dist/ui-kit/PopupManager/PopupManager.js +3 -0
- package/dist/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/lib/EventBus/EventBus.d.ts +1 -8
- package/lib/EventBus/EventBus.js +1 -27
- package/lib/EventBus/EventBus.js.map +1 -1
- package/lib/EventBus/defaultEventBus.d.ts +0 -9
- package/lib/EventBus/defaultEventBus.js.map +1 -1
- package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +1 -1
- package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/lib/components/ContentPage/ContentPage.js +2 -0
- package/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/lib/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
- package/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
- package/lib/components/Header/HeaderSecondaryMenu.js +1 -1
- package/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/lib/components/OfficesAtmsMap/AtmsMap.js +1 -1
- package/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
- package/lib/components/OfficesAtmsMap/OfficesMap.js +1 -1
- package/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/lib/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
- package/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/lib/hooks/useLocation.d.ts +4 -1
- package/lib/hooks/useLocation.js +15 -34
- package/lib/hooks/useLocation.js.map +1 -1
- package/lib/hooks/useRegions.js +3 -1
- package/lib/hooks/useRegions.js.map +1 -1
- package/lib/ui-kit/DialogManager/useDialogsList.js +3 -0
- package/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/AddressFactField.js +1 -1
- package/lib/ui-kit/FormField/Fields/AddressFactField.js.map +1 -1
- package/lib/ui-kit/FormField/validators.js +3 -2
- package/lib/ui-kit/FormField/validators.js.map +1 -1
- package/lib/ui-kit/Input/InputControl.js +4 -1
- package/lib/ui-kit/Input/InputControl.js.map +1 -1
- package/lib/ui-kit/LocationDialog/LocationDialog.js +13 -16
- package/lib/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
- package/lib/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/lib/ui-kit/LocationDialog/SelectedLocation.js +13 -0
- package/lib/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
- package/lib/ui-kit/PopupManager/PopupManager.js +3 -0
- package/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/mobile/bundle/EventBus/EventBus.d.ts +1 -8
- package/mobile/bundle/EventBus/defaultEventBus.d.ts +0 -9
- package/mobile/bundle/bundle.umd.js +406 -136
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/hooks/useLocation.d.ts +4 -1
- package/mobile/bundle/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/mobile/dist/EventBus/EventBus.d.ts +1 -8
- package/mobile/dist/EventBus/EventBus.js +2 -28
- package/mobile/dist/EventBus/EventBus.js.map +1 -1
- package/mobile/dist/EventBus/defaultEventBus.d.ts +0 -9
- package/mobile/dist/EventBus/defaultEventBus.js.map +1 -1
- package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +1 -1
- package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/mobile/dist/components/ContentPage/ContentPage.js +2 -0
- package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
- package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
- package/mobile/dist/components/Header/HeaderSecondaryMenu.js +1 -1
- package/mobile/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js +1 -1
- package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
- package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js +1 -1
- package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
- package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/mobile/dist/hooks/useLocation.d.ts +4 -1
- package/mobile/dist/hooks/useLocation.js +16 -34
- package/mobile/dist/hooks/useLocation.js.map +1 -1
- package/mobile/dist/hooks/useRegions.js +3 -1
- package/mobile/dist/hooks/useRegions.js.map +1 -1
- package/mobile/dist/ui-kit/DialogManager/useDialogsList.js +3 -0
- package/mobile/dist/ui-kit/DialogManager/useDialogsList.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.js +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/validators.js +3 -2
- package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
- package/mobile/dist/ui-kit/Input/InputControl.js +4 -1
- package/mobile/dist/ui-kit/Input/InputControl.js.map +1 -1
- package/mobile/dist/ui-kit/LocationDialog/LocationDialog.js +11 -14
- package/mobile/dist/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
- package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.js +15 -0
- package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
- package/mobile/dist/ui-kit/PopupManager/PopupManager.js +3 -0
- package/mobile/dist/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/mobile/lib/EventBus/EventBus.d.ts +1 -8
- package/mobile/lib/EventBus/EventBus.js +1 -27
- package/mobile/lib/EventBus/EventBus.js.map +1 -1
- package/mobile/lib/EventBus/defaultEventBus.d.ts +0 -9
- package/mobile/lib/EventBus/defaultEventBus.js.map +1 -1
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +1 -1
- package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
- package/mobile/lib/components/ContentPage/ContentPage.js +2 -0
- package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
- package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
- package/mobile/lib/components/Header/HeaderSecondaryMenu.js +1 -1
- package/mobile/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js +1 -1
- package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
- package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js +1 -1
- package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
- package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/mobile/lib/hooks/useLocation.d.ts +4 -1
- package/mobile/lib/hooks/useLocation.js +15 -34
- package/mobile/lib/hooks/useLocation.js.map +1 -1
- package/mobile/lib/hooks/useRegions.js +3 -1
- package/mobile/lib/hooks/useRegions.js.map +1 -1
- package/mobile/lib/ui-kit/DialogManager/useDialogsList.js +3 -0
- package/mobile/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.js +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/validators.js +3 -2
- package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
- package/mobile/lib/ui-kit/Input/InputControl.js +4 -1
- package/mobile/lib/ui-kit/Input/InputControl.js.map +1 -1
- package/mobile/lib/ui-kit/LocationDialog/LocationDialog.js +13 -16
- package/mobile/lib/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
- package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
- package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.js +13 -0
- package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
- package/mobile/lib/ui-kit/PopupManager/PopupManager.js +3 -0
- package/mobile/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
- package/mobile/src/EventBus/EventBus.ts +1 -36
- package/mobile/src/EventBus/defaultEventBus.ts +0 -10
- package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +1 -1
- package/mobile/src/components/ContentPage/ContentPage.tsx +2 -0
- package/mobile/src/components/ExchangeRateTile/ExchangeRateTile.tsx +1 -1
- package/mobile/src/components/Header/HeaderSecondaryMenu.tsx +1 -1
- package/mobile/src/components/OfficesAtmsMap/AtmsMap.tsx +1 -1
- package/mobile/src/components/OfficesAtmsMap/OfficesMap.tsx +1 -1
- package/mobile/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +1 -1
- package/mobile/src/hooks/useLocation.ts +25 -47
- package/mobile/src/hooks/useRegions.ts +4 -1
- package/mobile/src/ui-kit/DialogManager/useDialogsList.ts +3 -0
- package/mobile/src/ui-kit/FormField/Fields/AddressFactField.tsx +1 -1
- package/mobile/src/ui-kit/FormField/validators.ts +4 -3
- package/mobile/src/ui-kit/Input/InputControl.tsx +5 -2
- package/mobile/src/ui-kit/LocationDialog/LocationDialog.tsx +22 -28
- package/mobile/src/ui-kit/LocationDialog/SelectedLocation.tsx +27 -0
- package/mobile/src/ui-kit/PopupManager/PopupManager.tsx +3 -0
- package/package.json +5 -5
- package/src/EventBus/EventBus.ts +1 -36
- package/src/EventBus/defaultEventBus.ts +0 -10
- package/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +1 -1
- package/src/components/ContentPage/ContentPage.tsx +2 -0
- package/src/components/ExchangeRateTile/ExchangeRateTile.tsx +1 -1
- package/src/components/Header/HeaderSecondaryMenu.tsx +1 -1
- package/src/components/OfficesAtmsMap/AtmsMap.tsx +1 -1
- package/src/components/OfficesAtmsMap/OfficesMap.tsx +1 -1
- package/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +1 -1
- package/src/hooks/useLocation.ts +25 -47
- package/src/hooks/useRegions.ts +4 -1
- package/src/ui-kit/DialogManager/useDialogsList.ts +3 -0
- package/src/ui-kit/FormField/Fields/AddressFactField.tsx +1 -1
- package/src/ui-kit/FormField/validators.ts +4 -3
- package/src/ui-kit/Input/InputControl.tsx +5 -2
- package/src/ui-kit/LocationDialog/LocationDialog.tsx +22 -28
- package/src/ui-kit/LocationDialog/SelectedLocation.tsx +27 -0
- package/src/ui-kit/PopupManager/PopupManager.tsx +3 -0
|
@@ -414,32 +414,53 @@
|
|
|
414
414
|
className,
|
|
415
415
|
].join(' ');
|
|
416
416
|
|
|
417
|
-
class EventBus {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
this.
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
417
|
+
class EventBus {
|
|
418
|
+
watchers = new Set();
|
|
419
|
+
subscribersMap = {};
|
|
420
|
+
subjectsStateMap = {};
|
|
421
|
+
emitter = this;
|
|
422
|
+
observable = this;
|
|
423
|
+
watch(watcher) {
|
|
424
|
+
this.watchers.add(watcher);
|
|
425
|
+
return () => {
|
|
426
|
+
this.watchers.delete(watcher);
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
subscribe(type, listener) {
|
|
430
|
+
this.subscribersMap[type] ||= new Set();
|
|
431
|
+
this.subscribersMap[type]?.add(listener);
|
|
432
|
+
const initialEvent = this.subjectsStateMap[type];
|
|
433
|
+
initialEvent && listener(initialEvent);
|
|
434
|
+
return () => {
|
|
435
|
+
this.subscribersMap[type]?.delete(listener);
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
fire(type, event) {
|
|
439
|
+
const isSubjectDeclared = type in this.subjectsStateMap;
|
|
440
|
+
if (isSubjectDeclared) {
|
|
441
|
+
this.subject(type, event);
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
this.fireSubscribers(type, event);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
subject(type, event) {
|
|
448
|
+
if (this.subjectsStateMap[type] !== event) {
|
|
449
|
+
this.subjectsStateMap[type] = event ?? undefined;
|
|
450
|
+
this.fireSubscribers(type, event);
|
|
451
|
+
}
|
|
452
|
+
return () => {
|
|
453
|
+
delete this.subjectsStateMap[type];
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
fireSubscribers(type, event) {
|
|
457
|
+
for (const _ of this.subscribersMap[type] ?? []) {
|
|
458
|
+
_(event ?? null);
|
|
459
|
+
}
|
|
460
|
+
for (const _ of this.watchers) {
|
|
461
|
+
_({ type, event: event ?? null });
|
|
462
|
+
}
|
|
463
|
+
}
|
|
443
464
|
}
|
|
444
465
|
|
|
445
466
|
const defaultEventBus = new EventBus();
|
|
@@ -725,26 +746,166 @@
|
|
|
725
746
|
const leftOrRightImage = (img, directionRight) => directionRight ? { rightImage: img } : { leftImage: img };
|
|
726
747
|
const renderTags = (tags) => (tags?.length ? jsx(Tags, { tags: tags }) : null);
|
|
727
748
|
|
|
749
|
+
class JSONBox {
|
|
750
|
+
_;
|
|
751
|
+
constructor(_) {
|
|
752
|
+
this._ = _;
|
|
753
|
+
}
|
|
754
|
+
of(_) {
|
|
755
|
+
return new this.constructor(_ instanceof JSONBox ? _._ : _);
|
|
756
|
+
}
|
|
757
|
+
filter(predicate) {
|
|
758
|
+
return this.from(this.entries().filter(predicate));
|
|
759
|
+
}
|
|
760
|
+
map(mapper) {
|
|
761
|
+
return this.from(this.entries().map(mapper));
|
|
762
|
+
}
|
|
763
|
+
flatMap(mapper) {
|
|
764
|
+
return this.from(this.entries().flatMap(mapper));
|
|
765
|
+
}
|
|
766
|
+
reduce(reducer, initial) {
|
|
767
|
+
return this.entries().reduce(reducer.bind(this), initial);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
const trueF = () => true;
|
|
772
|
+
const and = (a, b) => (...args) => a(...args) && b(...args);
|
|
773
|
+
|
|
774
|
+
const table = (...table) => (...input) => {
|
|
775
|
+
const [, unit] = assertNonEmpty$1(table.find(([predicate]) => predicate(...input)));
|
|
776
|
+
return unit(...input);
|
|
777
|
+
};
|
|
778
|
+
function assertNonEmpty$1(value) {
|
|
779
|
+
if (!value) {
|
|
780
|
+
throw new Error('Value should be fulfilled');
|
|
781
|
+
}
|
|
782
|
+
return value;
|
|
783
|
+
}
|
|
784
|
+
|
|
728
785
|
const isJSONArray = (_) => Boolean(_ && Array.isArray(_));
|
|
729
|
-
const isJSONRecord = (_) => Boolean(_ &&
|
|
730
|
-
const isJSONRef = (_) => Boolean(isJSONRecord(_) && typeof _.$ref === 'string');
|
|
786
|
+
const isJSONRecord = (_) => Boolean(_ && typeof _ === 'object' && !isJSONArray(_));
|
|
731
787
|
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
|
|
788
|
+
const identity$1 = (x) => x;
|
|
789
|
+
|
|
790
|
+
const t0 = (fn = identity$1) => ([_]) => fn(_);
|
|
791
|
+
const t1 = (fn = identity$1) => ([, _]) => fn(_);
|
|
792
|
+
|
|
793
|
+
function unbox(box) {
|
|
794
|
+
return box instanceof JSONBox ? box._ : box;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
class JSONArrayBox extends JSONBox {
|
|
798
|
+
from(entries) {
|
|
799
|
+
return this.of(entries.map(t1(unbox)));
|
|
735
800
|
}
|
|
736
|
-
|
|
737
|
-
return
|
|
801
|
+
entries() {
|
|
802
|
+
return (this._ ?? []).map((node, p) => [p, this.of(node)]);
|
|
738
803
|
}
|
|
739
|
-
|
|
740
|
-
return
|
|
804
|
+
size() {
|
|
805
|
+
return this._?.length ?? 0;
|
|
741
806
|
}
|
|
742
|
-
|
|
743
|
-
return
|
|
807
|
+
get(p) {
|
|
808
|
+
return this.of(typeof p === 'number' ? this._?.[p] : undefined);
|
|
809
|
+
}
|
|
810
|
+
set(p, child) {
|
|
811
|
+
return this.of(isJSONArray(this._)
|
|
812
|
+
? Array.from({ length: Math.max(this._.length, Number(p) + 1) }, (x, i) => (i === p ? child : this._[i]))
|
|
813
|
+
: Array.from({ length: Number(p) + 1 }, (x, i) => (i === p ? child : undefined)));
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
class JSONLeafBox extends JSONBox {
|
|
818
|
+
from() {
|
|
819
|
+
return this;
|
|
820
|
+
}
|
|
821
|
+
entries() {
|
|
822
|
+
return [];
|
|
823
|
+
}
|
|
824
|
+
size() {
|
|
825
|
+
return 0;
|
|
826
|
+
}
|
|
827
|
+
get(p) {
|
|
828
|
+
return this.of(p !== undefined ? undefined /* no childs */ : this._ /* self */);
|
|
829
|
+
}
|
|
830
|
+
set(p, child) {
|
|
831
|
+
return this.of(child);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
class JSONRecordBox extends JSONBox {
|
|
836
|
+
from(entries) {
|
|
837
|
+
return this.of(Object.fromEntries(entries.map(([p, box]) => [p, unbox(box)])));
|
|
838
|
+
}
|
|
839
|
+
entries() {
|
|
840
|
+
return Object.entries(this._ ?? {}).map(([p, node]) => [p, this.of(node)]);
|
|
841
|
+
}
|
|
842
|
+
size() {
|
|
843
|
+
return Object.keys(this._ ?? {}).length;
|
|
844
|
+
}
|
|
845
|
+
get(p) {
|
|
846
|
+
return this.of(typeof p === 'string' ? this._?.[p] : undefined);
|
|
847
|
+
}
|
|
848
|
+
set(p, child) {
|
|
849
|
+
return this.of({ ...this._, [p]: child });
|
|
744
850
|
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
class JSONBoxDefault extends JSONBox {
|
|
854
|
+
proto = table([p => isJSONArray(this._) || typeof p === 'number', () => JSONArrayBox.prototype], [p => isJSONRecord(this._) || typeof p === 'string', () => JSONRecordBox.prototype], [trueF, () => JSONLeafBox.prototype]);
|
|
855
|
+
from(entries) {
|
|
856
|
+
return this.proto(undefined).from.call(this, entries);
|
|
857
|
+
}
|
|
858
|
+
entries() {
|
|
859
|
+
return this.proto(undefined).entries.call(this);
|
|
860
|
+
}
|
|
861
|
+
size() {
|
|
862
|
+
return this.proto(undefined).size.call(this);
|
|
863
|
+
}
|
|
864
|
+
get(p) {
|
|
865
|
+
return this.proto(p).get.call(this, p);
|
|
866
|
+
}
|
|
867
|
+
set(p, child) {
|
|
868
|
+
return this.proto(p).set.call(this, p, child);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
const box = (_) => (_ instanceof JSONBox ? _ : new JSONBoxDefault(_));
|
|
873
|
+
|
|
874
|
+
const boxed = (fn) => {
|
|
875
|
+
const boxedFn = (node, ...args) => unbox(fn(box(node), ...args));
|
|
876
|
+
boxedFn.fn = fn;
|
|
877
|
+
return boxedFn;
|
|
745
878
|
};
|
|
746
879
|
|
|
747
|
-
const
|
|
880
|
+
const ROOT = [];
|
|
881
|
+
const endsWith = (suffix) => suffix
|
|
882
|
+
.map((predicate, i) => (path) => cmp(predicate)(path[i + path.length - suffix.length]))
|
|
883
|
+
.reduceRight(and, trueF);
|
|
884
|
+
const cmp = (a) => a instanceof Function ? a : (b) => a === b;
|
|
885
|
+
|
|
886
|
+
const reduce = (reducer) => (node, initial, path = ROOT) => box(node)
|
|
887
|
+
.entries()
|
|
888
|
+
.reduce((acc, [p, _]) => reduce(reducer)(_, acc, path.concat(p)), reducer(initial, [path, box(node)]));
|
|
889
|
+
|
|
890
|
+
const set = boxed((target, [path, node]) => {
|
|
891
|
+
const [p, ...tail] = path;
|
|
892
|
+
return target.set(p, tail.length ? set(target.get(p), [tail, node]) : node);
|
|
893
|
+
});
|
|
894
|
+
|
|
895
|
+
const fromEntries = boxed((initial, tree) => tree.reduce(set.fn, initial));
|
|
896
|
+
|
|
897
|
+
const leafs = (node) => reduce((acc, [path, _]) => (isLeaf(_) ? [...acc, [path, unbox(_)]] : acc))(node, []);
|
|
898
|
+
const isLeaf = (_) => _.size() === 0;
|
|
899
|
+
|
|
900
|
+
const map = (mapper, initial = {}) => (node) => fromEntries(initial, leafs(node).map(_ => mapper(_)));
|
|
901
|
+
|
|
902
|
+
const init = (list) => list.slice(0, -1);
|
|
903
|
+
|
|
904
|
+
boxed((target, path = ROOT) => path.reduce((_, p) => _.get(p), target));
|
|
905
|
+
|
|
906
|
+
const remove = boxed((target, [p, ...tail]) => tail.length ? target.set(p, remove(target.get(p), tail)) : target.filter(([i]) => i !== p));
|
|
907
|
+
|
|
908
|
+
const isJSONRefPath = endsWith(['$ref']);
|
|
748
909
|
|
|
749
910
|
const parseJPointer = (uri) => uri.includes('#')
|
|
750
911
|
? uri
|
|
@@ -754,46 +915,17 @@
|
|
|
754
915
|
: [];
|
|
755
916
|
|
|
756
917
|
const resolveJPointer = (json, uri) => parseJPointer(uri).reduce(selectNodeByKey, json);
|
|
757
|
-
const selectNodeByKey = (json, key) =>
|
|
758
|
-
if (!json || !key) {
|
|
759
|
-
return json;
|
|
760
|
-
}
|
|
761
|
-
if (isJSONRecord(json)) {
|
|
762
|
-
return json[key];
|
|
763
|
-
}
|
|
764
|
-
else if (isJSONArray(json)) {
|
|
765
|
-
return json[parseInt(key, 10)];
|
|
766
|
-
}
|
|
767
|
-
else {
|
|
768
|
-
return json;
|
|
769
|
-
}
|
|
770
|
-
};
|
|
918
|
+
const selectNodeByKey = table([isJSONArray, (json, key) => json[parseInt(key, 10)]], [isJSONRecord, (json, key) => json[key]], [trueF, identity$1]);
|
|
771
919
|
|
|
772
|
-
const resolveRef = (json, resolver) =>
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
array: list => list.map(_ => resolveRef(_, resolver))
|
|
776
|
-
});
|
|
920
|
+
const resolveRef = (json, resolver) => map(([path, node]) => isJSONRefPath(path)
|
|
921
|
+
? [init(path), resolveJPointer(resolver(node), node)]
|
|
922
|
+
: [path, node])(json);
|
|
777
923
|
|
|
778
|
-
const
|
|
779
|
-
mapJSONNode(json, {
|
|
780
|
-
ref: json => visitor(json.$ref, path),
|
|
781
|
-
record: record => {
|
|
782
|
-
for (const key in record)
|
|
783
|
-
visitRef(record[key], visitor, [...path, key]);
|
|
784
|
-
},
|
|
785
|
-
array: list => {
|
|
786
|
-
for (let i = 0; i < list.length; i++)
|
|
787
|
-
visitRef(list[i], visitor, [...path, i]);
|
|
788
|
-
}
|
|
789
|
-
});
|
|
790
|
-
};
|
|
924
|
+
const refEntries = (json) => leafs(json).filter(t0(isJSONRefPath));
|
|
791
925
|
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
return refs;
|
|
796
|
-
};
|
|
926
|
+
const unique$1 = (list) => [...new Set(list)];
|
|
927
|
+
|
|
928
|
+
const collectRef = (json) => unique$1(refEntries(json).map(([, _]) => _));
|
|
797
929
|
|
|
798
930
|
async function fetchJSON(url, options) {
|
|
799
931
|
try {
|
|
@@ -1340,7 +1472,10 @@
|
|
|
1340
1472
|
const InputControl = JSX(({ className, label, value = '', placeholder, error, errors, onChange = noop, onDaDataChange, onBlur, isTextarea, type, name = '', daDataQueryPrefix, maxLength, dadata = false, disabled = false, }) => {
|
|
1341
1473
|
const [isOpen, { setFalse: close, setTrue: open }] = useBool();
|
|
1342
1474
|
const popupRef = useOutsideClick(close);
|
|
1343
|
-
const handleChange = useCallback((v) =>
|
|
1475
|
+
const handleChange = useCallback((v) => {
|
|
1476
|
+
dadata && !isOpen && open();
|
|
1477
|
+
maxLength ? v.length <= maxLength && onChange(v) : onChange(v);
|
|
1478
|
+
}, [dadata, isOpen, onChange]);
|
|
1344
1479
|
const inputRef = useInputPopup({
|
|
1345
1480
|
isOpen: isOpen && dadata,
|
|
1346
1481
|
name,
|
|
@@ -1434,6 +1569,7 @@
|
|
|
1434
1569
|
const required = validator((_) => _ !== null && _ !== undefined && _ !== '');
|
|
1435
1570
|
|
|
1436
1571
|
const ERROR_MESSAGE = 'Некорректно заполненное поле';
|
|
1572
|
+
const ADDRESS_ERROR_MESSAGE = 'Укажите регион, город/населенный пункт, улицу, дом';
|
|
1437
1573
|
const defaultValidator = (errorMsg) => required(errorMsg ?? ERROR_MESSAGE);
|
|
1438
1574
|
const defaultSelectValidator = (errorMsg) => validator((_) => _?.key && _?.key !== '')(errorMsg ?? ERROR_MESSAGE);
|
|
1439
1575
|
const jobNumberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 0 && _.length <= 2)(errorMsg ?? ERROR_MESSAGE);
|
|
@@ -1465,8 +1601,8 @@
|
|
|
1465
1601
|
const emailValidate = (email) => /^[^\s@]+@[^\s@]+\.[a-zA-Z]{2,4}$/.test(email);
|
|
1466
1602
|
const emailValidator = (errorMsg) => validator((_) => emailValidate(_))(errorMsg);
|
|
1467
1603
|
const addressDaDataValidate = (address) => Boolean(address.region && address.city && address.house);
|
|
1468
|
-
const addressDaDataValidator = () => validator(addressDaDataValidate)(
|
|
1469
|
-
const addressOrganizationValidator = () => validator((address) => Boolean(address.fiasCode && address.city && address.house))(
|
|
1604
|
+
const addressDaDataValidator = () => validator(addressDaDataValidate)(ADDRESS_ERROR_MESSAGE);
|
|
1605
|
+
const addressOrganizationValidator = () => validator((address) => Boolean(address.fiasCode && address.city && address.house))(ADDRESS_ERROR_MESSAGE);
|
|
1470
1606
|
const codeWordValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 3 && _.length <= 21 && isCyrillic(_))(errorMsg ?? ERROR_MESSAGE);
|
|
1471
1607
|
const cyrillicPattern = /^[\u0400-\u04FF\d]+$/u;
|
|
1472
1608
|
const isCyrillic = (_ = '') => cyrillicPattern.test(_);
|
|
@@ -1704,7 +1840,7 @@
|
|
|
1704
1840
|
if (value) {
|
|
1705
1841
|
field('addressFact')?.onChange?.(field('addressRegistration').value);
|
|
1706
1842
|
}
|
|
1707
|
-
}, [value]);
|
|
1843
|
+
}, [value, field('addressRegistration').value]);
|
|
1708
1844
|
const onDaDataChange = useCallback((item) => {
|
|
1709
1845
|
field?.(fieldName)?.onChange?.({
|
|
1710
1846
|
apartment: item?.data?.flat,
|
|
@@ -3152,10 +3288,10 @@
|
|
|
3152
3288
|
const LegalFormField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u041F\u0424", placeholder: "\u041E\u041E\u041E, \u041F\u0410\u041E \u0438 \u0434\u0440.", ...getValidation(field('legalForm'), validatorObj.legalForm, input?.required), ...input })));
|
|
3153
3289
|
|
|
3154
3290
|
const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
|
|
3155
|
-
const EMPTY_REGIONS = [];
|
|
3291
|
+
const EMPTY_REGIONS$1 = [];
|
|
3156
3292
|
async function getOutServiceRegions() {
|
|
3157
3293
|
const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
|
|
3158
|
-
return data && Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
3294
|
+
return data && Array.isArray(data) ? data : EMPTY_REGIONS$1;
|
|
3159
3295
|
}
|
|
3160
3296
|
|
|
3161
3297
|
const LocalitiesField = JSX(({ field, input }) => {
|
|
@@ -3288,9 +3424,11 @@
|
|
|
3288
3424
|
const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
|
|
3289
3425
|
|
|
3290
3426
|
const REGIONS_URL = `${API_BASE_URI}/regions`;
|
|
3427
|
+
const EMPTY_REGIONS = [];
|
|
3428
|
+
// TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
|
|
3291
3429
|
function useRegions(url = REGIONS_URL) {
|
|
3292
3430
|
const { data } = useAsyncData(url, fetchJSONUnsafe);
|
|
3293
|
-
return Array.isArray(data) ? data :
|
|
3431
|
+
return Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
3294
3432
|
}
|
|
3295
3433
|
|
|
3296
3434
|
const RegionField = JSX(({ field, input, url }) => {
|
|
@@ -6006,7 +6144,7 @@
|
|
|
6006
6144
|
: [cellsNode, []];
|
|
6007
6145
|
const [isVisible, setIsVisible] = useState(false);
|
|
6008
6146
|
useEffect(() => defaultEventBus.subscribe('fold', (event) => {
|
|
6009
|
-
if (options?.parent !== undefined && event.parent === options?.parent) {
|
|
6147
|
+
if (event && options?.parent !== undefined && event.parent === options?.parent) {
|
|
6010
6148
|
setIsVisible(event.isUnfolded);
|
|
6011
6149
|
}
|
|
6012
6150
|
}), [options?.parent]);
|
|
@@ -7910,47 +8048,166 @@
|
|
|
7910
8048
|
};
|
|
7911
8049
|
const ErrorBlock = JSX(({ className = '', title, description, error, button, ...rest }) => (jsxs(BlockWrapper, { className: style('flex flex-col justify-center items-center', className), defaultPadding: style('p-6xl'), version: "transparent", ...rest, children: [jsx("div", { className: "flex justify-center", children: renderErrorContent(error) }), jsx(Headline, { title: title, description: description, headlineVersion: "XL", isEmbedded: true, className: "mb-2xl last:mb-0" }), button?.text ? (jsx(LinkButton, { version: button?.version, text: button?.text, ...button })) : null] })));
|
|
7912
8050
|
|
|
7913
|
-
|
|
7914
|
-
const [
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
8051
|
+
function copy(source, target) {
|
|
8052
|
+
for (const [k, v] of source.entries()) {
|
|
8053
|
+
if (v !== null && v !== undefined) {
|
|
8054
|
+
target.setItem(k, v);
|
|
8055
|
+
}
|
|
8056
|
+
else {
|
|
8057
|
+
target.removeItem(k);
|
|
8058
|
+
}
|
|
8059
|
+
}
|
|
8060
|
+
}
|
|
8061
|
+
|
|
8062
|
+
function replicate(primary, secondary) {
|
|
8063
|
+
copy(primary, secondary);
|
|
8064
|
+
copy(secondary, primary);
|
|
8065
|
+
return primary.bus.watch(({ type, event }) => {
|
|
8066
|
+
if (event !== null && event !== undefined) {
|
|
8067
|
+
secondary.setItem(type, event);
|
|
8068
|
+
}
|
|
8069
|
+
else {
|
|
8070
|
+
secondary.removeItem(type);
|
|
8071
|
+
}
|
|
8072
|
+
});
|
|
8073
|
+
}
|
|
8074
|
+
|
|
8075
|
+
class StorageAdapter {
|
|
8076
|
+
storage;
|
|
8077
|
+
bus;
|
|
8078
|
+
get size() {
|
|
8079
|
+
return this.storage?.length ?? 0;
|
|
8080
|
+
}
|
|
8081
|
+
constructor(storage, bus = new EventBus()) {
|
|
8082
|
+
this.storage = storage;
|
|
8083
|
+
this.bus = bus;
|
|
8084
|
+
}
|
|
8085
|
+
hasItem(key) {
|
|
8086
|
+
return Boolean(this.storage?.getItem(String(key)));
|
|
8087
|
+
}
|
|
8088
|
+
getItem(key) {
|
|
8089
|
+
const _ = this.storage?.getItem(String(key)) ?? null;
|
|
8090
|
+
try {
|
|
8091
|
+
return JSON.parse(String(_));
|
|
8092
|
+
}
|
|
8093
|
+
catch (ex) {
|
|
8094
|
+
return null;
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
8097
|
+
entries() {
|
|
8098
|
+
return Array.from({ length: this.size }, (_, i) => {
|
|
8099
|
+
const k = String(this.storage?.key(i));
|
|
8100
|
+
return [k, this.getItem(k)];
|
|
8101
|
+
});
|
|
8102
|
+
}
|
|
8103
|
+
setItem(key, value) {
|
|
8104
|
+
if (value !== null) {
|
|
8105
|
+
this.storage?.setItem(String(key), JSON.stringify(value));
|
|
8106
|
+
}
|
|
8107
|
+
else {
|
|
8108
|
+
this.storage?.removeItem(String(key));
|
|
8109
|
+
}
|
|
8110
|
+
this.bus?.subject(key, value);
|
|
8111
|
+
}
|
|
8112
|
+
removeItem(key) {
|
|
8113
|
+
this.storage?.removeItem(String(key));
|
|
8114
|
+
this.bus?.subject(key, null);
|
|
8115
|
+
}
|
|
8116
|
+
}
|
|
8117
|
+
|
|
8118
|
+
class Store {
|
|
8119
|
+
bus;
|
|
8120
|
+
store = new Map();
|
|
8121
|
+
get size() {
|
|
8122
|
+
return this.store.size;
|
|
8123
|
+
}
|
|
8124
|
+
constructor(bus = new EventBus()) {
|
|
8125
|
+
this.bus = bus;
|
|
8126
|
+
}
|
|
8127
|
+
hasItem(key) {
|
|
8128
|
+
return this.store.has(key);
|
|
8129
|
+
}
|
|
8130
|
+
getItem(key) {
|
|
8131
|
+
return this.store.get(key);
|
|
8132
|
+
}
|
|
8133
|
+
entries() {
|
|
8134
|
+
return this.store.entries();
|
|
8135
|
+
}
|
|
8136
|
+
setItem(key, value) {
|
|
8137
|
+
this.store.set(key, value);
|
|
8138
|
+
this.bus.subject(key, value);
|
|
8139
|
+
}
|
|
8140
|
+
removeItem(key) {
|
|
8141
|
+
this.store.delete(key);
|
|
8142
|
+
this.bus.subject(key, null);
|
|
8143
|
+
}
|
|
8144
|
+
}
|
|
8145
|
+
|
|
8146
|
+
function useRerender() {
|
|
8147
|
+
const [, setCount] = useState(0);
|
|
8148
|
+
return useCallback(() => setCount(_ => (_ + 1) % (1 << 16)), []);
|
|
8149
|
+
}
|
|
8150
|
+
|
|
8151
|
+
const DEFAULT_METHODS = {};
|
|
8152
|
+
/**
|
|
8153
|
+
* MobX like reactivity (simplified).
|
|
8154
|
+
* Can be used to migrate from Redux/MobX or something else
|
|
8155
|
+
*
|
|
8156
|
+
* @param store
|
|
8157
|
+
* @returns reactive proxy backed by store
|
|
8158
|
+
*/
|
|
8159
|
+
function useStore(store, methods = DEFAULT_METHODS) {
|
|
8160
|
+
const deps = useRef(null);
|
|
8161
|
+
const render = useRerender();
|
|
8162
|
+
useEffect(() => store.bus.watch(ev => {
|
|
8163
|
+
if (deps.current?.has(String(ev.type))) {
|
|
8164
|
+
render();
|
|
8165
|
+
}
|
|
8166
|
+
}), [store, render]);
|
|
8167
|
+
return useMemo(() => new Proxy(methods, {
|
|
8168
|
+
get(_, key) {
|
|
8169
|
+
deps.current ||= new Set();
|
|
8170
|
+
deps.current.add(key);
|
|
8171
|
+
return store.getItem(key);
|
|
8172
|
+
},
|
|
8173
|
+
has(_, key) {
|
|
8174
|
+
deps.current ||= new Set();
|
|
8175
|
+
deps.current.add(key);
|
|
8176
|
+
return store.hasItem(key);
|
|
8177
|
+
},
|
|
8178
|
+
set(_, key, value) {
|
|
8179
|
+
store.setItem(key, value);
|
|
8180
|
+
return true;
|
|
8181
|
+
},
|
|
8182
|
+
deleteProperty(_, key) {
|
|
8183
|
+
store.removeItem(key);
|
|
8184
|
+
return true;
|
|
8185
|
+
}
|
|
8186
|
+
}), [store]);
|
|
8187
|
+
}
|
|
8188
|
+
|
|
8189
|
+
const localStore = new Store(); // localStorage cache
|
|
8190
|
+
replicate(localStore, new StorageAdapter(globalThis?.localStorage));
|
|
8191
|
+
function useLocalStore(methods) {
|
|
8192
|
+
return useStore(localStore, methods);
|
|
8193
|
+
}
|
|
7919
8194
|
|
|
7920
8195
|
const REGION_URL = `${API_BASE_URI}/region`;
|
|
7921
|
-
const LOCATION_STORAGE_KEY = 'location';
|
|
7922
8196
|
function useLocation(defaultLocation = 'Москва') {
|
|
7923
|
-
const
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
const
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
}
|
|
7933
|
-
}, [
|
|
7934
|
-
|
|
8197
|
+
const locationStore = useLocalStore();
|
|
8198
|
+
return locationStore.location ?? { name: defaultLocation };
|
|
8199
|
+
}
|
|
8200
|
+
function useDefaultLocation(defaultLocation = 'Москва') {
|
|
8201
|
+
const locationStore = useLocalStore();
|
|
8202
|
+
const preselectLocation = useCallback(async () => {
|
|
8203
|
+
if (!locationStore.location) {
|
|
8204
|
+
const region = await fetchJSON(REGION_URL);
|
|
8205
|
+
locationStore.location = region ?? { name: defaultLocation };
|
|
8206
|
+
}
|
|
8207
|
+
}, [locationStore, defaultLocation]);
|
|
8208
|
+
useAsyncData(REGION_URL, preselectLocation);
|
|
8209
|
+
return locationStore;
|
|
7935
8210
|
}
|
|
7936
|
-
const hasStoredLocation = () => Boolean(globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY));
|
|
7937
|
-
const restoreLocation = () => {
|
|
7938
|
-
try {
|
|
7939
|
-
const data = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
|
|
7940
|
-
return data && JSON.parse(data);
|
|
7941
|
-
}
|
|
7942
|
-
catch (ex) {
|
|
7943
|
-
return null;
|
|
7944
|
-
}
|
|
7945
|
-
};
|
|
7946
|
-
const storeLocation = (_) => {
|
|
7947
|
-
try {
|
|
7948
|
-
globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
|
|
7949
|
-
}
|
|
7950
|
-
catch (ex) {
|
|
7951
|
-
// Do nothing
|
|
7952
|
-
}
|
|
7953
|
-
};
|
|
7954
8211
|
|
|
7955
8212
|
var Currency;
|
|
7956
8213
|
(function (Currency) {
|
|
@@ -8092,7 +8349,7 @@
|
|
|
8092
8349
|
}
|
|
8093
8350
|
|
|
8094
8351
|
const ExchangeRateTile = JSX(({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
|
|
8095
|
-
const
|
|
8352
|
+
const currentLocation = useLocation();
|
|
8096
8353
|
const exchangeRates = useFetchExchangeRateData(currentLocation);
|
|
8097
8354
|
const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
|
|
8098
8355
|
const currencyRatesBuy = currencyRates.filter((_) => _.buyExchangeRate);
|
|
@@ -8579,7 +8836,7 @@
|
|
|
8579
8836
|
designDisabledPeople: (item) => Boolean(item.designDisabledPeople),
|
|
8580
8837
|
};
|
|
8581
8838
|
const AtmsMap = JSX(({ descriptionData, className }) => {
|
|
8582
|
-
const
|
|
8839
|
+
const currentLocation = useLocation();
|
|
8583
8840
|
const regionCode = currentLocation?.code ?? '000';
|
|
8584
8841
|
const { data: officesData, isLoad } = useAtms(regionCode);
|
|
8585
8842
|
return (jsx(OfficesAtmsMapLayout, { className: className, filterItems: filterItems, data: officesData, isLoad: isLoad, initFilterState: INITIAL_FILTRATION_STATE, renderCard: renderAtmCard, getBalloon: getAtmPoint, title: `Банкоматы филиала ${currentLocation?.name}`, descriptionData: descriptionData }));
|
|
@@ -8632,7 +8889,7 @@
|
|
|
8632
8889
|
};
|
|
8633
8890
|
|
|
8634
8891
|
const OfficesMap = JSX(({ className }) => {
|
|
8635
|
-
const
|
|
8892
|
+
const currentLocation = useLocation();
|
|
8636
8893
|
const regionCode = currentLocation?.code ?? '000';
|
|
8637
8894
|
const { data, isLoad } = useOffices(regionCode);
|
|
8638
8895
|
return (jsx(OfficesAtmsMapLayout, { className: className, data: data?.branches, isLoad: isLoad, remoteWorkplaces: data?.remoteWorkplaces, renderCard: renderOfficeCard, renderRemoteWorkplaceCard: renderRemoteWorkplaceCard, getBalloon: getOfficePoint, getBalloonRemoteWorkplaces: getRemoteWorkplacePoint, title: `Офисы филиала ${currentLocation?.name}` }));
|
|
@@ -8881,6 +9138,9 @@
|
|
|
8881
9138
|
pop();
|
|
8882
9139
|
}, [dialogs, onClose]);
|
|
8883
9140
|
useEffect(() => defaultEventBus.subscribe('dialog', (action) => {
|
|
9141
|
+
if (!action) {
|
|
9142
|
+
return;
|
|
9143
|
+
}
|
|
8884
9144
|
switch (action.type) {
|
|
8885
9145
|
case 'open':
|
|
8886
9146
|
push(action);
|
|
@@ -8989,27 +9249,33 @@
|
|
|
8989
9249
|
return (jsxs("form", { className: `font-sans relative ${className}`, children: [jsx("div", { className: "absolute rounded h-full flex items-center justify-center pl-m max-w-44 gap-s pointer-events-none", children: searchTerm ? null : (jsx("label", { htmlFor: "search-bar-input", className: `text-secondary-text `, children: "\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0444\u0438\u043B\u0438\u0430\u043B\u0430\u043C" })) }), jsx("input", { id: "search-bar-input", className: style(inputValidStyle, `h-12 pl-m w-full peer text-l text-black rounded-md box-border`), value: searchTerm, onChange: (e) => onSearch(e.target.value.toLowerCase()), type: "text", name: "location-search-bar-input" })] }));
|
|
8990
9250
|
});
|
|
8991
9251
|
|
|
8992
|
-
const
|
|
8993
|
-
|
|
8994
|
-
const [currentLocation, selectCurrentLocation] = useLocation(branches?.default);
|
|
9252
|
+
const SelectedLocation = JSX(({ defaultLocation }) => {
|
|
9253
|
+
const currentLocation = useLocation(defaultLocation);
|
|
8995
9254
|
const link = useLink();
|
|
8996
9255
|
const { href } = link({ href: `/branches/${currentLocation.slug}` });
|
|
9256
|
+
return currentLocation ? (jsx("div", { className: "mb-s", children: jsxs(Paragraph, { size: "text-l", color: "text-primary-text", children: ["\u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u044B\u0431\u0440\u0430\u043D:", jsx(LinkWrapper, { href: href, className: "inline mx-2xs text-primary-main", children: currentLocation.name })] }) })) : null;
|
|
9257
|
+
});
|
|
9258
|
+
|
|
9259
|
+
const SEARCH_TERM_MIN_LENGTH = 3;
|
|
9260
|
+
const LocationDialog = JSX(({ foreignOffices, branches }) => {
|
|
9261
|
+
const locationStore = useDefaultLocation(branches?.default);
|
|
8997
9262
|
const [query, setQuery] = useState('');
|
|
8998
|
-
const
|
|
8999
|
-
const
|
|
9263
|
+
const rawRegions = useRegions();
|
|
9264
|
+
const regions = useMemo(() => cleanUpRegions(rawRegions).sort((a, b) => a.name.localeCompare(b.name)), [rawRegions]);
|
|
9265
|
+
const regionsGroupByLetter = useMemo(() => groupBy(regions, regionFirstLetter), [regions]);
|
|
9000
9266
|
const { close } = useDialogManager();
|
|
9001
|
-
const handleChangeLocation = useCallback((
|
|
9002
|
-
|
|
9267
|
+
const handleChangeLocation = useCallback((_) => {
|
|
9268
|
+
locationStore.location = _;
|
|
9003
9269
|
close();
|
|
9004
|
-
}, []);
|
|
9005
|
-
return (jsxs(Dialog, { className: "pb-20", head: jsxs("div", { children: [jsx(Text, { size: "text-h4", color: "text-primary-text", children: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B" }),
|
|
9270
|
+
}, [locationStore]);
|
|
9271
|
+
return (jsxs(Dialog, { className: "pb-20", head: jsxs("div", { children: [jsx(Text, { size: "text-h4", color: "text-primary-text", children: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B" }), jsx(SelectedLocation, { defaultLocation: branches?.default }), jsx(SearchBar, { onSearch: setQuery, searchTerm: query })] }), children: [query && query.length >= SEARCH_TERM_MIN_LENGTH ? (jsx("div", { children: regions
|
|
9006
9272
|
.filter(({ name }) => name && jaroWinklerDistance(name.toLowerCase())(query.toLowerCase()) >= 0.8)
|
|
9007
9273
|
.map(renderRegion(branches?.dataSelect, handleChangeLocation)) })) : (jsx("div", { className: "columns-1 sm:columns-3 md:columns-4 lg:columns-5", children: Array.from(regionsGroupByLetter.entries()).map(renderRegionGroup(handleChangeLocation, branches?.dataSelect)) })), renderForeignOffices(foreignOffices)] }));
|
|
9008
9274
|
});
|
|
9009
|
-
const regionFirstLetter = (region) => region.name?.charAt(0)
|
|
9275
|
+
const regionFirstLetter = (region) => region.name?.charAt(0) ?? '';
|
|
9010
9276
|
const cleanUpRegions = (regions) => regions.map((region) => ({
|
|
9011
9277
|
...region,
|
|
9012
|
-
name: region.name?.replace(/республика|область|край'/gi, '').trim()
|
|
9278
|
+
name: region.name?.replace(/республика|область|край'/gi, '').trim() ?? '',
|
|
9013
9279
|
}));
|
|
9014
9280
|
|
|
9015
9281
|
const useLocationDialog = (props) => {
|
|
@@ -9022,7 +9288,7 @@
|
|
|
9022
9288
|
|
|
9023
9289
|
const BurgerMenuDialog = JSX(({ menuRef, menuItem, locationDialogProps, closeAll }) => {
|
|
9024
9290
|
const locationDialog = useLocationDialog(locationDialogProps || {});
|
|
9025
|
-
const
|
|
9291
|
+
const { name: location } = useLocation();
|
|
9026
9292
|
const menuDimensions = menuRef?.current?.getBoundingClientRect();
|
|
9027
9293
|
const basePath = getBasePath(env.SITE_URL);
|
|
9028
9294
|
const handleIframeLoad = () => {
|
|
@@ -9585,6 +9851,9 @@
|
|
|
9585
9851
|
setPopup(null);
|
|
9586
9852
|
}, []);
|
|
9587
9853
|
useEffect(() => defaultEventBus.subscribe('popup', (action) => {
|
|
9854
|
+
if (!action) {
|
|
9855
|
+
return;
|
|
9856
|
+
}
|
|
9588
9857
|
switch (action.type) {
|
|
9589
9858
|
case 'open':
|
|
9590
9859
|
case 'update':
|
|
@@ -9618,6 +9887,7 @@
|
|
|
9618
9887
|
const { slots, blocks, fallback, ...pageContent } = data;
|
|
9619
9888
|
const resolvedPageContent = useJSONRef(pageContent, fallback);
|
|
9620
9889
|
useClickHandler();
|
|
9890
|
+
useDefaultLocation();
|
|
9621
9891
|
const options = {
|
|
9622
9892
|
key: '',
|
|
9623
9893
|
page: { slots, blocks, fallback, ...resolvedPageContent },
|
|
@@ -9639,7 +9909,7 @@
|
|
|
9639
9909
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
9640
9910
|
});
|
|
9641
9911
|
|
|
9642
|
-
const packageVersion = "0.14.
|
|
9912
|
+
const packageVersion = "0.14.675";
|
|
9643
9913
|
|
|
9644
9914
|
exports.Blocks = Blocks;
|
|
9645
9915
|
exports.ContentPage = ContentPage;
|