@player-ui/reference-assets-plugin 0.3.1-next.1 → 0.3.1

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/dist/index.cjs.js CHANGED
@@ -4,28 +4,28 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var assetTransformPlugin = require('@player-ui/asset-transform-plugin');
6
6
 
7
- var __defProp$1 = Object.defineProperty;
8
- var __defProps$1 = Object.defineProperties;
9
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
10
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
11
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
12
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
13
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
- var __spreadValues$1 = (a, b) => {
7
+ var __defProp$3 = Object.defineProperty;
8
+ var __defProps$3 = Object.defineProperties;
9
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
10
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
11
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
12
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
13
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
+ var __spreadValues$3 = (a, b) => {
15
15
  for (var prop in b || (b = {}))
16
- if (__hasOwnProp$1.call(b, prop))
17
- __defNormalProp$1(a, prop, b[prop]);
18
- if (__getOwnPropSymbols$1)
19
- for (var prop of __getOwnPropSymbols$1(b)) {
20
- if (__propIsEnum$1.call(b, prop))
21
- __defNormalProp$1(a, prop, b[prop]);
16
+ if (__hasOwnProp$3.call(b, prop))
17
+ __defNormalProp$3(a, prop, b[prop]);
18
+ if (__getOwnPropSymbols$3)
19
+ for (var prop of __getOwnPropSymbols$3(b)) {
20
+ if (__propIsEnum$3.call(b, prop))
21
+ __defNormalProp$3(a, prop, b[prop]);
22
22
  }
23
23
  return a;
24
24
  };
25
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
25
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
26
26
  const inputTransform = (asset, options) => {
27
27
  var _a, _b;
28
- return __spreadProps$1(__spreadValues$1({}, asset), {
28
+ return __spreadProps$3(__spreadValues$3({}, asset), {
29
29
  format(val) {
30
30
  if (asset.binding === void 0) {
31
31
  return val;
@@ -49,30 +49,30 @@ const inputTransform = (asset, options) => {
49
49
  });
50
50
  };
51
51
 
52
- var __defProp = Object.defineProperty;
53
- var __defProps = Object.defineProperties;
54
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
55
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
56
- var __hasOwnProp = Object.prototype.hasOwnProperty;
57
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
58
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
59
- var __spreadValues = (a, b) => {
52
+ var __defProp$2 = Object.defineProperty;
53
+ var __defProps$2 = Object.defineProperties;
54
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
55
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
56
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
57
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
58
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
59
+ var __spreadValues$2 = (a, b) => {
60
60
  for (var prop in b || (b = {}))
61
- if (__hasOwnProp.call(b, prop))
62
- __defNormalProp(a, prop, b[prop]);
63
- if (__getOwnPropSymbols)
64
- for (var prop of __getOwnPropSymbols(b)) {
65
- if (__propIsEnum.call(b, prop))
66
- __defNormalProp(a, prop, b[prop]);
61
+ if (__hasOwnProp$2.call(b, prop))
62
+ __defNormalProp$2(a, prop, b[prop]);
63
+ if (__getOwnPropSymbols$2)
64
+ for (var prop of __getOwnPropSymbols$2(b)) {
65
+ if (__propIsEnum$2.call(b, prop))
66
+ __defNormalProp$2(a, prop, b[prop]);
67
67
  }
68
68
  return a;
69
69
  };
70
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
70
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
71
71
  function isBackAction(action) {
72
72
  return action.value === "Prev";
73
73
  }
74
74
  const transform = (action, options) => {
75
- return __spreadProps(__spreadValues({}, action), {
75
+ return __spreadProps$2(__spreadValues$2({}, action), {
76
76
  run() {
77
77
  var _a, _b;
78
78
  if (action.exp) {
@@ -85,15 +85,26 @@ const transform = (action, options) => {
85
85
  }
86
86
  });
87
87
  };
88
+ const backIconTransform = (action) => {
89
+ var _a;
90
+ if (isBackAction(action) && ((_a = action == null ? void 0 : action.metaData) == null ? void 0 : _a.role) === void 0) {
91
+ return __spreadProps$2(__spreadValues$2({}, action), {
92
+ metaData: __spreadProps$2(__spreadValues$2({}, action == null ? void 0 : action.metaData), {
93
+ role: "back"
94
+ })
95
+ });
96
+ }
97
+ return action;
98
+ };
88
99
  const expPropTransform = (asset) => {
89
100
  var _a, _b, _c, _d, _e, _f;
90
101
  const skipArray = (_b = (_a = asset.plugins) == null ? void 0 : _a.stringResolver) == null ? void 0 : _b.propertiesToSkip;
91
102
  if (skipArray && skipArray.indexOf("exp") > 1) {
92
103
  return asset;
93
104
  }
94
- return __spreadProps(__spreadValues({}, asset), {
95
- plugins: __spreadProps(__spreadValues({}, asset.plugins), {
96
- stringResolver: __spreadProps(__spreadValues({}, (_c = asset == null ? void 0 : asset.plugins) == null ? void 0 : _c.stringResolver), {
105
+ return __spreadProps$2(__spreadValues$2({}, asset), {
106
+ plugins: __spreadProps$2(__spreadValues$2({}, asset.plugins), {
107
+ stringResolver: __spreadProps$2(__spreadValues$2({}, (_c = asset == null ? void 0 : asset.plugins) == null ? void 0 : _c.stringResolver), {
97
108
  propertiesToSkip: [
98
109
  ...(_f = (_e = (_d = asset.plugins) == null ? void 0 : _d.stringResolver) == null ? void 0 : _e.propertiesToSkip) != null ? _f : [],
99
110
  "exp"
@@ -102,7 +113,72 @@ const expPropTransform = (asset) => {
102
113
  })
103
114
  });
104
115
  };
105
- const actionTransform = assetTransformPlugin.compose(transform, assetTransformPlugin.composeBefore(expPropTransform));
116
+ const actionTransform = assetTransformPlugin.compose(transform, backIconTransform, assetTransformPlugin.composeBefore(expPropTransform));
117
+
118
+ var __defProp$1 = Object.defineProperty;
119
+ var __defProps$1 = Object.defineProperties;
120
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
121
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
122
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
123
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
124
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
125
+ var __spreadValues$1 = (a, b) => {
126
+ for (var prop in b || (b = {}))
127
+ if (__hasOwnProp$1.call(b, prop))
128
+ __defNormalProp$1(a, prop, b[prop]);
129
+ if (__getOwnPropSymbols$1)
130
+ for (var prop of __getOwnPropSymbols$1(b)) {
131
+ if (__propIsEnum$1.call(b, prop))
132
+ __defNormalProp$1(a, prop, b[prop]);
133
+ }
134
+ return a;
135
+ };
136
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
137
+ const infoTransform = (infoAsset) => {
138
+ const actions = infoAsset == null ? void 0 : infoAsset.actions;
139
+ const segmentedActions = actions == null ? void 0 : actions.reduce((segmentedActionsArray, action) => {
140
+ segmentedActionsArray[isBackAction(action.asset) ? "prev" : "next"].push(action);
141
+ return segmentedActionsArray;
142
+ }, { next: [], prev: [] });
143
+ return __spreadProps$1(__spreadValues$1({}, infoAsset), {
144
+ segmentedActions
145
+ });
146
+ };
147
+
148
+ var __defProp = Object.defineProperty;
149
+ var __defProps = Object.defineProperties;
150
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
151
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
152
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
153
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
154
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
155
+ var __spreadValues = (a, b) => {
156
+ for (var prop in b || (b = {}))
157
+ if (__hasOwnProp.call(b, prop))
158
+ __defNormalProp(a, prop, b[prop]);
159
+ if (__getOwnPropSymbols)
160
+ for (var prop of __getOwnPropSymbols(b)) {
161
+ if (__propIsEnum.call(b, prop))
162
+ __defNormalProp(a, prop, b[prop]);
163
+ }
164
+ return a;
165
+ };
166
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
167
+ const getImageAlt = (props) => {
168
+ const { metaData, placeholder } = props;
169
+ if (metaData.accessibility)
170
+ return metaData.accessibility;
171
+ if (placeholder)
172
+ return placeholder;
173
+ return "Image";
174
+ };
175
+ const imageTransform = (props) => {
176
+ const altText = getImageAlt(props);
177
+ const newImage = __spreadProps(__spreadValues({}, props), {
178
+ altText
179
+ });
180
+ return newImage;
181
+ };
106
182
 
107
183
  class ReferenceAssetsPlugin {
108
184
  constructor() {
@@ -111,7 +187,9 @@ class ReferenceAssetsPlugin {
111
187
  apply(player) {
112
188
  player.registerPlugin(new assetTransformPlugin.AssetTransformPlugin([
113
189
  [{ type: "action" }, actionTransform],
114
- [{ type: "input" }, inputTransform]
190
+ [{ type: "input" }, inputTransform],
191
+ [{ type: "image" }, imageTransform],
192
+ [{ type: "info" }, infoTransform]
115
193
  ]));
116
194
  }
117
195
  }
@@ -119,6 +197,8 @@ class ReferenceAssetsPlugin {
119
197
  exports.ReferenceAssetsPlugin = ReferenceAssetsPlugin;
120
198
  exports.actionTransform = actionTransform;
121
199
  exports.expPropTransform = expPropTransform;
200
+ exports.imageTransform = imageTransform;
201
+ exports.infoTransform = infoTransform;
122
202
  exports.inputTransform = inputTransform;
123
203
  exports.isBackAction = isBackAction;
124
204
  //# sourceMappingURL=index.cjs.js.map
package/dist/index.d.ts CHANGED
@@ -58,6 +58,8 @@ interface ActionAsset<AnyTextAsset extends Asset = Asset> extends Asset<'action'
58
58
  beacon?: BeaconDataType;
59
59
  /** Force transition to the next view without checking for validation */
60
60
  skipValidation?: boolean;
61
+ /** string value to decide for the left anchor sign */
62
+ role?: string;
61
63
  };
62
64
  }
63
65
  /** A stateful instance of an action */
@@ -66,6 +68,9 @@ interface TransformedAction extends ActionAsset {
66
68
  run: () => void;
67
69
  }
68
70
 
71
+ /**
72
+ * Function to find prev button
73
+ */
69
74
  declare function isBackAction(action: ActionAsset): boolean;
70
75
  /**
71
76
  * Appends `exp` to the plugins.stringResolver.propertiesToSkip array or creates it if it doesn't exist
@@ -92,6 +97,27 @@ interface InfoAsset extends Asset<'info'> {
92
97
  /** List of actions to show at the bottom of the page */
93
98
  actions?: Array<AssetWrapper>;
94
99
  }
100
+ interface InfoAssetTransform extends InfoAsset {
101
+ /**
102
+ * This is an array of next and prev actions
103
+ */
104
+ segmentedActions?: {
105
+ /**
106
+ * Array of next actions
107
+ */
108
+ next: Array<AssetWrapper<ActionAsset>>;
109
+ /**
110
+ * Array of prev actions
111
+ */
112
+ prev: Array<AssetWrapper<ActionAsset>>;
113
+ };
114
+ }
115
+
116
+ /**
117
+ * This transform should add segmentedActions to the info asset.
118
+ * Segmented actions display side by side in larger viewports. Segmented Actions is an object of next and prev actions
119
+ */
120
+ declare const infoTransform: TransformFunction<InfoAsset, InfoAssetTransform>;
95
121
 
96
122
  interface TextAsset extends Asset<'text'> {
97
123
  /** The text to display */
@@ -123,6 +149,31 @@ interface LinkModifier {
123
149
  };
124
150
  }
125
151
 
152
+ interface ImageAsset extends Asset<'image'> {
153
+ /** Reference to the image */
154
+ metaData: ImageMetaData;
155
+ /** Optional placeholder text */
156
+ placeholder?: string;
157
+ /** Optional caption */
158
+ caption?: Asset;
159
+ }
160
+ /** A modifier to turn the text into a link */
161
+ interface ImageMetaData {
162
+ /** The location of the image to load */
163
+ ref: string;
164
+ /** Used for accessibility support */
165
+ accessibility?: string;
166
+ }
167
+ interface TransformedImage extends ImageAsset {
168
+ /** Alt text */
169
+ altText: string;
170
+ }
171
+
172
+ /**
173
+ * Sets the Image's placeholder and accessibilty
174
+ */
175
+ declare const imageTransform: TransformFunction<ImageAsset, TransformedImage>;
176
+
126
177
  /**
127
178
  * A plugin to add transforms for the reference assets
128
179
  */
@@ -131,4 +182,4 @@ declare class ReferenceAssetsPlugin implements PlayerPlugin {
131
182
  apply(player: Player): void;
132
183
  }
133
184
 
134
- export { ActionAsset, BasicTextModifier, CollectionAsset, InfoAsset, InputAsset, LinkModifier, ReferenceAssetsPlugin, TextAsset, TextModifier, TransformedAction, TransformedInput, actionTransform, expPropTransform, inputTransform, isBackAction };
185
+ export { ActionAsset, BasicTextModifier, CollectionAsset, ImageAsset, ImageMetaData, InfoAsset, InfoAssetTransform, InputAsset, LinkModifier, ReferenceAssetsPlugin, TextAsset, TextModifier, TransformedAction, TransformedImage, TransformedInput, actionTransform, expPropTransform, imageTransform, infoTransform, inputTransform, isBackAction };
package/dist/index.esm.js CHANGED
@@ -1,27 +1,27 @@
1
1
  import { compose, composeBefore, AssetTransformPlugin } from '@player-ui/asset-transform-plugin';
2
2
 
3
- var __defProp$1 = Object.defineProperty;
4
- var __defProps$1 = Object.defineProperties;
5
- var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
7
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
8
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues$1 = (a, b) => {
3
+ var __defProp$3 = Object.defineProperty;
4
+ var __defProps$3 = Object.defineProperties;
5
+ var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
7
+ var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues$3 = (a, b) => {
11
11
  for (var prop in b || (b = {}))
12
- if (__hasOwnProp$1.call(b, prop))
13
- __defNormalProp$1(a, prop, b[prop]);
14
- if (__getOwnPropSymbols$1)
15
- for (var prop of __getOwnPropSymbols$1(b)) {
16
- if (__propIsEnum$1.call(b, prop))
17
- __defNormalProp$1(a, prop, b[prop]);
12
+ if (__hasOwnProp$3.call(b, prop))
13
+ __defNormalProp$3(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols$3)
15
+ for (var prop of __getOwnPropSymbols$3(b)) {
16
+ if (__propIsEnum$3.call(b, prop))
17
+ __defNormalProp$3(a, prop, b[prop]);
18
18
  }
19
19
  return a;
20
20
  };
21
- var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
21
+ var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
22
22
  const inputTransform = (asset, options) => {
23
23
  var _a, _b;
24
- return __spreadProps$1(__spreadValues$1({}, asset), {
24
+ return __spreadProps$3(__spreadValues$3({}, asset), {
25
25
  format(val) {
26
26
  if (asset.binding === void 0) {
27
27
  return val;
@@ -45,30 +45,30 @@ const inputTransform = (asset, options) => {
45
45
  });
46
46
  };
47
47
 
48
- var __defProp = Object.defineProperty;
49
- var __defProps = Object.defineProperties;
50
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
51
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
52
- var __hasOwnProp = Object.prototype.hasOwnProperty;
53
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
54
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
55
- var __spreadValues = (a, b) => {
48
+ var __defProp$2 = Object.defineProperty;
49
+ var __defProps$2 = Object.defineProperties;
50
+ var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
51
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
52
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
53
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
54
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
55
+ var __spreadValues$2 = (a, b) => {
56
56
  for (var prop in b || (b = {}))
57
- if (__hasOwnProp.call(b, prop))
58
- __defNormalProp(a, prop, b[prop]);
59
- if (__getOwnPropSymbols)
60
- for (var prop of __getOwnPropSymbols(b)) {
61
- if (__propIsEnum.call(b, prop))
62
- __defNormalProp(a, prop, b[prop]);
57
+ if (__hasOwnProp$2.call(b, prop))
58
+ __defNormalProp$2(a, prop, b[prop]);
59
+ if (__getOwnPropSymbols$2)
60
+ for (var prop of __getOwnPropSymbols$2(b)) {
61
+ if (__propIsEnum$2.call(b, prop))
62
+ __defNormalProp$2(a, prop, b[prop]);
63
63
  }
64
64
  return a;
65
65
  };
66
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
66
+ var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
67
67
  function isBackAction(action) {
68
68
  return action.value === "Prev";
69
69
  }
70
70
  const transform = (action, options) => {
71
- return __spreadProps(__spreadValues({}, action), {
71
+ return __spreadProps$2(__spreadValues$2({}, action), {
72
72
  run() {
73
73
  var _a, _b;
74
74
  if (action.exp) {
@@ -81,15 +81,26 @@ const transform = (action, options) => {
81
81
  }
82
82
  });
83
83
  };
84
+ const backIconTransform = (action) => {
85
+ var _a;
86
+ if (isBackAction(action) && ((_a = action == null ? void 0 : action.metaData) == null ? void 0 : _a.role) === void 0) {
87
+ return __spreadProps$2(__spreadValues$2({}, action), {
88
+ metaData: __spreadProps$2(__spreadValues$2({}, action == null ? void 0 : action.metaData), {
89
+ role: "back"
90
+ })
91
+ });
92
+ }
93
+ return action;
94
+ };
84
95
  const expPropTransform = (asset) => {
85
96
  var _a, _b, _c, _d, _e, _f;
86
97
  const skipArray = (_b = (_a = asset.plugins) == null ? void 0 : _a.stringResolver) == null ? void 0 : _b.propertiesToSkip;
87
98
  if (skipArray && skipArray.indexOf("exp") > 1) {
88
99
  return asset;
89
100
  }
90
- return __spreadProps(__spreadValues({}, asset), {
91
- plugins: __spreadProps(__spreadValues({}, asset.plugins), {
92
- stringResolver: __spreadProps(__spreadValues({}, (_c = asset == null ? void 0 : asset.plugins) == null ? void 0 : _c.stringResolver), {
101
+ return __spreadProps$2(__spreadValues$2({}, asset), {
102
+ plugins: __spreadProps$2(__spreadValues$2({}, asset.plugins), {
103
+ stringResolver: __spreadProps$2(__spreadValues$2({}, (_c = asset == null ? void 0 : asset.plugins) == null ? void 0 : _c.stringResolver), {
93
104
  propertiesToSkip: [
94
105
  ...(_f = (_e = (_d = asset.plugins) == null ? void 0 : _d.stringResolver) == null ? void 0 : _e.propertiesToSkip) != null ? _f : [],
95
106
  "exp"
@@ -98,7 +109,72 @@ const expPropTransform = (asset) => {
98
109
  })
99
110
  });
100
111
  };
101
- const actionTransform = compose(transform, composeBefore(expPropTransform));
112
+ const actionTransform = compose(transform, backIconTransform, composeBefore(expPropTransform));
113
+
114
+ var __defProp$1 = Object.defineProperty;
115
+ var __defProps$1 = Object.defineProperties;
116
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
117
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
118
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
119
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
120
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
121
+ var __spreadValues$1 = (a, b) => {
122
+ for (var prop in b || (b = {}))
123
+ if (__hasOwnProp$1.call(b, prop))
124
+ __defNormalProp$1(a, prop, b[prop]);
125
+ if (__getOwnPropSymbols$1)
126
+ for (var prop of __getOwnPropSymbols$1(b)) {
127
+ if (__propIsEnum$1.call(b, prop))
128
+ __defNormalProp$1(a, prop, b[prop]);
129
+ }
130
+ return a;
131
+ };
132
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
133
+ const infoTransform = (infoAsset) => {
134
+ const actions = infoAsset == null ? void 0 : infoAsset.actions;
135
+ const segmentedActions = actions == null ? void 0 : actions.reduce((segmentedActionsArray, action) => {
136
+ segmentedActionsArray[isBackAction(action.asset) ? "prev" : "next"].push(action);
137
+ return segmentedActionsArray;
138
+ }, { next: [], prev: [] });
139
+ return __spreadProps$1(__spreadValues$1({}, infoAsset), {
140
+ segmentedActions
141
+ });
142
+ };
143
+
144
+ var __defProp = Object.defineProperty;
145
+ var __defProps = Object.defineProperties;
146
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
147
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
148
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
149
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
150
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
151
+ var __spreadValues = (a, b) => {
152
+ for (var prop in b || (b = {}))
153
+ if (__hasOwnProp.call(b, prop))
154
+ __defNormalProp(a, prop, b[prop]);
155
+ if (__getOwnPropSymbols)
156
+ for (var prop of __getOwnPropSymbols(b)) {
157
+ if (__propIsEnum.call(b, prop))
158
+ __defNormalProp(a, prop, b[prop]);
159
+ }
160
+ return a;
161
+ };
162
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
163
+ const getImageAlt = (props) => {
164
+ const { metaData, placeholder } = props;
165
+ if (metaData.accessibility)
166
+ return metaData.accessibility;
167
+ if (placeholder)
168
+ return placeholder;
169
+ return "Image";
170
+ };
171
+ const imageTransform = (props) => {
172
+ const altText = getImageAlt(props);
173
+ const newImage = __spreadProps(__spreadValues({}, props), {
174
+ altText
175
+ });
176
+ return newImage;
177
+ };
102
178
 
103
179
  class ReferenceAssetsPlugin {
104
180
  constructor() {
@@ -107,10 +183,12 @@ class ReferenceAssetsPlugin {
107
183
  apply(player) {
108
184
  player.registerPlugin(new AssetTransformPlugin([
109
185
  [{ type: "action" }, actionTransform],
110
- [{ type: "input" }, inputTransform]
186
+ [{ type: "input" }, inputTransform],
187
+ [{ type: "image" }, imageTransform],
188
+ [{ type: "info" }, infoTransform]
111
189
  ]));
112
190
  }
113
191
  }
114
192
 
115
- export { ReferenceAssetsPlugin, actionTransform, expPropTransform, inputTransform, isBackAction };
193
+ export { ReferenceAssetsPlugin, actionTransform, expPropTransform, imageTransform, infoTransform, inputTransform, isBackAction };
116
194
  //# sourceMappingURL=index.esm.js.map