@applicaster/zapp-react-dom-app 12.0.2-rc.0 → 13.0.0-alpha.1839726411
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/App/Loader/SplashLoader.js +8 -7
- package/App/Loader/loadSessionStorageData.js +0 -1
- package/App/Loader/utils/platform.js +0 -1
- package/App/Router/index.js +6 -7
- package/App/Splash/Spinner.js +0 -1
- package/App/Splash/Splash.js +9 -6
- package/Polyfills/Storage/index.js +15 -26
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
/* global tizen */
|
|
3
2
|
import * as React from "react";
|
|
4
3
|
import * as R from "ramda";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
5
|
|
|
6
6
|
import { connectToStore } from "@applicaster/zapp-react-native-redux";
|
|
7
7
|
import { QUICK_BRICK_EVENTS } from "@applicaster/zapp-react-native-bridge/QuickBrick";
|
|
@@ -9,17 +9,12 @@ import { QUICK_BRICK_EVENTS } from "@applicaster/zapp-react-native-bridge/QuickB
|
|
|
9
9
|
import { QuickBrickEvents } from "../../Polyfills/QuickBrickCommunicationModule";
|
|
10
10
|
import { Splash } from "../Splash";
|
|
11
11
|
|
|
12
|
-
type Props = {
|
|
13
|
-
appLaunched: boolean,
|
|
14
|
-
children: any,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
12
|
const getAppLaunched = R.compose(
|
|
18
13
|
R.assoc("appLaunched", R.__, {}),
|
|
19
14
|
R.path(["appState", "appLaunched"])
|
|
20
15
|
);
|
|
21
16
|
|
|
22
|
-
class SplashHandler extends React.Component
|
|
17
|
+
class SplashHandler extends React.Component {
|
|
23
18
|
constructor(props) {
|
|
24
19
|
super(props);
|
|
25
20
|
|
|
@@ -76,6 +71,12 @@ class SplashHandler extends React.Component<Props> {
|
|
|
76
71
|
}
|
|
77
72
|
}
|
|
78
73
|
|
|
74
|
+
SplashHandler.propTypes = {
|
|
75
|
+
appLaunched: PropTypes.bool.isRequired,
|
|
76
|
+
children: PropTypes.node.isRequired,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
SplashHandler.shouldShowSplash = true;
|
|
79
80
|
SplashHandler.shouldShowSplash = true;
|
|
80
81
|
|
|
81
82
|
export const SplashLoader = connectToStore(getAppLaunched)(SplashHandler);
|
package/App/Router/index.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
|
|
3
1
|
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
4
3
|
|
|
5
4
|
import { Router } from "react-router";
|
|
6
5
|
import { createMemoryHistory } from "history";
|
|
7
6
|
|
|
8
|
-
type Props = {
|
|
9
|
-
children: any,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
7
|
const history = createMemoryHistory();
|
|
13
8
|
|
|
14
|
-
export const ZappDomRouter = ({ children, ...otherProps }
|
|
9
|
+
export const ZappDomRouter = ({ children, ...otherProps }) => (
|
|
15
10
|
<Router history={history} {...otherProps}>
|
|
16
11
|
{children}
|
|
17
12
|
</Router>
|
|
18
13
|
);
|
|
14
|
+
|
|
15
|
+
ZappDomRouter.propTypes = {
|
|
16
|
+
children: PropTypes.node.isRequired,
|
|
17
|
+
};
|
package/App/Splash/Spinner.js
CHANGED
package/App/Splash/Splash.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import React from "react";
|
|
3
2
|
|
|
4
|
-
import
|
|
3
|
+
import PropTypes from "prop-types";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
remoteConfigurations: any,
|
|
8
|
-
};
|
|
5
|
+
import { verifyAssets } from "@applicaster/zapp-react-dom-ui-components/Helpers/protectHelper";
|
|
9
6
|
|
|
10
|
-
export const SplashComponent = ({ remoteConfigurations }
|
|
7
|
+
export const SplashComponent = ({ remoteConfigurations }) => {
|
|
11
8
|
const image = verifyAssets(remoteConfigurations.assets, [
|
|
12
9
|
"universal",
|
|
13
10
|
"splash",
|
|
@@ -19,3 +16,9 @@ export const SplashComponent = ({ remoteConfigurations }: Props) => {
|
|
|
19
16
|
</div>
|
|
20
17
|
);
|
|
21
18
|
};
|
|
19
|
+
|
|
20
|
+
SplashComponent.propTypes = {
|
|
21
|
+
remoteConfigurations: PropTypes.shape({
|
|
22
|
+
assets: PropTypes.object.isRequired,
|
|
23
|
+
}).isRequired,
|
|
24
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @flow
|
|
2
1
|
import * as R from "ramda";
|
|
3
2
|
|
|
4
3
|
import {
|
|
@@ -7,11 +6,11 @@ import {
|
|
|
7
6
|
} from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
8
7
|
import { mapKeys } from "@applicaster/zapp-react-native-utils/objectUtils";
|
|
9
8
|
|
|
10
|
-
export type StorageI = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
9
|
+
// export type StorageI = {
|
|
10
|
+
// setItem: (string, string, ?string) => Promise<any>,
|
|
11
|
+
// getItem: (string, ?string) => Promise<any>,
|
|
12
|
+
// getAllItems: () => Promise<any>,
|
|
13
|
+
// };
|
|
15
14
|
|
|
16
15
|
export const STORAGE_TYPES = ["localStorage", "sessionStorage"];
|
|
17
16
|
|
|
@@ -25,10 +24,7 @@ const NAMESPACE_SEPARATOR = "_::_";
|
|
|
25
24
|
* @param {?String} namespace
|
|
26
25
|
* @returns {String}
|
|
27
26
|
*/
|
|
28
|
-
export function applyNamespaceToKeyName(
|
|
29
|
-
key: string,
|
|
30
|
-
namespace: ?string
|
|
31
|
-
): string {
|
|
27
|
+
export function applyNamespaceToKeyName(key, namespace) {
|
|
32
28
|
return namespace ? `${namespace}${NAMESPACE_SEPARATOR}${key}` : key;
|
|
33
29
|
}
|
|
34
30
|
|
|
@@ -40,7 +36,7 @@ export function applyNamespaceToKeyName(
|
|
|
40
36
|
* @param {Function} fn function to run
|
|
41
37
|
* @returns {Promise}
|
|
42
38
|
*/
|
|
43
|
-
function tryAndResolve(fn
|
|
39
|
+
function tryAndResolve(fn) {
|
|
44
40
|
try {
|
|
45
41
|
return R.compose(
|
|
46
42
|
(value) => Promise.resolve(value),
|
|
@@ -62,7 +58,7 @@ function tryAndResolve(fn: (any) => any): Promise<any> {
|
|
|
62
58
|
* @returns {Function} storageObject.callMethod: invokes methods on the storage object
|
|
63
59
|
* @returns {Function} storageObject.getKeys: returns all existing keys in the storage object
|
|
64
60
|
*/
|
|
65
|
-
function getStorageObject(type
|
|
61
|
+
function getStorageObject(type) {
|
|
66
62
|
const storage = R.prop(type, window);
|
|
67
63
|
|
|
68
64
|
if (!R.includes(type, STORAGE_TYPES) || !storage) {
|
|
@@ -80,7 +76,7 @@ function getStorageObject(type: string): (any) => void | Promise<any> {
|
|
|
80
76
|
* @param {Array} args array of arguments to use when invoking the method
|
|
81
77
|
* @returns response of the method call
|
|
82
78
|
*/
|
|
83
|
-
function callMethod(method
|
|
79
|
+
function callMethod(method, ...args) {
|
|
84
80
|
return storage[method](...args);
|
|
85
81
|
}
|
|
86
82
|
|
|
@@ -107,9 +103,9 @@ function getStorageObject(type: string): (any) => void | Promise<any> {
|
|
|
107
103
|
/**
|
|
108
104
|
* returns an object to interact with a storage module (localStorage or sessionStorage)
|
|
109
105
|
* @param {String} type of storage
|
|
110
|
-
* @returns {
|
|
106
|
+
* @returns {StorageI}
|
|
111
107
|
*/
|
|
112
|
-
export function getStorageModule(type
|
|
108
|
+
export function getStorageModule(type) {
|
|
113
109
|
const Storage = getStorageObject(type);
|
|
114
110
|
|
|
115
111
|
/**
|
|
@@ -120,11 +116,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
120
116
|
* @param {?String} namespace
|
|
121
117
|
* @returns {Promise<Boolean|Error>}
|
|
122
118
|
*/
|
|
123
|
-
function setItem(
|
|
124
|
-
key: string,
|
|
125
|
-
value: string,
|
|
126
|
-
namespace: ?string = DEFAULT_NAMESPACE
|
|
127
|
-
): Promise<boolean | Error> {
|
|
119
|
+
function setItem(key, value, namespace = DEFAULT_NAMESPACE) {
|
|
128
120
|
const keyName = applyNamespaceToKeyName(
|
|
129
121
|
key,
|
|
130
122
|
namespace || DEFAULT_NAMESPACE
|
|
@@ -144,10 +136,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
144
136
|
* @param {?String} namespace
|
|
145
137
|
* @returns {Promise<Any|Error>}
|
|
146
138
|
*/
|
|
147
|
-
function getItem(
|
|
148
|
-
key: string,
|
|
149
|
-
namespace: ?string = DEFAULT_NAMESPACE
|
|
150
|
-
): Promise<any> {
|
|
139
|
+
function getItem(key, namespace = DEFAULT_NAMESPACE) {
|
|
151
140
|
const keyName = applyNamespaceToKeyName(
|
|
152
141
|
key,
|
|
153
142
|
namespace || DEFAULT_NAMESPACE
|
|
@@ -163,7 +152,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
163
152
|
* @param {?String} namespace
|
|
164
153
|
* @returns {Promise<Boolean|Error>}
|
|
165
154
|
*/
|
|
166
|
-
function removeItem(key
|
|
155
|
+
function removeItem(key, namespace = DEFAULT_NAMESPACE) {
|
|
167
156
|
const keyName = applyNamespaceToKeyName(key, namespace);
|
|
168
157
|
|
|
169
158
|
return tryAndResolve(() => Storage.callMethod("removeItem", keyName));
|
|
@@ -174,7 +163,7 @@ export function getStorageModule(type: string): StorageI {
|
|
|
174
163
|
* @param {?String} namespace
|
|
175
164
|
* @returns {Promise<Object|Error>}
|
|
176
165
|
*/
|
|
177
|
-
function getAllItems(namespace
|
|
166
|
+
function getAllItems(namespace = null) {
|
|
178
167
|
return tryAndResolve(() => {
|
|
179
168
|
const keys = Storage.getKeys();
|
|
180
169
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-dom-app",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0-alpha.1839726411",
|
|
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": "
|
|
26
|
-
"@applicaster/zapp-react-native-bridge": "
|
|
27
|
-
"@applicaster/zapp-react-native-redux": "
|
|
28
|
-
"@applicaster/zapp-react-native-ui-components": "
|
|
29
|
-
"@applicaster/zapp-react-native-utils": "
|
|
25
|
+
"@applicaster/zapp-react-dom-ui-components": "13.0.0-alpha.1839726411",
|
|
26
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.1839726411",
|
|
27
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.1839726411",
|
|
28
|
+
"@applicaster/zapp-react-native-ui-components": "13.0.0-alpha.1839726411",
|
|
29
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.1839726411",
|
|
30
30
|
"abortcontroller-polyfill": "^1.7.5",
|
|
31
31
|
"history": "^4.7.2",
|
|
32
32
|
"react-router-dom": "^5.1.2",
|