@newskit-render/core 0.0.0-d5e6fac23 → 0.0.0-d75fd5849

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.
@@ -4,7 +4,6 @@ WORKDIR /app
4
4
 
5
5
  ENV NEXT_TELEMETRY_DISABLED 1
6
6
 
7
- RUN npm install @newrelic/next
8
7
  COPY .next/standalone ./standalone
9
8
  COPY public ./standalone/public
10
9
  COPY .next/static ./standalone/.next/static
@@ -12,4 +11,4 @@ COPY .next/static ./standalone/.next/static
12
11
  EXPOSE 3000
13
12
  ENV PORT 3000
14
13
 
15
- CMD ["node", "-r", "@newrelic/next", "./standalone/server.js"]
14
+ CMD ["node", "./standalone/server.js"]
@@ -32,6 +32,10 @@ export const pastDueBanner = {
32
32
  text: 'We have successfully cancelled your subscription and will be processing your refund shortly. If you have any question please call ##PHONE_NUMBER##.',
33
33
  dismissDays: 7,
34
34
  },
35
+ paymentFailure: {
36
+ title: 'We haven’t been able to take payment',
37
+ text: 'Your latest payment has failed. Please update your payment details as soon as possible to keep your membership.',
38
+ },
35
39
  treshold: {
36
40
  firstNotice: 26,
37
41
  secondNotice: 30,
@@ -1,6 +1,6 @@
1
1
  import { getTestDates } from '../../fixtures/testDates'
2
2
 
3
- describe('Book a Holiday Stop', () => {
3
+ describe.skip('Book a Holiday Stop', () => {
4
4
  beforeEach(() => {
5
5
  cy.GetTnlAcsSession('tnl')
6
6
  cy.mockConsentAndVisit('/account/holiday-stop')
@@ -13,7 +13,7 @@ describe('Book a Holiday Stop', () => {
13
13
  })
14
14
  })
15
15
 
16
- describe('Add a Holiday Stop', () => {
16
+ describe.skip('Add a Holiday Stop', () => {
17
17
  beforeEach(() => {
18
18
  cy.GetTnlAcsSession('tnl')
19
19
  cy.mockConsentAndVisit('/account/add/holiday-stop')
@@ -52,7 +52,7 @@ describe('Add a Holiday Stop', () => {
52
52
  })
53
53
  })
54
54
 
55
- describe('Upcoming Holiday Stops - edit button', () => {
55
+ describe.skip('Upcoming Holiday Stops - edit button', () => {
56
56
  beforeEach(() => {
57
57
  cy.GetTnlAcsSession('tnl')
58
58
  cy.mockConsentAndVisit('/account/holiday-stop')
@@ -86,7 +86,7 @@ describe('Upcoming Holiday Stops - edit button', () => {
86
86
  })
87
87
  })
88
88
 
89
- describe('Cancel Holiday Stop', () => {
89
+ describe.skip('Cancel Holiday Stop', () => {
90
90
  beforeEach(() => {
91
91
  cy.GetTnlAcsSession('tnl')
92
92
  cy.mockConsentAndVisit('/account/holiday-stop')
@@ -1,51 +1,52 @@
1
- import {
2
- registration_blaize_jwt,
3
- subscription_blaize_jwt,
4
- } from '../../support/blaizeJwtValues'
5
-
6
1
  describe('Newsletters page', () => {
7
2
  beforeEach(() => {
8
3
  cy.GetTnlAcsSession()
9
4
  cy.mockConsent()
10
5
  })
11
6
 
12
- it('Should display all the newsletters on the newsletters page when user is subscribed', () => {
13
- cy.mockBlaizeJwtAndVisit(subscription_blaize_jwt, '/account/newsletters')
7
+ it('Should display all the newsletters on the newsletters page when user has a subscription', () => {
8
+ cy.mockConsentAndVisit('/account/newsletters')
14
9
  cy.contains('Newsletters')
15
10
  cy.contains(
16
11
  'Exclusive content and a curated selection of our top stories straight to your inbox.'
17
12
  )
18
- cy.get('[data-testid="newsletters-grid"] > div').should('have.length', 20)
13
+ cy.get('[data-testid="newsletters-grid"] > div > div').should(
14
+ 'have.length.greaterThan',
15
+ 1
16
+ )
19
17
  })
20
18
 
21
- // Commented out because Optimizely feature flag with tm-my-account key is causing it to fail in this repo. Test should be re-enabled once feature flag is removed.
22
- // it('Should only display selected newsletters on the newsletters page when user is registered', () => {
23
- // cy.mockBlaizeJwtAndVisit(registration_blaize_jwt, '/account/newsletters')
24
- // cy.contains('Newsletters')
25
- // cy.contains(
26
- // 'Exclusive content and a curated selection of our top stories straight to your inbox.'
27
- // )
28
- // cy.get('[data-testid="newsletters-grid"] > div').should('have.length', 12)
29
- // })
19
+ it('Should only display selected newsletters on the newsletters page when user is registered', () => {
20
+ cy.GetTnlAcsSession('tnlNoSubscription')
21
+ cy.mockConsentAndVisit('/account/newsletters')
22
+ cy.contains('Newsletters')
23
+ cy.contains(
24
+ 'Exclusive content and a curated selection of our top stories straight to your inbox.'
25
+ )
26
+ cy.get('[data-testid="newsletters-grid"] > div > div').should(
27
+ 'have.length.greaterThan',
28
+ 1
29
+ )
30
+ })
30
31
 
31
32
  it('Should display all required newsletter text in the first grid card', () => {
32
- cy.mockBlaizeJwtAndVisit(subscription_blaize_jwt, '/account/newsletters')
33
- cy.get('[data-testid="newsletters-grid"]').then(($parentDiv) => {
33
+ cy.mockConsentAndVisit('/account/newsletters')
34
+ cy.get('[data-testid="newsletters-grid-featured"]').then(($parentDiv) => {
34
35
  const firstNewsletter = $parentDiv.find('div:first-child')
35
36
 
36
- cy.wrap(firstNewsletter).contains('Business').should('be.visible')
37
+ cy.wrap(firstNewsletter).contains('Daily Briefing').should('be.visible')
37
38
  cy.wrap(firstNewsletter).contains('Daily').should('be.visible')
38
39
  cy.wrap(firstNewsletter)
39
40
  .contains(
40
- "The business editor's exclusive analysis of all the latest financial and economic news."
41
+ 'Our flagship newsletter with our top stories and exclusive analysis every morning.'
41
42
  )
42
43
  .should('be.visible')
43
44
  })
44
45
  })
45
46
 
46
47
  it('Should successfully subscribe to a newsletter', () => {
47
- cy.mockBlaizeJwtAndVisit(subscription_blaize_jwt, '/account/newsletters')
48
- cy.get('[data-testid="newsletters-grid"]').then(($parentDiv) => {
48
+ cy.mockConsentAndVisit('/account/newsletters')
49
+ cy.get('[data-testid="newsletters-grid-featured"]').then(($parentDiv) => {
49
50
  cy.intercept('POST', '/api/account/mutate', { statusCode: 200, ok: true })
50
51
 
51
52
  const firstNewsletter = $parentDiv.find('div:first-child')
@@ -58,14 +59,14 @@ describe('Newsletters page', () => {
58
59
 
59
60
  cy.contains(
60
61
  '[data-testid="toast-container"]',
61
- 'Thank you, you are now signed up to the Business newsletter'
62
+ 'Thank you, you are now signed up to the Daily Briefing newsletter'
62
63
  )
63
64
  })
64
65
  })
65
66
 
66
67
  it('Should show the error toast on server error', () => {
67
- cy.mockBlaizeJwtAndVisit(subscription_blaize_jwt, '/account/newsletters')
68
- cy.get('[data-testid="newsletters-grid"]').then(($parentDiv) => {
68
+ cy.mockConsentAndVisit('/account/newsletters')
69
+ cy.get('[data-testid="newsletters-grid-featured"]').then(($parentDiv) => {
69
70
  cy.intercept('POST', '/api/account/mutate', {
70
71
  statusCode: 500,
71
72
  ok: false,
@@ -81,7 +82,7 @@ describe('Newsletters page', () => {
81
82
 
82
83
  cy.contains(
83
84
  '[data-testid="toast-container"]',
84
- 'Sorry we were unable to sign you up to the Business newsletter, please try again'
85
+ 'Sorry we were unable to sign you up to the Daily Briefing newsletter, please try again'
85
86
  )
86
87
  })
87
88
  })
@@ -138,15 +138,14 @@ describe('Subscription and billing details for Digital user', () => {
138
138
  cy.contains('expiry date 02/27')
139
139
  })
140
140
 
141
- // Skipped due to graphql changes. To be fixed with TMR-1959
142
- it.skip('Should display Invoice history section', () => {
143
- cy.contains('[data-testid="ContentListIntroduction"]', 'Invoice history')
144
- cy.contains('Digital pack')
145
- cy.contains('20 Sept 2022')
146
- cy.contains('Paid')
147
- cy.get('a[data-testid="download-button"]')
148
- .should('have.attr', 'href', '#')
149
- .contains('View')
141
+ // Section no longer displayed when Invoice history is empty due to graphql change
142
+ // Invoices are no longer fetched if older than 1 year
143
+ // This test would periodically fail as it depends on changing user data
144
+ it('Should not display empty Invoice history section', () => {
145
+ cy.get('[data-testid="ContentListIntroduction"]').should(
146
+ 'not.contain',
147
+ 'Invoice history'
148
+ )
150
149
  })
151
150
 
152
151
  it('Should NOT display Your deliveries section', () => {
@@ -227,17 +226,6 @@ describe('Subscription and billing details for Print user', () => {
227
226
  )
228
227
  })
229
228
 
230
- // Skipped due to graphql changes. To be fixed with TMR-1959
231
- it.skip('Should display Invoice history section', () => {
232
- cy.contains('[data-testid="ContentListIntroduction"]', 'Invoice history')
233
- cy.contains('Print pack')
234
- cy.contains('24 Apr 2023')
235
- cy.contains('Paid')
236
- cy.get('a[data-testid="download-button"]')
237
- .should('have.attr', 'href', '#')
238
- .contains('View')
239
- })
240
-
241
229
  it('Should display Your deliveries section for users with vouchers', () => {
242
230
  cy.GetTnlAcsSession('printVouchers')
243
231
  cy.mockConsentAndVisit('/account/subscription-and-billing')
@@ -245,8 +233,6 @@ describe('Subscription and billing details for Print user', () => {
245
233
  cy.contains('[data-testid="ContentListIntroduction"]', 'Your deliveries')
246
234
  cy.contains('Address')
247
235
  cy.contains('2 Tuke House, Cromwell Road, York, YO1 6DJ, North Yorkshire')
248
- cy.contains('Delivery instructions')
249
- cy.contains('On my doorstep')
250
236
  cy.contains('Holiday Stops')
251
237
  cy.contains(
252
238
  'You can pause your print delivery at any time by adding a Holiday Stop to your account. Holiday Stops need to be booked before 16:00 GMT the day before you want to pause delivery.'
@@ -279,18 +265,6 @@ describe('Subscription and billing details for Digi-Print user', () => {
279
265
  cy.contains('Digi-Print')
280
266
  //...rest is same as Print user
281
267
  })
282
-
283
- // This test is going to fail on 13.11.2024 due to graphql changes.
284
- // To be fixed with TMR-1959
285
- it('Should display Invoice history section', () => {
286
- cy.contains('[data-testid="ContentListIntroduction"]', 'Invoice history')
287
- cy.contains('Digi-Print pack')
288
- cy.contains('12 Nov 2023')
289
- cy.contains('Paid')
290
- cy.get('a[data-testid="download-button"]')
291
- .should('have.attr', 'href', '#')
292
- .contains('View')
293
- })
294
268
  })
295
269
 
296
270
  describe('Subscription and billing details for Paypal user', () => {
@@ -31,11 +31,6 @@ Cypress.Commands.add('mockConsent', () => {
31
31
  setConsentLocalStorage()
32
32
  })
33
33
 
34
- Cypress.Commands.add('mockBlaizeJwtAndVisit', (jwtValue, url) => {
35
- cy.setCookie('blaize_jwt', jwtValue)
36
- cy.visit(url)
37
- })
38
-
39
34
  Cypress.Commands.add('GetAcsSession', (user = 'default') => {
40
35
  const { username, password } = userMap[user]
41
36
 
@@ -54,5 +54,9 @@ export const userMap = {
54
54
  username: 'digi-print-card-15-11-22@yopmail.com',
55
55
  password: 'Password123Testing123$',
56
56
  },
57
- }
58
-
57
+ tnlNoSubscription: {
58
+ //registered user with no subscription, tests the number of newsletters displayed
59
+ username: 'tm-test+staging-registered-user@news.co.uk',
60
+ password: 'Growth123',
61
+ },
62
+ }
@@ -6,8 +6,11 @@ import { publisher } from '../config'
6
6
 
7
7
  export const getProviderPropsUtil = (context, options?) => {
8
8
  if (process.env.NODE_ENV === 'development' && publisher === 'TIMES') {
9
- return getProviderPropsTimes(context, {
10
- ...options,
9
+ return getProviderPropsTimes({
10
+ context,
11
+ options: {
12
+ ...options,
13
+ },
11
14
  })
12
15
  }
13
16
 
package/next.config.js CHANGED
@@ -29,67 +29,65 @@ module.exports = (phase) => {
29
29
  }
30
30
 
31
31
  const path = require('path')
32
- const withTM = require('next-transpile-modules')([
33
- '@newskit-render/auth',
34
- '@newskit-render/my-account',
35
- '@newskit-render/validation',
36
- ])
37
32
  const withBundleAnalyzer = require('@next/bundle-analyzer')({
38
33
  enabled: process.env.ANALYZE === 'true',
39
34
  })
40
35
 
41
- return withBundleAnalyzer(
42
- withTM({
43
- webpack: (config, options) => {
44
- if (options.isServer) {
45
- config.externals = ['react', ...config.externals]
46
- }
36
+ return withBundleAnalyzer({
37
+ transpilePackages: [
38
+ '@newskit-render/auth',
39
+ '@newskit-render/my-account',
40
+ '@newskit-render/validation',
41
+ ],
42
+ webpack: (config, options) => {
43
+ if (options.isServer) {
44
+ config.externals = ['react', ...config.externals]
45
+ }
47
46
 
48
- config.resolve.alias.newskit = path.resolve(
49
- __dirname,
50
- '.',
51
- 'node_modules',
52
- 'newskit'
53
- )
54
- config.resolve.alias.react = path.resolve(
55
- __dirname,
56
- '.',
57
- 'node_modules',
58
- 'react'
59
- )
47
+ config.resolve.alias.newskit = path.resolve(
48
+ __dirname,
49
+ '.',
50
+ 'node_modules',
51
+ 'newskit'
52
+ )
53
+ config.resolve.alias.react = path.resolve(
54
+ __dirname,
55
+ '.',
56
+ 'node_modules',
57
+ 'react'
58
+ )
60
59
 
61
- return config
62
- },
63
- images,
64
- output: 'standalone',
65
- async rewrites() {
66
- return [
67
- {
68
- source: '/sitemap.xml',
69
- destination: '/api/sitemap',
70
- },
71
- {
72
- source: '/pages-sitemap.xml',
73
- destination: '/api/pages-sitemap',
74
- },
75
- {
76
- source: '/competitions-sitemap.xml',
77
- destination: '/api/competitions-sitemap',
78
- },
79
- {
80
- source: '/news-sitemap.xml',
81
- destination: '/api/news-sitemap',
82
- },
83
- {
84
- source: '/feed',
85
- destination: '/api/feed',
86
- },
87
- {
88
- source: '/robots.txt',
89
- destination: '/api/robots',
90
- },
91
- ]
92
- },
93
- })
94
- )
60
+ return config
61
+ },
62
+ images,
63
+ output: 'standalone',
64
+ async rewrites() {
65
+ return [
66
+ {
67
+ source: '/sitemap.xml',
68
+ destination: '/api/sitemap',
69
+ },
70
+ {
71
+ source: '/pages-sitemap.xml',
72
+ destination: '/api/pages-sitemap',
73
+ },
74
+ {
75
+ source: '/competitions-sitemap.xml',
76
+ destination: '/api/competitions-sitemap',
77
+ },
78
+ {
79
+ source: '/news-sitemap.xml',
80
+ destination: '/api/news-sitemap',
81
+ },
82
+ {
83
+ source: '/feed',
84
+ destination: '/api/feed',
85
+ },
86
+ {
87
+ source: '/robots.txt',
88
+ destination: '/api/robots',
89
+ },
90
+ ]
91
+ },
92
+ })
95
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newskit-render/core",
3
- "version": "0.0.0-d5e6fac23",
3
+ "version": "0.0.0-d75fd5849",
4
4
  "description": "Newskit Render - Core package",
5
5
  "author": "",
6
6
  "license": "UNLICENSED",
@@ -42,21 +42,21 @@
42
42
  "@emotion/styled": "11.9.3",
43
43
  "@newrelic/next": "0.5.2",
44
44
  "@newrelic/winston-enricher": "4.0.1",
45
- "@newskit-render/api": "^1.14.1",
46
- "@newskit-render/auth": "^1.8.2",
47
- "@newskit-render/checkout": "^3.10.21",
48
- "@newskit-render/feature-flags": "^1.11.1",
49
- "@newskit-render/feed": "^1.8.14",
50
- "@newskit-render/my-account": "^7.83.0-alpha.0",
51
- "@newskit-render/shared-components": "^4.35.1",
52
- "@newskit-render/standalone-components": "^3.23.4",
53
- "@newskit-render/validation": "^1.18.1",
45
+ "@newskit-render/api": "^1.16.51",
46
+ "@newskit-render/auth": "^1.8.70",
47
+ "@newskit-render/checkout": "^3.11.34",
48
+ "@newskit-render/feature-flags": "^1.11.67",
49
+ "@newskit-render/feed": "^1.8.86",
50
+ "@newskit-render/my-account": "^7.125.2",
51
+ "@newskit-render/shared-components": "^4.53.16",
52
+ "@newskit-render/standalone-components": "^3.25.77",
53
+ "@newskit-render/validation": "^1.20.11",
54
54
  "cross-fetch": "3.1.5",
55
55
  "graphql": "16.6.0",
56
56
  "lodash.get": "4.4.2",
57
57
  "newrelic": "10.6.1",
58
58
  "newskit": "7.7.0",
59
- "next": "13.4.4",
59
+ "next": "13.5.10",
60
60
  "react": "18.2.0",
61
61
  "react-dom": "18.2.0",
62
62
  "react-helmet": "6.1.0",
@@ -100,7 +100,6 @@
100
100
  "jest-junit": "15.0.0",
101
101
  "jest-watch-typeahead": "2.2.1",
102
102
  "lint-staged": "13.1.0",
103
- "next-transpile-modules": "10.0.0",
104
103
  "prettier": "2.8.3",
105
104
  "prettier-eslint": "15.0.1",
106
105
  "prettier-eslint-cli": "7.1.0",
@@ -9,18 +9,15 @@ const AccountFamily = (props) => <Family {...props} />
9
9
  export default AccountFamily
10
10
 
11
11
  export const getServerSideProps = async (context) => {
12
- replaceConsoleAndSetTransactionName('Account: Family')
12
+ replaceConsoleAndSetTransactionName('Account: Bonus Accounts')
13
13
  /* start cra-effected */
14
14
  const featureFlags = await getAllFeatureFlags()
15
15
 
16
- const provider = featureFlags?.enable_invite_family_v2_query
17
- ? 'GroupAccountsV2'
18
- : 'GroupAccounts'
19
16
  /* end cra-effected */
20
17
  return getProviderPropsUtil(
21
18
  {
22
19
  ...context,
23
- provider,
20
+ provider: 'GroupAccountsV2',
24
21
  },
25
22
  { featureFlags } /* cra-effected */
26
23
  )
@@ -0,0 +1,14 @@
1
+ import React from 'react'
2
+ import { CancellationStepper } from '@newskit-render/my-account'
3
+ import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
4
+ import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
5
+
6
+ const TMAccountCancellation = (props) => <CancellationStepper {...props} />
7
+
8
+ export default TMAccountCancellation
9
+
10
+ export const getServerSideProps = async (context) => {
11
+ replaceConsoleAndSetTransactionName('Account: Cancellation')
12
+
13
+ return getProviderPropsUtil({ ...context, provider: 'Cancellation' })
14
+ }
@@ -3,15 +3,19 @@ import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
3
3
  import {
4
4
  EditField,
5
5
  editComponentMap,
6
+ broadcastingOnlyEditComponentMap,
6
7
  DynamicPage,
7
8
  } from '@newskit-render/my-account'
8
9
  import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
9
10
  import validation from '../../../validation'
10
11
  import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
12
+ import { publisher } from '../../../config'
13
+ import { Publisher } from '@newskit-render/api'
11
14
 
12
15
  const AccountEditField = (props) => (
13
16
  <DynamicPage
14
17
  objectMap={editComponentMap}
18
+ isPageRestricted={props.isPageRestricted}
15
19
  pageName={props.data.type}
16
20
  Component={EditField}
17
21
  componentProps={props}
@@ -27,9 +31,15 @@ export const getServerSideProps = async (context) => {
27
31
  } = context
28
32
  const doesEditPageExist = Object.keys(editComponentMap).includes(field)
29
33
 
34
+ const isBroadcasting = publisher === Publisher.BROADCASTING
35
+ const broadcastingOnlyPages = Object.keys(broadcastingOnlyEditComponentMap)
36
+
37
+ const isPageRestricted =
38
+ !isBroadcasting && broadcastingOnlyPages.includes(field)
39
+
30
40
  replaceConsoleAndSetTransactionName(`Account: edit ${field}`)
31
41
 
32
- if (!doesEditPageExist) {
42
+ if (!doesEditPageExist || isPageRestricted) {
33
43
  context.res.statusCode = 404
34
44
  // Logging the error for being captured by New Relic
35
45
  console.error(`An error ${context.res.statusCode} occurred on server`)
@@ -40,6 +50,9 @@ export const getServerSideProps = async (context) => {
40
50
 
41
51
  return getProviderPropsUtil(
42
52
  { ...context, provider: 'EditField' },
43
- { featureFlags } /* cra-effected */
53
+ {
54
+ featureFlags,
55
+ isPageRestricted,
56
+ } /* cra-effected */
44
57
  )
45
58
  }
@@ -1,12 +1,22 @@
1
1
  import React from 'react'
2
- import { SubscriptionAndBilling } from '@newskit-render/my-account'
2
+ import {
3
+ SubscriptionAndBilling,
4
+ subscriptionAndBillingContextSun,
5
+ subscriptionAndBillingContext,
6
+ } from '@newskit-render/my-account'
3
7
  import { getAllFeatureFlags } from '@newskit-render/feature-flags' /* cra-effected */
4
8
  import { replaceConsoleAndSetTransactionName } from '../../../helpers/logger'
5
9
  import { getProviderPropsUtil } from '../../../helpers/getProviderPropsUtil'
10
+ import { Publisher } from '@newskit-render/api'
6
11
 
7
- const AccountSubscriptionAndBilling = (props) => (
8
- <SubscriptionAndBilling {...props} />
9
- )
12
+ const AccountSubscriptionAndBilling = (props) => {
13
+ const context =
14
+ props.env.PUBLISHER === Publisher.SUN_UK
15
+ ? subscriptionAndBillingContextSun
16
+ : subscriptionAndBillingContext
17
+
18
+ return <SubscriptionAndBilling {...props} context={context} />
19
+ }
10
20
 
11
21
  export default AccountSubscriptionAndBilling
12
22
 
@@ -14,7 +14,7 @@ export const getServerSideProps = async (context) => {
14
14
  const featureFlags = await getAllFeatureFlags()
15
15
  /* end cra-effected */
16
16
  return getProviderPropsUtil(
17
- { ...context, provider: 'PersonalDetails' },
17
+ { ...context, provider: 'UserHub' },
18
18
  { featureFlags } /* cra-effected */
19
19
  )
20
20
  }
@@ -0,0 +1,16 @@
1
+ import { trackEvent } from '@newskit-render/my-account'
2
+ import { NextApiRequest, NextApiResponse } from 'next'
3
+
4
+ export default function handler(req: NextApiRequest, res: NextApiResponse) {
5
+ if (req.method !== 'POST') {
6
+ return res.status(405).json({ error: 'Method not allowed' })
7
+ }
8
+
9
+ try {
10
+ trackEvent(req)
11
+ res.status(200).end()
12
+ } catch (error) {
13
+ console.error('Error tracking Optimizely event:', error)
14
+ res.status(500).json({ error: 'Internal server error' })
15
+ }
16
+ }
@@ -1,3 +0,0 @@
1
- export const subscription_blaize_jwt = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ7XCJjcG5cIjpcIkFBQUEwMjU1OTcwNDVcIixcInByb2R1Y3RzXCI6W1wiVGhlIFRpbWVzIFNpdGUgUHJvZHVjdFwiLFwiVGltZXMgU3BvcnRzIEFwcFwiLFwiVGhlIFRpbWVzIEVQTCBWaWRlbyBQcm9kdWN0XCIsXCJUaGUgU3VuZGF5IFRpbWVzIGlQaG9uZSBhcHAgcHJvZHVjdFwiLFwiRW1haWwgQnVsbGV0aW5zIFByb2R1Y3RcIixcIlRoZSBTdW5kYXkgVGltZXMgTW9iaSBQcm9kdWN0XCIsXCJUaGUgU3VuZGF5IFRpbWVzIGlQYWQgYXBwIHByb2R1Y3RcIixcImUtcGFwZXIgUHJvZHVjdFwiLFwiRGFpbHkgQ3Jvc3N3b3JkIFByb2R1Y3RcIixcIlRoZSBTdW5kYXkgVGltZXMgU2l0ZSBQcm9kdWN0XCIsXCJUaGUgVGltZXMgTW9iaSBQcm9kdWN0XCIsXCJUaGUgVGltZXMgaVBhZCBhcHAgUHJvZHVjdFwiLFwiRGlnaXRhbCBTdWJzY3JpcHRpb24gUHJvZHVjdFwiLFwiVGhlIFRpbWVzIGlQaG9uZSBhcHAgcHJvZHVjdFwiLFwiVGltZXMrIG1lbWJlcnNoaXAgYmVuZWZpdHMgUHJvZHVjdFwiXX0iLCJodHRwczpcL1wvdGhldGltZXMuY28udWtcL2NwbiI6IkFBQUEwMjU1OTcwNDUiLCJodHRwczpcL1wvdGhldGltZXMuY28udWtcL3N1YnNjcmlwdGlvbiI6IlNVQi0wMDEwOTcyNjQ0IiwiaXNzIjoiLnRoZXRpbWVzLmNvbSIsImh0dHBzOlwvXC90aGV0aW1lcy5jby51a1wvcHJvZHVjdHMiOlsiVGhlIFRpbWVzIFNpdGUgUHJvZHVjdCIsIlRpbWVzIFNwb3J0cyBBcHAiLCJUaGUgVGltZXMgRVBMIFZpZGVvIFByb2R1Y3QiLCJUaGUgU3VuZGF5IFRpbWVzIGlQaG9uZSBhcHAgcHJvZHVjdCIsIkVtYWlsIEJ1bGxldGlucyBQcm9kdWN0IiwiVGhlIFN1bmRheSBUaW1lcyBNb2JpIFByb2R1Y3QiLCJUaGUgU3VuZGF5IFRpbWVzIGlQYWQgYXBwIHByb2R1Y3QiLCJlLXBhcGVyIFByb2R1Y3QiLCJEYWlseSBDcm9zc3dvcmQgUHJvZHVjdCIsIlRoZSBTdW5kYXkgVGltZXMgU2l0ZSBQcm9kdWN0IiwiVGhlIFRpbWVzIE1vYmkgUHJvZHVjdCIsIlRoZSBUaW1lcyBpUGFkIGFwcCBQcm9kdWN0IiwiRGlnaXRhbCBTdWJzY3JpcHRpb24gUHJvZHVjdCIsIlRoZSBUaW1lcyBpUGhvbmUgYXBwIHByb2R1Y3QiLCJUaW1lcysgbWVtYmVyc2hpcCBiZW5lZml0cyBQcm9kdWN0Il0sImV4cCI6MTcxNjk4ODc3OSwiaWF0IjoxNzE2MzgzOTc5fQ.JTqe7UJo985At-2JkuMrH-6H__qzwZwBGRnEJXl4CSM'
2
-
3
- export const registration_blaize_jwt = 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ7XCJjcG5cIjpcIkNQTi1YNlpOWFBRUlFcIixcInByb2R1Y3RzXCI6W119IiwiaHR0cHM6XC9cL3RoZXRpbWVzLmNvLnVrXC9jcG4iOiJDUE4tWDZaTlhQUVJRIiwiaHR0cHM6XC9cL3RoZXRpbWVzLmNvLnVrXC9zdWJzY3JpcHRpb24iOiJFR0FDQy1DUzAwMDAxMzQ0NjI4IiwiaXNzIjoiLnRoZXRpbWVzLmNvLnVrIiwiaHR0cHM6XC9cL3RoZXRpbWVzLmNvLnVrXC9wcm9kdWN0cyI6W10sImV4cCI6MTcyNTQ1NDgwNCwiaWF0IjoxNzI0ODUwMDA0fQ.XGTv2XooQ8VELZsc7bl35D0A9FlOvEWpexNlYpCCK1Q'