@applicaster/zapp-react-native-utils 16.0.0-rc.9 → 16.0.0-rc.90

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.
Files changed (201) hide show
  1. package/actionsExecutor/ActionExecutor.ts +57 -12
  2. package/actionsExecutor/ActionExecutorContext.tsx +113 -314
  3. package/actionsExecutor/__tests__/ActionExecutor.test.ts +71 -0
  4. package/actionsExecutor/__tests__/feedDecorator.test.ts +61 -0
  5. package/actionsExecutor/actions/__tests__/dismissBottomSheet.test.ts +25 -0
  6. package/actionsExecutor/actions/__tests__/goBack.test.ts +62 -0
  7. package/actionsExecutor/actions/__tests__/goHome.test.ts +19 -0
  8. package/actionsExecutor/actions/__tests__/loadItemsFromSource.test.ts +88 -0
  9. package/actionsExecutor/actions/__tests__/navigateToScreen.test.ts +133 -0
  10. package/actionsExecutor/actions/__tests__/openBottomSheet.customContent.test.ts +76 -0
  11. package/actionsExecutor/actions/__tests__/openBottomSheet.inlineItems.test.ts +212 -0
  12. package/actionsExecutor/actions/__tests__/presentScreen.test.ts +127 -0
  13. package/actionsExecutor/actions/__tests__/showAlert.test.ts +49 -0
  14. package/actionsExecutor/actions/__tests__/showToast.test.ts +88 -0
  15. package/actionsExecutor/actions/appRestart.ts +24 -0
  16. package/actionsExecutor/actions/confirmDialog.ts +53 -0
  17. package/actionsExecutor/actions/dismissBottomSheet.ts +23 -0
  18. package/actionsExecutor/actions/goBack.ts +60 -0
  19. package/actionsExecutor/actions/goHome.ts +31 -0
  20. package/actionsExecutor/actions/index.ts +42 -0
  21. package/actionsExecutor/actions/localStorageRemove.ts +27 -0
  22. package/actionsExecutor/actions/localStorageSet.ts +28 -0
  23. package/actionsExecutor/actions/localStorageToggleFlag.ts +28 -0
  24. package/actionsExecutor/actions/navigateToScreen.ts +137 -0
  25. package/actionsExecutor/actions/openBottomSheet.ts +329 -0
  26. package/actionsExecutor/actions/presentScreen.ts +78 -0
  27. package/actionsExecutor/actions/refreshComponent.ts +85 -0
  28. package/actionsExecutor/actions/screenSetVariable.ts +35 -0
  29. package/actionsExecutor/actions/screenToggleFlag.ts +38 -0
  30. package/actionsExecutor/actions/sendCloudEvent.ts +93 -0
  31. package/actionsExecutor/actions/sessionStorageRemove.ts +19 -0
  32. package/actionsExecutor/actions/sessionStorageSet.ts +20 -0
  33. package/actionsExecutor/actions/sessionStorageToggleFlag.ts +15 -0
  34. package/actionsExecutor/actions/showAlert.ts +51 -0
  35. package/actionsExecutor/actions/showToast.ts +87 -0
  36. package/actionsExecutor/actions/switchLayout.ts +40 -0
  37. package/actionsExecutor/consts.ts +27 -0
  38. package/actionsExecutor/feedDecorator.ts +6 -6
  39. package/actionsExecutor/types.ts +59 -0
  40. package/analyticsUtils/AnalyticsEvents/sendMenuClickEvent.ts +2 -2
  41. package/analyticsUtils/PlayerAnalyticsManager.ts +12 -2
  42. package/analyticsUtils/__tests__/analyticsMapper.test.ts +35 -0
  43. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testACP_events.json +1 -1
  44. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testBlockUnlistedParams_rules.json +1 -1
  45. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_events.json +4 -0
  46. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEmptyRenameKeepsName_rules.json +6 -0
  47. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testEventRegex_events.json +3 -9
  48. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_events.json +18 -0
  49. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testIgnoreOrdering_rules.json +16 -0
  50. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_events.json +4 -0
  51. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexEventNoFallback_rules.json +6 -0
  52. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_events.json +4 -0
  53. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexMultiGroupRename_rules.json +6 -0
  54. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_events.json +4 -0
  55. package/analyticsUtils/__tests__/fixtures/analytics_mapper_testRegexNonNamedFullMatch_rules.json +6 -0
  56. package/analyticsUtils/__tests__/fixtures/index.js +20 -0
  57. package/analyticsUtils/analyticsMapper.ts +4 -1
  58. package/analyticsUtils/playerAnalyticsTracker.ts +26 -3
  59. package/appUtils/HooksManager/index.ts +12 -8
  60. package/appUtils/contextKeysManager/__tests__/getKey/failure.test.ts +1 -1
  61. package/appUtils/contextKeysManager/__tests__/removeKey/failure.test.ts +1 -1
  62. package/appUtils/contextKeysManager/__tests__/setKey/failure/invalidKey.test.ts +4 -4
  63. package/appUtils/contextKeysManager/index.ts +1 -1
  64. package/appUtils/contextKeysManager/utils/index.ts +38 -25
  65. package/appUtils/playerManager/OverlayObserver/OverlaysObserver.ts +143 -53
  66. package/appUtils/playerManager/OverlayObserver/__tests__/liveContent.test.ts +205 -0
  67. package/appUtils/playerManager/OverlayObserver/__tests__/utils.test.ts +49 -0
  68. package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.android.tv.ts +4 -0
  69. package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.ios.tv.ts +4 -0
  70. package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.ts +11 -0
  71. package/appUtils/playerManager/OverlayObserver/getUpcomingQueue.web.ts +4 -0
  72. package/appUtils/playerManager/OverlayObserver/utils.ts +54 -20
  73. package/appUtils/playerManager/__tests__/playerContent.test.ts +403 -0
  74. package/appUtils/playerManager/__tests__/playerFactory.test.ts +1 -1
  75. package/appUtils/playerManager/__tests__/playerNative.test.ts +38 -0
  76. package/appUtils/playerManager/__tests__/usePlayerContent.test.tsx +64 -0
  77. package/appUtils/playerManager/{conts.ts → const.ts} +20 -0
  78. package/appUtils/playerManager/index.ts +1 -1
  79. package/appUtils/playerManager/player.ts +115 -3
  80. package/appUtils/playerManager/playerFactory.ts +1 -1
  81. package/appUtils/playerManager/playerNative.ts +6 -4
  82. package/appUtils/playerManager/usePlayerContent.tsx +43 -0
  83. package/appUtils/playerManager/usePlayerControllerSetup.tsx +1 -1
  84. package/appUtils/playerManager/userLanguagePreference.ts +1 -1
  85. package/arrayUtils/__tests__/{anyThruthy.test.ts → anyTruthy.test.ts} +8 -0
  86. package/arrayUtils/__tests__/arrayUtils.test.ts +165 -108
  87. package/arrayUtils/__tests__/isEmptyArray.test.ts +11 -0
  88. package/arrayUtils/__tests__/isFilledArray.test.ts +12 -0
  89. package/arrayUtils/__tests__/isFirst.test.ts +17 -0
  90. package/arrayUtils/__tests__/isIndexInRange.test.ts +14 -0
  91. package/arrayUtils/__tests__/isLast.test.ts +31 -0
  92. package/arrayUtils/__tests__/makeListOf.test.ts +31 -0
  93. package/arrayUtils/__tests__/makeListOfIndexes.test.ts +20 -0
  94. package/arrayUtils/__tests__/reorderByIds.test.ts +50 -0
  95. package/arrayUtils/__tests__/sample.test.ts +61 -0
  96. package/arrayUtils/index.ts +136 -20
  97. package/bottomSheet/__tests__/scrollContext.test.tsx +35 -0
  98. package/bottomSheet/index.ts +17 -0
  99. package/cellUtils/index.ts +33 -8
  100. package/colorUtils/__tests__/isTransparentColor.test.ts +76 -0
  101. package/colorUtils/__tests__/isValidColor.test.ts +70 -0
  102. package/colorUtils/index.ts +50 -0
  103. package/configurationUtils/__tests__/manifestKeyParser.test.ts +21 -0
  104. package/configurationUtils/__tests__/modalBlocksParser.test.ts +260 -0
  105. package/configurationUtils/manifestKeyParser.ts +50 -10
  106. package/configurationUtils/modalBlocksParser.ts +296 -0
  107. package/entryActions/__tests__/buildEntryActions.test.ts +195 -0
  108. package/entryActions/aliasPresentation.ts +124 -0
  109. package/entryActions/buildEntryActions.ts +167 -0
  110. package/entryActions/index.ts +17 -0
  111. package/entryActions/types.ts +39 -0
  112. package/manifestUtils/__tests__/player.audioControls.test.js +158 -0
  113. package/manifestUtils/_internals/index.js +14 -3
  114. package/manifestUtils/defaultManifestConfigurations/generalContent.js +41 -0
  115. package/manifestUtils/defaultManifestConfigurations/player.js +349 -20
  116. package/manifestUtils/fieldUtils/__tests__/fieldUtils.test.js +84 -0
  117. package/manifestUtils/fieldUtils/index.js +125 -0
  118. package/manifestUtils/index.js +3 -0
  119. package/manifestUtils/keys.js +9 -0
  120. package/manifestUtils/mobileAction/button/index.js +16 -0
  121. package/manifestUtils/mobileAction/container/index.js +3 -1
  122. package/manifestUtils/mobileAction/groups/defaults.js +3 -1
  123. package/manifestUtils/modalBlocks.js +304 -0
  124. package/manifestUtils/platformIsTV.js +1 -0
  125. package/modalState/ContentViewModel.ts +113 -0
  126. package/modalState/EditableCollection.ts +17 -0
  127. package/modalState/EditableCollectionRegistry.ts +51 -0
  128. package/modalState/ModalOrchestrator.ts +211 -0
  129. package/modalState/RemoteEditableCollection.ts +235 -0
  130. package/modalState/__tests__/ContentViewModel.editable.test.ts +69 -0
  131. package/modalState/__tests__/ContentViewModel.test.ts +165 -0
  132. package/modalState/__tests__/EditableCollectionRegistry.test.ts +112 -0
  133. package/modalState/__tests__/ModalOrchestrator.phase3.test.ts +47 -0
  134. package/modalState/__tests__/RemoteEditableCollection.test.ts +415 -0
  135. package/modalState/__tests__/index.test.ts +30 -1
  136. package/modalState/__tests__/useBottomSheetContent.test.ts +349 -0
  137. package/modalState/__tests__/useModalStoreState.test.ts +142 -0
  138. package/modalState/index.ts +35 -83
  139. package/modalState/store.ts +109 -0
  140. package/modalState/types.ts +160 -0
  141. package/modalState/useBottomSheetContent.ts +109 -0
  142. package/numberUtils/__tests__/isMinusZero.test.ts +20 -0
  143. package/numberUtils/__tests__/isZero.test.ts +27 -0
  144. package/numberUtils/__tests__/requireNumber.test.ts +50 -0
  145. package/numberUtils/__tests__/toNumber.test.ts +27 -0
  146. package/numberUtils/__tests__/toNumberWithDefault.test.ts +64 -0
  147. package/numberUtils/__tests__/toNumberWithDefaultZero.test.ts +48 -0
  148. package/numberUtils/index.ts +27 -8
  149. package/package.json +2 -2
  150. package/pipesUtils/__tests__/buildUrlWithQuery.test.ts +33 -0
  151. package/pipesUtils/__tests__/withPipesEndpoint.test.tsx +56 -0
  152. package/pipesUtils/index.ts +1 -0
  153. package/pipesUtils/withPipesEndpoint.tsx +54 -0
  154. package/playerUtils/__tests__/contentDataKeys.test.ts +297 -0
  155. package/playerUtils/__tests__/resolvePlayerActions.test.ts +138 -0
  156. package/playerUtils/__tests__/resolvePlayerTitleSubtitle.test.ts +180 -0
  157. package/playerUtils/contentDataKeys.ts +134 -0
  158. package/playerUtils/index.ts +41 -18
  159. package/playerUtils/isAudioItem.ts +26 -0
  160. package/playerUtils/resolvePlayerActions.ts +71 -0
  161. package/playerUtils/resolvePlayerTitleSubtitle.ts +76 -0
  162. package/reactHooks/actions/index.ts +117 -2
  163. package/reactHooks/cell-click/__tests__/index.test.js +64 -0
  164. package/reactHooks/cell-click/index.ts +39 -24
  165. package/reactHooks/feed/__mocks__/useMarkPipesDataStale.ts +4 -0
  166. package/reactHooks/feed/__tests__/useInflatedUrl.test.tsx +25 -0
  167. package/reactHooks/feed/index.ts +5 -1
  168. package/reactHooks/feed/useBatchLoading.ts +9 -1
  169. package/reactHooks/feed/{usePipesCacheReset.ts → useMarkPipesDataStale.ts} +12 -4
  170. package/reactHooks/index.ts +2 -0
  171. package/reactHooks/layout/index.ts +1 -1
  172. package/reactHooks/navigation/__mocks__/index.ts +4 -0
  173. package/reactHooks/navigation/__tests__/index.test.tsx +176 -1
  174. package/reactHooks/navigation/__tests__/useIsScreenActive.test.ts +42 -0
  175. package/reactHooks/navigation/__tests__/usePresentScreen.test.ts +154 -0
  176. package/reactHooks/navigation/index.ts +3 -1
  177. package/reactHooks/navigation/useIsScreenActive.ts +29 -8
  178. package/reactHooks/navigation/usePresentScreen.ts +157 -0
  179. package/reactHooks/navigation/useRoute.ts +22 -5
  180. package/reactHooks/state/useComponentScreenState.ts +1 -1
  181. package/reactHooks/usePluginConfiguration.ts +4 -1
  182. package/reactHooks/utils/__tests__/index.test.js +22 -2
  183. package/reactHooks/utils/index.ts +13 -2
  184. package/reactHooks/videoModal/hooks/useVideoModalScreenData.tsx +22 -4
  185. package/riverComponetsMeasurementProvider/index.tsx +12 -8
  186. package/stringUtils/__tests__/stringUtils.test.js +42 -0
  187. package/stringUtils/index.ts +2 -2
  188. package/uiActionsRegistrator/__tests__/resolveActionIdentifiers.test.ts +93 -0
  189. package/uiActionsRegistrator/__tests__/subscribe.test.ts +107 -0
  190. package/uiActionsRegistrator/__tests__/usableActionItems.test.ts +52 -0
  191. package/uiActionsRegistrator/index.ts +25 -0
  192. package/uiActionsRegistrator/registry.ts +335 -0
  193. package/uiActionsRegistrator/resolveActionIdentifiers.ts +100 -0
  194. package/uiActionsRegistrator/usableActionItems.ts +66 -0
  195. package/zappFrameworkUtils/__tests__/localStorageHelper.test.ts +146 -0
  196. package/zappFrameworkUtils/localStorageHelper.ts +19 -15
  197. package/appUtils/playerManager/usePlayerTitleSummaryOverlay.tsx +0 -56
  198. package/playerUtils/__tests__/getPlayerActionButtons.test.ts +0 -54
  199. package/playerUtils/getPlayerActionButtons.ts +0 -17
  200. package/reactHooks/feed/__mocks__/usePipesCacheReset.ts +0 -1
  201. /package/reactHooks/actions/__tests__/{index.test.js → index.test.tsx} +0 -0
@@ -1,9 +1,93 @@
1
1
  const {
2
+ parseShorthand,
3
+ margin,
4
+ padding,
2
5
  withConditional,
3
6
  getConditionalKey,
4
7
  createConditionalField,
5
8
  } = require("..");
6
9
 
10
+ describe("parseShorthand", () => {
11
+ it("1 value → all four sides equal", () => {
12
+ expect(parseShorthand("8")).toEqual([8, 8, 8, 8]);
13
+ });
14
+
15
+ it("2 values → top/bottom, right/left", () => {
16
+ expect(parseShorthand("0 20")).toEqual([0, 20, 0, 20]);
17
+ });
18
+
19
+ it("3 values → top, right/left, bottom", () => {
20
+ expect(parseShorthand("0 0 20")).toEqual([0, 0, 20, 0]);
21
+ });
22
+
23
+ it("4 values → top right bottom left", () => {
24
+ expect(parseShorthand("1 2 3 4")).toEqual([1, 2, 3, 4]);
25
+ });
26
+
27
+ it("throws on invalid count", () => {
28
+ expect(() => parseShorthand("1 2 3 4 5")).toThrow();
29
+ });
30
+ });
31
+
32
+ describe("margin", () => {
33
+ it("returns 4 field descriptors with correct suffixes", () => {
34
+ const fields = margin("margin", { mobile: "0" });
35
+
36
+ expect(fields.map((f) => f.suffix)).toEqual([
37
+ "margin top",
38
+ "margin right",
39
+ "margin bottom",
40
+ "margin left",
41
+ ]);
42
+ });
43
+
44
+ it("sets type to number_input", () => {
45
+ margin("margin", { mobile: "0" }).forEach((f) => {
46
+ expect(f.type).toBe("number_input");
47
+ });
48
+ });
49
+
50
+ it("expands shorthand per platform", () => {
51
+ const fields = margin("margin", { mobile: "0 0 20", tv: "0 0 90" });
52
+ const byKey = Object.fromEntries(fields.map((f) => [f.suffix, f]));
53
+ expect(byKey["margin top"].initialValue).toEqual({ mobile: 0, tv: 0 });
54
+ expect(byKey["margin bottom"].initialValue).toEqual({ mobile: 20, tv: 90 });
55
+ expect(byKey["margin left"].initialValue).toEqual({ mobile: 0, tv: 0 });
56
+ });
57
+
58
+ it("supports a custom suffix prefix", () => {
59
+ const fields = margin("input margin", { mobile: "4" });
60
+ expect(fields[0].suffix).toBe("input margin top");
61
+ });
62
+ });
63
+
64
+ describe("padding", () => {
65
+ it("returns 4 field descriptors with correct suffixes", () => {
66
+ const fields = padding("padding", { mobile: "0" });
67
+
68
+ expect(fields.map((f) => f.suffix)).toEqual([
69
+ "padding top",
70
+ "padding right",
71
+ "padding bottom",
72
+ "padding left",
73
+ ]);
74
+ });
75
+
76
+ it("expands 2-value shorthand symmetrically", () => {
77
+ const fields = padding("padding", { mobile: "0 20", tv: "0 124" });
78
+ const byKey = Object.fromEntries(fields.map((f) => [f.suffix, f]));
79
+
80
+ expect(byKey["padding right"].initialValue).toEqual({
81
+ mobile: 20,
82
+ tv: 124,
83
+ });
84
+
85
+ expect(byKey["padding left"].initialValue).toEqual({ mobile: 20, tv: 124 });
86
+ expect(byKey["padding top"].initialValue).toEqual({ mobile: 0, tv: 0 });
87
+ expect(byKey["padding bottom"].initialValue).toEqual({ mobile: 0, tv: 0 });
88
+ });
89
+ });
90
+
7
91
  describe("manifestUtils/fieldUtils", () => {
8
92
  it("appends conditions and adds all_conditions when there is more than one condition", () => {
9
93
  const config = {
@@ -1,3 +1,121 @@
1
+ const { ZAPPIFEST_FIELDS } = require("../keys");
2
+ const { toCamelCase } = require("../_internals");
3
+
4
+ const SIDES = ["top", "right", "bottom", "left"];
5
+
6
+ /**
7
+ * Parses a CSS margin/padding shorthand string into [top, right, bottom, left].
8
+ *
9
+ * 1 value → all four sides
10
+ * 2 values → top/bottom, right/left
11
+ * 3 values → top, right/left, bottom
12
+ * 4 values → top, right, bottom, left
13
+ *
14
+ * @param {string} str
15
+ * @returns {[number, number, number, number]}
16
+ */
17
+ function parseShorthand(str) {
18
+ const parts = String(str).trim().split(/\s+/).map(Number);
19
+
20
+ switch (parts.length) {
21
+ case 1:
22
+ return [parts[0], parts[0], parts[0], parts[0]];
23
+ case 2:
24
+ return [parts[0], parts[1], parts[0], parts[1]];
25
+ case 3:
26
+ return [parts[0], parts[1], parts[2], parts[1]];
27
+ case 4:
28
+ return parts;
29
+ default:
30
+ throw new Error(
31
+ `Shorthand expects 1–4 space-separated values, got ${parts.length}: "${str}"`
32
+ );
33
+ }
34
+ }
35
+
36
+ function spacingFields(prefix, initialValues) {
37
+ const platforms = Object.keys(initialValues);
38
+
39
+ const parsed = Object.fromEntries(
40
+ platforms.map((p) => [p, parseShorthand(initialValues[p])])
41
+ );
42
+
43
+ return SIDES.map((side, i) => ({
44
+ suffix: `${prefix} ${side}`,
45
+ type: ZAPPIFEST_FIELDS.number_input,
46
+ initialValue: Object.fromEntries(platforms.map((p) => [p, parsed[p][i]])),
47
+ }));
48
+ }
49
+
50
+ /**
51
+ * Generates four margin field descriptors (top/right/bottom/left) from a
52
+ * per-platform CSS shorthand string.
53
+ *
54
+ * @param {string} suffix - prefix word for generated field names, e.g. "margin"
55
+ * @param {Record<string, string>} initialValues - e.g. { mobile: "0 0 20", tv: "0 0 90" }
56
+ * @returns {object[]}
57
+ */
58
+ function margin(suffix, initialValues) {
59
+ return spacingFields(suffix, initialValues);
60
+ }
61
+
62
+ /**
63
+ * Generates four padding field descriptors (top/right/bottom/left) from a
64
+ * per-platform CSS shorthand string.
65
+ *
66
+ * @param {string} suffix - prefix word for generated field names, e.g. "padding"
67
+ * @param {Record<string, string>} initialValues - e.g. { mobile: "0 20", tv: "0 124" }
68
+ * @returns {object[]}
69
+ */
70
+ function padding(suffix, initialValues) {
71
+ return spacingFields(suffix, initialValues);
72
+ }
73
+
74
+ /**
75
+ * Returns a flat camelCase defaults object for a spacing shorthand.
76
+ * e.g. marginDefaults("margin", "0 0 20") → { marginTop: 0, marginRight: 0, marginBottom: 20, marginLeft: 0 }
77
+ *
78
+ * @param {string} suffix - e.g. "margin" or "padding"
79
+ * @param {string} shorthand - CSS-like shorthand string
80
+ * @returns {Record<string, number>}
81
+ */
82
+ function spacingDefaults(suffix, shorthand) {
83
+ const values = parseShorthand(shorthand);
84
+
85
+ return Object.fromEntries(
86
+ SIDES.map((side, i) => [toCamelCase(`${suffix} ${side}`), values[i]])
87
+ );
88
+ }
89
+
90
+ function marginDefaults(suffix, shorthand) {
91
+ return spacingDefaults(suffix, shorthand);
92
+ }
93
+
94
+ function paddingDefaults(suffix, shorthand) {
95
+ return spacingDefaults(suffix, shorthand);
96
+ }
97
+
98
+ /**
99
+ * Returns four field descriptors (top/right/bottom/left) with only suffix and type — no initialValue.
100
+ * Used when defaults are stored separately in the subgroup spec.
101
+ *
102
+ * @param {string} prefix - e.g. "margin" or "padding"
103
+ * @returns {object[]}
104
+ */
105
+ function marginFields(prefix) {
106
+ return SIDES.map((side) => ({
107
+ suffix: `${prefix} ${side}`,
108
+ type: ZAPPIFEST_FIELDS.number_input,
109
+ }));
110
+ }
111
+
112
+ function paddingFields(prefix) {
113
+ return SIDES.map((side) => ({
114
+ suffix: `${prefix} ${side}`,
115
+ type: ZAPPIFEST_FIELDS.number_input,
116
+ }));
117
+ }
118
+
1
119
  /**
2
120
  * Appends new conditional_fields from conditions array
3
121
  * to config.conditional_fields
@@ -48,6 +166,13 @@ function createConditionalField(key, condition_value, category = "styles") {
48
166
  }
49
167
 
50
168
  module.exports = {
169
+ parseShorthand,
170
+ margin,
171
+ padding,
172
+ marginDefaults,
173
+ paddingDefaults,
174
+ marginFields,
175
+ paddingFields,
51
176
  withConditional,
52
177
  getConditionalKey,
53
178
  createConditionalField,
@@ -24,6 +24,7 @@ const {
24
24
  const { buttonKey } = require("./buttons");
25
25
  const { tvBadges } = require("./tvBadges");
26
26
  const { mobileProgressBar, tvProgressBar } = require("./progressBar");
27
+ const { getModalBlockStyles, getModalLocalizations } = require("./modalBlocks");
27
28
 
28
29
  const {
29
30
  secondaryImage,
@@ -54,4 +55,6 @@ module.exports = {
54
55
  getUpdatedSecondaryImageKeys,
55
56
  DEFAULT_GRADIENT_IMAGE,
56
57
  compact,
58
+ getModalBlockStyles,
59
+ getModalLocalizations,
57
60
  };
@@ -43,6 +43,7 @@ const TV_PLATFORMS = [
43
43
  "tvos_for_quickbrick",
44
44
  "samsung_tv",
45
45
  "lg_tv",
46
+ "vidaa",
46
47
  "vizio",
47
48
  ];
48
49
 
@@ -630,6 +631,14 @@ const MOBILE_ACTION_BUTTON_FIELDS = [
630
631
  type: ZAPPIFEST_FIELDS.number_input,
631
632
  suffix: "margin left",
632
633
  },
634
+ {
635
+ type: ZAPPIFEST_FIELDS.number_input,
636
+ suffix: "horizontal gutter",
637
+ },
638
+ {
639
+ type: ZAPPIFEST_FIELDS.number_input,
640
+ suffix: "vertical gutter",
641
+ },
633
642
  ];
634
643
 
635
644
  const TV_MENU_LABEL_FIELDS = [
@@ -129,6 +129,22 @@ function mobileActionButton({ label, description, defaults, isFirstButton }) {
129
129
  conditions.push(createConditionalField(labelEnabledKey, true));
130
130
  }
131
131
 
132
+ const assetAlignmentKey = keyPrefixGenerator("asset_alignment");
133
+
134
+ // horizontal_gutter fields depends on [asset_alignment: left or asset_alignment: right]
135
+ if (isKeyHasSuffix("horizontal_gutter", key)) {
136
+ conditions.push(
137
+ createConditionalField(assetAlignmentKey, ["left", "right"])
138
+ );
139
+ }
140
+
141
+ // vertical_gutter fields depends on [asset_alignment: above or asset_alignment: below]
142
+ if (isKeyHasSuffix("vertical_gutter", key)) {
143
+ conditions.push(
144
+ createConditionalField(assetAlignmentKey, ["above", "below"])
145
+ );
146
+ }
147
+
132
148
  return withConditional(conditions)(field);
133
149
  });
134
150
 
@@ -49,7 +49,9 @@ function mobileActionButtonsContainer({ label, description, defaults }) {
49
49
 
50
50
  // over_image_position depends on [positionKey: over_image]
51
51
  if (isKeyHasSuffix("over_image_position", key)) {
52
- conditions.push(createConditionalField(positionKey, "over_image"));
52
+ conditions.push(
53
+ createConditionalField(positionKey, defaults.position[0])
54
+ );
53
55
  }
54
56
 
55
57
  // horizontal_gutter depends on [stackingKey: horizontal]
@@ -33,7 +33,7 @@ const DEFAULT_MOBILE_ACTION_BUTTON_SHARED_DEFAULTS = {
33
33
  assetHeight: 24,
34
34
  assetWidth: 24,
35
35
  assetMarginTop: 0,
36
- assetMarginRight: 6,
36
+ assetMarginRight: 0,
37
37
  assetMarginBottom: 0,
38
38
  assetMarginLeft: 0,
39
39
  labelEnabled: true,
@@ -50,6 +50,8 @@ const DEFAULT_MOBILE_ACTION_BUTTON_SHARED_DEFAULTS = {
50
50
  marginRight: 0,
51
51
  marginBottom: 0,
52
52
  marginLeft: 0,
53
+ horizontalGutter: 8,
54
+ verticalGutter: 8,
53
55
  };
54
56
 
55
57
  const DEFAULT_MOBILE_ACTION_BUTTON_PRESETS = {
@@ -0,0 +1,304 @@
1
+ function getModalBlockStyles({ prefix }) {
2
+ return [
3
+ {
4
+ group: true,
5
+ label: "Header Styles",
6
+ folded: true,
7
+ fields: [
8
+ {
9
+ type: "color_picker_rgba",
10
+ key: `${prefix}_style_header_container_default_backgroundColor`,
11
+ label: "Header Background Color",
12
+ initial_value: "rgba(30,30,30,1)",
13
+ },
14
+ {
15
+ type: "color_picker_rgba",
16
+ key: `${prefix}_style_header_container_default_borderBottomColor`,
17
+ label: "Header Border Bottom Color",
18
+ initial_value: "transparent",
19
+ },
20
+ {
21
+ type: "number_input",
22
+ key: `${prefix}_style_header_container_default_borderBottomSize`,
23
+ label: "Header Border Bottom Size",
24
+ initial_value: 0,
25
+ },
26
+ {
27
+ type: "color_picker_rgba",
28
+ key: `${prefix}_style_header_title_default_fontColor`,
29
+ label: "Header Title Color",
30
+ initial_value: "#EFEFEF",
31
+ },
32
+ {
33
+ type: "number_input",
34
+ key: `${prefix}_style_header_title_default_fontSize`,
35
+ label: "Header Title Font Size",
36
+ initial_value: 18,
37
+ },
38
+ {
39
+ type: "number_input",
40
+ key: `${prefix}_style_header_title_default_lineHeight`,
41
+ label: "Header Title Line Height",
42
+ initial_value: 32,
43
+ },
44
+ {
45
+ type: "color_picker_rgba",
46
+ key: `${prefix}_style_header_close_button_default_backgroundColor`,
47
+ label: "Close Button Background Color",
48
+ initial_value: "transparent",
49
+ },
50
+ {
51
+ type: "color_picker_rgba",
52
+ key: `${prefix}_style_header_close_button_hover_backgroundColor`,
53
+ label: "Close Button Hover Background Color",
54
+ initial_value: "rgba(46,46,46,1)",
55
+ },
56
+ {
57
+ type: "uploader",
58
+ key: `${prefix}_style_header_close_button_asset`,
59
+ label: "Close Button Icon Asset",
60
+ },
61
+ {
62
+ type: "color_picker_rgba",
63
+ key: `${prefix}_style_header_action_buttons_default_backgroundColor`,
64
+ label: "Header Action Button Background Color",
65
+ initial_value: "rgba(46,46,46,1)",
66
+ },
67
+ {
68
+ type: "color_picker_rgba",
69
+ key: `${prefix}_style_header_action_buttons_hover_backgroundColor`,
70
+ label: "Header Action Button Hover Color",
71
+ initial_value: "rgba(62,62,62,1)",
72
+ },
73
+ {
74
+ type: "color_picker_rgba",
75
+ key: `${prefix}_style_header_action_buttons_default_fontColor`,
76
+ label: "Header Action Button Title Color",
77
+ initial_value: "#EFEFEF",
78
+ },
79
+ {
80
+ type: "number_input",
81
+ key: `${prefix}_style_header_action_buttons_default_fontSize`,
82
+ label: "Header Action Button Font Size",
83
+ initial_value: 14,
84
+ },
85
+ {
86
+ type: "number_input",
87
+ key: `${prefix}_style_header_action_buttons_default_borderRadius`,
88
+ label: "Header Action Button Radius",
89
+ initial_value: 16,
90
+ },
91
+ ],
92
+ },
93
+ {
94
+ group: true,
95
+ label: "Item Styles",
96
+ folded: true,
97
+ fields: [
98
+ {
99
+ type: "color_picker_rgba",
100
+ key: `${prefix}_style_item_background_default_backgroundColor`,
101
+ label: "Item Background Color",
102
+ initial_value: "transparent",
103
+ },
104
+ {
105
+ type: "color_picker_rgba",
106
+ key: `${prefix}_style_item_background_focus_backgroundColor`,
107
+ label: "Item Focus/Touch Color",
108
+ initial_value: "rgba(62,62,62,1)",
109
+ },
110
+ {
111
+ type: "number_input",
112
+ key: `${prefix}_style_item_background_default_borderRadius`,
113
+ label: "Item Corner Radius",
114
+ initial_value: 12,
115
+ },
116
+ {
117
+ type: "number_input",
118
+ key: `${prefix}_style_item_background_default_paddingTop`,
119
+ label: "Item Padding Top",
120
+ initial_value: 8,
121
+ },
122
+ {
123
+ type: "number_input",
124
+ key: `${prefix}_style_item_background_default_paddingBottom`,
125
+ label: "Item Padding Bottom",
126
+ initial_value: 8,
127
+ },
128
+ {
129
+ type: "number_input",
130
+ key: `${prefix}_style_item_background_default_paddingLeft`,
131
+ label: "Item Padding Left",
132
+ initial_value: 10,
133
+ },
134
+ {
135
+ type: "number_input",
136
+ key: `${prefix}_style_item_background_default_paddingRight`,
137
+ label: "Item Padding Right",
138
+ initial_value: 10,
139
+ },
140
+ {
141
+ type: "number_input",
142
+ key: `${prefix}_style_item_image_default_width`,
143
+ label: "Item Image Width",
144
+ initial_value: 48,
145
+ },
146
+ {
147
+ type: "number_input",
148
+ key: `${prefix}_style_item_image_default_height`,
149
+ label: "Item Image Height",
150
+ initial_value: 48,
151
+ },
152
+ {
153
+ type: "number_input",
154
+ key: `${prefix}_style_item_image_default_borderRadius`,
155
+ label: "Item Image Radius",
156
+ initial_value: 6,
157
+ },
158
+ {
159
+ type: "color_picker_rgba",
160
+ key: `${prefix}_style_item_text_label_1_default_fontColor`,
161
+ label: "Item Title Color",
162
+ initial_value: "#FFFFFF",
163
+ },
164
+ {
165
+ type: "number_input",
166
+ key: `${prefix}_style_item_text_label_1_default_fontSize`,
167
+ label: "Item Title Font Size",
168
+ initial_value: 15,
169
+ },
170
+ {
171
+ type: "color_picker_rgba",
172
+ key: `${prefix}_style_item_text_label_2_default_fontColor`,
173
+ label: "Item Subtitle Color",
174
+ initial_value: "#999999",
175
+ },
176
+ {
177
+ type: "number_input",
178
+ key: `${prefix}_style_item_text_label_2_default_fontSize`,
179
+ label: "Item Subtitle Font Size",
180
+ initial_value: 13,
181
+ },
182
+ ],
183
+ },
184
+ {
185
+ group: true,
186
+ label: "Action Styles",
187
+ folded: true,
188
+ fields: [
189
+ {
190
+ type: "color_picker_rgba",
191
+ key: `${prefix}_style_action_background_default_backgroundColor`,
192
+ label: "Action Background Color",
193
+ initial_value: "transparent",
194
+ },
195
+ {
196
+ type: "color_picker_rgba",
197
+ key: `${prefix}_style_action_background_hover_backgroundColor`,
198
+ label: "Action Hover/Touch Color",
199
+ initial_value: "rgba(46,46,46,1)",
200
+ },
201
+ {
202
+ type: "number_input",
203
+ key: `${prefix}_style_action_background_default_borderRadius`,
204
+ label: "Action Corner Radius",
205
+ initial_value: 12,
206
+ },
207
+ {
208
+ type: "number_input",
209
+ key: `${prefix}_style_action_background_default_paddingTop`,
210
+ label: "Action Padding Top",
211
+ initial_value: 14,
212
+ },
213
+ {
214
+ type: "number_input",
215
+ key: `${prefix}_style_action_background_default_paddingBottom`,
216
+ label: "Action Padding Bottom",
217
+ initial_value: 14,
218
+ },
219
+ {
220
+ type: "color_picker_rgba",
221
+ key: `${prefix}_style_action_title_default_fontColor`,
222
+ label: "Action Title Color",
223
+ initial_value: "#EFEFEF",
224
+ },
225
+ {
226
+ type: "number_input",
227
+ key: `${prefix}_style_action_title_default_fontSize`,
228
+ label: "Action Title Font Size",
229
+ initial_value: 14,
230
+ },
231
+ {
232
+ type: "uploader",
233
+ key: `${prefix}_style_action_trailing_icon_chevron_asset`,
234
+ label: "Action Chevron Asset",
235
+ },
236
+ ],
237
+ },
238
+ {
239
+ group: true,
240
+ label: "Button Styles",
241
+ folded: true,
242
+ fields: [
243
+ {
244
+ type: "color_picker_rgba",
245
+ key: `${prefix}_style_button_background_default_backgroundColor`,
246
+ label: "Button Background Color",
247
+ initial_value: "#FFFFFF",
248
+ },
249
+ {
250
+ type: "color_picker_rgba",
251
+ key: `${prefix}_style_button_background_focus_backgroundColor`,
252
+ label: "Button Focus Color",
253
+ initial_value: "#E0E0E0",
254
+ },
255
+ {
256
+ type: "color_picker_rgba",
257
+ key: `${prefix}_style_button_background_inactive_backgroundColor`,
258
+ label: "Button Inactive Color",
259
+ initial_value: "#999999",
260
+ },
261
+ {
262
+ type: "number_input",
263
+ key: `${prefix}_style_button_background_default_borderRadius`,
264
+ label: "Button Corner Radius",
265
+ initial_value: 12,
266
+ },
267
+ {
268
+ type: "color_picker_rgba",
269
+ key: `${prefix}_style_button_title_default_fontColor`,
270
+ label: "Button Title Color",
271
+ initial_value: "#000000",
272
+ },
273
+ {
274
+ type: "number_input",
275
+ key: `${prefix}_style_button_title_default_fontSize`,
276
+ label: "Button Title Font Size",
277
+ initial_value: 15,
278
+ },
279
+ ],
280
+ },
281
+ ];
282
+ }
283
+
284
+ function getModalLocalizations({ prefix }) {
285
+ return [
286
+ {
287
+ type: "text_input",
288
+ label: "Queue Header Title",
289
+ key: `${prefix}_header_title`,
290
+ initial_value: "Queue",
291
+ },
292
+ {
293
+ type: "text_input",
294
+ label: "Go To Queue Action Label",
295
+ key: `${prefix}_label_go_to_queue`,
296
+ initial_value: "Go To Queue",
297
+ },
298
+ ];
299
+ }
300
+
301
+ module.exports = {
302
+ getModalBlockStyles,
303
+ getModalLocalizations,
304
+ };
@@ -4,6 +4,7 @@ function platformIsTV(platform) {
4
4
  "android_tv_for_quickbrick",
5
5
  "amazon_fire_tv_for_quickbrick",
6
6
  "lg_tv",
7
+ "vidaa",
7
8
  "samsung_tv",
8
9
  "web",
9
10
  "vizio",