@applicaster/zapp-react-native-utils 15.0.0-alpha.9521406515 → 15.0.0-alpha.9884207424
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/arrayUtils/__tests__/allTruthy.test.ts +24 -0
- package/arrayUtils/__tests__/anyThruthy.test.ts +24 -0
- package/arrayUtils/index.ts +5 -0
- package/package.json +2 -2
- package/reactHooks/feed/useFeedRefresh.tsx +2 -5
- package/reactHooks/layout/index.ts +1 -1
- package/zappFrameworkUtils/HookCallback/callbackNavigationAction.ts +15 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { allTruthy } from "..";
|
|
2
|
+
|
|
3
|
+
describe("allTruthy", () => {
|
|
4
|
+
it("should return true when all values are true", () => {
|
|
5
|
+
expect(allTruthy([true, true, true])).toBe(true);
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it("should return false when at least one value is false", () => {
|
|
9
|
+
expect(allTruthy([true, false, true])).toBe(false);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should return false when all values are false", () => {
|
|
13
|
+
expect(allTruthy([false, false, false])).toBe(false);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should return false for an empty array", () => {
|
|
17
|
+
expect(allTruthy([])).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should handle single-element arrays correctly", () => {
|
|
21
|
+
expect(allTruthy([true])).toBe(true);
|
|
22
|
+
expect(allTruthy([false])).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { anyTruthy } from "..";
|
|
2
|
+
|
|
3
|
+
describe("anyTruthy", () => {
|
|
4
|
+
it("should return true when at least one value is true", () => {
|
|
5
|
+
expect(anyTruthy([false, true, false])).toBe(true);
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it("should return false when all values are false", () => {
|
|
9
|
+
expect(anyTruthy([false, false, false])).toBe(false);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should return true when all values are true", () => {
|
|
13
|
+
expect(anyTruthy([true, true, true])).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should return false for an empty array", () => {
|
|
17
|
+
expect(anyTruthy([])).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should handle single-element arrays correctly", () => {
|
|
21
|
+
expect(anyTruthy([true])).toBe(true);
|
|
22
|
+
expect(anyTruthy([false])).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
});
|
package/arrayUtils/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "15.0.0-alpha.
|
|
3
|
+
"version": "15.0.0-alpha.9884207424",
|
|
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": "15.0.0-alpha.
|
|
30
|
+
"@applicaster/applicaster-types": "15.0.0-alpha.9884207424",
|
|
31
31
|
"buffer": "^5.2.1",
|
|
32
32
|
"camelize": "^1.0.0",
|
|
33
33
|
"dayjs": "^1.11.10",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { isTrue } from "@applicaster/zapp-react-native-utils/booleanUtils";
|
|
2
|
+
import { max } from "ramda";
|
|
4
3
|
import { toNumberWithDefault } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
5
4
|
import { useIsScreenActive } from "@applicaster/zapp-react-native-utils/reactHooks/navigation";
|
|
6
5
|
|
|
@@ -19,9 +18,7 @@ const minimumRefreshingInterval = 5;
|
|
|
19
18
|
const defaultRefreshInterval = 60;
|
|
20
19
|
|
|
21
20
|
export const useFeedRefresh = ({ reloadData, component }: Props): void => {
|
|
22
|
-
const isDataRefreshingEnabled =
|
|
23
|
-
path(["rules", "enable_data_refreshing"], component)
|
|
24
|
-
);
|
|
21
|
+
const isDataRefreshingEnabled = false;
|
|
25
22
|
|
|
26
23
|
const refreshing_interval = toNumberWithDefault(
|
|
27
24
|
defaultRefreshInterval,
|
|
@@ -56,9 +56,23 @@ const legacyMappingKeys = {
|
|
|
56
56
|
actionType: "logout_completion_action",
|
|
57
57
|
targetScreen: "navigate_to_logout_screen",
|
|
58
58
|
},
|
|
59
|
+
"quick-brick-storefront": {
|
|
60
|
+
actionType: "purchase_completion_action",
|
|
61
|
+
targetScreen: "navigate_to_screen_after_purchase",
|
|
62
|
+
},
|
|
63
|
+
"zapp_login_plugin_oauth_tv_2_0.login": {
|
|
64
|
+
actionType: "login_completion_action",
|
|
65
|
+
targetScreen: "navigate_to_login_screen",
|
|
66
|
+
},
|
|
67
|
+
"zapp_login_plugin_oauth_tv_2_0.logout": {
|
|
68
|
+
actionType: "logout_completion_action",
|
|
69
|
+
targetScreen: "navigate_to_logout_screen",
|
|
70
|
+
},
|
|
59
71
|
};
|
|
60
72
|
|
|
61
|
-
const NAV_ACTIONS =
|
|
73
|
+
const NAV_ACTIONS = (
|
|
74
|
+
Object.values(NavigationCallbackOptions) as string[]
|
|
75
|
+
).filter((value) => value !== NavigationCallbackOptions.DEFAULT);
|
|
62
76
|
|
|
63
77
|
const isNavAction = (v: unknown): v is NavigationCallbackOptions =>
|
|
64
78
|
typeof v === "string" && NAV_ACTIONS.includes(v);
|