@commercetools-frontend/mc-html-template 22.37.0 → 22.38.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.
@@ -70,15 +70,18 @@ const htmlScripts$1 = {
70
70
  "publicPath": "window.__dynamicImportHandler__=function(n){return window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n.replace(/^(\\.\\/)?/,\"\")},window.__dynamicImportPreload__=function(n){return n.map(n=>window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n)};"
71
71
  };
72
72
  const toArray = value => _Array$isArray__default["default"](value) ? value : [value];
73
- const mergeCspDirectives = function () {
73
+ const mergeDirectives = function () {
74
74
  for (var _len = arguments.length, directives = new Array(_len), _key = 0; _key < _len; _key++) {
75
75
  directives[_key] = arguments[_key];
76
76
  }
77
- return _reduceInstanceProperty__default["default"](directives).call(directives, (mergedCsp, csp) => {
77
+ return _reduceInstanceProperty__default["default"](directives).call(directives, (mergedDirectives, directive) => {
78
78
  var _context;
79
- return _Object$assign__default["default"](mergedCsp, _reduceInstanceProperty__default["default"](_context = _Object$keys__default["default"](csp)).call(_context, (acc, directiveKey) => _Object$assign__default["default"](acc, {
80
- [directiveKey]: [...toArray(mergedCsp[directiveKey] ? mergedCsp[directiveKey] : []), ...toArray(csp[directiveKey])]
81
- }), {}));
79
+ return _Object$assign__default["default"](mergedDirectives, _reduceInstanceProperty__default["default"](_context = _Object$keys__default["default"](directive)).call(_context, (mergedDirectiveValues, directiveKey) => {
80
+ const existingDirectiveValue = mergedDirectives[directiveKey];
81
+ return _Object$assign__default["default"](mergedDirectiveValues, {
82
+ [directiveKey]: [...toArray(existingDirectiveValue ?? []), ...toArray(directive[directiveKey])]
83
+ });
84
+ }, {}));
82
85
  }, {});
83
86
  };
84
87
  const toHeaderString = function () {
@@ -153,16 +156,14 @@ const processHeaders = applicationConfig => {
153
156
  );
154
157
 
155
158
  // Recursively merge the directives
156
- const mergedCsp = mergeCspDirectives(cspDirectives, applicationConfig.headers?.csp ?? {});
157
- return _objectSpread(_objectSpread(_objectSpread({}, constants.HTTP_SECURITY_HEADERS), {}, {
159
+ const mergedCsp = mergeDirectives(cspDirectives, applicationConfig.headers?.csp ?? {});
160
+ return _objectSpread(_objectSpread({}, constants.HTTP_SECURITY_HEADERS), {}, {
158
161
  // The `Content-Security-Policy` header is always generated
159
162
  // based on the Merchant Center customization config.
160
163
  'Content-Security-Policy': toHeaderString(mergedCsp)
161
- }, applicationConfig.headers?.strictTransportSecurity && {
162
- 'Strict-Transport-Security': [constants.HTTP_SECURITY_HEADERS['Strict-Transport-Security'], ...applicationConfig.headers.strictTransportSecurity].join('; ')
163
- }), applicationConfig.headers?.permissionsPolicies && {
164
+ }, applicationConfig.headers?.permissionsPolicies ? {
164
165
  'Permissions-Policy': toStructuredHeaderString(applicationConfig.headers.permissionsPolicies)
165
- });
166
+ } : {});
166
167
  };
167
168
 
168
169
  // https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
@@ -70,15 +70,18 @@ const htmlScripts$1 = {
70
70
  "publicPath": "window.__dynamicImportHandler__=function(n){return window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n.replace(/^(\\.\\/)?/,\"\")},window.__dynamicImportPreload__=function(n){return n.map(n=>window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n)};"
71
71
  };
72
72
  const toArray = value => _Array$isArray__default["default"](value) ? value : [value];
73
- const mergeCspDirectives = function () {
73
+ const mergeDirectives = function () {
74
74
  for (var _len = arguments.length, directives = new Array(_len), _key = 0; _key < _len; _key++) {
75
75
  directives[_key] = arguments[_key];
76
76
  }
77
- return _reduceInstanceProperty__default["default"](directives).call(directives, (mergedCsp, csp) => {
77
+ return _reduceInstanceProperty__default["default"](directives).call(directives, (mergedDirectives, directive) => {
78
78
  var _context;
79
- return _Object$assign__default["default"](mergedCsp, _reduceInstanceProperty__default["default"](_context = _Object$keys__default["default"](csp)).call(_context, (acc, directiveKey) => _Object$assign__default["default"](acc, {
80
- [directiveKey]: [...toArray(mergedCsp[directiveKey] ? mergedCsp[directiveKey] : []), ...toArray(csp[directiveKey])]
81
- }), {}));
79
+ return _Object$assign__default["default"](mergedDirectives, _reduceInstanceProperty__default["default"](_context = _Object$keys__default["default"](directive)).call(_context, (mergedDirectiveValues, directiveKey) => {
80
+ const existingDirectiveValue = mergedDirectives[directiveKey];
81
+ return _Object$assign__default["default"](mergedDirectiveValues, {
82
+ [directiveKey]: [...toArray(existingDirectiveValue ?? []), ...toArray(directive[directiveKey])]
83
+ });
84
+ }, {}));
82
85
  }, {});
83
86
  };
84
87
  const toHeaderString = function () {
@@ -153,16 +156,14 @@ const processHeaders = applicationConfig => {
153
156
  );
154
157
 
155
158
  // Recursively merge the directives
156
- const mergedCsp = mergeCspDirectives(cspDirectives, applicationConfig.headers?.csp ?? {});
157
- return _objectSpread(_objectSpread(_objectSpread({}, constants.HTTP_SECURITY_HEADERS), {}, {
159
+ const mergedCsp = mergeDirectives(cspDirectives, applicationConfig.headers?.csp ?? {});
160
+ return _objectSpread(_objectSpread({}, constants.HTTP_SECURITY_HEADERS), {}, {
158
161
  // The `Content-Security-Policy` header is always generated
159
162
  // based on the Merchant Center customization config.
160
163
  'Content-Security-Policy': toHeaderString(mergedCsp)
161
- }, applicationConfig.headers?.strictTransportSecurity && {
162
- 'Strict-Transport-Security': [constants.HTTP_SECURITY_HEADERS['Strict-Transport-Security'], ...applicationConfig.headers.strictTransportSecurity].join('; ')
163
- }), applicationConfig.headers?.permissionsPolicies && {
164
+ }, applicationConfig.headers?.permissionsPolicies ? {
164
165
  'Permissions-Policy': toStructuredHeaderString(applicationConfig.headers.permissionsPolicies)
165
- });
166
+ } : {});
166
167
  };
167
168
 
168
169
  // https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
@@ -46,15 +46,18 @@ const htmlScripts$1 = {
46
46
  "publicPath": "window.__dynamicImportHandler__=function(n){return window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n.replace(/^(\\.\\/)?/,\"\")},window.__dynamicImportPreload__=function(n){return n.map(n=>window.app.cdnUrl.replace(/\\/$/,\"\")+\"/\"+n)};"
47
47
  };
48
48
  const toArray = value => _Array$isArray(value) ? value : [value];
49
- const mergeCspDirectives = function () {
49
+ const mergeDirectives = function () {
50
50
  for (var _len = arguments.length, directives = new Array(_len), _key = 0; _key < _len; _key++) {
51
51
  directives[_key] = arguments[_key];
52
52
  }
53
- return _reduceInstanceProperty(directives).call(directives, (mergedCsp, csp) => {
53
+ return _reduceInstanceProperty(directives).call(directives, (mergedDirectives, directive) => {
54
54
  var _context;
55
- return _Object$assign(mergedCsp, _reduceInstanceProperty(_context = _Object$keys(csp)).call(_context, (acc, directiveKey) => _Object$assign(acc, {
56
- [directiveKey]: [...toArray(mergedCsp[directiveKey] ? mergedCsp[directiveKey] : []), ...toArray(csp[directiveKey])]
57
- }), {}));
55
+ return _Object$assign(mergedDirectives, _reduceInstanceProperty(_context = _Object$keys(directive)).call(_context, (mergedDirectiveValues, directiveKey) => {
56
+ const existingDirectiveValue = mergedDirectives[directiveKey];
57
+ return _Object$assign(mergedDirectiveValues, {
58
+ [directiveKey]: [...toArray(existingDirectiveValue ?? []), ...toArray(directive[directiveKey])]
59
+ });
60
+ }, {}));
58
61
  }, {});
59
62
  };
60
63
  const toHeaderString = function () {
@@ -129,16 +132,14 @@ const processHeaders = applicationConfig => {
129
132
  );
130
133
 
131
134
  // Recursively merge the directives
132
- const mergedCsp = mergeCspDirectives(cspDirectives, applicationConfig.headers?.csp ?? {});
133
- return _objectSpread(_objectSpread(_objectSpread({}, HTTP_SECURITY_HEADERS), {}, {
135
+ const mergedCsp = mergeDirectives(cspDirectives, applicationConfig.headers?.csp ?? {});
136
+ return _objectSpread(_objectSpread({}, HTTP_SECURITY_HEADERS), {}, {
134
137
  // The `Content-Security-Policy` header is always generated
135
138
  // based on the Merchant Center customization config.
136
139
  'Content-Security-Policy': toHeaderString(mergedCsp)
137
- }, applicationConfig.headers?.strictTransportSecurity && {
138
- 'Strict-Transport-Security': [HTTP_SECURITY_HEADERS['Strict-Transport-Security'], ...applicationConfig.headers.strictTransportSecurity].join('; ')
139
- }), applicationConfig.headers?.permissionsPolicies && {
140
+ }, applicationConfig.headers?.permissionsPolicies ? {
140
141
  'Permissions-Policy': toStructuredHeaderString(applicationConfig.headers.permissionsPolicies)
141
- });
142
+ } : {});
142
143
  };
143
144
 
144
145
  // https://babeljs.io/blog/2017/09/11/zero-config-with-babel-macros
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/mc-html-template",
3
- "version": "22.37.0",
3
+ "version": "22.38.0",
4
4
  "description": "Everything related to render the index.html for a MC application",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -38,8 +38,8 @@
38
38
  "dependencies": {
39
39
  "@babel/runtime": "^7.22.15",
40
40
  "@babel/runtime-corejs3": "^7.22.15",
41
- "@commercetools-frontend/application-config": "22.37.0",
42
- "@commercetools-frontend/constants": "22.37.0",
41
+ "@commercetools-frontend/application-config": "22.38.0",
42
+ "@commercetools-frontend/constants": "22.38.0",
43
43
  "serialize-javascript": "6.0.2",
44
44
  "uglify-js": "3.18.0",
45
45
  "uglifycss": "0.0.29"