@homefile/components-v2 2.63.1 → 2.64.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/dist/index.d.ts
CHANGED
|
@@ -7,5 +7,6 @@ export { homeAssistantWizardSteps, partnerWizardSteps } from './helpers';
|
|
|
7
7
|
export { billingProxy, dynamicFormProxy, homeCardProxy, partnerContentProxy, partnerDetailsProxy, paymentMethodProxy, recordsInputsProxy, recordsInputsToDBProxy, userDetailsProxy, confirmAddressProxy, addressProxy, } from './proxies';
|
|
8
8
|
import theme from './theme';
|
|
9
9
|
export { theme };
|
|
10
|
+
export { default as englishStrings } from './assets/locales/en/index.json';
|
|
10
11
|
export { Button, IconButton } from './components/button/Button';
|
|
11
12
|
export type { ButtonProps, IconButtonProps } from './components/button/Button';
|
package/dist/index.js
CHANGED
|
@@ -7,4 +7,8 @@ export { homeAssistantWizardSteps, partnerWizardSteps } from './helpers';
|
|
|
7
7
|
export { billingProxy, dynamicFormProxy, homeCardProxy, partnerContentProxy, partnerDetailsProxy, paymentMethodProxy, recordsInputsProxy, recordsInputsToDBProxy, userDetailsProxy, confirmAddressProxy, addressProxy, } from './proxies';
|
|
8
8
|
import theme from './theme';
|
|
9
9
|
export { theme };
|
|
10
|
+
// The English strings the components' t() keys resolve to ('signin.signinBt' →
|
|
11
|
+
// "Log in", …), so an app sets up i18next from the package entry, never from a
|
|
12
|
+
// dist/ path: resources: { en: { translation: englishStrings } }.
|
|
13
|
+
export { default as englishStrings } from './assets/locales/en/index.json';
|
|
10
14
|
export { Button, IconButton } from './components/button/Button';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { expect, within } from '@storybook/test';
|
|
12
|
+
import { Box, Text } from '@chakra-ui/react';
|
|
13
|
+
import * as packageEntry from '../../index';
|
|
14
|
+
import translateEN from '../../assets/locales/en/index.json';
|
|
15
|
+
/**
|
|
16
|
+
* The English strings, exported from the package entry as `englishStrings`.
|
|
17
|
+
*
|
|
18
|
+
* The screens call i18next's `t()` with keys ('signin.signinBt', …), so an app
|
|
19
|
+
* has to give i18next these strings. Until now the website could only reach
|
|
20
|
+
* them through a `dist/` path inside this package. The web connect page (R4)
|
|
21
|
+
* may not import from `dist/` (Vera V-1(b)), so the entry exports them and the
|
|
22
|
+
* app sets up i18next with:
|
|
23
|
+
*
|
|
24
|
+
* import { englishStrings } from '@homefile/components-v2'
|
|
25
|
+
* i18n.init({ lng: 'en', resources: { en: { translation: englishStrings } } })
|
|
26
|
+
*/
|
|
27
|
+
// Read through the entry's namespace, so this story loads (and fails its
|
|
28
|
+
// check) even where the entry has no such export.
|
|
29
|
+
const englishStrings = packageEntry.englishStrings;
|
|
30
|
+
// The keys the sign-in and code screens use, with the words they show.
|
|
31
|
+
const SIGN_IN_AND_CODE = {
|
|
32
|
+
'signin.signinBt': 'Log in',
|
|
33
|
+
'signin.forgotBt': 'Forgot Password?',
|
|
34
|
+
'signup.continueGoogle': 'Continue with Google',
|
|
35
|
+
'signup.or': 'or',
|
|
36
|
+
'forms.email': 'Email',
|
|
37
|
+
'forms.password': 'Password',
|
|
38
|
+
'reset.2FA.placeholder': 'Enter your code here',
|
|
39
|
+
'reset.2FA.resend': 'Resend new code',
|
|
40
|
+
'footer.copyright': 'HMFC, Inc. All Rights Reserved.',
|
|
41
|
+
};
|
|
42
|
+
const lookup = (strings, key) => key.split('.').reduce((node, part) => (node && typeof node === 'object' ? node[part] : undefined), strings);
|
|
43
|
+
const EnglishStringsTable = () => (_jsx(Box, { as: "dl", p: "base", children: Object.keys(SIGN_IN_AND_CODE).map((key) => {
|
|
44
|
+
var _a;
|
|
45
|
+
return (_jsxs(Box, { mb: "2", children: [_jsx(Text, { as: "dt", variant: "label", children: key }), _jsx(Text, { as: "dd", "data-key": key, children: String((_a = lookup(englishStrings, key)) !== null && _a !== void 0 ? _a : '(missing)') })] }, key));
|
|
46
|
+
}) }));
|
|
47
|
+
export default {
|
|
48
|
+
title: 'Foundations/English strings',
|
|
49
|
+
component: EnglishStringsTable,
|
|
50
|
+
};
|
|
51
|
+
export const FromThePackageEntry = {
|
|
52
|
+
render: () => _jsx(EnglishStringsTable, {}),
|
|
53
|
+
play: (_a) => __awaiter(void 0, [_a], void 0, function* ({ canvasElement }) {
|
|
54
|
+
var _b;
|
|
55
|
+
// The entry exports the English strings: the same object as the locale file.
|
|
56
|
+
yield expect(englishStrings).toBeDefined();
|
|
57
|
+
yield expect(englishStrings).toEqual(translateEN);
|
|
58
|
+
// Each key the sign-in and code screens use resolves to its words.
|
|
59
|
+
const canvas = within(canvasElement);
|
|
60
|
+
for (const [key, words] of Object.entries(SIGN_IN_AND_CODE)) {
|
|
61
|
+
yield expect(lookup(englishStrings, key)).toBe(words);
|
|
62
|
+
yield expect((_b = canvasElement.querySelector(`[data-key="${key}"]`)) === null || _b === void 0 ? void 0 : _b.textContent).toBe(words);
|
|
63
|
+
}
|
|
64
|
+
yield expect(canvas.queryByText('(missing)')).toBeNull();
|
|
65
|
+
}),
|
|
66
|
+
};
|