@applicaster/zapp-react-native-utils 16.0.0-alpha.4380012274 → 16.0.0-alpha.4548770949
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/__tests__/StorageActions.test.ts +98 -0
- package/actionsExecutor/__tests__/feedDecorator.test.ts +30 -0
- package/actionsExecutor/__tests__/screenToggleFlag.test.ts +90 -0
- package/actionsExecutor/actions/__tests__/openBottomSheet.inlineItems.test.ts +72 -0
- package/actionsExecutor/actions/openBottomSheet.ts +1 -0
- package/actionsExecutor/actions/screenToggleFlag.ts +1 -3
- package/actionsExecutor/feedDecorator.ts +6 -0
- package/appUtils/contextKeysManager/__tests__/getKey/failure.test.ts +1 -22
- package/appUtils/contextKeysManager/__tests__/getKey/success/fullSearch.test.ts +1 -25
- package/appUtils/contextKeysManager/__tests__/getKey/success/searchInSecure.test.ts +1 -7
- package/appUtils/contextKeysManager/__tests__/removeKey/failure.test.ts +0 -25
- package/appUtils/contextKeysManager/__tests__/removeKey/success.test.ts +0 -6
- package/appUtils/contextKeysManager/__tests__/setKey/failure/failedToSaveInStorage.test.ts +0 -40
- package/appUtils/contextKeysManager/__tests__/setKey/{success/saveItemAndReference.test.ts → success.test.ts} +2 -42
- package/appUtils/contextKeysManager/index.ts +28 -129
- package/configurationUtils/__tests__/modalBlocksParser.test.ts +11 -0
- package/modalState/ModalOrchestrator.ts +1 -0
- package/modalState/__tests__/ModalOrchestrator.phase3.test.ts +23 -0
- package/modalState/index.ts +2 -0
- package/modalState/types.ts +11 -0
- package/package.json +2 -2
- package/reactHooks/feed/__tests__/feedInvalidation.test.tsx +338 -0
- package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +8 -2
- package/reactHooks/feed/useFeedLoader.tsx +28 -1
- package/reactHooks/feed/useLoadPipesDataDispatch.ts +12 -11
- package/appUtils/contextKeysManager/__tests__/getKey/success/byReference.test.ts +0 -56
- package/appUtils/contextKeysManager/__tests__/getKeyByReference/failure.test.ts +0 -265
- package/appUtils/contextKeysManager/__tests__/getKeyByReference/success.test.ts +0 -303
- package/appUtils/contextKeysManager/__tests__/removeReferenceForKey/failure.test.ts +0 -82
- package/appUtils/contextKeysManager/__tests__/removeReferenceForKey/success.test.ts +0 -41
- package/appUtils/contextKeysManager/__tests__/setKey/success/saveItemButNotReference.test.ts +0 -208
- package/appUtils/contextKeysManager/__tests__/setReferenceForKey/failure.test.ts +0 -93
- package/appUtils/contextKeysManager/__tests__/setReferenceForKey/success.test.ts +0 -45
|
@@ -38,10 +38,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
38
38
|
secureStorage: mockedSecureStorage,
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
const setReferenceForKey = jest
|
|
42
|
-
.spyOn(contextManager, "setReferenceForKey")
|
|
43
|
-
.mockResolvedValueOnce(true);
|
|
44
|
-
|
|
45
41
|
// run
|
|
46
42
|
const result = await contextManager.setKey({ key, value, storageLevel });
|
|
47
43
|
|
|
@@ -68,12 +64,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
68
64
|
|
|
69
65
|
expect(mockedSecureStorage.getItem).not.toHaveBeenCalled();
|
|
70
66
|
expect(mockedSecureStorage.setItem).not.toHaveBeenCalled();
|
|
71
|
-
|
|
72
|
-
expect(setReferenceForKey).toHaveBeenCalledWith(
|
|
73
|
-
"key",
|
|
74
|
-
"namespace",
|
|
75
|
-
storageLevel
|
|
76
|
-
);
|
|
77
67
|
});
|
|
78
68
|
|
|
79
69
|
it("returns false if failed to saved with storage-level=persisted", async () => {
|
|
@@ -112,10 +102,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
112
102
|
secureStorage: mockedSecureStorage,
|
|
113
103
|
});
|
|
114
104
|
|
|
115
|
-
const setReferenceForKey = jest
|
|
116
|
-
.spyOn(contextManager, "setReferenceForKey")
|
|
117
|
-
.mockResolvedValueOnce(true);
|
|
118
|
-
|
|
119
105
|
// run
|
|
120
106
|
const result = await contextManager.setKey({ key, value, storageLevel });
|
|
121
107
|
|
|
@@ -142,12 +128,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
142
128
|
|
|
143
129
|
expect(mockedSecureStorage.getItem).not.toHaveBeenCalled();
|
|
144
130
|
expect(mockedSecureStorage.setItem).not.toHaveBeenCalled();
|
|
145
|
-
|
|
146
|
-
expect(setReferenceForKey).toHaveBeenCalledWith(
|
|
147
|
-
"key",
|
|
148
|
-
"namespace",
|
|
149
|
-
storageLevel
|
|
150
|
-
);
|
|
151
131
|
});
|
|
152
132
|
|
|
153
133
|
it("returns false if failed to saved with storage-level=secure", async () => {
|
|
@@ -186,10 +166,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
186
166
|
secureStorage: mockedSecureStorage,
|
|
187
167
|
});
|
|
188
168
|
|
|
189
|
-
const setReferenceForKey = jest
|
|
190
|
-
.spyOn(contextManager, "setReferenceForKey")
|
|
191
|
-
.mockResolvedValueOnce(true);
|
|
192
|
-
|
|
193
169
|
// run
|
|
194
170
|
const result = await contextManager.setKey({ key, value, storageLevel });
|
|
195
171
|
|
|
@@ -216,12 +192,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
216
192
|
value,
|
|
217
193
|
"namespace"
|
|
218
194
|
);
|
|
219
|
-
|
|
220
|
-
expect(setReferenceForKey).toHaveBeenCalledWith(
|
|
221
|
-
"key",
|
|
222
|
-
"namespace",
|
|
223
|
-
storageLevel
|
|
224
|
-
);
|
|
225
195
|
});
|
|
226
196
|
|
|
227
197
|
it("returns false if failed to saved with storage-level=undefined", async () => {
|
|
@@ -259,10 +229,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
259
229
|
secureStorage: mockedSecureStorage,
|
|
260
230
|
});
|
|
261
231
|
|
|
262
|
-
const setReferenceForKey = jest
|
|
263
|
-
.spyOn(contextManager, "setReferenceForKey")
|
|
264
|
-
.mockResolvedValueOnce(true);
|
|
265
|
-
|
|
266
232
|
// run
|
|
267
233
|
const result = await contextManager.setKey({ key, value });
|
|
268
234
|
|
|
@@ -289,11 +255,5 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
289
255
|
|
|
290
256
|
expect(mockedSecureStorage.getItem).not.toHaveBeenCalled();
|
|
291
257
|
expect(mockedSecureStorage.setItem).not.toHaveBeenCalled();
|
|
292
|
-
|
|
293
|
-
expect(setReferenceForKey).toHaveBeenCalledWith(
|
|
294
|
-
"key",
|
|
295
|
-
"namespace",
|
|
296
|
-
StorageLevel.default
|
|
297
|
-
);
|
|
298
258
|
});
|
|
299
259
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ContextKeysManager } from "
|
|
2
|
-
import { StorageLevel } from "
|
|
1
|
+
import { ContextKeysManager } from "../..";
|
|
2
|
+
import { StorageLevel } from "../../consts";
|
|
3
3
|
|
|
4
4
|
describe("Context Keys Manager - setKey", () => {
|
|
5
5
|
it("returns true if saved with success with storage-level=undefined", async () => {
|
|
@@ -37,10 +37,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
37
37
|
secureStorage: mockedSecureStorage,
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
const setReferenceForKey = jest
|
|
41
|
-
.spyOn(contextManager, "setReferenceForKey")
|
|
42
|
-
.mockResolvedValueOnce(true);
|
|
43
|
-
|
|
44
40
|
// run
|
|
45
41
|
const result = await contextManager.setKey({ key, value, storageLevel });
|
|
46
42
|
|
|
@@ -62,12 +58,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
62
58
|
|
|
63
59
|
expect(mockedSecureStorage.getItem).not.toHaveBeenCalled();
|
|
64
60
|
expect(mockedSecureStorage.setItem).not.toHaveBeenCalled();
|
|
65
|
-
|
|
66
|
-
expect(setReferenceForKey).toHaveBeenCalledWith(
|
|
67
|
-
"key",
|
|
68
|
-
"namespace",
|
|
69
|
-
StorageLevel.default
|
|
70
|
-
);
|
|
71
61
|
});
|
|
72
62
|
|
|
73
63
|
it("returns true if saved with success with storage-level=default", async () => {
|
|
@@ -105,10 +95,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
105
95
|
secureStorage: mockedSecureStorage,
|
|
106
96
|
});
|
|
107
97
|
|
|
108
|
-
const setReferenceForKey = jest
|
|
109
|
-
.spyOn(contextManager, "setReferenceForKey")
|
|
110
|
-
.mockResolvedValueOnce(true);
|
|
111
|
-
|
|
112
98
|
// run
|
|
113
99
|
const result = await contextManager.setKey({ key, value, storageLevel });
|
|
114
100
|
|
|
@@ -130,12 +116,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
130
116
|
|
|
131
117
|
expect(mockedSecureStorage.getItem).not.toHaveBeenCalled();
|
|
132
118
|
expect(mockedSecureStorage.setItem).not.toHaveBeenCalled();
|
|
133
|
-
|
|
134
|
-
expect(setReferenceForKey).toHaveBeenCalledWith(
|
|
135
|
-
"key",
|
|
136
|
-
"namespace",
|
|
137
|
-
StorageLevel.default
|
|
138
|
-
);
|
|
139
119
|
});
|
|
140
120
|
|
|
141
121
|
it("returns true if saved with success with storage-level=persisted", async () => {
|
|
@@ -173,10 +153,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
173
153
|
secureStorage: mockedSecureStorage,
|
|
174
154
|
});
|
|
175
155
|
|
|
176
|
-
const setReferenceForKey = jest
|
|
177
|
-
.spyOn(contextManager, "setReferenceForKey")
|
|
178
|
-
.mockResolvedValueOnce(true);
|
|
179
|
-
|
|
180
156
|
// run
|
|
181
157
|
const result = await contextManager.setKey({ key, value, storageLevel });
|
|
182
158
|
|
|
@@ -198,12 +174,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
198
174
|
|
|
199
175
|
expect(mockedSecureStorage.getItem).not.toHaveBeenCalled();
|
|
200
176
|
expect(mockedSecureStorage.setItem).not.toHaveBeenCalled();
|
|
201
|
-
|
|
202
|
-
expect(setReferenceForKey).toHaveBeenCalledWith(
|
|
203
|
-
"key",
|
|
204
|
-
"namespace",
|
|
205
|
-
storageLevel
|
|
206
|
-
);
|
|
207
177
|
});
|
|
208
178
|
|
|
209
179
|
it("returns true if saved with success with storage-level=secure", async () => {
|
|
@@ -241,10 +211,6 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
241
211
|
secureStorage: mockedSecureStorage,
|
|
242
212
|
});
|
|
243
213
|
|
|
244
|
-
const setReferenceForKey = jest
|
|
245
|
-
.spyOn(contextManager, "setReferenceForKey")
|
|
246
|
-
.mockResolvedValueOnce(true);
|
|
247
|
-
|
|
248
214
|
// run
|
|
249
215
|
const result = await contextManager.setKey({ key, value, storageLevel });
|
|
250
216
|
|
|
@@ -266,11 +232,5 @@ describe("Context Keys Manager - setKey", () => {
|
|
|
266
232
|
value,
|
|
267
233
|
"namespace"
|
|
268
234
|
);
|
|
269
|
-
|
|
270
|
-
expect(setReferenceForKey).toHaveBeenCalledWith(
|
|
271
|
-
"key",
|
|
272
|
-
"namespace",
|
|
273
|
-
storageLevel
|
|
274
|
-
);
|
|
275
235
|
});
|
|
276
236
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isNil } from "@applicaster/zapp-react-native-utils/utils";
|
|
2
2
|
|
|
3
|
-
import { StorageLevel
|
|
3
|
+
import { StorageLevel } from "./consts";
|
|
4
4
|
import {
|
|
5
5
|
getNamespaceAndKey,
|
|
6
6
|
keyIsValid,
|
|
@@ -59,18 +59,14 @@ type Setup = {
|
|
|
59
59
|
sessionStorage?: Storage;
|
|
60
60
|
localStorage?: Storage;
|
|
61
61
|
secureStorage?: Storage;
|
|
62
|
-
referenceStorage?: Storage;
|
|
63
62
|
};
|
|
64
63
|
|
|
65
|
-
export const REFERENCE_NAMESPACE = "applicaster.v2.references";
|
|
66
|
-
|
|
67
64
|
export class ContextKeysManager {
|
|
68
65
|
private static _instance: ContextKeysManager;
|
|
69
66
|
private _logger: Logger;
|
|
70
67
|
private _sessionStorage: Storage;
|
|
71
68
|
private _localStorage: Storage;
|
|
72
69
|
private _secureStorage: Storage;
|
|
73
|
-
private _referenceStorage: Storage;
|
|
74
70
|
|
|
75
71
|
public static get instance() {
|
|
76
72
|
if (!this._instance) {
|
|
@@ -79,7 +75,6 @@ export class ContextKeysManager {
|
|
|
79
75
|
sessionStorage: SessionStorage,
|
|
80
76
|
localStorage: LocalStorage,
|
|
81
77
|
secureStorage: SecureStorage,
|
|
82
|
-
referenceStorage: SessionStorage,
|
|
83
78
|
});
|
|
84
79
|
|
|
85
80
|
this._instance = instance;
|
|
@@ -94,13 +89,11 @@ export class ContextKeysManager {
|
|
|
94
89
|
sessionStorage = SessionStorage,
|
|
95
90
|
localStorage = LocalStorage,
|
|
96
91
|
secureStorage = SecureStorage,
|
|
97
|
-
|
|
98
|
-
}: Setup) {
|
|
92
|
+
}: Setup = {}) {
|
|
99
93
|
this._logger = logger;
|
|
100
94
|
this._sessionStorage = sessionStorage;
|
|
101
95
|
this._localStorage = localStorage;
|
|
102
96
|
this._secureStorage = secureStorage;
|
|
103
|
-
this._referenceStorage = referenceStorage;
|
|
104
97
|
}
|
|
105
98
|
|
|
106
99
|
private parseKey(key: KeyName): ParsedKeyAndNamespace {
|
|
@@ -119,41 +112,6 @@ export class ContextKeysManager {
|
|
|
119
112
|
return { isValid: true, ...parsedKey };
|
|
120
113
|
}
|
|
121
114
|
|
|
122
|
-
// GET
|
|
123
|
-
public async getKeyByReference(
|
|
124
|
-
key: string,
|
|
125
|
-
namespace: string
|
|
126
|
-
): Promise<ValueOrNothing> {
|
|
127
|
-
// 1) look for storage
|
|
128
|
-
// 2) if storage found - look value in it
|
|
129
|
-
// 3) if storage not found return NOTHING
|
|
130
|
-
|
|
131
|
-
return this._referenceStorage
|
|
132
|
-
.getItem(buildNamespaceKey(key, namespace), REFERENCE_NAMESPACE)
|
|
133
|
-
.then((storage: StorageType | unknown) => {
|
|
134
|
-
switch (storage) {
|
|
135
|
-
case StorageType.session:
|
|
136
|
-
return this._sessionStorage.getItem(key, namespace);
|
|
137
|
-
case StorageType.local:
|
|
138
|
-
return this._localStorage.getItem(key, namespace);
|
|
139
|
-
case StorageType.secure:
|
|
140
|
-
return this._secureStorage.getItem(key, namespace);
|
|
141
|
-
default:
|
|
142
|
-
// unknown storage
|
|
143
|
-
return NOTHING;
|
|
144
|
-
}
|
|
145
|
-
})
|
|
146
|
-
.catch((error) => {
|
|
147
|
-
// something went wrong
|
|
148
|
-
this._logger.warn({
|
|
149
|
-
message: error.message,
|
|
150
|
-
data: { key, namespace },
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
return NOTHING;
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
115
|
public async getKeys(
|
|
158
116
|
keys: Array<KeyName>,
|
|
159
117
|
contextObj?: { key: string; required?: boolean }[]
|
|
@@ -228,19 +186,7 @@ export class ContextKeysManager {
|
|
|
228
186
|
return NOTHING;
|
|
229
187
|
}
|
|
230
188
|
|
|
231
|
-
//
|
|
232
|
-
// if not found, look in session > local > secure
|
|
233
|
-
|
|
234
|
-
const resultByReference = await this.getKeyByReference(
|
|
235
|
-
parsedKey,
|
|
236
|
-
parsedNamespace
|
|
237
|
-
);
|
|
238
|
-
|
|
239
|
-
if (!isNil(resultByReference)) {
|
|
240
|
-
return resultByReference;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// try to full-search
|
|
189
|
+
// look in session > local > secure
|
|
244
190
|
try {
|
|
245
191
|
const resultFromSessionStorage = await this._sessionStorage.getItem(
|
|
246
192
|
parsedKey,
|
|
@@ -284,41 +230,6 @@ export class ContextKeysManager {
|
|
|
284
230
|
// GET
|
|
285
231
|
|
|
286
232
|
// SET
|
|
287
|
-
public async setReferenceForKey(
|
|
288
|
-
key: string,
|
|
289
|
-
namespace: string,
|
|
290
|
-
storageLevel: StorageLevel
|
|
291
|
-
): Promise<boolean> {
|
|
292
|
-
return this._referenceStorage
|
|
293
|
-
.setItem(
|
|
294
|
-
buildNamespaceKey(key, namespace),
|
|
295
|
-
storageLevel,
|
|
296
|
-
REFERENCE_NAMESPACE
|
|
297
|
-
)
|
|
298
|
-
.then((result) => {
|
|
299
|
-
if (savingResultIsSuccess(result)) {
|
|
300
|
-
return true;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
this._logger.warn({
|
|
304
|
-
message:
|
|
305
|
-
"While saving reference - reference storage return non expected value: true",
|
|
306
|
-
data: { key, namespace, storageLevel },
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
return false;
|
|
310
|
-
})
|
|
311
|
-
.catch((error) => {
|
|
312
|
-
// something went wrong
|
|
313
|
-
this._logger.warn({
|
|
314
|
-
message: error.message,
|
|
315
|
-
data: { key, namespace, storageLevel },
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
return false;
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
|
|
322
233
|
// for all keys where saving were succeed return true
|
|
323
234
|
// for others return false
|
|
324
235
|
public async setKeys(
|
|
@@ -352,29 +263,36 @@ export class ContextKeysManager {
|
|
|
352
263
|
}
|
|
353
264
|
|
|
354
265
|
try {
|
|
266
|
+
let setItemResult: boolean;
|
|
267
|
+
|
|
355
268
|
switch (storageLevel) {
|
|
356
269
|
case StorageLevel.persisted:
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
270
|
+
setItemResult = await this._localStorage.setItem(
|
|
271
|
+
parsedKey,
|
|
272
|
+
value,
|
|
273
|
+
parsedNamespace
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
break;
|
|
363
277
|
case StorageLevel.secure:
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
278
|
+
setItemResult = await this._secureStorage.setItem(
|
|
279
|
+
parsedKey,
|
|
280
|
+
value,
|
|
281
|
+
parsedNamespace
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
break;
|
|
370
285
|
default:
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
286
|
+
setItemResult = await this._sessionStorage.setItem(
|
|
287
|
+
parsedKey,
|
|
288
|
+
value,
|
|
289
|
+
parsedNamespace
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
break;
|
|
377
293
|
}
|
|
294
|
+
|
|
295
|
+
return savingResultIsSuccess(setItemResult);
|
|
378
296
|
} catch (error) {
|
|
379
297
|
// something went wrong
|
|
380
298
|
this._logger.warn({
|
|
@@ -388,24 +306,6 @@ export class ContextKeysManager {
|
|
|
388
306
|
// SET
|
|
389
307
|
|
|
390
308
|
// REMOVE
|
|
391
|
-
public async removeReferenceForKey(
|
|
392
|
-
key: string,
|
|
393
|
-
namespace: string
|
|
394
|
-
): Promise<boolean> {
|
|
395
|
-
return this._referenceStorage
|
|
396
|
-
.removeItem(buildNamespaceKey(key, namespace), REFERENCE_NAMESPACE)
|
|
397
|
-
.then(() => true)
|
|
398
|
-
.catch((error) => {
|
|
399
|
-
// something went wrong
|
|
400
|
-
this._logger.warn({
|
|
401
|
-
message: error.message,
|
|
402
|
-
data: { key, namespace },
|
|
403
|
-
});
|
|
404
|
-
|
|
405
|
-
return false;
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
|
|
409
309
|
public async removeKey(key: KeyName): Promise<boolean> {
|
|
410
310
|
const {
|
|
411
311
|
isValid: isValidKey,
|
|
@@ -422,7 +322,6 @@ export class ContextKeysManager {
|
|
|
422
322
|
this._sessionStorage.removeItem(parsedKey, parsedNamespace),
|
|
423
323
|
this._localStorage.removeItem(parsedKey, parsedNamespace),
|
|
424
324
|
this._secureStorage.removeItem(parsedKey, parsedNamespace),
|
|
425
|
-
this.removeReferenceForKey(parsedKey, parsedNamespace),
|
|
426
325
|
])
|
|
427
326
|
.then(() => true)
|
|
428
327
|
.catch((error) => {
|
|
@@ -171,6 +171,17 @@ describe("parseModalBlocksConfiguration", () => {
|
|
|
171
171
|
expect(result.item.checkbox.default).toBeUndefined();
|
|
172
172
|
expect(result.item.actionButtons.default).toBeUndefined();
|
|
173
173
|
});
|
|
174
|
+
|
|
175
|
+
it("parses the generic button leading icon asset", () => {
|
|
176
|
+
const result = parseModalBlocksConfiguration(
|
|
177
|
+
{ "button.leading_icon.asset": "https://example.com/add.png" },
|
|
178
|
+
"playlist-experience"
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
expect(result.button.leadingIcon.default?.asset).toBe(
|
|
182
|
+
"https://example.com/add.png"
|
|
183
|
+
);
|
|
184
|
+
});
|
|
174
185
|
});
|
|
175
186
|
|
|
176
187
|
describe("getEmptyModalBlocksStructure", () => {
|
|
@@ -60,4 +60,27 @@ describe("ModalOrchestrator phase 3", () => {
|
|
|
60
60
|
|
|
61
61
|
expect(props.emptyMessage).toBe("Queued items will be added here");
|
|
62
62
|
});
|
|
63
|
+
|
|
64
|
+
it("forwards operationButtons onto the sheet props unchanged", () => {
|
|
65
|
+
const operationButtons = {
|
|
66
|
+
add: {
|
|
67
|
+
title: "Create New Playlist",
|
|
68
|
+
iconURL: "https://example.com/add.png",
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
modalOrchestrator.open({
|
|
73
|
+
header: { title: "Playlists" },
|
|
74
|
+
content: {
|
|
75
|
+
title: "Playlists",
|
|
76
|
+
items: [],
|
|
77
|
+
operationButtons,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const props = (modalStore.getState().modalState.screen as any)
|
|
82
|
+
?.modalBottomSheetContentProps;
|
|
83
|
+
|
|
84
|
+
expect(props.operationButtons).toEqual(operationButtons);
|
|
85
|
+
});
|
|
63
86
|
});
|
package/modalState/index.ts
CHANGED
package/modalState/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { EntryAction } from "../entryActions/types";
|
|
2
|
+
|
|
1
3
|
export interface Header {
|
|
2
4
|
title: string;
|
|
3
5
|
subtitle?: string;
|
|
@@ -107,6 +109,13 @@ export interface DynamicCollectionOptions {
|
|
|
107
109
|
events?: Record<CollectionScopedOperation | string, Action[]>;
|
|
108
110
|
}
|
|
109
111
|
|
|
112
|
+
/** Presentation of a sheet-synthesized operation control; same fields as an entry action button. */
|
|
113
|
+
export type OperationButton = Pick<EntryAction["button"], "title" | "iconURL">;
|
|
114
|
+
|
|
115
|
+
export type OperationButtons = Partial<
|
|
116
|
+
Record<CollectionScopedOperation | string, OperationButton>
|
|
117
|
+
>;
|
|
118
|
+
|
|
110
119
|
export interface Content {
|
|
111
120
|
title: string;
|
|
112
121
|
stickyTitle?: boolean;
|
|
@@ -120,6 +129,8 @@ export interface Content {
|
|
|
120
129
|
styleOverrides?: Record<string, any>;
|
|
121
130
|
/** Shown under Next Up when the queue sheet has no upcoming items. */
|
|
122
131
|
emptyMessage?: string;
|
|
132
|
+
/** Producer-owned presentation for sheet-synthesized operation controls (e.g. `add`). */
|
|
133
|
+
operationButtons?: OperationButtons;
|
|
123
134
|
context?: Record<string, any>;
|
|
124
135
|
}
|
|
125
136
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "16.0.0-alpha.
|
|
3
|
+
"version": "16.0.0-alpha.4548770949",
|
|
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": "16.0.0-alpha.
|
|
30
|
+
"@applicaster/applicaster-types": "16.0.0-alpha.4548770949",
|
|
31
31
|
"buffer": "^5.2.1",
|
|
32
32
|
"camelize": "^1.0.0",
|
|
33
33
|
"dayjs": "^1.11.10",
|