@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/i18n/ja.json +1 -1
- package/build/main.css +15 -0
- package/build/main.js +225 -103
- package/build/main.mjs +225 -103
- package/build/types/domain/components/MediaComponent.d.ts +10 -0
- package/build/types/domain/components/UpsellComponent.d.ts +12 -0
- package/build/types/domain/components/searchComponent/SearchComponent.d.ts +2 -1
- package/build/types/domain/features/prefetch/request-cache.d.ts +1 -0
- package/build/types/domain/mappers/layout/mediaLayoutToComponent.d.ts +2 -0
- package/build/types/domain/mappers/layout/searchLayoutToComponent.d.ts +1 -1
- package/build/types/domain/mappers/layout/upsellLayoutToComponent.d.ts +3 -0
- package/build/types/domain/mappers/utils/call-to-action-utils.d.ts +4 -2
- package/build/types/domain/types.d.ts +12 -14
- package/build/types/renderers/mappers/mediaComponentToProps.d.ts +4 -0
- package/build/types/renderers/mappers/upsellComponentToProps.d.ts +4 -0
- package/build/types/test-utils/getMergedTestRenderers.d.ts +1 -1
- package/package.json +10 -10
package/build/i18n/ja.json
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dynamicFlows.FileUploadSchema.maxFileSizeError": "大変申し訳ございませんが、ファイルが大きすぎます。これより小さいファイルをアップロードしてください。",
|
|
27
27
|
"dynamicFlows.FileUploadSchema.wrongFileTypeError": "そのファイル形式はサポートされていません。別のファイルをアップロードしてください。",
|
|
28
28
|
"dynamicFlows.Help.ariaLabel": "詳細はこちらをクリックしてください。",
|
|
29
|
-
"dynamicFlows.MultiSelect.summary": "{first}とその他{count}",
|
|
29
|
+
"dynamicFlows.MultiSelect.summary": "{first}とその他{count}オプション",
|
|
30
30
|
"dynamicFlows.MultipleFileUploadSchema.maxFileSizeError": "大変申し訳ございませんが、ファイルが大きすぎます。これより小さいファイルをアップロードしてください。",
|
|
31
31
|
"dynamicFlows.MultipleFileUploadSchema.maxItemsError": "{maxItems}個以下のファイルをアップロードしてください。",
|
|
32
32
|
"dynamicFlows.MultipleFileUploadSchema.minItemsError": "{minItems}個以上のファイルをアップロードしてください。",
|
package/build/main.css
CHANGED
|
@@ -153,6 +153,21 @@
|
|
|
153
153
|
width: 300px;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
+
.df-media-layout-avatar {
|
|
157
|
+
display: flex;
|
|
158
|
+
}
|
|
159
|
+
.df-media-layout-avatar.start {
|
|
160
|
+
justify-content: start;
|
|
161
|
+
align-items: start;
|
|
162
|
+
}
|
|
163
|
+
.df-media-layout-avatar.center {
|
|
164
|
+
justify-content: center;
|
|
165
|
+
align-items: center;
|
|
166
|
+
}
|
|
167
|
+
.df-media-layout-avatar.end {
|
|
168
|
+
justify-content: end;
|
|
169
|
+
align-items: end;
|
|
170
|
+
}
|
|
156
171
|
.df-toolbar {
|
|
157
172
|
display: flex;
|
|
158
173
|
gap: 0.25em;
|
package/build/main.js
CHANGED
|
@@ -416,7 +416,7 @@ var ja_default = {
|
|
|
416
416
|
"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",
|
|
417
417
|
"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",
|
|
418
418
|
"dynamicFlows.Help.ariaLabel": "\u8A73\u7D30\u306F\u3053\u3061\u3089\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
419
|
-
"dynamicFlows.MultiSelect.summary": "{first}\u3068\u305D\u306E\u4ED6{count}",
|
|
419
|
+
"dynamicFlows.MultiSelect.summary": "{first}\u3068\u305D\u306E\u4ED6{count}\u30AA\u30D7\u30B7\u30E7\u30F3",
|
|
420
420
|
"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",
|
|
421
421
|
"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",
|
|
422
422
|
"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",
|
|
@@ -841,6 +841,7 @@ var getChildren = (node) => {
|
|
|
841
841
|
case "list":
|
|
842
842
|
case "loading-indicator":
|
|
843
843
|
case "markdown":
|
|
844
|
+
case "media":
|
|
844
845
|
case "input-multi-select":
|
|
845
846
|
case "input-upload-multi":
|
|
846
847
|
case "input-number":
|
|
@@ -854,6 +855,7 @@ var getChildren = (node) => {
|
|
|
854
855
|
case "input-upload":
|
|
855
856
|
case "external-confirmation":
|
|
856
857
|
case "subflow":
|
|
858
|
+
case "upsell":
|
|
857
859
|
return [];
|
|
858
860
|
}
|
|
859
861
|
};
|
|
@@ -1134,6 +1136,55 @@ var createSubflowDomainComponent = (subflowProps, onComponentUpdate) => {
|
|
|
1134
1136
|
return subflowComponent;
|
|
1135
1137
|
};
|
|
1136
1138
|
|
|
1139
|
+
// src/domain/features/prefetch/request-cache.ts
|
|
1140
|
+
var makeRequestCacheWithParent = (parent) => {
|
|
1141
|
+
const map = /* @__PURE__ */ new Map();
|
|
1142
|
+
const cache = {
|
|
1143
|
+
get: (requestParams) => {
|
|
1144
|
+
var _a;
|
|
1145
|
+
const key = makeRequestCacheKey(requestParams);
|
|
1146
|
+
const promise = (_a = map.get(key)) != null ? _a : parent == null ? void 0 : parent.get(requestParams);
|
|
1147
|
+
map.delete(key);
|
|
1148
|
+
return promise;
|
|
1149
|
+
},
|
|
1150
|
+
set: (requestParams, responsePromise) => {
|
|
1151
|
+
return map.set(makeRequestCacheKey(requestParams), responsePromise);
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
return cache;
|
|
1155
|
+
};
|
|
1156
|
+
var makeRequestCache = (initialValues = []) => {
|
|
1157
|
+
const cache = makeRequestCacheWithParent(void 0);
|
|
1158
|
+
initialValues.forEach(([requestParams, responsePromise]) => {
|
|
1159
|
+
cache.set(requestParams, responsePromise);
|
|
1160
|
+
});
|
|
1161
|
+
return cache;
|
|
1162
|
+
};
|
|
1163
|
+
var normaliseRequestCache = (cache) => {
|
|
1164
|
+
if (cache === void 0) {
|
|
1165
|
+
return makeRequestCache();
|
|
1166
|
+
}
|
|
1167
|
+
if (isRequestCacheInstance(cache)) {
|
|
1168
|
+
return cache;
|
|
1169
|
+
}
|
|
1170
|
+
return makeRequestCache(cache);
|
|
1171
|
+
};
|
|
1172
|
+
var isRequestCacheInstance = (cache) => {
|
|
1173
|
+
return !cache || !Array.isArray(cache);
|
|
1174
|
+
};
|
|
1175
|
+
var makeRequestCacheKey = (requestParams) => {
|
|
1176
|
+
var _a, _b;
|
|
1177
|
+
const [input, init] = requestParams;
|
|
1178
|
+
const url = typeof input === "string" || input instanceof URL ? input.toString() : input.url;
|
|
1179
|
+
const key = JSON.stringify({
|
|
1180
|
+
url,
|
|
1181
|
+
method: (_a = init == null ? void 0 : init.method) != null ? _a : "GET",
|
|
1182
|
+
headers: (init == null ? void 0 : init.headers) ? Array.from(new Headers(init.headers).entries()) : [],
|
|
1183
|
+
body: (_b = init == null ? void 0 : init.body) != null ? _b : null
|
|
1184
|
+
});
|
|
1185
|
+
return key;
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1137
1188
|
// src/domain/components/ModalComponent.ts
|
|
1138
1189
|
var createModalContentComponent = (modalProps, onComponentUpdate) => {
|
|
1139
1190
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
@@ -1208,51 +1259,6 @@ var getActionByReference = ($ref, actions = []) => {
|
|
|
1208
1259
|
return action;
|
|
1209
1260
|
};
|
|
1210
1261
|
|
|
1211
|
-
// src/domain/mappers/utils/call-to-action-utils.ts
|
|
1212
|
-
var getDomainLayerCallToAction = (callToAction, mapperProps) => {
|
|
1213
|
-
var _a;
|
|
1214
|
-
if (!callToAction) {
|
|
1215
|
-
return void 0;
|
|
1216
|
-
}
|
|
1217
|
-
const { step, onBehavior, registerSubmissionBehavior } = mapperProps;
|
|
1218
|
-
const stepActions = (_a = step.actions) != null ? _a : [];
|
|
1219
|
-
const { title = "", accessibilityDescription, action, behavior } = callToAction;
|
|
1220
|
-
return getCallToAction(
|
|
1221
|
-
{ title, accessibilityDescription },
|
|
1222
|
-
getDomainLayerBehavior({ action, behavior }, stepActions, registerSubmissionBehavior),
|
|
1223
|
-
onBehavior
|
|
1224
|
-
);
|
|
1225
|
-
};
|
|
1226
|
-
var getCallToAction = ({ title, accessibilityDescription }, behavior, onBehavior) => {
|
|
1227
|
-
const onClick = () => {
|
|
1228
|
-
void onBehavior(behavior);
|
|
1229
|
-
};
|
|
1230
|
-
switch (behavior.type) {
|
|
1231
|
-
case "action":
|
|
1232
|
-
case "modal":
|
|
1233
|
-
case "copy":
|
|
1234
|
-
case "dismiss": {
|
|
1235
|
-
return {
|
|
1236
|
-
type: behavior.type,
|
|
1237
|
-
title: title != null ? title : "",
|
|
1238
|
-
accessibilityDescription,
|
|
1239
|
-
onClick
|
|
1240
|
-
};
|
|
1241
|
-
}
|
|
1242
|
-
case "link": {
|
|
1243
|
-
return {
|
|
1244
|
-
type: "link",
|
|
1245
|
-
title: title != null ? title : "",
|
|
1246
|
-
href: behavior.url,
|
|
1247
|
-
accessibilityDescription,
|
|
1248
|
-
onClick
|
|
1249
|
-
};
|
|
1250
|
-
}
|
|
1251
|
-
default:
|
|
1252
|
-
return void 0;
|
|
1253
|
-
}
|
|
1254
|
-
};
|
|
1255
|
-
|
|
1256
1262
|
// src/domain/mappers/utils/legacy-utils.ts
|
|
1257
1263
|
var mapLegacyContext = (context) => {
|
|
1258
1264
|
switch (context) {
|
|
@@ -1304,6 +1310,27 @@ var legacyActionTypeToControl = {
|
|
|
1304
1310
|
};
|
|
1305
1311
|
var mapLegacyActionTypeToControl = (type) => type && type in legacyActionTypeToControl ? legacyActionTypeToControl[type] : "secondary";
|
|
1306
1312
|
|
|
1313
|
+
// src/domain/mappers/utils/call-to-action-utils.ts
|
|
1314
|
+
function getDomainLayerCallToAction(cta, mapperProps) {
|
|
1315
|
+
var _a, _b;
|
|
1316
|
+
if (!cta) {
|
|
1317
|
+
return void 0;
|
|
1318
|
+
}
|
|
1319
|
+
const { step, onBehavior, registerSubmissionBehavior } = mapperProps;
|
|
1320
|
+
const stepActions = (_a = step.actions) != null ? _a : [];
|
|
1321
|
+
const behavior = getDomainLayerBehavior(cta, stepActions, registerSubmissionBehavior);
|
|
1322
|
+
return {
|
|
1323
|
+
type: behavior.type,
|
|
1324
|
+
title: (_b = cta.title) != null ? _b : "",
|
|
1325
|
+
context: cta.context ? mapLegacyContext(cta.context) : void 0,
|
|
1326
|
+
accessibilityDescription: cta.accessibilityDescription,
|
|
1327
|
+
href: behavior.type === "link" ? behavior.url : void 0,
|
|
1328
|
+
onClick: () => {
|
|
1329
|
+
void onBehavior(behavior);
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1307
1334
|
// src/domain/mappers/layout/alertLayoutToComponent.ts
|
|
1308
1335
|
var alertLayoutToComponent = (uid, {
|
|
1309
1336
|
control,
|
|
@@ -1852,6 +1879,24 @@ var markdownLayoutToComponent = (uid, {
|
|
|
1852
1879
|
size: size != null ? size : "md"
|
|
1853
1880
|
});
|
|
1854
1881
|
|
|
1882
|
+
// src/domain/components/MediaComponent.ts
|
|
1883
|
+
var createMediaComponent = (props) => __spreadValues({
|
|
1884
|
+
type: "media",
|
|
1885
|
+
kind: "layout"
|
|
1886
|
+
}, props);
|
|
1887
|
+
|
|
1888
|
+
// src/domain/mappers/layout/mediaLayoutToComponent.ts
|
|
1889
|
+
var mediaLayoutToComponent = (uid, { analyticsId, align, control, margin, media, size, tags }) => createMediaComponent({
|
|
1890
|
+
uid,
|
|
1891
|
+
analyticsId,
|
|
1892
|
+
align: mapLegacyAlign(align != null ? align : "center"),
|
|
1893
|
+
control,
|
|
1894
|
+
margin: margin != null ? margin : "md",
|
|
1895
|
+
media,
|
|
1896
|
+
size: size != null ? size : "md",
|
|
1897
|
+
tags
|
|
1898
|
+
});
|
|
1899
|
+
|
|
1855
1900
|
// src/domain/components/ModalLayoutComponent.ts
|
|
1856
1901
|
var createModalComponent = (modalProps) => __spreadProps(__spreadValues({
|
|
1857
1902
|
type: "modal-layout",
|
|
@@ -1951,14 +1996,14 @@ var reviewLayoutToComponent = (uid, {
|
|
|
1951
1996
|
}, mapperProps) => createReviewComponent({
|
|
1952
1997
|
uid,
|
|
1953
1998
|
analyticsId,
|
|
1954
|
-
callToAction:
|
|
1999
|
+
callToAction: getCallToAction({ mapperProps, callToAction, action }),
|
|
1955
2000
|
control: getOrientationControl({ control, orientation }),
|
|
1956
2001
|
fields: fields.map((field) => mapReviewField(field, mapperProps)),
|
|
1957
2002
|
margin: margin != null ? margin : "md",
|
|
1958
2003
|
tags,
|
|
1959
2004
|
title
|
|
1960
2005
|
});
|
|
1961
|
-
var
|
|
2006
|
+
var getCallToAction = ({
|
|
1962
2007
|
callToAction,
|
|
1963
2008
|
action,
|
|
1964
2009
|
mapperProps
|
|
@@ -1996,7 +2041,7 @@ var mapReviewField = (field, mapperProps) => {
|
|
|
1996
2041
|
help: (_a = field.help) == null ? void 0 : _a.markdown,
|
|
1997
2042
|
inlineAlert: mapInlineAlert(field.inlineAlert),
|
|
1998
2043
|
additionalInfo: mapAdditionalInfo(field.additionalInfo, mapperProps),
|
|
1999
|
-
callToAction:
|
|
2044
|
+
callToAction: getCallToAction({
|
|
2000
2045
|
callToAction: field.callToAction,
|
|
2001
2046
|
mapperProps
|
|
2002
2047
|
}),
|
|
@@ -2043,7 +2088,7 @@ var debounce = (callback, waitMs) => {
|
|
|
2043
2088
|
// src/domain/components/searchComponent/SearchComponent.ts
|
|
2044
2089
|
var DEBOUNCE_TIME = 400;
|
|
2045
2090
|
var createSearchComponent = (searchProps, performSearch, onBehavior, onComponentUpdate) => {
|
|
2046
|
-
const { uid, analyticsId, control, emptyMessage, margin, tags, title } = searchProps;
|
|
2091
|
+
const { uid, analyticsId, control, emptyMessage, hint, margin, tags, title } = searchProps;
|
|
2047
2092
|
const update = getInputUpdateFunction(onComponentUpdate);
|
|
2048
2093
|
let abortController = new AbortController();
|
|
2049
2094
|
const search = (component2, query, searchConfig) => {
|
|
@@ -2079,6 +2124,7 @@ var createSearchComponent = (searchProps, performSearch, onBehavior, onComponent
|
|
|
2079
2124
|
analyticsId,
|
|
2080
2125
|
control,
|
|
2081
2126
|
emptyMessage,
|
|
2127
|
+
hint,
|
|
2082
2128
|
margin,
|
|
2083
2129
|
tags,
|
|
2084
2130
|
title,
|
|
@@ -2165,7 +2211,7 @@ var isValidResponseBody = (body) => isObject(body) && "results" in body && isArr
|
|
|
2165
2211
|
var hashRequest = (query, config) => JSON.stringify({ query, config });
|
|
2166
2212
|
|
|
2167
2213
|
// src/domain/mappers/layout/searchLayoutToComponent.ts
|
|
2168
|
-
var searchLayoutToComponent = (uid, { analyticsId, control, emptyMessage, method, param, title, url, margin, tags }, mapperProps) => {
|
|
2214
|
+
var searchLayoutToComponent = (uid, { analyticsId, control, emptyMessage, hint, method, param, title, url, margin, tags }, mapperProps) => {
|
|
2169
2215
|
const { httpClient, onBehavior, onComponentUpdate } = mapperProps;
|
|
2170
2216
|
const search = getPerformSearchFunction(httpClient, { method, param, url });
|
|
2171
2217
|
return createSearchComponent(
|
|
@@ -2174,6 +2220,7 @@ var searchLayoutToComponent = (uid, { analyticsId, control, emptyMessage, method
|
|
|
2174
2220
|
analyticsId,
|
|
2175
2221
|
control,
|
|
2176
2222
|
emptyMessage: emptyMessage != null ? emptyMessage : "",
|
|
2223
|
+
hint,
|
|
2177
2224
|
margin: margin != null ? margin : "md",
|
|
2178
2225
|
tags,
|
|
2179
2226
|
title
|
|
@@ -2253,6 +2300,60 @@ var mapTabs = (tabs, uid, mapperProps, schemaComponents) => tabs.map(({ componen
|
|
|
2253
2300
|
)
|
|
2254
2301
|
}));
|
|
2255
2302
|
|
|
2303
|
+
// src/domain/components/UpsellComponent.ts
|
|
2304
|
+
var createUpsellComponent = (upsellProps, onComponentUpdate) => {
|
|
2305
|
+
const update = getInputUpdateFunction(onComponentUpdate);
|
|
2306
|
+
const _a = upsellProps, { onDismiss: propsOnDismiss } = _a, restProps = __objRest(_a, ["onDismiss"]);
|
|
2307
|
+
const component = __spreadProps(__spreadValues({
|
|
2308
|
+
type: "upsell",
|
|
2309
|
+
kind: "layout"
|
|
2310
|
+
}, restProps), {
|
|
2311
|
+
visible: true,
|
|
2312
|
+
onDismiss: propsOnDismiss ? () => {
|
|
2313
|
+
update(component, (draft) => {
|
|
2314
|
+
draft.visible = false;
|
|
2315
|
+
});
|
|
2316
|
+
propsOnDismiss();
|
|
2317
|
+
} : void 0
|
|
2318
|
+
});
|
|
2319
|
+
return component;
|
|
2320
|
+
};
|
|
2321
|
+
|
|
2322
|
+
// src/domain/mappers/layout/upsellLayoutToComponent.ts
|
|
2323
|
+
var upsellLayoutToComponent = (uid, {
|
|
2324
|
+
analyticsId,
|
|
2325
|
+
callToAction,
|
|
2326
|
+
context,
|
|
2327
|
+
control,
|
|
2328
|
+
margin,
|
|
2329
|
+
media,
|
|
2330
|
+
onDismiss,
|
|
2331
|
+
tags,
|
|
2332
|
+
text
|
|
2333
|
+
}, mapperProps) => {
|
|
2334
|
+
const { onComponentUpdate } = mapperProps;
|
|
2335
|
+
return createUpsellComponent(
|
|
2336
|
+
{
|
|
2337
|
+
uid,
|
|
2338
|
+
analyticsId,
|
|
2339
|
+
callToAction: getDomainLayerCallToAction(callToAction, mapperProps),
|
|
2340
|
+
context: context ? mapLegacyContext(context) : "neutral",
|
|
2341
|
+
control,
|
|
2342
|
+
margin: margin != null ? margin : "md",
|
|
2343
|
+
media: getDomainLayerMedia({ media }),
|
|
2344
|
+
tags,
|
|
2345
|
+
text,
|
|
2346
|
+
onDismiss: onDismiss ? () => {
|
|
2347
|
+
const { url, method } = onDismiss;
|
|
2348
|
+
const body = method === "GET" ? void 0 : JSON.stringify(onDismiss.body);
|
|
2349
|
+
void mapperProps.httpClient(url, { method, body }).catch(() => {
|
|
2350
|
+
});
|
|
2351
|
+
} : void 0
|
|
2352
|
+
},
|
|
2353
|
+
onComponentUpdate
|
|
2354
|
+
);
|
|
2355
|
+
};
|
|
2356
|
+
|
|
2256
2357
|
// src/domain/mappers/mapLayoutToComponent.ts
|
|
2257
2358
|
var mapLayoutToComponent = (uid, layout, mapperProps, schemaComponents) => {
|
|
2258
2359
|
switch (layout.type) {
|
|
@@ -2284,6 +2385,8 @@ var mapLayoutToComponent = (uid, layout, mapperProps, schemaComponents) => {
|
|
|
2284
2385
|
return loadingIndicatorLayoutToComponent(uid, layout);
|
|
2285
2386
|
case "markdown":
|
|
2286
2387
|
return markdownLayoutToComponent(uid, layout);
|
|
2388
|
+
case "media":
|
|
2389
|
+
return mediaLayoutToComponent(uid, layout);
|
|
2287
2390
|
case "modal":
|
|
2288
2391
|
return modalLayoutToComponent(uid, layout, mapperProps, schemaComponents);
|
|
2289
2392
|
case "paragraph":
|
|
@@ -2300,6 +2403,8 @@ var mapLayoutToComponent = (uid, layout, mapperProps, schemaComponents) => {
|
|
|
2300
2403
|
return statusListLayoutToComponent(uid, layout, mapperProps);
|
|
2301
2404
|
case "tabs":
|
|
2302
2405
|
return tabsLayoutToComponent(uid, layout, mapperProps, schemaComponents);
|
|
2406
|
+
case "upsell":
|
|
2407
|
+
return upsellLayoutToComponent(uid, layout, mapperProps);
|
|
2303
2408
|
default:
|
|
2304
2409
|
throw new Error(`Invalid layout type in ${JSON.stringify(layout)}`);
|
|
2305
2410
|
}
|
|
@@ -5407,6 +5512,7 @@ var mapStringSchemaSuggestions = (suggestions, logEvent) => {
|
|
|
5407
5512
|
|
|
5408
5513
|
// src/domain/mappers/schema/stringSchemaToComponent/stringSchemaToDateInputComponent.ts
|
|
5409
5514
|
var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
5515
|
+
var _a;
|
|
5410
5516
|
const { schema, localValue, model, required = false, onPersistAsync } = schemaMapperProps;
|
|
5411
5517
|
const {
|
|
5412
5518
|
autocompleteHint,
|
|
@@ -5422,7 +5528,7 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5422
5528
|
mapperProps
|
|
5423
5529
|
);
|
|
5424
5530
|
const validLocalValue = isString(localValue) ? localValue : null;
|
|
5425
|
-
const validModel =
|
|
5531
|
+
const validModel = (_a = getValidDate(model)) != null ? _a : getValidDate(defaultValue != null ? defaultValue : null);
|
|
5426
5532
|
const value = onPersistAsync ? validLocalValue : validModel;
|
|
5427
5533
|
return createDateInputComponent(
|
|
5428
5534
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
@@ -5445,6 +5551,21 @@ var stringSchemaToDateInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
5445
5551
|
onComponentUpdate
|
|
5446
5552
|
);
|
|
5447
5553
|
};
|
|
5554
|
+
var getValidDate = (model) => {
|
|
5555
|
+
if (!isString(model)) {
|
|
5556
|
+
return null;
|
|
5557
|
+
}
|
|
5558
|
+
if (/^\d{4}-\d{2}$/.test(model)) {
|
|
5559
|
+
return model;
|
|
5560
|
+
}
|
|
5561
|
+
try {
|
|
5562
|
+
const date = new Date(model);
|
|
5563
|
+
const stringDate = date.toISOString();
|
|
5564
|
+
return stringDate.split("T")[0];
|
|
5565
|
+
} catch (e) {
|
|
5566
|
+
return null;
|
|
5567
|
+
}
|
|
5568
|
+
};
|
|
5448
5569
|
|
|
5449
5570
|
// src/domain/mappers/schema/stringSchemaToComponent/stringSchemaToUploadInputComponent.ts
|
|
5450
5571
|
var stringSchemaToUploadInputComponent = (schemaMapperProps, mapperProps) => {
|
|
@@ -6015,59 +6136,14 @@ var createRequestFromAction = (action, model) => {
|
|
|
6015
6136
|
});
|
|
6016
6137
|
};
|
|
6017
6138
|
|
|
6018
|
-
// src/domain/features/prefetch/request-cache.ts
|
|
6019
|
-
var makeRequestCacheWithParent = (parent) => {
|
|
6020
|
-
const map = /* @__PURE__ */ new Map();
|
|
6021
|
-
const cache = {
|
|
6022
|
-
get: (requestParams) => {
|
|
6023
|
-
var _a;
|
|
6024
|
-
const key = makeKey(requestParams);
|
|
6025
|
-
const promise = (_a = map.get(key)) != null ? _a : parent == null ? void 0 : parent.get(requestParams);
|
|
6026
|
-
map.delete(key);
|
|
6027
|
-
return promise;
|
|
6028
|
-
},
|
|
6029
|
-
set: (requestParams, responsePromise) => {
|
|
6030
|
-
return map.set(makeKey(requestParams), responsePromise);
|
|
6031
|
-
}
|
|
6032
|
-
};
|
|
6033
|
-
return cache;
|
|
6034
|
-
};
|
|
6035
|
-
var makeRequestCache = (initialValues = []) => {
|
|
6036
|
-
const cache = makeRequestCacheWithParent(void 0);
|
|
6037
|
-
initialValues.forEach(([requestParams, responsePromise]) => {
|
|
6038
|
-
cache.set(requestParams, responsePromise);
|
|
6039
|
-
});
|
|
6040
|
-
return cache;
|
|
6041
|
-
};
|
|
6042
|
-
var normaliseRequestCache = (cache) => {
|
|
6043
|
-
if (cache === void 0) {
|
|
6044
|
-
return makeRequestCache();
|
|
6045
|
-
}
|
|
6046
|
-
if (isRequestCacheInstance(cache)) {
|
|
6047
|
-
return cache;
|
|
6048
|
-
}
|
|
6049
|
-
return makeRequestCache(cache);
|
|
6050
|
-
};
|
|
6051
|
-
var isRequestCacheInstance = (cache) => {
|
|
6052
|
-
return !cache || !Array.isArray(cache);
|
|
6053
|
-
};
|
|
6054
|
-
var makeKey = (requestParams) => {
|
|
6055
|
-
var _a, _b;
|
|
6056
|
-
const [input, init] = requestParams;
|
|
6057
|
-
const url = typeof input === "string" || input instanceof URL ? input.toString() : input.url;
|
|
6058
|
-
const key = JSON.stringify({
|
|
6059
|
-
url,
|
|
6060
|
-
method: (_a = init == null ? void 0 : init.method) != null ? _a : "GET",
|
|
6061
|
-
headers: (init == null ? void 0 : init.headers) ? Array.from(new Headers(init.headers).entries()) : [],
|
|
6062
|
-
body: (_b = init == null ? void 0 : init.body) != null ? _b : null
|
|
6063
|
-
});
|
|
6064
|
-
return key;
|
|
6065
|
-
};
|
|
6066
|
-
|
|
6067
6139
|
// src/domain/features/prefetch/getStepPrefetch.ts
|
|
6068
6140
|
var getStepPrefetch = (httpClient, flowRequestCache, submissionBehaviors) => {
|
|
6069
6141
|
const requestCache = makeRequestCacheWithParent(flowRequestCache);
|
|
6142
|
+
const keys = /* @__PURE__ */ new Set();
|
|
6070
6143
|
const start = (model) => {
|
|
6144
|
+
if (keys.size > 0) {
|
|
6145
|
+
return;
|
|
6146
|
+
}
|
|
6071
6147
|
submissionBehaviors.forEach((behavior) => {
|
|
6072
6148
|
const request = behavior.type === "action" ? createRequestFromAction(behavior.action, model) : behavior.launchConfig.request;
|
|
6073
6149
|
const requestParams = [
|
|
@@ -6079,8 +6155,13 @@ var getStepPrefetch = (httpClient, flowRequestCache, submissionBehaviors) => {
|
|
|
6079
6155
|
}
|
|
6080
6156
|
];
|
|
6081
6157
|
try {
|
|
6158
|
+
const key = makeRequestCacheKey(requestParams);
|
|
6159
|
+
if (keys.has(key)) {
|
|
6160
|
+
return;
|
|
6161
|
+
}
|
|
6082
6162
|
const responsePromise = httpClient(...requestParams).catch(() => null);
|
|
6083
6163
|
requestCache.set(requestParams, responsePromise);
|
|
6164
|
+
keys.add(key);
|
|
6084
6165
|
} catch (e) {
|
|
6085
6166
|
}
|
|
6086
6167
|
});
|
|
@@ -6825,7 +6906,11 @@ var createFlowController = (props) => {
|
|
|
6825
6906
|
initState = "created";
|
|
6826
6907
|
trackEvent("Initiated");
|
|
6827
6908
|
rootComponent.setLoadingState("submitting");
|
|
6828
|
-
void onAction(__spreadValues({ method: "GET" }, initialAction), null)
|
|
6909
|
+
void onAction(__spreadValues({ method: "GET" }, initialAction), null).then(() => {
|
|
6910
|
+
initState = "started";
|
|
6911
|
+
rootComponent.start();
|
|
6912
|
+
});
|
|
6913
|
+
return;
|
|
6829
6914
|
}
|
|
6830
6915
|
if (initState === "created") {
|
|
6831
6916
|
initState = "started";
|
|
@@ -7472,6 +7557,9 @@ var markdownComponentToProps = (control, rendererMapperProps) => __spreadValues(
|
|
|
7472
7557
|
"size"
|
|
7473
7558
|
)), rendererMapperProps);
|
|
7474
7559
|
|
|
7560
|
+
// src/renderers/mappers/mediaComponentToProps.ts
|
|
7561
|
+
var mediaComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "align", "control", "margin", "media", "size", "tags")), rendererMapperProps);
|
|
7562
|
+
|
|
7475
7563
|
// src/renderers/mappers/modalComponentToProps.ts
|
|
7476
7564
|
var modalComponentToProps = (component, rendererMapperProps) => {
|
|
7477
7565
|
const { uid, analyticsId, open, tags, title, close } = component;
|
|
@@ -7817,7 +7905,19 @@ var rootComponentToProps = (rootComponent, rendererMapperProps) => {
|
|
|
7817
7905
|
|
|
7818
7906
|
// src/renderers/mappers/searchComponentToProps.ts
|
|
7819
7907
|
var searchComponentToProps = (component, rendererMapperProps) => {
|
|
7820
|
-
const {
|
|
7908
|
+
const {
|
|
7909
|
+
uid,
|
|
7910
|
+
control,
|
|
7911
|
+
emptyMessage,
|
|
7912
|
+
error,
|
|
7913
|
+
hint,
|
|
7914
|
+
isLoading,
|
|
7915
|
+
margin,
|
|
7916
|
+
query,
|
|
7917
|
+
results,
|
|
7918
|
+
title,
|
|
7919
|
+
tags
|
|
7920
|
+
} = component;
|
|
7821
7921
|
const onChange = component.onChange.bind(component);
|
|
7822
7922
|
const onSelect = component.onSelect.bind(component);
|
|
7823
7923
|
const state = getSearchState({
|
|
@@ -7834,6 +7934,7 @@ var searchComponentToProps = (component, rendererMapperProps) => {
|
|
|
7834
7934
|
type: "search",
|
|
7835
7935
|
id: uid,
|
|
7836
7936
|
control,
|
|
7937
|
+
hint,
|
|
7837
7938
|
isLoading,
|
|
7838
7939
|
margin,
|
|
7839
7940
|
query,
|
|
@@ -7978,6 +8079,23 @@ var uploadInputComponentToProps = (component, rendererMapperProps) => {
|
|
|
7978
8079
|
});
|
|
7979
8080
|
};
|
|
7980
8081
|
|
|
8082
|
+
// src/renderers/mappers/upsellComponentToProps.ts
|
|
8083
|
+
var upsellComponentToProps = (component, rendererMapperProps) => __spreadValues(__spreadProps(__spreadValues({}, pick(
|
|
8084
|
+
component,
|
|
8085
|
+
"uid",
|
|
8086
|
+
"analyticsId",
|
|
8087
|
+
"type",
|
|
8088
|
+
"callToAction",
|
|
8089
|
+
"context",
|
|
8090
|
+
"control",
|
|
8091
|
+
"margin",
|
|
8092
|
+
"media",
|
|
8093
|
+
"tags",
|
|
8094
|
+
"text"
|
|
8095
|
+
)), {
|
|
8096
|
+
onDismiss: component.onDismiss ? component.onDismiss.bind(component) : void 0
|
|
8097
|
+
}), rendererMapperProps);
|
|
8098
|
+
|
|
7981
8099
|
// src/renderers/mappers/subflowComponentToRendererProps.ts
|
|
7982
8100
|
var subflowComponentToRendererProps = (component, rendererMapperProps) => {
|
|
7983
8101
|
return __spreadValues(__spreadProps(__spreadValues({
|
|
@@ -8059,6 +8177,8 @@ var getComponentProps = (component, rendererMapperProps) => {
|
|
|
8059
8177
|
return loadingIndicatorComponentToProps(component, rendererMapperProps);
|
|
8060
8178
|
case "markdown":
|
|
8061
8179
|
return markdownComponentToProps(component, rendererMapperProps);
|
|
8180
|
+
case "media":
|
|
8181
|
+
return mediaComponentToProps(component, rendererMapperProps);
|
|
8062
8182
|
case "modal-layout":
|
|
8063
8183
|
return modalLayoutComponentToProps(component, rendererMapperProps);
|
|
8064
8184
|
case "modal":
|
|
@@ -8099,6 +8219,8 @@ var getComponentProps = (component, rendererMapperProps) => {
|
|
|
8099
8219
|
return tupleComponentToProps(component, rendererMapperProps);
|
|
8100
8220
|
case "upload":
|
|
8101
8221
|
return uploadInputComponentToProps(component, rendererMapperProps);
|
|
8222
|
+
case "upsell":
|
|
8223
|
+
return upsellComponentToProps(component, rendererMapperProps);
|
|
8102
8224
|
case "persist-async":
|
|
8103
8225
|
return persistAsyncComponentToProps(component, rendererMapperProps);
|
|
8104
8226
|
case "step":
|