@applicaster/zapp-react-dom-app 13.0.8-rc.1 → 13.0.8

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,14 +1,12 @@
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";
10
8
 
11
- import { renameKeys, getDeviceData } from "./utils/platform";
9
+ import { getDeviceData, getUserAgent, renameKeys } from "./utils/platform";
12
10
  import { desiredKeysMap } from "./utils/const";
13
11
 
14
12
  /**
@@ -55,6 +53,9 @@ 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
 
@@ -63,6 +64,7 @@ async function gatherData(uuid) {
63
64
  ...NativeModules?.QuickBrickCommunicationModule,
64
65
  // Device data retrieved from native device apis
65
66
  ...deviceData,
67
+ userAgent: deviceData.userAgent || getUserAgent(),
66
68
  uuid: uuid || uuidv4(), // Created on first session, persisted in local thereafter
67
69
  sessionId: uuidv4(), // Created on every session
68
70
  locale: `{language=${languageLocale}, country=${countryLocale}}`,
@@ -79,21 +81,23 @@ async function gatherData(uuid) {
79
81
  * @param {Object} desiredKeys - The map of original key names to desired key names.
80
82
  */
81
83
  function storeData(data, desiredKeys) {
82
- // Pick only the keys we want and need, map them to the correct name, and reject any unusuable data
83
- const filteredData = R.compose(
84
- R.reject(isEmptyOrNil),
85
- R.reject(R.either(R.is(Object), R.is(Function))),
86
- mapKeys(renameKeys),
87
- R.pick(Object.keys(desiredKeys))
88
- )(data);
89
-
90
- R.forEachObjIndexed((value, key) => {
91
- if (key === "uuid") {
92
- 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);
93
97
  }
94
98
 
95
- sessionStorage.setItem(key, value);
96
- }, filteredData);
99
+ sessionStorage.setItem(renamedKey, value);
100
+ });
97
101
  }
98
102
 
99
103
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-dom-app",
3
- "version": "13.0.8-rc.1",
3
+ "version": "13.0.8",
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": "13.0.8-rc.1",
26
- "@applicaster/zapp-react-native-bridge": "13.0.8-rc.1",
27
- "@applicaster/zapp-react-native-redux": "13.0.8-rc.1",
28
- "@applicaster/zapp-react-native-ui-components": "13.0.8-rc.1",
29
- "@applicaster/zapp-react-native-utils": "13.0.8-rc.1",
25
+ "@applicaster/zapp-react-dom-ui-components": "13.0.8",
26
+ "@applicaster/zapp-react-native-bridge": "13.0.8",
27
+ "@applicaster/zapp-react-native-redux": "13.0.8",
28
+ "@applicaster/zapp-react-native-ui-components": "13.0.8",
29
+ "@applicaster/zapp-react-native-utils": "13.0.8",
30
30
  "abortcontroller-polyfill": "^1.7.5",
31
31
  "react-router-dom": "^5.1.2",
32
32
  "typeface-montserrat": "^0.0.54",