@applicaster/zapp-react-dom-app 14.0.0-rc.48 → 14.0.0-rc.49

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,9 +1,7 @@
1
- import * as R from "ramda";
2
1
  import { NativeModules } from "react-native";
3
2
  import uuidv4 from "uuid/v4";
4
3
 
5
4
  import { isEmptyOrNil } from "@applicaster/zapp-react-native-utils/cellUtils";
6
- import { mapKeys } from "@applicaster/zapp-react-native-utils/objectUtils";
7
5
  import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
8
6
  import { sessionStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/SessionStorage";
9
7
  import { localStorage } from "@applicaster/zapp-react-native-bridge/ZappStorage/LocalStorage";
@@ -55,14 +53,17 @@ export const loadPluginDataIntoSession = async (plugins = null) => {
55
53
  async function gatherData(uuid) {
56
54
  const deviceData = await getDeviceData();
57
55
 
56
+ // Prevent the device sdkVersion from overriding the build time value
57
+ delete deviceData.sdkVersion;
58
+
58
59
  const { languageLocale, countryLocale } =
59
60
  NativeModules?.QuickBrickCommunicationModule || {};
60
61
 
61
62
  const sessionStorageData = {
62
63
  // Build time values
63
64
  ...NativeModules?.QuickBrickCommunicationModule,
64
- // Device data retrieved from native device apis, sdkVersion of the device was overriding the build time value
65
- ...R.omit(["sdkVersion"], deviceData),
65
+ // Device data retrieved from native device apis
66
+ ...deviceData,
66
67
  userAgent: deviceData.userAgent || getUserAgent(),
67
68
  uuid: uuid || uuidv4(), // Created on first session, persisted in local thereafter
68
69
  sessionId: uuidv4(), // Created on every session
@@ -80,21 +81,23 @@ async function gatherData(uuid) {
80
81
  * @param {Object} desiredKeys - The map of original key names to desired key names.
81
82
  */
82
83
  function storeData(data, desiredKeys) {
83
- // Pick only the keys we want and need, map them to the correct name, and reject any unusuable data
84
- const filteredData = R.compose(
85
- R.reject(isEmptyOrNil),
86
- R.reject(R.either(R.is(Object), R.is(Function))),
87
- mapKeys(renameKeys),
88
- R.pick(Object.keys(desiredKeys))
89
- )(data);
90
-
91
- R.forEachObjIndexed((value, key) => {
92
- if (key === "uuid") {
93
- localStorage.setItem(key, value);
84
+ const desiredKeysList = Object.keys(desiredKeys);
85
+
86
+ Object.entries(data).forEach(([key, value]) => {
87
+ if (!desiredKeysList.includes(key)) return;
88
+
89
+ if (isEmptyOrNil(value)) return;
90
+
91
+ if (typeof value === "object" || typeof value === "function") return;
92
+
93
+ const renamedKey = renameKeys(key);
94
+
95
+ if (renamedKey === "uuid") {
96
+ localStorage.setItem(renamedKey, value);
94
97
  }
95
98
 
96
- sessionStorage.setItem(key, value);
97
- }, filteredData);
99
+ sessionStorage.setItem(renamedKey, value);
100
+ });
98
101
  }
99
102
 
100
103
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-dom-app",
3
- "version": "14.0.0-rc.48",
3
+ "version": "14.0.0-rc.49",
4
4
  "description": "Zapp App Component for Applicaster's Quick Brick React Native App",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "homepage": "https://github.com/applicaster/zapp-react-dom-app#readme",
24
24
  "dependencies": {
25
- "@applicaster/zapp-react-dom-ui-components": "14.0.0-rc.48",
26
- "@applicaster/zapp-react-native-bridge": "14.0.0-rc.48",
27
- "@applicaster/zapp-react-native-redux": "14.0.0-rc.48",
28
- "@applicaster/zapp-react-native-ui-components": "14.0.0-rc.48",
29
- "@applicaster/zapp-react-native-utils": "14.0.0-rc.48",
25
+ "@applicaster/zapp-react-dom-ui-components": "14.0.0-rc.49",
26
+ "@applicaster/zapp-react-native-bridge": "14.0.0-rc.49",
27
+ "@applicaster/zapp-react-native-redux": "14.0.0-rc.49",
28
+ "@applicaster/zapp-react-native-ui-components": "14.0.0-rc.49",
29
+ "@applicaster/zapp-react-native-utils": "14.0.0-rc.49",
30
30
  "abortcontroller-polyfill": "^1.7.5",
31
31
  "typeface-montserrat": "^0.0.54",
32
32
  "video.js": "7.14.3",