@automattic/jetpack-components 0.41.2 → 0.42.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/CHANGELOG.md +11 -0
- package/components/boost-score-graph/background.tsx +183 -0
- package/components/boost-score-graph/index.tsx +24 -16
- package/components/boost-score-graph/style.scss +17 -0
- package/components/boost-score-graph/types/declarations.d.ts +4 -0
- package/components/boost-score-graph/uplot-line-chart.tsx +11 -5
- package/components/boost-score-graph/use-boost-score-transform.ts +21 -18
- package/components/gridicon/index.tsx +13 -0
- package/components/{pricing-slider → number-slider}/index.tsx +12 -12
- package/components/{pricing-slider → number-slider}/style.scss +8 -8
- package/components/{pricing-slider → number-slider}/types.ts +2 -2
- package/components/popover/index.tsx +19 -0
- package/components/popover/style.scss +25 -0
- package/index.ts +2 -1
- package/package.json +3 -3
- package/.gitattributes +0 -8
- package/components/action-button/stories/index.stories.jsx +0 -38
- package/components/action-button/test/component.jsx +0 -16
- package/components/action-popover/stories/index.stories.jsx +0 -115
- package/components/action-popover/stories/styles.module.scss +0 -7
- package/components/admin-page/stories/index.stories.tsx +0 -35
- package/components/admin-page/stories/style.module.scss +0 -13
- package/components/admin-section/stories/index.stories.tsx +0 -60
- package/components/alert/stories/index.stories.jsx +0 -24
- package/components/automattic-byline-logo/stories/index.stories.tsx +0 -20
- package/components/automattic-byline-logo/test/component.tsx +0 -28
- package/components/boost-score-bar/stories/index.stories.tsx +0 -39
- package/components/boost-score-bar/test/component.tsx +0 -102
- package/components/boost-score-graph/stories/index.stories.tsx +0 -187
- package/components/boost-score-graph/stories/tooltip.stories.tsx +0 -41
- package/components/button/stories/index.mdx +0 -90
- package/components/button/stories/index.stories.tsx +0 -400
- package/components/button/stories/style.module.scss +0 -20
- package/components/contextual-upgrade-trigger/stories/index.stories.tsx +0 -25
- package/components/decorative-card/stories/index.stories.tsx +0 -18
- package/components/dialog/stories/boost.png +0 -0
- package/components/dialog/stories/declaration.d.ts +0 -1
- package/components/dialog/stories/index.stories.tsx +0 -118
- package/components/dialog/stories/js-components.components.dialog.mdx +0 -62
- package/components/dialog/stories/js-components.components.dialog.stories.js +0 -37
- package/components/dialog/stories/style.module.scss +0 -21
- package/components/donut-meter/stories/index.stories.tsx +0 -51
- package/components/donut-meter/test/component.tsx +0 -24
- package/components/gridicon/stories/index.stories.tsx +0 -18
- package/components/icon-tooltip/stories/index.stories.tsx +0 -108
- package/components/icon-tooltip/stories/style.scss +0 -36
- package/components/icon-tooltip/test/component.tsx +0 -15
- package/components/icons/stories/index.stories.tsx +0 -65
- package/components/icons/stories/style.module.scss +0 -33
- package/components/indeterminate-progress-bar/stories/index.stories.tsx +0 -14
- package/components/jetpack-footer/stories/index.stories.tsx +0 -39
- package/components/jetpack-footer/test/__snapshots__/component.tsx.snap +0 -186
- package/components/jetpack-footer/test/component.tsx +0 -159
- package/components/jetpack-logo/stories/index.stories.tsx +0 -20
- package/components/jetpack-logo/test/component.tsx +0 -16
- package/components/jetpack-search-logo/stories/index.stories.tsx +0 -21
- package/components/jetpack-search-logo/test/component.tsx +0 -16
- package/components/jetpack-vaultpress-backup-logo/stories/index.stories.tsx +0 -20
- package/components/jetpack-vaultpress-backup-logo/test/component.tsx +0 -18
- package/components/jetpack-videopress-logo/stories/index.stories.tsx +0 -20
- package/components/jetpack-videopress-logo/test/component.tsx +0 -16
- package/components/layout/stories/index.stories.tsx +0 -145
- package/components/layout/stories/styles.module.scss +0 -22
- package/components/loading-placeholder/stories/index.stories.tsx +0 -78
- package/components/notice/stories/index.stories.jsx +0 -90
- package/components/pricing-card/stories/index.stories.tsx +0 -55
- package/components/pricing-card/test/component.tsx +0 -89
- package/components/pricing-slider/stories/index.stories.tsx +0 -44
- package/components/pricing-slider/test/component.tsx +0 -14
- package/components/pricing-table/stories/index.stories.tsx +0 -74
- package/components/pricing-table/test/component.tsx +0 -41
- package/components/product-offer/stories/index.stories.tsx +0 -104
- package/components/product-price/stories/index.stories.tsx +0 -33
- package/components/product-price/test/component.tsx +0 -26
- package/components/qr-code/stories/index.stories.tsx +0 -32
- package/components/record-meter-bar/stories/index.stories.tsx +0 -39
- package/components/record-meter-bar/test/component.tsx +0 -52
- package/components/spinner/stories/index.stories.jsx +0 -20
- package/components/spinner/test/component.jsx +0 -17
- package/components/split-button/stories/index.stories.tsx +0 -35
- package/components/stat-card/stories/index.mdx +0 -35
- package/components/stat-card/stories/index.stories.tsx +0 -41
- package/components/stat-card/test/component.tsx +0 -24
- package/components/status/stories/index.stories.tsx +0 -44
- package/components/terms-of-service/test/index.test.jsx +0 -52
- package/components/testimonials/test/component.tsx +0 -103
- package/components/text/stories/headings.index.stories.tsx +0 -80
- package/components/text/stories/index.mdx +0 -195
- package/components/text/stories/index.stories.tsx +0 -69
- package/components/text/stories/style.module.scss +0 -64
- package/components/text/stories/title.index.stories.tsx +0 -34
- package/components/theme-provider/stories/index.stories.tsx +0 -164
- package/components/theme-provider/stories/style.module.scss +0 -79
- package/components/toggle-control/stories/index.stories.tsx +0 -83
- package/components/zendesk-chat/stories/index.stories.tsx +0 -15
- package/components/zendesk-chat/test/component.tsx +0 -16
- package/lib/locale/test/index.ts +0 -21
- package/tools/jp-redirect/test/index.tsx +0 -89
- package/tools/pricing-utils/test/index.ts +0 -39
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jest } from '@jest/globals';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import ZendeskChat from '../index';
|
|
4
|
-
|
|
5
|
-
describe( 'ZendeskChat', () => {
|
|
6
|
-
afterEach( () => {
|
|
7
|
-
// restore the spy created with spyOn
|
|
8
|
-
jest.restoreAllMocks();
|
|
9
|
-
} );
|
|
10
|
-
|
|
11
|
-
it( 'renders the zendesk chat widget', () => {
|
|
12
|
-
render( <ZendeskChat jwt_token="exampletoken" /> );
|
|
13
|
-
|
|
14
|
-
expect( screen.getByTestId( 'zendesk-chat-container' ) ).toBeInTheDocument();
|
|
15
|
-
} );
|
|
16
|
-
} );
|
package/lib/locale/test/index.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { cleanLocale } from '../';
|
|
2
|
-
|
|
3
|
-
describe( 'cleanLocale', () => {
|
|
4
|
-
const testLocales = [
|
|
5
|
-
[ 'af', 'af' ],
|
|
6
|
-
[ 'arq', 'arq' ],
|
|
7
|
-
[ 'fr_FR', 'fr-FR' ],
|
|
8
|
-
[ 'pap_CW', 'pap-CW' ],
|
|
9
|
-
[ 'de_DE_formal', 'de-DE' ],
|
|
10
|
-
[ 'art_xpirate', 'art-xpirate' ],
|
|
11
|
-
[ 'art_xemoji', 'art-xemoji' ],
|
|
12
|
-
[ 'pt_PT_ao90', 'pt-PT' ],
|
|
13
|
-
[ 'deDE', 'en-US' ],
|
|
14
|
-
[ 'foobarde_DE', 'en-US' ], // Language should never be more than 3 chars long.
|
|
15
|
-
[ 'en_alotofchars', 'en' ], // region or variant tags should not be more than 8 chars.
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
it.each( testLocales )( '%s is cleaned into %s', ( input, expected ) => {
|
|
19
|
-
expect( cleanLocale( input ) ).toBe( expected );
|
|
20
|
-
} );
|
|
21
|
-
} );
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import getRedirectUrl from '../';
|
|
2
|
-
|
|
3
|
-
describe( 'getRedirectUrl', () => {
|
|
4
|
-
it( 'simple url', () => {
|
|
5
|
-
const url = getRedirectUrl( 'simple' );
|
|
6
|
-
const parsedUrl = new URL( url );
|
|
7
|
-
|
|
8
|
-
expect( parsedUrl.searchParams.get( 'source' ) ).toBe( 'simple' );
|
|
9
|
-
} );
|
|
10
|
-
|
|
11
|
-
it( 'Random param', () => {
|
|
12
|
-
const url = getRedirectUrl( 'simple', { random: 'asd' } );
|
|
13
|
-
expect( url ).toBe( 'https://jetpack.com/redirect/?source=simple&random=asd' );
|
|
14
|
-
} );
|
|
15
|
-
|
|
16
|
-
it( 'Test path', () => {
|
|
17
|
-
const url = getRedirectUrl( 'simple', { path: '1234' } );
|
|
18
|
-
const parsedUrl = new URL( url );
|
|
19
|
-
|
|
20
|
-
expect( parsedUrl.searchParams.get( 'source' ) ).toBe( 'simple' );
|
|
21
|
-
expect( parsedUrl.searchParams.get( 'path' ) ).toBe( '1234' );
|
|
22
|
-
} );
|
|
23
|
-
|
|
24
|
-
it( 'Test path with special chars', () => {
|
|
25
|
-
const url = getRedirectUrl( 'simple', { path: 'weird value!' } );
|
|
26
|
-
const parsedUrl = new URL( url );
|
|
27
|
-
|
|
28
|
-
expect( parsedUrl.searchParams.get( 'source' ) ).toBe( 'simple' );
|
|
29
|
-
expect( parsedUrl.searchParams.get( 'path' ) ).toBe( 'weird value!' );
|
|
30
|
-
} );
|
|
31
|
-
|
|
32
|
-
it( 'Test query', () => {
|
|
33
|
-
const url = getRedirectUrl( 'simple', { query: 'key=1234&other=super' } );
|
|
34
|
-
const parsedUrl = new URL( url );
|
|
35
|
-
|
|
36
|
-
expect( parsedUrl.searchParams.get( 'source' ) ).toBe( 'simple' );
|
|
37
|
-
expect( parsedUrl.searchParams.get( 'query' ) ).toBe( 'key=1234&other=super' );
|
|
38
|
-
} );
|
|
39
|
-
|
|
40
|
-
it( 'Test anchor', () => {
|
|
41
|
-
const url = getRedirectUrl( 'simple', { anchor: 'section' } );
|
|
42
|
-
const parsedUrl = new URL( url );
|
|
43
|
-
|
|
44
|
-
expect( parsedUrl.searchParams.get( 'source' ) ).toBe( 'simple' );
|
|
45
|
-
expect( parsedUrl.searchParams.get( 'anchor' ) ).toBe( 'section' );
|
|
46
|
-
} );
|
|
47
|
-
|
|
48
|
-
it( 'Test all', () => {
|
|
49
|
-
const url = getRedirectUrl( 'simple', {
|
|
50
|
-
query: 'key=1234&other=super',
|
|
51
|
-
anchor: 'section',
|
|
52
|
-
site: 'example.org',
|
|
53
|
-
path: '123',
|
|
54
|
-
} );
|
|
55
|
-
const parsedUrl = new URL( url );
|
|
56
|
-
|
|
57
|
-
expect( parsedUrl.searchParams.get( 'source' ) ).toBe( 'simple' );
|
|
58
|
-
expect( parsedUrl.searchParams.get( 'anchor' ) ).toBe( 'section' );
|
|
59
|
-
expect( parsedUrl.searchParams.get( 'query' ) ).toBe( 'key=1234&other=super' );
|
|
60
|
-
expect( parsedUrl.searchParams.get( 'site' ) ).toBe( 'example.org' );
|
|
61
|
-
expect( parsedUrl.searchParams.get( 'path' ) ).toBe( '123' );
|
|
62
|
-
} );
|
|
63
|
-
|
|
64
|
-
it( 'Test passing an URL as the first parameter', () => {
|
|
65
|
-
const url = getRedirectUrl( 'https://wordpress.com/support' );
|
|
66
|
-
const value = encodeURIComponent( 'https://wordpress.com/support' );
|
|
67
|
-
expect( url ).toBe( `https://jetpack.com/redirect/?url=${ value }` );
|
|
68
|
-
} );
|
|
69
|
-
|
|
70
|
-
it( 'Test passing an URL as the first parameter and query', () => {
|
|
71
|
-
const url = getRedirectUrl( 'https://wordpress.com/support', {
|
|
72
|
-
query: 'key=1234&other=super',
|
|
73
|
-
} );
|
|
74
|
-
const parsedUrl = new URL( url );
|
|
75
|
-
|
|
76
|
-
expect( parsedUrl.searchParams.get( 'url' ) ).toBe( 'https://wordpress.com/support' );
|
|
77
|
-
expect( parsedUrl.searchParams.get( 'query' ) ).toBe( 'key=1234&other=super' );
|
|
78
|
-
} );
|
|
79
|
-
|
|
80
|
-
it( 'Test passing an URL as the first parameter and query discarding info from url', () => {
|
|
81
|
-
const url = getRedirectUrl( 'https://wordpress.com/support?super=mega&key=value#section1', {
|
|
82
|
-
query: 'key=1234&other=super',
|
|
83
|
-
} );
|
|
84
|
-
const parsedUrl = new URL( url );
|
|
85
|
-
|
|
86
|
-
expect( parsedUrl.searchParams.get( 'url' ) ).toBe( 'https://wordpress.com/support' );
|
|
87
|
-
expect( parsedUrl.searchParams.get( 'query' ) ).toBe( 'key=1234&other=super' );
|
|
88
|
-
} );
|
|
89
|
-
} );
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { isFirstMonthTrial } from '..';
|
|
2
|
-
import { IntroOffer } from './../types';
|
|
3
|
-
|
|
4
|
-
const trialIntroOffer: IntroOffer = {
|
|
5
|
-
product_id: 0,
|
|
6
|
-
product_slug: 'test_product',
|
|
7
|
-
currency_code: 'USD',
|
|
8
|
-
formatted_price: '$10',
|
|
9
|
-
original_price: 10,
|
|
10
|
-
raw_price: 1,
|
|
11
|
-
discount_percentage: 90,
|
|
12
|
-
ineligible_reason: null,
|
|
13
|
-
interval_unit: 'month',
|
|
14
|
-
interval_count: 1,
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
describe( 'isFirstMonthTrial', () => {
|
|
18
|
-
it( 'returns true if interval_unit is "month" and interval_count is 1', () => {
|
|
19
|
-
expect( isFirstMonthTrial( trialIntroOffer ) ).toBe( true );
|
|
20
|
-
} );
|
|
21
|
-
|
|
22
|
-
it( 'returns false if interval_unit is not "month"', () => {
|
|
23
|
-
const introOffer: IntroOffer = {
|
|
24
|
-
...trialIntroOffer,
|
|
25
|
-
interval_unit: 'year',
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
expect( isFirstMonthTrial( introOffer ) ).toBe( false );
|
|
29
|
-
} );
|
|
30
|
-
|
|
31
|
-
it( "returns false if interval_unit not 'month' but interval_count isn't 1", () => {
|
|
32
|
-
const introOffer: IntroOffer = {
|
|
33
|
-
...trialIntroOffer,
|
|
34
|
-
interval_count: 3,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
expect( isFirstMonthTrial( introOffer ) ).toBe( false );
|
|
38
|
-
} );
|
|
39
|
-
} );
|