@applicaster/zapp-react-native-utils 15.0.0-alpha.6144399951 → 15.0.0-alpha.6203358875
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/README.md +0 -6
- package/actionsExecutor/ActionExecutorContext.tsx +83 -6
- package/adsUtils/__tests__/createVMAP.test.ts +419 -0
- package/analyticsUtils/analyticsMapper.ts +10 -2
- package/appDataUtils/__tests__/urlScheme.test.ts +678 -0
- package/appUtils/HooksManager/__tests__/__snapshots__/hooksManager.test.js.snap +0 -188
- package/appUtils/HooksManager/__tests__/hooksManager.test.js +16 -2
- package/appUtils/HooksManager/index.ts +35 -0
- package/appUtils/contextKeysManager/__tests__/getKeys/failure.test.ts +7 -2
- package/appUtils/contextKeysManager/__tests__/getKeys/success.test.ts +48 -0
- package/appUtils/contextKeysManager/contextResolver.ts +51 -22
- package/appUtils/contextKeysManager/index.ts +65 -10
- package/appUtils/focusManager/treeDataStructure/Tree/__tests__/Tree.test.js +46 -0
- package/appUtils/focusManager/treeDataStructure/Tree/index.js +18 -18
- package/appUtils/focusManagerAux/utils/index.ts +2 -4
- package/appUtils/focusManagerAux/utils/utils.ios.ts +6 -3
- package/appUtils/localizationsHelper.ts +4 -0
- package/appUtils/playerManager/index.ts +9 -0
- package/appUtils/playerManager/player.ts +1 -1
- package/appUtils/playerManager/playerNative.ts +2 -1
- package/appUtils/playerManager/usePlayer.tsx +5 -3
- package/cellUtils/__tests__/cellUtils.test.ts +39 -0
- package/cellUtils/index.ts +11 -1
- package/cloudEventsUtils/__tests__/index.test.ts +529 -0
- package/cloudEventsUtils/index.ts +65 -1
- package/configurationUtils/__tests__/imageSrcFromMediaItem.test.ts +38 -0
- package/configurationUtils/index.ts +17 -11
- package/dateUtils/__tests__/dayjs.test.ts +327 -0
- package/dateUtils/index.ts +2 -0
- package/enumUtils/__tests__/getEnumKeyByEnumValue.test.ts +207 -0
- package/errorUtils/__tests__/GeneralError.test.ts +97 -0
- package/errorUtils/__tests__/HttpStatusCode.test.ts +344 -0
- package/errorUtils/__tests__/MissingPluginError.test.ts +113 -0
- package/errorUtils/__tests__/NetworkError.test.ts +202 -0
- package/errorUtils/__tests__/getParsedResponse.test.ts +188 -0
- package/errorUtils/__tests__/invariant.test.ts +112 -0
- package/headersUtils/__tests__/headersUtils.test.js +11 -1
- package/headersUtils/index.ts +2 -1
- package/manifestUtils/_internals/__tests__/index.test.js +41 -0
- package/manifestUtils/_internals/index.js +33 -0
- package/manifestUtils/defaultManifestConfigurations/player.js +35 -16
- package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +49 -0
- package/manifestUtils/fieldUtils/index.js +54 -0
- package/manifestUtils/index.js +2 -0
- package/manifestUtils/keys.js +228 -0
- package/manifestUtils/mobileAction/button/__tests__/mobileActionButton.test.js +168 -0
- package/manifestUtils/mobileAction/button/index.js +140 -0
- package/manifestUtils/mobileAction/container/__tests__/mobileActionButtonsContainer.test.js +102 -0
- package/manifestUtils/mobileAction/container/index.js +73 -0
- package/manifestUtils/mobileAction/groups/__tests__/buildMobileActionButtonGroups.test.js +127 -0
- package/manifestUtils/mobileAction/groups/defaults.js +76 -0
- package/manifestUtils/mobileAction/groups/index.js +80 -0
- package/manifestUtils/platformIsTV.js +13 -0
- package/navigationUtils/index.ts +15 -5
- package/numberUtils/__tests__/toNumber.test.ts +27 -0
- package/numberUtils/__tests__/toPositiveNumber.test.ts +193 -0
- package/numberUtils/index.ts +23 -1
- package/package.json +3 -3
- package/reactHooks/analytics/__tests__/useSendAnalyticsOnPress.test.ts +537 -0
- package/reactHooks/app/__tests__/useAppState.test.ts +1 -1
- package/reactHooks/autoscrolling/__tests__/useTrackCurrentAutoScrollingElement.test.ts +1 -1
- package/reactHooks/autoscrolling/__tests__/useTrackedView.test.tsx +1 -2
- package/reactHooks/cell-click/__tests__/index.test.js +1 -3
- package/reactHooks/cell-click/index.ts +2 -1
- package/reactHooks/configuration/__tests__/index.test.tsx +1 -1
- package/reactHooks/connection/__tests__/index.test.js +1 -1
- package/reactHooks/dev/__tests__/useReRenderLog.test.ts +188 -0
- package/reactHooks/device/useIsTablet.tsx +14 -19
- package/reactHooks/events/index.ts +20 -0
- package/reactHooks/feed/__tests__/useBatchLoading.test.tsx +32 -23
- package/reactHooks/feed/__tests__/useBuildPipesUrl.test.tsx +19 -19
- package/reactHooks/feed/__tests__/useEntryScreenId.test.tsx +1 -1
- package/reactHooks/feed/__tests__/useFeedLoader.test.tsx +42 -30
- package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +1 -1
- package/reactHooks/feed/index.ts +0 -2
- package/reactHooks/feed/useInflatedUrl.ts +1 -1
- package/reactHooks/hookModal/hooks/useHookModalScreenData.ts +12 -8
- package/reactHooks/index.ts +2 -0
- package/reactHooks/layout/__tests__/index.test.tsx +1 -1
- package/reactHooks/layout/__tests__/useLayoutVersion.test.tsx +1 -1
- package/reactHooks/navigation/__tests__/index.test.tsx +40 -9
- package/reactHooks/navigation/index.ts +15 -4
- package/reactHooks/navigation/useRoute.ts +3 -1
- package/reactHooks/player/__tests__/useAutoSeek._test.tsx +1 -1
- package/reactHooks/player/__tests__/useTapSeek._test.ts +1 -1
- package/reactHooks/resolvers/__tests__/useCellResolver.test.tsx +1 -1
- package/reactHooks/resolvers/__tests__/useComponentResolver.test.tsx +1 -1
- package/reactHooks/resolvers/useComponentResolver.ts +11 -1
- package/reactHooks/screen/__tests__/useCurrentScreenData.test.tsx +1 -1
- package/reactHooks/screen/__tests__/useScreenBackgroundColor.test.tsx +1 -1
- package/reactHooks/screen/__tests__/useScreenData.test.tsx +1 -1
- package/reactHooks/screen/__tests__/useTargetScreenData.test.tsx +1 -1
- package/reactHooks/state/__tests__/useComponentScreenState.test.ts +246 -0
- package/reactHooks/state/index.ts +2 -0
- package/reactHooks/state/useComponentScreenState.ts +45 -0
- package/reactHooks/state/useRefWithInitialValue.ts +10 -0
- package/reactHooks/ui/__tests__/useFadeOutWhenBlurred.test.ts +580 -0
- package/reactHooks/utils/__tests__/index.test.js +1 -1
- package/rectUtils/__tests__/index.test.ts +549 -0
- package/rectUtils/index.ts +2 -2
- package/refreshUtils/RefreshCoordinator/__tests__/refreshCoordinator.test.ts +161 -0
- package/refreshUtils/RefreshCoordinator/index.ts +216 -0
- package/refreshUtils/RefreshCoordinator/utils/__tests__/getDataRefreshConfig.test.ts +104 -0
- package/refreshUtils/RefreshCoordinator/utils/index.ts +29 -0
- package/screenPickerUtils/__tests__/index.test.ts +333 -0
- package/screenPickerUtils/index.ts +5 -0
- package/screenState/__tests__/index.test.ts +1 -1
- package/screenUtils/index.ts +3 -0
- package/services/storageServiceSync.web.ts +1 -1
- package/time/__tests__/BackgroundTimer.test.ts +156 -0
- package/time/__tests__/Timer.test.ts +236 -0
- package/typeGuards/__tests__/isString.test.ts +21 -0
- package/typeGuards/index.ts +4 -0
- package/utils/__tests__/clone.test.ts +158 -0
- package/utils/__tests__/path.test.ts +7 -0
- package/utils/clone.ts +7 -0
- package/utils/index.ts +2 -1
- package/reactHooks/componentsMap/index.ts +0 -55
- package/reactHooks/feed/__tests__/useFeedRefresh.test.tsx +0 -75
- package/reactHooks/feed/useFeedRefresh.tsx +0 -65
|
@@ -123,6 +123,12 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
123
123
|
key: "skip_button_localization_text_skip_intro",
|
|
124
124
|
initial_value: "Skip Intro",
|
|
125
125
|
},
|
|
126
|
+
{
|
|
127
|
+
type: "text_input",
|
|
128
|
+
label: "Stream error message",
|
|
129
|
+
key: "stream_error_message",
|
|
130
|
+
initial_value: "Cannot play stream",
|
|
131
|
+
},
|
|
126
132
|
{
|
|
127
133
|
type: "text_input",
|
|
128
134
|
label: "Locked message",
|
|
@@ -331,6 +337,35 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
331
337
|
label_tooltip: "Hint for skip intro button accessibility",
|
|
332
338
|
type: "text_input",
|
|
333
339
|
},
|
|
340
|
+
{
|
|
341
|
+
type: "text_input",
|
|
342
|
+
label: "Text Tracks Label",
|
|
343
|
+
key: "text_tracks_label",
|
|
344
|
+
initial_value: "Subtitles",
|
|
345
|
+
label_tooltip: "Label for the text tracks list",
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
type: "text_input",
|
|
349
|
+
label: "Audio Tracks Label",
|
|
350
|
+
key: "audio_tracks_label",
|
|
351
|
+
initial_value: "Audio",
|
|
352
|
+
label_tooltip: "Label for the audio tracks list",
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
type: "text_input",
|
|
356
|
+
label: "Off Track Label",
|
|
357
|
+
key: "off_track_label",
|
|
358
|
+
initial_value: "Off",
|
|
359
|
+
label_tooltip: "Label for the 'Off' option in text tracks list",
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
type: "text_input",
|
|
363
|
+
label: "Default Track Label",
|
|
364
|
+
key: "default_track_label",
|
|
365
|
+
initial_value: "Default",
|
|
366
|
+
label_tooltip:
|
|
367
|
+
"Label for the 'Default' audio track in audio tracks list",
|
|
368
|
+
},
|
|
334
369
|
],
|
|
335
370
|
};
|
|
336
371
|
|
|
@@ -678,22 +713,6 @@ function getPlayerConfiguration({ platform, version }) {
|
|
|
678
713
|
}
|
|
679
714
|
|
|
680
715
|
if (isMobile(platform)) {
|
|
681
|
-
localizations.fields.push(
|
|
682
|
-
{
|
|
683
|
-
type: "text_input",
|
|
684
|
-
label: "Restrict playback on mobile networks alert title",
|
|
685
|
-
key: "mobile_connection_restricted_alert_title",
|
|
686
|
-
initial_value: "Restricted Connection Type",
|
|
687
|
-
},
|
|
688
|
-
{
|
|
689
|
-
type: "text_input",
|
|
690
|
-
label: "Restrict playback on mobile networks alert message",
|
|
691
|
-
key: "mobile_connection_restricted_alert_message",
|
|
692
|
-
initial_value:
|
|
693
|
-
"This content can only be viewed over a Wi-Fi or LAN network.",
|
|
694
|
-
}
|
|
695
|
-
);
|
|
696
|
-
|
|
697
716
|
general.fields.push(
|
|
698
717
|
{
|
|
699
718
|
section: "Default Timestamp Type",
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const {
|
|
2
|
+
withConditional,
|
|
3
|
+
getConditionalKey,
|
|
4
|
+
createConditionalField,
|
|
5
|
+
} = require("..");
|
|
6
|
+
|
|
7
|
+
describe("manifestUtils/fieldUtils", () => {
|
|
8
|
+
it("appends conditions and adds all_conditions when there is more than one condition", () => {
|
|
9
|
+
const config = {
|
|
10
|
+
key: "mobile_button_1_width",
|
|
11
|
+
conditional_fields: [
|
|
12
|
+
{ key: "styles/mobile_button_1_button_enabled", condition_value: true },
|
|
13
|
+
],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const result = withConditional([
|
|
17
|
+
{ key: "styles/mobile_button_1_display_mode", condition_value: "fixed" },
|
|
18
|
+
])(config);
|
|
19
|
+
|
|
20
|
+
expect(result.conditional_fields).toEqual([
|
|
21
|
+
{ key: "styles/mobile_button_1_button_enabled", condition_value: true },
|
|
22
|
+
{ key: "styles/mobile_button_1_display_mode", condition_value: "fixed" },
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
expect(result.rules).toBe("all_conditions");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("creates category-prefixed conditional key", () => {
|
|
29
|
+
expect(
|
|
30
|
+
getConditionalKey("mobile_buttons_container_position", "styles")
|
|
31
|
+
).toBe("styles/mobile_buttons_container_position");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("creates conditional fields with default category and with raw key", () => {
|
|
35
|
+
expect(
|
|
36
|
+
createConditionalField("mobile_button_1_asset_enabled", true)
|
|
37
|
+
).toEqual({
|
|
38
|
+
key: "styles/mobile_button_1_asset_enabled",
|
|
39
|
+
condition_value: true,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
expect(
|
|
43
|
+
createConditionalField("mobile_button_1_asset_enabled", true, null)
|
|
44
|
+
).toEqual({
|
|
45
|
+
key: "mobile_button_1_asset_enabled",
|
|
46
|
+
condition_value: true,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Appends new conditional_fields from conditions array
|
|
3
|
+
* to config.conditional_fields
|
|
4
|
+
* if there are more than 1 condition, sets rules to "all_conditions"
|
|
5
|
+
*
|
|
6
|
+
* @param {Array<{key: string, condition_value: unknown}>} conditions
|
|
7
|
+
* @returns {(config: object) => object}
|
|
8
|
+
*/
|
|
9
|
+
const withConditional = (conditions) => (config) => {
|
|
10
|
+
const conditional_fields = [
|
|
11
|
+
...(config.conditional_fields || []),
|
|
12
|
+
...conditions,
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const next = { ...config, conditional_fields };
|
|
16
|
+
|
|
17
|
+
if (conditional_fields.length > 1) {
|
|
18
|
+
return { ...next, rules: "all_conditions" };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return next;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Builds key for conditional fields prepending category, e.g. "styles/mobile_buttons_container_position"
|
|
26
|
+
*
|
|
27
|
+
* @param {string} key
|
|
28
|
+
* @param {string} category
|
|
29
|
+
* @returns {string}
|
|
30
|
+
*/
|
|
31
|
+
function getConditionalKey(key, category) {
|
|
32
|
+
return `${category}/${key}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns a conditional field object for manifest visibility rules.
|
|
37
|
+
*
|
|
38
|
+
* @param {string} key
|
|
39
|
+
* @param {unknown} condition_value
|
|
40
|
+
* @param {string|null} [category="styles"] Pass `null` to use the key as-is.
|
|
41
|
+
* @returns {{key: string, condition_value: unknown}}
|
|
42
|
+
*/
|
|
43
|
+
function createConditionalField(key, condition_value, category = "styles") {
|
|
44
|
+
return {
|
|
45
|
+
key: category ? getConditionalKey(key, category) : key,
|
|
46
|
+
condition_value,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = {
|
|
51
|
+
withConditional,
|
|
52
|
+
getConditionalKey,
|
|
53
|
+
createConditionalField,
|
|
54
|
+
};
|
package/manifestUtils/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const {
|
|
|
8
8
|
|
|
9
9
|
const { tvActionButtonsContainer } = require("./tvAction/container");
|
|
10
10
|
const { tvActionButton } = require("./tvAction/button");
|
|
11
|
+
const { buildMobileActionButtonGroups } = require("./mobileAction/groups");
|
|
11
12
|
const { compact } = require("./_internals");
|
|
12
13
|
|
|
13
14
|
const { spacingKey, absolutePositionElement } = require("./containers");
|
|
@@ -43,6 +44,7 @@ module.exports = {
|
|
|
43
44
|
tvMenuLabel,
|
|
44
45
|
tvActionButtonsContainer,
|
|
45
46
|
tvActionButton,
|
|
47
|
+
buildMobileActionButtonGroups,
|
|
46
48
|
mobileCellLabel,
|
|
47
49
|
tvCellLabel,
|
|
48
50
|
tvBadges,
|
package/manifestUtils/keys.js
CHANGED
|
@@ -406,6 +406,232 @@ const TV_ACTION_BUTTON_FIELDS = [
|
|
|
406
406
|
},
|
|
407
407
|
];
|
|
408
408
|
|
|
409
|
+
const mobileActionButtonContainerFields = (positionOptions) => [
|
|
410
|
+
{
|
|
411
|
+
type: ZAPPIFEST_FIELDS.switch,
|
|
412
|
+
suffix: "buttons enabled",
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
type: ZAPPIFEST_FIELDS.select,
|
|
416
|
+
suffix: "position",
|
|
417
|
+
options: positionOptions,
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
type: ZAPPIFEST_FIELDS.select,
|
|
421
|
+
suffix: "align",
|
|
422
|
+
options: ["left", "center", "right"],
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
type: ZAPPIFEST_FIELDS.select,
|
|
426
|
+
suffix: "over image position",
|
|
427
|
+
options: ["center", "top_left", "top_right", "bottom_left", "bottom_right"],
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
431
|
+
suffix: "margin top",
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
435
|
+
suffix: "margin right",
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
439
|
+
suffix: "margin bottom",
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
443
|
+
suffix: "margin left",
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
type: ZAPPIFEST_FIELDS.select,
|
|
447
|
+
suffix: "stacking",
|
|
448
|
+
options: ["horizontal", "vertical"],
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
452
|
+
suffix: "horizontal gutter",
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
456
|
+
suffix: "vertical gutter",
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
type: ZAPPIFEST_FIELDS.switch,
|
|
460
|
+
suffix: "independent styles",
|
|
461
|
+
},
|
|
462
|
+
];
|
|
463
|
+
|
|
464
|
+
const MOBILE_ACTION_BUTTON_FIELDS = [
|
|
465
|
+
{
|
|
466
|
+
type: ZAPPIFEST_FIELDS.switch,
|
|
467
|
+
suffix: "button enabled",
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
type: ZAPPIFEST_FIELDS.select,
|
|
471
|
+
suffix: "assign action",
|
|
472
|
+
options: [
|
|
473
|
+
{ text: "primary navigation", value: "navigation_action" },
|
|
474
|
+
{ text: "secondary navigation", value: "secondary_navigation" },
|
|
475
|
+
{ text: "favorite", value: "local_storage_favourites_action" },
|
|
476
|
+
{ text: "more", value: "more" },
|
|
477
|
+
{ text: "add to calendar", value: "add_to_calendar" },
|
|
478
|
+
{ text: "share", value: "share" },
|
|
479
|
+
{ text: "downloads", value: "downloads" },
|
|
480
|
+
{ text: "trailer", value: "trailer_action" },
|
|
481
|
+
{ text: "mute/unmute", value: "mute_unmute" },
|
|
482
|
+
],
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
type: ZAPPIFEST_FIELDS.select,
|
|
486
|
+
suffix: "display mode",
|
|
487
|
+
options: ["dynamic", "fixed", "fill"],
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
491
|
+
suffix: "width",
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
type: ZAPPIFEST_FIELDS.select,
|
|
495
|
+
suffix: "contents alignment",
|
|
496
|
+
options: ["left", "center", "right"],
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
type: ZAPPIFEST_FIELDS.color_picker,
|
|
500
|
+
suffix: "background color",
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
type: ZAPPIFEST_FIELDS.color_picker,
|
|
504
|
+
suffix: "focused background color",
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
type: ZAPPIFEST_FIELDS.color_picker,
|
|
508
|
+
suffix: "border color",
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
type: ZAPPIFEST_FIELDS.color_picker,
|
|
512
|
+
suffix: "focused border color",
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
516
|
+
suffix: "border size",
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
520
|
+
suffix: "corner radius",
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
524
|
+
suffix: "padding top",
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
528
|
+
suffix: "padding right",
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
532
|
+
suffix: "padding bottom",
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
536
|
+
suffix: "padding left",
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
type: ZAPPIFEST_FIELDS.switch,
|
|
540
|
+
suffix: "asset enabled",
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
type: ZAPPIFEST_FIELDS.select,
|
|
544
|
+
suffix: "action asset flavour",
|
|
545
|
+
options: ["flavour_1", "flavour_2"],
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
type: ZAPPIFEST_FIELDS.select,
|
|
549
|
+
suffix: "asset alignment",
|
|
550
|
+
options: ["left", "right", "above", "below"],
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
554
|
+
suffix: "asset height",
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
558
|
+
suffix: "asset width",
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
562
|
+
suffix: "asset margin top",
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
566
|
+
suffix: "asset margin right",
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
570
|
+
suffix: "asset margin bottom",
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
574
|
+
suffix: "asset margin left",
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
type: ZAPPIFEST_FIELDS.switch,
|
|
578
|
+
suffix: "label enabled",
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
type: ZAPPIFEST_FIELDS.color_picker,
|
|
582
|
+
suffix: "font color",
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
type: ZAPPIFEST_FIELDS.color_picker,
|
|
586
|
+
suffix: "focused font color",
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
type: ZAPPIFEST_FIELDS.font_selector.ios,
|
|
590
|
+
suffix: "iOS font family",
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
type: ZAPPIFEST_FIELDS.font_selector.android,
|
|
594
|
+
suffix: "android font family",
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
598
|
+
suffix: "font size",
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
602
|
+
suffix: "line height",
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
606
|
+
suffix: "iOS letter spacing",
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
610
|
+
suffix: "android letter spacing",
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
type: ZAPPIFEST_FIELDS.select,
|
|
614
|
+
suffix: "text transform",
|
|
615
|
+
options: ["default", "lowercase", "uppercase", "capitalize"],
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
619
|
+
suffix: "margin top",
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
623
|
+
suffix: "margin right",
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
627
|
+
suffix: "margin bottom",
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
type: ZAPPIFEST_FIELDS.number_input,
|
|
631
|
+
suffix: "margin left",
|
|
632
|
+
},
|
|
633
|
+
];
|
|
634
|
+
|
|
409
635
|
const TV_MENU_LABEL_FIELDS = [
|
|
410
636
|
{
|
|
411
637
|
type: ZAPPIFEST_FIELDS.switch,
|
|
@@ -2134,6 +2360,8 @@ module.exports = {
|
|
|
2134
2360
|
TV_COLOR_STATES,
|
|
2135
2361
|
TV_ACTION_BUTTON_FIELDS,
|
|
2136
2362
|
tvActionButtonContainerFields,
|
|
2363
|
+
MOBILE_ACTION_BUTTON_FIELDS,
|
|
2364
|
+
mobileActionButtonContainerFields,
|
|
2137
2365
|
MOBILE_CELL_LABEL_FIELDS,
|
|
2138
2366
|
TV_CELL_LABEL_FIELDS,
|
|
2139
2367
|
TV_CELL_BADGE_FIELDS,
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { mobileActionButton } from "..";
|
|
2
|
+
|
|
3
|
+
describe("mobileActionButton", () => {
|
|
4
|
+
const defaults = {
|
|
5
|
+
buttonEnabled: true,
|
|
6
|
+
assignAction: "navigation_action",
|
|
7
|
+
displayMode: "dynamic",
|
|
8
|
+
width: 140,
|
|
9
|
+
contentsAlignment: "center",
|
|
10
|
+
backgroundColor: "rgba(1,1,1,1)",
|
|
11
|
+
focusedBackgroundColor: "rgba(2,2,2,1)",
|
|
12
|
+
borderColor: "rgba(0,0,0,0)",
|
|
13
|
+
focusedBorderColor: "rgba(0,0,0,0)",
|
|
14
|
+
borderSize: 0,
|
|
15
|
+
cornerRadius: 8,
|
|
16
|
+
paddingTop: 14,
|
|
17
|
+
paddingRight: 24,
|
|
18
|
+
paddingBottom: 14,
|
|
19
|
+
paddingLeft: 16,
|
|
20
|
+
assetEnabled: true,
|
|
21
|
+
actionAssetFlavour: "flavour_1",
|
|
22
|
+
assetAlignment: "left",
|
|
23
|
+
assetHeight: 24,
|
|
24
|
+
assetWidth: 24,
|
|
25
|
+
assetMarginTop: 0,
|
|
26
|
+
assetMarginRight: 6,
|
|
27
|
+
assetMarginBottom: 0,
|
|
28
|
+
assetMarginLeft: 0,
|
|
29
|
+
labelEnabled: true,
|
|
30
|
+
fontColor: "rgba(239,239,239,1)",
|
|
31
|
+
focusedFontColor: "rgba(239,239,239,1)",
|
|
32
|
+
iosFontFamily: "Ubuntu-Bold",
|
|
33
|
+
androidFontFamily: "Ubuntu-Bold",
|
|
34
|
+
fontSize: 15,
|
|
35
|
+
lineHeight: 24,
|
|
36
|
+
iosLetterSpacing: -0.2,
|
|
37
|
+
androidLetterSpacing: -0.2,
|
|
38
|
+
textTransform: "default",
|
|
39
|
+
marginTop: 0,
|
|
40
|
+
marginRight: 0,
|
|
41
|
+
marginBottom: 0,
|
|
42
|
+
marginLeft: 0,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
it("generates button fields with inferred conditional rules", () => {
|
|
46
|
+
const result = mobileActionButton({
|
|
47
|
+
label: "Mobile Button 2",
|
|
48
|
+
description: "button 2",
|
|
49
|
+
defaults,
|
|
50
|
+
isFirstButton: false,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
expect(result.group).toBe(true);
|
|
54
|
+
|
|
55
|
+
const enabledField = result.fields.find(
|
|
56
|
+
(field) => field.key === "mobile_button_2_button_enabled"
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
expect(enabledField).toBeTruthy();
|
|
60
|
+
|
|
61
|
+
expect(enabledField.conditional_fields).toEqual([
|
|
62
|
+
{
|
|
63
|
+
key: "styles/mobile_buttons_container_buttons_enabled",
|
|
64
|
+
condition_value: true,
|
|
65
|
+
},
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
const assignActionField = result.fields.find(
|
|
69
|
+
(field) => field.key === "mobile_button_2_assign_action"
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
expect(assignActionField).toBeTruthy();
|
|
73
|
+
|
|
74
|
+
expect(assignActionField.conditional_fields).toEqual([
|
|
75
|
+
{
|
|
76
|
+
key: "styles/mobile_button_2_button_enabled",
|
|
77
|
+
condition_value: true,
|
|
78
|
+
},
|
|
79
|
+
]);
|
|
80
|
+
|
|
81
|
+
const widthField = result.fields.find(
|
|
82
|
+
(field) => field.key === "mobile_button_2_width"
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
expect(widthField.rules).toBe("all_conditions");
|
|
86
|
+
|
|
87
|
+
expect(widthField.conditional_fields).toEqual([
|
|
88
|
+
{
|
|
89
|
+
key: "styles/mobile_button_2_button_enabled",
|
|
90
|
+
condition_value: true,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
key: "styles/mobile_buttons_container_independent_styles",
|
|
94
|
+
condition_value: true,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
key: "styles/mobile_button_2_display_mode",
|
|
98
|
+
condition_value: "fixed",
|
|
99
|
+
},
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
const actionAssetFlavourField = result.fields.find(
|
|
103
|
+
(field) => field.key === "mobile_button_2_action_asset_flavour"
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
expect(actionAssetFlavourField.rules).toBe("all_conditions");
|
|
107
|
+
|
|
108
|
+
expect(actionAssetFlavourField.conditional_fields).toEqual([
|
|
109
|
+
{
|
|
110
|
+
key: "styles/mobile_button_2_button_enabled",
|
|
111
|
+
condition_value: true,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
key: "styles/mobile_buttons_container_independent_styles",
|
|
115
|
+
condition_value: true,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
key: "styles/mobile_button_2_asset_enabled",
|
|
119
|
+
condition_value: true,
|
|
120
|
+
},
|
|
121
|
+
]);
|
|
122
|
+
|
|
123
|
+
const contentsAlignmentField = result.fields.find(
|
|
124
|
+
(field) => field.key === "mobile_button_2_contents_alignment"
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
expect(contentsAlignmentField.rules).toBe("all_conditions");
|
|
128
|
+
|
|
129
|
+
expect(contentsAlignmentField.conditional_fields).toEqual([
|
|
130
|
+
{
|
|
131
|
+
key: "styles/mobile_button_2_button_enabled",
|
|
132
|
+
condition_value: true,
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
key: "styles/mobile_buttons_container_independent_styles",
|
|
136
|
+
condition_value: true,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
key: "styles/mobile_button_2_display_mode",
|
|
140
|
+
condition_value: ["fixed", "fill"],
|
|
141
|
+
},
|
|
142
|
+
]);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it("keeps first-button fields independent-style agnostic", () => {
|
|
146
|
+
const result = mobileActionButton({
|
|
147
|
+
label: "Mobile Button 1",
|
|
148
|
+
description: "button 1",
|
|
149
|
+
defaults,
|
|
150
|
+
isFirstButton: true,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const widthField = result.fields.find(
|
|
154
|
+
(field) => field.key === "mobile_button_1_width"
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
expect(widthField.conditional_fields).toEqual([
|
|
158
|
+
{
|
|
159
|
+
key: "styles/mobile_button_1_button_enabled",
|
|
160
|
+
condition_value: true,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
key: "styles/mobile_button_1_display_mode",
|
|
164
|
+
condition_value: "fixed",
|
|
165
|
+
},
|
|
166
|
+
]);
|
|
167
|
+
});
|
|
168
|
+
});
|