@jetshop/template-trend 5.7.0 → 5.8.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.
@@ -0,0 +1,11 @@
1
+ {
2
+ "configurations": [
3
+ {
4
+ "type": "node-terminal",
5
+ "name": "Run Script: start",
6
+ "request": "launch",
7
+ "command": "yarn run start",
8
+ "cwd": "${workspaceFolder}"
9
+ }
10
+ ]
11
+ }
@@ -1,4 +1,5 @@
1
- export const PRODUCT_URL = '/accessories/watches/watch-classic-504';
2
- export const OUT_OF_STOCK_PRODUCT_URL = '/preview?articlenumber=224733';
3
- export const CATEGORY_URL = '/accessories/watches';
4
- export const ARTICLENUMBER_URL = '/articlenumber/6952315';
1
+ export const PRODUCT_URL = 'se/accessories/watches/watch-classic-504';
2
+ export const OUT_OF_STOCK_PRODUCT_URL = 'se/preview?articlenumber=224733';
3
+ export const CATEGORY_URL = 'se/accessories/watches';
4
+ export const ARTICLENUMBER_URL = 'se/articlenumber/6952315';
5
+ export const US_ARTICLENUMBER_URL = 'int/articlenumber/6952315';
@@ -1,21 +1,17 @@
1
1
  describe('Log In', () => {
2
2
  it('Will show an error when the user enters bad credentials', () => {
3
- cy.visit('/login');
3
+ cy.visit('/se/login');
4
4
  cy.get('#email').type('test@test.com');
5
5
  cy.get('#password').type('iamanonsensepassword');
6
- cy.get('button[type="submit"]')
7
- .contains('Log in')
8
- .click();
6
+ cy.get('button[type="submit"]').contains('Log in').click();
9
7
  cy.findByText('Login failed. Please try again').should('exist');
10
8
  });
11
9
 
12
10
  it('Will log a user in with correct credentials', () => {
13
- cy.visit('/login');
11
+ cy.visit('/se/login');
14
12
  cy.get('#email').type('wolverine@jetshop.se');
15
13
  cy.get('#password').type('jetshop');
16
- cy.get('button[type="submit"]')
17
- .contains('Log in')
18
- .click();
14
+ cy.get('button[type="submit"]').contains('Log in').click();
19
15
  cy.findByText('Login failed. Please try again').should('not.exist');
20
16
  cy.url().should('contain', 'my-pages');
21
17
  });
@@ -4,7 +4,7 @@ function randomString() {
4
4
 
5
5
  describe('User can sign up', () => {
6
6
  it('as a private customer', () => {
7
- cy.visit('/signup');
7
+ cy.visit('/se/signup');
8
8
 
9
9
  cy.get("input[name='pid']").type('test');
10
10
  cy.get("input[name='firstName']").type('Private');
@@ -21,20 +21,14 @@ describe('User can sign up', () => {
21
21
  'Private Customer'
22
22
  );
23
23
 
24
- cy.get('a[href="/my-pages/profile"]').click();
24
+ cy.get('a[href="/se/my-pages/profile"]').click();
25
25
 
26
26
  cy.get('input[type="checkbox"][name="confirm"]').click({ force: true });
27
27
 
28
- cy.get('button[type="submit"]')
29
- .contains('Delete account')
30
- .click();
31
-
32
- cy.get('span')
33
- .contains('Log in')
34
- .should('be.visible');
28
+ cy.get('button[type="submit"]').contains('Delete account').click();
35
29
  });
36
30
  it('as a business customer', () => {
37
- cy.visit('/signup');
31
+ cy.visit('/se/signup');
38
32
 
39
33
  cy.get('input[type="radio"][value="company"]').click({ force: true });
40
34
  cy.get("input[name='organizationNumber']").type('test');
@@ -52,20 +46,16 @@ describe('User can sign up', () => {
52
46
  cy.get("input[name='password']").type('cypresstest');
53
47
  cy.get('[data-testid="sign-up-button"]').click();
54
48
 
55
- cy.get('a[href="/my-pages/profile"]').click();
49
+ cy.get('a[href="/se/my-pages/profile"]').click();
56
50
 
57
51
  cy.get('input[type="checkbox"][name="confirm"]').click({ force: true });
58
52
 
59
- cy.get('button[type="submit"]')
60
- .contains('Delete account')
61
- .click();
53
+ cy.get('button[type="submit"]').contains('Delete account').click();
62
54
 
63
- cy.get('span')
64
- .contains('Log in')
65
- .should('be.visible');
55
+ cy.get('span').contains('Log in').should('be.visible');
66
56
  });
67
57
  it('with encrypted values', () => {
68
- cy.visit('/signup');
58
+ cy.visit('/se/signup');
69
59
 
70
60
  cy.get("input[name='pid']").type('test');
71
61
  cy.get("input[name='firstName']").type('eTZ7FGaVn/RAThBesp3unQ==');
@@ -77,22 +67,18 @@ describe('User can sign up', () => {
77
67
  cy.get("input[name='password']").type('cypresstest');
78
68
  cy.get('[data-testid="sign-up-button"]').click();
79
69
 
80
- cy.get('a[href="/my-pages/profile"]').click();
70
+ cy.get('a[href="/se/my-pages/profile"]').click();
81
71
  cy.get('h2[data-testid="customer-name"]').should('contain', 'Erik Pehrers');
82
72
 
83
73
  cy.get('input[type="checkbox"][name="confirm"]').click({ force: true });
84
74
 
85
- cy.get('button[type="submit"]')
86
- .contains('Delete account')
87
- .click();
75
+ cy.get('button[type="submit"]').contains('Delete account').click();
88
76
 
89
- cy.get('span')
90
- .contains('Log in')
91
- .should('be.visible');
77
+ cy.get('span').contains('Log in').should('be.visible');
92
78
  });
93
79
 
94
80
  it('Displays email validation error', () => {
95
- cy.visit('/signup');
81
+ cy.visit('/se/signup');
96
82
 
97
83
  cy.get("input[name='pid']").type('test');
98
84
  cy.get("input[name='firstName']").type('integrationtest');
@@ -1,5 +1,5 @@
1
1
  const BIKES_URL = '/bikes';
2
- const SEARCH_URL = '/search/?term=city';
2
+ const SEARCH_URL = '/se/search/?term=city';
3
3
  const FURNITURE_URL = '/furniture';
4
4
  const PRODUCT_NAME_TO_CHECK = 'Toldbod Pendant';
5
5
  describe('Filters', () => {
@@ -7,9 +7,7 @@ describe('Filters', () => {
7
7
  cy.visit(`${BIKES_URL}?channelCountry=US`);
8
8
  cy.get('input[type=checkbox]').should('be.checked');
9
9
  cy.contains('City Racer_ 2').should('not.exist');
10
- cy.get('label')
11
- .contains('In stock')
12
- .click();
10
+ cy.get('label').contains('In stock').click();
13
11
  cy.url().should('include', 'boolean[150:buyable]=false');
14
12
  cy.contains('City Racer_ 2').should('exist');
15
13
  });
@@ -18,9 +16,7 @@ describe('Filters', () => {
18
16
  cy.visit(`${SEARCH_URL}&channelCountry=US`);
19
17
  cy.get('input[type=checkbox]').should('be.checked');
20
18
  cy.contains('City Racer_ 2').should('not.exist');
21
- cy.get('label')
22
- .contains('In stock')
23
- .click();
19
+ cy.get('label').contains('In stock').click();
24
20
  cy.url().should('include', 'boolean[buyable]=false');
25
21
  cy.contains('City Racer_ 2').should('exist');
26
22
  });
@@ -38,9 +34,7 @@ describe('Filters', () => {
38
34
  cy.get('button[data-flight-dropdown-button] > span')
39
35
  .contains('Brand')
40
36
  .click();
41
- cy.get('li[data-flight-dropdown-item] > span')
42
- .contains('Cartels')
43
- .click();
37
+ cy.get('li[data-flight-dropdown-item] > span').contains('Cartels').click();
44
38
  cy.get('.product-card-detail')
45
39
  .contains(PRODUCT_NAME_TO_CHECK)
46
40
  .should('not.exist');
@@ -56,9 +50,7 @@ describe('Filters', () => {
56
50
  cy.get('button[data-flight-dropdown-button] > span')
57
51
  .contains('Brand')
58
52
  .click();
59
- cy.get('li[data-flight-dropdown-item] > span')
60
- .contains('Cartels')
61
- .click();
53
+ cy.get('li[data-flight-dropdown-item] > span').contains('Cartels').click();
62
54
  cy.get('button[data-flight-dropdown-button] > span')
63
55
  .contains('Sort By')
64
56
  .click();
@@ -72,9 +64,7 @@ describe('Filters', () => {
72
64
  .should('not.exist');
73
65
 
74
66
  // also shown in ui
75
- cy.get('aside > button')
76
- .contains('Clear all filters')
77
- .should('exist');
67
+ cy.get('aside > button').contains('Clear all filters').should('exist');
78
68
  });
79
69
 
80
70
  it('Persists filters when paginating', () => {
@@ -83,27 +73,15 @@ describe('Filters', () => {
83
73
  .contains('Categories')
84
74
  .click();
85
75
  cy.get('li[data-flight-dropdown-item] > span').as('listOfCategories');
86
- cy.get('@listOfCategories')
87
- .contains('Watches')
88
- .click();
89
- cy.get('@listOfCategories')
90
- .contains('Glasses')
91
- .click();
92
- cy.get('@listOfCategories')
93
- .contains('Bags')
94
- .click();
76
+ cy.get('@listOfCategories').contains('Watches').click();
77
+ cy.get('@listOfCategories').contains('Glasses').click();
78
+ cy.get('@listOfCategories').contains('Bags').click();
95
79
 
96
- cy.get('.product-card-detail')
97
- .contains('Belt Light')
98
- .should('not.exist');
80
+ cy.get('.product-card-detail').contains('Belt Light').should('not.exist');
99
81
 
100
- cy.get('a')
101
- .contains('Next')
102
- .click();
82
+ cy.get('a').contains('Next').click();
103
83
 
104
- cy.get('.product-card-detail')
105
- .contains('Belt Light')
106
- .should('not.exist');
84
+ cy.get('.product-card-detail').contains('Belt Light').should('not.exist');
107
85
  });
108
86
 
109
87
  it('Persists filters when infinite paginating', () => {
@@ -112,26 +90,14 @@ describe('Filters', () => {
112
90
  .contains('Categories')
113
91
  .click();
114
92
  cy.get('li[data-flight-dropdown-item] > span').as('listOfCategories');
115
- cy.get('@listOfCategories')
116
- .contains('Watches')
117
- .click();
118
- cy.get('@listOfCategories')
119
- .contains('Glasses')
120
- .click();
121
- cy.get('@listOfCategories')
122
- .contains('Bags')
123
- .click();
93
+ cy.get('@listOfCategories').contains('Watches').click();
94
+ cy.get('@listOfCategories').contains('Glasses').click();
95
+ cy.get('@listOfCategories').contains('Bags').click();
124
96
 
125
- cy.get('.product-card-detail')
126
- .contains('Belt Light')
127
- .should('not.exist');
97
+ cy.get('.product-card-detail').contains('Belt Light').should('not.exist');
128
98
 
129
- cy.get('a')
130
- .contains('Show more')
131
- .click();
99
+ cy.get('a').contains('Show more').click();
132
100
 
133
- cy.get('.product-card-detail')
134
- .contains('Belt Light')
135
- .should('not.exist');
101
+ cy.get('.product-card-detail').contains('Belt Light').should('not.exist');
136
102
  });
137
103
  });
@@ -1,4 +1,4 @@
1
- import { ARTICLENUMBER_URL } from '../constants';
1
+ import { ARTICLENUMBER_URL, US_ARTICLENUMBER_URL } from '../constants';
2
2
 
3
3
  describe('Visiting /articlenumber/:articlenumber', () => {
4
4
  it('does a redirect on the server to the correct product', () => {
@@ -13,7 +13,7 @@ describe('Visiting /articlenumber/:articlenumber', () => {
13
13
  });
14
14
  it('redirect to login if login required', () => {
15
15
  cy.request(
16
- ARTICLENUMBER_URL +
16
+ US_ARTICLENUMBER_URL +
17
17
  '?culture=en-US&currency=USD&channelCountry=US&channel=M7-GLOBAL'
18
18
  ).then(res => {
19
19
  expect(res.redirects).to.have.length(1);
@@ -4,44 +4,32 @@ const PAGED_TERM = 'wa bag';
4
4
 
5
5
  describe('Search page', () => {
6
6
  it('Returns results', () => {
7
- cy.visit(`/search/?term=${PRODUCT_TERM}`);
7
+ cy.visit(`se/search/?term=${PRODUCT_TERM}`);
8
8
 
9
- cy.findByTestId('product-grid')
10
- .as('productGrid')
11
- .should('exist');
9
+ cy.findByTestId('product-grid').as('productGrid').should('exist');
12
10
  });
13
11
 
14
12
  it('Returns a no results page if there are no matches', () => {
15
- cy.visit(`/search/?term=${EMPTY_TERM}`);
13
+ cy.visit(`se/search/?term=${EMPTY_TERM}`);
16
14
 
17
- cy.findByTestId('product-grid')
18
- .as('productGrid')
19
- .should('not.exist');
15
+ cy.findByTestId('product-grid').as('productGrid').should('not.exist');
20
16
 
21
17
  cy.findAllByText('No results for').should('exist');
22
18
  });
23
19
 
24
20
  it('Can handle pagination on search page', () => {
25
- cy.visit(`/search/?term=${PAGED_TERM}&standardPagination=true`);
26
- cy.findByTestId('product-grid')
27
- .as('productGrid')
28
- .should('exist');
21
+ cy.visit(`se/search/?term=${PAGED_TERM}&standardPagination=true`);
22
+ cy.findByTestId('product-grid').as('productGrid').should('exist');
29
23
  cy.get('li[data-testid="product"]').should('have.length', 24);
30
- cy.get('a')
31
- .contains('Next')
32
- .click();
24
+ cy.get('a').contains('Next').click();
33
25
  cy.url().should('contain', 'page=2');
34
- cy.findByTestId('product-grid')
35
- .as('productGrid')
36
- .should('exist');
26
+ cy.findByTestId('product-grid').as('productGrid').should('exist');
37
27
  cy.get('li[data-testid="product"]').should('have.length.lessThan', 24);
38
28
  });
39
29
 
40
30
  it('Can handle infinite pagination', () => {
41
- cy.visit(`/search/?term=${PAGED_TERM}`);
42
- cy.get('a')
43
- .contains('Show more')
44
- .click();
31
+ cy.visit(`se/search/?term=${PAGED_TERM}`);
32
+ cy.get('a').contains('Show more').click();
45
33
  cy.wait(2000);
46
34
  cy.scrollTo('bottom');
47
35
  cy.url().should('contain', 'page=2');
@@ -2,7 +2,7 @@ import { CATEGORY_URL } from '../../constants';
2
2
 
3
3
  describe('Product Page SSR', () => {
4
4
  it('Gets the full page from the server', () => {
5
- cy.request(`${CATEGORY_URL}?channelCountry=US`)
5
+ cy.request(`${CATEGORY_URL}`)
6
6
  .its('body')
7
7
  .should('include', '>Watches</h1>');
8
8
  });
@@ -2,7 +2,7 @@ import { PRODUCT_URL } from '../../constants';
2
2
 
3
3
  describe('Product Page SSR', () => {
4
4
  it('Gets the full page from the server', () => {
5
- cy.request(`${PRODUCT_URL}?channelCountry=US`)
5
+ cy.request(`${PRODUCT_URL}`)
6
6
  .its('body')
7
7
  .should('include', '">Watch Classic</h1>');
8
8
  });
@@ -1,7 +1,5 @@
1
1
  describe('Product Page SSR', () => {
2
2
  it('Gets the full page from the server', () => {
3
- cy.request('?channelCountry=US')
4
- .its('body')
5
- .should('include', 'Selected Categories</h2>');
3
+ cy.request('/se').its('body').should('include', 'Selected Categories</h2>');
6
4
  });
7
5
  });
@@ -1,5 +1,5 @@
1
1
  describe('Stores page', () => {
2
2
  it('Successfully loads without errors', () => {
3
- cy.visit('/stores');
3
+ cy.visit('/se/stores');
4
4
  });
5
5
  });
@@ -1,14 +1,14 @@
1
1
  import './commands';
2
2
 
3
- Cypress.on('window:before:load', win => {
3
+ Cypress.on('window:before:load', (win) => {
4
4
  const dl = [];
5
5
  cy.spy(dl, 'push').as('gtm_dataLayer_push');
6
6
  win.dataLayer = dl;
7
7
  });
8
8
 
9
- const resizeObserverLoopErrRe = /^ResizeObserver loop limit exceeded/;
9
+ const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/;
10
10
 
11
- Cypress.on('uncaught:exception', err => {
11
+ Cypress.on('uncaught:exception', (err) => {
12
12
  if (resizeObserverLoopErrRe.test(err.message)) {
13
13
  // returning false here prevents Cypress from
14
14
  // failing the test
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetshop/template-trend",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "build": "react-scripts build",
@@ -32,14 +32,24 @@
32
32
  "not op_mini all"
33
33
  ],
34
34
  "prettier": {
35
- "singleQuote": true
35
+ "singleQuote": true,
36
+ "trailingComma": "none",
37
+ "arrowParens": "avoid",
38
+ "overrides": [
39
+ {
40
+ "files": "*.md",
41
+ "options": {
42
+ "semi": false
43
+ }
44
+ }
45
+ ]
36
46
  },
37
47
  "dependencies": {
38
- "@jetshop/core": "^5.7.0",
48
+ "@jetshop/core": "^5.8.0",
39
49
  "@jetshop/flight-shortcodes": "^2.0.10",
40
- "@jetshop/intl": "^5.7.0",
41
- "@jetshop/react-scripts": "^5.7.0",
42
- "@jetshop/ui": "^5.7.0",
50
+ "@jetshop/intl": "^5.8.0",
51
+ "@jetshop/react-scripts": "^5.8.0",
52
+ "@jetshop/ui": "^5.8.0",
43
53
  "@react-google-maps/api": "~1.7.0",
44
54
  "prop-types": "^15.6.2",
45
55
  "react": "^16.9.0",
@@ -52,13 +62,13 @@
52
62
  "@graphql-cli/codegen": "^1.17.18",
53
63
  "@graphql-codegen/schema-ast": "^1.18.1",
54
64
  "@testing-library/cypress": "^6.0.0",
55
- "cypress": "^3.8.3",
65
+ "cypress": "^8.5.0",
56
66
  "graphql": "^14.5.8",
57
67
  "graphql-cli": "^4.1.0",
58
68
  "graphql-config": "3.0.3",
59
69
  "lint-staged": "^8.1.5",
60
- "prettier": "^1.19.1",
61
- "typescript": "^4.1.5",
70
+ "prettier": "^2.3.2",
71
+ "typescript": "^4.3.2",
62
72
  "yargs": "16.0.3"
63
73
  },
64
74
  "resolutions": {
package/schema.graphql CHANGED
@@ -2133,6 +2133,7 @@ type StockStatus {
2133
2133
 
2134
2134
  type Store {
2135
2135
  id: Int!
2136
+ externalId: String
2136
2137
  name: String
2137
2138
  city: String
2138
2139
  region: String
@@ -18,7 +18,7 @@ function DeleteAccount() {
18
18
  const t = useIntl();
19
19
 
20
20
  const { confirmDeletion, error, success } = useDeleteAccountMutation({
21
- confirmationMessage: t('Are you sure?')
21
+ confirmationMessage: t('Are you sure?'),
22
22
  });
23
23
 
24
24
  // Redirect to root once account is deleted, and user is logged out
@@ -32,18 +32,21 @@ function DeleteAccount() {
32
32
  </p>
33
33
 
34
34
  <Formik
35
- validate={values => {
35
+ validate={(values) => {
36
36
  // Just check if confirm has been checked. If it is checked, the form becomes valid.
37
37
  if (!values.confirm) {
38
38
  return {
39
- confirm: ''
39
+ confirm: '',
40
40
  };
41
41
  }
42
42
  return {};
43
43
  }}
44
44
  onSubmit={confirmDeletion}
45
+ initialValues={{
46
+ confirm: false,
47
+ }}
45
48
  >
46
- {formik => {
49
+ {(formik) => {
47
50
  return (
48
51
  <Form>
49
52
  <Field
@@ -1,4 +1,4 @@
1
- import AddToCartFormik from '@jetshop/core/components/Mutation/AddToCartFormik';
1
+ import AddToCartFormik from '@jetshop/core/cart/AddToCartFormik';
2
2
  import ProductConfigurationContext from '@jetshop/core/components/ProductConfigurationProvider/ProductConfigurationContext';
3
3
  import { useDynamicPrice } from '@jetshop/core/hooks/useDynamicPrice';
4
4
  import t from '@jetshop/intl';
@@ -56,7 +56,7 @@ function AddToCartForm({
56
56
  product,
57
57
  variant,
58
58
  getMissingOptions,
59
- variantHandler
59
+ variantHandler,
60
60
  }) {
61
61
  const configurationContext = useContext(ProductConfigurationContext);
62
62
  const price = useDynamicPrice(product, variant);
@@ -68,7 +68,7 @@ function AddToCartForm({
68
68
  missingOptions,
69
69
  variantValidation,
70
70
  hasVariants,
71
- stockStatus
71
+ stockStatus,
72
72
  });
73
73
  const [trigger, dismiss] = useNotification();
74
74
 
@@ -82,7 +82,7 @@ function AddToCartForm({
82
82
  />,
83
83
  {
84
84
  id: mutationId,
85
- type: 'add-to-cart'
85
+ type: 'add-to-cart',
86
86
  }
87
87
  );
88
88
  };
@@ -99,7 +99,7 @@ function AddToCartForm({
99
99
  error={error}
100
100
  />,
101
101
  {
102
- type: 'add-to-cart'
102
+ type: 'add-to-cart',
103
103
  }
104
104
  );
105
105
  };
@@ -136,7 +136,9 @@ function AddToCartForm({
136
136
  css={{
137
137
  marginBottom: '24px',
138
138
  opacity:
139
- configurationContext && configurationContext.loading ? 0.3 : 1
139
+ configurationContext && configurationContext.loading
140
+ ? 0.3
141
+ : 1,
140
142
  }}
141
143
  />
142
144
 
@@ -149,7 +151,7 @@ function AddToCartForm({
149
151
 
150
152
  <StyledForm>
151
153
  {product.customerComments &&
152
- product.customerComments.map(comment => (
154
+ product.customerComments.map((comment) => (
153
155
  <InputWithLabel
154
156
  wrapperClassName="customer-comment-input-wrapper"
155
157
  className="customer-comment-input"
@@ -182,7 +184,7 @@ function AddToCartForm({
182
184
  style={{
183
185
  opacity: !!validationMessage ? 0.7 : 1,
184
186
  cursor: !!validationMessage ? 'not-allowed' : 'pointer',
185
- width: '100%'
187
+ width: '100%',
186
188
  }}
187
189
  >
188
190
  {validationMessage ? validationMessage : t('Add to cart')}