@strapi/plugin-users-permissions 5.0.0-beta.1 → 5.0.0-beta.3

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 (73) hide show
  1. package/admin/src/pages/AdvancedSettings/index.jsx +4 -4
  2. package/admin/src/pages/EmailTemplates/index.jsx +3 -4
  3. package/admin/src/pages/Providers/index.jsx +3 -4
  4. package/admin/src/pages/Roles/pages/CreatePage.jsx +3 -4
  5. package/admin/src/pages/Roles/pages/EditPage.jsx +3 -4
  6. package/admin/src/pages/Roles/pages/ListPage/index.jsx +3 -4
  7. package/dist/_chunks/{index-_UNneVIg.js → index-21XWiNaI.js} +21 -37
  8. package/dist/_chunks/index-21XWiNaI.js.map +1 -0
  9. package/dist/_chunks/{index-gw-9XoIT.js → index-5Su9tV8W.js} +16 -22
  10. package/dist/_chunks/index-5Su9tV8W.js.map +1 -0
  11. package/dist/_chunks/{index-DtWla9tx.mjs → index-EfXIfij8.mjs} +9 -15
  12. package/dist/_chunks/index-EfXIfij8.mjs.map +1 -0
  13. package/dist/_chunks/{index-46oU0LRy.js → index-Ev6k_nHX.js} +11 -17
  14. package/dist/_chunks/index-Ev6k_nHX.js.map +1 -0
  15. package/dist/_chunks/{index-UxzhJuP2.js → index-I7wqiaSz.js} +13 -19
  16. package/dist/_chunks/index-I7wqiaSz.js.map +1 -0
  17. package/dist/_chunks/{index-G9pZniMC.mjs → index-J5bVMwKb.mjs} +10 -16
  18. package/dist/_chunks/index-J5bVMwKb.mjs.map +1 -0
  19. package/dist/_chunks/{index-JO4fO3Yj.js → index-RdT-49jb.js} +12 -12
  20. package/dist/_chunks/{index-JO4fO3Yj.js.map → index-RdT-49jb.js.map} +1 -1
  21. package/dist/_chunks/{index-PTS42_em.mjs → index-Yd7pX7dw.mjs} +12 -12
  22. package/dist/_chunks/{index-PTS42_em.mjs.map → index-Yd7pX7dw.mjs.map} +1 -1
  23. package/dist/_chunks/{index-Vg50EMBp.mjs → index-fIJnE26b.mjs} +14 -30
  24. package/dist/_chunks/index-fIJnE26b.mjs.map +1 -0
  25. package/dist/_chunks/index-oBxjGftZ-Zv9D3a55.js +10335 -0
  26. package/dist/_chunks/index-oBxjGftZ-Zv9D3a55.js.map +1 -0
  27. package/dist/_chunks/index-oBxjGftZ-sZD2cl-K.mjs +10311 -0
  28. package/dist/_chunks/index-oBxjGftZ-sZD2cl-K.mjs.map +1 -0
  29. package/dist/_chunks/{index-oUZpvYqS.mjs → index-oDAXPgSA.mjs} +10 -16
  30. package/dist/_chunks/index-oDAXPgSA.mjs.map +1 -0
  31. package/dist/admin/index.js +1 -1
  32. package/dist/admin/index.mjs +1 -1
  33. package/package.json +8 -8
  34. package/server/bootstrap/index.js +3 -3
  35. package/server/controllers/content-manager-user.js +4 -2
  36. package/server/services/users-permissions.js +3 -3
  37. package/dist/_chunks/EditViewPage-BJdNfzBZ-XIkFGBc4.mjs +0 -84380
  38. package/dist/_chunks/EditViewPage-BJdNfzBZ-XIkFGBc4.mjs.map +0 -1
  39. package/dist/_chunks/EditViewPage-BJdNfzBZ-eKwHxgPQ.js +0 -84408
  40. package/dist/_chunks/EditViewPage-BJdNfzBZ-eKwHxgPQ.js.map +0 -1
  41. package/dist/_chunks/Helmet-En-SEnNC.mjs +0 -1008
  42. package/dist/_chunks/Helmet-En-SEnNC.mjs.map +0 -1
  43. package/dist/_chunks/Helmet-d9JljxUo.js +0 -1010
  44. package/dist/_chunks/Helmet-d9JljxUo.js.map +0 -1
  45. package/dist/_chunks/ListViewPage-FE12IpwT-Wq63ge4-.js +0 -1595
  46. package/dist/_chunks/ListViewPage-FE12IpwT-Wq63ge4-.js.map +0 -1
  47. package/dist/_chunks/ListViewPage-FE12IpwT-qmEuoG2g.mjs +0 -1571
  48. package/dist/_chunks/ListViewPage-FE12IpwT-qmEuoG2g.mjs.map +0 -1
  49. package/dist/_chunks/ReviewWorkflowsColumn-NUu47oVz-8gQO_Y5x.mjs +0 -33
  50. package/dist/_chunks/ReviewWorkflowsColumn-NUu47oVz-8gQO_Y5x.mjs.map +0 -1
  51. package/dist/_chunks/ReviewWorkflowsColumn-NUu47oVz-ARD7iQQF.js +0 -33
  52. package/dist/_chunks/ReviewWorkflowsColumn-NUu47oVz-ARD7iQQF.js.map +0 -1
  53. package/dist/_chunks/constants-D6NLEhwu-4IL8biHd.js +0 -209
  54. package/dist/_chunks/constants-D6NLEhwu-4IL8biHd.js.map +0 -1
  55. package/dist/_chunks/constants-D6NLEhwu-gRKBHArd.mjs +0 -190
  56. package/dist/_chunks/constants-D6NLEhwu-gRKBHArd.mjs.map +0 -1
  57. package/dist/_chunks/index-1NFAbkxM-Km1zKLTh.mjs +0 -16568
  58. package/dist/_chunks/index-1NFAbkxM-Km1zKLTh.mjs.map +0 -1
  59. package/dist/_chunks/index-1NFAbkxM-c8HdvwSA.js +0 -16593
  60. package/dist/_chunks/index-1NFAbkxM-c8HdvwSA.js.map +0 -1
  61. package/dist/_chunks/index-46oU0LRy.js.map +0 -1
  62. package/dist/_chunks/index-DtWla9tx.mjs.map +0 -1
  63. package/dist/_chunks/index-G9pZniMC.mjs.map +0 -1
  64. package/dist/_chunks/index-UxzhJuP2.js.map +0 -1
  65. package/dist/_chunks/index-Vg50EMBp.mjs.map +0 -1
  66. package/dist/_chunks/index-_UNneVIg.js.map +0 -1
  67. package/dist/_chunks/index-gw-9XoIT.js.map +0 -1
  68. package/dist/_chunks/index-oUZpvYqS.mjs.map +0 -1
  69. package/dist/_chunks/useSyncRbac-LNOzRXJ5-5S0qhFuZ.js +0 -63
  70. package/dist/_chunks/useSyncRbac-LNOzRXJ5-5S0qhFuZ.js.map +0 -1
  71. package/dist/_chunks/useSyncRbac-LNOzRXJ5-PZzFwA1X.mjs +0 -45
  72. package/dist/_chunks/useSyncRbac-LNOzRXJ5-PZzFwA1X.mjs.map +0 -1
  73. package/dist/style.css +0 -84
@@ -1,1008 +0,0 @@
1
- import PropTypes from "prop-types";
2
- import React__default$1 from "react";
3
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
4
- function getDefaultExportFromCjs(x) {
5
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
6
- }
7
- function getAugmentedNamespace(n) {
8
- if (n.__esModule)
9
- return n;
10
- var f = n.default;
11
- if (typeof f == "function") {
12
- var a = function a2() {
13
- if (this instanceof a2) {
14
- return Reflect.construct(f, arguments, this.constructor);
15
- }
16
- return f.apply(this, arguments);
17
- };
18
- a.prototype = f.prototype;
19
- } else
20
- a = {};
21
- Object.defineProperty(a, "__esModule", { value: true });
22
- Object.keys(n).forEach(function(k) {
23
- var d = Object.getOwnPropertyDescriptor(n, k);
24
- Object.defineProperty(a, k, d.get ? d : {
25
- enumerable: true,
26
- get: function() {
27
- return n[k];
28
- }
29
- });
30
- });
31
- return a;
32
- }
33
- function _interopDefault(ex) {
34
- return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex;
35
- }
36
- var React = React__default$1;
37
- var React__default = _interopDefault(React);
38
- function _defineProperty(obj, key, value) {
39
- if (key in obj) {
40
- Object.defineProperty(obj, key, {
41
- value,
42
- enumerable: true,
43
- configurable: true,
44
- writable: true
45
- });
46
- } else {
47
- obj[key] = value;
48
- }
49
- return obj;
50
- }
51
- function _inheritsLoose(subClass, superClass) {
52
- subClass.prototype = Object.create(superClass.prototype);
53
- subClass.prototype.constructor = subClass;
54
- subClass.__proto__ = superClass;
55
- }
56
- var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
57
- function withSideEffect(reducePropsToState3, handleStateChangeOnClient, mapStateOnServer3) {
58
- if (typeof reducePropsToState3 !== "function") {
59
- throw new Error("Expected reducePropsToState to be a function.");
60
- }
61
- if (typeof handleStateChangeOnClient !== "function") {
62
- throw new Error("Expected handleStateChangeOnClient to be a function.");
63
- }
64
- if (typeof mapStateOnServer3 !== "undefined" && typeof mapStateOnServer3 !== "function") {
65
- throw new Error("Expected mapStateOnServer to either be undefined or a function.");
66
- }
67
- function getDisplayName(WrappedComponent) {
68
- return WrappedComponent.displayName || WrappedComponent.name || "Component";
69
- }
70
- return function wrap(WrappedComponent) {
71
- if (typeof WrappedComponent !== "function") {
72
- throw new Error("Expected WrappedComponent to be a React component.");
73
- }
74
- var mountedInstances = [];
75
- var state;
76
- function emitChange() {
77
- state = reducePropsToState3(mountedInstances.map(function(instance) {
78
- return instance.props;
79
- }));
80
- if (SideEffect.canUseDOM) {
81
- handleStateChangeOnClient(state);
82
- } else if (mapStateOnServer3) {
83
- state = mapStateOnServer3(state);
84
- }
85
- }
86
- var SideEffect = /* @__PURE__ */ function(_PureComponent) {
87
- _inheritsLoose(SideEffect2, _PureComponent);
88
- function SideEffect2() {
89
- return _PureComponent.apply(this, arguments) || this;
90
- }
91
- SideEffect2.peek = function peek() {
92
- return state;
93
- };
94
- SideEffect2.rewind = function rewind() {
95
- if (SideEffect2.canUseDOM) {
96
- throw new Error("You may only call rewind() on the server. Call peek() to read the current state.");
97
- }
98
- var recordedState = state;
99
- state = void 0;
100
- mountedInstances = [];
101
- return recordedState;
102
- };
103
- var _proto = SideEffect2.prototype;
104
- _proto.UNSAFE_componentWillMount = function UNSAFE_componentWillMount() {
105
- mountedInstances.push(this);
106
- emitChange();
107
- };
108
- _proto.componentDidUpdate = function componentDidUpdate() {
109
- emitChange();
110
- };
111
- _proto.componentWillUnmount = function componentWillUnmount() {
112
- var index = mountedInstances.indexOf(this);
113
- mountedInstances.splice(index, 1);
114
- emitChange();
115
- };
116
- _proto.render = function render() {
117
- return React__default.createElement(WrappedComponent, this.props);
118
- };
119
- return SideEffect2;
120
- }(React.PureComponent);
121
- _defineProperty(SideEffect, "displayName", "SideEffect(" + getDisplayName(WrappedComponent) + ")");
122
- _defineProperty(SideEffect, "canUseDOM", canUseDOM);
123
- return SideEffect;
124
- };
125
- }
126
- var lib = withSideEffect;
127
- const withSideEffect$1 = /* @__PURE__ */ getDefaultExportFromCjs(lib);
128
- var hasElementType = typeof Element !== "undefined";
129
- var hasMap = typeof Map === "function";
130
- var hasSet = typeof Set === "function";
131
- var hasArrayBuffer = typeof ArrayBuffer === "function" && !!ArrayBuffer.isView;
132
- function equal(a, b) {
133
- if (a === b)
134
- return true;
135
- if (a && b && typeof a == "object" && typeof b == "object") {
136
- if (a.constructor !== b.constructor)
137
- return false;
138
- var length, i, keys;
139
- if (Array.isArray(a)) {
140
- length = a.length;
141
- if (length != b.length)
142
- return false;
143
- for (i = length; i-- !== 0; )
144
- if (!equal(a[i], b[i]))
145
- return false;
146
- return true;
147
- }
148
- var it;
149
- if (hasMap && a instanceof Map && b instanceof Map) {
150
- if (a.size !== b.size)
151
- return false;
152
- it = a.entries();
153
- while (!(i = it.next()).done)
154
- if (!b.has(i.value[0]))
155
- return false;
156
- it = a.entries();
157
- while (!(i = it.next()).done)
158
- if (!equal(i.value[1], b.get(i.value[0])))
159
- return false;
160
- return true;
161
- }
162
- if (hasSet && a instanceof Set && b instanceof Set) {
163
- if (a.size !== b.size)
164
- return false;
165
- it = a.entries();
166
- while (!(i = it.next()).done)
167
- if (!b.has(i.value[0]))
168
- return false;
169
- return true;
170
- }
171
- if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
172
- length = a.length;
173
- if (length != b.length)
174
- return false;
175
- for (i = length; i-- !== 0; )
176
- if (a[i] !== b[i])
177
- return false;
178
- return true;
179
- }
180
- if (a.constructor === RegExp)
181
- return a.source === b.source && a.flags === b.flags;
182
- if (a.valueOf !== Object.prototype.valueOf)
183
- return a.valueOf() === b.valueOf();
184
- if (a.toString !== Object.prototype.toString)
185
- return a.toString() === b.toString();
186
- keys = Object.keys(a);
187
- length = keys.length;
188
- if (length !== Object.keys(b).length)
189
- return false;
190
- for (i = length; i-- !== 0; )
191
- if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
192
- return false;
193
- if (hasElementType && a instanceof Element)
194
- return false;
195
- for (i = length; i-- !== 0; ) {
196
- if ((keys[i] === "_owner" || keys[i] === "__v" || keys[i] === "__o") && a.$$typeof) {
197
- continue;
198
- }
199
- if (!equal(a[keys[i]], b[keys[i]]))
200
- return false;
201
- }
202
- return true;
203
- }
204
- return a !== a && b !== b;
205
- }
206
- var reactFastCompare = function isEqual(a, b) {
207
- try {
208
- return equal(a, b);
209
- } catch (error) {
210
- if ((error.message || "").match(/stack|recursion/i)) {
211
- console.warn("react-fast-compare cannot handle circular refs");
212
- return false;
213
- }
214
- throw error;
215
- }
216
- };
217
- const isEqual2 = /* @__PURE__ */ getDefaultExportFromCjs(reactFastCompare);
218
- /*
219
- object-assign
220
- (c) Sindre Sorhus
221
- @license MIT
222
- */
223
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
224
- var hasOwnProperty = Object.prototype.hasOwnProperty;
225
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
226
- function toObject(val) {
227
- if (val === null || val === void 0) {
228
- throw new TypeError("Object.assign cannot be called with null or undefined");
229
- }
230
- return Object(val);
231
- }
232
- function shouldUseNative() {
233
- try {
234
- if (!Object.assign) {
235
- return false;
236
- }
237
- var test1 = new String("abc");
238
- test1[5] = "de";
239
- if (Object.getOwnPropertyNames(test1)[0] === "5") {
240
- return false;
241
- }
242
- var test2 = {};
243
- for (var i = 0; i < 10; i++) {
244
- test2["_" + String.fromCharCode(i)] = i;
245
- }
246
- var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
247
- return test2[n];
248
- });
249
- if (order2.join("") !== "0123456789") {
250
- return false;
251
- }
252
- var test3 = {};
253
- "abcdefghijklmnopqrst".split("").forEach(function(letter) {
254
- test3[letter] = letter;
255
- });
256
- if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
257
- return false;
258
- }
259
- return true;
260
- } catch (err) {
261
- return false;
262
- }
263
- }
264
- var objectAssign = shouldUseNative() ? Object.assign : function(target, source) {
265
- var from;
266
- var to = toObject(target);
267
- var symbols;
268
- for (var s = 1; s < arguments.length; s++) {
269
- from = Object(arguments[s]);
270
- for (var key in from) {
271
- if (hasOwnProperty.call(from, key)) {
272
- to[key] = from[key];
273
- }
274
- }
275
- if (getOwnPropertySymbols) {
276
- symbols = getOwnPropertySymbols(from);
277
- for (var i = 0; i < symbols.length; i++) {
278
- if (propIsEnumerable.call(from, symbols[i])) {
279
- to[symbols[i]] = from[symbols[i]];
280
- }
281
- }
282
- }
283
- }
284
- return to;
285
- };
286
- const objectAssign$1 = /* @__PURE__ */ getDefaultExportFromCjs(objectAssign);
287
- var ATTRIBUTE_NAMES = {
288
- BODY: "bodyAttributes",
289
- HTML: "htmlAttributes",
290
- TITLE: "titleAttributes"
291
- };
292
- var TAG_NAMES = {
293
- BASE: "base",
294
- BODY: "body",
295
- HEAD: "head",
296
- HTML: "html",
297
- LINK: "link",
298
- META: "meta",
299
- NOSCRIPT: "noscript",
300
- SCRIPT: "script",
301
- STYLE: "style",
302
- TITLE: "title"
303
- };
304
- var VALID_TAG_NAMES = Object.keys(TAG_NAMES).map(function(name) {
305
- return TAG_NAMES[name];
306
- });
307
- var TAG_PROPERTIES = {
308
- CHARSET: "charset",
309
- CSS_TEXT: "cssText",
310
- HREF: "href",
311
- HTTPEQUIV: "http-equiv",
312
- INNER_HTML: "innerHTML",
313
- ITEM_PROP: "itemprop",
314
- NAME: "name",
315
- PROPERTY: "property",
316
- REL: "rel",
317
- SRC: "src",
318
- TARGET: "target"
319
- };
320
- var REACT_TAG_MAP = {
321
- accesskey: "accessKey",
322
- charset: "charSet",
323
- class: "className",
324
- contenteditable: "contentEditable",
325
- contextmenu: "contextMenu",
326
- "http-equiv": "httpEquiv",
327
- itemprop: "itemProp",
328
- tabindex: "tabIndex"
329
- };
330
- var HELMET_PROPS = {
331
- DEFAULT_TITLE: "defaultTitle",
332
- DEFER: "defer",
333
- ENCODE_SPECIAL_CHARACTERS: "encodeSpecialCharacters",
334
- ON_CHANGE_CLIENT_STATE: "onChangeClientState",
335
- TITLE_TEMPLATE: "titleTemplate"
336
- };
337
- var HTML_TAG_MAP = Object.keys(REACT_TAG_MAP).reduce(function(obj, key) {
338
- obj[REACT_TAG_MAP[key]] = key;
339
- return obj;
340
- }, {});
341
- var SELF_CLOSING_TAGS = [TAG_NAMES.NOSCRIPT, TAG_NAMES.SCRIPT, TAG_NAMES.STYLE];
342
- var HELMET_ATTRIBUTE = "data-react-helmet";
343
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
344
- return typeof obj;
345
- } : function(obj) {
346
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
347
- };
348
- var classCallCheck = function(instance, Constructor) {
349
- if (!(instance instanceof Constructor)) {
350
- throw new TypeError("Cannot call a class as a function");
351
- }
352
- };
353
- var createClass = /* @__PURE__ */ function() {
354
- function defineProperties(target, props) {
355
- for (var i = 0; i < props.length; i++) {
356
- var descriptor = props[i];
357
- descriptor.enumerable = descriptor.enumerable || false;
358
- descriptor.configurable = true;
359
- if ("value" in descriptor)
360
- descriptor.writable = true;
361
- Object.defineProperty(target, descriptor.key, descriptor);
362
- }
363
- }
364
- return function(Constructor, protoProps, staticProps) {
365
- if (protoProps)
366
- defineProperties(Constructor.prototype, protoProps);
367
- if (staticProps)
368
- defineProperties(Constructor, staticProps);
369
- return Constructor;
370
- };
371
- }();
372
- var _extends = Object.assign || function(target) {
373
- for (var i = 1; i < arguments.length; i++) {
374
- var source = arguments[i];
375
- for (var key in source) {
376
- if (Object.prototype.hasOwnProperty.call(source, key)) {
377
- target[key] = source[key];
378
- }
379
- }
380
- }
381
- return target;
382
- };
383
- var inherits = function(subClass, superClass) {
384
- if (typeof superClass !== "function" && superClass !== null) {
385
- throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
386
- }
387
- subClass.prototype = Object.create(superClass && superClass.prototype, {
388
- constructor: {
389
- value: subClass,
390
- enumerable: false,
391
- writable: true,
392
- configurable: true
393
- }
394
- });
395
- if (superClass)
396
- Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
397
- };
398
- var objectWithoutProperties = function(obj, keys) {
399
- var target = {};
400
- for (var i in obj) {
401
- if (keys.indexOf(i) >= 0)
402
- continue;
403
- if (!Object.prototype.hasOwnProperty.call(obj, i))
404
- continue;
405
- target[i] = obj[i];
406
- }
407
- return target;
408
- };
409
- var possibleConstructorReturn = function(self2, call) {
410
- if (!self2) {
411
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
412
- }
413
- return call && (typeof call === "object" || typeof call === "function") ? call : self2;
414
- };
415
- var encodeSpecialCharacters = function encodeSpecialCharacters2(str) {
416
- var encode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
417
- if (encode === false) {
418
- return String(str);
419
- }
420
- return String(str).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
421
- };
422
- var getTitleFromPropsList = function getTitleFromPropsList2(propsList) {
423
- var innermostTitle = getInnermostProperty(propsList, TAG_NAMES.TITLE);
424
- var innermostTemplate = getInnermostProperty(propsList, HELMET_PROPS.TITLE_TEMPLATE);
425
- if (innermostTemplate && innermostTitle) {
426
- return innermostTemplate.replace(/%s/g, function() {
427
- return Array.isArray(innermostTitle) ? innermostTitle.join("") : innermostTitle;
428
- });
429
- }
430
- var innermostDefaultTitle = getInnermostProperty(propsList, HELMET_PROPS.DEFAULT_TITLE);
431
- return innermostTitle || innermostDefaultTitle || void 0;
432
- };
433
- var getOnChangeClientState = function getOnChangeClientState2(propsList) {
434
- return getInnermostProperty(propsList, HELMET_PROPS.ON_CHANGE_CLIENT_STATE) || function() {
435
- };
436
- };
437
- var getAttributesFromPropsList = function getAttributesFromPropsList2(tagType, propsList) {
438
- return propsList.filter(function(props) {
439
- return typeof props[tagType] !== "undefined";
440
- }).map(function(props) {
441
- return props[tagType];
442
- }).reduce(function(tagAttrs, current) {
443
- return _extends({}, tagAttrs, current);
444
- }, {});
445
- };
446
- var getBaseTagFromPropsList = function getBaseTagFromPropsList2(primaryAttributes, propsList) {
447
- return propsList.filter(function(props) {
448
- return typeof props[TAG_NAMES.BASE] !== "undefined";
449
- }).map(function(props) {
450
- return props[TAG_NAMES.BASE];
451
- }).reverse().reduce(function(innermostBaseTag, tag) {
452
- if (!innermostBaseTag.length) {
453
- var keys = Object.keys(tag);
454
- for (var i = 0; i < keys.length; i++) {
455
- var attributeKey = keys[i];
456
- var lowerCaseAttributeKey = attributeKey.toLowerCase();
457
- if (primaryAttributes.indexOf(lowerCaseAttributeKey) !== -1 && tag[lowerCaseAttributeKey]) {
458
- return innermostBaseTag.concat(tag);
459
- }
460
- }
461
- }
462
- return innermostBaseTag;
463
- }, []);
464
- };
465
- var getTagsFromPropsList = function getTagsFromPropsList2(tagName, primaryAttributes, propsList) {
466
- var approvedSeenTags = {};
467
- return propsList.filter(function(props) {
468
- if (Array.isArray(props[tagName])) {
469
- return true;
470
- }
471
- if (typeof props[tagName] !== "undefined") {
472
- warn("Helmet: " + tagName + ' should be of type "Array". Instead found type "' + _typeof(props[tagName]) + '"');
473
- }
474
- return false;
475
- }).map(function(props) {
476
- return props[tagName];
477
- }).reverse().reduce(function(approvedTags, instanceTags) {
478
- var instanceSeenTags = {};
479
- instanceTags.filter(function(tag) {
480
- var primaryAttributeKey = void 0;
481
- var keys2 = Object.keys(tag);
482
- for (var i2 = 0; i2 < keys2.length; i2++) {
483
- var attributeKey2 = keys2[i2];
484
- var lowerCaseAttributeKey = attributeKey2.toLowerCase();
485
- if (primaryAttributes.indexOf(lowerCaseAttributeKey) !== -1 && !(primaryAttributeKey === TAG_PROPERTIES.REL && tag[primaryAttributeKey].toLowerCase() === "canonical") && !(lowerCaseAttributeKey === TAG_PROPERTIES.REL && tag[lowerCaseAttributeKey].toLowerCase() === "stylesheet")) {
486
- primaryAttributeKey = lowerCaseAttributeKey;
487
- }
488
- if (primaryAttributes.indexOf(attributeKey2) !== -1 && (attributeKey2 === TAG_PROPERTIES.INNER_HTML || attributeKey2 === TAG_PROPERTIES.CSS_TEXT || attributeKey2 === TAG_PROPERTIES.ITEM_PROP)) {
489
- primaryAttributeKey = attributeKey2;
490
- }
491
- }
492
- if (!primaryAttributeKey || !tag[primaryAttributeKey]) {
493
- return false;
494
- }
495
- var value = tag[primaryAttributeKey].toLowerCase();
496
- if (!approvedSeenTags[primaryAttributeKey]) {
497
- approvedSeenTags[primaryAttributeKey] = {};
498
- }
499
- if (!instanceSeenTags[primaryAttributeKey]) {
500
- instanceSeenTags[primaryAttributeKey] = {};
501
- }
502
- if (!approvedSeenTags[primaryAttributeKey][value]) {
503
- instanceSeenTags[primaryAttributeKey][value] = true;
504
- return true;
505
- }
506
- return false;
507
- }).reverse().forEach(function(tag) {
508
- return approvedTags.push(tag);
509
- });
510
- var keys = Object.keys(instanceSeenTags);
511
- for (var i = 0; i < keys.length; i++) {
512
- var attributeKey = keys[i];
513
- var tagUnion = objectAssign$1({}, approvedSeenTags[attributeKey], instanceSeenTags[attributeKey]);
514
- approvedSeenTags[attributeKey] = tagUnion;
515
- }
516
- return approvedTags;
517
- }, []).reverse();
518
- };
519
- var getInnermostProperty = function getInnermostProperty2(propsList, property) {
520
- for (var i = propsList.length - 1; i >= 0; i--) {
521
- var props = propsList[i];
522
- if (props.hasOwnProperty(property)) {
523
- return props[property];
524
- }
525
- }
526
- return null;
527
- };
528
- var reducePropsToState = function reducePropsToState2(propsList) {
529
- return {
530
- baseTag: getBaseTagFromPropsList([TAG_PROPERTIES.HREF, TAG_PROPERTIES.TARGET], propsList),
531
- bodyAttributes: getAttributesFromPropsList(ATTRIBUTE_NAMES.BODY, propsList),
532
- defer: getInnermostProperty(propsList, HELMET_PROPS.DEFER),
533
- encode: getInnermostProperty(propsList, HELMET_PROPS.ENCODE_SPECIAL_CHARACTERS),
534
- htmlAttributes: getAttributesFromPropsList(ATTRIBUTE_NAMES.HTML, propsList),
535
- linkTags: getTagsFromPropsList(TAG_NAMES.LINK, [TAG_PROPERTIES.REL, TAG_PROPERTIES.HREF], propsList),
536
- metaTags: getTagsFromPropsList(TAG_NAMES.META, [TAG_PROPERTIES.NAME, TAG_PROPERTIES.CHARSET, TAG_PROPERTIES.HTTPEQUIV, TAG_PROPERTIES.PROPERTY, TAG_PROPERTIES.ITEM_PROP], propsList),
537
- noscriptTags: getTagsFromPropsList(TAG_NAMES.NOSCRIPT, [TAG_PROPERTIES.INNER_HTML], propsList),
538
- onChangeClientState: getOnChangeClientState(propsList),
539
- scriptTags: getTagsFromPropsList(TAG_NAMES.SCRIPT, [TAG_PROPERTIES.SRC, TAG_PROPERTIES.INNER_HTML], propsList),
540
- styleTags: getTagsFromPropsList(TAG_NAMES.STYLE, [TAG_PROPERTIES.CSS_TEXT], propsList),
541
- title: getTitleFromPropsList(propsList),
542
- titleAttributes: getAttributesFromPropsList(ATTRIBUTE_NAMES.TITLE, propsList)
543
- };
544
- };
545
- var rafPolyfill = function() {
546
- var clock = Date.now();
547
- return function(callback) {
548
- var currentTime = Date.now();
549
- if (currentTime - clock > 16) {
550
- clock = currentTime;
551
- callback(currentTime);
552
- } else {
553
- setTimeout(function() {
554
- rafPolyfill(callback);
555
- }, 0);
556
- }
557
- };
558
- }();
559
- var cafPolyfill = function cafPolyfill2(id) {
560
- return clearTimeout(id);
561
- };
562
- var requestAnimationFrame = typeof window !== "undefined" ? window.requestAnimationFrame && window.requestAnimationFrame.bind(window) || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || rafPolyfill : global.requestAnimationFrame || rafPolyfill;
563
- var cancelAnimationFrame = typeof window !== "undefined" ? window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || cafPolyfill : global.cancelAnimationFrame || cafPolyfill;
564
- var warn = function warn2(msg) {
565
- return console && typeof console.warn === "function" && console.warn(msg);
566
- };
567
- var _helmetCallback = null;
568
- var handleClientStateChange = function handleClientStateChange2(newState) {
569
- if (_helmetCallback) {
570
- cancelAnimationFrame(_helmetCallback);
571
- }
572
- if (newState.defer) {
573
- _helmetCallback = requestAnimationFrame(function() {
574
- commitTagChanges(newState, function() {
575
- _helmetCallback = null;
576
- });
577
- });
578
- } else {
579
- commitTagChanges(newState);
580
- _helmetCallback = null;
581
- }
582
- };
583
- var commitTagChanges = function commitTagChanges2(newState, cb) {
584
- var baseTag = newState.baseTag, bodyAttributes = newState.bodyAttributes, htmlAttributes = newState.htmlAttributes, linkTags = newState.linkTags, metaTags = newState.metaTags, noscriptTags = newState.noscriptTags, onChangeClientState = newState.onChangeClientState, scriptTags = newState.scriptTags, styleTags = newState.styleTags, title = newState.title, titleAttributes = newState.titleAttributes;
585
- updateAttributes(TAG_NAMES.BODY, bodyAttributes);
586
- updateAttributes(TAG_NAMES.HTML, htmlAttributes);
587
- updateTitle(title, titleAttributes);
588
- var tagUpdates = {
589
- baseTag: updateTags(TAG_NAMES.BASE, baseTag),
590
- linkTags: updateTags(TAG_NAMES.LINK, linkTags),
591
- metaTags: updateTags(TAG_NAMES.META, metaTags),
592
- noscriptTags: updateTags(TAG_NAMES.NOSCRIPT, noscriptTags),
593
- scriptTags: updateTags(TAG_NAMES.SCRIPT, scriptTags),
594
- styleTags: updateTags(TAG_NAMES.STYLE, styleTags)
595
- };
596
- var addedTags = {};
597
- var removedTags = {};
598
- Object.keys(tagUpdates).forEach(function(tagType) {
599
- var _tagUpdates$tagType = tagUpdates[tagType], newTags = _tagUpdates$tagType.newTags, oldTags = _tagUpdates$tagType.oldTags;
600
- if (newTags.length) {
601
- addedTags[tagType] = newTags;
602
- }
603
- if (oldTags.length) {
604
- removedTags[tagType] = tagUpdates[tagType].oldTags;
605
- }
606
- });
607
- cb && cb();
608
- onChangeClientState(newState, addedTags, removedTags);
609
- };
610
- var flattenArray = function flattenArray2(possibleArray) {
611
- return Array.isArray(possibleArray) ? possibleArray.join("") : possibleArray;
612
- };
613
- var updateTitle = function updateTitle2(title, attributes) {
614
- if (typeof title !== "undefined" && document.title !== title) {
615
- document.title = flattenArray(title);
616
- }
617
- updateAttributes(TAG_NAMES.TITLE, attributes);
618
- };
619
- var updateAttributes = function updateAttributes2(tagName, attributes) {
620
- var elementTag = document.getElementsByTagName(tagName)[0];
621
- if (!elementTag) {
622
- return;
623
- }
624
- var helmetAttributeString = elementTag.getAttribute(HELMET_ATTRIBUTE);
625
- var helmetAttributes = helmetAttributeString ? helmetAttributeString.split(",") : [];
626
- var attributesToRemove = [].concat(helmetAttributes);
627
- var attributeKeys = Object.keys(attributes);
628
- for (var i = 0; i < attributeKeys.length; i++) {
629
- var attribute = attributeKeys[i];
630
- var value = attributes[attribute] || "";
631
- if (elementTag.getAttribute(attribute) !== value) {
632
- elementTag.setAttribute(attribute, value);
633
- }
634
- if (helmetAttributes.indexOf(attribute) === -1) {
635
- helmetAttributes.push(attribute);
636
- }
637
- var indexToSave = attributesToRemove.indexOf(attribute);
638
- if (indexToSave !== -1) {
639
- attributesToRemove.splice(indexToSave, 1);
640
- }
641
- }
642
- for (var _i = attributesToRemove.length - 1; _i >= 0; _i--) {
643
- elementTag.removeAttribute(attributesToRemove[_i]);
644
- }
645
- if (helmetAttributes.length === attributesToRemove.length) {
646
- elementTag.removeAttribute(HELMET_ATTRIBUTE);
647
- } else if (elementTag.getAttribute(HELMET_ATTRIBUTE) !== attributeKeys.join(",")) {
648
- elementTag.setAttribute(HELMET_ATTRIBUTE, attributeKeys.join(","));
649
- }
650
- };
651
- var updateTags = function updateTags2(type, tags) {
652
- var headElement = document.head || document.querySelector(TAG_NAMES.HEAD);
653
- var tagNodes = headElement.querySelectorAll(type + "[" + HELMET_ATTRIBUTE + "]");
654
- var oldTags = Array.prototype.slice.call(tagNodes);
655
- var newTags = [];
656
- var indexToDelete = void 0;
657
- if (tags && tags.length) {
658
- tags.forEach(function(tag) {
659
- var newElement = document.createElement(type);
660
- for (var attribute in tag) {
661
- if (tag.hasOwnProperty(attribute)) {
662
- if (attribute === TAG_PROPERTIES.INNER_HTML) {
663
- newElement.innerHTML = tag.innerHTML;
664
- } else if (attribute === TAG_PROPERTIES.CSS_TEXT) {
665
- if (newElement.styleSheet) {
666
- newElement.styleSheet.cssText = tag.cssText;
667
- } else {
668
- newElement.appendChild(document.createTextNode(tag.cssText));
669
- }
670
- } else {
671
- var value = typeof tag[attribute] === "undefined" ? "" : tag[attribute];
672
- newElement.setAttribute(attribute, value);
673
- }
674
- }
675
- }
676
- newElement.setAttribute(HELMET_ATTRIBUTE, "true");
677
- if (oldTags.some(function(existingTag, index) {
678
- indexToDelete = index;
679
- return newElement.isEqualNode(existingTag);
680
- })) {
681
- oldTags.splice(indexToDelete, 1);
682
- } else {
683
- newTags.push(newElement);
684
- }
685
- });
686
- }
687
- oldTags.forEach(function(tag) {
688
- return tag.parentNode.removeChild(tag);
689
- });
690
- newTags.forEach(function(tag) {
691
- return headElement.appendChild(tag);
692
- });
693
- return {
694
- oldTags,
695
- newTags
696
- };
697
- };
698
- var generateElementAttributesAsString = function generateElementAttributesAsString2(attributes) {
699
- return Object.keys(attributes).reduce(function(str, key) {
700
- var attr = typeof attributes[key] !== "undefined" ? key + '="' + attributes[key] + '"' : "" + key;
701
- return str ? str + " " + attr : attr;
702
- }, "");
703
- };
704
- var generateTitleAsString = function generateTitleAsString2(type, title, attributes, encode) {
705
- var attributeString = generateElementAttributesAsString(attributes);
706
- var flattenedTitle = flattenArray(title);
707
- return attributeString ? "<" + type + " " + HELMET_ATTRIBUTE + '="true" ' + attributeString + ">" + encodeSpecialCharacters(flattenedTitle, encode) + "</" + type + ">" : "<" + type + " " + HELMET_ATTRIBUTE + '="true">' + encodeSpecialCharacters(flattenedTitle, encode) + "</" + type + ">";
708
- };
709
- var generateTagsAsString = function generateTagsAsString2(type, tags, encode) {
710
- return tags.reduce(function(str, tag) {
711
- var attributeHtml = Object.keys(tag).filter(function(attribute) {
712
- return !(attribute === TAG_PROPERTIES.INNER_HTML || attribute === TAG_PROPERTIES.CSS_TEXT);
713
- }).reduce(function(string, attribute) {
714
- var attr = typeof tag[attribute] === "undefined" ? attribute : attribute + '="' + encodeSpecialCharacters(tag[attribute], encode) + '"';
715
- return string ? string + " " + attr : attr;
716
- }, "");
717
- var tagContent = tag.innerHTML || tag.cssText || "";
718
- var isSelfClosing = SELF_CLOSING_TAGS.indexOf(type) === -1;
719
- return str + "<" + type + " " + HELMET_ATTRIBUTE + '="true" ' + attributeHtml + (isSelfClosing ? "/>" : ">" + tagContent + "</" + type + ">");
720
- }, "");
721
- };
722
- var convertElementAttributestoReactProps = function convertElementAttributestoReactProps2(attributes) {
723
- var initProps = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
724
- return Object.keys(attributes).reduce(function(obj, key) {
725
- obj[REACT_TAG_MAP[key] || key] = attributes[key];
726
- return obj;
727
- }, initProps);
728
- };
729
- var convertReactPropstoHtmlAttributes = function convertReactPropstoHtmlAttributes2(props) {
730
- var initAttributes = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
731
- return Object.keys(props).reduce(function(obj, key) {
732
- obj[HTML_TAG_MAP[key] || key] = props[key];
733
- return obj;
734
- }, initAttributes);
735
- };
736
- var generateTitleAsReactComponent = function generateTitleAsReactComponent2(type, title, attributes) {
737
- var _initProps;
738
- var initProps = (_initProps = {
739
- key: title
740
- }, _initProps[HELMET_ATTRIBUTE] = true, _initProps);
741
- var props = convertElementAttributestoReactProps(attributes, initProps);
742
- return [React__default$1.createElement(TAG_NAMES.TITLE, props, title)];
743
- };
744
- var generateTagsAsReactComponent = function generateTagsAsReactComponent2(type, tags) {
745
- return tags.map(function(tag, i) {
746
- var _mappedTag;
747
- var mappedTag = (_mappedTag = {
748
- key: i
749
- }, _mappedTag[HELMET_ATTRIBUTE] = true, _mappedTag);
750
- Object.keys(tag).forEach(function(attribute) {
751
- var mappedAttribute = REACT_TAG_MAP[attribute] || attribute;
752
- if (mappedAttribute === TAG_PROPERTIES.INNER_HTML || mappedAttribute === TAG_PROPERTIES.CSS_TEXT) {
753
- var content = tag.innerHTML || tag.cssText;
754
- mappedTag.dangerouslySetInnerHTML = { __html: content };
755
- } else {
756
- mappedTag[mappedAttribute] = tag[attribute];
757
- }
758
- });
759
- return React__default$1.createElement(type, mappedTag);
760
- });
761
- };
762
- var getMethodsForTag = function getMethodsForTag2(type, tags, encode) {
763
- switch (type) {
764
- case TAG_NAMES.TITLE:
765
- return {
766
- toComponent: function toComponent() {
767
- return generateTitleAsReactComponent(type, tags.title, tags.titleAttributes);
768
- },
769
- toString: function toString() {
770
- return generateTitleAsString(type, tags.title, tags.titleAttributes, encode);
771
- }
772
- };
773
- case ATTRIBUTE_NAMES.BODY:
774
- case ATTRIBUTE_NAMES.HTML:
775
- return {
776
- toComponent: function toComponent() {
777
- return convertElementAttributestoReactProps(tags);
778
- },
779
- toString: function toString() {
780
- return generateElementAttributesAsString(tags);
781
- }
782
- };
783
- default:
784
- return {
785
- toComponent: function toComponent() {
786
- return generateTagsAsReactComponent(type, tags);
787
- },
788
- toString: function toString() {
789
- return generateTagsAsString(type, tags, encode);
790
- }
791
- };
792
- }
793
- };
794
- var mapStateOnServer = function mapStateOnServer2(_ref) {
795
- var baseTag = _ref.baseTag, bodyAttributes = _ref.bodyAttributes, encode = _ref.encode, htmlAttributes = _ref.htmlAttributes, linkTags = _ref.linkTags, metaTags = _ref.metaTags, noscriptTags = _ref.noscriptTags, scriptTags = _ref.scriptTags, styleTags = _ref.styleTags, _ref$title = _ref.title, title = _ref$title === void 0 ? "" : _ref$title, titleAttributes = _ref.titleAttributes;
796
- return {
797
- base: getMethodsForTag(TAG_NAMES.BASE, baseTag, encode),
798
- bodyAttributes: getMethodsForTag(ATTRIBUTE_NAMES.BODY, bodyAttributes, encode),
799
- htmlAttributes: getMethodsForTag(ATTRIBUTE_NAMES.HTML, htmlAttributes, encode),
800
- link: getMethodsForTag(TAG_NAMES.LINK, linkTags, encode),
801
- meta: getMethodsForTag(TAG_NAMES.META, metaTags, encode),
802
- noscript: getMethodsForTag(TAG_NAMES.NOSCRIPT, noscriptTags, encode),
803
- script: getMethodsForTag(TAG_NAMES.SCRIPT, scriptTags, encode),
804
- style: getMethodsForTag(TAG_NAMES.STYLE, styleTags, encode),
805
- title: getMethodsForTag(TAG_NAMES.TITLE, { title, titleAttributes }, encode)
806
- };
807
- };
808
- var Helmet = function Helmet2(Component) {
809
- var _class, _temp;
810
- return _temp = _class = function(_React$Component) {
811
- inherits(HelmetWrapper, _React$Component);
812
- function HelmetWrapper() {
813
- classCallCheck(this, HelmetWrapper);
814
- return possibleConstructorReturn(this, _React$Component.apply(this, arguments));
815
- }
816
- HelmetWrapper.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
817
- return !isEqual2(this.props, nextProps);
818
- };
819
- HelmetWrapper.prototype.mapNestedChildrenToProps = function mapNestedChildrenToProps(child, nestedChildren) {
820
- if (!nestedChildren) {
821
- return null;
822
- }
823
- switch (child.type) {
824
- case TAG_NAMES.SCRIPT:
825
- case TAG_NAMES.NOSCRIPT:
826
- return {
827
- innerHTML: nestedChildren
828
- };
829
- case TAG_NAMES.STYLE:
830
- return {
831
- cssText: nestedChildren
832
- };
833
- }
834
- throw new Error("<" + child.type + " /> elements are self-closing and can not contain children. Refer to our API for more information.");
835
- };
836
- HelmetWrapper.prototype.flattenArrayTypeChildren = function flattenArrayTypeChildren(_ref) {
837
- var _babelHelpers$extends;
838
- var child = _ref.child, arrayTypeChildren = _ref.arrayTypeChildren, newChildProps = _ref.newChildProps, nestedChildren = _ref.nestedChildren;
839
- return _extends({}, arrayTypeChildren, (_babelHelpers$extends = {}, _babelHelpers$extends[child.type] = [].concat(arrayTypeChildren[child.type] || [], [_extends({}, newChildProps, this.mapNestedChildrenToProps(child, nestedChildren))]), _babelHelpers$extends));
840
- };
841
- HelmetWrapper.prototype.mapObjectTypeChildren = function mapObjectTypeChildren(_ref2) {
842
- var _babelHelpers$extends2, _babelHelpers$extends3;
843
- var child = _ref2.child, newProps = _ref2.newProps, newChildProps = _ref2.newChildProps, nestedChildren = _ref2.nestedChildren;
844
- switch (child.type) {
845
- case TAG_NAMES.TITLE:
846
- return _extends({}, newProps, (_babelHelpers$extends2 = {}, _babelHelpers$extends2[child.type] = nestedChildren, _babelHelpers$extends2.titleAttributes = _extends({}, newChildProps), _babelHelpers$extends2));
847
- case TAG_NAMES.BODY:
848
- return _extends({}, newProps, {
849
- bodyAttributes: _extends({}, newChildProps)
850
- });
851
- case TAG_NAMES.HTML:
852
- return _extends({}, newProps, {
853
- htmlAttributes: _extends({}, newChildProps)
854
- });
855
- }
856
- return _extends({}, newProps, (_babelHelpers$extends3 = {}, _babelHelpers$extends3[child.type] = _extends({}, newChildProps), _babelHelpers$extends3));
857
- };
858
- HelmetWrapper.prototype.mapArrayTypeChildrenToProps = function mapArrayTypeChildrenToProps(arrayTypeChildren, newProps) {
859
- var newFlattenedProps = _extends({}, newProps);
860
- Object.keys(arrayTypeChildren).forEach(function(arrayChildName) {
861
- var _babelHelpers$extends4;
862
- newFlattenedProps = _extends({}, newFlattenedProps, (_babelHelpers$extends4 = {}, _babelHelpers$extends4[arrayChildName] = arrayTypeChildren[arrayChildName], _babelHelpers$extends4));
863
- });
864
- return newFlattenedProps;
865
- };
866
- HelmetWrapper.prototype.warnOnInvalidChildren = function warnOnInvalidChildren(child, nestedChildren) {
867
- if (process.env.NODE_ENV !== "production") {
868
- if (!VALID_TAG_NAMES.some(function(name) {
869
- return child.type === name;
870
- })) {
871
- if (typeof child.type === "function") {
872
- return warn("You may be attempting to nest <Helmet> components within each other, which is not allowed. Refer to our API for more information.");
873
- }
874
- return warn("Only elements types " + VALID_TAG_NAMES.join(", ") + " are allowed. Helmet does not support rendering <" + child.type + "> elements. Refer to our API for more information.");
875
- }
876
- if (nestedChildren && typeof nestedChildren !== "string" && (!Array.isArray(nestedChildren) || nestedChildren.some(function(nestedChild) {
877
- return typeof nestedChild !== "string";
878
- }))) {
879
- throw new Error("Helmet expects a string as a child of <" + child.type + ">. Did you forget to wrap your children in braces? ( <" + child.type + ">{``}</" + child.type + "> ) Refer to our API for more information.");
880
- }
881
- }
882
- return true;
883
- };
884
- HelmetWrapper.prototype.mapChildrenToProps = function mapChildrenToProps(children, newProps) {
885
- var _this2 = this;
886
- var arrayTypeChildren = {};
887
- React__default$1.Children.forEach(children, function(child) {
888
- if (!child || !child.props) {
889
- return;
890
- }
891
- var _child$props = child.props, nestedChildren = _child$props.children, childProps = objectWithoutProperties(_child$props, ["children"]);
892
- var newChildProps = convertReactPropstoHtmlAttributes(childProps);
893
- _this2.warnOnInvalidChildren(child, nestedChildren);
894
- switch (child.type) {
895
- case TAG_NAMES.LINK:
896
- case TAG_NAMES.META:
897
- case TAG_NAMES.NOSCRIPT:
898
- case TAG_NAMES.SCRIPT:
899
- case TAG_NAMES.STYLE:
900
- arrayTypeChildren = _this2.flattenArrayTypeChildren({
901
- child,
902
- arrayTypeChildren,
903
- newChildProps,
904
- nestedChildren
905
- });
906
- break;
907
- default:
908
- newProps = _this2.mapObjectTypeChildren({
909
- child,
910
- newProps,
911
- newChildProps,
912
- nestedChildren
913
- });
914
- break;
915
- }
916
- });
917
- newProps = this.mapArrayTypeChildrenToProps(arrayTypeChildren, newProps);
918
- return newProps;
919
- };
920
- HelmetWrapper.prototype.render = function render() {
921
- var _props = this.props, children = _props.children, props = objectWithoutProperties(_props, ["children"]);
922
- var newProps = _extends({}, props);
923
- if (children) {
924
- newProps = this.mapChildrenToProps(children, newProps);
925
- }
926
- return React__default$1.createElement(Component, newProps);
927
- };
928
- createClass(HelmetWrapper, null, [{
929
- key: "canUseDOM",
930
- // Component.peek comes from react-side-effect:
931
- // For testing, you may use a static peek() method available on the returned component.
932
- // It lets you get the current state without resetting the mounted instance stack.
933
- // Don’t use it for anything other than testing.
934
- /**
935
- * @param {Object} base: {"target": "_blank", "href": "http://mysite.com/"}
936
- * @param {Object} bodyAttributes: {"className": "root"}
937
- * @param {String} defaultTitle: "Default Title"
938
- * @param {Boolean} defer: true
939
- * @param {Boolean} encodeSpecialCharacters: true
940
- * @param {Object} htmlAttributes: {"lang": "en", "amp": undefined}
941
- * @param {Array} link: [{"rel": "canonical", "href": "http://mysite.com/example"}]
942
- * @param {Array} meta: [{"name": "description", "content": "Test description"}]
943
- * @param {Array} noscript: [{"innerHTML": "<img src='http://mysite.com/js/test.js'"}]
944
- * @param {Function} onChangeClientState: "(newState) => console.log(newState)"
945
- * @param {Array} script: [{"type": "text/javascript", "src": "http://mysite.com/js/test.js"}]
946
- * @param {Array} style: [{"type": "text/css", "cssText": "div { display: block; color: blue; }"}]
947
- * @param {String} title: "Title"
948
- * @param {Object} titleAttributes: {"itemprop": "name"}
949
- * @param {String} titleTemplate: "MySite.com - %s"
950
- */
951
- set: function set$$1(canUseDOM2) {
952
- Component.canUseDOM = canUseDOM2;
953
- }
954
- }]);
955
- return HelmetWrapper;
956
- }(React__default$1.Component), _class.propTypes = {
957
- base: PropTypes.object,
958
- bodyAttributes: PropTypes.object,
959
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
960
- defaultTitle: PropTypes.string,
961
- defer: PropTypes.bool,
962
- encodeSpecialCharacters: PropTypes.bool,
963
- htmlAttributes: PropTypes.object,
964
- link: PropTypes.arrayOf(PropTypes.object),
965
- meta: PropTypes.arrayOf(PropTypes.object),
966
- noscript: PropTypes.arrayOf(PropTypes.object),
967
- onChangeClientState: PropTypes.func,
968
- script: PropTypes.arrayOf(PropTypes.object),
969
- style: PropTypes.arrayOf(PropTypes.object),
970
- title: PropTypes.string,
971
- titleAttributes: PropTypes.object,
972
- titleTemplate: PropTypes.string
973
- }, _class.defaultProps = {
974
- defer: true,
975
- encodeSpecialCharacters: true
976
- }, _class.peek = Component.peek, _class.rewind = function() {
977
- var mappedState = Component.rewind();
978
- if (!mappedState) {
979
- mappedState = mapStateOnServer({
980
- baseTag: [],
981
- bodyAttributes: {},
982
- encodeSpecialCharacters: true,
983
- htmlAttributes: {},
984
- linkTags: [],
985
- metaTags: [],
986
- noscriptTags: [],
987
- scriptTags: [],
988
- styleTags: [],
989
- title: "",
990
- titleAttributes: {}
991
- });
992
- }
993
- return mappedState;
994
- }, _temp;
995
- };
996
- var NullComponent = function NullComponent2() {
997
- return null;
998
- };
999
- var HelmetSideEffects = withSideEffect$1(reducePropsToState, handleClientStateChange, mapStateOnServer)(NullComponent);
1000
- var HelmetExport = Helmet(HelmetSideEffects);
1001
- HelmetExport.renderStatic = HelmetExport.rewind;
1002
- export {
1003
- HelmetExport as H,
1004
- getAugmentedNamespace as a,
1005
- commonjsGlobal as c,
1006
- getDefaultExportFromCjs as g
1007
- };
1008
- //# sourceMappingURL=Helmet-En-SEnNC.mjs.map