@wise/dynamic-flow-client-internal 3.0.0-next-9cca10.1 → 3.0.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/README.md +39 -13
- package/build/main.css +17 -18
- package/build/main.js +2286 -1989
- package/build/main.min.js +8 -1
- package/build/types/dynamicFlow/DynamicFlow.d.ts +3 -3
- package/build/types/test-utils/NeptuneProviders.d.ts +3 -3
- package/build/types/test-utils/rtl-utils.d.ts +1 -1
- package/package.json +55 -59
package/README.md
CHANGED
|
@@ -44,30 +44,56 @@ import '@wise/dynamic-flow-client-internal/build/main.css';
|
|
|
44
44
|
|
|
45
45
|
The `DynamicFlow` component must be wraped in a Neptune `Provider` to support localisation, a `ThemeProvider` to provide theming, and a `SnackbarProvider` to ensure snackbars display correctly. Translations should be imported from both components and dynamic flows, merged, and passed to the `Provider` component (as below).
|
|
46
46
|
|
|
47
|
+
### For CRAB apps, use the `getLocalisedMessages(...)` function for translations
|
|
48
|
+
|
|
47
49
|
```js
|
|
48
50
|
import {
|
|
49
51
|
Provider,
|
|
50
52
|
SnackbarProvider,
|
|
51
53
|
translations as componentTranslations,
|
|
52
|
-
getLangFromLocale,
|
|
53
|
-
DEFAULT_LANG,
|
|
54
54
|
} from '@transferwise/components';
|
|
55
|
+
import { getLocalisedMessages } from '@transferwise/crab/client';
|
|
55
56
|
import {
|
|
56
57
|
DynamicFlow,
|
|
57
58
|
translations as dynamicFlowsTranslations,
|
|
58
|
-
} from '@wise/dynamic-flow-client-internal
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
messages
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
} from '@wise/dynamic-flow-client-internal';
|
|
60
|
+
|
|
61
|
+
const messages = getLocalisedMessages(locale, [componentTranslations, dynamicFlowsTranslations])
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<Provider i18n={{ locale, messages }}>
|
|
65
|
+
<ThemeProvider theme={theme} screenMode={screenMode}>
|
|
66
|
+
<SnackbarProvider>
|
|
67
|
+
<DynamicFlow {...props} />
|
|
68
|
+
</SnackbarProvider>
|
|
69
|
+
</ThemeProvider>
|
|
70
|
+
</Provider>
|
|
71
|
+
);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### For non-CRAB apps
|
|
75
|
+
|
|
76
|
+
You'll need to merge the '@transferwise/components' translations with the '@wise/dynamic-flow-client' translations.
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
import {
|
|
80
|
+
Provider,
|
|
81
|
+
SnackbarProvider,
|
|
82
|
+
translations as componentTranslations,
|
|
83
|
+
} from '@transferwise/components';
|
|
84
|
+
import {
|
|
85
|
+
DynamicFlow,
|
|
86
|
+
translations as dynamicFlowsTranslations,
|
|
87
|
+
} from '@wise/dynamic-flow-client-internal';
|
|
88
|
+
|
|
89
|
+
// create your messages object
|
|
90
|
+
const messages: Record<string, string> = {
|
|
91
|
+
...(componentTranslations[lang] || componentTranslations[lang.replace('-', '_')] || componentTranslations[lang.substring(0, 2)] || {}),
|
|
92
|
+
...(translations[lang] || translations[lang.replace('-', '_')] || translations[lang.substring(0, 2)] || {}),
|
|
93
|
+
}
|
|
68
94
|
|
|
69
95
|
return (
|
|
70
|
-
<Provider i18n={
|
|
96
|
+
<Provider i18n={{ locale, messages }}>
|
|
71
97
|
<ThemeProvider theme={theme} screenMode={screenMode}>
|
|
72
98
|
<SnackbarProvider>
|
|
73
99
|
<DynamicFlow {...props} />
|
package/build/main.css
CHANGED
|
@@ -129,25 +129,24 @@
|
|
|
129
129
|
.df-back-btn:active .tw-avatar__content {
|
|
130
130
|
background-color: var(--color-background-neutral-active);
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
height: 100%;
|
|
135
|
-
left: 0;
|
|
136
|
-
overflow: scroll;
|
|
132
|
+
.orientation-lock-overlay {
|
|
133
|
+
display: none;
|
|
137
134
|
position: fixed;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
135
|
+
inset: 0;
|
|
136
|
+
background-color: var(--color-dark);
|
|
137
|
+
color: var(--color-white);
|
|
138
|
+
font-size: var(--font-size-16);
|
|
139
|
+
font-weight: var(--font-weight-semi-bold);
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
align-items: center;
|
|
143
|
+
z-index: 1000;
|
|
144
|
+
padding: 24px;
|
|
141
145
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
overflow: scroll;
|
|
147
|
-
position: fixed;
|
|
148
|
-
top: 0;
|
|
149
|
-
width: 100%;
|
|
150
|
-
z-index: 10000;
|
|
146
|
+
@media screen and (orientation: landscape) and (height <= 767px) {
|
|
147
|
+
.orientation-lock-overlay {
|
|
148
|
+
display: flex;
|
|
149
|
+
}
|
|
151
150
|
}
|
|
152
151
|
.df-image {
|
|
153
152
|
display: flex;
|
|
@@ -172,7 +171,7 @@
|
|
|
172
171
|
width: 300px;
|
|
173
172
|
}
|
|
174
173
|
/* wide screens */
|
|
175
|
-
@media (
|
|
174
|
+
@media (width >= 576px) {
|
|
176
175
|
.df-image.xs img {
|
|
177
176
|
width: 100px;
|
|
178
177
|
}
|