@financial-times/n-conversion-forms 30.0.1 → 31.0.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.
Files changed (101) hide show
  1. package/.circleci/config.yml +97 -150
  2. package/.toolkitrc.yml +19 -0
  3. package/.toolkitstate/ci.json +6 -0
  4. package/README.md +2 -2
  5. package/components/__snapshots__/package-change.spec.js.snap +15 -0
  6. package/components/accept-terms-subscription.jsx +50 -0
  7. package/components/index.jsx +1 -0
  8. package/components/package-change.jsx +13 -9
  9. package/components/package-change.spec.js +17 -0
  10. package/components/package-change.stories.js +8 -0
  11. package/components/payment-term.jsx +51 -14
  12. package/components/payment-term.spec.js +47 -0
  13. package/components/payment-term.stories.js +20 -0
  14. package/components/seven-day-pass-experiment-confirmation.jsx +110 -0
  15. package/components/seven-day-pass-experiment-confirmation.stories.js +33 -0
  16. package/jest.config.js +2 -0
  17. package/package.json +30 -16
  18. package/.circleci/shared-helpers/.github/settings.yml +0 -1
  19. package/.circleci/shared-helpers/CODEOWNERS +0 -3
  20. package/.circleci/shared-helpers/README.md +0 -72
  21. package/.circleci/shared-helpers/helper-check-service-ready +0 -37
  22. package/.circleci/shared-helpers/helper-configure-awscli +0 -20
  23. package/.circleci/shared-helpers/helper-generate-build-state-artifacts +0 -29
  24. package/.circleci/shared-helpers/helper-install-awscli +0 -14
  25. package/.circleci/shared-helpers/helper-install-puppeteer-deps +0 -25
  26. package/.circleci/shared-helpers/helper-npm-install-peer-deps +0 -40
  27. package/.circleci/shared-helpers/helper-npm-store-auth-token +0 -14
  28. package/.circleci/shared-helpers/helper-npm-update +0 -26
  29. package/.circleci/shared-helpers/helper-npm-version-and-publish-public +0 -19
  30. package/.circleci/shared-helpers/helper-publish-github-pages +0 -43
  31. package/.circleci/shared-helpers/helper-setup-heroku-cli +0 -46
  32. package/.circleci/shared-helpers/helper-setup-s3-upload +0 -17
  33. package/.circleci/shared-helpers/helper-upload-assets-to-s3 +0 -69
  34. package/.circleci/shared-helpers/helper.example +0 -13
  35. package/build-state/npm-shrinkwrap.json +0 -58461
  36. package/dist/accept-terms-business.js +0 -74
  37. package/dist/accept-terms-business.spec.js +0 -40
  38. package/dist/accept-terms-privacy-policy.js +0 -71
  39. package/dist/accept-terms-subscription.js +0 -124
  40. package/dist/accept-terms.js +0 -217
  41. package/dist/app-banner.js +0 -51
  42. package/dist/b2c-partnership-confirmation.js +0 -64
  43. package/dist/billing-city.js +0 -58
  44. package/dist/billing-country.js +0 -43
  45. package/dist/billing-postcode.js +0 -76
  46. package/dist/company-name.js +0 -78
  47. package/dist/confirmation.js +0 -117
  48. package/dist/continue-reading.js +0 -45
  49. package/dist/country.js +0 -106
  50. package/dist/customer-care.js +0 -52
  51. package/dist/debug.js +0 -50
  52. package/dist/decision-maker.js +0 -72
  53. package/dist/deferred-billing-terms.js +0 -112
  54. package/dist/delivery-address-map.js +0 -184
  55. package/dist/delivery-address-type.js +0 -74
  56. package/dist/delivery-address.js +0 -123
  57. package/dist/delivery-city.js +0 -70
  58. package/dist/delivery-county.js +0 -48
  59. package/dist/delivery-instructions.js +0 -123
  60. package/dist/delivery-option.js +0 -77
  61. package/dist/delivery-po-box.js +0 -75
  62. package/dist/delivery-postcode.js +0 -116
  63. package/dist/delivery-security-instructions.js +0 -72
  64. package/dist/delivery-start-date.js +0 -77
  65. package/dist/education-job-title.js +0 -67
  66. package/dist/email.js +0 -90
  67. package/dist/error-page.js +0 -45
  68. package/dist/fieldset.js +0 -58
  69. package/dist/first-name.js +0 -73
  70. package/dist/form.js +0 -29
  71. package/dist/google-sign-in.js +0 -24
  72. package/dist/graduation-date.js +0 -112
  73. package/dist/index.js +0 -425
  74. package/dist/industry.js +0 -81
  75. package/dist/job-title.js +0 -65
  76. package/dist/last-name.js +0 -73
  77. package/dist/licence-confirmation.js +0 -67
  78. package/dist/licence-header.js +0 -52
  79. package/dist/licence-sign-in.js +0 -36
  80. package/dist/licence-title.js +0 -46
  81. package/dist/lite-sub-confirmation.js +0 -118
  82. package/dist/loader.js +0 -54
  83. package/dist/message.js +0 -101
  84. package/dist/message.spec.js +0 -96
  85. package/dist/organisation.js +0 -73
  86. package/dist/package-change.js +0 -36
  87. package/dist/password.js +0 -95
  88. package/dist/payment-term.js +0 -300
  89. package/dist/payment-type.js +0 -213
  90. package/dist/personal-title.js +0 -94
  91. package/dist/phone.js +0 -85
  92. package/dist/position.js +0 -86
  93. package/dist/progress-indicator.js +0 -66
  94. package/dist/province.js +0 -80
  95. package/dist/registration-confirmation.js +0 -108
  96. package/dist/responsibility.js +0 -84
  97. package/dist/section.js +0 -20
  98. package/dist/state.js +0 -80
  99. package/dist/submit.js +0 -52
  100. package/dist/text-input.js +0 -78
  101. package/dist/trial-banner.js +0 -29
@@ -1,168 +1,115 @@
1
- # generator: n-circle2-cli
2
- # template: component
3
-
4
- references:
5
-
6
- container_config_node: &container_config_node
7
- working_directory: ~/project/build
1
+ # CONFIG GENERATED BY DOTCOM-TOOL-KIT, DO NOT EDIT BY HAND
2
+ version: 2.1
3
+ orbs:
4
+ tool-kit: financial-times/dotcom-tool-kit@4
5
+ executors:
6
+ node:
8
7
  docker:
9
8
  - image: cimg/node:18.17-browsers
10
- workspace_root: &workspace_root
11
- ~/project
12
-
13
- attach_workspace: &attach_workspace
14
- attach_workspace:
15
- at: *workspace_root
16
-
17
- npm_cache_keys: &npm_cache_keys
18
- keys:
19
- - v3-dependency-npm-{{ checksum "package.json" }}-
20
- - v3-dependency-npm-{{ checksum "package.json" }}
21
- - v3-dependency-npm-
22
-
23
- cache_npm_cache: &cache_npm_cache
24
- save_cache:
25
- key: v3-dependency-npm-{{ checksum "package.json" }}-{{ epoch }}
26
- paths:
27
- - ./node_modules/
28
-
29
- restore_npm_cache: &restore_npm_cache
30
- restore_cache:
31
- <<: *npm_cache_keys
32
-
33
- filters_only_main: &filters_only_main
34
- branches:
35
- only: main
36
-
37
- filters_only_renovate_nori: &filters_only_renovate_nori
38
- branches:
39
- only: /(^renovate-.*|^nori/.*)/
40
-
41
- filters_ignore_tags_renovate_nori: &filters_ignore_tags_renovate_nori
42
- tags:
43
- ignore: /.*/
44
- branches:
45
- ignore: /(^renovate-.*|^nori/.*)/
46
-
47
- filters_version_tag: &filters_version_tag
48
- tags:
49
- only:
50
- - /^v?\d+\.\d+\.\d+(?:-beta\.\d+)?$/
51
- branches:
52
- ignore: /.*/
53
-
54
- version: 2.1
55
-
56
9
  jobs:
57
-
58
- build:
59
- <<: *container_config_node
10
+ checkout:
11
+ docker:
12
+ - image: cimg/base:stable
60
13
  steps:
61
14
  - checkout
62
- - run:
63
- name: Checkout next-ci-shared-helpers
64
- command: git clone --depth 1 git@github.com:Financial-Times/next-ci-shared-helpers.git --branch unpin-heroku .circleci/shared-helpers
65
- - *restore_npm_cache
66
- - run:
67
- name: Install project dependencies
68
- command: make install
69
- - run:
70
- name: Run the project build task
71
- command: make build
72
- - run:
73
- name: shared-helper / generate-build-state-artifacts
74
- command: .circleci/shared-helpers/helper-generate-build-state-artifacts
75
- when: always
76
- - *cache_npm_cache
77
- - store_artifacts:
78
- path: build-state
79
- destination: build-state
80
- - persist_to_workspace:
81
- root: *workspace_root
82
- paths:
83
- - build
84
-
85
- test:
86
- <<: *container_config_node
87
- steps:
88
- - *attach_workspace
89
- - run:
90
- name: Run tests
91
- command: npm run lint && make test
92
- environment:
93
- JEST_JUNIT_OUTPUT: test-results/jest/results.xml
94
- MOCHA_FILE: test-results/mocha/results.xml
95
- - store_test_results:
96
- path: test-results
97
- - store_artifacts:
98
- path: test-results
99
- destination: test-results
100
-
101
- publish:
102
- <<: *container_config_node
103
- steps:
104
- - *attach_workspace
105
- - run:
106
- name: shared-helper / npm-store-auth-token
107
- command: .circleci/shared-helpers/helper-npm-store-auth-token
108
- - run: npx snyk monitor --org=customer-products --project-name=Financial-Times/n-conversion-forms
109
- - run:
110
- name: shared-helper / npm-version-and-publish-public
111
- command: .circleci/shared-helpers/helper-npm-version-and-publish-public
112
-
15
+ - tool-kit/persist-workspace:
16
+ path: .
113
17
  workflows:
114
-
115
- version: 2
116
-
117
- build-test:
118
- jobs:
119
- - build:
120
- filters:
121
- <<: *filters_ignore_tags_renovate_nori
122
- - test:
123
- requires:
124
- - build
125
-
126
- build-test-publish:
18
+ tool-kit:
19
+ when:
20
+ not:
21
+ equal:
22
+ - scheduled_pipeline
23
+ - << pipeline.trigger_source >>
127
24
  jobs:
128
- - build:
25
+ - checkout:
129
26
  filters:
130
- <<: *filters_version_tag
131
- - test:
27
+ tags:
28
+ only: /^v\d+\.\d+\.\d+(-.+)?/
29
+ - waiting-for-approval:
30
+ type: approval
132
31
  filters:
133
- <<: *filters_version_tag
32
+ branches:
33
+ only: /(^renovate-.*|^nori/.*)/
34
+ tags:
35
+ only: /^v\d+\.\d+\.\d+(-.+)?/
36
+ - tool-kit/setup:
37
+ name: tool-kit/setup-<< matrix.executor >>
134
38
  requires:
135
- - build
136
- - publish:
137
- context: npm-publish-token
39
+ - checkout
40
+ - waiting-for-approval
41
+ matrix:
42
+ parameters:
43
+ executor:
44
+ - node
138
45
  filters:
139
- <<: *filters_version_tag
46
+ tags:
47
+ only: /^v\d+\.\d+\.\d+(-.+)?/
48
+ - tool-kit/build:
49
+ name: tool-kit/build-<< matrix.executor >>
140
50
  requires:
141
- - test
142
-
143
- renovate-nori-build-test-provision:
144
- jobs:
145
- - waiting-for-approval:
146
- type: approval
51
+ - tool-kit/setup-<< matrix.executor >>
52
+ matrix:
53
+ parameters:
54
+ executor:
55
+ - node
147
56
  filters:
148
- <<: *filters_only_renovate_nori
149
- - build:
57
+ tags:
58
+ only: /^v\d+\.\d+\.\d+(-.+)?/
59
+ - tool-kit/test:
60
+ name: tool-kit/test-<< matrix.executor >>
150
61
  requires:
151
- - waiting-for-approval
152
- - test:
62
+ - tool-kit/build-<< matrix.executor >>
63
+ matrix:
64
+ parameters:
65
+ executor:
66
+ - node
67
+ filters:
68
+ tags:
69
+ only: /^v\d+\.\d+\.\d+(-.+)?/
70
+ - tool-kit/publish-tag:
153
71
  requires:
154
- - build
155
-
156
- nightly:
157
- triggers:
158
- - schedule:
159
- cron: "0 0 * * *"
72
+ - tool-kit/test-node
73
+ name: tool-kit/publish-tag-node
74
+ executor: node
160
75
  filters:
161
- <<: *filters_only_main
76
+ tags:
77
+ only: /^v\d+\.\d+\.\d+(-.+)?/
78
+ branches:
79
+ ignore: /.*/
80
+ context: npm-publish-token
81
+ nightly:
82
+ when:
83
+ and:
84
+ - equal:
85
+ - scheduled_pipeline
86
+ - << pipeline.trigger_source >>
87
+ - equal:
88
+ - nightly
89
+ - << pipeline.schedule.name >>
162
90
  jobs:
163
- - build:
164
- context: next-nightly-build
165
- - test:
91
+ - checkout
92
+ - tool-kit/setup:
93
+ name: tool-kit/setup-<< matrix.executor >>
94
+ requires:
95
+ - checkout
96
+ matrix:
97
+ parameters:
98
+ executor:
99
+ - node
100
+ - tool-kit/build:
101
+ name: tool-kit/build-<< matrix.executor >>
102
+ requires:
103
+ - tool-kit/setup-<< matrix.executor >>
104
+ matrix:
105
+ parameters:
106
+ executor:
107
+ - node
108
+ - tool-kit/test:
109
+ name: tool-kit/test-<< matrix.executor >>
166
110
  requires:
167
- - build
168
- context: next-nightly-build
111
+ - tool-kit/build-<< matrix.executor >>
112
+ matrix:
113
+ parameters:
114
+ executor:
115
+ - node
package/.toolkitrc.yml ADDED
@@ -0,0 +1,19 @@
1
+ plugins:
2
+ - "@dotcom-tool-kit/component"
3
+ - "@dotcom-tool-kit/jest"
4
+ - "@dotcom-tool-kit/eslint"
5
+ - "@dotcom-tool-kit/prettier"
6
+ - "@dotcom-tool-kit/lint-staged"
7
+ hooks:
8
+ git:precommit:
9
+ - SecretSquirrel
10
+ - LintStaged
11
+ test:local:
12
+ - Eslint
13
+ - JestLocal
14
+ test:ci:
15
+ - Eslint
16
+ - JestCI
17
+ options:
18
+ "@dotcom-tool-kit/circleci":
19
+ nodeVersion: 18.17-browsers
@@ -0,0 +1,6 @@
1
+ {
2
+ "branch": "",
3
+ "repo": "n-conversion-forms",
4
+ "version": "c11f11ba33cddfdac510ecca5f74fc304bdc6eda",
5
+ "tag": "v31.0.0"
6
+ }
package/README.md CHANGED
@@ -6,8 +6,8 @@ Contains HTML and CSS that's used within the conversion forms
6
6
  [![Known Vulnerabilities](https://snyk.io/test/github/Financial-Times/n-conversion-forms/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Financial-Times/n-conversion-forms?targetFile=package.json)
7
7
 
8
8
  ```bash
9
- make install # install all dependencies
10
- make run # build and start documentation app at http://local.ft.com:5005/
9
+ npm install # install all dependencies
10
+ npm run storybook # build and start documentation app at http://local.ft.com:5005/
11
11
  ```
12
12
 
13
13
  ## Table of contents
@@ -1,5 +1,20 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`PackageChange annual render when is7DayPassExperiment is true 1`] = `
4
+ <div class="ncf__package-change">
5
+ <div class="ncf__package-change__package">
6
+ <div class="ncf__package-change__content">
7
+ <p>
8
+ You have chosen
9
+ <span class="ncf__strong">
10
+ Trial
11
+ </span>
12
+ </p>
13
+ </div>
14
+ </div>
15
+ </div>
16
+ `;
17
+
3
18
  exports[`PackageChange annual render with defaults 1`] = `
4
19
  <div class="ncf__package-change">
5
20
  <div class="ncf__package-change__package">
@@ -9,6 +9,7 @@ export function AcceptTermsSubscription({
9
9
  isTrial = false,
10
10
  isPrintProduct = false,
11
11
  isSingleTerm = false,
12
+ is7DayPassExperiment = false,
12
13
  isTransition = false,
13
14
  transitionType = null,
14
15
  isDeferredBilling = false,
@@ -37,6 +38,54 @@ export function AcceptTermsSubscription({
37
38
  required: true,
38
39
  };
39
40
 
41
+ if (is7DayPassExperiment) {
42
+ return (
43
+ <div {...divProps}>
44
+ <ul className="o-typography-list ncf__accept-terms-list">
45
+ <li>
46
+ <span className="terms-transition terms-transition--immediate">
47
+ I give consent for my chosen payment method to be charged
48
+ automatically.
49
+ </span>
50
+ </li>
51
+ <li>
52
+ <span className="terms-transition terms-transition--immediate">
53
+ By placing your order subject to the Terms & Conditions (save for
54
+ section 2) referred to below, you are waiving your statutory right
55
+ to cancel our contract within 14 days of payment. Your payment is
56
+ a one-time payment collected at the time of checkout, and
57
+ unsubscribing or cancelling at any point (whether before or after
58
+ the 14-day period) will not entitle you to a refund.
59
+ </span>
60
+ </li>
61
+ <li>
62
+ <span className="terms-transition">
63
+ Please see here for the complete{' '}
64
+ <a
65
+ className="ncf__link--external"
66
+ href="http://help.ft.com/help/legal-privacy/terms-conditions/"
67
+ target="_blank"
68
+ rel="noopener noreferrer"
69
+ >
70
+ Terms &amp; Conditions
71
+ </a>
72
+ .
73
+ </span>
74
+ </li>
75
+ </ul>
76
+ <label className={labelClassName} htmlFor="termsAcceptance">
77
+ <input {...inputProps} />
78
+ <span className="o-forms-input__label">
79
+ I agree to the above terms &amp; conditions.
80
+ </span>
81
+ <p className="o-forms-input__error">
82
+ Please accept our terms &amp; conditions
83
+ </p>
84
+ </label>
85
+ </div>
86
+ );
87
+ }
88
+
40
89
  const transitionTerms = isTransition && (
41
90
  <>
42
91
  {!isSingleTerm && (
@@ -209,6 +258,7 @@ AcceptTermsSubscription.propTypes = {
209
258
  isTrial: PropTypes.bool,
210
259
  isPrintProduct: PropTypes.bool,
211
260
  isSingleTerm: PropTypes.bool,
261
+ is7DayPassExperiment: PropTypes.bool,
212
262
  isTransition: PropTypes.bool,
213
263
  transitionType: PropTypes.string,
214
264
  isDeferredBilling: PropTypes.bool,
@@ -49,6 +49,7 @@ export { Province } from './province';
49
49
  export { RegistrationConfirmation } from './registration-confirmation';
50
50
  export { Responsibility } from './responsibility';
51
51
  export { Section } from './section';
52
+ export { SevenDayPassExperimentConfirmation } from './seven-day-pass-experiment-confirmation';
52
53
  export { State } from './state';
53
54
  export { Submit } from './submit';
54
55
  export { TrialBanner } from './trial-banner';
@@ -5,6 +5,7 @@ export function PackageChange({
5
5
  changePackageUrl,
6
6
  currentPackage,
7
7
  packageDescription,
8
+ is7DayPassExperiment,
8
9
  }) {
9
10
  return (
10
11
  <div className="ncf__package-change">
@@ -20,15 +21,17 @@ export function PackageChange({
20
21
  </p>
21
22
  )}
22
23
  </div>
23
- <div className="ncf__package-change__actions">
24
- <a
25
- href={changePackageUrl}
26
- className="ncf__button ncf__button--mono ncf__button--baseline"
27
- data-trackable="change"
28
- >
29
- Change
30
- </a>
31
- </div>
24
+ {!is7DayPassExperiment && (
25
+ <div className="ncf__package-change__actions">
26
+ <a
27
+ href={changePackageUrl}
28
+ className="ncf__button ncf__button--mono ncf__button--baseline"
29
+ data-trackable="change"
30
+ >
31
+ Change
32
+ </a>
33
+ </div>
34
+ )}
32
35
  </div>
33
36
  </div>
34
37
  );
@@ -38,4 +41,5 @@ PackageChange.propTypes = {
38
41
  changePackageUrl: PropTypes.string.isRequired,
39
42
  currentPackage: PropTypes.string.isRequired,
40
43
  packageDescription: PropTypes.string,
44
+ is7DayPassExperiment: PropTypes.bool,
41
45
  };
@@ -74,6 +74,23 @@ describe('PackageChange', () => {
74
74
 
75
75
  expect(PackageChange).toRenderCorrectly(props);
76
76
  });
77
+
78
+ it('render when is7DayPassExperiment is true', () => {
79
+ const props = {
80
+ changePackageUrl: 'https://www.ft.com',
81
+ currentPackage: 'Trial',
82
+ is7DayPassExperiment: true,
83
+ terms: [
84
+ {
85
+ name: term,
86
+ price: '£1.00',
87
+ weeklyPrice: '£1.00',
88
+ },
89
+ ],
90
+ };
91
+
92
+ expect(PackageChange).toRenderCorrectly(props);
93
+ });
77
94
  });
78
95
  });
79
96
  });
@@ -18,3 +18,11 @@ WithPackageDescription.args = {
18
18
  changePackageUrl: 'https://ft.com/products',
19
19
  packageDescription: 'Personalised email briefings and alerts',
20
20
  };
21
+
22
+ export const SevenDayPassExperiment = (args) => <PackageChange {...args} />;
23
+ SevenDayPassExperiment.args = {
24
+ currentPackage: 'Premium Digital',
25
+ changePackageUrl: 'https://ft.com/products',
26
+ packageDescription: 'Personalised email briefings and alerts',
27
+ is7DayPassExperiment: true,
28
+ };
@@ -15,6 +15,7 @@ export function PaymentTerm({
15
15
  largePrice = false,
16
16
  optionsInARow = false,
17
17
  billingCountry = '',
18
+ is7DayPassExperiment = false,
18
19
  }) {
19
20
  /**
20
21
  * Compute monthly price for given term name
@@ -107,11 +108,24 @@ export function PaymentTerm({
107
108
  },
108
109
  monthly: {
109
110
  title: 'Monthly',
110
- price: (price) => (
111
- <React.Fragment>
112
- <span className="ncf__payment-term__price">{price}</span> per month
113
- </React.Fragment>
114
- ),
111
+ price: (price, is7DayPassExperiment) => {
112
+ const paymentIntervalTextToDisplay = (() => {
113
+ switch (true) {
114
+ case is7DayPassExperiment:
115
+ return ' one-time payment';
116
+
117
+ default:
118
+ return ' per month';
119
+ }
120
+ })();
121
+
122
+ return (
123
+ <React.Fragment>
124
+ <span className="ncf__payment-term__price">{price}</span>
125
+ {paymentIntervalTextToDisplay}
126
+ </React.Fragment>
127
+ );
128
+ },
115
129
  trialPrice: (price) => (
116
130
  <React.Fragment>
117
131
  Unless you cancel during your trial you will be billed{' '}
@@ -120,10 +134,20 @@ export function PaymentTerm({
120
134
  </React.Fragment>
121
135
  ),
122
136
  monthlyPrice: () => {},
123
- renewsText: (isFixedTermOffer) => {
124
- const textToDisplay = isFixedTermOffer
125
- ? 'This subscription is for 3 months, charged monthly. You can cancel at anytime'
126
- : 'Renews monthly unless cancelled';
137
+ renewsText: (isFixedTermOffer, is7DayPassExperiment) => {
138
+ const textToDisplay = (() => {
139
+ switch (true) {
140
+ case is7DayPassExperiment:
141
+ return 'This subscription is for 7 days, charged at the outset.';
142
+
143
+ case isFixedTermOffer:
144
+ return 'This subscription is for 3 months, charged monthly. You can cancel at anytime';
145
+
146
+ default:
147
+ return 'Renews monthly unless cancelled';
148
+ }
149
+ })();
150
+
127
151
  return (
128
152
  <p className="ncf__payment-term__renews-text">{textToDisplay}</p>
129
153
  );
@@ -218,9 +242,12 @@ export function PaymentTerm({
218
242
  <React.Fragment>
219
243
  {nameMap[option.name] ? (
220
244
  <div className="ncf__payment-term__description">
221
- {nameMap[option.name].price(option.price)}
245
+ {nameMap[option.name].price(option.price, is7DayPassExperiment)}
222
246
  {nameMap[option.name].monthlyPrice(option.monthlyPrice)}
223
- {nameMap[option.name].renewsText(isFixedTermOffer)}
247
+ {nameMap[option.name].renewsText(
248
+ isFixedTermOffer,
249
+ is7DayPassExperiment
250
+ )}
224
251
  {/* Remove this discount text temporarily in favour of monthly price */}
225
252
  {/* <br />Save up to 25% when you pay annually */}
226
253
  </div>
@@ -262,11 +289,21 @@ export function PaymentTerm({
262
289
  const showTrialCopyInTitle =
263
290
  option.isTrial && !isPrintOrBundle && !isEpaper;
264
291
 
265
- const defaultTitle =
266
- option.name && nameMap[option.name] ? nameMap[option.name].title : '';
292
+ const defaultTitle = (() => {
293
+ switch (true) {
294
+ case is7DayPassExperiment:
295
+ return '';
296
+
297
+ case Boolean(option.name && nameMap[option.name]):
298
+ return nameMap[option.name].title;
299
+
300
+ default:
301
+ return '';
302
+ }
303
+ })();
267
304
 
268
305
  const title = isFixedTermOffer
269
- ? `${offerDisplayName} - ${defaultTitle}`
306
+ ? [offerDisplayName, defaultTitle].filter(Boolean).join(' - ')
270
307
  : defaultTitle;
271
308
 
272
309
  let termDisplayName = '';
@@ -153,6 +153,37 @@ describe('PaymentTerm', () => {
153
153
  });
154
154
  });
155
155
 
156
+ describe('given is7DayPassExperiment is true', () => {
157
+ const options = [
158
+ {
159
+ name: 'monthly',
160
+ price: '$5.00',
161
+ value: 'monthly',
162
+ monthlyPrice: '$5.00',
163
+ },
164
+ ];
165
+ const wrapper = shallow(
166
+ <PaymentTerm
167
+ isFixedTermOffer={true}
168
+ options={options}
169
+ offerDisplayName="7-day pass"
170
+ is7DayPassExperiment={true}
171
+ />
172
+ );
173
+
174
+ it('renders renewal text that actually reflects how the 7-day pass is a fixed term subscription with a one-off payment made at the outset', () => {
175
+ expect(wrapper.find('.ncf__payment-term__renews-text').text()).toMatch(
176
+ /This subscription is for 7 days, charged at the outset./
177
+ );
178
+ });
179
+
180
+ it('renders offer name and omits payment term title', () => {
181
+ expect(wrapper.find('.ncf__payment-term__title').text()).toMatch(
182
+ '7-day pass'
183
+ );
184
+ });
185
+ });
186
+
156
187
  describe('getDisplayName', () => {
157
188
  const baseOptions = {
158
189
  name: 'monthly',
@@ -199,6 +230,22 @@ describe('PaymentTerm', () => {
199
230
  );
200
231
  });
201
232
  });
233
+ describe('7-day pass experiment', () => {
234
+ const options = [
235
+ {
236
+ ...baseOptions,
237
+ isTrial: false,
238
+ },
239
+ ];
240
+ it('renders with time period only if trial.option == false', () => {
241
+ const wrapper = shallow(
242
+ <PaymentTerm options={options} is7DayPassExperiment={true} />
243
+ );
244
+ expect(wrapper.find('.ncf__payment-term__label').text().trim()).toMatch(
245
+ '£20.00 one-time paymentThis subscription is for 7 days, charged at the outset.'
246
+ );
247
+ });
248
+ });
202
249
  });
203
250
 
204
251
  describe('[data-base-amount]', () => {
@@ -109,6 +109,26 @@ FixedTermOffer.args = {
109
109
  offerDisplayName: 'Mix & Match',
110
110
  };
111
111
 
112
+ export const SevenDayPassExperimentOffer = (args) => (
113
+ <div className="ncf">
114
+ <Fieldset>
115
+ <PaymentTerm {...args} />
116
+ </Fieldset>
117
+ </div>
118
+ );
119
+ SevenDayPassExperimentOffer.args = {
120
+ options: [
121
+ {
122
+ name: 'monthly',
123
+ price: '$5.00',
124
+ value: 5.0,
125
+ },
126
+ ],
127
+ isFixedTermOffer: true,
128
+ is7DayPassExperiment: true,
129
+ offerDisplayName: '7-day pass',
130
+ };
131
+
112
132
  export const RenewOffers = (args) => (
113
133
  <div className="ncf">
114
134
  <Fieldset>