@applicaster/zapp-react-native-utils 14.0.0-alpha.8583696651 → 14.0.0-alpha.9203091422

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "14.0.0-alpha.8583696651",
3
+ "version": "14.0.0-alpha.9203091422",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "homepage": "https://github.com/applicaster/quickbrick#readme",
29
29
  "dependencies": {
30
- "@applicaster/applicaster-types": "14.0.0-alpha.8583696651",
30
+ "@applicaster/applicaster-types": "14.0.0-alpha.9203091422",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",
@@ -16,7 +16,8 @@ import { ActionExecutorContext } from "@applicaster/zapp-react-native-utils/acti
16
16
  import { isFunction, noop } from "../../functionUtils";
17
17
  import { useSendAnalyticsOnPress } from "../analytics";
18
18
  import { logOnPress, warnEmptyContentType } from "./helpers";
19
- import { useCurrentScreenData } from "../screen";
19
+ import { useCurrentScreenData, useScreenContext } from "../screen";
20
+ import { useScreenStateStore } from "../navigation/useScreenStateStore";
20
21
 
21
22
  /**
22
23
  * If onCellTap is defined execute the function and
@@ -42,10 +43,12 @@ export const useCellClick = ({
42
43
  }: Props): onPressReturnFn => {
43
44
  const { push, currentRoute } = useNavigation();
44
45
  const { pathname } = useRoute();
46
+ const screenStateStore = useScreenStateStore();
45
47
 
46
48
  const onCellTap: Option<Function> = React.useContext(CellTapContext);
47
49
  const actionExecutor = React.useContext(ActionExecutorContext);
48
50
  const screenData = useCurrentScreenData();
51
+ const screenState = useScreenContext()?.options;
49
52
 
50
53
  const cellSelectable = toBooleanWithDefaultTrue(
51
54
  component?.rules?.component_cells_selectable
@@ -83,6 +86,9 @@ export const useCellClick = ({
83
86
  await actionExecutor?.handleEntryActions(selectedItem, {
84
87
  component,
85
88
  screenData,
89
+ screenState,
90
+ screenRoute: pathname,
91
+ screenStateStore,
86
92
  });
87
93
  }
88
94
 
@@ -117,6 +123,7 @@ export const useCellClick = ({
117
123
  push,
118
124
  sendAnalyticsOnPress,
119
125
  screenData,
126
+ screenState,
120
127
  ]
121
128
  );
122
129
 
@@ -138,6 +138,11 @@ describe("useFeedLoader", () => {
138
138
  expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
139
139
  clearCache: true,
140
140
  riverId: undefined,
141
+ resolvers: {
142
+ screen: {
143
+ screenStateStore: undefined,
144
+ },
145
+ },
141
146
  });
142
147
 
143
148
  const store2 = mockStore({
@@ -179,6 +184,11 @@ describe("useFeedLoader", () => {
179
184
  expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
180
185
  clearCache: true,
181
186
  riverId: undefined,
187
+ resolvers: {
188
+ screen: {
189
+ screenStateStore: undefined,
190
+ },
191
+ },
182
192
  });
183
193
 
184
194
  const store2 = mockStore({
@@ -228,6 +238,11 @@ describe("useFeedLoader", () => {
228
238
  expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
229
239
  clearCache: true,
230
240
  silentRefresh: true,
241
+ resolvers: {
242
+ screen: {
243
+ screenStateStore: undefined,
244
+ },
245
+ },
231
246
  });
232
247
 
233
248
  loadPipesDataSpy.mockRestore();
@@ -267,6 +282,11 @@ describe("useFeedLoader", () => {
267
282
  expect(loadPipesDataSpy).toBeCalledWith(nextUrl, {
268
283
  parentFeed: feedUrlWithNext,
269
284
  silentRefresh: true,
285
+ resolvers: {
286
+ screen: {
287
+ screenStateStore: undefined,
288
+ },
289
+ },
270
290
  });
271
291
 
272
292
  loadPipesDataSpy.mockRestore();
@@ -8,6 +8,7 @@ import { reactHooksLogger } from "../logger";
8
8
  import { shouldDispatchData, useIsInitialRender } from "../utils";
9
9
  import { useInflatedUrl } from "./useInflatedUrl";
10
10
  import { useRoute } from "../navigation";
11
+ import { useScreenResolvers } from "@applicaster/zapp-react-native-utils/actionsExecutor/screenResolver";
11
12
 
12
13
  const logger = reactHooksLogger.addSubsystem("useFeedLoader");
13
14
 
@@ -51,6 +52,7 @@ export const useFeedLoader = ({
51
52
  const isInitialRender = useIsInitialRender();
52
53
  const dispatch = useDispatch();
53
54
  const { screenData } = useRoute();
55
+ const resolvers = useScreenResolvers();
54
56
 
55
57
  const callableFeedUrl = useInflatedUrl({ feedUrl, mapping });
56
58
 
@@ -69,11 +71,12 @@ export const useFeedLoader = ({
69
71
  silentRefresh,
70
72
  callback,
71
73
  riverId,
74
+ resolvers,
72
75
  })
73
76
  );
74
77
  }
75
78
  },
76
- [callableFeedUrl]
79
+ [callableFeedUrl, resolvers]
77
80
  );
78
81
 
79
82
  const loadNext: FeedLoaderResponse["loadNext"] = React.useCallback(() => {
@@ -86,11 +89,12 @@ export const useFeedLoader = ({
86
89
  silentRefresh: true,
87
90
  parentFeed: callableFeedUrl,
88
91
  riverId,
92
+ resolvers,
89
93
  })
90
94
  );
91
95
  }
92
96
  }
93
- }, [callableFeedUrl, currentFeed?.data?.next]);
97
+ }, [callableFeedUrl, currentFeed?.data?.next, resolvers]);
94
98
 
95
99
  useEffect(() => {
96
100
  if (
@@ -102,6 +106,7 @@ export const useFeedLoader = ({
102
106
  ...pipesOptions,
103
107
  clearCache: true,
104
108
  riverId,
109
+ resolvers,
105
110
  })
106
111
  );
107
112
  } else if (!callableFeedUrl) {
@@ -126,14 +131,16 @@ export const useFeedLoader = ({
126
131
  jsOnly: true,
127
132
  });
128
133
  }
129
- }, []);
134
+ }, [resolvers]);
130
135
 
131
136
  // Reload feed when feedUrl changes, unless skipLoading is true
132
137
  useEffect(() => {
133
138
  if (!isInitialRender && callableFeedUrl && !pipesOptions.skipLoading) {
134
- dispatch(loadPipesData(callableFeedUrl, { ...pipesOptions, riverId }));
139
+ dispatch(
140
+ loadPipesData(callableFeedUrl, { ...pipesOptions, riverId, resolvers })
141
+ );
135
142
  }
136
- }, [callableFeedUrl]);
143
+ }, [callableFeedUrl, resolvers]);
137
144
 
138
145
  return React.useMemo(() => {
139
146
  if (!callableFeedUrl || !feedUrl) {
@@ -28,14 +28,19 @@ const isHookPathname = (pathname: string) => /^\/hooks\//.test(pathname);
28
28
 
29
29
  type VariousScreenData = LegacyNavigationScreenData | ZappRiver | ZappEntry;
30
30
 
31
- export const useRoute = (): {
31
+ export const useRoute = (
32
+ useLegacy = true
33
+ ): {
32
34
  screenData: VariousScreenData;
33
35
  pathname: string;
34
36
  } => {
35
37
  const pathname = usePathname() || "";
36
38
  const navigator = useNavigation();
39
+ const screenContext = useContext(ScreenDataContext);
37
40
 
38
- const screenDataContext = legacyScreenData(useContext(ScreenDataContext));
41
+ const screenDataContext = useLegacy
42
+ ? legacyScreenData(screenContext)
43
+ : screenContext;
39
44
 
40
45
  const { plugins, contentTypes, rivers } = usePickFromState([
41
46
  "plugins",
@@ -0,0 +1,8 @@
1
+ import { useRoute } from "./useRoute";
2
+ import { useMemo } from "react";
3
+
4
+ export const useScreenStateStore = () => {
5
+ const route = useRoute(false);
6
+
7
+ return useMemo(() => route.screenData["screenStateStore"], [route.pathname]);
8
+ };
@@ -0,0 +1,201 @@
1
+ import { BehaviorSubject } from "rxjs";
2
+ import { SingleValueProvider } from "./StorageSingleSelectProvider";
3
+ import { createLogger } from "../logger";
4
+ import { bridgeLogger } from "../../zapp-react-native-bridge/logger";
5
+
6
+ export const { log_debug, log_error } = createLogger({
7
+ category: "ScreenSingleValueProvider",
8
+ subsystem: "zapp-react-native-bridge",
9
+ parent: bridgeLogger,
10
+ });
11
+
12
+ export class ScreenSingleValueProvider implements SingleValueProvider {
13
+ // @ts-ignore
14
+ private valueSubject: BehaviorSubject<string | null>;
15
+ private screenStateStoreUnsubscribe: (() => void) | null = null;
16
+
17
+ private static providers: Record<
18
+ string,
19
+ Record<string, SingleValueProvider>
20
+ > = {};
21
+
22
+ public static getProvider(
23
+ key: string,
24
+ screenRoute: string,
25
+ screenStateStore: ScreenStateStore
26
+ ): SingleValueProvider {
27
+ if (!key) {
28
+ throw new Error("ScreenSingleValueProvider: Key is required");
29
+ }
30
+
31
+ if (!screenRoute) {
32
+ throw new Error("ScreenSingleValueProvider: Screen route is required");
33
+ }
34
+
35
+ if (!screenStateStore) {
36
+ throw new Error(
37
+ "ScreenSingleValueProvider: screen state store is required"
38
+ );
39
+ }
40
+
41
+ if (!this.providers[screenRoute]) {
42
+ this.providers[screenRoute] = {};
43
+ }
44
+
45
+ try {
46
+ if (!this.providers[screenRoute][key]) {
47
+ this.providers[screenRoute][key] = new ScreenSingleValueProvider(
48
+ key,
49
+ screenRoute,
50
+ screenStateStore
51
+ );
52
+ } else {
53
+ (
54
+ this.providers[screenRoute][key] as ScreenSingleValueProvider
55
+ ).updateStore(screenStateStore);
56
+ }
57
+ } catch (error) {
58
+ log_error("Failed to create provider", { key, screenRoute, error });
59
+ throw error;
60
+ }
61
+
62
+ return this.providers[screenRoute][key];
63
+ }
64
+
65
+ // @ts-ignore
66
+ private constructor(
67
+ private key: string,
68
+ route: string,
69
+ private screenStateStore: ScreenStateStore
70
+ ) {
71
+ if (!key) {
72
+ throw new Error("ScreenSingleValueProvider: Key is required");
73
+ }
74
+
75
+ if (!screenStateStore) {
76
+ throw new Error(
77
+ "ScreenSingleValueProvider: screen state store is required"
78
+ );
79
+ }
80
+
81
+ this.key = key;
82
+ this.valueSubject = new BehaviorSubject<string | null>(null);
83
+
84
+ this.setupScreenStateSubscription();
85
+
86
+ void this.getValueAsync();
87
+
88
+ log_debug("ScreenSingleValueProvider: Initializing", { key, route });
89
+ }
90
+
91
+ private updateStore(screenStateStore: ScreenStateStore): void {
92
+ this.cleanup();
93
+ this.screenStateStore = screenStateStore;
94
+ this.setupScreenStateSubscription();
95
+ void this.getValueAsync();
96
+ }
97
+
98
+ private setupScreenStateSubscription(): void {
99
+ this.screenStateStoreUnsubscribe = this.screenStateStore.subscribe(
100
+ (state) => ({
101
+ value: state.data[this.key],
102
+ exists: this.key in state.data,
103
+ }),
104
+ (current, previous) => {
105
+ if (!current.exists && previous.exists) {
106
+ log_debug(
107
+ `ScreenSingleValueProvider: Key deleted from store: ${this.key}`
108
+ );
109
+
110
+ // TODO: If we need to handle deletion, we can do it here
111
+ }
112
+
113
+ if (current.value !== previous.value) {
114
+ this.valueSubject.next(current.value || null);
115
+
116
+ log_debug(`ScreenSingleValueProvider: Key updated: ${this.key}`, {
117
+ previous: previous.value,
118
+ current: current.value,
119
+ });
120
+ }
121
+ }
122
+ );
123
+
124
+ log_debug(
125
+ `ScreenSingleValueProvider: screen state store subscription setup for key: ${this.key}`
126
+ );
127
+ }
128
+
129
+ private cleanup(): void {
130
+ if (this.screenStateStoreUnsubscribe) {
131
+ this.screenStateStoreUnsubscribe();
132
+ this.screenStateStoreUnsubscribe = null;
133
+
134
+ log_debug(
135
+ `ScreenSingleValueProvider: Unsubscribed from screen state store for key: ${this.key}`
136
+ );
137
+ }
138
+ }
139
+
140
+ clearValue(): Promise<void> {
141
+ this.screenStateStore.getState().removeValue(this.key);
142
+ this.valueSubject.next(null);
143
+
144
+ log_debug(`clearValue: value cleared for key: ${this.key}`);
145
+
146
+ return Promise.resolve();
147
+ }
148
+
149
+ getObservable(): BehaviorSubject<string | null> {
150
+ return this.valueSubject;
151
+ }
152
+
153
+ getValue(): string | null {
154
+ return this.valueSubject.value;
155
+ }
156
+
157
+ getValueAsync(): Promise<string | null> {
158
+ const currentValue = this.screenStateStore.getState().data[this.key];
159
+ const value = currentValue || null;
160
+ const selected = this.getValue();
161
+ const valuesAreEqual = value === selected;
162
+
163
+ const bothEmpty =
164
+ (value === null || value === "") &&
165
+ (selected === null || selected === "");
166
+
167
+ if (!this.valueSubject.closed && !valuesAreEqual && !bothEmpty) {
168
+ this.valueSubject.next(value);
169
+ }
170
+
171
+ return Promise.resolve(value);
172
+ }
173
+
174
+ setValue(value: string): Promise<void> {
175
+ this.screenStateStore.getState().setValue(this.key, value);
176
+ this.valueSubject.next(value);
177
+
178
+ log_debug(`setValue: value set for key: ${this.key}`, { value });
179
+
180
+ return Promise.resolve();
181
+ }
182
+
183
+ // TODO: remove if not needed
184
+
185
+ public static cleanupRoute(screenRoute: string): void {
186
+ if (this.providers[screenRoute]) {
187
+ Object.values(this.providers[screenRoute]).forEach((provider) => {
188
+ (provider as ScreenSingleValueProvider).destroy();
189
+ });
190
+
191
+ delete this.providers[screenRoute];
192
+ }
193
+ }
194
+
195
+ // TODO: remove if not needed
196
+
197
+ public destroy(): void {
198
+ this.valueSubject.complete();
199
+ this.cleanup();
200
+ }
201
+ }
@@ -0,0 +1,290 @@
1
+ import { MultiSelectProvider } from "./StorageMultiSelectProvider";
2
+ import { BehaviorSubject } from "rxjs";
3
+ import { createLogger } from "../logger";
4
+ import { bridgeLogger } from "../../zapp-react-native-bridge/logger";
5
+
6
+ export const { log_debug, log_error } = createLogger({
7
+ category: "ScreenMultiSelectProvider",
8
+ subsystem: "zapp-react-native-bridge",
9
+ parent: bridgeLogger,
10
+ });
11
+
12
+ export class ScreenMultiSelectProvider implements MultiSelectProvider {
13
+ // @ts-ignore
14
+ private itemSubject: BehaviorSubject<string[] | null>;
15
+ private screenStateStoreUnsubscribe: (() => void) | null = null;
16
+
17
+ private static providers: Record<
18
+ string,
19
+ Record<string, MultiSelectProvider>
20
+ > = {};
21
+
22
+ public static getProvider(
23
+ key: string,
24
+ screenRoute: string,
25
+ screenStateStore: ScreenStateStore
26
+ ): MultiSelectProvider {
27
+ if (!key) {
28
+ throw new Error("ScreenMultiSelectProvider: Key is required");
29
+ }
30
+
31
+ if (!screenRoute) {
32
+ throw new Error("ScreenMultiSelectProvider: Screen route is required");
33
+ }
34
+
35
+ if (!screenStateStore) {
36
+ throw new Error(
37
+ "ScreenMultiSelectProvider: screen state store is required"
38
+ );
39
+ }
40
+
41
+ if (!this.providers[screenRoute]) {
42
+ this.providers[screenRoute] = {};
43
+ }
44
+
45
+ try {
46
+ if (!this.providers[screenRoute][key]) {
47
+ this.providers[screenRoute][key] = new ScreenMultiSelectProvider(
48
+ key,
49
+ screenRoute,
50
+ screenStateStore
51
+ );
52
+ } else {
53
+ (
54
+ this.providers[screenRoute][key] as ScreenMultiSelectProvider
55
+ ).updateStore(screenStateStore);
56
+ }
57
+ } catch (error) {
58
+ log_error("Failed to create provider", { key, screenRoute, error });
59
+ throw error;
60
+ }
61
+
62
+ return this.providers[screenRoute][key];
63
+ }
64
+
65
+ // @ts-ignore
66
+ private constructor(
67
+ private key: string,
68
+ route: string,
69
+ private screenStateStore: ScreenStateStore
70
+ ) {
71
+ if (!key) {
72
+ throw new Error("ScreenMultiSelectProvider: Key is required");
73
+ }
74
+
75
+ if (!screenStateStore) {
76
+ throw new Error(
77
+ "ScreenMultiSelectProvider: screen state store is required"
78
+ );
79
+ }
80
+
81
+ this.key = key;
82
+ this.itemSubject = new BehaviorSubject<string[]>([]);
83
+
84
+ this.setupScreenStateSubscription();
85
+
86
+ void this.getSelectedAsync();
87
+
88
+ log_debug("ScreenMultiSelectProvider: Initializing", { key, route });
89
+ }
90
+
91
+ private updateStore(screenStateStore: ScreenStateStore): void {
92
+ if (screenStateStore === this.screenStateStore) {
93
+ return;
94
+ }
95
+
96
+ this.cleanup();
97
+ this.screenStateStore = screenStateStore;
98
+ this.setupScreenStateSubscription();
99
+ void this.getSelectedAsync();
100
+ }
101
+
102
+ private setupScreenStateSubscription(): void {
103
+ this.screenStateStoreUnsubscribe = this.screenStateStore.subscribe(
104
+ (state) => ({
105
+ value: state.data[this.key],
106
+ exists: this.key in state.data,
107
+ }),
108
+ (current, previous) => {
109
+ if (!current.exists && previous.exists) {
110
+ log_debug(
111
+ `ScreenMultiSelectProvider: Key deleted from store: ${this.key}`
112
+ );
113
+
114
+ // TODO: If we need to handle deletion, we can do it here
115
+ }
116
+
117
+ if (current.value !== previous.value) {
118
+ const items = this.parseStoredValue(current.value);
119
+ this.itemSubject.next(items);
120
+
121
+ log_debug(`ScreenMultiSelectProvider: Key updated: ${this.key}`, {
122
+ previous: this.parseStoredValue(previous.value),
123
+ current: items,
124
+ });
125
+ }
126
+ }
127
+ );
128
+
129
+ log_debug(
130
+ `ScreenMultiSelectProvider: screen state store subscription setup for key: ${this.key}`
131
+ );
132
+ }
133
+
134
+ private parseStoredValue(value: string): string[] {
135
+ if (!value) return [];
136
+
137
+ return typeof value === "string"
138
+ ? value.split(",").filter((item) => item.length > 0)
139
+ : [];
140
+ }
141
+
142
+ private formatValueForStorage(items: string[]): string {
143
+ return items.join(",");
144
+ }
145
+
146
+ private getCurrentItems(): Set<string> {
147
+ const currentValue = this.screenStateStore.getState().data[this.key];
148
+ const items = this.parseStoredValue(currentValue);
149
+
150
+ return new Set(items);
151
+ }
152
+
153
+ private updateScreenState(items: Set<string>): void {
154
+ const itemsArray = Array.from(items);
155
+ const formattedValue = this.formatValueForStorage(itemsArray);
156
+
157
+ this.screenStateStore.getState().setValue(this.key, formattedValue);
158
+ const itemsToUpdate = Array.from(items) || [];
159
+ this.itemSubject.next(itemsToUpdate);
160
+ }
161
+
162
+ private cleanup(): void {
163
+ if (this.screenStateStoreUnsubscribe) {
164
+ this.screenStateStoreUnsubscribe();
165
+ this.screenStateStoreUnsubscribe = null;
166
+
167
+ log_debug(
168
+ `ScreenMultiSelectProvider: Unsubscribed from screen state store for key: ${this.key}`
169
+ );
170
+ }
171
+ }
172
+
173
+ addItem(item: string): Promise<void> {
174
+ const items = this.getCurrentItems();
175
+ items.add(item);
176
+ this.updateScreenState(items);
177
+
178
+ log_debug(
179
+ `addItem: item added: ${item}, current items: [${Array.from(items).join(", ")}]`
180
+ );
181
+
182
+ return Promise.resolve();
183
+ }
184
+
185
+ addItems(itemsToAdd: string[]): Promise<void> {
186
+ const items = this.getCurrentItems();
187
+
188
+ for (const item of itemsToAdd) {
189
+ items.add(item);
190
+ }
191
+
192
+ this.updateScreenState(items);
193
+
194
+ log_debug(
195
+ `addItems: items added: [${itemsToAdd.join(", ")}], current items: [${Array.from(items).join(", ")}]`
196
+ );
197
+
198
+ return Promise.resolve();
199
+ }
200
+
201
+ public getObservable = (): BehaviorSubject<string[]> => this.itemSubject;
202
+
203
+ getSelectedAsync(): Promise<string[]> {
204
+ const currentValue = this.screenStateStore.getState().data[this.key] || [];
205
+ const values = this.parseStoredValue(currentValue);
206
+ const selected = this.getSelectedItems();
207
+
208
+ const arraysAreEqual =
209
+ Array.isArray(values) &&
210
+ Array.isArray(selected) &&
211
+ values.length === selected.length &&
212
+ values.every((val, index) => val === selected[index]);
213
+
214
+ const bothEmpty = values.length === 0 && selected.length === 0;
215
+
216
+ if (!this.itemSubject.closed && !arraysAreEqual && !bothEmpty) {
217
+ this.itemSubject.next(values);
218
+ }
219
+
220
+ return Promise.resolve(values);
221
+ }
222
+
223
+ getSelectedItems(): string[] {
224
+ return this.itemSubject.value || [];
225
+ }
226
+
227
+ removeAllItems(): Promise<void> {
228
+ this.screenStateStore.getState().removeValue(this.key);
229
+ this.itemSubject.next([]);
230
+
231
+ log_debug(`removeAllItems: all items removed for key: ${this.key}`);
232
+
233
+ return Promise.resolve();
234
+ }
235
+
236
+ removeItem(item: string): Promise<void> {
237
+ const items = this.getCurrentItems();
238
+ items.delete(item);
239
+
240
+ this.updateScreenState(items);
241
+
242
+ log_debug(
243
+ `removeItem: item removed: ${item}, remaining items: ${Array.from(items).join(", ")}`
244
+ );
245
+
246
+ return Promise.resolve();
247
+ }
248
+
249
+ removeItems(itemsToRemove: string[]): Promise<void> {
250
+ const items = this.getCurrentItems();
251
+
252
+ for (const item of itemsToRemove) {
253
+ items.delete(item);
254
+ }
255
+
256
+ this.updateScreenState(items);
257
+
258
+ log_debug(
259
+ `removeItems: items removed: [${itemsToRemove.join(", ")}], remaining items: [${Array.from(items).join(", ")}]`
260
+ );
261
+
262
+ return Promise.resolve();
263
+ }
264
+
265
+ setSelectedItems(items: string[]): Promise<void> {
266
+ this.updateScreenState(new Set(items));
267
+ log_debug(`setSelectedItems: items set to: [${items.join(", ")}]`);
268
+
269
+ return Promise.resolve();
270
+ }
271
+
272
+ // TODO: remove if not needed
273
+
274
+ public static cleanupRoute(screenRoute: string): void {
275
+ if (this.providers[screenRoute]) {
276
+ Object.values(this.providers[screenRoute]).forEach((provider) => {
277
+ (provider as ScreenMultiSelectProvider).destroy();
278
+ });
279
+
280
+ delete this.providers[screenRoute];
281
+ }
282
+ }
283
+
284
+ // TODO: remove if not needed
285
+
286
+ public destroy(): void {
287
+ this.itemSubject.complete();
288
+ this.cleanup();
289
+ }
290
+ }