@ons/design-system 74.0.0-next.15 → 74.0.0-next.16

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/js/chart.js CHANGED
@@ -1,4 +1,2 @@
1
1
  import '../components/chart/chart';
2
2
  import '../components/chart/chart.dom';
3
- import '../components/chart/chart-iframe-resize';
4
- import '../components/chart/chart-iframe-resize.dom';
@@ -167,27 +167,10 @@ function getCookieDomain() {
167
167
  if (configuredDomain !== null) {
168
168
  return configuredDomain;
169
169
  } else {
170
- return extractDomainFromUrl(document.location.hostname);
170
+ return document.location.hostname;
171
171
  }
172
172
  }
173
173
 
174
- export function extractDomainFromUrl(url) {
175
- if (url.indexOf('localhost') >= 0 || url.indexOf('127.0.0.1') >= 0) {
176
- return 'localhost';
177
- }
178
-
179
- const pattern = '(\\.co\\.uk|\\.onsdigital\\.uk|\\.gov\\.uk)';
180
- const tlds = new RegExp(pattern);
181
-
182
- const isKnownDomain = tlds.test(url);
183
-
184
- if (isKnownDomain) {
185
- return url;
186
- }
187
-
188
- return '';
189
- }
190
-
191
174
  function getCookieDomainAttribute() {
192
175
  const domain = getCookieDomain();
193
176
 
@@ -3,7 +3,7 @@
3
3
  * @jest-environment-options {"url":"https://www.ons.gov.uk/"}
4
4
  */
5
5
 
6
- import { extractDomainFromUrl, setConsentCookie, setCookie } from './cookies-functions';
6
+ import { setConsentCookie, setCookie } from './cookies-functions';
7
7
 
8
8
  let cookieAssignments = [];
9
9
  let mockCookieStore = {};
@@ -45,20 +45,7 @@ describe('script: cookies-functions', () => {
45
45
  });
46
46
  });
47
47
 
48
- test('uses the Go port domain rule for known hosts', () => {
49
- expect(extractDomainFromUrl('www.ons.gov.uk')).toBe('www.ons.gov.uk');
50
- expect(extractDomainFromUrl('eq.census.gov.uk')).toBe('eq.census.gov.uk');
51
- expect(extractDomainFromUrl('service.onsdigital.uk')).toBe('service.onsdigital.uk');
52
- expect(extractDomainFromUrl('service.co.uk')).toBe('service.co.uk');
53
- });
54
-
55
- test('uses the Go port domain rule for local and unrecognised hosts', () => {
56
- expect(extractDomainFromUrl('localhost')).toBe('localhost');
57
- expect(extractDomainFromUrl('127.0.0.1')).toBe('localhost');
58
- expect(extractDomainFromUrl('service.example.com')).toBe('');
59
- });
60
-
61
- test('sets a domain cookie by default on a known hostname', () => {
48
+ test('sets a domain cookie using the current hostname by default', () => {
62
49
  setCookie('ons_cookie_policy', 'test-value', { days: 365 });
63
50
 
64
51
  expect(cookieAssignments).toHaveLength(1);
@@ -263,7 +263,7 @@
263
263
  (function() {
264
264
  var s = [ '{{ assetsUrl }}/scripts/main.js' ],
265
265
  c = document.createElement('script');
266
- var hasCharts = !!document.querySelector('[data-highcharts-base-chart], .ons-chart__iframe-wrapper iframe');
266
+ var hasCharts = !!document.querySelector('[data-highcharts-base-chart]');
267
267
 
268
268
  if (hasCharts) {
269
269
  s.push('{{ assetsUrl }}/scripts/chart.js');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ons/design-system",
3
3
  "description": "ONS Design System built CSS, JS, and Nunjucks templates",
4
- "version": "74.0.0-next.15",
4
+ "version": "74.0.0-next.16",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -144,8 +144,7 @@
144
144
  "access": "public"
145
145
  },
146
146
  "dependencies": {
147
- "highcharts": "12.1.2",
148
- "pym.js": "1.3.2"
147
+ "highcharts": "12.1.2"
149
148
  },
150
149
  "resolutions": {
151
150
  "backstopjs/puppeteer": "25.11.0",