@applicaster/zapp-react-native-utils 16.0.0-rc.108 → 16.0.0-rc.109

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.
@@ -257,6 +257,69 @@ describe("getEmptyModalBlocksStructure", () => {
257
257
  );
258
258
  });
259
259
 
260
+ it("maps text label and now playing font keys onto the label style", () => {
261
+ const result = parseModalBlocksConfiguration(
262
+ {
263
+ "item.text_label1.ios.font_family": "SFProText-Bold",
264
+ "item.text_label1.letter_spacing": -0.4,
265
+ "item.text_label1.text_transform": "uppercase",
266
+ "now_playing_item.now_playing_label.ios.font_family":
267
+ "SFProText-Semibold",
268
+ "now_playing_item.now_playing_label.font_size": 18,
269
+ },
270
+ "queue-action"
271
+ );
272
+
273
+ expect(result.item.textLabel1.default).toEqual(
274
+ expect.objectContaining({
275
+ fontFamily: "SFProText-Bold",
276
+ letterSpacing: -0.4,
277
+ textTransform: "uppercase",
278
+ })
279
+ );
280
+
281
+ expect(result.nowPlayingItem?.nowPlayingLabel.default).toEqual(
282
+ expect.objectContaining({
283
+ fontFamily: "SFProText-Semibold",
284
+ fontSize: 18,
285
+ })
286
+ );
287
+ });
288
+
289
+ it("maps queue remove and reorder assets onto item action buttons", () => {
290
+ const result = parseModalBlocksConfiguration(
291
+ {
292
+ "item.remove_asset": "https://example.com/remove.png",
293
+ "item.reorder_handle_asset": "https://example.com/reorder.png",
294
+ },
295
+ "queue-action"
296
+ );
297
+
298
+ expect(result.item.actionButtons.default).toEqual(
299
+ expect.objectContaining({
300
+ removeAsset: "https://example.com/remove.png",
301
+ dragAsset: "https://example.com/reorder.png",
302
+ })
303
+ );
304
+ });
305
+
306
+ it("maps now playing play and pause assets onto action buttons", () => {
307
+ const result = parseModalBlocksConfiguration(
308
+ {
309
+ "now_playing_item.play_asset": "https://example.com/play.png",
310
+ "now_playing_item.pause_asset": "https://example.com/pause.png",
311
+ },
312
+ "queue-action"
313
+ );
314
+
315
+ expect(result.nowPlayingItem?.actionButtons.default).toEqual(
316
+ expect.objectContaining({
317
+ playAsset: "https://example.com/play.png",
318
+ pauseAsset: "https://example.com/pause.png",
319
+ })
320
+ );
321
+ });
322
+
260
323
  it("should leave sectionHeader empty when keys are absent", () => {
261
324
  const result = parseModalBlocksConfiguration(
262
325
  { "item.text_label1.font_color": "#FFFFFF" },
@@ -210,5 +210,43 @@ export const parseModalBlocksConfiguration = (
210
210
 
211
211
  parseBlock("button", ["background", "title", "icons", "leading_icon"]);
212
212
 
213
+ // Leaf uploader keys. They are not `<block>_<sub>_<prop>` styles, so
214
+ // getAllSpecificStyles never sees them.
215
+ const assignLeafAsset = (
216
+ block: ModalBlocksConfig["item"] | undefined,
217
+ key: string,
218
+ prop: "playAsset" | "pauseAsset" | "removeAsset" | "dragAsset"
219
+ ) => {
220
+ if (!block) return;
221
+
222
+ const value = configuration[key];
223
+
224
+ if (typeof value !== "string" || !value.trim()) return;
225
+
226
+ block.actionButtons = {
227
+ ...block.actionButtons,
228
+ default: {
229
+ ...(block.actionButtons?.default || {}),
230
+ [prop]: value,
231
+ },
232
+ };
233
+ };
234
+
235
+ assignLeafAsset(
236
+ result.nowPlayingItem,
237
+ "now_playing_item.play_asset",
238
+ "playAsset"
239
+ );
240
+
241
+ assignLeafAsset(
242
+ result.nowPlayingItem,
243
+ "now_playing_item.pause_asset",
244
+ "pauseAsset"
245
+ );
246
+
247
+ assignLeafAsset(result.item, "item.remove_asset", "removeAsset");
248
+
249
+ assignLeafAsset(result.item, "item.reorder_handle_asset", "dragAsset");
250
+
213
251
  return result;
214
252
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applicaster/zapp-react-native-utils",
3
- "version": "16.0.0-rc.108",
3
+ "version": "16.0.0-rc.109",
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-rc.108",
30
+ "@applicaster/applicaster-types": "16.0.0-rc.109",
31
31
  "buffer": "^5.2.1",
32
32
  "camelize": "^1.0.0",
33
33
  "dayjs": "^1.11.10",