@applicaster/zapp-react-native-ui-components 13.0.0-alpha.1744140354 → 13.0.0-alpha.1855742455

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,12 @@
1
1
  /// <reference types="@applicaster/applicaster-types" />
2
2
  /// <reference types="@applicaster/zapp-react-native-ui-components" />
3
3
  import React, { useEffect, useMemo } from "react";
4
+ import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
5
+
4
6
  import * as R from "ramda";
5
7
  import { Platform } from "react-native";
6
8
  import Url from "url";
7
-
9
+ import { ENDPOINT_TAGS } from "@applicaster/zapp-react-native-utils/types";
8
10
  import { favoritesListener } from "@applicaster/zapp-react-native-bridge/Favorites";
9
11
  import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
10
12
  import { useRoute } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
@@ -19,6 +21,12 @@ import { ZappPipesSearchContext } from "@applicaster/zapp-react-native-ui-compon
19
21
  import { useScreenContext } from "@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext";
20
22
 
21
23
  import { isVerticalListOrGrid } from "./utils";
24
+ import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
25
+ import {
26
+ findEndpointForURL,
27
+ HTTP_METHODS,
28
+ } from "@applicaster/zapp-pipes-v2-client";
29
+ import { getNamespaceAndKey } from "@applicaster/zapp-react-native-utils/appUtils/contextKeysManager/utils";
22
30
 
23
31
  type Props = {
24
32
  component: ZappUIComponent;
@@ -291,6 +299,37 @@ export function zappPipesDataConnector(
291
299
  if (addListener) {
292
300
  return addListener(reloadData);
293
301
  }
302
+ } else {
303
+ const pipesEndpoints = appStore.get("pipesEndpoints");
304
+
305
+ const endpointURL = findEndpointForURL(
306
+ dataSourceUrl,
307
+ pipesEndpoints,
308
+ HTTP_METHODS.GET
309
+ );
310
+
311
+ const endpoint = pipesEndpoints?.[endpointURL];
312
+
313
+ if (endpoint?.tags?.includes(ENDPOINT_TAGS.observe_storage)) {
314
+ const storageKeys = endpoint.context_obj;
315
+
316
+ const subscriptions = [];
317
+
318
+ storageKeys.forEach((data) => {
319
+ const { namespace, key: storageKey } = getNamespaceAndKey(data.key);
320
+
321
+ const listener = localStorage.addListener(
322
+ { key: storageKey, namespace },
323
+ () => {
324
+ reloadData();
325
+ }
326
+ );
327
+
328
+ subscriptions.push(listener);
329
+ });
330
+
331
+ return () => subscriptions.forEach((listener) => listener());
332
+ }
294
333
  }
295
334
  }, [dataSourceUrl, reloadData]);
296
335
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-ui-components",
3
- "version": "13.0.0-alpha.1744140354",
3
+ "version": "13.0.0-alpha.1855742455",
4
4
  "description": "Applicaster Zapp React Native ui components for the Quick Brick App",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -34,10 +34,10 @@
34
34
  "redux-mock-store": "^1.5.3"
35
35
  },
36
36
  "dependencies": {
37
- "@applicaster/applicaster-types": "13.0.0-alpha.1744140354",
38
- "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1744140354",
39
- "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1744140354",
40
- "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1744140354",
37
+ "@applicaster/applicaster-types": "13.0.0-alpha.1855742455",
38
+ "@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1855742455",
39
+ "@applicaster/zapp-react-native-redux": "13.0.0-alpha.1855742455",
40
+ "@applicaster/zapp-react-native-utils": "13.0.0-alpha.1855742455",
41
41
  "promise": "^8.3.0",
42
42
  "react-router-native": "^5.1.2",
43
43
  "url": "^0.11.0",