@redneckz/wildless-cms-uni-blocks 0.14.675 → 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 +398 -132
- 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/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/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 +398 -132
- 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/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/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/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/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);
|
|
744
847
|
}
|
|
848
|
+
set(p, child) {
|
|
849
|
+
return this.of({ ...this._, [p]: child });
|
|
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 {
|
|
@@ -3156,10 +3288,10 @@
|
|
|
3156
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 })));
|
|
3157
3289
|
|
|
3158
3290
|
const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
|
|
3159
|
-
const EMPTY_REGIONS = [];
|
|
3291
|
+
const EMPTY_REGIONS$1 = [];
|
|
3160
3292
|
async function getOutServiceRegions() {
|
|
3161
3293
|
const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
|
|
3162
|
-
return data && Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
3294
|
+
return data && Array.isArray(data) ? data : EMPTY_REGIONS$1;
|
|
3163
3295
|
}
|
|
3164
3296
|
|
|
3165
3297
|
const LocalitiesField = JSX(({ field, input }) => {
|
|
@@ -3292,9 +3424,11 @@
|
|
|
3292
3424
|
const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
|
|
3293
3425
|
|
|
3294
3426
|
const REGIONS_URL = `${API_BASE_URI}/regions`;
|
|
3427
|
+
const EMPTY_REGIONS = [];
|
|
3428
|
+
// TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
|
|
3295
3429
|
function useRegions(url = REGIONS_URL) {
|
|
3296
3430
|
const { data } = useAsyncData(url, fetchJSONUnsafe);
|
|
3297
|
-
return Array.isArray(data) ? data :
|
|
3431
|
+
return Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
3298
3432
|
}
|
|
3299
3433
|
|
|
3300
3434
|
const RegionField = JSX(({ field, input, url }) => {
|
|
@@ -6010,7 +6144,7 @@
|
|
|
6010
6144
|
: [cellsNode, []];
|
|
6011
6145
|
const [isVisible, setIsVisible] = useState(false);
|
|
6012
6146
|
useEffect(() => defaultEventBus.subscribe('fold', (event) => {
|
|
6013
|
-
if (options?.parent !== undefined && event.parent === options?.parent) {
|
|
6147
|
+
if (event && options?.parent !== undefined && event.parent === options?.parent) {
|
|
6014
6148
|
setIsVisible(event.isUnfolded);
|
|
6015
6149
|
}
|
|
6016
6150
|
}), [options?.parent]);
|
|
@@ -7914,47 +8048,166 @@
|
|
|
7914
8048
|
};
|
|
7915
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] })));
|
|
7916
8050
|
|
|
7917
|
-
|
|
7918
|
-
const [
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
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
|
+
}
|
|
7923
8194
|
|
|
7924
8195
|
const REGION_URL = `${API_BASE_URI}/region`;
|
|
7925
|
-
const LOCATION_STORAGE_KEY = 'location';
|
|
7926
8196
|
function useLocation(defaultLocation = 'Москва') {
|
|
7927
|
-
const
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
const
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
}
|
|
7937
|
-
}, [
|
|
7938
|
-
|
|
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;
|
|
7939
8210
|
}
|
|
7940
|
-
const hasStoredLocation = () => Boolean(globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY));
|
|
7941
|
-
const restoreLocation = () => {
|
|
7942
|
-
try {
|
|
7943
|
-
const data = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
|
|
7944
|
-
return data && JSON.parse(data);
|
|
7945
|
-
}
|
|
7946
|
-
catch (ex) {
|
|
7947
|
-
return null;
|
|
7948
|
-
}
|
|
7949
|
-
};
|
|
7950
|
-
const storeLocation = (_) => {
|
|
7951
|
-
try {
|
|
7952
|
-
globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
|
|
7953
|
-
}
|
|
7954
|
-
catch (ex) {
|
|
7955
|
-
// Do nothing
|
|
7956
|
-
}
|
|
7957
|
-
};
|
|
7958
8211
|
|
|
7959
8212
|
var Currency;
|
|
7960
8213
|
(function (Currency) {
|
|
@@ -8096,7 +8349,7 @@
|
|
|
8096
8349
|
}
|
|
8097
8350
|
|
|
8098
8351
|
const ExchangeRateTile = JSX(({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
|
|
8099
|
-
const
|
|
8352
|
+
const currentLocation = useLocation();
|
|
8100
8353
|
const exchangeRates = useFetchExchangeRateData(currentLocation);
|
|
8101
8354
|
const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
|
|
8102
8355
|
const currencyRatesBuy = currencyRates.filter((_) => _.buyExchangeRate);
|
|
@@ -8583,7 +8836,7 @@
|
|
|
8583
8836
|
designDisabledPeople: (item) => Boolean(item.designDisabledPeople),
|
|
8584
8837
|
};
|
|
8585
8838
|
const AtmsMap = JSX(({ descriptionData, className }) => {
|
|
8586
|
-
const
|
|
8839
|
+
const currentLocation = useLocation();
|
|
8587
8840
|
const regionCode = currentLocation?.code ?? '000';
|
|
8588
8841
|
const { data: officesData, isLoad } = useAtms(regionCode);
|
|
8589
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 }));
|
|
@@ -8636,7 +8889,7 @@
|
|
|
8636
8889
|
};
|
|
8637
8890
|
|
|
8638
8891
|
const OfficesMap = JSX(({ className }) => {
|
|
8639
|
-
const
|
|
8892
|
+
const currentLocation = useLocation();
|
|
8640
8893
|
const regionCode = currentLocation?.code ?? '000';
|
|
8641
8894
|
const { data, isLoad } = useOffices(regionCode);
|
|
8642
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}` }));
|
|
@@ -8885,6 +9138,9 @@
|
|
|
8885
9138
|
pop();
|
|
8886
9139
|
}, [dialogs, onClose]);
|
|
8887
9140
|
useEffect(() => defaultEventBus.subscribe('dialog', (action) => {
|
|
9141
|
+
if (!action) {
|
|
9142
|
+
return;
|
|
9143
|
+
}
|
|
8888
9144
|
switch (action.type) {
|
|
8889
9145
|
case 'open':
|
|
8890
9146
|
push(action);
|
|
@@ -8993,27 +9249,33 @@
|
|
|
8993
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" })] }));
|
|
8994
9250
|
});
|
|
8995
9251
|
|
|
8996
|
-
const
|
|
8997
|
-
|
|
8998
|
-
const [currentLocation, selectCurrentLocation] = useLocation(branches?.default);
|
|
9252
|
+
const SelectedLocation = JSX(({ defaultLocation }) => {
|
|
9253
|
+
const currentLocation = useLocation(defaultLocation);
|
|
8999
9254
|
const link = useLink();
|
|
9000
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);
|
|
9001
9262
|
const [query, setQuery] = useState('');
|
|
9002
|
-
const
|
|
9003
|
-
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]);
|
|
9004
9266
|
const { close } = useDialogManager();
|
|
9005
|
-
const handleChangeLocation = useCallback((
|
|
9006
|
-
|
|
9267
|
+
const handleChangeLocation = useCallback((_) => {
|
|
9268
|
+
locationStore.location = _;
|
|
9007
9269
|
close();
|
|
9008
|
-
}, []);
|
|
9009
|
-
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
|
|
9010
9272
|
.filter(({ name }) => name && jaroWinklerDistance(name.toLowerCase())(query.toLowerCase()) >= 0.8)
|
|
9011
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)] }));
|
|
9012
9274
|
});
|
|
9013
|
-
const regionFirstLetter = (region) => region.name?.charAt(0)
|
|
9275
|
+
const regionFirstLetter = (region) => region.name?.charAt(0) ?? '';
|
|
9014
9276
|
const cleanUpRegions = (regions) => regions.map((region) => ({
|
|
9015
9277
|
...region,
|
|
9016
|
-
name: region.name?.replace(/республика|область|край'/gi, '').trim()
|
|
9278
|
+
name: region.name?.replace(/республика|область|край'/gi, '').trim() ?? '',
|
|
9017
9279
|
}));
|
|
9018
9280
|
|
|
9019
9281
|
const useLocationDialog = (props) => {
|
|
@@ -9026,7 +9288,7 @@
|
|
|
9026
9288
|
|
|
9027
9289
|
const BurgerMenuDialog = JSX(({ menuRef, menuItem, locationDialogProps, closeAll }) => {
|
|
9028
9290
|
const locationDialog = useLocationDialog(locationDialogProps || {});
|
|
9029
|
-
const
|
|
9291
|
+
const { name: location } = useLocation();
|
|
9030
9292
|
const menuDimensions = menuRef?.current?.getBoundingClientRect();
|
|
9031
9293
|
const basePath = getBasePath(env.SITE_URL);
|
|
9032
9294
|
const handleIframeLoad = () => {
|
|
@@ -9589,6 +9851,9 @@
|
|
|
9589
9851
|
setPopup(null);
|
|
9590
9852
|
}, []);
|
|
9591
9853
|
useEffect(() => defaultEventBus.subscribe('popup', (action) => {
|
|
9854
|
+
if (!action) {
|
|
9855
|
+
return;
|
|
9856
|
+
}
|
|
9592
9857
|
switch (action.type) {
|
|
9593
9858
|
case 'open':
|
|
9594
9859
|
case 'update':
|
|
@@ -9622,6 +9887,7 @@
|
|
|
9622
9887
|
const { slots, blocks, fallback, ...pageContent } = data;
|
|
9623
9888
|
const resolvedPageContent = useJSONRef(pageContent, fallback);
|
|
9624
9889
|
useClickHandler();
|
|
9890
|
+
useDefaultLocation();
|
|
9625
9891
|
const options = {
|
|
9626
9892
|
key: '',
|
|
9627
9893
|
page: { slots, blocks, fallback, ...resolvedPageContent },
|
|
@@ -9643,7 +9909,7 @@
|
|
|
9643
9909
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
9644
9910
|
});
|
|
9645
9911
|
|
|
9646
|
-
const packageVersion = "0.14.
|
|
9912
|
+
const packageVersion = "0.14.675";
|
|
9647
9913
|
|
|
9648
9914
|
exports.Blocks = Blocks;
|
|
9649
9915
|
exports.ContentPage = ContentPage;
|