@blaze-cms/react-page-builder 0.125.0-alpha.15 → 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.
Files changed (125) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +2 -1
  3. package/lib/components/Banner/index.js +1 -1
  4. package/lib/components/Banner/index.js.map +1 -1
  5. package/lib/components/Card/Card.js +31 -22
  6. package/lib/components/Card/Card.js.map +1 -1
  7. package/lib/components/Card/CardContainer.js +2 -1
  8. package/lib/components/Card/CardContainer.js.map +1 -1
  9. package/lib/components/DataSummary/DataSummaryTypes/index.js +5 -5
  10. package/lib/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
  11. package/lib/components/Image/GlobalLightbox/index.js +1 -1
  12. package/lib/components/Image/GlobalLightbox/index.js.map +1 -1
  13. package/lib/components/LazyImage/index.js +1 -1
  14. package/lib/components/LazyImage/index.js.map +1 -1
  15. package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
  16. package/lib/components/List/components/Cards/CardsRenderItem.js +2 -1
  17. package/lib/components/List/components/Cards/CardsRenderItem.js.map +1 -1
  18. package/lib/components/Video/providers/JWPlayer/JWPlayerController.js +2 -1
  19. package/lib/components/Video/providers/JWPlayer/JWPlayerController.js.map +1 -1
  20. package/lib/components/Video/providers/get-provider.js +4 -4
  21. package/lib/components/Video/providers/get-provider.js.map +1 -1
  22. package/lib/components/index.js +28 -43
  23. package/lib/components/index.js.map +1 -1
  24. package/lib/constants/index.js +2 -14
  25. package/lib/constants/index.js.map +1 -1
  26. package/lib/index.js +6 -0
  27. package/lib/index.js.map +1 -1
  28. package/lib-es/components/Card/Card.js +15 -5
  29. package/lib-es/components/Card/Card.js.map +1 -1
  30. package/lib-es/components/Card/CardContainer.js +2 -1
  31. package/lib-es/components/Card/CardContainer.js.map +1 -1
  32. package/lib-es/components/List/components/Cards/CardsRender.js.map +1 -1
  33. package/lib-es/components/List/components/Cards/CardsRenderItem.js +2 -1
  34. package/lib-es/components/List/components/Cards/CardsRenderItem.js.map +1 -1
  35. package/lib-es/components/index.js +0 -3
  36. package/lib-es/components/index.js.map +1 -1
  37. package/lib-es/constants/index.js +1 -7
  38. package/lib-es/constants/index.js.map +1 -1
  39. package/lib-es/index.js +1 -1
  40. package/lib-es/index.js.map +1 -1
  41. package/package.json +7 -7
  42. package/src/components/Card/Card.js +13 -3
  43. package/src/components/Card/CardContainer.js +2 -1
  44. package/src/components/List/components/Cards/CardsRender.js +1 -0
  45. package/src/components/List/components/Cards/CardsRenderItem.js +2 -1
  46. package/src/components/index.js +1 -7
  47. package/src/constants/index.js +0 -13
  48. package/src/index.js +1 -1
  49. package/tests/unit/src/components/Card/Card.test.js +18 -7
  50. package/tests/unit/src/components/Card/__snapshots__/Card.test.js.snap +5 -0
  51. package/tests/unit/src/components/__snapshots__/index.test.js.snap +0 -12
  52. package/lib/components/Login/LoggedInMessage.js +0 -28
  53. package/lib/components/Login/LoggedInMessage.js.map +0 -1
  54. package/lib/components/Login/Login.js +0 -135
  55. package/lib/components/Login/Login.js.map +0 -1
  56. package/lib/components/Login/LoginForm.js +0 -112
  57. package/lib/components/Login/LoginForm.js.map +0 -1
  58. package/lib/components/Login/helpers/check-gtm-children.js +0 -42
  59. package/lib/components/Login/helpers/check-gtm-children.js.map +0 -1
  60. package/lib/components/Login/helpers/get-url-to-use.js +0 -18
  61. package/lib/components/Login/helpers/get-url-to-use.js.map +0 -1
  62. package/lib/components/Login/helpers/index.js +0 -22
  63. package/lib/components/Login/helpers/index.js.map +0 -1
  64. package/lib/components/Login/index.js +0 -12
  65. package/lib/components/Login/index.js.map +0 -1
  66. package/lib/components/PasswordReset/PasswordReset.js +0 -172
  67. package/lib/components/PasswordReset/PasswordReset.js.map +0 -1
  68. package/lib/components/PasswordReset/helpers/index.js +0 -15
  69. package/lib/components/PasswordReset/helpers/index.js.map +0 -1
  70. package/lib/components/PasswordReset/helpers/validatePassword.js +0 -16
  71. package/lib/components/PasswordReset/helpers/validatePassword.js.map +0 -1
  72. package/lib/components/PasswordReset/index.js +0 -12
  73. package/lib/components/PasswordReset/index.js.map +0 -1
  74. package/lib/components/PasswordResetRequest/PasswordResetRequest.js +0 -114
  75. package/lib/components/PasswordResetRequest/PasswordResetRequest.js.map +0 -1
  76. package/lib/components/PasswordResetRequest/index.js +0 -12
  77. package/lib/components/PasswordResetRequest/index.js.map +0 -1
  78. package/lib-es/components/Login/LoggedInMessage.js +0 -18
  79. package/lib-es/components/Login/LoggedInMessage.js.map +0 -1
  80. package/lib-es/components/Login/Login.js +0 -83
  81. package/lib-es/components/Login/Login.js.map +0 -1
  82. package/lib-es/components/Login/LoginForm.js +0 -89
  83. package/lib-es/components/Login/LoginForm.js.map +0 -1
  84. package/lib-es/components/Login/helpers/check-gtm-children.js +0 -35
  85. package/lib-es/components/Login/helpers/check-gtm-children.js.map +0 -1
  86. package/lib-es/components/Login/helpers/get-url-to-use.js +0 -10
  87. package/lib-es/components/Login/helpers/get-url-to-use.js.map +0 -1
  88. package/lib-es/components/Login/helpers/index.js +0 -4
  89. package/lib-es/components/Login/helpers/index.js.map +0 -1
  90. package/lib-es/components/Login/index.js +0 -3
  91. package/lib-es/components/Login/index.js.map +0 -1
  92. package/lib-es/components/PasswordReset/PasswordReset.js +0 -144
  93. package/lib-es/components/PasswordReset/PasswordReset.js.map +0 -1
  94. package/lib-es/components/PasswordReset/helpers/index.js +0 -3
  95. package/lib-es/components/PasswordReset/helpers/index.js.map +0 -1
  96. package/lib-es/components/PasswordReset/helpers/validatePassword.js +0 -7
  97. package/lib-es/components/PasswordReset/helpers/validatePassword.js.map +0 -1
  98. package/lib-es/components/PasswordReset/index.js +0 -3
  99. package/lib-es/components/PasswordReset/index.js.map +0 -1
  100. package/lib-es/components/PasswordResetRequest/PasswordResetRequest.js +0 -92
  101. package/lib-es/components/PasswordResetRequest/PasswordResetRequest.js.map +0 -1
  102. package/lib-es/components/PasswordResetRequest/index.js +0 -3
  103. package/lib-es/components/PasswordResetRequest/index.js.map +0 -1
  104. package/src/components/Login/LoggedInMessage.js +0 -24
  105. package/src/components/Login/Login.js +0 -74
  106. package/src/components/Login/LoginForm.js +0 -81
  107. package/src/components/Login/helpers/check-gtm-children.js +0 -30
  108. package/src/components/Login/helpers/get-url-to-use.js +0 -6
  109. package/src/components/Login/helpers/index.js +0 -4
  110. package/src/components/Login/index.js +0 -3
  111. package/src/components/PasswordReset/PasswordReset.js +0 -120
  112. package/src/components/PasswordReset/helpers/index.js +0 -3
  113. package/src/components/PasswordReset/helpers/validatePassword.js +0 -8
  114. package/src/components/PasswordReset/index.js +0 -3
  115. package/src/components/PasswordResetRequest/PasswordResetRequest.js +0 -82
  116. package/src/components/PasswordResetRequest/index.js +0 -3
  117. package/tests/unit/src/components/Login/Login.test.js +0 -36
  118. package/tests/unit/src/components/Login/__snapshots__/Login.test.js.snap +0 -103
  119. package/tests/unit/src/components/Login/helpers/check-gtm-children.test.js +0 -60
  120. package/tests/unit/src/components/Login/helpers/get-url-to-use.test.js +0 -15
  121. package/tests/unit/src/components/PasswordReset/PasswordReset.test.js +0 -85
  122. package/tests/unit/src/components/PasswordReset/__snapshots__/PasswordReset.test.js.snap +0 -83
  123. package/tests/unit/src/components/PasswordReset/helpers/validatePassword.test.js +0 -21
  124. package/tests/unit/src/components/PasswordResetRequest/PasswordResetRequest.test.js +0 -79
  125. package/tests/unit/src/components/PasswordResetRequest/__snapshots__/PasswordResetRequest.test.js.snap +0 -39
@@ -1,103 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Login component should render rederict link if logged in 1`] = `
4
- <DocumentFragment>
5
- <span>
6
- You are already logged in please
7
- <a
8
- href=""
9
- >
10
- click here
11
- </a>
12
- to reload your content access
13
- </span>
14
- </DocumentFragment>
15
- `;
16
-
17
- exports[`Login component should render without throwing an error and match snapshot 1`] = `
18
- <DocumentFragment>
19
- <form
20
- class=""
21
- id="loginForm"
22
- >
23
- <div
24
- class="form-field form-field--input "
25
- >
26
- <label
27
- class="required"
28
- >
29
- Email
30
- </label>
31
- <input
32
- data-testid="input"
33
- name="email"
34
- placeholder="example@email.com"
35
- required=""
36
- type="email"
37
- value=""
38
- />
39
- </div>
40
- <div
41
- class="form-field form-field--input form-field--password"
42
- >
43
- <label
44
- class="required"
45
- >
46
- Password
47
- </label>
48
- <input
49
- data-testid="input"
50
- name="password"
51
- required=""
52
- type="password"
53
- value=""
54
- />
55
- <span
56
- class="show-hide-password active"
57
- data-testid="toggle-input-type"
58
- role="button"
59
- >
60
- Show
61
- <i
62
- class="material-icons"
63
- >
64
- visibility_off
65
- </i>
66
- </span>
67
- </div>
68
- <div
69
- class="form-field form-field--checkbox"
70
- role="button"
71
- >
72
- <input
73
- class="form-checkbox"
74
- id="remember-me-checkbox"
75
- name="rememberme"
76
- readonly=""
77
- type="checkbox"
78
- value=""
79
- />
80
- <div
81
- class=""
82
- >
83
- <label
84
- for="remember-me-checkbox"
85
- >
86
- <span>
87
- Remember Me
88
- </span>
89
- </label>
90
- </div>
91
- </div>
92
- </form>
93
- <button
94
- class="button "
95
- disabled=""
96
- form="loginForm"
97
- name="button"
98
- type="submit"
99
- >
100
- Login
101
- </button>
102
- </DocumentFragment>
103
- `;
@@ -1,60 +0,0 @@
1
- import { checkGtmChildren } from '../../../../../../src/components/Login/helpers';
2
-
3
- const mockedChildren = [
4
- {
5
- props: {
6
- children: [false, [{ props: { component: { settings: {} } } }]]
7
- }
8
- },
9
- {
10
- props: {
11
- children: [
12
- false,
13
- [{ props: { component: { settings: { gtmEvents: [{ eventTrigger: 'onLoad' }] } } } }]
14
- ]
15
- }
16
- },
17
- {
18
- props: {
19
- children: [
20
- false,
21
- [{ props: { component: { settings: { gtmEvents: [{ eventTrigger: 'onSuccess' }] } } } }]
22
- ]
23
- }
24
- }
25
- ];
26
-
27
- describe('checkGtmChildrenhelper', () => {
28
- const noParams = checkGtmChildren();
29
- const emptyChildren = checkGtmChildren([]);
30
- const childrenWithNoGtm = checkGtmChildren(mockedChildren[0]);
31
- const childrenWithGtm = checkGtmChildren(mockedChildren[1]);
32
- const childrenWithOnSuccessGtm = checkGtmChildren(mockedChildren[2], () => {});
33
-
34
- it('should always return an array with 2 elements', () => {
35
- expect(Array.isArray(noParams)).toEqual(true);
36
- expect(noParams.length).toEqual(2);
37
- expect(Array.isArray(emptyChildren)).toEqual(true);
38
- expect(emptyChildren.length).toEqual(2);
39
- expect(Array.isArray(childrenWithNoGtm)).toEqual(true);
40
- expect(childrenWithNoGtm.length).toEqual(2);
41
- expect(Array.isArray(childrenWithGtm)).toEqual(true);
42
- expect(childrenWithGtm.length).toEqual(2);
43
- expect(Array.isArray(childrenWithOnSuccessGtm)).toEqual(true);
44
- expect(childrenWithOnSuccessGtm.length).toEqual(2);
45
- });
46
-
47
- it('if no valid onSuccess children are passed the first value in the array should be false', () => {
48
- expect(noParams[0]).toEqual(false);
49
- expect(emptyChildren[0]).toEqual(false);
50
- expect(childrenWithNoGtm[0]).toEqual(false);
51
- expect(childrenWithGtm[0]).toEqual(false);
52
- });
53
-
54
- it('otherwise first value should be true and children should be updated with the handleOnSuccess function', () => {
55
- expect(childrenWithOnSuccessGtm[0]).toEqual(true);
56
- expect(
57
- childrenWithOnSuccessGtm[1].props.children[1][0].props.component.settings.gtmEvents[0]
58
- ).toHaveProperty('handleOnSuccess');
59
- });
60
- });
@@ -1,15 +0,0 @@
1
- import { getUrlToUse } from '../../../../../../src/components/Login/helpers';
2
-
3
- describe('Get url to use helper', () => {
4
- it('should return url to use based on props passed', () => {
5
- const singleRedirect = getUrlToUse({ redirectUrl: 'redirect' });
6
- const arrayRedirect = getUrlToUse({ redirectUrl: ['multi-redirect'] });
7
- const baseUrl = getUrlToUse({ redirectUrl: 'base' });
8
- const asPathUrl = getUrlToUse({ redirectUrl: 'asPath' });
9
-
10
- expect(singleRedirect).toEqual('redirect');
11
- expect(arrayRedirect).toEqual('multi-redirect');
12
- expect(baseUrl).toEqual('base');
13
- expect(asPathUrl).toEqual('asPath');
14
- });
15
- });
@@ -1,85 +0,0 @@
1
- import '@testing-library/jest-dom/extend-expect';
2
- import React from 'react';
3
- import { RESET_USER_PASSWORD_MUTATION } from '@blaze-cms/core-auth-ui';
4
- import { fireEvent, render, queryByAttribute, waitFor } from '@testing-library/react';
5
- import { MockedProvider } from '@apollo/client/testing';
6
- import PasswordReset from '../../../../../src/components/PasswordReset';
7
-
8
- jest.mock('next/router', () => ({
9
- useRouter: jest.fn(() => ({ asPath: 'test-url?token=123' }))
10
- }));
11
-
12
- const getById = queryByAttribute.bind(null, 'id');
13
- const validPassword = 'NewPassword$123';
14
- const mocks = [
15
- {
16
- request: {
17
- query: RESET_USER_PASSWORD_MUTATION,
18
- variables: {
19
- input: { token: '123', password: validPassword }
20
- }
21
- },
22
- result: {
23
- data: {
24
- resetUserPasswordResult: {
25
- result: { result: true, extras: { redirectUrl: 'redirect-url' } }
26
- }
27
- }
28
- }
29
- }
30
- ];
31
-
32
- const setup = () => {
33
- const resetComponent = render(
34
- <MockedProvider mocks={mocks}>
35
- <PasswordReset>
36
- <div>child</div>
37
- </PasswordReset>
38
- </MockedProvider>
39
- );
40
-
41
- const passWordInput = getById(resetComponent.container, 'password');
42
- const passWordConfirmInput = getById(resetComponent.container, 'passwordConfirm');
43
- const button = resetComponent.getByText('Reset Password');
44
-
45
- return { resetComponent, button, passWordInput, passWordConfirmInput };
46
- };
47
-
48
- describe('PasswordResetRequest component', () => {
49
- it('should render without throwing an error if token is present', () => {
50
- const {
51
- resetComponent: { asFragment }
52
- } = setup();
53
- expect(asFragment()).toMatchSnapshot();
54
- });
55
-
56
- it('button should be disabled if no passord or passwordConfirm is entered', () => {
57
- const { button } = setup();
58
- expect(button).toHaveAttribute('disabled');
59
- });
60
-
61
- it('button should not be disabled if both password fields have value', () => {
62
- const { passWordInput, passWordConfirmInput, button } = setup();
63
- fireEvent.change(passWordInput, { target: { value: '123' } });
64
- fireEvent.change(passWordConfirmInput, { target: { value: '234' } });
65
- expect(button).not.toBeDisabled();
66
- });
67
-
68
- it('should call PasswordReset mutation and render children if password and passwordConfirm match', async () => {
69
- const { passWordInput, passWordConfirmInput, button, resetComponent } = setup();
70
- fireEvent.change(passWordInput, { target: { value: validPassword } });
71
- fireEvent.change(passWordConfirmInput, { target: { value: validPassword } });
72
- fireEvent(
73
- button,
74
- new MouseEvent('click', {
75
- bubbles: true,
76
- cancelable: true
77
- })
78
- );
79
-
80
- await waitFor(() => {
81
- const renderedChildren = resetComponent.getByText('child');
82
- expect(renderedChildren).toBeDefined();
83
- });
84
- });
85
- });
@@ -1,83 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`PasswordResetRequest component should render without throwing an error if token is present 1`] = `
4
- <DocumentFragment>
5
- <div
6
- class=""
7
- >
8
- <form
9
- id="passwordReset"
10
- >
11
- <div
12
- class="form-field form-field--input form-field--password"
13
- >
14
- <label
15
- class="required"
16
- for="password"
17
- >
18
- Password
19
- </label>
20
- <input
21
- data-testid="input"
22
- id="password"
23
- name="password"
24
- required=""
25
- type="password"
26
- value=""
27
- />
28
- <span
29
- class="show-hide-password active"
30
- data-testid="toggle-input-type"
31
- role="button"
32
- >
33
- Show
34
- <i
35
- class="material-icons"
36
- >
37
- visibility_off
38
- </i>
39
- </span>
40
- </div>
41
- <div
42
- class="form-field form-field--input form-field--password"
43
- >
44
- <label
45
- class="required"
46
- for="passwordConfirm"
47
- >
48
- Confirm New Password
49
- </label>
50
- <input
51
- data-testid="input"
52
- id="passwordConfirm"
53
- name="passwordConfirm"
54
- required=""
55
- type="password"
56
- value=""
57
- />
58
- <span
59
- class="show-hide-password active"
60
- data-testid="toggle-input-type"
61
- role="button"
62
- >
63
- Show
64
- <i
65
- class="material-icons"
66
- >
67
- visibility_off
68
- </i>
69
- </span>
70
- </div>
71
- </form>
72
- <button
73
- class="button "
74
- disabled=""
75
- form="passwordReset"
76
- name="button"
77
- type="submit"
78
- >
79
- Reset Password
80
- </button>
81
- </div>
82
- </DocumentFragment>
83
- `;
@@ -1,21 +0,0 @@
1
- import validatePassword from '../../../../../../src/components/PasswordReset/helpers/validatePassword';
2
-
3
- describe('validatePassword helper', () => {
4
- it('should return true if a valid password format is passed', () => {
5
- const validatedEmail = validatePassword('12ab&thinG');
6
-
7
- expect(validatedEmail).toBe(true);
8
- });
9
-
10
- it('should return false otherwise', () => {
11
- const invalidPassword = validatePassword('12');
12
- const invalidPassword1 = validatePassword('ab');
13
- const invalidPassword2 = validatePassword('123abcdlaks');
14
- const invalidPassword3 = validatePassword('123abcDlaks');
15
-
16
- expect(invalidPassword).toBe(false);
17
- expect(invalidPassword1).toBe(false);
18
- expect(invalidPassword2).toBe(false);
19
- expect(invalidPassword3).toBe(false);
20
- });
21
- });
@@ -1,79 +0,0 @@
1
- import '@testing-library/jest-dom/extend-expect';
2
- import React from 'react';
3
- import { REQUEST_USER_PASSWORD_RESET_MUTATION } from '@blaze-cms/core-auth-ui';
4
- import { fireEvent, render, waitFor } from '@testing-library/react';
5
- import { MockedProvider } from '@apollo/client/testing';
6
- import PasswordResetRequest from '../../../../../src/components/PasswordResetRequest';
7
-
8
- jest.mock('next/router', () => ({
9
- useRouter: jest.fn(() => ({ asPath: 'some-url' }))
10
- }));
11
- const testEmail = 'test@email.com';
12
-
13
- const mocks = [
14
- {
15
- request: {
16
- query: REQUEST_USER_PASSWORD_RESET_MUTATION,
17
- variables: {
18
- input: { email: testEmail, userId: null, extras: { redirectUrl: 'some-url' } }
19
- }
20
- },
21
- result: {
22
- data: {
23
- requestUserPasswordResetResult: { result: true }
24
- }
25
- }
26
- }
27
- ];
28
-
29
- const setup = () => {
30
- const resetRequestComponent = render(
31
- <MockedProvider mocks={mocks}>
32
- <PasswordResetRequest modifier="pass-request-reset">
33
- <div className="child_1">one child</div>
34
- </PasswordResetRequest>
35
- </MockedProvider>
36
- );
37
- const input = resetRequestComponent.getByTestId('input');
38
- const button = resetRequestComponent.getByText('Request Password Reset');
39
-
40
- return { resetRequestComponent, input, button };
41
- };
42
-
43
- describe('PasswordResetRequest component', () => {
44
- it('should render without throwing an error and match snapshot', () => {
45
- const {
46
- resetRequestComponent: { asFragment }
47
- } = setup();
48
- expect(asFragment()).toMatchSnapshot();
49
- });
50
-
51
- it('button should be disabled if no email is entered', () => {
52
- const { button } = setup();
53
- expect(button).toHaveAttribute('disabled');
54
- });
55
-
56
- it('button should not be disabled if correct email format is entered', () => {
57
- const { input, button } = setup();
58
- fireEvent.change(input, { target: { value: testEmail } });
59
- expect(input.value).toBe(testEmail);
60
- expect(button).not.toBeDisabled();
61
- });
62
-
63
- it('button click should fire passwordResetRequest mutation and render children on success', async () => {
64
- const { resetRequestComponent, input, button } = setup();
65
- fireEvent.change(input, { target: { value: testEmail } });
66
- fireEvent(
67
- button,
68
- new MouseEvent('click', {
69
- bubbles: true,
70
- cancelable: true
71
- })
72
- );
73
-
74
- await waitFor(() => {
75
- const renderedChildren = resetRequestComponent.getByText('one child');
76
- expect(renderedChildren).toBeDefined();
77
- });
78
- });
79
- });
@@ -1,39 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`PasswordResetRequest component should render without throwing an error and match snapshot 1`] = `
4
- <DocumentFragment>
5
- <div
6
- class="pass-request-reset"
7
- >
8
- <form
9
- id="passwordResetRequest"
10
- >
11
- <div
12
- class="form-field form-field--input "
13
- >
14
- <label
15
- class="required"
16
- >
17
- Email
18
- </label>
19
- <input
20
- data-testid="input"
21
- name="email"
22
- required=""
23
- type="email"
24
- value=""
25
- />
26
- </div>
27
- </form>
28
- <button
29
- class="button "
30
- disabled=""
31
- form="passwordResetRequest"
32
- name="button"
33
- type="submit"
34
- >
35
- Request Password Reset
36
- </button>
37
- </div>
38
- </DocumentFragment>
39
- `;