@applicaster/zapp-react-native-utils 14.0.0-alpha.7900711229 → 14.0.0-alpha.8419134002
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/actionsExecutor/ActionExecutorContext.tsx +83 -60
- package/analyticsUtils/AnalyticsEvents/helper.ts +81 -0
- package/analyticsUtils/AnalyticsEvents/sendOnClickEvent.ts +14 -4
- package/analyticsUtils/__tests__/analyticsUtils.test.js +14 -0
- package/analyticsUtils/events.ts +8 -0
- package/appUtils/accessibilityManager/index.ts +3 -3
- package/appUtils/contextKeysManager/contextResolver.ts +1 -14
- package/focusManager/FocusManager.ts +4 -6
- package/manifestUtils/defaultManifestConfigurations/player.js +8 -0
- package/package.json +2 -2
- package/playerUtils/getPlayerActionButtons.ts +1 -1
- package/reactHooks/cell-click/index.ts +1 -8
- package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +0 -20
- package/reactHooks/feed/useBatchLoading.ts +1 -1
- package/reactHooks/feed/useFeedLoader.tsx +5 -12
- package/reactHooks/feed/usePipesCacheReset.ts +1 -1
- package/reactHooks/navigation/useIsScreenActive.ts +9 -5
- package/reactHooks/navigation/useRoute.ts +2 -7
- package/reactHooks/screen/useScreenContext.ts +1 -1
- package/reactHooks/state/__tests__/ZStoreProvider.test.tsx +2 -1
- package/riverComponetsMeasurementProvider/index.tsx +1 -1
- package/services/js2native.ts +1 -0
- package/time/BackgroundTimer.ts +5 -3
- package/utils/index.ts +4 -0
- package/actionsExecutor/ScreenActions.ts +0 -163
- package/actionsExecutor/StorageActions.ts +0 -110
- package/actionsExecutor/feedDecorator.ts +0 -171
- package/actionsExecutor/screenResolver.ts +0 -11
- package/reactHooks/navigation/useScreenStateStore.ts +0 -11
- package/storage/ScreenSingleValueProvider.ts +0 -197
- package/storage/ScreenStateMultiSelectProvider.ts +0 -282
- package/storage/StorageMultiSelectProvider.ts +0 -192
- package/storage/StorageSingleSelectProvider.ts +0 -108
|
@@ -16,6 +16,7 @@ import { QUICK_BRICK_EVENTS } from "@applicaster/zapp-react-native-bridge/QuickB
|
|
|
16
16
|
import { showConfirmationDialog } from "../alertUtils";
|
|
17
17
|
import { createCloudEvent, sendCloudEvent } from "../cloudEventsUtils";
|
|
18
18
|
import { createLogger } from "../logger";
|
|
19
|
+
import { StorageMultiSelectProvider } from "@applicaster/zapp-react-native-bridge/ZappStorage/StorageMultiSelectProvider";
|
|
19
20
|
import { ACTIVE_LAYOUT_ID_STORAGE_KEY } from "@applicaster/quick-brick-core/App/remoteContextReloader/consts";
|
|
20
21
|
import { appStore } from "@applicaster/zapp-react-native-redux/AppStore";
|
|
21
22
|
import { loadPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
@@ -24,19 +25,15 @@ import {
|
|
|
24
25
|
resolveObjectValues,
|
|
25
26
|
} from "../appUtils/contextKeysManager/contextResolver";
|
|
26
27
|
import { useNavigation } from "../reactHooks";
|
|
28
|
+
import { get } from "../utils";
|
|
27
29
|
|
|
28
30
|
import {
|
|
29
31
|
useContentTypes,
|
|
30
32
|
usePickFromState,
|
|
31
33
|
} from "@applicaster/zapp-react-native-redux/hooks";
|
|
32
|
-
import {
|
|
34
|
+
import { TOGGLE_FLAG_MAX_ITEMS_REACHED_EVENT } from "./consts";
|
|
35
|
+
import { postEvent, useSubscriberFor } from "../reactHooks/useSubscriberFor";
|
|
33
36
|
import { APP_EVENTS } from "../appUtils/events";
|
|
34
|
-
import {
|
|
35
|
-
localStorageToggleFlag,
|
|
36
|
-
sessionStorageToggleFlag,
|
|
37
|
-
} from "./StorageActions";
|
|
38
|
-
|
|
39
|
-
import { screenSetVariable, screenToggleFlag } from "./ScreenActions";
|
|
40
37
|
|
|
41
38
|
export const { log_error, log_info, log_debug } = createLogger({
|
|
42
39
|
subsystem: "ActionExecutorContext",
|
|
@@ -85,6 +82,19 @@ function findParentComponent(
|
|
|
85
82
|
return null;
|
|
86
83
|
}
|
|
87
84
|
|
|
85
|
+
// send all data just in case (like for message string formatting)
|
|
86
|
+
// Type is not exported for now
|
|
87
|
+
type MaxTagsReachedEvent = {
|
|
88
|
+
selectedItems: string[];
|
|
89
|
+
maxItems: number;
|
|
90
|
+
tag: string;
|
|
91
|
+
keyNamespace: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
async function onMaxTagsReached(data: MaxTagsReachedEvent) {
|
|
95
|
+
postEvent(TOGGLE_FLAG_MAX_ITEMS_REACHED_EVENT, [data]);
|
|
96
|
+
}
|
|
97
|
+
|
|
88
98
|
const prepareDefaultActions = (actionExecutor) => {
|
|
89
99
|
actionExecutor.registerAction("localStorageSet", async (action) => {
|
|
90
100
|
const namespaces = action.options.content;
|
|
@@ -168,15 +178,10 @@ const prepareDefaultActions = (actionExecutor) => {
|
|
|
168
178
|
|
|
169
179
|
const entry = context?.entry || {};
|
|
170
180
|
const entryResolver = new EntryResolver(entry);
|
|
171
|
-
const screenData = context?.screenStateStore.getState().data || {};
|
|
172
|
-
const screenResolver = new EntryResolver(screenData || {});
|
|
173
181
|
|
|
174
182
|
const data =
|
|
175
183
|
options?.data && options.inflateData
|
|
176
|
-
? await resolveObjectValues(options.data, {
|
|
177
|
-
entry: entryResolver,
|
|
178
|
-
screen: screenResolver,
|
|
179
|
-
})
|
|
184
|
+
? await resolveObjectValues(options.data, { entry: entryResolver })
|
|
180
185
|
: options?.data || entry;
|
|
181
186
|
|
|
182
187
|
const cloudEvent = await createCloudEvent({
|
|
@@ -210,63 +215,81 @@ const prepareDefaultActions = (actionExecutor) => {
|
|
|
210
215
|
return ActionResult.Error;
|
|
211
216
|
});
|
|
212
217
|
|
|
213
|
-
actionExecutor.registerAction(
|
|
214
|
-
"sessionStorageToggleFlag",
|
|
215
|
-
async (
|
|
216
|
-
action: ActionType,
|
|
217
|
-
context?: Record<string, any>
|
|
218
|
-
): Promise<ActionResult> => {
|
|
219
|
-
return await sessionStorageToggleFlag(context, action);
|
|
220
|
-
}
|
|
221
|
-
);
|
|
222
|
-
|
|
223
218
|
actionExecutor.registerAction(
|
|
224
219
|
"localStorageToggleFlag",
|
|
225
220
|
async (
|
|
226
221
|
action: ActionType,
|
|
227
222
|
context?: Record<string, any>
|
|
228
223
|
): Promise<ActionResult> => {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
224
|
+
if (!context) {
|
|
225
|
+
log_error(
|
|
226
|
+
"handleAction: localStorageToggleFlag action missing context"
|
|
227
|
+
);
|
|
232
228
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
async (
|
|
236
|
-
action: ActionType,
|
|
237
|
-
context?: Record<string, any>
|
|
238
|
-
): Promise<ActionResult> => {
|
|
239
|
-
const route = context?.screenRoute;
|
|
240
|
-
const screenStateStore = context?.screenStateStore;
|
|
241
|
-
|
|
242
|
-
await screenSetVariable(
|
|
243
|
-
route,
|
|
244
|
-
screenStateStore,
|
|
245
|
-
{ entry: context?.entry, options: action.options },
|
|
246
|
-
action
|
|
247
|
-
);
|
|
229
|
+
return ActionResult.Error;
|
|
230
|
+
}
|
|
248
231
|
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
);
|
|
232
|
+
const entry = context?.entry as ZappEntry;
|
|
252
233
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
)
|
|
234
|
+
if (!entry) {
|
|
235
|
+
log_error(
|
|
236
|
+
"handleAction: localStorageToggleFlag action missing entry. Entry is required to get the tag."
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
return ActionResult.Error;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const tag = action.options?.selector
|
|
243
|
+
? get(entry, action.options.selector)
|
|
244
|
+
: (entry.extensions?.tag ?? entry.id);
|
|
245
|
+
|
|
246
|
+
const keyNamespace = action.options?.key;
|
|
247
|
+
|
|
248
|
+
if (keyNamespace && tag) {
|
|
249
|
+
const multiSelectProvider =
|
|
250
|
+
StorageMultiSelectProvider.getProvider(keyNamespace);
|
|
251
|
+
|
|
252
|
+
const selectedItems = await multiSelectProvider.getSelectedAsync();
|
|
253
|
+
const isTagInSelectedItems = selectedItems.includes(tag);
|
|
268
254
|
|
|
269
|
-
|
|
255
|
+
log_info(
|
|
256
|
+
`handleAction: localStorageToggleFlag event will ${
|
|
257
|
+
isTagInSelectedItems ? "remove" : "add"
|
|
258
|
+
} tag: ${tag} for keyNamespace: ${keyNamespace}, current selectedItems: ${selectedItems}`
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
if (selectedItems.includes(tag)) {
|
|
262
|
+
await multiSelectProvider.removeItem(tag);
|
|
263
|
+
} else {
|
|
264
|
+
const maxItems = action.options?.max_items;
|
|
265
|
+
|
|
266
|
+
if (maxItems && selectedItems.length >= maxItems) {
|
|
267
|
+
log_info(
|
|
268
|
+
`handleAction: localStorageToggleFlag event reached max items limit: ${maxItems}, cannot add tag: ${tag}`
|
|
269
|
+
);
|
|
270
|
+
|
|
271
|
+
await onMaxTagsReached({
|
|
272
|
+
selectedItems,
|
|
273
|
+
maxItems,
|
|
274
|
+
tag,
|
|
275
|
+
keyNamespace,
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
return ActionResult.Cancel;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
await multiSelectProvider.addItem(tag);
|
|
282
|
+
}
|
|
283
|
+
} else {
|
|
284
|
+
log_error(
|
|
285
|
+
"handleAction: localStorageToggleFlag event missing keyNamespace or tag",
|
|
286
|
+
{ keyNamespace, tag }
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
return ActionResult.Error;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return ActionResult.Success;
|
|
270
293
|
}
|
|
271
294
|
);
|
|
272
295
|
};
|
|
@@ -4,9 +4,12 @@ import {
|
|
|
4
4
|
ANALYTICS_COMPONENT_EVENTS,
|
|
5
5
|
ANALYTICS_CORE_EVENTS,
|
|
6
6
|
ANALYTICS_ENTRY_EVENTS,
|
|
7
|
+
ANALYTICS_PREFERENCES_EVENTS,
|
|
7
8
|
DOWNLOADS_EVENTS,
|
|
8
9
|
} from "../events";
|
|
9
10
|
import { isEmptyOrNil } from "../../cellUtils";
|
|
11
|
+
import { get } from "lodash";
|
|
12
|
+
import { StorageMultiSelectProvider } from "@applicaster/zapp-react-native-bridge/ZappStorage/StorageMultiSelectProvider";
|
|
10
13
|
|
|
11
14
|
export enum OfflineItemState {
|
|
12
15
|
notExist = "NOT_EXISTS",
|
|
@@ -102,6 +105,84 @@ export function eventForComponent(
|
|
|
102
105
|
return analyticsProps;
|
|
103
106
|
}
|
|
104
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Checks if an item is currently selected in localStorage based on its actions
|
|
110
|
+
* @param item - The item to check
|
|
111
|
+
* @returns boolean indicating if the item is currently selected
|
|
112
|
+
*/
|
|
113
|
+
function isItemPreviouslySelected(item: any): boolean {
|
|
114
|
+
const actions = item?.extensions?.tap_actions?.actions;
|
|
115
|
+
|
|
116
|
+
if (!actions) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const localStorageAction = actions.find(
|
|
121
|
+
(action) => action?.type === "localStorageToggleFlag"
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
if (!localStorageAction?.options?.key) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const keyNamespace = localStorageAction.options.key;
|
|
129
|
+
|
|
130
|
+
const tag = localStorageAction.options?.selector
|
|
131
|
+
? get(item, localStorageAction.options.selector)
|
|
132
|
+
: (item.extensions?.tag ?? item.id);
|
|
133
|
+
|
|
134
|
+
if (!tag) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
try {
|
|
139
|
+
const multiSelectProvider =
|
|
140
|
+
StorageMultiSelectProvider.getProvider(keyNamespace);
|
|
141
|
+
|
|
142
|
+
const selectedItems = multiSelectProvider.getSelectedItems();
|
|
143
|
+
|
|
144
|
+
return selectedItems.includes(tag);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function getLocalStorageSetPayload(extraProps) {
|
|
151
|
+
const { item } = extraProps;
|
|
152
|
+
|
|
153
|
+
const hasLocalStorageSetAction = item?.extensions?.tap_actions?.actions?.some(
|
|
154
|
+
(action) => action?.type === "localStorageSet"
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
if (!hasLocalStorageSetAction) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
[ANALYTICS_PREFERENCES_EVENTS.ITEM_SELECTED_STATUS]: true,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export function getLocalStorageToggleFlagPayload(extraProps) {
|
|
167
|
+
const { item } = extraProps;
|
|
168
|
+
|
|
169
|
+
const hasLocalStorageToggleAction =
|
|
170
|
+
item?.extensions?.tap_actions?.actions?.some(
|
|
171
|
+
(action) => action?.type === "localStorageToggleFlag"
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
if (!hasLocalStorageToggleAction) {
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const previouslySelected = isItemPreviouslySelected(item);
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
[ANALYTICS_PREFERENCES_EVENTS.ITEM_SELECTED_STATUS]: !previouslySelected,
|
|
182
|
+
[ANALYTICS_PREFERENCES_EVENTS.PREVIOUS_SELECTED_STATE]: previouslySelected,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
105
186
|
export function playEventForType(item) {
|
|
106
187
|
const itemType = item?.type && item.type?.value;
|
|
107
188
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { log_error, log_debug } from "../logger";
|
|
2
|
-
|
|
3
|
-
import { ANALYTICS_CORE_EVENTS } from "../events";
|
|
4
|
-
|
|
2
|
+
import { ANALYTICS_CORE_EVENTS, ACTION_TYPE } from "../events";
|
|
5
3
|
import { postAnalyticEvent } from "../manager";
|
|
6
4
|
import {
|
|
7
5
|
replaceAnalyticsPropsNils,
|
|
8
6
|
eventForEntry,
|
|
9
7
|
eventForComponent,
|
|
10
8
|
extensionsEvents,
|
|
9
|
+
getLocalStorageSetPayload,
|
|
10
|
+
getLocalStorageToggleFlagPayload,
|
|
11
11
|
} from "./helper";
|
|
12
12
|
|
|
13
13
|
declare type AnalyticsDefaultHelperProperties = {
|
|
@@ -26,7 +26,16 @@ export const sendOnClickEvent = ({
|
|
|
26
26
|
const castedExtraProps: ExtraProps = extraProps;
|
|
27
27
|
const componentData = component || extraProps.component;
|
|
28
28
|
const data = zappPipesData || extraProps.zappPipesData;
|
|
29
|
-
|
|
29
|
+
|
|
30
|
+
const actionCellPayload =
|
|
31
|
+
extraProps?.item?.type?.value === ACTION_TYPE
|
|
32
|
+
? getLocalStorageSetPayload(extraProps) ||
|
|
33
|
+
getLocalStorageToggleFlagPayload(extraProps)
|
|
34
|
+
: null;
|
|
35
|
+
|
|
36
|
+
const eventName = actionCellPayload
|
|
37
|
+
? ANALYTICS_CORE_EVENTS.TAP_SELECTABLE_CELL
|
|
38
|
+
: ANALYTICS_CORE_EVENTS.TAP_CELL;
|
|
30
39
|
|
|
31
40
|
if (!analyticsScreenData) {
|
|
32
41
|
log_error(
|
|
@@ -44,6 +53,7 @@ export const sendOnClickEvent = ({
|
|
|
44
53
|
...replaceAnalyticsPropsNils({
|
|
45
54
|
...analyticsScreenData,
|
|
46
55
|
}),
|
|
56
|
+
...actionCellPayload,
|
|
47
57
|
};
|
|
48
58
|
|
|
49
59
|
if (analyticsCustomProperties) {
|
|
@@ -3,8 +3,22 @@ import { ANALYTICS_CORE_EVENTS } from "../events";
|
|
|
3
3
|
|
|
4
4
|
jest.mock("@applicaster/zapp-react-native-utils/reactUtils", () => ({
|
|
5
5
|
isWeb: jest.fn(),
|
|
6
|
+
platformSelect: jest.fn(
|
|
7
|
+
(options) => options.android || options.ios || options.web
|
|
8
|
+
),
|
|
6
9
|
}));
|
|
7
10
|
|
|
11
|
+
jest.mock(
|
|
12
|
+
"@applicaster/zapp-react-native-bridge/ZappStorage/StorageMultiSelectProvider",
|
|
13
|
+
() => ({
|
|
14
|
+
StorageMultiSelectProvider: {
|
|
15
|
+
getProvider: jest.fn(() => ({
|
|
16
|
+
getSelectedItems: jest.fn(() => []),
|
|
17
|
+
})),
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
);
|
|
21
|
+
|
|
8
22
|
const mock_postAnalyticEvent = jest.fn();
|
|
9
23
|
const mock_startAnalyticsTimedEvent = jest.fn();
|
|
10
24
|
const mock_endAnalyticsTimedEvent = jest.fn();
|
package/analyticsUtils/events.ts
CHANGED
|
@@ -17,8 +17,11 @@ export const SCREEN_VIEW_EVENTS = {
|
|
|
17
17
|
TIME_ON_SCREEN: "time_on_screen",
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
export const ACTION_TYPE = "action";
|
|
21
|
+
|
|
20
22
|
export const TAPPING_EVENTS = {
|
|
21
23
|
TAP_CELL: "tap_cell",
|
|
24
|
+
TAP_SELECTABLE_CELL: "tap_selectable_cell",
|
|
22
25
|
TAP_MENU: "tap_menu",
|
|
23
26
|
TAP_NAVBAR_BACK_BUTTON: "tap_navbar_back_button",
|
|
24
27
|
};
|
|
@@ -99,6 +102,11 @@ export const ANALYTICS_COMPONENT_EVENTS = {
|
|
|
99
102
|
COMPONENT_SOURCE: "component_source",
|
|
100
103
|
};
|
|
101
104
|
|
|
105
|
+
export const ANALYTICS_PREFERENCES_EVENTS = {
|
|
106
|
+
ITEM_SELECTED_STATUS: "item_selected_status",
|
|
107
|
+
PREVIOUS_SELECTED_STATE: "previous_selected_state",
|
|
108
|
+
};
|
|
109
|
+
|
|
102
110
|
// ---------------- EVENTS ---------------------
|
|
103
111
|
export const AD_EVENT = {
|
|
104
112
|
ad_break_start: "player_ad_break_start",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BehaviorSubject } from "rxjs";
|
|
2
2
|
import { accessibilityManagerLogger as logger } from "./logger";
|
|
3
|
-
import { TTSManager } from "../platform
|
|
3
|
+
import { TTSManager } from "../platform";
|
|
4
4
|
import { BUTTON_ACCESSIBILITY_KEYS } from "./const";
|
|
5
5
|
import { AccessibilityRole } from "react-native";
|
|
6
|
-
import
|
|
6
|
+
import { toString } from "../../utils";
|
|
7
7
|
|
|
8
8
|
export class AccessibilityManager {
|
|
9
9
|
private static _instance: AccessibilityManager | null = null;
|
|
@@ -137,7 +137,7 @@ export class AccessibilityManager {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
public getButtonAccessibilityProps(name: string): AccessibilityProps {
|
|
140
|
-
const buttonName =
|
|
140
|
+
const buttonName = toString(name);
|
|
141
141
|
|
|
142
142
|
const buttonConfig = BUTTON_ACCESSIBILITY_KEYS[buttonName];
|
|
143
143
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ContextKeysManager } from "./index";
|
|
2
2
|
import * as R from "ramda";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
interface IResolver {
|
|
5
5
|
resolve: (string) => Promise<string | number | object>;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
// TODO: Rename to ObjectKeyResolver or similar
|
|
9
8
|
export class EntryResolver implements IResolver {
|
|
10
9
|
entry: ZappEntry;
|
|
11
10
|
|
|
@@ -22,18 +21,6 @@ export class EntryResolver implements IResolver {
|
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
// TODO: Move to proper place
|
|
26
|
-
|
|
27
|
-
export class ScreenStateResolver implements IResolver {
|
|
28
|
-
constructor(private screenStateStore: ScreenStateStore) {}
|
|
29
|
-
|
|
30
|
-
async resolve(key: string) {
|
|
31
|
-
const screenState = this.screenStateStore.getState().data;
|
|
32
|
-
|
|
33
|
-
return screenState?.[key];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
24
|
export class ContextResolver implements IResolver {
|
|
38
25
|
resolve = async (compositeKey: string) =>
|
|
39
26
|
ContextKeysManager.instance.getKey(compositeKey);
|
|
@@ -243,12 +243,10 @@ class FocusManager {
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
blurPrevious(options?: FocusManager.Android.CallbackOptions) {
|
|
246
|
-
|
|
247
|
-
FocusManager.instance.prevFocused
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
);
|
|
251
|
-
}
|
|
246
|
+
FocusManager.instance.prevFocused?.onBlur?.(
|
|
247
|
+
FocusManager.instance.prevFocused,
|
|
248
|
+
options ?? {} // Adding fallback to avoid potential regression caused by #7509
|
|
249
|
+
);
|
|
252
250
|
}
|
|
253
251
|
|
|
254
252
|
onDisableFocusChange = (id) => {
|
|
@@ -2985,6 +2985,14 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
2985
2985
|
type: "uploader",
|
|
2986
2986
|
default: "",
|
|
2987
2987
|
},
|
|
2988
|
+
{
|
|
2989
|
+
key: "audio_player_background_image_overlay",
|
|
2990
|
+
label: "Background Image Overlay",
|
|
2991
|
+
label_tooltip:
|
|
2992
|
+
"Add a semi-transparent color overlay to improve text readability over the background image.",
|
|
2993
|
+
type: "color_picker_rgba",
|
|
2994
|
+
initial_value: "rgba(17, 17, 17, 0.5)",
|
|
2995
|
+
},
|
|
2988
2996
|
{
|
|
2989
2997
|
type: "text_input",
|
|
2990
2998
|
label: "Item Image Key",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.8419134002",
|
|
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": "14.0.0-alpha.
|
|
30
|
+
"@applicaster/applicaster-types": "14.0.0-alpha.8419134002",
|
|
31
31
|
"buffer": "^5.2.1",
|
|
32
32
|
"camelize": "^1.0.0",
|
|
33
33
|
"dayjs": "^1.11.10",
|
|
@@ -16,8 +16,7 @@ import { ActionExecutorContext } from "@applicaster/zapp-react-native-utils/acti
|
|
|
16
16
|
import { isFunction, noop } from "../../functionUtils";
|
|
17
17
|
import { useSendAnalyticsOnPress } from "../analytics";
|
|
18
18
|
import { logOnPress, warnEmptyContentType } from "./helpers";
|
|
19
|
-
import { useCurrentScreenData
|
|
20
|
-
import { useScreenStateStore } from "../navigation/useScreenStateStore";
|
|
19
|
+
import { useCurrentScreenData } from "../screen";
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* If onCellTap is defined execute the function and
|
|
@@ -43,12 +42,10 @@ export const useCellClick = ({
|
|
|
43
42
|
}: Props): onPressReturnFn => {
|
|
44
43
|
const { push, currentRoute } = useNavigation();
|
|
45
44
|
const { pathname } = useRoute();
|
|
46
|
-
const screenStateStore = useScreenStateStore();
|
|
47
45
|
|
|
48
46
|
const onCellTap: Option<Function> = React.useContext(CellTapContext);
|
|
49
47
|
const actionExecutor = React.useContext(ActionExecutorContext);
|
|
50
48
|
const screenData = useCurrentScreenData();
|
|
51
|
-
const screenState = useScreenContext()?.options;
|
|
52
49
|
|
|
53
50
|
const cellSelectable = toBooleanWithDefaultTrue(
|
|
54
51
|
component?.rules?.component_cells_selectable
|
|
@@ -86,9 +83,6 @@ export const useCellClick = ({
|
|
|
86
83
|
await actionExecutor?.handleEntryActions(selectedItem, {
|
|
87
84
|
component,
|
|
88
85
|
screenData,
|
|
89
|
-
screenState,
|
|
90
|
-
screenRoute: pathname,
|
|
91
|
-
screenStateStore,
|
|
92
86
|
});
|
|
93
87
|
}
|
|
94
88
|
|
|
@@ -123,7 +117,6 @@ export const useCellClick = ({
|
|
|
123
117
|
push,
|
|
124
118
|
sendAnalyticsOnPress,
|
|
125
119
|
screenData,
|
|
126
|
-
screenState,
|
|
127
120
|
]
|
|
128
121
|
);
|
|
129
122
|
|
|
@@ -138,11 +138,6 @@ describe("useFeedLoader", () => {
|
|
|
138
138
|
expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
|
|
139
139
|
clearCache: true,
|
|
140
140
|
riverId: undefined,
|
|
141
|
-
resolvers: {
|
|
142
|
-
screen: {
|
|
143
|
-
screenStateStore: undefined,
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
141
|
});
|
|
147
142
|
|
|
148
143
|
const store2 = mockStore({
|
|
@@ -184,11 +179,6 @@ describe("useFeedLoader", () => {
|
|
|
184
179
|
expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
|
|
185
180
|
clearCache: true,
|
|
186
181
|
riverId: undefined,
|
|
187
|
-
resolvers: {
|
|
188
|
-
screen: {
|
|
189
|
-
screenStateStore: undefined,
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
182
|
});
|
|
193
183
|
|
|
194
184
|
const store2 = mockStore({
|
|
@@ -238,11 +228,6 @@ describe("useFeedLoader", () => {
|
|
|
238
228
|
expect(loadPipesDataSpy).toBeCalledWith(feedUrl, {
|
|
239
229
|
clearCache: true,
|
|
240
230
|
silentRefresh: true,
|
|
241
|
-
resolvers: {
|
|
242
|
-
screen: {
|
|
243
|
-
screenStateStore: undefined,
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
231
|
});
|
|
247
232
|
|
|
248
233
|
loadPipesDataSpy.mockRestore();
|
|
@@ -282,11 +267,6 @@ describe("useFeedLoader", () => {
|
|
|
282
267
|
expect(loadPipesDataSpy).toBeCalledWith(nextUrl, {
|
|
283
268
|
parentFeed: feedUrlWithNext,
|
|
284
269
|
silentRefresh: true,
|
|
285
|
-
resolvers: {
|
|
286
|
-
screen: {
|
|
287
|
-
screenStateStore: undefined,
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
270
|
});
|
|
291
271
|
|
|
292
272
|
loadPipesDataSpy.mockRestore();
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getSearchContext,
|
|
11
11
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
12
|
import { isGallery } from "@applicaster/zapp-react-native-utils/componentsUtils";
|
|
13
|
-
import { useScreenContext } from "../screen
|
|
13
|
+
import { useScreenContext } from "../screen";
|
|
14
14
|
|
|
15
15
|
type Options = {
|
|
16
16
|
initialBatchSize?: number;
|
|
@@ -8,7 +8,6 @@ import { reactHooksLogger } from "../logger";
|
|
|
8
8
|
import { shouldDispatchData, useIsInitialRender } from "../utils";
|
|
9
9
|
import { useInflatedUrl } from "./useInflatedUrl";
|
|
10
10
|
import { useRoute } from "../navigation";
|
|
11
|
-
import { useScreenResolvers } from "@applicaster/zapp-react-native-utils/actionsExecutor/screenResolver";
|
|
12
11
|
|
|
13
12
|
const logger = reactHooksLogger.addSubsystem("useFeedLoader");
|
|
14
13
|
|
|
@@ -52,7 +51,6 @@ export const useFeedLoader = ({
|
|
|
52
51
|
const isInitialRender = useIsInitialRender();
|
|
53
52
|
const dispatch = useDispatch();
|
|
54
53
|
const { screenData } = useRoute();
|
|
55
|
-
const resolvers = useScreenResolvers();
|
|
56
54
|
|
|
57
55
|
const callableFeedUrl = useInflatedUrl({ feedUrl, mapping });
|
|
58
56
|
|
|
@@ -71,12 +69,11 @@ export const useFeedLoader = ({
|
|
|
71
69
|
silentRefresh,
|
|
72
70
|
callback,
|
|
73
71
|
riverId,
|
|
74
|
-
resolvers,
|
|
75
72
|
})
|
|
76
73
|
);
|
|
77
74
|
}
|
|
78
75
|
},
|
|
79
|
-
[callableFeedUrl
|
|
76
|
+
[callableFeedUrl]
|
|
80
77
|
);
|
|
81
78
|
|
|
82
79
|
const loadNext: FeedLoaderResponse["loadNext"] = React.useCallback(() => {
|
|
@@ -89,12 +86,11 @@ export const useFeedLoader = ({
|
|
|
89
86
|
silentRefresh: true,
|
|
90
87
|
parentFeed: callableFeedUrl,
|
|
91
88
|
riverId,
|
|
92
|
-
resolvers,
|
|
93
89
|
})
|
|
94
90
|
);
|
|
95
91
|
}
|
|
96
92
|
}
|
|
97
|
-
}, [callableFeedUrl, currentFeed?.data?.next
|
|
93
|
+
}, [callableFeedUrl, currentFeed?.data?.next]);
|
|
98
94
|
|
|
99
95
|
useEffect(() => {
|
|
100
96
|
if (
|
|
@@ -106,7 +102,6 @@ export const useFeedLoader = ({
|
|
|
106
102
|
...pipesOptions,
|
|
107
103
|
clearCache: true,
|
|
108
104
|
riverId,
|
|
109
|
-
resolvers,
|
|
110
105
|
})
|
|
111
106
|
);
|
|
112
107
|
} else if (!callableFeedUrl) {
|
|
@@ -131,16 +126,14 @@ export const useFeedLoader = ({
|
|
|
131
126
|
jsOnly: true,
|
|
132
127
|
});
|
|
133
128
|
}
|
|
134
|
-
}, [
|
|
129
|
+
}, []);
|
|
135
130
|
|
|
136
131
|
// Reload feed when feedUrl changes, unless skipLoading is true
|
|
137
132
|
useEffect(() => {
|
|
138
133
|
if (!isInitialRender && callableFeedUrl && !pipesOptions.skipLoading) {
|
|
139
|
-
dispatch(
|
|
140
|
-
loadPipesData(callableFeedUrl, { ...pipesOptions, riverId, resolvers })
|
|
141
|
-
);
|
|
134
|
+
dispatch(loadPipesData(callableFeedUrl, { ...pipesOptions, riverId }));
|
|
142
135
|
}
|
|
143
|
-
}, [callableFeedUrl
|
|
136
|
+
}, [callableFeedUrl]);
|
|
144
137
|
|
|
145
138
|
return React.useMemo(() => {
|
|
146
139
|
if (!callableFeedUrl || !feedUrl) {
|
|
@@ -5,7 +5,7 @@ import { getDatasourceUrl } from "@applicaster/zapp-react-native-ui-components/D
|
|
|
5
5
|
import { usePipesContexts } from "@applicaster/zapp-react-native-ui-components/Decorators/RiverFeedLoader/utils/usePipesContexts";
|
|
6
6
|
import { clearPipesData } from "@applicaster/zapp-react-native-redux/ZappPipes";
|
|
7
7
|
|
|
8
|
-
import { useRoute } from "../navigation
|
|
8
|
+
import { useRoute } from "../navigation";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* reset river components cache when screen is unmounted
|