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

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.
@@ -233,6 +233,16 @@ const prepareDefaultActions = (actionExecutor) => {
233
233
  if (selectedItems.includes(tag)) {
234
234
  await multiSelectProvider.removeItem(tag);
235
235
  } else {
236
+ const maxItems = action.options?.max_items;
237
+
238
+ if (maxItems && selectedItems.length >= maxItems) {
239
+ log_info(
240
+ `handleAction: localStorageToggleFlag event reached max items limit: ${maxItems}, cannot add tag: ${tag}`
241
+ );
242
+
243
+ return ActionResult.Cancel;
244
+ }
245
+
236
246
  await multiSelectProvider.addItem(tag);
237
247
  }
238
248
  } else {
@@ -241,3 +241,28 @@ export const extractDataFromProperty = (property, data): any =>
241
241
  );
242
242
 
243
243
  export const then = (fn) => (promise) => promise.then(fn);
244
+
245
+ /**
246
+ * Returns a replacer function for JSON.stringify that handles circular references,
247
+ * functions, and React context objects
248
+ * @returns {Function} A replacer function that detects and handles circular references,
249
+ * functions, and React context objects
250
+ */
251
+ export const getJsonReplacer = () => {
252
+ return (_key, value) => {
253
+ if (typeof value === "function") {
254
+ return "[Function]";
255
+ }
256
+
257
+ if (
258
+ typeof value === "object" &&
259
+ value !== null &&
260
+ value.Provider &&
261
+ value.Consumer
262
+ ) {
263
+ return "[ReactContext]";
264
+ }
265
+
266
+ return value;
267
+ };
268
+ };
package/index.d.ts CHANGED
@@ -105,18 +105,6 @@ declare type NavBarState = {
105
105
  title: string;
106
106
  };
107
107
 
108
- declare type StorageValuesToAdd = Record<string, NamespaceValues>;
109
-
110
- declare type StorageValuesToRemove = {
111
- string?: string[];
112
- };
113
-
114
- declare type StorageOwnedValues = {
115
- string?: string[];
116
- };
117
-
118
- declare type NamespaceValues = Record<string, string>;
119
-
120
108
  declare type RefreshProps = {
121
109
  forceRefresh?: boolean;
122
110
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "12.0.19-rc.0",
3
+ "version": "12.0.19-rc.2",
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.19-rc.0",
31
+ "@applicaster/applicaster-types": "12.0.19-rc.2",
32
32
  "buffer": "^5.2.1",
33
33
  "camelize": "^1.0.0",
34
34
  "create-react-context": "^0.2.3",