@blaze-cms/react-page-builder 0.125.0-alpha.14 → 0.125.0-alpha.18
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/CHANGELOG.md +28 -0
- package/README.md +7 -4
- package/example.env +1 -0
- package/lib/components/Banner/index.js +1 -1
- package/lib/components/Banner/index.js.map +1 -1
- package/lib/components/Card/Card.js +53 -25
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardContainer.js +2 -1
- package/lib/components/Card/CardContainer.js.map +1 -1
- package/lib/components/Card/constants.js +3 -1
- package/lib/components/Card/constants.js.map +1 -1
- package/lib/components/ContentGroup/ContentGroup.js +29 -0
- package/lib/components/ContentGroup/ContentGroup.js.map +1 -0
- package/lib/components/ContentGroup/ContentGroupTabs.js +94 -0
- package/lib/components/ContentGroup/ContentGroupTabs.js.map +1 -0
- package/lib/components/{Login → ContentGroup}/index.js +2 -2
- package/lib/components/ContentGroup/index.js.map +1 -0
- package/lib/components/ContentGroupSection/ContentGroupSection.js +30 -0
- package/lib/components/ContentGroupSection/ContentGroupSection.js.map +1 -0
- package/lib/components/{PasswordReset → ContentGroupSection}/index.js +2 -2
- package/lib/components/ContentGroupSection/index.js.map +1 -0
- package/lib/components/DataSummary/DataSummaryTypes/index.js +5 -5
- package/lib/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/index.js +1 -1
- package/lib/components/Image/GlobalLightbox/index.js.map +1 -1
- package/lib/components/LazyImage/index.js +1 -1
- package/lib/components/LazyImage/index.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRenderItem.js +2 -1
- package/lib/components/List/components/Cards/CardsRenderItem.js.map +1 -1
- package/lib/components/Video/providers/JWPlayer/JWPlayerController.js +2 -1
- package/lib/components/Video/providers/JWPlayer/JWPlayerController.js.map +1 -1
- package/lib/components/Video/providers/get-provider.js +4 -4
- package/lib/components/Video/providers/get-provider.js.map +1 -1
- package/lib/components/index.js +35 -40
- package/lib/components/index.js.map +1 -1
- package/lib/constants/index.js +2 -14
- package/lib/constants/index.js.map +1 -1
- package/lib/hooks/helpers/get-banners-by-type.js +1 -1
- package/lib/hooks/helpers/get-banners-by-type.js.map +1 -1
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -1
- package/lib-es/components/Card/Card.js +34 -8
- package/lib-es/components/Card/Card.js.map +1 -1
- package/lib-es/components/Card/CardContainer.js +2 -1
- package/lib-es/components/Card/CardContainer.js.map +1 -1
- package/lib-es/components/Card/constants.js +2 -1
- package/lib-es/components/Card/constants.js.map +1 -1
- package/lib-es/components/ContentGroup/ContentGroup.js +22 -0
- package/lib-es/components/ContentGroup/ContentGroup.js.map +1 -0
- package/lib-es/components/ContentGroup/ContentGroupTabs.js +72 -0
- package/lib-es/components/ContentGroup/ContentGroupTabs.js.map +1 -0
- package/lib-es/components/ContentGroup/index.js +3 -0
- package/lib-es/components/ContentGroup/index.js.map +1 -0
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js +23 -0
- package/lib-es/components/ContentGroupSection/ContentGroupSection.js.map +1 -0
- package/lib-es/components/ContentGroupSection/index.js +3 -0
- package/lib-es/components/ContentGroupSection/index.js.map +1 -0
- package/lib-es/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib-es/components/List/components/Cards/CardsRenderItem.js +2 -1
- package/lib-es/components/List/components/Cards/CardsRenderItem.js.map +1 -1
- package/lib-es/components/index.js +3 -4
- package/lib-es/components/index.js.map +1 -1
- package/lib-es/constants/index.js +1 -7
- package/lib-es/constants/index.js.map +1 -1
- package/lib-es/hooks/helpers/get-banners-by-type.js +1 -1
- package/lib-es/hooks/helpers/get-banners-by-type.js.map +1 -1
- package/lib-es/index.js +1 -1
- package/lib-es/index.js.map +1 -1
- package/package.json +7 -7
- package/src/components/Card/Card.js +37 -5
- package/src/components/Card/CardContainer.js +2 -1
- package/src/components/Card/constants.js +2 -1
- package/src/components/ContentGroup/ContentGroup.js +17 -0
- package/src/components/ContentGroup/ContentGroupTabs.js +74 -0
- package/src/components/ContentGroup/index.js +3 -0
- package/src/components/ContentGroupSection/ContentGroupSection.js +17 -0
- package/src/components/ContentGroupSection/index.js +3 -0
- package/src/components/List/components/Cards/CardsRender.js +1 -0
- package/src/components/List/components/Cards/CardsRenderItem.js +2 -1
- package/src/components/index.js +8 -8
- package/src/constants/index.js +0 -13
- package/src/hooks/helpers/get-banners-by-type.js +1 -1
- package/src/index.js +1 -1
- package/tests/unit/src/components/Card/Card.test.js +18 -7
- package/tests/unit/src/components/Card/__snapshots__/Card.test.js.snap +5 -0
- package/tests/unit/src/components/ContentGroup/ContentGroup.test.js +13 -0
- package/tests/unit/src/components/ContentGroup/ContentGroupTabs.test.js +16 -0
- package/tests/unit/src/components/ContentGroup/__snapshots__/ContentGroup.test.js.snap +5 -0
- package/tests/unit/src/components/ContentGroup/__snapshots__/ContentGroupTabs.test.js.snap +5 -0
- package/tests/unit/src/components/ContentGroupSection/ContentGroupSection.test.js +17 -0
- package/tests/unit/src/components/ContentGroupSection/__snapshots__/ContentGroupSection.test.js.snap +15 -0
- package/tests/unit/src/components/__snapshots__/index.test.js.snap +8 -12
- package/lib/components/Login/LoggedInMessage.js +0 -28
- package/lib/components/Login/LoggedInMessage.js.map +0 -1
- package/lib/components/Login/Login.js +0 -135
- package/lib/components/Login/Login.js.map +0 -1
- package/lib/components/Login/LoginForm.js +0 -112
- package/lib/components/Login/LoginForm.js.map +0 -1
- package/lib/components/Login/helpers/check-gtm-children.js +0 -42
- package/lib/components/Login/helpers/check-gtm-children.js.map +0 -1
- package/lib/components/Login/helpers/get-url-to-use.js +0 -18
- package/lib/components/Login/helpers/get-url-to-use.js.map +0 -1
- package/lib/components/Login/helpers/index.js +0 -22
- package/lib/components/Login/helpers/index.js.map +0 -1
- package/lib/components/Login/index.js.map +0 -1
- package/lib/components/PasswordReset/PasswordReset.js +0 -172
- package/lib/components/PasswordReset/PasswordReset.js.map +0 -1
- package/lib/components/PasswordReset/helpers/index.js +0 -15
- package/lib/components/PasswordReset/helpers/index.js.map +0 -1
- package/lib/components/PasswordReset/helpers/validatePassword.js +0 -16
- package/lib/components/PasswordReset/helpers/validatePassword.js.map +0 -1
- package/lib/components/PasswordReset/index.js.map +0 -1
- package/lib/components/PasswordResetRequest/PasswordResetRequest.js +0 -114
- package/lib/components/PasswordResetRequest/PasswordResetRequest.js.map +0 -1
- package/lib/components/PasswordResetRequest/index.js +0 -12
- package/lib/components/PasswordResetRequest/index.js.map +0 -1
- package/lib-es/components/Login/LoggedInMessage.js +0 -18
- package/lib-es/components/Login/LoggedInMessage.js.map +0 -1
- package/lib-es/components/Login/Login.js +0 -83
- package/lib-es/components/Login/Login.js.map +0 -1
- package/lib-es/components/Login/LoginForm.js +0 -89
- package/lib-es/components/Login/LoginForm.js.map +0 -1
- package/lib-es/components/Login/helpers/check-gtm-children.js +0 -35
- package/lib-es/components/Login/helpers/check-gtm-children.js.map +0 -1
- package/lib-es/components/Login/helpers/get-url-to-use.js +0 -10
- package/lib-es/components/Login/helpers/get-url-to-use.js.map +0 -1
- package/lib-es/components/Login/helpers/index.js +0 -4
- package/lib-es/components/Login/helpers/index.js.map +0 -1
- package/lib-es/components/Login/index.js +0 -3
- package/lib-es/components/Login/index.js.map +0 -1
- package/lib-es/components/PasswordReset/PasswordReset.js +0 -144
- package/lib-es/components/PasswordReset/PasswordReset.js.map +0 -1
- package/lib-es/components/PasswordReset/helpers/index.js +0 -3
- package/lib-es/components/PasswordReset/helpers/index.js.map +0 -1
- package/lib-es/components/PasswordReset/helpers/validatePassword.js +0 -7
- package/lib-es/components/PasswordReset/helpers/validatePassword.js.map +0 -1
- package/lib-es/components/PasswordReset/index.js +0 -3
- package/lib-es/components/PasswordReset/index.js.map +0 -1
- package/lib-es/components/PasswordResetRequest/PasswordResetRequest.js +0 -92
- package/lib-es/components/PasswordResetRequest/PasswordResetRequest.js.map +0 -1
- package/lib-es/components/PasswordResetRequest/index.js +0 -3
- package/lib-es/components/PasswordResetRequest/index.js.map +0 -1
- package/src/components/Login/LoggedInMessage.js +0 -24
- package/src/components/Login/Login.js +0 -74
- package/src/components/Login/LoginForm.js +0 -81
- package/src/components/Login/helpers/check-gtm-children.js +0 -30
- package/src/components/Login/helpers/get-url-to-use.js +0 -6
- package/src/components/Login/helpers/index.js +0 -4
- package/src/components/Login/index.js +0 -3
- package/src/components/PasswordReset/PasswordReset.js +0 -120
- package/src/components/PasswordReset/helpers/index.js +0 -3
- package/src/components/PasswordReset/helpers/validatePassword.js +0 -8
- package/src/components/PasswordReset/index.js +0 -3
- package/src/components/PasswordResetRequest/PasswordResetRequest.js +0 -82
- package/src/components/PasswordResetRequest/index.js +0 -3
- package/tests/unit/src/components/Login/Login.test.js +0 -36
- package/tests/unit/src/components/Login/__snapshots__/Login.test.js.snap +0 -103
- package/tests/unit/src/components/Login/helpers/check-gtm-children.test.js +0 -60
- package/tests/unit/src/components/Login/helpers/get-url-to-use.test.js +0 -15
- package/tests/unit/src/components/PasswordReset/PasswordReset.test.js +0 -85
- package/tests/unit/src/components/PasswordReset/__snapshots__/PasswordReset.test.js.snap +0 -83
- package/tests/unit/src/components/PasswordReset/helpers/validatePassword.test.js +0 -21
- package/tests/unit/src/components/PasswordResetRequest/PasswordResetRequest.test.js +0 -79
- package/tests/unit/src/components/PasswordResetRequest/__snapshots__/PasswordResetRequest.test.js.snap +0 -39
package/src/constants/index.js
CHANGED
|
@@ -35,10 +35,7 @@ const CATEGORY_ID = 'categoryId';
|
|
|
35
35
|
const PUBLISHED = 'published';
|
|
36
36
|
const ID = 'id';
|
|
37
37
|
const LINK = 'link';
|
|
38
|
-
const EMAIL = 'email';
|
|
39
|
-
const PASSWORD = 'password';
|
|
40
38
|
const LOGOUT = 'logout';
|
|
41
|
-
const LOGIN_FORM = 'loginForm';
|
|
42
39
|
const GRAPH_QL_ERROR = 'GraphQL error: ';
|
|
43
40
|
const HOVER = 'hover';
|
|
44
41
|
const MOUSE_ENTER = 'mouseenter';
|
|
@@ -130,10 +127,6 @@ const BREAKPOINT_SIZES = {
|
|
|
130
127
|
|
|
131
128
|
const MAX_BANNER_HEIGHT = 250;
|
|
132
129
|
const MIN_BANNER_HEIGHT = 90;
|
|
133
|
-
const PASSWORD_REGEX = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{8,}$/;
|
|
134
|
-
const PASSWORD_VALIDATION_MESSAGE =
|
|
135
|
-
'Must contain 8 or more characters with a mix of upper & lower case letters, numbers & symbols and no spaces';
|
|
136
|
-
const PASSWORD_CONFIRM_MESSAGE = 'Passwords must match';
|
|
137
130
|
const ALLOWED_BLOCK_TYPES = ['p', 'ul', 'ol'];
|
|
138
131
|
|
|
139
132
|
const PREHEADER_PROP = 'alternativePreHeader';
|
|
@@ -287,8 +280,6 @@ export {
|
|
|
287
280
|
LOAD_MORE,
|
|
288
281
|
CLASSIC,
|
|
289
282
|
BREAKPOINT_SIZES,
|
|
290
|
-
EMAIL,
|
|
291
|
-
PASSWORD,
|
|
292
283
|
LOGOUT,
|
|
293
284
|
MIN_BANNER_HEIGHT,
|
|
294
285
|
MAX_BANNER_HEIGHT,
|
|
@@ -305,10 +296,6 @@ export {
|
|
|
305
296
|
HIDDEN,
|
|
306
297
|
MENU_ITEM,
|
|
307
298
|
SUB_MENU,
|
|
308
|
-
LOGIN_FORM,
|
|
309
|
-
PASSWORD_REGEX,
|
|
310
|
-
PASSWORD_VALIDATION_MESSAGE,
|
|
311
|
-
PASSWORD_CONFIRM_MESSAGE,
|
|
312
299
|
ELEMENT,
|
|
313
300
|
ALLOWED_BLOCK_TYPES,
|
|
314
301
|
PREHEADER_PROP,
|
|
@@ -15,7 +15,7 @@ const getBannersByType = (items, bannerType) => {
|
|
|
15
15
|
type === PB_TYPE_BANNER && insertionType === PB_TYPE_TEXTBLOCK
|
|
16
16
|
);
|
|
17
17
|
|
|
18
|
-
const hasTextBlockBanners = textBlockBanners && textBlockBanners.length;
|
|
18
|
+
const hasTextBlockBanners = !!textBlockBanners && !!textBlockBanners.length;
|
|
19
19
|
|
|
20
20
|
return [hasTextBlockBanners, textBlockBanners];
|
|
21
21
|
}
|
package/src/index.js
CHANGED
|
@@ -11,7 +11,7 @@ export {
|
|
|
11
11
|
getSingleEntitySchema,
|
|
12
12
|
getUser
|
|
13
13
|
} from './application/query';
|
|
14
|
-
export { buildPropsQuery, getUnpublishedEntityName, renderChildren } from './helpers';
|
|
14
|
+
export { buildPropsQuery, getUnpublishedEntityName, renderChildren, hasChildren } from './helpers';
|
|
15
15
|
export { withTitle } from './HOC';
|
|
16
16
|
export { useGetEntitySchema, useGetEntitySchemasAsObj, useGetSingleEntitySchema } from './hooks';
|
|
17
17
|
export { summaryComponents } from './components/DataSummary/DataSummaryTypes';
|
|
@@ -16,8 +16,17 @@ const render = async (Component, props) => {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const CATEGORY = 'category-name';
|
|
19
|
-
|
|
20
|
-
const
|
|
19
|
+
|
|
20
|
+
const propsToDisplay = [
|
|
21
|
+
{
|
|
22
|
+
htmlAttribute: 'data-testid'
|
|
23
|
+
}
|
|
24
|
+
];
|
|
25
|
+
const getMockedParsedProp = children => <>{children}</>;
|
|
26
|
+
const firstPropValue = 'some description';
|
|
27
|
+
const secondPropValue = 'extra props';
|
|
28
|
+
const firstPropToDisplay = getMockedParsedProp(['', '', firstPropValue, '', '']);
|
|
29
|
+
const secondPropToDisplay = getMockedParsedProp(['', '', secondPropValue, '', '']);
|
|
21
30
|
|
|
22
31
|
const componentProps = {
|
|
23
32
|
id: 'id',
|
|
@@ -41,7 +50,8 @@ const componentProps = {
|
|
|
41
50
|
displayCategory: true,
|
|
42
51
|
displayThumbnail: true,
|
|
43
52
|
displayTitle: true,
|
|
44
|
-
propsToDisplay
|
|
53
|
+
propsToDisplay,
|
|
54
|
+
parsedPropsToDisplay: [firstPropToDisplay, secondPropToDisplay]
|
|
45
55
|
};
|
|
46
56
|
|
|
47
57
|
const preHeaderName = 'Pre header';
|
|
@@ -54,7 +64,8 @@ jest.mock('../../../../../src/components/LazyImage', () => ({ src, alt }) => (
|
|
|
54
64
|
|
|
55
65
|
describe('Card component', () => {
|
|
56
66
|
it('should render without throwing an error and match snapshot', async () => {
|
|
57
|
-
const { asFragment } = await render(Card, componentProps);
|
|
67
|
+
const { asFragment, getByTestId } = await render(Card, componentProps);
|
|
68
|
+
expect(getByTestId(encodeURIComponent(firstPropValue))).toBeDefined();
|
|
58
69
|
expect(asFragment()).toMatchSnapshot();
|
|
59
70
|
});
|
|
60
71
|
|
|
@@ -159,8 +170,8 @@ describe('Card component', () => {
|
|
|
159
170
|
const { getByText } = await render(Card, componentProps);
|
|
160
171
|
|
|
161
172
|
await waitFor(() => {
|
|
162
|
-
expect(getByText(
|
|
163
|
-
expect(getByText(
|
|
173
|
+
expect(getByText(firstPropValue)).toBeInTheDocument();
|
|
174
|
+
expect(getByText(secondPropValue)).toBeInTheDocument();
|
|
164
175
|
});
|
|
165
176
|
});
|
|
166
177
|
|
|
@@ -170,7 +181,7 @@ describe('Card component', () => {
|
|
|
170
181
|
const { getByText } = await render(Card, { ...componentProps, ...propsToDisplayModifiers });
|
|
171
182
|
|
|
172
183
|
await waitFor(() => {
|
|
173
|
-
const span = getByText(
|
|
184
|
+
const span = getByText(firstPropValue).closest('span');
|
|
174
185
|
expect(span).not.toHaveAttribute(modifier);
|
|
175
186
|
});
|
|
176
187
|
});
|
|
@@ -44,6 +44,7 @@ exports[`Card component should not render alternative headline if alternativePre
|
|
|
44
44
|
>
|
|
45
45
|
<span
|
|
46
46
|
class=""
|
|
47
|
+
data-testid="some%20description"
|
|
47
48
|
>
|
|
48
49
|
some description
|
|
49
50
|
</span>
|
|
@@ -112,6 +113,7 @@ exports[`Card component should not render alternative headline if displayCategor
|
|
|
112
113
|
>
|
|
113
114
|
<span
|
|
114
115
|
class=""
|
|
116
|
+
data-testid="some%20description"
|
|
115
117
|
>
|
|
116
118
|
some description
|
|
117
119
|
</span>
|
|
@@ -186,6 +188,7 @@ exports[`Card component should not render preHeader if alternativeHeadline is no
|
|
|
186
188
|
>
|
|
187
189
|
<span
|
|
188
190
|
class=""
|
|
191
|
+
data-testid="some%20description"
|
|
189
192
|
>
|
|
190
193
|
some description
|
|
191
194
|
</span>
|
|
@@ -259,6 +262,7 @@ exports[`Card component should render customPreheader and alternativeHeadline in
|
|
|
259
262
|
>
|
|
260
263
|
<span
|
|
261
264
|
class=""
|
|
265
|
+
data-testid="some%20description"
|
|
262
266
|
>
|
|
263
267
|
some description
|
|
264
268
|
</span>
|
|
@@ -333,6 +337,7 @@ exports[`Card component should render without throwing an error and match snapsh
|
|
|
333
337
|
>
|
|
334
338
|
<span
|
|
335
339
|
class=""
|
|
340
|
+
data-testid="some%20description"
|
|
336
341
|
>
|
|
337
342
|
some description
|
|
338
343
|
</span>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { render } from '@blaze-cms/tools/test-helpers/test-functions';
|
|
2
|
+
import ContentGroup from '../../../../../src/components/ContentGroup/ContentGroup';
|
|
3
|
+
|
|
4
|
+
describe('ContentGroup component', () => {
|
|
5
|
+
it('should match snapshot and render based on contentType prop', () => {
|
|
6
|
+
const { asFragment: tabContentGroup } = render(ContentGroup, { contentType: 'tab' });
|
|
7
|
+
const { asFragment: sidepanelContentGroup } = render(ContentGroup, {
|
|
8
|
+
contentType: 'sidepanel'
|
|
9
|
+
});
|
|
10
|
+
expect(tabContentGroup()).toMatchSnapshot();
|
|
11
|
+
expect(sidepanelContentGroup()).toMatchSnapshot();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { render } from '@blaze-cms/tools/test-helpers/test-functions';
|
|
2
|
+
import ContentGroupTabs from '../../../../../src/components/ContentGroup/ContentGroupTabs';
|
|
3
|
+
|
|
4
|
+
describe('ContentGroupTabs component', () => {
|
|
5
|
+
it('should match snapshot and render tabs content', () => {
|
|
6
|
+
const { asFragment: tabContentGroup } = render(ContentGroupTabs, { contentType: 'tab' });
|
|
7
|
+
expect(tabContentGroup()).toMatchSnapshot();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should match snapshot and render sidepanel content', () => {
|
|
11
|
+
const { asFragment: sidepanelContentGroup } = render(ContentGroupTabs, {
|
|
12
|
+
contentType: 'sidepanel'
|
|
13
|
+
});
|
|
14
|
+
expect(sidepanelContentGroup()).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`ContentGroup component should match snapshot and render based on contentType prop 1`] = `<DocumentFragment />`;
|
|
4
|
+
|
|
5
|
+
exports[`ContentGroup component should match snapshot and render based on contentType prop 2`] = `<DocumentFragment />`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`ContentGroupTabs component should match snapshot and render sidepanel content 1`] = `<DocumentFragment />`;
|
|
4
|
+
|
|
5
|
+
exports[`ContentGroupTabs component should match snapshot and render tabs content 1`] = `<DocumentFragment />`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@blaze-cms/tools/test-helpers/test-functions';
|
|
3
|
+
import ContentGroupSection from '../../../../../src/components/ContentGroupSection/ContentGroupSection';
|
|
4
|
+
|
|
5
|
+
describe('ContentGroupSection component', () => {
|
|
6
|
+
it('should not render if section has no children', () => {
|
|
7
|
+
const { asFragment: contentGroupSection } = render(ContentGroupSection);
|
|
8
|
+
expect(contentGroupSection()).toMatchSnapshot();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('should render if section has children', () => {
|
|
12
|
+
const { asFragment: contentGroupSection } = render(ContentGroupSection, {
|
|
13
|
+
children: [<div>child div</div>]
|
|
14
|
+
});
|
|
15
|
+
expect(contentGroupSection()).toMatchSnapshot();
|
|
16
|
+
});
|
|
17
|
+
});
|
package/tests/unit/src/components/ContentGroupSection/__snapshots__/ContentGroupSection.test.js.snap
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`ContentGroupSection component should not render if section has no children 1`] = `<DocumentFragment />`;
|
|
4
|
+
|
|
5
|
+
exports[`ContentGroupSection component should render if section has children 1`] = `
|
|
6
|
+
<DocumentFragment>
|
|
7
|
+
<div
|
|
8
|
+
class="content-group-section"
|
|
9
|
+
>
|
|
10
|
+
<div>
|
|
11
|
+
child div
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</DocumentFragment>
|
|
15
|
+
`;
|
|
@@ -34,6 +34,14 @@ Object {
|
|
|
34
34
|
"$$typeof": Symbol(react.forward_ref),
|
|
35
35
|
"render": [Function],
|
|
36
36
|
},
|
|
37
|
+
"contentgroup": Object {
|
|
38
|
+
"$$typeof": Symbol(react.forward_ref),
|
|
39
|
+
"render": [Function],
|
|
40
|
+
},
|
|
41
|
+
"contentgroupsection": Object {
|
|
42
|
+
"$$typeof": Symbol(react.forward_ref),
|
|
43
|
+
"render": [Function],
|
|
44
|
+
},
|
|
37
45
|
"datasummary": Object {
|
|
38
46
|
"$$typeof": Symbol(react.forward_ref),
|
|
39
47
|
"render": [Function],
|
|
@@ -62,10 +70,6 @@ Object {
|
|
|
62
70
|
"$$typeof": Symbol(react.forward_ref),
|
|
63
71
|
"render": [Function],
|
|
64
72
|
},
|
|
65
|
-
"login": Object {
|
|
66
|
-
"$$typeof": Symbol(react.forward_ref),
|
|
67
|
-
"render": [Function],
|
|
68
|
-
},
|
|
69
73
|
"menu": Object {
|
|
70
74
|
"$$typeof": Symbol(react.forward_ref),
|
|
71
75
|
"render": [Function],
|
|
@@ -78,14 +82,6 @@ Object {
|
|
|
78
82
|
"$$typeof": Symbol(react.forward_ref),
|
|
79
83
|
"render": [Function],
|
|
80
84
|
},
|
|
81
|
-
"passwordreset": Object {
|
|
82
|
-
"$$typeof": Symbol(react.forward_ref),
|
|
83
|
-
"render": [Function],
|
|
84
|
-
},
|
|
85
|
-
"passwordresetrequest": Object {
|
|
86
|
-
"$$typeof": Symbol(react.forward_ref),
|
|
87
|
-
"render": [Function],
|
|
88
|
-
},
|
|
89
85
|
"row": Object {
|
|
90
86
|
"$$typeof": Symbol(react.forward_ref),
|
|
91
87
|
"render": [Function],
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var LoggedInMessage = function LoggedInMessage(_ref) {
|
|
12
|
-
var goToUrl = _ref.goToUrl,
|
|
13
|
-
urlToUse = _ref.urlToUse;
|
|
14
|
-
return /*#__PURE__*/_react["default"].createElement("span", null, "You are already logged in please", ' ', /*#__PURE__*/_react["default"].createElement("a", {
|
|
15
|
-
onClick: function onClick(e) {
|
|
16
|
-
e.preventDefault();
|
|
17
|
-
goToUrl(true);
|
|
18
|
-
},
|
|
19
|
-
href: urlToUse
|
|
20
|
-
}, "click here"), ' ', "to reload your content access");
|
|
21
|
-
};
|
|
22
|
-
LoggedInMessage.propTypes = {
|
|
23
|
-
goToUrl: _propTypes["default"].func.isRequired,
|
|
24
|
-
urlToUse: _propTypes["default"].string.isRequired
|
|
25
|
-
};
|
|
26
|
-
var _default = LoggedInMessage;
|
|
27
|
-
exports["default"] = _default;
|
|
28
|
-
//# sourceMappingURL=LoggedInMessage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoggedInMessage.js","names":["LoggedInMessage","goToUrl","urlToUse","e","preventDefault","propTypes","PropTypes","func","isRequired","string"],"sources":["../../../src/components/Login/LoggedInMessage.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst LoggedInMessage = ({ goToUrl, urlToUse }) => (\n <span>\n You are already logged in please{' '}\n <a\n onClick={e => {\n e.preventDefault();\n goToUrl(true);\n }}\n href={urlToUse}>\n click here\n </a>{' '}\n to reload your content access\n </span>\n);\n\nLoggedInMessage.propTypes = {\n goToUrl: PropTypes.func.isRequired,\n urlToUse: PropTypes.string.isRequired\n};\n\nexport default LoggedInMessage;\n"],"mappings":";;;;;;;;AAAA;AACA;AAEA,IAAMA,eAAe,GAAG,SAAlBA,eAAe;EAAA,IAAMC,OAAO,QAAPA,OAAO;IAAEC,QAAQ,QAARA,QAAQ;EAAA,oBAC1C,kFACmC,GAAG,eACpC;IACE,OAAO,EAAE,iBAAAC,CAAC,EAAI;MACZA,CAAC,CAACC,cAAc,EAAE;MAClBH,OAAO,CAAC,IAAI,CAAC;IACf,CAAE;IACF,IAAI,EAAEC;EAAS,gBAEb,EAAC,GAAG,kCAEH;AAAA,CACR;AAEDF,eAAe,CAACK,SAAS,GAAG;EAC1BJ,OAAO,EAAEK,qBAAS,CAACC,IAAI,CAACC,UAAU;EAClCN,QAAQ,EAAEI,qBAAS,CAACG,MAAM,CAACD;AAC7B,CAAC;AAAC,eAEaR,eAAe;AAAA"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.array.iterator.js");
|
|
4
|
-
require("core-js/modules/es.object.to-string.js");
|
|
5
|
-
require("core-js/modules/es.string.iterator.js");
|
|
6
|
-
require("core-js/modules/es.weak-map.js");
|
|
7
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
|
-
require("core-js/modules/es.object.define-property.js");
|
|
9
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
10
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
11
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
12
|
-
Object.defineProperty(exports, "__esModule", {
|
|
13
|
-
value: true
|
|
14
|
-
});
|
|
15
|
-
exports["default"] = void 0;
|
|
16
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
17
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
18
|
-
require("core-js/modules/es.string.replace.js");
|
|
19
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
20
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
21
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
22
|
-
var _coreAuthUi = require("@blaze-cms/core-auth-ui");
|
|
23
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
24
|
-
var _client = require("@apollo/client");
|
|
25
|
-
var _router = require("next/router");
|
|
26
|
-
var _queryString = require("query-string");
|
|
27
|
-
var _LoggedInMessage = _interopRequireDefault(require("./LoggedInMessage"));
|
|
28
|
-
var _LoginForm = _interopRequireDefault(require("./LoginForm"));
|
|
29
|
-
var _helpers = require("./helpers");
|
|
30
|
-
var _constants = require("../../constants");
|
|
31
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
32
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
function shouldShowAlreadyLoggedInMessage(called) {
|
|
34
|
-
var _checkIfLoggedIn = (0, _coreAuthUi.checkIfLoggedIn)(),
|
|
35
|
-
isLoggedIn = _checkIfLoggedIn.isLoggedIn;
|
|
36
|
-
return !called && isLoggedIn;
|
|
37
|
-
}
|
|
38
|
-
var Login = function Login(_ref) {
|
|
39
|
-
var modifier = _ref.modifier,
|
|
40
|
-
url = _ref.url,
|
|
41
|
-
children = _ref.children;
|
|
42
|
-
var router = (0, _router.useRouter)();
|
|
43
|
-
var asPath = router.asPath;
|
|
44
|
-
var _parseUrl = (0, _queryString.parseUrl)(asPath),
|
|
45
|
-
_parseUrl$query = _parseUrl.query;
|
|
46
|
-
_parseUrl$query = _parseUrl$query === void 0 ? {} : _parseUrl$query;
|
|
47
|
-
var redirectUrl = _parseUrl$query.redirectUrl;
|
|
48
|
-
var _useState = (0, _react.useState)(false),
|
|
49
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
50
|
-
isLoginDone = _useState2[0],
|
|
51
|
-
setIsLoginDone = _useState2[1];
|
|
52
|
-
var _useState3 = (0, _react.useState)(null),
|
|
53
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
54
|
-
errorMessageToDisplay = _useState4[0],
|
|
55
|
-
setErrorMessage = _useState4[1];
|
|
56
|
-
var urlToUse = (0, _helpers.getUrlToUse)({
|
|
57
|
-
redirectUrl: redirectUrl,
|
|
58
|
-
url: url,
|
|
59
|
-
asPath: asPath
|
|
60
|
-
});
|
|
61
|
-
var goToUrl = function goToUrl(reload) {
|
|
62
|
-
urlToUse === asPath && reload ? router.reload() : router.push('/Resolver', urlToUse);
|
|
63
|
-
};
|
|
64
|
-
var _checkGtmChildren = (0, _helpers.checkGtmChildren)(children, goToUrl),
|
|
65
|
-
_checkGtmChildren2 = (0, _slicedToArray2["default"])(_checkGtmChildren, 2),
|
|
66
|
-
hasOnSuccessChildren = _checkGtmChildren2[0],
|
|
67
|
-
updatedChildren = _checkGtmChildren2[1];
|
|
68
|
-
var _useMutation = (0, _client.useMutation)(_coreAuthUi.LOGIN_MUTATION, {
|
|
69
|
-
update: function update(cache, _ref2) {
|
|
70
|
-
var data = _ref2.data;
|
|
71
|
-
return afterLogin(data);
|
|
72
|
-
},
|
|
73
|
-
onError: function onError(_ref3) {
|
|
74
|
-
var message = _ref3.message;
|
|
75
|
-
var parsedMessage = message.replace(_constants.GRAPH_QL_ERROR, '');
|
|
76
|
-
setErrorMessage(parsedMessage);
|
|
77
|
-
}
|
|
78
|
-
}),
|
|
79
|
-
_useMutation2 = (0, _slicedToArray2["default"])(_useMutation, 2),
|
|
80
|
-
loginMutation = _useMutation2[0],
|
|
81
|
-
_useMutation2$ = _useMutation2[1],
|
|
82
|
-
client = _useMutation2$.client,
|
|
83
|
-
called = _useMutation2$.called;
|
|
84
|
-
var afterLogin = /*#__PURE__*/function () {
|
|
85
|
-
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
|
|
86
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
87
|
-
while (1) {
|
|
88
|
-
switch (_context.prev = _context.next) {
|
|
89
|
-
case 0:
|
|
90
|
-
_context.next = 2;
|
|
91
|
-
return (0, _coreAuthUi.handleLogin)(data, client);
|
|
92
|
-
case 2:
|
|
93
|
-
if (_context.sent) {
|
|
94
|
-
_context.next = 4;
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
return _context.abrupt("return");
|
|
98
|
-
case 4:
|
|
99
|
-
if (!hasOnSuccessChildren) goToUrl();
|
|
100
|
-
setIsLoginDone(true);
|
|
101
|
-
case 6:
|
|
102
|
-
case "end":
|
|
103
|
-
return _context.stop();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}, _callee);
|
|
107
|
-
}));
|
|
108
|
-
return function afterLogin(_x) {
|
|
109
|
-
return _ref4.apply(this, arguments);
|
|
110
|
-
};
|
|
111
|
-
}();
|
|
112
|
-
var showAlreadyLoggedInMessage = shouldShowAlreadyLoggedInMessage(called);
|
|
113
|
-
var shouldRenderForm = !showAlreadyLoggedInMessage && !isLoginDone;
|
|
114
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, showAlreadyLoggedInMessage && /*#__PURE__*/_react["default"].createElement(_LoggedInMessage["default"], {
|
|
115
|
-
goToUrl: goToUrl,
|
|
116
|
-
urlToUse: urlToUse
|
|
117
|
-
}), shouldRenderForm && /*#__PURE__*/_react["default"].createElement(_LoginForm["default"], {
|
|
118
|
-
errorMessageToDisplay: errorMessageToDisplay,
|
|
119
|
-
loginMutation: loginMutation,
|
|
120
|
-
modifier: modifier
|
|
121
|
-
}), isLoginDone && updatedChildren);
|
|
122
|
-
};
|
|
123
|
-
Login.propTypes = {
|
|
124
|
-
modifier: _propTypes["default"].string,
|
|
125
|
-
url: _propTypes["default"].string,
|
|
126
|
-
children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node])
|
|
127
|
-
};
|
|
128
|
-
Login.defaultProps = {
|
|
129
|
-
modifier: '',
|
|
130
|
-
url: '',
|
|
131
|
-
children: null
|
|
132
|
-
};
|
|
133
|
-
var _default = Login;
|
|
134
|
-
exports["default"] = _default;
|
|
135
|
-
//# sourceMappingURL=Login.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Login.js","names":["shouldShowAlreadyLoggedInMessage","called","checkIfLoggedIn","isLoggedIn","Login","modifier","url","children","router","useRouter","asPath","parseUrl","query","redirectUrl","useState","isLoginDone","setIsLoginDone","errorMessageToDisplay","setErrorMessage","urlToUse","getUrlToUse","goToUrl","reload","push","checkGtmChildren","hasOnSuccessChildren","updatedChildren","useMutation","LOGIN_MUTATION","update","cache","data","afterLogin","onError","message","parsedMessage","replace","GRAPH_QL_ERROR","loginMutation","client","handleLogin","showAlreadyLoggedInMessage","shouldRenderForm","propTypes","PropTypes","string","oneOfType","arrayOf","node","defaultProps"],"sources":["../../../src/components/Login/Login.js"],"sourcesContent":["import React, { useState } from 'react';\nimport { handleLogin, checkIfLoggedIn, LOGIN_MUTATION } from '@blaze-cms/core-auth-ui';\nimport PropTypes from 'prop-types';\nimport { useMutation } from '@apollo/client';\nimport { useRouter } from 'next/router';\nimport { parseUrl } from 'query-string';\nimport LoggedInMessage from './LoggedInMessage';\nimport LoginForm from './LoginForm';\nimport { checkGtmChildren, getUrlToUse } from './helpers';\nimport { GRAPH_QL_ERROR } from '../../constants';\n\nfunction shouldShowAlreadyLoggedInMessage(called) {\n const { isLoggedIn } = checkIfLoggedIn();\n return !called && isLoggedIn;\n}\n\nconst Login = ({ modifier, url, children }) => {\n const router = useRouter();\n const { asPath } = router;\n const { query: { redirectUrl } = {} } = parseUrl(asPath);\n\n const [isLoginDone, setIsLoginDone] = useState(false);\n const [errorMessageToDisplay, setErrorMessage] = useState(null);\n const urlToUse = getUrlToUse({ redirectUrl, url, asPath });\n const goToUrl = reload => {\n urlToUse === asPath && reload ? router.reload() : router.push('/Resolver', urlToUse);\n };\n const [hasOnSuccessChildren, updatedChildren] = checkGtmChildren(children, goToUrl);\n\n const [loginMutation, { client, called }] = useMutation(LOGIN_MUTATION, {\n update: (cache, { data }) => afterLogin(data),\n onError: ({ message }) => {\n const parsedMessage = message.replace(GRAPH_QL_ERROR, '');\n setErrorMessage(parsedMessage);\n }\n });\n\n const afterLogin = async data => {\n if (!(await handleLogin(data, client))) return;\n if (!hasOnSuccessChildren) goToUrl();\n setIsLoginDone(true);\n };\n\n const showAlreadyLoggedInMessage = shouldShowAlreadyLoggedInMessage(called);\n const shouldRenderForm = !showAlreadyLoggedInMessage && !isLoginDone;\n\n return (\n <>\n {showAlreadyLoggedInMessage && <LoggedInMessage goToUrl={goToUrl} urlToUse={urlToUse} />}\n {shouldRenderForm && (\n <LoginForm\n errorMessageToDisplay={errorMessageToDisplay}\n loginMutation={loginMutation}\n modifier={modifier}\n />\n )}\n {isLoginDone && updatedChildren}\n </>\n );\n};\n\nLogin.propTypes = {\n modifier: PropTypes.string,\n url: PropTypes.string,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nLogin.defaultProps = {\n modifier: '',\n url: '',\n children: null\n};\n\nexport default Login;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAiD;AAAA;AAEjD,SAASA,gCAAgC,CAACC,MAAM,EAAE;EAChD,uBAAuB,IAAAC,2BAAe,GAAE;IAAhCC,UAAU,oBAAVA,UAAU;EAClB,OAAO,CAACF,MAAM,IAAIE,UAAU;AAC9B;AAEA,IAAMC,KAAK,GAAG,SAARA,KAAK,OAAoC;EAAA,IAA9BC,QAAQ,QAARA,QAAQ;IAAEC,GAAG,QAAHA,GAAG;IAAEC,QAAQ,QAARA,QAAQ;EACtC,IAAMC,MAAM,GAAG,IAAAC,iBAAS,GAAE;EAC1B,IAAQC,MAAM,GAAKF,MAAM,CAAjBE,MAAM;EACd,gBAAwC,IAAAC,qBAAQ,EAACD,MAAM,CAAC;IAAA,4BAAhDE,KAAK;EAAb,+CAAiC,CAAC,CAAC;EAAnC,IAAiBC,WAAW,mBAAXA,WAAW;EAE5B,gBAAsC,IAAAC,eAAQ,EAAC,KAAK,CAAC;IAAA;IAA9CC,WAAW;IAAEC,cAAc;EAClC,iBAAiD,IAAAF,eAAQ,EAAC,IAAI,CAAC;IAAA;IAAxDG,qBAAqB;IAAEC,eA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AAMS,0BAA0B,GAAGzC,gCAAgC,CAACC,MAAM,CAAC;EAC3E,IAAMyC,gBAAgB,GAAG,CAACD,0BAA0B,IAAI,CAAC1B,WAAW;EAEpE,oBACE,kEACG0B,0BAA0B,iBAAI,gCAAC,2BAAe;IAAC,OAAO,EAAEpB,OAAQ;IAAC,QAAQ,EAAEF;EAAS,EAAG,EACvFuB,gBAAgB,iBACf,gCAAC,qBAAS;IACR,qBAAqB,EAAEzB,qBAAsB;IAC7C,aAAa,EAAEqB,aAAc;IAC7B,QAAQ,EAAEjC;EAAS,EAEtB,EACAU,WAAW,IAAIW,eAAe,CAC9B;AAEP,CAAC;AAEDtB,KAAK,CAACuC,SAAS,GAAG;EAChBtC,QAAQ,EAAEuC,qBAAS,CAACC,MAAM;EAC1BvC,GAAG,EAAEsC,qBAAS,CAACC,MAAM;EACrBtC,QAAQ,EAAEqC,qBAAS,CAACE,SAAS,CAAC,CAACF,qBAAS,CAACG,OAAO,CAACH,qBAAS,CAACI,IAAI,CAAC,EAAEJ,qBAAS,CAACI,IAAI,CAAC;AACnF,CAAC;AAED5C,KAAK,CAAC6C,YAAY,GAAG;EACnB5C,QAAQ,EAAE,EAAE;EACZC,GAAG,EAAE,EAAE;EACPC,QAAQ,EAAE;AACZ,CAAC;AAAC,eAEaH,KAAK;AAAA"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.array.iterator.js");
|
|
4
|
-
require("core-js/modules/es.object.to-string.js");
|
|
5
|
-
require("core-js/modules/es.string.iterator.js");
|
|
6
|
-
require("core-js/modules/es.weak-map.js");
|
|
7
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
8
|
-
require("core-js/modules/es.object.define-property.js");
|
|
9
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
10
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
11
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
12
|
-
Object.defineProperty(exports, "__esModule", {
|
|
13
|
-
value: true
|
|
14
|
-
});
|
|
15
|
-
exports["default"] = void 0;
|
|
16
|
-
require("core-js/modules/es.function.name.js");
|
|
17
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
18
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
20
|
-
var _input = _interopRequireDefault(require("@blaze-react/input"));
|
|
21
|
-
var _button = _interopRequireDefault(require("@blaze-react/button"));
|
|
22
|
-
var _checkboxes = require("@blaze-react/checkboxes");
|
|
23
|
-
var _constants = require("../../constants");
|
|
24
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
26
|
-
var LoginForm = function LoginForm(_ref) {
|
|
27
|
-
var errorMessageToDisplay = _ref.errorMessageToDisplay,
|
|
28
|
-
loginMutation = _ref.loginMutation,
|
|
29
|
-
modifier = _ref.modifier;
|
|
30
|
-
var _useState = (0, _react.useState)(''),
|
|
31
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
32
|
-
email = _useState2[0],
|
|
33
|
-
setEmail = _useState2[1];
|
|
34
|
-
var _useState3 = (0, _react.useState)(''),
|
|
35
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
36
|
-
password = _useState4[0],
|
|
37
|
-
setPassword = _useState4[1];
|
|
38
|
-
var _useState5 = (0, _react.useState)(false),
|
|
39
|
-
_useState6 = (0, _slicedToArray2["default"])(_useState5, 2),
|
|
40
|
-
rememberMe = _useState6[0],
|
|
41
|
-
setRememberMe = _useState6[1];
|
|
42
|
-
var handleChange = function handleChange(_ref2) {
|
|
43
|
-
var event = _ref2.event;
|
|
44
|
-
var _event$target = event.target,
|
|
45
|
-
iName = _event$target.name,
|
|
46
|
-
iValue = _event$target.value;
|
|
47
|
-
if (iName === _constants.EMAIL) setEmail(iValue);
|
|
48
|
-
if (iName === _constants.PASSWORD) setPassword(iValue);
|
|
49
|
-
};
|
|
50
|
-
var isDisabled = !email || !password;
|
|
51
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("form", {
|
|
52
|
-
id: _constants.LOGIN_FORM,
|
|
53
|
-
className: modifier,
|
|
54
|
-
onSubmit: function onSubmit(e) {
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
if (isDisabled) return;
|
|
57
|
-
loginMutation({
|
|
58
|
-
variables: {
|
|
59
|
-
input: {
|
|
60
|
-
identity: email,
|
|
61
|
-
password: password,
|
|
62
|
-
rememberMe: rememberMe
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}, /*#__PURE__*/_react["default"].createElement(_input["default"], {
|
|
68
|
-
key: "email",
|
|
69
|
-
type: "email",
|
|
70
|
-
name: "email",
|
|
71
|
-
placeholder: "example@email.com",
|
|
72
|
-
label: "Email",
|
|
73
|
-
required: true,
|
|
74
|
-
onChange: handleChange,
|
|
75
|
-
value: email
|
|
76
|
-
}), /*#__PURE__*/_react["default"].createElement(_input["default"], {
|
|
77
|
-
key: "password",
|
|
78
|
-
type: "password",
|
|
79
|
-
name: "password",
|
|
80
|
-
label: "Password",
|
|
81
|
-
required: true,
|
|
82
|
-
onChange: handleChange,
|
|
83
|
-
value: password
|
|
84
|
-
}), /*#__PURE__*/_react["default"].createElement(_checkboxes.Checkbox, {
|
|
85
|
-
checked: rememberMe,
|
|
86
|
-
label: "Remember Me",
|
|
87
|
-
name: "rememberme",
|
|
88
|
-
id: "remember-me",
|
|
89
|
-
onChange: function onChange(_ref3) {
|
|
90
|
-
var checked = _ref3.value.checked;
|
|
91
|
-
return setRememberMe(checked);
|
|
92
|
-
}
|
|
93
|
-
}), !!errorMessageToDisplay && /*#__PURE__*/_react["default"].createElement("div", {
|
|
94
|
-
className: "error_message"
|
|
95
|
-
}, errorMessageToDisplay)), /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
96
|
-
type: "submit",
|
|
97
|
-
name: "button",
|
|
98
|
-
form: _constants.LOGIN_FORM,
|
|
99
|
-
disabled: isDisabled
|
|
100
|
-
}, "Login"));
|
|
101
|
-
};
|
|
102
|
-
LoginForm.propTypes = {
|
|
103
|
-
errorMessageToDisplay: _propTypes["default"].string,
|
|
104
|
-
modifier: _propTypes["default"].string.isRequired,
|
|
105
|
-
loginMutation: _propTypes["default"].func.isRequired
|
|
106
|
-
};
|
|
107
|
-
LoginForm.defaultProps = {
|
|
108
|
-
errorMessageToDisplay: _propTypes["default"].string.isRequired
|
|
109
|
-
};
|
|
110
|
-
var _default = LoginForm;
|
|
111
|
-
exports["default"] = _default;
|
|
112
|
-
//# sourceMappingURL=LoginForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoginForm.js","names":["LoginForm","errorMessageToDisplay","loginMutation","modifier","useState","email","setEmail","password","setPassword","rememberMe","setRememberMe","handleChange","event","target","iName","name","iValue","value","EMAIL","PASSWORD","isDisabled","LOGIN_FORM","e","preventDefault","variables","input","identity","checked","propTypes","PropTypes","string","isRequired","func","defaultProps"],"sources":["../../../src/components/Login/LoginForm.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport Input from '@blaze-react/input';\nimport Button from '@blaze-react/button';\nimport { Checkbox } from '@blaze-react/checkboxes';\nimport { EMAIL, PASSWORD, LOGIN_FORM } from '../../constants';\n\nconst LoginForm = ({ errorMessageToDisplay, loginMutation, modifier }) => {\n const [email, setEmail] = useState('');\n const [password, setPassword] = useState('');\n const [rememberMe, setRememberMe] = useState(false);\n\n const handleChange = ({ event }) => {\n const {\n target: { name: iName, value: iValue }\n } = event;\n\n if (iName === EMAIL) setEmail(iValue);\n if (iName === PASSWORD) setPassword(iValue);\n };\n\n const isDisabled = !email || !password;\n\n return (\n <>\n <form\n id={LOGIN_FORM}\n className={modifier}\n onSubmit={e => {\n e.preventDefault();\n if (isDisabled) return;\n loginMutation({\n variables: { input: { identity: email, password, rememberMe } }\n });\n }}>\n <Input\n key=\"email\"\n type=\"email\"\n name=\"email\"\n placeholder=\"example@email.com\"\n label=\"Email\"\n required\n onChange={handleChange}\n value={email}\n />\n <Input\n key=\"password\"\n type=\"password\"\n name=\"password\"\n label=\"Password\"\n required\n onChange={handleChange}\n value={password}\n />\n <Checkbox\n checked={rememberMe}\n label=\"Remember Me\"\n name=\"rememberme\"\n id=\"remember-me\"\n onChange={({ value: { checked } }) => setRememberMe(checked)}\n />\n {!!errorMessageToDisplay && <div className=\"error_message\">{errorMessageToDisplay}</div>}\n </form>\n <Button type=\"submit\" name=\"button\" form={LOGIN_FORM} disabled={isDisabled}>\n Login\n </Button>\n </>\n );\n};\n\nLoginForm.propTypes = {\n errorMessageToDisplay: PropTypes.string,\n modifier: PropTypes.string.isRequired,\n loginMutation: PropTypes.func.isRequired\n};\n\nLoginForm.defaultProps = {\n errorMessageToDisplay: PropTypes.string.isRequired\n};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property.js");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
-
require("core-js/modules/es.array.is-array.js");
|
|
11
|
-
require("core-js/modules/es.array.for-each.js");
|
|
12
|
-
require("core-js/modules/es.object.to-string.js");
|
|
13
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
14
|
-
require("core-js/modules/es.array.map.js");
|
|
15
|
-
var checkGtmChildren = function checkGtmChildren(children, handleOnSuccess) {
|
|
16
|
-
var hasOnSuccessChildren = false;
|
|
17
|
-
if (!children || Array.isArray(children)) return [hasOnSuccessChildren, children];
|
|
18
|
-
var _children$props$child = (0, _slicedToArray2["default"])(children.props.children, 2),
|
|
19
|
-
allChildren = _children$props$child[1];
|
|
20
|
-
if (allChildren && allChildren.length) {
|
|
21
|
-
allChildren.forEach(function (_ref) {
|
|
22
|
-
var props = _ref.props;
|
|
23
|
-
var _props$component = props.component;
|
|
24
|
-
_props$component = _props$component === void 0 ? {} : _props$component;
|
|
25
|
-
var gtmEvents = _props$component.settings.gtmEvents;
|
|
26
|
-
if (gtmEvents) {
|
|
27
|
-
gtmEvents = gtmEvents.map(function (gtmEvent) {
|
|
28
|
-
var updatedEvent = gtmEvent;
|
|
29
|
-
if (gtmEvent.eventTrigger === 'onSuccess') {
|
|
30
|
-
updatedEvent.handleOnSuccess = handleOnSuccess;
|
|
31
|
-
hasOnSuccessChildren = true;
|
|
32
|
-
}
|
|
33
|
-
return updatedEvent;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return [hasOnSuccessChildren, children];
|
|
39
|
-
};
|
|
40
|
-
var _default = checkGtmChildren;
|
|
41
|
-
exports["default"] = _default;
|
|
42
|
-
//# sourceMappingURL=check-gtm-children.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"check-gtm-children.js","names":["checkGtmChildren","children","handleOnSuccess","hasOnSuccessChildren","Array","isArray","props","allChildren","length","forEach","component","gtmEvents","settings","map","gtmEvent","updatedEvent","eventTrigger"],"sources":["../../../../src/components/Login/helpers/check-gtm-children.js"],"sourcesContent":["const checkGtmChildren = (children, handleOnSuccess) => {\n let hasOnSuccessChildren = false;\n if (!children || Array.isArray(children)) return [hasOnSuccessChildren, children];\n const {\n props: {\n children: [, allChildren]\n }\n } = children;\n\n if (allChildren && allChildren.length) {\n allChildren.forEach(({ props }) => {\n let { component: { settings: { gtmEvents } } = {} } = props;\n if (gtmEvents) {\n gtmEvents = gtmEvents.map(gtmEvent => {\n const updatedEvent = gtmEvent;\n if (gtmEvent.eventTrigger === 'onSuccess') {\n updatedEvent.handleOnSuccess = handleOnSuccess;\n hasOnSuccessChildren = true;\n }\n\n return updatedEvent;\n });\n }\n });\n }\n\n return [hasOnSuccessChildren, children];\n};\n\nexport default checkGtmChildren;\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAgB,CAAIC,QAAQ,EAAEC,eAAe,EAAK;EACtD,IAAIC,oBAAoB,GAAG,KAAK;EAChC,IAAI,CAACF,QAAQ,IAAIG,KAAK,CAACC,OAAO,CAACJ,QAAQ,CAAC,EAAE,OAAO,CAACE,oBAAoB,EAAEF,QAAQ,CAAC;EACjF,4DAIIA,QAAQ,CAHVK,KAAK,CACHL,QAAQ;IAAKM,WAAW;EAI5B,IAAIA,WAAW,IAAIA,WAAW,CAACC,MAAM,EAAE;IACrCD,WAAW,CAACE,OAAO,CAAC,gBAAe;MAAA,IAAZH,KAAK,QAALA,KAAK;MAC1B,uBAAsDA,KAAK,CAArDI,SAAS;MAAf,iDAA+C,CAAC,CAAC;MAAjD,IAA+BC,SAAS,oBAArBC,QAAQ,CAAID,SAAS;MACxC,IAAIA,SAAS,EAAE;QACbA,SAAS,GAAGA,SAAS,CAACE,GAAG,CAAC,UAAAC,QAAQ,EAAI;UACpC,IAAMC,YAAY,GAAGD,QAAQ;UAC7B,IAAIA,QAAQ,CAACE,YAAY,KAAK,WAAW,EAAE;YACzCD,YAAY,CAACb,eAAe,GAAGA,eAAe;YAC9CC,oBAAoB,GAAG,IAAI;UAC7B;UAEA,OAAOY,YAAY;QACrB,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;EACJ;EAEA,OAAO,CAACZ,oBAAoB,EAAEF,QAAQ,CAAC;AACzC,CAAC;AAAC,eAEaD,gBAAgB;AAAA"}
|