@wise/dynamic-flow-client 4.10.0 → 4.11.0-experimental-189acbd

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 CHANGED
@@ -361,5 +361,5 @@ button.df-back-btn {
361
361
  flex-direction: column;
362
362
  }
363
363
  .chips-container {
364
- overflow-x: scroll;
364
+ overflow-x: auto;
365
365
  }
package/build/main.js CHANGED
@@ -2148,6 +2148,7 @@ var getCallToAction = ({ title, accessibilityDescription }, behavior, onBehavior
2148
2148
  switch (behavior.type) {
2149
2149
  case "action":
2150
2150
  case "modal":
2151
+ case "copy":
2151
2152
  case "dismiss": {
2152
2153
  return {
2153
2154
  type: behavior.type,
@@ -6558,6 +6559,7 @@ function useDynamicFlowCore(props) {
6558
6559
  const _a = props, { flowId, initialAction, initialStep, displayStepTitle = true } = _a, rest = __objRest(_a, ["flowId", "initialAction", "initialStep", "displayStepTitle"]);
6559
6560
  const httpClient = useStableCallback(rest.httpClient);
6560
6561
  const onCompletion = useStableCallback(rest.onCompletion);
6562
+ const onCopy = useStableCallback(props.onCopy);
6561
6563
  const onValueChange = useStableCallback(props.onValueChange);
6562
6564
  const onLink = useStableCallback(props.onLink);
6563
6565
  const onError = useStableCallback(rest.onError);
@@ -6691,6 +6693,10 @@ function useDynamicFlowCore(props) {
6691
6693
  }
6692
6694
  break;
6693
6695
  }
6696
+ case "copy": {
6697
+ navigator.clipboard.writeText(behavior.content).then(() => onCopy(behavior.content)).catch(() => onCopy(null));
6698
+ break;
6699
+ }
6694
6700
  case "non-merging-action": {
6695
6701
  rootComponentRef.current.dismissAllModals();
6696
6702
  const { action } = behavior;
package/build/main.mjs CHANGED
@@ -2105,6 +2105,7 @@ var getCallToAction = ({ title, accessibilityDescription }, behavior, onBehavior
2105
2105
  switch (behavior.type) {
2106
2106
  case "action":
2107
2107
  case "modal":
2108
+ case "copy":
2108
2109
  case "dismiss": {
2109
2110
  return {
2110
2111
  type: behavior.type,
@@ -6515,6 +6516,7 @@ function useDynamicFlowCore(props) {
6515
6516
  const _a = props, { flowId, initialAction, initialStep, displayStepTitle = true } = _a, rest = __objRest(_a, ["flowId", "initialAction", "initialStep", "displayStepTitle"]);
6516
6517
  const httpClient = useStableCallback(rest.httpClient);
6517
6518
  const onCompletion = useStableCallback(rest.onCompletion);
6519
+ const onCopy = useStableCallback(props.onCopy);
6518
6520
  const onValueChange = useStableCallback(props.onValueChange);
6519
6521
  const onLink = useStableCallback(props.onLink);
6520
6522
  const onError = useStableCallback(rest.onError);
@@ -6648,6 +6650,10 @@ function useDynamicFlowCore(props) {
6648
6650
  }
6649
6651
  break;
6650
6652
  }
6653
+ case "copy": {
6654
+ navigator.clipboard.writeText(behavior.content).then(() => onCopy(behavior.content)).catch(() => onCopy(null));
6655
+ break;
6656
+ }
6651
6657
  case "non-merging-action": {
6652
6658
  rootComponentRef.current.dismissAllModals();
6653
6659
  const { action } = behavior;
@@ -1,4 +1,4 @@
1
- import type { Action, ActionBehavior, DismissBehavior, Icon, JsonElement, LinkBehavior, Margin, ModalBehavior, Model } from '@wise/dynamic-flow-types/build/next';
1
+ import type { ActionBehavior, CopyBehavior, DismissBehavior, Icon, JsonElement, LinkBehavior, Margin, ModalBehavior, Model } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { AlertComponent } from './components/AlertComponent';
3
3
  import type { AllOfComponent } from './components/AllOfComponent';
4
4
  import type { BooleanInputComponent } from './components/BooleanInputComponent';
@@ -53,7 +53,7 @@ export interface LocalValueObject extends Record<string, LocalValuePrimitive | L
53
53
  export interface LocalValueArray extends Array<LocalValuePrimitive | LocalValueObject | LocalValueArray> {
54
54
  }
55
55
  export type CallToAction = {
56
- type: 'action' | 'modal' | 'dismiss';
56
+ type: 'action' | 'modal' | 'dismiss' | 'copy';
57
57
  title: string;
58
58
  accessibilityDescription?: string;
59
59
  onClick: () => void;
@@ -64,7 +64,7 @@ export type CallToAction = {
64
64
  href: string;
65
65
  onClick: () => void;
66
66
  };
67
- export type Behavior = (ActionBehavior | RefreshBehavior | LinkBehavior | ModalBehavior | DismissBehavior | NonMergingActionBehaviour | NullAction) & {
67
+ export type Behavior = (ActionBehavior | CopyBehavior | DismissBehavior | LinkBehavior | ModalBehavior | NonMergingActionBehaviour | NullAction | RefreshBehavior) & {
68
68
  analytics?: Record<string, unknown>;
69
69
  };
70
70
  type NonMergingActionBehaviour = Omit<ActionBehavior, 'type'> & {
@@ -127,7 +127,6 @@ export type BaseInputComponent<LV extends LocalValue> = BaseSchemaComponent<LV>
127
127
  };
128
128
  export type UpdateComponent = () => void;
129
129
  export type OnBehavior = (behavior: Behavior) => Promise<void>;
130
- export type OnAction = (action: Action) => Promise<void>;
131
130
  export type OnPoll = (url: string, errorBehavior: Behavior, signal: AbortSignal) => Promise<boolean>;
132
131
  export type OnLink = (url: string) => boolean;
133
132
  export type OnValueChange = () => void;
@@ -7,6 +7,7 @@ type DynamicFlowCorePropsBasic = {
7
7
  httpClient: HttpClient;
8
8
  renderers: Renderers;
9
9
  onCompletion: (result: Model) => void;
10
+ onCopy?: (copiedString: string | null) => void;
10
11
  onError: (error: unknown, status?: number) => void;
11
12
  onEvent?: AnalyticsEventHandler;
12
13
  onLog?: LoggingEventHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "4.10.0",
3
+ "version": "4.11.0-experimental-189acbd",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -42,8 +42,8 @@
42
42
  "@storybook/addon-docs": "^9.0.18",
43
43
  "@storybook/addon-links": "^9.0.18",
44
44
  "@storybook/react-vite": "9.0.18",
45
- "@testing-library/dom": "10.4.0",
46
- "@testing-library/jest-dom": "6.6.3",
45
+ "@testing-library/dom": "10.4.1",
46
+ "@testing-library/jest-dom": "6.6.4",
47
47
  "@testing-library/react": "16.3.0",
48
48
  "@testing-library/user-event": "14.6.1",
49
49
  "@transferwise/components": "46.100.1",
@@ -64,7 +64,7 @@
64
64
  "jest-environment-jsdom": "30.0.5",
65
65
  "jest-fetch-mock": "^3.0.3",
66
66
  "jest-watch-typeahead": "^3.0.1",
67
- "npm-run-all2": "7.0.2",
67
+ "npm-run-all2": "8.0.4",
68
68
  "postcss": "^8.5.6",
69
69
  "postcss-cli": "^11.0.1",
70
70
  "postcss-import": "^16.1.1",
@@ -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.8.1"
98
+ "@wise/dynamic-flow-types": "3.9.0-experimental-189acbd"
99
99
  },
100
100
  "scripts": {
101
101
  "dev": "pnpm build:visual-tests && storybook dev -p 3003",