@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
package/bundle/bundle.umd.js
CHANGED
|
@@ -406,32 +406,53 @@
|
|
|
406
406
|
className,
|
|
407
407
|
].join(' ');
|
|
408
408
|
|
|
409
|
-
class EventBus {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
this.
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
409
|
+
class EventBus {
|
|
410
|
+
watchers = new Set();
|
|
411
|
+
subscribersMap = {};
|
|
412
|
+
subjectsStateMap = {};
|
|
413
|
+
emitter = this;
|
|
414
|
+
observable = this;
|
|
415
|
+
watch(watcher) {
|
|
416
|
+
this.watchers.add(watcher);
|
|
417
|
+
return () => {
|
|
418
|
+
this.watchers.delete(watcher);
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
subscribe(type, listener) {
|
|
422
|
+
this.subscribersMap[type] ||= new Set();
|
|
423
|
+
this.subscribersMap[type]?.add(listener);
|
|
424
|
+
const initialEvent = this.subjectsStateMap[type];
|
|
425
|
+
initialEvent && listener(initialEvent);
|
|
426
|
+
return () => {
|
|
427
|
+
this.subscribersMap[type]?.delete(listener);
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
fire(type, event) {
|
|
431
|
+
const isSubjectDeclared = type in this.subjectsStateMap;
|
|
432
|
+
if (isSubjectDeclared) {
|
|
433
|
+
this.subject(type, event);
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
this.fireSubscribers(type, event);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
subject(type, event) {
|
|
440
|
+
if (this.subjectsStateMap[type] !== event) {
|
|
441
|
+
this.subjectsStateMap[type] = event ?? undefined;
|
|
442
|
+
this.fireSubscribers(type, event);
|
|
443
|
+
}
|
|
444
|
+
return () => {
|
|
445
|
+
delete this.subjectsStateMap[type];
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
fireSubscribers(type, event) {
|
|
449
|
+
for (const _ of this.subscribersMap[type] ?? []) {
|
|
450
|
+
_(event ?? null);
|
|
451
|
+
}
|
|
452
|
+
for (const _ of this.watchers) {
|
|
453
|
+
_({ type, event: event ?? null });
|
|
454
|
+
}
|
|
455
|
+
}
|
|
435
456
|
}
|
|
436
457
|
|
|
437
458
|
const defaultEventBus = new EventBus();
|
|
@@ -717,26 +738,166 @@
|
|
|
717
738
|
const leftOrRightImage = (img, directionRight) => directionRight ? { rightImage: img } : { leftImage: img };
|
|
718
739
|
const renderTags = (tags) => (tags?.length ? jsx(Tags, { tags: tags }) : null);
|
|
719
740
|
|
|
741
|
+
class JSONBox {
|
|
742
|
+
_;
|
|
743
|
+
constructor(_) {
|
|
744
|
+
this._ = _;
|
|
745
|
+
}
|
|
746
|
+
of(_) {
|
|
747
|
+
return new this.constructor(_ instanceof JSONBox ? _._ : _);
|
|
748
|
+
}
|
|
749
|
+
filter(predicate) {
|
|
750
|
+
return this.from(this.entries().filter(predicate));
|
|
751
|
+
}
|
|
752
|
+
map(mapper) {
|
|
753
|
+
return this.from(this.entries().map(mapper));
|
|
754
|
+
}
|
|
755
|
+
flatMap(mapper) {
|
|
756
|
+
return this.from(this.entries().flatMap(mapper));
|
|
757
|
+
}
|
|
758
|
+
reduce(reducer, initial) {
|
|
759
|
+
return this.entries().reduce(reducer.bind(this), initial);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
const trueF = () => true;
|
|
764
|
+
const and = (a, b) => (...args) => a(...args) && b(...args);
|
|
765
|
+
|
|
766
|
+
const table = (...table) => (...input) => {
|
|
767
|
+
const [, unit] = assertNonEmpty$1(table.find(([predicate]) => predicate(...input)));
|
|
768
|
+
return unit(...input);
|
|
769
|
+
};
|
|
770
|
+
function assertNonEmpty$1(value) {
|
|
771
|
+
if (!value) {
|
|
772
|
+
throw new Error('Value should be fulfilled');
|
|
773
|
+
}
|
|
774
|
+
return value;
|
|
775
|
+
}
|
|
776
|
+
|
|
720
777
|
const isJSONArray = (_) => Boolean(_ && Array.isArray(_));
|
|
721
|
-
const isJSONRecord = (_) => Boolean(_ &&
|
|
722
|
-
const isJSONRef = (_) => Boolean(isJSONRecord(_) && typeof _.$ref === 'string');
|
|
778
|
+
const isJSONRecord = (_) => Boolean(_ && typeof _ === 'object' && !isJSONArray(_));
|
|
723
779
|
|
|
724
|
-
const
|
|
725
|
-
|
|
726
|
-
|
|
780
|
+
const identity$1 = (x) => x;
|
|
781
|
+
|
|
782
|
+
const t0 = (fn = identity$1) => ([_]) => fn(_);
|
|
783
|
+
const t1 = (fn = identity$1) => ([, _]) => fn(_);
|
|
784
|
+
|
|
785
|
+
function unbox(box) {
|
|
786
|
+
return box instanceof JSONBox ? box._ : box;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
class JSONArrayBox extends JSONBox {
|
|
790
|
+
from(entries) {
|
|
791
|
+
return this.of(entries.map(t1(unbox)));
|
|
727
792
|
}
|
|
728
|
-
|
|
729
|
-
return
|
|
793
|
+
entries() {
|
|
794
|
+
return (this._ ?? []).map((node, p) => [p, this.of(node)]);
|
|
730
795
|
}
|
|
731
|
-
|
|
732
|
-
return
|
|
796
|
+
size() {
|
|
797
|
+
return this._?.length ?? 0;
|
|
733
798
|
}
|
|
734
|
-
|
|
735
|
-
return
|
|
799
|
+
get(p) {
|
|
800
|
+
return this.of(typeof p === 'number' ? this._?.[p] : undefined);
|
|
801
|
+
}
|
|
802
|
+
set(p, child) {
|
|
803
|
+
return this.of(isJSONArray(this._)
|
|
804
|
+
? Array.from({ length: Math.max(this._.length, Number(p) + 1) }, (x, i) => (i === p ? child : this._[i]))
|
|
805
|
+
: Array.from({ length: Number(p) + 1 }, (x, i) => (i === p ? child : undefined)));
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
class JSONLeafBox extends JSONBox {
|
|
810
|
+
from() {
|
|
811
|
+
return this;
|
|
812
|
+
}
|
|
813
|
+
entries() {
|
|
814
|
+
return [];
|
|
815
|
+
}
|
|
816
|
+
size() {
|
|
817
|
+
return 0;
|
|
818
|
+
}
|
|
819
|
+
get(p) {
|
|
820
|
+
return this.of(p !== undefined ? undefined /* no childs */ : this._ /* self */);
|
|
821
|
+
}
|
|
822
|
+
set(p, child) {
|
|
823
|
+
return this.of(child);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
class JSONRecordBox extends JSONBox {
|
|
828
|
+
from(entries) {
|
|
829
|
+
return this.of(Object.fromEntries(entries.map(([p, box]) => [p, unbox(box)])));
|
|
830
|
+
}
|
|
831
|
+
entries() {
|
|
832
|
+
return Object.entries(this._ ?? {}).map(([p, node]) => [p, this.of(node)]);
|
|
833
|
+
}
|
|
834
|
+
size() {
|
|
835
|
+
return Object.keys(this._ ?? {}).length;
|
|
836
|
+
}
|
|
837
|
+
get(p) {
|
|
838
|
+
return this.of(typeof p === 'string' ? this._?.[p] : undefined);
|
|
736
839
|
}
|
|
840
|
+
set(p, child) {
|
|
841
|
+
return this.of({ ...this._, [p]: child });
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
class JSONBoxDefault extends JSONBox {
|
|
846
|
+
proto = table([p => isJSONArray(this._) || typeof p === 'number', () => JSONArrayBox.prototype], [p => isJSONRecord(this._) || typeof p === 'string', () => JSONRecordBox.prototype], [trueF, () => JSONLeafBox.prototype]);
|
|
847
|
+
from(entries) {
|
|
848
|
+
return this.proto(undefined).from.call(this, entries);
|
|
849
|
+
}
|
|
850
|
+
entries() {
|
|
851
|
+
return this.proto(undefined).entries.call(this);
|
|
852
|
+
}
|
|
853
|
+
size() {
|
|
854
|
+
return this.proto(undefined).size.call(this);
|
|
855
|
+
}
|
|
856
|
+
get(p) {
|
|
857
|
+
return this.proto(p).get.call(this, p);
|
|
858
|
+
}
|
|
859
|
+
set(p, child) {
|
|
860
|
+
return this.proto(p).set.call(this, p, child);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
const box = (_) => (_ instanceof JSONBox ? _ : new JSONBoxDefault(_));
|
|
865
|
+
|
|
866
|
+
const boxed = (fn) => {
|
|
867
|
+
const boxedFn = (node, ...args) => unbox(fn(box(node), ...args));
|
|
868
|
+
boxedFn.fn = fn;
|
|
869
|
+
return boxedFn;
|
|
737
870
|
};
|
|
738
871
|
|
|
739
|
-
const
|
|
872
|
+
const ROOT = [];
|
|
873
|
+
const endsWith = (suffix) => suffix
|
|
874
|
+
.map((predicate, i) => (path) => cmp(predicate)(path[i + path.length - suffix.length]))
|
|
875
|
+
.reduceRight(and, trueF);
|
|
876
|
+
const cmp = (a) => a instanceof Function ? a : (b) => a === b;
|
|
877
|
+
|
|
878
|
+
const reduce = (reducer) => (node, initial, path = ROOT) => box(node)
|
|
879
|
+
.entries()
|
|
880
|
+
.reduce((acc, [p, _]) => reduce(reducer)(_, acc, path.concat(p)), reducer(initial, [path, box(node)]));
|
|
881
|
+
|
|
882
|
+
const set = boxed((target, [path, node]) => {
|
|
883
|
+
const [p, ...tail] = path;
|
|
884
|
+
return target.set(p, tail.length ? set(target.get(p), [tail, node]) : node);
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
const fromEntries = boxed((initial, tree) => tree.reduce(set.fn, initial));
|
|
888
|
+
|
|
889
|
+
const leafs = (node) => reduce((acc, [path, _]) => (isLeaf(_) ? [...acc, [path, unbox(_)]] : acc))(node, []);
|
|
890
|
+
const isLeaf = (_) => _.size() === 0;
|
|
891
|
+
|
|
892
|
+
const map = (mapper, initial = {}) => (node) => fromEntries(initial, leafs(node).map(_ => mapper(_)));
|
|
893
|
+
|
|
894
|
+
const init = (list) => list.slice(0, -1);
|
|
895
|
+
|
|
896
|
+
boxed((target, path = ROOT) => path.reduce((_, p) => _.get(p), target));
|
|
897
|
+
|
|
898
|
+
const remove = boxed((target, [p, ...tail]) => tail.length ? target.set(p, remove(target.get(p), tail)) : target.filter(([i]) => i !== p));
|
|
899
|
+
|
|
900
|
+
const isJSONRefPath = endsWith(['$ref']);
|
|
740
901
|
|
|
741
902
|
const parseJPointer = (uri) => uri.includes('#')
|
|
742
903
|
? uri
|
|
@@ -746,46 +907,17 @@
|
|
|
746
907
|
: [];
|
|
747
908
|
|
|
748
909
|
const resolveJPointer = (json, uri) => parseJPointer(uri).reduce(selectNodeByKey, json);
|
|
749
|
-
const selectNodeByKey = (json, key) =>
|
|
750
|
-
if (!json || !key) {
|
|
751
|
-
return json;
|
|
752
|
-
}
|
|
753
|
-
if (isJSONRecord(json)) {
|
|
754
|
-
return json[key];
|
|
755
|
-
}
|
|
756
|
-
else if (isJSONArray(json)) {
|
|
757
|
-
return json[parseInt(key, 10)];
|
|
758
|
-
}
|
|
759
|
-
else {
|
|
760
|
-
return json;
|
|
761
|
-
}
|
|
762
|
-
};
|
|
910
|
+
const selectNodeByKey = table([isJSONArray, (json, key) => json[parseInt(key, 10)]], [isJSONRecord, (json, key) => json[key]], [trueF, identity$1]);
|
|
763
911
|
|
|
764
|
-
const resolveRef = (json, resolver) =>
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
array: list => list.map(_ => resolveRef(_, resolver))
|
|
768
|
-
});
|
|
912
|
+
const resolveRef = (json, resolver) => map(([path, node]) => isJSONRefPath(path)
|
|
913
|
+
? [init(path), resolveJPointer(resolver(node), node)]
|
|
914
|
+
: [path, node])(json);
|
|
769
915
|
|
|
770
|
-
const
|
|
771
|
-
mapJSONNode(json, {
|
|
772
|
-
ref: json => visitor(json.$ref, path),
|
|
773
|
-
record: record => {
|
|
774
|
-
for (const key in record)
|
|
775
|
-
visitRef(record[key], visitor, [...path, key]);
|
|
776
|
-
},
|
|
777
|
-
array: list => {
|
|
778
|
-
for (let i = 0; i < list.length; i++)
|
|
779
|
-
visitRef(list[i], visitor, [...path, i]);
|
|
780
|
-
}
|
|
781
|
-
});
|
|
782
|
-
};
|
|
916
|
+
const refEntries = (json) => leafs(json).filter(t0(isJSONRefPath));
|
|
783
917
|
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
return refs;
|
|
788
|
-
};
|
|
918
|
+
const unique$1 = (list) => [...new Set(list)];
|
|
919
|
+
|
|
920
|
+
const collectRef = (json) => unique$1(refEntries(json).map(([, _]) => _));
|
|
789
921
|
|
|
790
922
|
async function fetchJSON(url, options) {
|
|
791
923
|
try {
|
|
@@ -1332,7 +1464,10 @@
|
|
|
1332
1464
|
const InputControl = JSX(({ className, label, value = '', placeholder, error, errors, onChange = noop, onDaDataChange, onBlur, isTextarea, type, name = '', daDataQueryPrefix, maxLength, dadata = false, disabled = false, }) => {
|
|
1333
1465
|
const [isOpen, { setFalse: close, setTrue: open }] = useBool();
|
|
1334
1466
|
const popupRef = useOutsideClick(close);
|
|
1335
|
-
const handleChange = useCallback((v) =>
|
|
1467
|
+
const handleChange = useCallback((v) => {
|
|
1468
|
+
dadata && !isOpen && open();
|
|
1469
|
+
maxLength ? v.length <= maxLength && onChange(v) : onChange(v);
|
|
1470
|
+
}, [dadata, isOpen, onChange]);
|
|
1336
1471
|
const inputRef = useInputPopup({
|
|
1337
1472
|
isOpen: isOpen && dadata,
|
|
1338
1473
|
name,
|
|
@@ -1426,6 +1561,7 @@
|
|
|
1426
1561
|
const required = validator((_) => _ !== null && _ !== undefined && _ !== '');
|
|
1427
1562
|
|
|
1428
1563
|
const ERROR_MESSAGE = 'Некорректно заполненное поле';
|
|
1564
|
+
const ADDRESS_ERROR_MESSAGE = 'Укажите регион, город/населенный пункт, улицу, дом';
|
|
1429
1565
|
const defaultValidator = (errorMsg) => required(errorMsg ?? ERROR_MESSAGE);
|
|
1430
1566
|
const defaultSelectValidator = (errorMsg) => validator((_) => _?.key && _?.key !== '')(errorMsg ?? ERROR_MESSAGE);
|
|
1431
1567
|
const jobNumberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 0 && _.length <= 2)(errorMsg ?? ERROR_MESSAGE);
|
|
@@ -1457,8 +1593,8 @@
|
|
|
1457
1593
|
const emailValidate = (email) => /^[^\s@]+@[^\s@]+\.[a-zA-Z]{2,4}$/.test(email);
|
|
1458
1594
|
const emailValidator = (errorMsg) => validator((_) => emailValidate(_))(errorMsg);
|
|
1459
1595
|
const addressDaDataValidate = (address) => Boolean(address.region && address.city && address.house);
|
|
1460
|
-
const addressDaDataValidator = () => validator(addressDaDataValidate)(
|
|
1461
|
-
const addressOrganizationValidator = () => validator((address) => Boolean(address.fiasCode && address.city && address.house))(
|
|
1596
|
+
const addressDaDataValidator = () => validator(addressDaDataValidate)(ADDRESS_ERROR_MESSAGE);
|
|
1597
|
+
const addressOrganizationValidator = () => validator((address) => Boolean(address.fiasCode && address.city && address.house))(ADDRESS_ERROR_MESSAGE);
|
|
1462
1598
|
const codeWordValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 3 && _.length <= 21 && isCyrillic(_))(errorMsg ?? ERROR_MESSAGE);
|
|
1463
1599
|
const cyrillicPattern = /^[\u0400-\u04FF\d]+$/u;
|
|
1464
1600
|
const isCyrillic = (_ = '') => cyrillicPattern.test(_);
|
|
@@ -1696,7 +1832,7 @@
|
|
|
1696
1832
|
if (value) {
|
|
1697
1833
|
field('addressFact')?.onChange?.(field('addressRegistration').value);
|
|
1698
1834
|
}
|
|
1699
|
-
}, [value]);
|
|
1835
|
+
}, [value, field('addressRegistration').value]);
|
|
1700
1836
|
const onDaDataChange = useCallback((item) => {
|
|
1701
1837
|
field?.(fieldName)?.onChange?.({
|
|
1702
1838
|
apartment: item?.data?.flat,
|
|
@@ -3144,10 +3280,10 @@
|
|
|
3144
3280
|
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 })));
|
|
3145
3281
|
|
|
3146
3282
|
const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
|
|
3147
|
-
const EMPTY_REGIONS = [];
|
|
3283
|
+
const EMPTY_REGIONS$1 = [];
|
|
3148
3284
|
async function getOutServiceRegions() {
|
|
3149
3285
|
const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
|
|
3150
|
-
return data && Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
3286
|
+
return data && Array.isArray(data) ? data : EMPTY_REGIONS$1;
|
|
3151
3287
|
}
|
|
3152
3288
|
|
|
3153
3289
|
const LocalitiesField = JSX(({ field, input }) => {
|
|
@@ -3280,9 +3416,11 @@
|
|
|
3280
3416
|
const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
|
|
3281
3417
|
|
|
3282
3418
|
const REGIONS_URL = `${API_BASE_URI}/regions`;
|
|
3419
|
+
const EMPTY_REGIONS = [];
|
|
3420
|
+
// TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
|
|
3283
3421
|
function useRegions(url = REGIONS_URL) {
|
|
3284
3422
|
const { data } = useAsyncData(url, fetchJSONUnsafe);
|
|
3285
|
-
return Array.isArray(data) ? data :
|
|
3423
|
+
return Array.isArray(data) ? data : EMPTY_REGIONS;
|
|
3286
3424
|
}
|
|
3287
3425
|
|
|
3288
3426
|
const RegionField = JSX(({ field, input, url }) => {
|
|
@@ -6038,7 +6176,7 @@
|
|
|
6038
6176
|
: [cellsNode, []];
|
|
6039
6177
|
const [isVisible, setIsVisible] = useState(false);
|
|
6040
6178
|
useEffect(() => defaultEventBus.subscribe('fold', (event) => {
|
|
6041
|
-
if (options?.parent !== undefined && event.parent === options?.parent) {
|
|
6179
|
+
if (event && options?.parent !== undefined && event.parent === options?.parent) {
|
|
6042
6180
|
setIsVisible(event.isUnfolded);
|
|
6043
6181
|
}
|
|
6044
6182
|
}), [options?.parent]);
|
|
@@ -7931,47 +8069,166 @@
|
|
|
7931
8069
|
};
|
|
7932
8070
|
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] })));
|
|
7933
8071
|
|
|
7934
|
-
|
|
7935
|
-
const [
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
8072
|
+
function copy(source, target) {
|
|
8073
|
+
for (const [k, v] of source.entries()) {
|
|
8074
|
+
if (v !== null && v !== undefined) {
|
|
8075
|
+
target.setItem(k, v);
|
|
8076
|
+
}
|
|
8077
|
+
else {
|
|
8078
|
+
target.removeItem(k);
|
|
8079
|
+
}
|
|
8080
|
+
}
|
|
8081
|
+
}
|
|
8082
|
+
|
|
8083
|
+
function replicate(primary, secondary) {
|
|
8084
|
+
copy(primary, secondary);
|
|
8085
|
+
copy(secondary, primary);
|
|
8086
|
+
return primary.bus.watch(({ type, event }) => {
|
|
8087
|
+
if (event !== null && event !== undefined) {
|
|
8088
|
+
secondary.setItem(type, event);
|
|
8089
|
+
}
|
|
8090
|
+
else {
|
|
8091
|
+
secondary.removeItem(type);
|
|
8092
|
+
}
|
|
8093
|
+
});
|
|
8094
|
+
}
|
|
8095
|
+
|
|
8096
|
+
class StorageAdapter {
|
|
8097
|
+
storage;
|
|
8098
|
+
bus;
|
|
8099
|
+
get size() {
|
|
8100
|
+
return this.storage?.length ?? 0;
|
|
8101
|
+
}
|
|
8102
|
+
constructor(storage, bus = new EventBus()) {
|
|
8103
|
+
this.storage = storage;
|
|
8104
|
+
this.bus = bus;
|
|
8105
|
+
}
|
|
8106
|
+
hasItem(key) {
|
|
8107
|
+
return Boolean(this.storage?.getItem(String(key)));
|
|
8108
|
+
}
|
|
8109
|
+
getItem(key) {
|
|
8110
|
+
const _ = this.storage?.getItem(String(key)) ?? null;
|
|
8111
|
+
try {
|
|
8112
|
+
return JSON.parse(String(_));
|
|
8113
|
+
}
|
|
8114
|
+
catch (ex) {
|
|
8115
|
+
return null;
|
|
8116
|
+
}
|
|
8117
|
+
}
|
|
8118
|
+
entries() {
|
|
8119
|
+
return Array.from({ length: this.size }, (_, i) => {
|
|
8120
|
+
const k = String(this.storage?.key(i));
|
|
8121
|
+
return [k, this.getItem(k)];
|
|
8122
|
+
});
|
|
8123
|
+
}
|
|
8124
|
+
setItem(key, value) {
|
|
8125
|
+
if (value !== null) {
|
|
8126
|
+
this.storage?.setItem(String(key), JSON.stringify(value));
|
|
8127
|
+
}
|
|
8128
|
+
else {
|
|
8129
|
+
this.storage?.removeItem(String(key));
|
|
8130
|
+
}
|
|
8131
|
+
this.bus?.subject(key, value);
|
|
8132
|
+
}
|
|
8133
|
+
removeItem(key) {
|
|
8134
|
+
this.storage?.removeItem(String(key));
|
|
8135
|
+
this.bus?.subject(key, null);
|
|
8136
|
+
}
|
|
8137
|
+
}
|
|
8138
|
+
|
|
8139
|
+
class Store {
|
|
8140
|
+
bus;
|
|
8141
|
+
store = new Map();
|
|
8142
|
+
get size() {
|
|
8143
|
+
return this.store.size;
|
|
8144
|
+
}
|
|
8145
|
+
constructor(bus = new EventBus()) {
|
|
8146
|
+
this.bus = bus;
|
|
8147
|
+
}
|
|
8148
|
+
hasItem(key) {
|
|
8149
|
+
return this.store.has(key);
|
|
8150
|
+
}
|
|
8151
|
+
getItem(key) {
|
|
8152
|
+
return this.store.get(key);
|
|
8153
|
+
}
|
|
8154
|
+
entries() {
|
|
8155
|
+
return this.store.entries();
|
|
8156
|
+
}
|
|
8157
|
+
setItem(key, value) {
|
|
8158
|
+
this.store.set(key, value);
|
|
8159
|
+
this.bus.subject(key, value);
|
|
8160
|
+
}
|
|
8161
|
+
removeItem(key) {
|
|
8162
|
+
this.store.delete(key);
|
|
8163
|
+
this.bus.subject(key, null);
|
|
8164
|
+
}
|
|
8165
|
+
}
|
|
8166
|
+
|
|
8167
|
+
function useRerender() {
|
|
8168
|
+
const [, setCount] = useState(0);
|
|
8169
|
+
return useCallback(() => setCount(_ => (_ + 1) % (1 << 16)), []);
|
|
8170
|
+
}
|
|
8171
|
+
|
|
8172
|
+
const DEFAULT_METHODS = {};
|
|
8173
|
+
/**
|
|
8174
|
+
* MobX like reactivity (simplified).
|
|
8175
|
+
* Can be used to migrate from Redux/MobX or something else
|
|
8176
|
+
*
|
|
8177
|
+
* @param store
|
|
8178
|
+
* @returns reactive proxy backed by store
|
|
8179
|
+
*/
|
|
8180
|
+
function useStore(store, methods = DEFAULT_METHODS) {
|
|
8181
|
+
const deps = useRef(null);
|
|
8182
|
+
const render = useRerender();
|
|
8183
|
+
useEffect(() => store.bus.watch(ev => {
|
|
8184
|
+
if (deps.current?.has(String(ev.type))) {
|
|
8185
|
+
render();
|
|
8186
|
+
}
|
|
8187
|
+
}), [store, render]);
|
|
8188
|
+
return useMemo(() => new Proxy(methods, {
|
|
8189
|
+
get(_, key) {
|
|
8190
|
+
deps.current ||= new Set();
|
|
8191
|
+
deps.current.add(key);
|
|
8192
|
+
return store.getItem(key);
|
|
8193
|
+
},
|
|
8194
|
+
has(_, key) {
|
|
8195
|
+
deps.current ||= new Set();
|
|
8196
|
+
deps.current.add(key);
|
|
8197
|
+
return store.hasItem(key);
|
|
8198
|
+
},
|
|
8199
|
+
set(_, key, value) {
|
|
8200
|
+
store.setItem(key, value);
|
|
8201
|
+
return true;
|
|
8202
|
+
},
|
|
8203
|
+
deleteProperty(_, key) {
|
|
8204
|
+
store.removeItem(key);
|
|
8205
|
+
return true;
|
|
8206
|
+
}
|
|
8207
|
+
}), [store]);
|
|
8208
|
+
}
|
|
8209
|
+
|
|
8210
|
+
const localStore = new Store(); // localStorage cache
|
|
8211
|
+
replicate(localStore, new StorageAdapter(globalThis?.localStorage));
|
|
8212
|
+
function useLocalStore(methods) {
|
|
8213
|
+
return useStore(localStore, methods);
|
|
8214
|
+
}
|
|
7940
8215
|
|
|
7941
8216
|
const REGION_URL = `${API_BASE_URI}/region`;
|
|
7942
|
-
const LOCATION_STORAGE_KEY = 'location';
|
|
7943
8217
|
function useLocation(defaultLocation = 'Москва') {
|
|
7944
|
-
const
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
const
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
}
|
|
7954
|
-
}, [
|
|
7955
|
-
|
|
8218
|
+
const locationStore = useLocalStore();
|
|
8219
|
+
return locationStore.location ?? { name: defaultLocation };
|
|
8220
|
+
}
|
|
8221
|
+
function useDefaultLocation(defaultLocation = 'Москва') {
|
|
8222
|
+
const locationStore = useLocalStore();
|
|
8223
|
+
const preselectLocation = useCallback(async () => {
|
|
8224
|
+
if (!locationStore.location) {
|
|
8225
|
+
const region = await fetchJSON(REGION_URL);
|
|
8226
|
+
locationStore.location = region ?? { name: defaultLocation };
|
|
8227
|
+
}
|
|
8228
|
+
}, [locationStore, defaultLocation]);
|
|
8229
|
+
useAsyncData(REGION_URL, preselectLocation);
|
|
8230
|
+
return locationStore;
|
|
7956
8231
|
}
|
|
7957
|
-
const hasStoredLocation = () => Boolean(globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY));
|
|
7958
|
-
const restoreLocation = () => {
|
|
7959
|
-
try {
|
|
7960
|
-
const data = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
|
|
7961
|
-
return data && JSON.parse(data);
|
|
7962
|
-
}
|
|
7963
|
-
catch (ex) {
|
|
7964
|
-
return null;
|
|
7965
|
-
}
|
|
7966
|
-
};
|
|
7967
|
-
const storeLocation = (_) => {
|
|
7968
|
-
try {
|
|
7969
|
-
globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
|
|
7970
|
-
}
|
|
7971
|
-
catch (ex) {
|
|
7972
|
-
// Do nothing
|
|
7973
|
-
}
|
|
7974
|
-
};
|
|
7975
8232
|
|
|
7976
8233
|
var Currency;
|
|
7977
8234
|
(function (Currency) {
|
|
@@ -8113,7 +8370,7 @@
|
|
|
8113
8370
|
}
|
|
8114
8371
|
|
|
8115
8372
|
const ExchangeRateTile = JSX(({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
|
|
8116
|
-
const
|
|
8373
|
+
const currentLocation = useLocation();
|
|
8117
8374
|
const exchangeRates = useFetchExchangeRateData(currentLocation);
|
|
8118
8375
|
const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
|
|
8119
8376
|
const currencyRatesBuy = currencyRates.filter((_) => _.buyExchangeRate);
|
|
@@ -8593,27 +8850,33 @@
|
|
|
8593
8850
|
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" })] }));
|
|
8594
8851
|
});
|
|
8595
8852
|
|
|
8596
|
-
const
|
|
8597
|
-
|
|
8598
|
-
const [currentLocation, selectCurrentLocation] = useLocation(branches?.default);
|
|
8853
|
+
const SelectedLocation = JSX(({ defaultLocation }) => {
|
|
8854
|
+
const currentLocation = useLocation(defaultLocation);
|
|
8599
8855
|
const link = useLink();
|
|
8600
8856
|
const { href } = link({ href: `/branches/${currentLocation.slug}` });
|
|
8857
|
+
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;
|
|
8858
|
+
});
|
|
8859
|
+
|
|
8860
|
+
const SEARCH_TERM_MIN_LENGTH = 3;
|
|
8861
|
+
const LocationDialog = JSX(({ foreignOffices, branches }) => {
|
|
8862
|
+
const locationStore = useDefaultLocation(branches?.default);
|
|
8601
8863
|
const [query, setQuery] = useState('');
|
|
8602
|
-
const
|
|
8603
|
-
const
|
|
8864
|
+
const rawRegions = useRegions();
|
|
8865
|
+
const regions = useMemo(() => cleanUpRegions(rawRegions).sort((a, b) => a.name.localeCompare(b.name)), [rawRegions]);
|
|
8866
|
+
const regionsGroupByLetter = useMemo(() => groupBy(regions, regionFirstLetter), [regions]);
|
|
8604
8867
|
const { close } = useDialogManager();
|
|
8605
|
-
const handleChangeLocation = useCallback((
|
|
8606
|
-
|
|
8868
|
+
const handleChangeLocation = useCallback((_) => {
|
|
8869
|
+
locationStore.location = _;
|
|
8607
8870
|
close();
|
|
8608
|
-
}, []);
|
|
8609
|
-
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" }),
|
|
8871
|
+
}, [locationStore]);
|
|
8872
|
+
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
|
|
8610
8873
|
.filter(({ name }) => name && jaroWinklerDistance(name.toLowerCase())(query.toLowerCase()) >= 0.8)
|
|
8611
8874
|
.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)] }));
|
|
8612
8875
|
});
|
|
8613
|
-
const regionFirstLetter = (region) => region.name?.charAt(0)
|
|
8876
|
+
const regionFirstLetter = (region) => region.name?.charAt(0) ?? '';
|
|
8614
8877
|
const cleanUpRegions = (regions) => regions.map((region) => ({
|
|
8615
8878
|
...region,
|
|
8616
|
-
name: region.name?.replace(/республика|область|край'/gi, '').trim()
|
|
8879
|
+
name: region.name?.replace(/республика|область|край'/gi, '').trim() ?? '',
|
|
8617
8880
|
}));
|
|
8618
8881
|
|
|
8619
8882
|
const useLocationDialog = (props) => {
|
|
@@ -8641,7 +8904,7 @@
|
|
|
8641
8904
|
|
|
8642
8905
|
const HeaderSecondaryMenu = JSX(({ className, version, ...rest }) => {
|
|
8643
8906
|
const iconVersion = version === 'transparent' ? 'white' : 'black';
|
|
8644
|
-
const
|
|
8907
|
+
const currentLocation = useLocation(rest?.branches?.default);
|
|
8645
8908
|
const searchDialog = useSearchDialog(rest);
|
|
8646
8909
|
const locationDialog = useLocationDialog(rest);
|
|
8647
8910
|
const openSearchDialog = useCallback(() => searchDialog.open(), [searchDialog]);
|
|
@@ -9173,7 +9436,7 @@
|
|
|
9173
9436
|
designDisabledPeople: (item) => Boolean(item.designDisabledPeople),
|
|
9174
9437
|
};
|
|
9175
9438
|
const AtmsMap = JSX(({ descriptionData, className }) => {
|
|
9176
|
-
const
|
|
9439
|
+
const currentLocation = useLocation();
|
|
9177
9440
|
const regionCode = currentLocation?.code ?? '000';
|
|
9178
9441
|
const { data: officesData, isLoad } = useAtms(regionCode);
|
|
9179
9442
|
return (jsx(OfficesAtmsMapLayout, { className: className, filterItems: filterItems, data: officesData, isLoad: isLoad, initFilterState: INITIAL_FILTRATION_STATE, renderCard: renderAtmCard, getBalloon: getAtmPoint, title: `Банкоматы филиала ${currentLocation?.name}`, descriptionData: descriptionData }));
|
|
@@ -9226,7 +9489,7 @@
|
|
|
9226
9489
|
};
|
|
9227
9490
|
|
|
9228
9491
|
const OfficesMap = JSX(({ className }) => {
|
|
9229
|
-
const
|
|
9492
|
+
const currentLocation = useLocation();
|
|
9230
9493
|
const regionCode = currentLocation?.code ?? '000';
|
|
9231
9494
|
const { data, isLoad } = useOffices(regionCode);
|
|
9232
9495
|
return (jsx(OfficesAtmsMapLayout, { className: className, data: data?.branches, isLoad: isLoad, remoteWorkplaces: data?.remoteWorkplaces, renderCard: renderOfficeCard, renderRemoteWorkplaceCard: renderRemoteWorkplaceCard, getBalloon: getOfficePoint, getBalloonRemoteWorkplaces: getRemoteWorkplacePoint, title: `Офисы филиала ${currentLocation?.name}` }));
|
|
@@ -9914,6 +10177,9 @@
|
|
|
9914
10177
|
pop();
|
|
9915
10178
|
}, [dialogs, onClose]);
|
|
9916
10179
|
useEffect(() => defaultEventBus.subscribe('dialog', (action) => {
|
|
10180
|
+
if (!action) {
|
|
10181
|
+
return;
|
|
10182
|
+
}
|
|
9917
10183
|
switch (action.type) {
|
|
9918
10184
|
case 'open':
|
|
9919
10185
|
push(action);
|
|
@@ -9971,6 +10237,9 @@
|
|
|
9971
10237
|
setPopup(null);
|
|
9972
10238
|
}, []);
|
|
9973
10239
|
useEffect(() => defaultEventBus.subscribe('popup', (action) => {
|
|
10240
|
+
if (!action) {
|
|
10241
|
+
return;
|
|
10242
|
+
}
|
|
9974
10243
|
switch (action.type) {
|
|
9975
10244
|
case 'open':
|
|
9976
10245
|
case 'update':
|
|
@@ -10004,6 +10273,7 @@
|
|
|
10004
10273
|
const { slots, blocks, fallback, ...pageContent } = data;
|
|
10005
10274
|
const resolvedPageContent = useJSONRef(pageContent, fallback);
|
|
10006
10275
|
useClickHandler();
|
|
10276
|
+
useDefaultLocation();
|
|
10007
10277
|
const options = {
|
|
10008
10278
|
key: '',
|
|
10009
10279
|
page: { slots, blocks, fallback, ...resolvedPageContent },
|
|
@@ -10025,7 +10295,7 @@
|
|
|
10025
10295
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
10026
10296
|
});
|
|
10027
10297
|
|
|
10028
|
-
const packageVersion = "0.14.
|
|
10298
|
+
const packageVersion = "0.14.675";
|
|
10029
10299
|
|
|
10030
10300
|
exports.Blocks = Blocks;
|
|
10031
10301
|
exports.ContentPage = ContentPage;
|