@applicaster/zapp-react-native-utils 12.0.20-rc.2 → 12.0.21-rc.0

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.
@@ -25,6 +25,8 @@ import {
25
25
  useContentTypes,
26
26
  usePickFromState,
27
27
  } from "@applicaster/zapp-react-native-redux/hooks";
28
+ import { TOGGLE_FLAG_MAX_ITEMS_REACHED_EVENT } from "./consts";
29
+ import { postEvent } from "../reactHooks/useSubscriberFor";
28
30
 
29
31
  const { log_error, log_info } = createLogger({
30
32
  subsystem: "ActionExecutorContext",
@@ -73,6 +75,19 @@ function findParentComponent(
73
75
  return null;
74
76
  }
75
77
 
78
+ // send all data just in case (like for message string formatting)
79
+ // Type is not exported for now
80
+ type MaxTagsReachedEvent = {
81
+ selectedItems: string[];
82
+ maxItems: number;
83
+ tag: string;
84
+ keyNamespace: string;
85
+ };
86
+
87
+ async function onMaxTagsReached(data: MaxTagsReachedEvent) {
88
+ postEvent(TOGGLE_FLAG_MAX_ITEMS_REACHED_EVENT, [data]);
89
+ }
90
+
76
91
  const prepareDefaultActions = (actionExecutor) => {
77
92
  actionExecutor.registerAction("localStorageSet", async (action) => {
78
93
  const namespaces = action.options.content;
@@ -240,6 +255,13 @@ const prepareDefaultActions = (actionExecutor) => {
240
255
  `handleAction: localStorageToggleFlag event reached max items limit: ${maxItems}, cannot add tag: ${tag}`
241
256
  );
242
257
 
258
+ await onMaxTagsReached({
259
+ selectedItems,
260
+ maxItems,
261
+ tag,
262
+ keyNamespace,
263
+ });
264
+
243
265
  return ActionResult.Cancel;
244
266
  }
245
267
 
@@ -0,0 +1,4 @@
1
+ export const TOGGLE_FLAG_MAX_ITEMS_REACHED_EVENT =
2
+ "action.localStorageToggleFlag.maxItemsReached";
3
+
4
+ export const ACTION_EXECUTOR_EVENT_SOURCE = "ActionExecutor";
@@ -251,6 +251,19 @@ const generalContent = () => ({
251
251
  key: "screen_title",
252
252
  initial_value: null,
253
253
  },
254
+ {
255
+ type: "text_input",
256
+ label: "Maximum Selection Reached - Alert Description",
257
+ key: "msg_maximum_selection_reached_message",
258
+ initial_value:
259
+ "You’ve reached the maximum number of items you can select.",
260
+ },
261
+ {
262
+ type: "text_input",
263
+ label: "Maximum Selection Reached - Alert Button",
264
+ key: "msg_maximum_selection_reached_message_ok_button",
265
+ initial_value: "Got it",
266
+ },
254
267
  ],
255
268
  },
256
269
  advertising: {
@@ -21,7 +21,30 @@ const ZAPPIFEST_FIELDS = {
21
21
  },
22
22
  };
23
23
 
24
- const TV_PLATFORMS = ["tvOS", "android", "LG", "samsung", "roku", "vizio"];
24
+ const TV_PLATFORMS_FOR_FONTS = [
25
+ "tvOS",
26
+ "android",
27
+ "LG",
28
+ "samsung",
29
+ "roku",
30
+ "vizio",
31
+ ];
32
+
33
+ const MOBILE_PLATFORMS = [
34
+ "ios",
35
+ "ios_for_quickbrick",
36
+ "android",
37
+ "android_for_quickbrick",
38
+ ];
39
+
40
+ const TV_PLATFORMS = [
41
+ "android_tv_for_quickbrick",
42
+ "amazon_fire_tv_for_quickbrick",
43
+ "tvos_for_quickbrick",
44
+ "samsung_tv",
45
+ "lg_tv",
46
+ "vizio",
47
+ ];
25
48
 
26
49
  const FontPropsForTVPlatform = (platform) => ({
27
50
  [`${R.toLower(platform)}FontFamily`]: {
@@ -92,7 +115,7 @@ const TV_FONT_KEY_DATA = {
92
115
  name: "focused font color",
93
116
  type: ZAPPIFEST_FIELDS.color_picker,
94
117
  },
95
- ...R.reduce(addTVFontsForPlatform, {}, TV_PLATFORMS),
118
+ ...R.reduce(addTVFontsForPlatform, {}, TV_PLATFORMS_FOR_FONTS),
96
119
  textAlignment: {
97
120
  name: "text alignment",
98
121
  type: ZAPPIFEST_FIELDS.select,
@@ -2083,4 +2106,6 @@ module.exports = {
2083
2106
  TV_CELL_BADGE_FIELDS,
2084
2107
  progressBarFields,
2085
2108
  secondaryImageFields,
2109
+ TV_PLATFORMS,
2110
+ MOBILE_PLATFORMS,
2086
2111
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "12.0.20-rc.2",
3
+ "version": "12.0.21-rc.0",
4
4
  "description": "Applicaster Zapp React Native utilities package",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://github.com/applicaster/quickbrick#readme",
30
30
  "dependencies": {
31
- "@applicaster/applicaster-types": "12.0.20-rc.2",
31
+ "@applicaster/applicaster-types": "12.0.21-rc.0",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",
@@ -23,5 +23,5 @@ export const useListenEventBusEvent = (
23
23
  sub.remove(); // stop listening to DeviceEventEmitter
24
24
  };
25
25
  }
26
- }, []);
26
+ }, [handler, subscriptionID, source, events]);
27
27
  };