@wise/dynamic-flow-client 5.6.1 → 5.7.0

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/build/main.mjs CHANGED
@@ -386,7 +386,7 @@ var ja_default = {
386
386
  "dynamicFlows.FileUploadSchema.maxFileSizeError": "\u5927\u5909\u7533\u3057\u8A33\u3054\u3056\u3044\u307E\u305B\u3093\u304C\u3001\u30D5\u30A1\u30A4\u30EB\u304C\u5927\u304D\u3059\u304E\u307E\u3059\u3002\u3053\u308C\u3088\u308A\u5C0F\u3055\u3044\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
387
387
  "dynamicFlows.FileUploadSchema.wrongFileTypeError": "\u305D\u306E\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u5225\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
388
388
  "dynamicFlows.Help.ariaLabel": "\u8A73\u7D30\u306F\u3053\u3061\u3089\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
389
- "dynamicFlows.MultiSelect.summary": "{first}\u3068\u305D\u306E\u4ED6{count}",
389
+ "dynamicFlows.MultiSelect.summary": "{first}\u3068\u305D\u306E\u4ED6{count}\u30AA\u30D7\u30B7\u30E7\u30F3",
390
390
  "dynamicFlows.MultipleFileUploadSchema.maxFileSizeError": "\u5927\u5909\u7533\u3057\u8A33\u3054\u3056\u3044\u307E\u305B\u3093\u304C\u3001\u30D5\u30A1\u30A4\u30EB\u304C\u5927\u304D\u3059\u304E\u307E\u3059\u3002\u3053\u308C\u3088\u308A\u5C0F\u3055\u3044\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
391
391
  "dynamicFlows.MultipleFileUploadSchema.maxItemsError": "{maxItems}\u500B\u4EE5\u4E0B\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
392
392
  "dynamicFlows.MultipleFileUploadSchema.minItemsError": "{minItems}\u500B\u4EE5\u4E0A\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
@@ -811,6 +811,7 @@ var getChildren = (node) => {
811
811
  case "list":
812
812
  case "loading-indicator":
813
813
  case "markdown":
814
+ case "media":
814
815
  case "input-multi-select":
815
816
  case "input-upload-multi":
816
817
  case "input-number":
@@ -824,6 +825,7 @@ var getChildren = (node) => {
824
825
  case "input-upload":
825
826
  case "external-confirmation":
826
827
  case "subflow":
828
+ case "upsell":
827
829
  return [];
828
830
  }
829
831
  };
@@ -1104,6 +1106,55 @@ var createSubflowDomainComponent = (subflowProps, onComponentUpdate) => {
1104
1106
  return subflowComponent;
1105
1107
  };
1106
1108
 
1109
+ // src/domain/features/prefetch/request-cache.ts
1110
+ var makeRequestCacheWithParent = (parent) => {
1111
+ const map = /* @__PURE__ */ new Map();
1112
+ const cache = {
1113
+ get: (requestParams) => {
1114
+ var _a;
1115
+ const key = makeRequestCacheKey(requestParams);
1116
+ const promise = (_a = map.get(key)) != null ? _a : parent == null ? void 0 : parent.get(requestParams);
1117
+ map.delete(key);
1118
+ return promise;
1119
+ },
1120
+ set: (requestParams, responsePromise) => {
1121
+ return map.set(makeRequestCacheKey(requestParams), responsePromise);
1122
+ }
1123
+ };
1124
+ return cache;
1125
+ };
1126
+ var makeRequestCache = (initialValues = []) => {
1127
+ const cache = makeRequestCacheWithParent(void 0);
1128
+ initialValues.forEach(([requestParams, responsePromise]) => {
1129
+ cache.set(requestParams, responsePromise);
1130
+ });
1131
+ return cache;
1132
+ };
1133
+ var normaliseRequestCache = (cache) => {
1134
+ if (cache === void 0) {
1135
+ return makeRequestCache();
1136
+ }
1137
+ if (isRequestCacheInstance(cache)) {
1138
+ return cache;
1139
+ }
1140
+ return makeRequestCache(cache);
1141
+ };
1142
+ var isRequestCacheInstance = (cache) => {
1143
+ return !cache || !Array.isArray(cache);
1144
+ };
1145
+ var makeRequestCacheKey = (requestParams) => {
1146
+ var _a, _b;
1147
+ const [input, init] = requestParams;
1148
+ const url = typeof input === "string" || input instanceof URL ? input.toString() : input.url;
1149
+ const key = JSON.stringify({
1150
+ url,
1151
+ method: (_a = init == null ? void 0 : init.method) != null ? _a : "GET",
1152
+ headers: (init == null ? void 0 : init.headers) ? Array.from(new Headers(init.headers).entries()) : [],
1153
+ body: (_b = init == null ? void 0 : init.body) != null ? _b : null
1154
+ });
1155
+ return key;
1156
+ };
1157
+
1107
1158
  // src/domain/components/ModalComponent.ts
1108
1159
  var createModalContentComponent = (modalProps, onComponentUpdate) => {
1109
1160
  const update = getInputUpdateFunction(onComponentUpdate);
@@ -1178,51 +1229,6 @@ var getActionByReference = ($ref, actions = []) => {
1178
1229
  return action;
1179
1230
  };
1180
1231
 
1181
- // src/domain/mappers/utils/call-to-action-utils.ts
1182
- var getDomainLayerCallToAction = (callToAction, mapperProps) => {
1183
- var _a;
1184
- if (!callToAction) {
1185
- return void 0;
1186
- }
1187
- const { step, onBehavior, registerSubmissionBehavior } = mapperProps;
1188
- const stepActions = (_a = step.actions) != null ? _a : [];
1189
- const { title = "", accessibilityDescription, action, behavior } = callToAction;
1190
- return getCallToAction(
1191
- { title, accessibilityDescription },
1192
- getDomainLayerBehavior({ action, behavior }, stepActions, registerSubmissionBehavior),
1193
- onBehavior
1194
- );
1195
- };
1196
- var getCallToAction = ({ title, accessibilityDescription }, behavior, onBehavior) => {
1197
- const onClick = () => {
1198
- void onBehavior(behavior);
1199
- };
1200
- switch (behavior.type) {
1201
- case "action":
1202
- case "modal":
1203
- case "copy":
1204
- case "dismiss": {
1205
- return {
1206
- type: behavior.type,
1207
- title: title != null ? title : "",
1208
- accessibilityDescription,
1209
- onClick
1210
- };
1211
- }
1212
- case "link": {
1213
- return {
1214
- type: "link",
1215
- title: title != null ? title : "",
1216
- href: behavior.url,
1217
- accessibilityDescription,
1218
- onClick
1219
- };
1220
- }
1221
- default:
1222
- return void 0;
1223
- }
1224
- };
1225
-
1226
1232
  // src/domain/mappers/utils/legacy-utils.ts
1227
1233
  var mapLegacyContext = (context) => {
1228
1234
  switch (context) {
@@ -1274,6 +1280,27 @@ var legacyActionTypeToControl = {
1274
1280
  };
1275
1281
  var mapLegacyActionTypeToControl = (type) => type && type in legacyActionTypeToControl ? legacyActionTypeToControl[type] : "secondary";
1276
1282
 
1283
+ // src/domain/mappers/utils/call-to-action-utils.ts
1284
+ function getDomainLayerCallToAction(cta, mapperProps) {
1285
+ var _a, _b;
1286
+ if (!cta) {
1287
+ return void 0;
1288
+ }
1289
+ const { step, onBehavior, registerSubmissionBehavior } = mapperProps;
1290
+ const stepActions = (_a = step.actions) != null ? _a : [];
1291
+ const behavior = getDomainLayerBehavior(cta, stepActions, registerSubmissionBehavior);
1292
+ return {
1293
+ type: behavior.type,
1294
+ title: (_b = cta.title) != null ? _b : "",
1295
+ context: cta.context ? mapLegacyContext(cta.context) : void 0,
1296
+ accessibilityDescription: cta.accessibilityDescription,
1297
+ href: behavior.type === "link" ? behavior.url : void 0,
1298
+ onClick: () => {
1299
+ void onBehavior(behavior);
1300
+ }
1301
+ };
1302
+ }
1303
+
1277
1304
  // src/domain/mappers/layout/alertLayoutToComponent.ts
1278
1305
  var alertLayoutToComponent = (uid, {
1279
1306
  control,
@@ -1822,6 +1849,24 @@ var markdownLayoutToComponent = (uid, {
1822
1849
  size: size != null ? size : "md"
1823
1850
  });
1824
1851
 
1852
+ // src/domain/components/MediaComponent.ts
1853
+ var createMediaComponent = (props) => __spreadValues({
1854
+ type: "media",
1855
+ kind: "layout"
1856
+ }, props);
1857
+
1858
+ // src/domain/mappers/layout/mediaLayoutToComponent.ts
1859
+ var mediaLayoutToComponent = (uid, { analyticsId, align, control, margin, media, size, tags }) => createMediaComponent({
1860
+ uid,
1861
+ analyticsId,
1862
+ align: mapLegacyAlign(align != null ? align : "center"),
1863
+ control,
1864
+ margin: margin != null ? margin : "md",
1865
+ media,
1866
+ size: size != null ? size : "md",
1867
+ tags
1868
+ });
1869
+
1825
1870
  // src/domain/components/ModalLayoutComponent.ts
1826
1871
  var createModalComponent = (modalProps) => __spreadProps(__spreadValues({
1827
1872
  type: "modal-layout",
@@ -1921,14 +1966,14 @@ var reviewLayoutToComponent = (uid, {
1921
1966
  }, mapperProps) => createReviewComponent({
1922
1967
  uid,
1923
1968
  analyticsId,
1924
- callToAction: getCallToAction2({ mapperProps, callToAction, action }),
1969
+ callToAction: getCallToAction({ mapperProps, callToAction, action }),
1925
1970
  control: getOrientationControl({ control, orientation }),
1926
1971
  fields: fields.map((field) => mapReviewField(field, mapperProps)),
1927
1972
  margin: margin != null ? margin : "md",
1928
1973
  tags,
1929
1974
  title
1930
1975
  });
1931
- var getCallToAction2 = ({
1976
+ var getCallToAction = ({
1932
1977
  callToAction,
1933
1978
  action,
1934
1979
  mapperProps
@@ -1966,7 +2011,7 @@ var mapReviewField = (field, mapperProps) => {
1966
2011
  help: (_a = field.help) == null ? void 0 : _a.markdown,
1967
2012
  inlineAlert: mapInlineAlert(field.inlineAlert),
1968
2013
  additionalInfo: mapAdditionalInfo(field.additionalInfo, mapperProps),
1969
- callToAction: getCallToAction2({
2014
+ callToAction: getCallToAction({
1970
2015
  callToAction: field.callToAction,
1971
2016
  mapperProps
1972
2017
  }),
@@ -2013,7 +2058,7 @@ var debounce = (callback, waitMs) => {
2013
2058
  // src/domain/components/searchComponent/SearchComponent.ts
2014
2059
  var DEBOUNCE_TIME = 400;
2015
2060
  var createSearchComponent = (searchProps, performSearch, onBehavior, onComponentUpdate) => {
2016
- const { uid, analyticsId, control, emptyMessage, margin, tags, title } = searchProps;
2061
+ const { uid, analyticsId, control, emptyMessage, hint, margin, tags, title } = searchProps;
2017
2062
  const update = getInputUpdateFunction(onComponentUpdate);
2018
2063
  let abortController = new AbortController();
2019
2064
  const search = (component2, query, searchConfig) => {
@@ -2049,6 +2094,7 @@ var createSearchComponent = (searchProps, performSearch, onBehavior, onComponent
2049
2094
  analyticsId,
2050
2095
  control,
2051
2096
  emptyMessage,
2097
+ hint,
2052
2098
  margin,
2053
2099
  tags,
2054
2100
  title,
@@ -2135,7 +2181,7 @@ var isValidResponseBody = (body) => isObject(body) && "results" in body && isArr
2135
2181
  var hashRequest = (query, config) => JSON.stringify({ query, config });
2136
2182
 
2137
2183
  // src/domain/mappers/layout/searchLayoutToComponent.ts
2138
- var searchLayoutToComponent = (uid, { analyticsId, control, emptyMessage, method, param, title, url, margin, tags }, mapperProps) => {
2184
+ var searchLayoutToComponent = (uid, { analyticsId, control, emptyMessage, hint, method, param, title, url, margin, tags }, mapperProps) => {
2139
2185
  const { httpClient, onBehavior, onComponentUpdate } = mapperProps;
2140
2186
  const search = getPerformSearchFunction(httpClient, { method, param, url });
2141
2187
  return createSearchComponent(
@@ -2144,6 +2190,7 @@ var searchLayoutToComponent = (uid, { analyticsId, control, emptyMessage, method
2144
2190
  analyticsId,
2145
2191
  control,
2146
2192
  emptyMessage: emptyMessage != null ? emptyMessage : "",
2193
+ hint,
2147
2194
  margin: margin != null ? margin : "md",
2148
2195
  tags,
2149
2196
  title
@@ -2223,6 +2270,60 @@ var mapTabs = (tabs, uid, mapperProps, schemaComponents) => tabs.map(({ componen
2223
2270
  )
2224
2271
  }));
2225
2272
 
2273
+ // src/domain/components/UpsellComponent.ts
2274
+ var createUpsellComponent = (upsellProps, onComponentUpdate) => {
2275
+ const update = getInputUpdateFunction(onComponentUpdate);
2276
+ const _a = upsellProps, { onDismiss: propsOnDismiss } = _a, restProps = __objRest(_a, ["onDismiss"]);
2277
+ const component = __spreadProps(__spreadValues({
2278
+ type: "upsell",
2279
+ kind: "layout"
2280
+ }, restProps), {
2281
+ visible: true,
2282
+ onDismiss: propsOnDismiss ? () => {
2283
+ update(component, (draft) => {
2284
+ draft.visible = false;
2285
+ });
2286
+ propsOnDismiss();
2287
+ } : void 0
2288
+ });
2289
+ return component;
2290
+ };
2291
+
2292
+ // src/domain/mappers/layout/upsellLayoutToComponent.ts
2293
+ var upsellLayoutToComponent = (uid, {
2294
+ analyticsId,
2295
+ callToAction,
2296
+ context,
2297
+ control,
2298
+ margin,
2299
+ media,
2300
+ onDismiss,
2301
+ tags,
2302
+ text
2303
+ }, mapperProps) => {
2304
+ const { onComponentUpdate } = mapperProps;
2305
+ return createUpsellComponent(
2306
+ {
2307
+ uid,
2308
+ analyticsId,
2309
+ callToAction: getDomainLayerCallToAction(callToAction, mapperProps),
2310
+ context: context ? mapLegacyContext(context) : "neutral",
2311
+ control,
2312
+ margin: margin != null ? margin : "md",
2313
+ media: getDomainLayerMedia({ media }),
2314
+ tags,
2315
+ text,
2316
+ onDismiss: onDismiss ? () => {
2317
+ const { url, method } = onDismiss;
2318
+ const body = method === "GET" ? void 0 : JSON.stringify(onDismiss.body);
2319
+ void mapperProps.httpClient(url, { method, body }).catch(() => {
2320
+ });
2321
+ } : void 0
2322
+ },
2323
+ onComponentUpdate
2324
+ );
2325
+ };
2326
+
2226
2327
  // src/domain/mappers/mapLayoutToComponent.ts
2227
2328
  var mapLayoutToComponent = (uid, layout, mapperProps, schemaComponents) => {
2228
2329
  switch (layout.type) {
@@ -2254,6 +2355,8 @@ var mapLayoutToComponent = (uid, layout, mapperProps, schemaComponents) => {
2254
2355
  return loadingIndicatorLayoutToComponent(uid, layout);
2255
2356
  case "markdown":
2256
2357
  return markdownLayoutToComponent(uid, layout);
2358
+ case "media":
2359
+ return mediaLayoutToComponent(uid, layout);
2257
2360
  case "modal":
2258
2361
  return modalLayoutToComponent(uid, layout, mapperProps, schemaComponents);
2259
2362
  case "paragraph":
@@ -2270,6 +2373,8 @@ var mapLayoutToComponent = (uid, layout, mapperProps, schemaComponents) => {
2270
2373
  return statusListLayoutToComponent(uid, layout, mapperProps);
2271
2374
  case "tabs":
2272
2375
  return tabsLayoutToComponent(uid, layout, mapperProps, schemaComponents);
2376
+ case "upsell":
2377
+ return upsellLayoutToComponent(uid, layout, mapperProps);
2273
2378
  default:
2274
2379
  throw new Error(`Invalid layout type in ${JSON.stringify(layout)}`);
2275
2380
  }
@@ -5377,6 +5482,7 @@ var mapStringSchemaSuggestions = (suggestions, logEvent) => {
5377
5482
 
5378
5483
  // src/domain/mappers/schema/stringSchemaToComponent/stringSchemaToDateInputComponent.ts
5379
5484
  var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
5485
+ var _a;
5380
5486
  const { schema, localValue, model, required = false, onPersistAsync } = schemaMapperProps;
5381
5487
  const {
5382
5488
  autocompleteHint,
@@ -5392,7 +5498,7 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
5392
5498
  mapperProps
5393
5499
  );
5394
5500
  const validLocalValue = isString(localValue) ? localValue : null;
5395
- const validModel = isString(model) ? model : defaultValue != null ? defaultValue : null;
5501
+ const validModel = (_a = getValidDate(model)) != null ? _a : getValidDate(defaultValue != null ? defaultValue : null);
5396
5502
  const value = onPersistAsync ? validLocalValue : validModel;
5397
5503
  return createDateInputComponent(
5398
5504
  __spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
@@ -5415,6 +5521,21 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
5415
5521
  onComponentUpdate
5416
5522
  );
5417
5523
  };
5524
+ var getValidDate = (model) => {
5525
+ if (!isString(model)) {
5526
+ return null;
5527
+ }
5528
+ if (/^\d{4}-\d{2}$/.test(model)) {
5529
+ return model;
5530
+ }
5531
+ try {
5532
+ const date = new Date(model);
5533
+ const stringDate = date.toISOString();
5534
+ return stringDate.split("T")[0];
5535
+ } catch (e) {
5536
+ return null;
5537
+ }
5538
+ };
5418
5539
 
5419
5540
  // src/domain/mappers/schema/stringSchemaToComponent/stringSchemaToUploadInputComponent.ts
5420
5541
  var stringSchemaToUploadInputComponent = (schemaMapperProps, mapperProps) => {
@@ -5985,59 +6106,14 @@ var createRequestFromAction = (action, model) => {
5985
6106
  });
5986
6107
  };
5987
6108
 
5988
- // src/domain/features/prefetch/request-cache.ts
5989
- var makeRequestCacheWithParent = (parent) => {
5990
- const map = /* @__PURE__ */ new Map();
5991
- const cache = {
5992
- get: (requestParams) => {
5993
- var _a;
5994
- const key = makeKey(requestParams);
5995
- const promise = (_a = map.get(key)) != null ? _a : parent == null ? void 0 : parent.get(requestParams);
5996
- map.delete(key);
5997
- return promise;
5998
- },
5999
- set: (requestParams, responsePromise) => {
6000
- return map.set(makeKey(requestParams), responsePromise);
6001
- }
6002
- };
6003
- return cache;
6004
- };
6005
- var makeRequestCache = (initialValues = []) => {
6006
- const cache = makeRequestCacheWithParent(void 0);
6007
- initialValues.forEach(([requestParams, responsePromise]) => {
6008
- cache.set(requestParams, responsePromise);
6009
- });
6010
- return cache;
6011
- };
6012
- var normaliseRequestCache = (cache) => {
6013
- if (cache === void 0) {
6014
- return makeRequestCache();
6015
- }
6016
- if (isRequestCacheInstance(cache)) {
6017
- return cache;
6018
- }
6019
- return makeRequestCache(cache);
6020
- };
6021
- var isRequestCacheInstance = (cache) => {
6022
- return !cache || !Array.isArray(cache);
6023
- };
6024
- var makeKey = (requestParams) => {
6025
- var _a, _b;
6026
- const [input, init] = requestParams;
6027
- const url = typeof input === "string" || input instanceof URL ? input.toString() : input.url;
6028
- const key = JSON.stringify({
6029
- url,
6030
- method: (_a = init == null ? void 0 : init.method) != null ? _a : "GET",
6031
- headers: (init == null ? void 0 : init.headers) ? Array.from(new Headers(init.headers).entries()) : [],
6032
- body: (_b = init == null ? void 0 : init.body) != null ? _b : null
6033
- });
6034
- return key;
6035
- };
6036
-
6037
6109
  // src/domain/features/prefetch/getStepPrefetch.ts
6038
6110
  var getStepPrefetch = (httpClient, flowRequestCache, submissionBehaviors) => {
6039
6111
  const requestCache = makeRequestCacheWithParent(flowRequestCache);
6112
+ const keys = /* @__PURE__ */ new Set();
6040
6113
  const start = (model) => {
6114
+ if (keys.size > 0) {
6115
+ return;
6116
+ }
6041
6117
  submissionBehaviors.forEach((behavior) => {
6042
6118
  const request = behavior.type === "action" ? createRequestFromAction(behavior.action, model) : behavior.launchConfig.request;
6043
6119
  const requestParams = [
@@ -6049,8 +6125,13 @@ var getStepPrefetch = (httpClient, flowRequestCache, submissionBehaviors) => {
6049
6125
  }
6050
6126
  ];
6051
6127
  try {
6128
+ const key = makeRequestCacheKey(requestParams);
6129
+ if (keys.has(key)) {
6130
+ return;
6131
+ }
6052
6132
  const responsePromise = httpClient(...requestParams).catch(() => null);
6053
6133
  requestCache.set(requestParams, responsePromise);
6134
+ keys.add(key);
6054
6135
  } catch (e) {
6055
6136
  }
6056
6137
  });
@@ -6795,7 +6876,11 @@ var createFlowController = (props) => {
6795
6876
  initState = "created";
6796
6877
  trackEvent("Initiated");
6797
6878
  rootComponent.setLoadingState("submitting");
6798
- void onAction(__spreadValues({ method: "GET" }, initialAction), null);
6879
+ void onAction(__spreadValues({ method: "GET" }, initialAction), null).then(() => {
6880
+ initState = "started";
6881
+ rootComponent.start();
6882
+ });
6883
+ return;
6799
6884
  }
6800
6885
  if (initState === "created") {
6801
6886
  initState = "started";
@@ -7442,6 +7527,9 @@ var markdownComponentToProps = (control, rendererMapperProps) => __spreadValues(
7442
7527
  "size"
7443
7528
  )), rendererMapperProps);
7444
7529
 
7530
+ // src/renderers/mappers/mediaComponentToProps.ts
7531
+ var mediaComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "align", "control", "margin", "media", "size", "tags")), rendererMapperProps);
7532
+
7445
7533
  // src/renderers/mappers/modalComponentToProps.ts
7446
7534
  var modalComponentToProps = (component, rendererMapperProps) => {
7447
7535
  const { uid, analyticsId, open, tags, title, close } = component;
@@ -7787,7 +7875,19 @@ var rootComponentToProps = (rootComponent, rendererMapperProps) => {
7787
7875
 
7788
7876
  // src/renderers/mappers/searchComponentToProps.ts
7789
7877
  var searchComponentToProps = (component, rendererMapperProps) => {
7790
- const { uid, control, emptyMessage, error, isLoading, margin, query, results, title, tags } = component;
7878
+ const {
7879
+ uid,
7880
+ control,
7881
+ emptyMessage,
7882
+ error,
7883
+ hint,
7884
+ isLoading,
7885
+ margin,
7886
+ query,
7887
+ results,
7888
+ title,
7889
+ tags
7890
+ } = component;
7791
7891
  const onChange = component.onChange.bind(component);
7792
7892
  const onSelect = component.onSelect.bind(component);
7793
7893
  const state = getSearchState({
@@ -7804,6 +7904,7 @@ var searchComponentToProps = (component, rendererMapperProps) => {
7804
7904
  type: "search",
7805
7905
  id: uid,
7806
7906
  control,
7907
+ hint,
7807
7908
  isLoading,
7808
7909
  margin,
7809
7910
  query,
@@ -7948,6 +8049,23 @@ var uploadInputComponentToProps = (component, rendererMapperProps) => {
7948
8049
  });
7949
8050
  };
7950
8051
 
8052
+ // src/renderers/mappers/upsellComponentToProps.ts
8053
+ var upsellComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(
8054
+ component,
8055
+ "uid",
8056
+ "analyticsId",
8057
+ "type",
8058
+ "callToAction",
8059
+ "context",
8060
+ "control",
8061
+ "margin",
8062
+ "media",
8063
+ "tags",
8064
+ "text"
8065
+ )), {
8066
+ onDismiss: component.onDismiss ? component.onDismiss.bind(component) : void 0
8067
+ }), rendererMapperProps);
8068
+
7951
8069
  // src/renderers/mappers/subflowComponentToRendererProps.ts
7952
8070
  var subflowComponentToRendererProps = (component, rendererMapperProps) => {
7953
8071
  return __spreadValues(__spreadProps(__spreadValues({
@@ -8029,6 +8147,8 @@ var getComponentProps = (component, rendererMapperProps) => {
8029
8147
  return loadingIndicatorComponentToProps(component, rendererMapperProps);
8030
8148
  case "markdown":
8031
8149
  return markdownComponentToProps(component, rendererMapperProps);
8150
+ case "media":
8151
+ return mediaComponentToProps(component, rendererMapperProps);
8032
8152
  case "modal-layout":
8033
8153
  return modalLayoutComponentToProps(component, rendererMapperProps);
8034
8154
  case "modal":
@@ -8069,6 +8189,8 @@ var getComponentProps = (component, rendererMapperProps) => {
8069
8189
  return tupleComponentToProps(component, rendererMapperProps);
8070
8190
  case "upload":
8071
8191
  return uploadInputComponentToProps(component, rendererMapperProps);
8192
+ case "upsell":
8193
+ return upsellComponentToProps(component, rendererMapperProps);
8072
8194
  case "persist-async":
8073
8195
  return persistAsyncComponentToProps(component, rendererMapperProps);
8074
8196
  case "step":
@@ -0,0 +1,10 @@
1
+ import type { Size } from '@wise/dynamic-flow-types/spec';
2
+ import type { Align, BaseLayoutComponent, Media } from '../types';
3
+ export type MediaComponent = BaseLayoutComponent & {
4
+ type: 'media';
5
+ kind: 'layout';
6
+ align: Align;
7
+ media: Media;
8
+ size: Size;
9
+ };
10
+ export declare const createMediaComponent: (props: Pick<MediaComponent, "uid" | "align" | "media" | "control" | "margin" | "size" | "analyticsId" | "tags">) => MediaComponent;
@@ -0,0 +1,12 @@
1
+ import type { BaseLayoutComponent, CallToAction, Context, Media, OnComponentUpdate } from '../types';
2
+ export type UpsellComponent = BaseLayoutComponent & {
3
+ type: 'upsell';
4
+ kind: 'layout';
5
+ text: string;
6
+ callToAction: CallToAction;
7
+ media?: Media;
8
+ visible: boolean;
9
+ onDismiss: (() => void) | undefined;
10
+ context: Context;
11
+ };
12
+ export declare const createUpsellComponent: (upsellProps: Pick<UpsellComponent, "uid" | "analyticsId" | "callToAction" | "context" | "control" | "margin" | "media" | "tags" | "text" | "onDismiss">, onComponentUpdate: OnComponentUpdate) => UpsellComponent;
@@ -15,6 +15,7 @@ export type SearchComponent = BaseLayoutComponent & {
15
15
  type: 'search';
16
16
  kind: 'layout';
17
17
  emptyMessage: string;
18
+ hint?: string;
18
19
  isLoading: boolean;
19
20
  query: string;
20
21
  title: string;
@@ -23,4 +24,4 @@ export type SearchComponent = BaseLayoutComponent & {
23
24
  onChange: (query: string) => void;
24
25
  onSelect: (result: SearchResult) => void;
25
26
  };
26
- export declare const createSearchComponent: (searchProps: Pick<SearchComponent, "uid" | "analyticsId" | "control" | "emptyMessage" | "margin" | "tags" | "title">, performSearch: PerformSearch, onBehavior: OnBehavior, onComponentUpdate: OnComponentUpdate) => SearchComponent;
27
+ export declare const createSearchComponent: (searchProps: Pick<SearchComponent, "uid" | "analyticsId" | "control" | "emptyMessage" | "hint" | "margin" | "tags" | "title">, performSearch: PerformSearch, onBehavior: OnBehavior, onComponentUpdate: OnComponentUpdate) => SearchComponent;
@@ -7,3 +7,4 @@ export type RequestCacheEntries = readonly [Parameters<HttpClient>, Promise<Resp
7
7
  export declare const makeRequestCacheWithParent: (parent: RequestCache | undefined) => RequestCache;
8
8
  export declare const makeRequestCache: (initialValues?: RequestCacheEntries) => RequestCache;
9
9
  export declare const normaliseRequestCache: (cache: RequestCache | RequestCacheEntries | undefined) => RequestCache;
10
+ export declare const makeRequestCacheKey: (requestParams: Parameters<HttpClient>) => string;
@@ -0,0 +1,2 @@
1
+ import type { MediaLayout } from '@wise/dynamic-flow-types/spec';
2
+ export declare const mediaLayoutToComponent: (uid: string, { analyticsId, align, control, margin, media, size, tags }: MediaLayout) => import("../../components/MediaComponent").MediaComponent;
@@ -1,3 +1,3 @@
1
1
  import type { SearchLayout } from '@wise/dynamic-flow-types/spec';
2
2
  import type { MapperProps } from '../schema/types';
3
- export declare const searchLayoutToComponent: (uid: string, { analyticsId, control, emptyMessage, method, param, title, url, margin, tags }: SearchLayout, mapperProps: MapperProps) => import("../../components/searchComponent/SearchComponent").SearchComponent;
3
+ export declare const searchLayoutToComponent: (uid: string, { analyticsId, control, emptyMessage, hint, method, param, title, url, margin, tags }: SearchLayout, mapperProps: MapperProps) => import("../../components/searchComponent/SearchComponent").SearchComponent;
@@ -0,0 +1,3 @@
1
+ import type { UpsellLayout } from '@wise/dynamic-flow-types/spec';
2
+ import { MapperProps } from '../schema/types';
3
+ export declare const upsellLayoutToComponent: (uid: string, { analyticsId, callToAction, context, control, margin, media, onDismiss, tags, text, }: UpsellLayout, mapperProps: MapperProps) => import("../../components/UpsellComponent").UpsellComponent;
@@ -1,11 +1,13 @@
1
- import { Action, Behavior as SpecBehavior } from '@wise/dynamic-flow-types/spec';
1
+ import { Action, Context, Behavior as SpecBehavior } from '@wise/dynamic-flow-types/spec';
2
2
  import { CallToAction } from '../../types';
3
3
  import { MapperProps } from '../schema/types';
4
4
  type SpecCallToAction = {
5
5
  title?: string;
6
+ context?: Context;
6
7
  accessibilityDescription?: string;
7
8
  action?: Action;
8
9
  behavior?: SpecBehavior;
9
10
  };
10
- export declare const getDomainLayerCallToAction: (callToAction: SpecCallToAction | undefined, mapperProps: MapperProps) => CallToAction | undefined;
11
+ export declare function getDomainLayerCallToAction(cta: SpecCallToAction, mp: MapperProps): CallToAction;
12
+ export declare function getDomainLayerCallToAction(cta: SpecCallToAction | undefined, mapperProps: MapperProps): CallToAction | undefined;
11
13
  export {};
@@ -19,6 +19,7 @@ import type { IntegerInputComponent } from './components/IntegerInputComponent';
19
19
  import type { ListComponent } from './components/ListComponent';
20
20
  import type { LoadingIndicatorComponent } from './components/LoadingIndicatorComponent';
21
21
  import type { MarkdownComponent } from './components/MarkdownComponent';
22
+ import type { MediaComponent } from './components/MediaComponent';
22
23
  import type { ModalComponent } from './components/ModalComponent';
23
24
  import type { ModalLayoutComponent } from './components/ModalLayoutComponent';
24
25
  import type { MoneyInputComponent } from './components/MoneyInputComponent';
@@ -38,12 +39,13 @@ import type { SelectInputComponent } from './components/SelectInputComponent';
38
39
  import type { StatusListComponent } from './components/StatusListComponent';
39
40
  import type { ExternalConfirmationComponent } from './components/step/ExternalConfirmationComponent';
40
41
  import type { StepDomainComponent } from './components/step/StepDomainComponent';
42
+ import type { SubflowDomainComponent } from './components/SubflowDomainComponent';
41
43
  import type { TabsComponent } from './components/TabsComponent';
42
44
  import type { TextInputComponent } from './components/TextInputComponent';
43
45
  import type { TupleComponent } from './components/TupleComponent';
44
46
  import type { UploadInputComponent } from './components/UploadInputComponent';
45
- import type { SubflowDomainComponent } from './components/SubflowDomainComponent';
46
- export type DomainComponent = RootDomainComponent | StepDomainComponent | PersistAsyncComponent | AllOfComponent | BooleanInputComponent | ConstComponent | DateInputComponent | IntegerInputComponent | MultiSelectComponent | MultiUploadInputComponent | NumberInputComponent | ObjectComponent | RepeatableComponent | SelectInputComponent | TextInputComponent | TupleComponent | UploadInputComponent | AlertComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DecisionComponent | DividerComponent | ExternalConfirmationComponent | FormattedValueComponent | FormComponent | HeadingComponent | ImageComponent | InstructionsComponent | ListComponent | LoadingIndicatorComponent | MarkdownComponent | ModalLayoutComponent | ModalComponent | MoneyInputComponent | ParagraphComponent | ProgressComponent | ReviewComponent | SearchComponent | SectionComponent | StatusListComponent | SubflowDomainComponent | TabsComponent;
47
+ import type { UpsellComponent } from './components/UpsellComponent';
48
+ export type DomainComponent = RootDomainComponent | StepDomainComponent | PersistAsyncComponent | AllOfComponent | BooleanInputComponent | ConstComponent | DateInputComponent | IntegerInputComponent | MultiSelectComponent | MultiUploadInputComponent | NumberInputComponent | ObjectComponent | RepeatableComponent | SelectInputComponent | TextInputComponent | TupleComponent | UploadInputComponent | AlertComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DecisionComponent | DividerComponent | ExternalConfirmationComponent | FormattedValueComponent | FormComponent | HeadingComponent | ImageComponent | InstructionsComponent | ListComponent | LoadingIndicatorComponent | MarkdownComponent | MediaComponent | ModalLayoutComponent | ModalComponent | MoneyInputComponent | ParagraphComponent | ProgressComponent | ReviewComponent | SearchComponent | SectionComponent | StatusListComponent | SubflowDomainComponent | TabsComponent | UpsellComponent;
47
49
  export type SchemaComponent = DomainComponent & {
48
50
  kind: 'input';
49
51
  };
@@ -56,18 +58,6 @@ export interface LocalValueObject extends Record<string, LocalValuePrimitive | L
56
58
  }
57
59
  export interface LocalValueArray extends Array<LocalValuePrimitive | LocalValueObject | LocalValueArray> {
58
60
  }
59
- export type CallToAction = {
60
- type: 'action' | 'modal' | 'dismiss' | 'copy';
61
- title: string;
62
- accessibilityDescription?: string;
63
- onClick: () => void;
64
- } | {
65
- type: 'link';
66
- title: string;
67
- accessibilityDescription?: string;
68
- href: string;
69
- onClick: () => void;
70
- };
71
61
  export type Behavior = (ActionBehavior | CopyBehavior | DismissBehavior | LinkBehavior | ModalBehavior | NonMergingActionBehaviour | NullBehavior | RefreshBehavior | BackBehaviour | SubflowBehavior) & {
72
62
  analytics?: Record<string, unknown>;
73
63
  };
@@ -98,6 +88,14 @@ export type SubflowBehavior = {
98
88
  onCompletion?: Behavior;
99
89
  onError?: Behavior;
100
90
  };
91
+ export type CallToAction = {
92
+ type: Behavior['type'];
93
+ title: string;
94
+ context?: Context;
95
+ accessibilityDescription?: string;
96
+ href?: string;
97
+ onClick: () => void;
98
+ };
101
99
  export type BaseComponent = {
102
100
  kind: 'step' | 'input' | 'layout';
103
101
  type: string;
@@ -0,0 +1,4 @@
1
+ import type { MediaRendererProps } from '@wise/dynamic-flow-types/renderers';
2
+ import type { MediaComponent } from '../../domain/components/MediaComponent';
3
+ import { RendererMapperProps } from './componentToRendererProps';
4
+ export declare const mediaComponentToProps: (component: MediaComponent, rendererMapperProps: RendererMapperProps) => MediaRendererProps;