@newskit-render/core 4.27.1 → 4.27.2-alpha.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/cypress/e2e/account/personal-details.cy.js +41 -37
- package/cypress/support/commands.js +2 -2
- package/package.json +6 -6
- package/pages/account/cancellation/index.tsx +2 -3
- package/pages/account/dream-team/index.tsx +2 -3
- package/pages/account/edit/[field].tsx +2 -3
- package/pages/account/family/index.tsx +2 -3
- package/pages/account/holiday-stop/index.tsx +2 -3
- package/pages/account/index.tsx +6 -6
- package/pages/account/newsletters/index.tsx +2 -3
- package/pages/account/newsletters-and-alerts/index.tsx +2 -3
- package/pages/account/payment/[paymentMethod].tsx +2 -3
- package/pages/account/payment/index.tsx +2 -3
- package/pages/account/payment-methods/index.tsx +3 -3
- package/pages/account/subscription-and-billing/index.tsx +2 -3
|
@@ -317,44 +317,7 @@ describe('Personal detail edit pages', () => {
|
|
|
317
317
|
expect(loc.pathname).to.eq('/account')
|
|
318
318
|
})
|
|
319
319
|
})
|
|
320
|
-
it('Should change user email', () => {
|
|
321
|
-
const currentEmail = 'cmp-digi-card-20-09-22@yopmail.com'
|
|
322
|
-
const notRegistredEmail = 'not-registered-email@yopmail.com'
|
|
323
|
-
|
|
324
|
-
cy.get('a[href="/account/edit/email"]').should('be.visible').click()
|
|
325
|
-
|
|
326
|
-
cy.get('[name="email"]').clear()
|
|
327
|
-
cy.get('[name="email"]').type(notRegistredEmail)
|
|
328
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
329
|
-
|
|
330
|
-
cy.contains('[data-testid="toast-container"]', 'Updating your email...')
|
|
331
320
|
|
|
332
|
-
// Redirects to Personal details page
|
|
333
|
-
cy.location().should((loc) => {
|
|
334
|
-
expect(loc.pathname).to.eq('/account')
|
|
335
|
-
})
|
|
336
|
-
cy.contains(notRegistredEmail).should('have.length', 1)
|
|
337
|
-
cy.contains(
|
|
338
|
-
'[data-testid="toast-container"]',
|
|
339
|
-
'Your email address was successfully updated'
|
|
340
|
-
)
|
|
341
|
-
|
|
342
|
-
// Back to edit email page
|
|
343
|
-
|
|
344
|
-
cy.get('a[href="/account/edit/email"]')
|
|
345
|
-
.should('be.visible')
|
|
346
|
-
.click({ force: true })
|
|
347
|
-
|
|
348
|
-
// Check the message for verification link
|
|
349
|
-
cy.contains(
|
|
350
|
-
`Email sent to ${notRegistredEmail} with a verification link. If you haven't received it yet, check again later or contact customer services on xxxx-xxx-xxxx`
|
|
351
|
-
)
|
|
352
|
-
|
|
353
|
-
// Change email back to the previous email
|
|
354
|
-
cy.get('[name="email"]').clear()
|
|
355
|
-
cy.get('[name="email"]').type(currentEmail)
|
|
356
|
-
cy.get('[data-testid="primary-button"]').click()
|
|
357
|
-
})
|
|
358
321
|
it('Should NOT change user email if input value is already registered mail', () => {
|
|
359
322
|
const alreadyRegistredEmail = 'cmp-digi-direct-20-09-22@yopmail.com'
|
|
360
323
|
|
|
@@ -370,6 +333,7 @@ describe('Personal detail edit pages', () => {
|
|
|
370
333
|
'This email address is already in use. Try a different one or contact customer support at 1234-1234'
|
|
371
334
|
)
|
|
372
335
|
})
|
|
336
|
+
|
|
373
337
|
it('Should show input validation error messages when user tries to add invalid email', () => {
|
|
374
338
|
cy.get('a[href="/account/edit/email"]').should('be.visible').click()
|
|
375
339
|
|
|
@@ -391,6 +355,7 @@ describe('Personal detail edit pages', () => {
|
|
|
391
355
|
'Updating your email...'
|
|
392
356
|
).should('not.exist')
|
|
393
357
|
})
|
|
358
|
+
|
|
394
359
|
it('Should show error toast when updating email if internal server error occures', () => {
|
|
395
360
|
cy.intercept('POST', '/api/account/mutate', { statusCode: 500 })
|
|
396
361
|
|
|
@@ -406,6 +371,45 @@ describe('Personal detail edit pages', () => {
|
|
|
406
371
|
"Sorry, we're unable to save your email right now. Please try again or come back later."
|
|
407
372
|
)
|
|
408
373
|
})
|
|
374
|
+
|
|
375
|
+
it('Should change user email', () => {
|
|
376
|
+
const currentEmail = 'cmp-digi-card-20-09-22@yopmail.com'
|
|
377
|
+
const notRegistredEmail = 'not-registered-email@yopmail.com'
|
|
378
|
+
|
|
379
|
+
cy.get('a[href="/account/edit/email"]').should('be.visible').click()
|
|
380
|
+
|
|
381
|
+
cy.get('[name="email"]').clear()
|
|
382
|
+
cy.get('[name="email"]').type(notRegistredEmail)
|
|
383
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
384
|
+
|
|
385
|
+
cy.contains('[data-testid="toast-container"]', 'Updating your email...')
|
|
386
|
+
|
|
387
|
+
// Redirects to Personal details page
|
|
388
|
+
cy.location().should((loc) => {
|
|
389
|
+
expect(loc.pathname).to.eq('/account')
|
|
390
|
+
})
|
|
391
|
+
cy.contains(notRegistredEmail).should('have.length', 1)
|
|
392
|
+
cy.contains(
|
|
393
|
+
'[data-testid="toast-container"]',
|
|
394
|
+
'Your email address was successfully updated'
|
|
395
|
+
)
|
|
396
|
+
|
|
397
|
+
// Back to edit email page
|
|
398
|
+
|
|
399
|
+
cy.get('a[href="/account/edit/email"]')
|
|
400
|
+
.should('be.visible')
|
|
401
|
+
.click({ force: true })
|
|
402
|
+
|
|
403
|
+
// Check the message for verification link
|
|
404
|
+
cy.contains(
|
|
405
|
+
`Email sent to ${notRegistredEmail} with a verification link. If you haven't received it yet, check again later or contact customer services on xxxx-xxx-xxxx`
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
// Change email back to the previous email
|
|
409
|
+
cy.get('[name="email"]').clear()
|
|
410
|
+
cy.get('[name="email"]').type(currentEmail)
|
|
411
|
+
cy.get('[data-testid="primary-button"]').click()
|
|
412
|
+
})
|
|
409
413
|
})
|
|
410
414
|
|
|
411
415
|
describe('Edit password', () => {
|
|
@@ -60,13 +60,13 @@ Cypress.Commands.add('GetTnlAcsSession', (user = 'tnl') => {
|
|
|
60
60
|
|
|
61
61
|
cy.request({
|
|
62
62
|
method: 'POST',
|
|
63
|
-
url: 'https://login.staging-thetimes.
|
|
63
|
+
url: 'https://login.staging-thetimes.com/services/session',
|
|
64
64
|
headers: {
|
|
65
65
|
'Content-Type': 'application/vnd.newsuk.acs.createsession-v1+json',
|
|
66
66
|
},
|
|
67
67
|
body: {
|
|
68
68
|
rememberMe: false,
|
|
69
|
-
gotoUrl: 'https://login.staging-thetimes.
|
|
69
|
+
gotoUrl: 'https://login.staging-thetimes.com/',
|
|
70
70
|
sso: false,
|
|
71
71
|
authCredentials: {
|
|
72
72
|
username,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "4.27.
|
|
3
|
+
"version": "4.27.2-alpha.0",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"@newrelic/winston-enricher": "4.0.1",
|
|
45
45
|
"@newskit-render/api": "^1.12.1",
|
|
46
46
|
"@newskit-render/auth": "^1.8.0",
|
|
47
|
-
"@newskit-render/checkout": "^3.9.
|
|
48
|
-
"@newskit-render/feature-flags": "^1.8.0",
|
|
47
|
+
"@newskit-render/checkout": "^3.9.35-alpha.0",
|
|
48
|
+
"@newskit-render/feature-flags": "^1.8.2-alpha.0",
|
|
49
49
|
"@newskit-render/feed": "^1.8.9",
|
|
50
|
-
"@newskit-render/my-account": "^7.
|
|
51
|
-
"@newskit-render/shared-components": "^4.28.0",
|
|
52
|
-
"@newskit-render/standalone-components": "^3.20.
|
|
50
|
+
"@newskit-render/my-account": "^7.55.0-alpha.0",
|
|
51
|
+
"@newskit-render/shared-components": "^4.28.1-alpha.0",
|
|
52
|
+
"@newskit-render/standalone-components": "^3.20.28-alpha.0",
|
|
53
53
|
"@newskit-render/validation": "^1.17.0",
|
|
54
54
|
"cross-fetch": "3.1.5",
|
|
55
55
|
"graphql": "16.6.0",
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Cancellation, getProviderProps } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
|
-
import {
|
|
5
|
-
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
4
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' /* cra-effected */
|
|
6
5
|
import validation from '../../../validation'
|
|
7
6
|
|
|
8
7
|
const AccountCancellation = (props) => (
|
|
@@ -14,7 +13,7 @@ export default AccountCancellation
|
|
|
14
13
|
export const getServerSideProps = async (context) => {
|
|
15
14
|
replaceConsoleAndSetTransactionName('Account: Cancellation')
|
|
16
15
|
/* start cra-effected */
|
|
17
|
-
const featureFlags = await
|
|
16
|
+
const featureFlags = await getFlagsAll()
|
|
18
17
|
/* end cra-effected */
|
|
19
18
|
return getProviderProps(
|
|
20
19
|
{ ...context, provider: 'Cancellation' },
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { DreamTeam, getProviderProps } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
|
-
import {
|
|
5
|
-
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
4
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' /* cra-effected */
|
|
6
5
|
|
|
7
6
|
const AccountNewslettersAndAlerts = (props) => <DreamTeam {...props} />
|
|
8
7
|
|
|
@@ -11,7 +10,7 @@ export default AccountNewslettersAndAlerts
|
|
|
11
10
|
export const getServerSideProps = async (context) => {
|
|
12
11
|
replaceConsoleAndSetTransactionName('Account: Dream Team')
|
|
13
12
|
/* start cra-effected */
|
|
14
|
-
const featureFlags = await
|
|
13
|
+
const featureFlags = await getFlagsAll()
|
|
15
14
|
/* end cra-effected */
|
|
16
15
|
return getProviderProps(
|
|
17
16
|
{ ...context, provider: 'DreamTeam' },
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
editComponentMap,
|
|
7
7
|
DynamicPage,
|
|
8
8
|
} from '@newskit-render/my-account'
|
|
9
|
-
import {
|
|
10
|
-
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
9
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' /* cra-effected */
|
|
11
10
|
import validation from '../../../validation'
|
|
12
11
|
|
|
13
12
|
const AccountEditField = (props) => (
|
|
@@ -36,7 +35,7 @@ export const getServerSideProps = async (context) => {
|
|
|
36
35
|
console.error(`An error ${context.res.statusCode} occurred on server`)
|
|
37
36
|
}
|
|
38
37
|
/* start cra-effected */
|
|
39
|
-
const featureFlags = await
|
|
38
|
+
const featureFlags = await getFlagsAll()
|
|
40
39
|
/* end cra-effected */
|
|
41
40
|
|
|
42
41
|
return getProviderProps(
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Family, getProviderProps } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
|
-
import {
|
|
5
|
-
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
4
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' /* cra-effected */
|
|
6
5
|
|
|
7
6
|
const AccountFamily = (props) => <Family {...props} />
|
|
8
7
|
|
|
@@ -11,7 +10,7 @@ export default AccountFamily
|
|
|
11
10
|
export const getServerSideProps = async (context) => {
|
|
12
11
|
replaceConsoleAndSetTransactionName('Account: Family')
|
|
13
12
|
/* start cra-effected */
|
|
14
|
-
const featureFlags = await
|
|
13
|
+
const featureFlags = await getFlagsAll()
|
|
15
14
|
/* end cra-effected */
|
|
16
15
|
return getProviderProps(
|
|
17
16
|
{ ...context, provider: 'GroupAccounts' },
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { getProviderProps, HolidayStop } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
|
-
import {
|
|
5
|
-
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
4
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' /* cra-effected */
|
|
6
5
|
|
|
7
6
|
const AccountHolidayStop = (props) => <HolidayStop {...props} />
|
|
8
7
|
|
|
@@ -11,7 +10,7 @@ export default AccountHolidayStop
|
|
|
11
10
|
export const getServerSideProps = async (context) => {
|
|
12
11
|
replaceConsoleAndSetTransactionName('Account: Book a Holiday Stop')
|
|
13
12
|
/* start cra-effected */
|
|
14
|
-
const featureFlags = await
|
|
13
|
+
const featureFlags = await getFlagsAll()
|
|
15
14
|
/* end cra-effected */
|
|
16
15
|
return getProviderProps(
|
|
17
16
|
{ ...context, provider: 'HolidayStop' },
|
package/pages/account/index.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { PersonalDetails, getProviderProps } from '@newskit-render/my-account'
|
|
3
|
-
import {
|
|
4
|
-
import { optimizelysdkKey } from '../../config' /* cra-effected */
|
|
3
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' /* cra-effected */
|
|
5
4
|
import { AccountDropdown } from '../../components/AccountDropdown' /* cra-disabled */
|
|
6
5
|
import { replaceConsoleAndSetTransactionName } from '../../helpers/logger'
|
|
6
|
+
import { closeFlagsInstance } from '@newskit-render/feature-flags'
|
|
7
7
|
|
|
8
8
|
const AccountPersonalDetails = (props) => {
|
|
9
9
|
return (
|
|
@@ -21,11 +21,11 @@ const AccountPersonalDetails = (props) => {
|
|
|
21
21
|
export default AccountPersonalDetails
|
|
22
22
|
|
|
23
23
|
export const getServerSideProps = async (context) => {
|
|
24
|
-
/* start cra-effected */
|
|
25
|
-
const featureFlags = await initAndGetFeatureFlag(optimizelysdkKey)
|
|
26
|
-
|
|
27
|
-
/* end cra-effected */
|
|
28
24
|
replaceConsoleAndSetTransactionName('Account: Personal details')
|
|
25
|
+
|
|
26
|
+
const featureFlags = await getFlagsAll()
|
|
27
|
+
await closeFlagsInstance()
|
|
28
|
+
|
|
29
29
|
return getProviderProps(
|
|
30
30
|
{ ...context, provider: 'PersonalDetails' },
|
|
31
31
|
{ featureFlags } /* cra-effected */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Newsletters, getProviderProps } from '@newskit-render/my-account'
|
|
3
3
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
4
|
-
import {
|
|
5
|
-
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
4
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' /* cra-effected */
|
|
6
5
|
|
|
7
6
|
const AccountNewsletters = (props) => <Newsletters {...props} />
|
|
8
7
|
|
|
@@ -11,7 +10,7 @@ export default AccountNewsletters
|
|
|
11
10
|
export const getServerSideProps = async (context) => {
|
|
12
11
|
replaceConsoleAndSetTransactionName('Account: Newsletters')
|
|
13
12
|
/* start cra-effected */
|
|
14
|
-
const featureFlags = await
|
|
13
|
+
const featureFlags = await getFlagsAll()
|
|
15
14
|
/* end cra-effected */
|
|
16
15
|
return getProviderProps(
|
|
17
16
|
{ ...context, provider: 'Newsletters' },
|
|
@@ -4,8 +4,7 @@ import {
|
|
|
4
4
|
getProviderProps,
|
|
5
5
|
} from '@newskit-render/my-account'
|
|
6
6
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
7
|
-
import {
|
|
8
|
-
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
7
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' /* cra-effected */
|
|
9
8
|
|
|
10
9
|
const AccountNewslettersAndAlerts = (props) => (
|
|
11
10
|
<NewslettersAndAlerts {...props} />
|
|
@@ -16,7 +15,7 @@ export default AccountNewslettersAndAlerts
|
|
|
16
15
|
export const getServerSideProps = async (context) => {
|
|
17
16
|
replaceConsoleAndSetTransactionName('Account: Newsletters and Alerts')
|
|
18
17
|
/* start cra-effected */
|
|
19
|
-
const featureFlags = await
|
|
18
|
+
const featureFlags = await getFlagsAll()
|
|
20
19
|
/* end cra-effected */
|
|
21
20
|
return getProviderProps(
|
|
22
21
|
{ ...context, provider: 'NewslettersAndAlerts' },
|
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
paymentMethodsMap,
|
|
7
7
|
DynamicPage,
|
|
8
8
|
} from '@newskit-render/my-account'
|
|
9
|
-
import {
|
|
10
|
-
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
9
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' /* cra-effected */
|
|
11
10
|
|
|
12
11
|
const PaymentPage = (props) => {
|
|
13
12
|
return (
|
|
@@ -25,7 +24,7 @@ export default PaymentPage
|
|
|
25
24
|
export const getServerSideProps = async (context) => {
|
|
26
25
|
replaceConsoleAndSetTransactionName('Payment method')
|
|
27
26
|
/* start cra-effected */
|
|
28
|
-
const featureFlags = await
|
|
27
|
+
const featureFlags = await getFlagsAll()
|
|
29
28
|
/* end cra-effected */
|
|
30
29
|
|
|
31
30
|
return getProviderProps(
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
3
3
|
import { Payment, getProviderProps } from '@newskit-render/my-account'
|
|
4
|
-
import {
|
|
5
|
-
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
4
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' /* cra-effected */
|
|
6
5
|
|
|
7
6
|
const AccountPayment = (props) => <Payment {...props} />
|
|
8
7
|
|
|
@@ -11,7 +10,7 @@ export default AccountPayment
|
|
|
11
10
|
export const getServerSideProps = async (context) => {
|
|
12
11
|
replaceConsoleAndSetTransactionName('Edit Payment method')
|
|
13
12
|
/* start cra-effected */
|
|
14
|
-
const featureFlags = await
|
|
13
|
+
const featureFlags = await getFlagsAll()
|
|
15
14
|
/* end cra-effected */
|
|
16
15
|
|
|
17
16
|
return getProviderProps(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { getProviderProps, PaymentMethods } from '@newskit-render/my-account'
|
|
3
|
-
import {
|
|
4
|
-
import { optimizelysdkKey } from '../../../config' // create-render-app effected
|
|
3
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' // create-render-app effected
|
|
5
4
|
import { paymentMethodContext } from '../../../context/app-context/paymentMethodContext'
|
|
6
5
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
7
6
|
|
|
@@ -13,7 +12,8 @@ export default AccountPaymentMethods
|
|
|
13
12
|
|
|
14
13
|
export const getServerSideProps = async (context) => {
|
|
15
14
|
replaceConsoleAndSetTransactionName('Account: Payment Methods')
|
|
16
|
-
const featureFlags = await
|
|
15
|
+
const featureFlags = await getFlagsAll()
|
|
16
|
+
// create-render-app effected
|
|
17
17
|
return getProviderProps(
|
|
18
18
|
{ ...context, provider: 'PaymentMethods' },
|
|
19
19
|
{ featureFlags } // create-render-app effected
|
|
@@ -3,8 +3,7 @@ import {
|
|
|
3
3
|
SubscriptionAndBilling,
|
|
4
4
|
getProviderProps,
|
|
5
5
|
} from '@newskit-render/my-account'
|
|
6
|
-
import {
|
|
7
|
-
import { optimizelysdkKey } from '../../../config' /* cra-effected */
|
|
6
|
+
import { getFlagsAll } from '@newskit-render/feature-flags' /* cra-effected */
|
|
8
7
|
import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
|
|
9
8
|
|
|
10
9
|
const AccountSubscriptionAndBilling = (props) => (
|
|
@@ -16,7 +15,7 @@ export default AccountSubscriptionAndBilling
|
|
|
16
15
|
export const getServerSideProps = async (context) => {
|
|
17
16
|
replaceConsoleAndSetTransactionName('Account: Subscription and Billing')
|
|
18
17
|
/* start cra-effected */
|
|
19
|
-
const featureFlags = await
|
|
18
|
+
const featureFlags = await getFlagsAll()
|
|
20
19
|
/* end cra-effected */
|
|
21
20
|
const result = await getProviderProps(
|
|
22
21
|
{
|