@wise/dynamic-flow-client 4.16.1 → 4.17.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.css +15 -0
- package/build/main.js +90 -2
- package/build/main.mjs +90 -2
- package/build/types/revamp/domain/components/step/StepDomainComponent.d.ts +2 -1
- package/build/types/revamp/domain/mappers/mapStepToComponent.d.ts +2 -1
- package/build/types/revamp/domain/mappers/utils/feature-utils.d.ts +3 -0
- package/build/types/revamp/domain/mappers/utils/groupLayoutByPinned.d.ts +5 -0
- package/build/types/revamp/types.d.ts +1 -0
- package/package.json +2 -2
package/build/main.css
CHANGED
|
@@ -358,6 +358,21 @@ button.df-back-btn {
|
|
|
358
358
|
display: flex;
|
|
359
359
|
flex-direction: column;
|
|
360
360
|
}
|
|
361
|
+
.df-step-fixed__footer {
|
|
362
|
+
position: sticky;
|
|
363
|
+
bottom: 0;
|
|
364
|
+
left: 0;
|
|
365
|
+
right: 0;
|
|
366
|
+
padding: var(--size-8) 0;
|
|
367
|
+
background-color: var(--color-background-screen);
|
|
368
|
+
}
|
|
369
|
+
/* If we're in a drawer, we need to account for the bottom padding on the drawer content */
|
|
370
|
+
.np-drawer-content .df-step-fixed__footer {
|
|
371
|
+
bottom: -16px;
|
|
372
|
+
}
|
|
373
|
+
.tw-modal-body--scrollable .df-step-fixed__footer {
|
|
374
|
+
bottom: -24px;
|
|
375
|
+
}
|
|
361
376
|
.chips-container {
|
|
362
377
|
overflow-x: auto;
|
|
363
378
|
}
|
package/build/main.js
CHANGED
|
@@ -1322,6 +1322,9 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
1322
1322
|
onBehavior
|
|
1323
1323
|
} = component;
|
|
1324
1324
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
1325
|
+
const footerProps = component.footerComponents.map(
|
|
1326
|
+
(c) => componentToRendererProps(c, rendererMapperProps)
|
|
1327
|
+
);
|
|
1325
1328
|
return __spreadValues({
|
|
1326
1329
|
type: "step",
|
|
1327
1330
|
id: step.id,
|
|
@@ -1337,6 +1340,8 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
1337
1340
|
title,
|
|
1338
1341
|
children: childrenProps.map(rendererMapperProps.render),
|
|
1339
1342
|
childrenProps,
|
|
1343
|
+
footer: footerProps.map(rendererMapperProps.render),
|
|
1344
|
+
footerProps,
|
|
1340
1345
|
onAction: (action) => {
|
|
1341
1346
|
void onBehavior({ type: "action", action });
|
|
1342
1347
|
}
|
|
@@ -6213,12 +6218,63 @@ var mapToolbarToComponent = (uid, toolbar, mapperProps) => {
|
|
|
6213
6218
|
});
|
|
6214
6219
|
};
|
|
6215
6220
|
|
|
6221
|
+
// src/revamp/domain/mappers/utils/groupLayoutByPinned.ts
|
|
6222
|
+
var groupLayoutByPinned = (layouts) => {
|
|
6223
|
+
return layouts.reduce(groupLayout, { pinned: [], nonPinned: [] });
|
|
6224
|
+
};
|
|
6225
|
+
var groupLayout = (acc, layout) => {
|
|
6226
|
+
if (layout.type === "button" && layout.pinOrder !== void 0) {
|
|
6227
|
+
return {
|
|
6228
|
+
pinned: [...acc.pinned, layout],
|
|
6229
|
+
nonPinned: acc.nonPinned
|
|
6230
|
+
};
|
|
6231
|
+
}
|
|
6232
|
+
if (hasColumns(layout)) {
|
|
6233
|
+
const leftChildren = groupLayoutByPinned(layout.left);
|
|
6234
|
+
const rightChildren = groupLayoutByPinned(layout.right);
|
|
6235
|
+
return {
|
|
6236
|
+
pinned: [...acc.pinned, ...leftChildren.pinned, ...rightChildren.pinned],
|
|
6237
|
+
nonPinned: [
|
|
6238
|
+
...acc.nonPinned,
|
|
6239
|
+
__spreadProps(__spreadValues({}, layout), {
|
|
6240
|
+
left: leftChildren.nonPinned,
|
|
6241
|
+
right: rightChildren.nonPinned
|
|
6242
|
+
})
|
|
6243
|
+
]
|
|
6244
|
+
};
|
|
6245
|
+
}
|
|
6246
|
+
if (hasChildren(layout)) {
|
|
6247
|
+
const childComponents = groupLayoutByPinned(layout.components);
|
|
6248
|
+
return {
|
|
6249
|
+
pinned: [...acc.pinned, ...childComponents.pinned],
|
|
6250
|
+
nonPinned: [
|
|
6251
|
+
...acc.nonPinned,
|
|
6252
|
+
__spreadProps(__spreadValues({}, layout), {
|
|
6253
|
+
components: childComponents.nonPinned
|
|
6254
|
+
})
|
|
6255
|
+
]
|
|
6256
|
+
};
|
|
6257
|
+
}
|
|
6258
|
+
return {
|
|
6259
|
+
pinned: [...acc.pinned],
|
|
6260
|
+
nonPinned: [...acc.nonPinned, layout]
|
|
6261
|
+
};
|
|
6262
|
+
};
|
|
6263
|
+
var hasChildren = (component) => "components" in component;
|
|
6264
|
+
var hasColumns = (component) => "right" in component && "left" in component;
|
|
6265
|
+
|
|
6266
|
+
// src/revamp/domain/mappers/utils/feature-utils.ts
|
|
6267
|
+
var isFeatureEnabled = (features, featureName) => {
|
|
6268
|
+
return features[featureName] !== void 0 && features[featureName] !== false;
|
|
6269
|
+
};
|
|
6270
|
+
|
|
6216
6271
|
// src/revamp/domain/mappers/mapStepToComponent.ts
|
|
6217
6272
|
var mapStepToComponent = (_a) => {
|
|
6218
6273
|
var _b = _a, {
|
|
6219
6274
|
uid: rootUid,
|
|
6220
6275
|
loadingState,
|
|
6221
6276
|
displayStepTitle,
|
|
6277
|
+
features,
|
|
6222
6278
|
trackEvent,
|
|
6223
6279
|
onPoll,
|
|
6224
6280
|
onBehavior
|
|
@@ -6226,6 +6282,7 @@ var mapStepToComponent = (_a) => {
|
|
|
6226
6282
|
"uid",
|
|
6227
6283
|
"loadingState",
|
|
6228
6284
|
"displayStepTitle",
|
|
6285
|
+
"features",
|
|
6229
6286
|
"trackEvent",
|
|
6230
6287
|
"onPoll",
|
|
6231
6288
|
"onBehavior"
|
|
@@ -6272,9 +6329,26 @@ var mapStepToComponent = (_a) => {
|
|
|
6272
6329
|
mapperProps,
|
|
6273
6330
|
referencedSchemaIds
|
|
6274
6331
|
);
|
|
6275
|
-
const
|
|
6332
|
+
const shouldPinButtons = isFeatureEnabled(features, "pinnedButtons");
|
|
6333
|
+
const { pinned, nonPinned } = shouldPinButtons ? groupLayoutByPinned(layout) : { pinned: [], nonPinned: layout };
|
|
6334
|
+
const layoutComponents = nonPinned.map(
|
|
6276
6335
|
(layoutComponent, index) => mapLayoutToComponent(`${uid}.layout-${index}`, layoutComponent, mapperProps, schemaComponents)
|
|
6277
6336
|
);
|
|
6337
|
+
const footerComponents = pinned.map((footerComponent, index) => {
|
|
6338
|
+
if (index === pinned.length - 1 && footerComponent.margin === void 0) {
|
|
6339
|
+
return __spreadProps(__spreadValues({}, footerComponent), {
|
|
6340
|
+
margin: "xs"
|
|
6341
|
+
});
|
|
6342
|
+
}
|
|
6343
|
+
return footerComponent;
|
|
6344
|
+
}).map(
|
|
6345
|
+
(footerComponent, index) => mapLayoutToComponent(
|
|
6346
|
+
`${uid}.footer-${index}`,
|
|
6347
|
+
footerComponent,
|
|
6348
|
+
mapperProps,
|
|
6349
|
+
schemaComponents
|
|
6350
|
+
)
|
|
6351
|
+
);
|
|
6278
6352
|
const toolbar = mapToolbarToComponent(uid, step.toolbar, mapperProps);
|
|
6279
6353
|
const stepComponent = createStepComponent({
|
|
6280
6354
|
uid,
|
|
@@ -6282,6 +6356,7 @@ var mapStepToComponent = (_a) => {
|
|
|
6282
6356
|
toolbar,
|
|
6283
6357
|
layoutComponents,
|
|
6284
6358
|
schemaComponents,
|
|
6359
|
+
footerComponents,
|
|
6285
6360
|
control,
|
|
6286
6361
|
description,
|
|
6287
6362
|
error: errors == null ? void 0 : errors.error,
|
|
@@ -6765,7 +6840,19 @@ function useStableCallback(handler) {
|
|
|
6765
6840
|
|
|
6766
6841
|
// src/revamp/useDynamicFlowCore.tsx
|
|
6767
6842
|
function useDynamicFlowCore(props) {
|
|
6768
|
-
const _a = props, {
|
|
6843
|
+
const _a = props, {
|
|
6844
|
+
flowId,
|
|
6845
|
+
initialAction,
|
|
6846
|
+
initialStep,
|
|
6847
|
+
displayStepTitle = true,
|
|
6848
|
+
features = {}
|
|
6849
|
+
} = _a, rest = __objRest(_a, [
|
|
6850
|
+
"flowId",
|
|
6851
|
+
"initialAction",
|
|
6852
|
+
"initialStep",
|
|
6853
|
+
"displayStepTitle",
|
|
6854
|
+
"features"
|
|
6855
|
+
]);
|
|
6769
6856
|
const httpClient = useStableCallback(rest.httpClient);
|
|
6770
6857
|
const onCompletion = useStableCallback(rest.onCompletion);
|
|
6771
6858
|
const onCopy = useStableCallback(props.onCopy);
|
|
@@ -6821,6 +6908,7 @@ function useDynamicFlowCore(props) {
|
|
|
6821
6908
|
getErrorMessageFunctions,
|
|
6822
6909
|
trackEvent,
|
|
6823
6910
|
logEvent,
|
|
6911
|
+
features,
|
|
6824
6912
|
httpClient,
|
|
6825
6913
|
onBehavior,
|
|
6826
6914
|
onPoll,
|
package/build/main.mjs
CHANGED
|
@@ -1279,6 +1279,9 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
1279
1279
|
onBehavior
|
|
1280
1280
|
} = component;
|
|
1281
1281
|
const childrenProps = component.getChildren().map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
1282
|
+
const footerProps = component.footerComponents.map(
|
|
1283
|
+
(c) => componentToRendererProps(c, rendererMapperProps)
|
|
1284
|
+
);
|
|
1282
1285
|
return __spreadValues({
|
|
1283
1286
|
type: "step",
|
|
1284
1287
|
id: step.id,
|
|
@@ -1294,6 +1297,8 @@ var stepComponentToProps = (component, rendererMapperProps) => {
|
|
|
1294
1297
|
title,
|
|
1295
1298
|
children: childrenProps.map(rendererMapperProps.render),
|
|
1296
1299
|
childrenProps,
|
|
1300
|
+
footer: footerProps.map(rendererMapperProps.render),
|
|
1301
|
+
footerProps,
|
|
1297
1302
|
onAction: (action) => {
|
|
1298
1303
|
void onBehavior({ type: "action", action });
|
|
1299
1304
|
}
|
|
@@ -6170,12 +6175,63 @@ var mapToolbarToComponent = (uid, toolbar, mapperProps) => {
|
|
|
6170
6175
|
});
|
|
6171
6176
|
};
|
|
6172
6177
|
|
|
6178
|
+
// src/revamp/domain/mappers/utils/groupLayoutByPinned.ts
|
|
6179
|
+
var groupLayoutByPinned = (layouts) => {
|
|
6180
|
+
return layouts.reduce(groupLayout, { pinned: [], nonPinned: [] });
|
|
6181
|
+
};
|
|
6182
|
+
var groupLayout = (acc, layout) => {
|
|
6183
|
+
if (layout.type === "button" && layout.pinOrder !== void 0) {
|
|
6184
|
+
return {
|
|
6185
|
+
pinned: [...acc.pinned, layout],
|
|
6186
|
+
nonPinned: acc.nonPinned
|
|
6187
|
+
};
|
|
6188
|
+
}
|
|
6189
|
+
if (hasColumns(layout)) {
|
|
6190
|
+
const leftChildren = groupLayoutByPinned(layout.left);
|
|
6191
|
+
const rightChildren = groupLayoutByPinned(layout.right);
|
|
6192
|
+
return {
|
|
6193
|
+
pinned: [...acc.pinned, ...leftChildren.pinned, ...rightChildren.pinned],
|
|
6194
|
+
nonPinned: [
|
|
6195
|
+
...acc.nonPinned,
|
|
6196
|
+
__spreadProps(__spreadValues({}, layout), {
|
|
6197
|
+
left: leftChildren.nonPinned,
|
|
6198
|
+
right: rightChildren.nonPinned
|
|
6199
|
+
})
|
|
6200
|
+
]
|
|
6201
|
+
};
|
|
6202
|
+
}
|
|
6203
|
+
if (hasChildren(layout)) {
|
|
6204
|
+
const childComponents = groupLayoutByPinned(layout.components);
|
|
6205
|
+
return {
|
|
6206
|
+
pinned: [...acc.pinned, ...childComponents.pinned],
|
|
6207
|
+
nonPinned: [
|
|
6208
|
+
...acc.nonPinned,
|
|
6209
|
+
__spreadProps(__spreadValues({}, layout), {
|
|
6210
|
+
components: childComponents.nonPinned
|
|
6211
|
+
})
|
|
6212
|
+
]
|
|
6213
|
+
};
|
|
6214
|
+
}
|
|
6215
|
+
return {
|
|
6216
|
+
pinned: [...acc.pinned],
|
|
6217
|
+
nonPinned: [...acc.nonPinned, layout]
|
|
6218
|
+
};
|
|
6219
|
+
};
|
|
6220
|
+
var hasChildren = (component) => "components" in component;
|
|
6221
|
+
var hasColumns = (component) => "right" in component && "left" in component;
|
|
6222
|
+
|
|
6223
|
+
// src/revamp/domain/mappers/utils/feature-utils.ts
|
|
6224
|
+
var isFeatureEnabled = (features, featureName) => {
|
|
6225
|
+
return features[featureName] !== void 0 && features[featureName] !== false;
|
|
6226
|
+
};
|
|
6227
|
+
|
|
6173
6228
|
// src/revamp/domain/mappers/mapStepToComponent.ts
|
|
6174
6229
|
var mapStepToComponent = (_a) => {
|
|
6175
6230
|
var _b = _a, {
|
|
6176
6231
|
uid: rootUid,
|
|
6177
6232
|
loadingState,
|
|
6178
6233
|
displayStepTitle,
|
|
6234
|
+
features,
|
|
6179
6235
|
trackEvent,
|
|
6180
6236
|
onPoll,
|
|
6181
6237
|
onBehavior
|
|
@@ -6183,6 +6239,7 @@ var mapStepToComponent = (_a) => {
|
|
|
6183
6239
|
"uid",
|
|
6184
6240
|
"loadingState",
|
|
6185
6241
|
"displayStepTitle",
|
|
6242
|
+
"features",
|
|
6186
6243
|
"trackEvent",
|
|
6187
6244
|
"onPoll",
|
|
6188
6245
|
"onBehavior"
|
|
@@ -6229,9 +6286,26 @@ var mapStepToComponent = (_a) => {
|
|
|
6229
6286
|
mapperProps,
|
|
6230
6287
|
referencedSchemaIds
|
|
6231
6288
|
);
|
|
6232
|
-
const
|
|
6289
|
+
const shouldPinButtons = isFeatureEnabled(features, "pinnedButtons");
|
|
6290
|
+
const { pinned, nonPinned } = shouldPinButtons ? groupLayoutByPinned(layout) : { pinned: [], nonPinned: layout };
|
|
6291
|
+
const layoutComponents = nonPinned.map(
|
|
6233
6292
|
(layoutComponent, index) => mapLayoutToComponent(`${uid}.layout-${index}`, layoutComponent, mapperProps, schemaComponents)
|
|
6234
6293
|
);
|
|
6294
|
+
const footerComponents = pinned.map((footerComponent, index) => {
|
|
6295
|
+
if (index === pinned.length - 1 && footerComponent.margin === void 0) {
|
|
6296
|
+
return __spreadProps(__spreadValues({}, footerComponent), {
|
|
6297
|
+
margin: "xs"
|
|
6298
|
+
});
|
|
6299
|
+
}
|
|
6300
|
+
return footerComponent;
|
|
6301
|
+
}).map(
|
|
6302
|
+
(footerComponent, index) => mapLayoutToComponent(
|
|
6303
|
+
`${uid}.footer-${index}`,
|
|
6304
|
+
footerComponent,
|
|
6305
|
+
mapperProps,
|
|
6306
|
+
schemaComponents
|
|
6307
|
+
)
|
|
6308
|
+
);
|
|
6235
6309
|
const toolbar = mapToolbarToComponent(uid, step.toolbar, mapperProps);
|
|
6236
6310
|
const stepComponent = createStepComponent({
|
|
6237
6311
|
uid,
|
|
@@ -6239,6 +6313,7 @@ var mapStepToComponent = (_a) => {
|
|
|
6239
6313
|
toolbar,
|
|
6240
6314
|
layoutComponents,
|
|
6241
6315
|
schemaComponents,
|
|
6316
|
+
footerComponents,
|
|
6242
6317
|
control,
|
|
6243
6318
|
description,
|
|
6244
6319
|
error: errors == null ? void 0 : errors.error,
|
|
@@ -6722,7 +6797,19 @@ function useStableCallback(handler) {
|
|
|
6722
6797
|
|
|
6723
6798
|
// src/revamp/useDynamicFlowCore.tsx
|
|
6724
6799
|
function useDynamicFlowCore(props) {
|
|
6725
|
-
const _a = props, {
|
|
6800
|
+
const _a = props, {
|
|
6801
|
+
flowId,
|
|
6802
|
+
initialAction,
|
|
6803
|
+
initialStep,
|
|
6804
|
+
displayStepTitle = true,
|
|
6805
|
+
features = {}
|
|
6806
|
+
} = _a, rest = __objRest(_a, [
|
|
6807
|
+
"flowId",
|
|
6808
|
+
"initialAction",
|
|
6809
|
+
"initialStep",
|
|
6810
|
+
"displayStepTitle",
|
|
6811
|
+
"features"
|
|
6812
|
+
]);
|
|
6726
6813
|
const httpClient = useStableCallback(rest.httpClient);
|
|
6727
6814
|
const onCompletion = useStableCallback(rest.onCompletion);
|
|
6728
6815
|
const onCopy = useStableCallback(props.onCopy);
|
|
@@ -6778,6 +6865,7 @@ function useDynamicFlowCore(props) {
|
|
|
6778
6865
|
getErrorMessageFunctions,
|
|
6779
6866
|
trackEvent,
|
|
6780
6867
|
logEvent,
|
|
6868
|
+
features,
|
|
6781
6869
|
httpClient,
|
|
6782
6870
|
onBehavior,
|
|
6783
6871
|
onPoll,
|
|
@@ -14,6 +14,7 @@ export type StepDomainComponent = BaseComponent & {
|
|
|
14
14
|
toolbar?: ToolbarComponent;
|
|
15
15
|
layoutComponents: LayoutComponent[];
|
|
16
16
|
schemaComponents: SchemaComponent[];
|
|
17
|
+
footerComponents: LayoutComponent[];
|
|
17
18
|
control?: string;
|
|
18
19
|
description?: string;
|
|
19
20
|
error?: string;
|
|
@@ -40,7 +41,7 @@ type BackNavigation = {
|
|
|
40
41
|
title?: string;
|
|
41
42
|
onClick: () => void;
|
|
42
43
|
};
|
|
43
|
-
export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "back" | "toolbar" | "layoutComponents" | "schemaComponents" | "control" | "description" | "error" | "externalConfirmation" | "loadingState" | "step" | "title" | "trackEvent" | "onBehavior"> & {
|
|
44
|
+
export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "back" | "toolbar" | "layoutComponents" | "schemaComponents" | "footerComponents" | "control" | "description" | "error" | "externalConfirmation" | "loadingState" | "step" | "title" | "trackEvent" | "onBehavior"> & {
|
|
44
45
|
stepPolling?: StepPolling;
|
|
45
46
|
stepRefreshAfter?: StepRefreshAfter;
|
|
46
47
|
updateComponent: UpdateComponent;
|
|
@@ -7,5 +7,6 @@ export type StepMapperProps = Omit<MapperProps, 'trackEvent'> & {
|
|
|
7
7
|
loadingState: LoadingState;
|
|
8
8
|
trackEvent: AnalyticsEventDispatcher<string>;
|
|
9
9
|
onPoll: OnPoll;
|
|
10
|
+
features: Record<string, unknown>;
|
|
10
11
|
};
|
|
11
|
-
export declare const mapStepToComponent: ({ uid: rootUid, loadingState, displayStepTitle, trackEvent, onPoll, onBehavior, ...restProps }: StepMapperProps) => import("../components/step/StepDomainComponent").StepDomainComponent;
|
|
12
|
+
export declare const mapStepToComponent: ({ uid: rootUid, loadingState, displayStepTitle, features, trackEvent, onPoll, onBehavior, ...restProps }: StepMapperProps) => import("../components/step/StepDomainComponent").StepDomainComponent;
|
|
@@ -6,6 +6,7 @@ type DynamicFlowCorePropsBasic = {
|
|
|
6
6
|
displayStepTitle?: boolean;
|
|
7
7
|
httpClient: HttpClient;
|
|
8
8
|
renderers: Renderers;
|
|
9
|
+
features?: Record<string, unknown>;
|
|
9
10
|
onCompletion: (result: Model) => void;
|
|
10
11
|
onCopy?: (copiedString: string | null) => void;
|
|
11
12
|
onError: (error: unknown, status?: number) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.17.0",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.js",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"classnames": "2.5.1",
|
|
96
96
|
"react-webcam": "^7.2.0",
|
|
97
97
|
"screenfull": "^5.2.0",
|
|
98
|
-
"@wise/dynamic-flow-types": "3.
|
|
98
|
+
"@wise/dynamic-flow-types": "3.14.0"
|
|
99
99
|
},
|
|
100
100
|
"scripts": {
|
|
101
101
|
"dev": "pnpm build:visual-tests && storybook dev -p 3003",
|