@atlaskit/feedback-collector 16.6.0 → 16.6.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/feedback-collector
2
2
 
3
+ ## 16.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`38d753092aa79`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/38d753092aa79) -
8
+ Fix feedback collector translations failing to load. The locale messages loader now resolves
9
+ bundles through an explicit per-locale loader map instead of a free-form dynamic import that
10
+ generated non-existent async chunk URLs in some builds (causing the dialog to silently fall back
11
+ to English). The fix is behind the `fun-2388_fix_feedback_collector_i18n` gate; when the gate is
12
+ off the previous loading behaviour is preserved.
13
+ - Updated dependencies
14
+
15
+ ## 16.6.1
16
+
17
+ ### Patch Changes
18
+
19
+ - [`a3bf20a2ec9f1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a3bf20a2ec9f1) -
20
+ Stop Escape from closing the feedback dialog when dismissing the feedback type dropdown.
21
+
3
22
  ## 16.6.0
4
23
 
5
24
  ### Minor Changes
@@ -164,7 +164,7 @@ var FeedbackCollector = exports.default = /*#__PURE__*/function (_Component) {
164
164
  }, {
165
165
  key: "getPackageVersion",
166
166
  value: function getPackageVersion() {
167
- return "16.5.0" || 'Unknown, at least 11.0.0';
167
+ return "16.6.1" || 'Unknown, at least 11.0.0';
168
168
  }
169
169
  }, {
170
170
  key: "getEntitlementInformation",
@@ -238,7 +238,8 @@ var FeedbackForm = function FeedbackForm(_ref2) {
238
238
  (_restProps$onChange = restProps.onChange) === null || _restProps$onChange === void 0 || _restProps$onChange.call(restProps, option.value);
239
239
  },
240
240
  menuPosition: "fixed",
241
- options: selectOptions
241
+ options: selectOptions,
242
+ shouldPreventEscapePropagation: (0, _platformFeatureFlags.fg)('ak_feedback_collector_select_escape')
242
243
  // @ts-ignore
243
244
  ,
244
245
  ref: focusRef,
@@ -369,7 +370,8 @@ var FeedbackForm = function FeedbackForm(_ref2) {
369
370
  (_restProps$onChange2 = restProps.onChange) === null || _restProps$onChange2 === void 0 || _restProps$onChange2.call(restProps, option.value);
370
371
  },
371
372
  menuPosition: "fixed",
372
- options: selectOptions
373
+ options: selectOptions,
374
+ shouldPreventEscapePropagation: (0, _platformFeatureFlags.fg)('ak_feedback_collector_select_escape')
373
375
  // @ts-ignore
374
376
  ,
375
377
  ref: focusRef,
@@ -1,35 +1,219 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
4
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.getMessagesForLocale = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t3 in e) "default" !== _t3 && {}.hasOwnProperty.call(e, _t3) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t3)) && (i.get || i.set) ? o(f, _t3, i) : f[_t3] = e[_t3]); return f; })(e, t); }
11
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  function _tsRewriteRelativeImportExtensions(t, e) { return "string" == typeof t && /^\.\.?\//.test(t) ? t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+)?)\.([cm]?)ts$/i, function (t, s, r, n, o) { return s ? e ? ".jsx" : ".js" : !r || n && o ? r + n + "." + o.toLowerCase() + "js" : t; }) : t; }
13
- /**
14
- * Tries to get the most specific messages bundle for a given locale.
15
- *
16
- * Strategy:
17
- * 1. Try to find messages with the exact string (i.e. 'fr_FR')
18
- * 2. If that doesn't work, try to find messages for the country locale (i.e. 'fr')
19
- * 3. If that doesn't work, return english messages as a fallback.
20
- *
21
- * @param locale string specifying the locale like 'en_GB', or 'fr'.
22
- */
23
-
24
- var getMessagesForLocale = exports.getMessagesForLocale = /*#__PURE__*/function () {
14
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t4 in e) "default" !== _t4 && {}.hasOwnProperty.call(e, _t4) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t4)) && (i.get || i.set) ? o(f, _t4, i) : f[_t4] = e[_t4]); return f; })(e, t); }
15
+ var isNestedMessagesModule = function isNestedMessagesModule(value) {
16
+ return 'default' in value && (0, _typeof2.default)(value.default) === 'object' && value.default !== null;
17
+ };
18
+ var unwrapMessages = function unwrapMessages(messages) {
19
+ var defaultExport = messages.default;
20
+ return isNestedMessagesModule(defaultExport) ? defaultExport.default : defaultExport;
21
+ };
22
+ var messagesLoaders = {
23
+ cs: function cs() {
24
+ return Promise.resolve().then(function () {
25
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-cs" */'../i18n/cs'));
26
+ });
27
+ },
28
+ da: function da() {
29
+ return Promise.resolve().then(function () {
30
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-da" */'../i18n/da'));
31
+ });
32
+ },
33
+ de: function de() {
34
+ return Promise.resolve().then(function () {
35
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-de" */'../i18n/de'));
36
+ });
37
+ },
38
+ en: function en() {
39
+ return Promise.resolve().then(function () {
40
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-en" */'../i18n/en'));
41
+ });
42
+ },
43
+ en_GB: function en_GB() {
44
+ return Promise.resolve().then(function () {
45
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-en_GB" */'../i18n/en_GB'));
46
+ });
47
+ },
48
+ en_ZZ: function en_ZZ() {
49
+ return Promise.resolve().then(function () {
50
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-en_ZZ" */'../i18n/en_ZZ'));
51
+ });
52
+ },
53
+ es: function es() {
54
+ return Promise.resolve().then(function () {
55
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-es" */'../i18n/es'));
56
+ });
57
+ },
58
+ fi: function fi() {
59
+ return Promise.resolve().then(function () {
60
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-fi" */'../i18n/fi'));
61
+ });
62
+ },
63
+ fr: function fr() {
64
+ return Promise.resolve().then(function () {
65
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-fr" */'../i18n/fr'));
66
+ });
67
+ },
68
+ hr: function hr() {
69
+ return Promise.resolve().then(function () {
70
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-hr" */'../i18n/hr'));
71
+ });
72
+ },
73
+ hu: function hu() {
74
+ return Promise.resolve().then(function () {
75
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-hu" */'../i18n/hu'));
76
+ });
77
+ },
78
+ it: function it() {
79
+ return Promise.resolve().then(function () {
80
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-it" */'../i18n/it'));
81
+ });
82
+ },
83
+ ja: function ja() {
84
+ return Promise.resolve().then(function () {
85
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-ja" */'../i18n/ja'));
86
+ });
87
+ },
88
+ ko: function ko() {
89
+ return Promise.resolve().then(function () {
90
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-ko" */'../i18n/ko'));
91
+ });
92
+ },
93
+ nb: function nb() {
94
+ return Promise.resolve().then(function () {
95
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-nb" */'../i18n/nb'));
96
+ });
97
+ },
98
+ nl: function nl() {
99
+ return Promise.resolve().then(function () {
100
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-nl" */'../i18n/nl'));
101
+ });
102
+ },
103
+ pl: function pl() {
104
+ return Promise.resolve().then(function () {
105
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-pl" */'../i18n/pl'));
106
+ });
107
+ },
108
+ pt_BR: function pt_BR() {
109
+ return Promise.resolve().then(function () {
110
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-pt_BR" */'../i18n/pt_BR'));
111
+ });
112
+ },
113
+ ru: function ru() {
114
+ return Promise.resolve().then(function () {
115
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-ru" */'../i18n/ru'));
116
+ });
117
+ },
118
+ sl: function sl() {
119
+ return Promise.resolve().then(function () {
120
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sl" */'../i18n/sl'));
121
+ });
122
+ },
123
+ sr_RS: function sr_RS() {
124
+ return Promise.resolve().then(function () {
125
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sr_RS" */'../i18n/sr_RS'));
126
+ });
127
+ },
128
+ sr_YR: function sr_YR() {
129
+ return Promise.resolve().then(function () {
130
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sr_YR" */'../i18n/sr_YR'));
131
+ });
132
+ },
133
+ sv: function sv() {
134
+ return Promise.resolve().then(function () {
135
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sv" */'../i18n/sv'));
136
+ });
137
+ },
138
+ th: function th() {
139
+ return Promise.resolve().then(function () {
140
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-th" */'../i18n/th'));
141
+ });
142
+ },
143
+ tr: function tr() {
144
+ return Promise.resolve().then(function () {
145
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-tr" */'../i18n/tr'));
146
+ });
147
+ },
148
+ uk: function uk() {
149
+ return Promise.resolve().then(function () {
150
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-uk" */'../i18n/uk'));
151
+ });
152
+ },
153
+ vi: function vi() {
154
+ return Promise.resolve().then(function () {
155
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-vi" */'../i18n/vi'));
156
+ });
157
+ },
158
+ zh: function zh() {
159
+ return Promise.resolve().then(function () {
160
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-zh" */'../i18n/zh'));
161
+ });
162
+ },
163
+ zh_TW: function zh_TW() {
164
+ return Promise.resolve().then(function () {
165
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-zh_TW" */'../i18n/zh_TW'));
166
+ });
167
+ }
168
+ };
169
+ var getMessages = /*#__PURE__*/function () {
25
170
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(locale) {
26
- var messages, parentLocale, _messages, _t, _t2;
171
+ var loadMessages, messages, _t;
27
172
  return _regenerator.default.wrap(function (_context) {
28
173
  while (1) switch (_context.prev = _context.next) {
29
174
  case 0:
30
- locale = locale.replace('-', '_');
175
+ loadMessages = messagesLoaders[locale];
176
+ if (loadMessages) {
177
+ _context.next = 1;
178
+ break;
179
+ }
180
+ return _context.abrupt("return", undefined);
181
+ case 1:
31
182
  _context.prev = 1;
32
183
  _context.next = 2;
184
+ return loadMessages();
185
+ case 2:
186
+ messages = _context.sent;
187
+ return _context.abrupt("return", unwrapMessages(messages));
188
+ case 3:
189
+ _context.prev = 3;
190
+ _t = _context["catch"](1);
191
+ return _context.abrupt("return", undefined);
192
+ case 4:
193
+ case "end":
194
+ return _context.stop();
195
+ }
196
+ }, _callee, null, [[1, 3]]);
197
+ }));
198
+ return function getMessages(_x) {
199
+ return _ref.apply(this, arguments);
200
+ };
201
+ }();
202
+
203
+ /**
204
+ * Legacy loader preserved for the `fun-2388_fix_feedback_collector_i18n` gate-off
205
+ * path. It uses a free-form dynamic import which, in some builds (e.g. Jira),
206
+ * generates non-existent async chunk URLs and silently fails to localize.
207
+ */
208
+ var getMessagesForLocaleLegacy = /*#__PURE__*/function () {
209
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(locale) {
210
+ var messages, parentLocale, _messages, _t2, _t3;
211
+ return _regenerator.default.wrap(function (_context2) {
212
+ while (1) switch (_context2.prev = _context2.next) {
213
+ case 0:
214
+ locale = locale.replace('-', '_');
215
+ _context2.prev = 1;
216
+ _context2.next = 2;
33
217
  return function (specifier) {
34
218
  return new Promise(function (r) {
35
219
  return r("".concat(specifier));
@@ -38,14 +222,14 @@ var getMessagesForLocale = exports.getMessagesForLocale = /*#__PURE__*/function
38
222
  });
39
223
  }( /* webpackChunkName: "@atlaskit-internal_feedback-collector/i18n-tranlations" */_tsRewriteRelativeImportExtensions("../i18n/".concat(locale)));
40
224
  case 2:
41
- messages = _context.sent;
42
- return _context.abrupt("return", messages.default);
225
+ messages = _context2.sent;
226
+ return _context2.abrupt("return", messages.default);
43
227
  case 3:
44
- _context.prev = 3;
45
- _t = _context["catch"](1);
46
- _context.prev = 4;
228
+ _context2.prev = 3;
229
+ _t2 = _context2["catch"](1);
230
+ _context2.prev = 4;
47
231
  parentLocale = locale.split(/[-_]/)[0];
48
- _context.next = 5;
232
+ _context2.next = 5;
49
233
  return function (specifier) {
50
234
  return new Promise(function (r) {
51
235
  return r("".concat(specifier));
@@ -54,18 +238,57 @@ var getMessagesForLocale = exports.getMessagesForLocale = /*#__PURE__*/function
54
238
  });
55
239
  }( /* webpackChunkName: "@atlaskit-internal_feedback-collector/i18n-tranlations" */_tsRewriteRelativeImportExtensions("../i18n/".concat(parentLocale)));
56
240
  case 5:
57
- _messages = _context.sent;
58
- return _context.abrupt("return", _messages.default);
241
+ _messages = _context2.sent;
242
+ return _context2.abrupt("return", _messages.default);
59
243
  case 6:
60
- _context.prev = 6;
61
- _t2 = _context["catch"](4);
244
+ _context2.prev = 6;
245
+ _t3 = _context2["catch"](4);
62
246
  case 7:
63
247
  case "end":
64
- return _context.stop();
248
+ return _context2.stop();
65
249
  }
66
- }, _callee, null, [[1, 3], [4, 6]]);
250
+ }, _callee2, null, [[1, 3], [4, 6]]);
67
251
  }));
68
- return function getMessagesForLocale(_x) {
69
- return _ref.apply(this, arguments);
252
+ return function getMessagesForLocaleLegacy(_x2) {
253
+ return _ref2.apply(this, arguments);
254
+ };
255
+ }();
256
+
257
+ /**
258
+ * Tries to get the most specific messages bundle for a given locale.
259
+ *
260
+ * Strategy:
261
+ * 1. Try to find messages with the exact string (i.e. 'fr_FR')
262
+ * 2. If that doesn't work, try to find messages for the language locale (i.e. 'fr')
263
+ * 3. If that doesn't work, return undefined so react-intl uses english default messages.
264
+ *
265
+ * @param locale string specifying the locale like 'en_GB', or 'fr'.
266
+ */
267
+ var getMessagesForLocale = exports.getMessagesForLocale = /*#__PURE__*/function () {
268
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(locale) {
269
+ var localeKey, messages;
270
+ return _regenerator.default.wrap(function (_context3) {
271
+ while (1) switch (_context3.prev = _context3.next) {
272
+ case 0:
273
+ if ((0, _platformFeatureFlags.fg)('fun-2388_fix_feedback_collector_i18n')) {
274
+ _context3.next = 1;
275
+ break;
276
+ }
277
+ return _context3.abrupt("return", getMessagesForLocaleLegacy(locale));
278
+ case 1:
279
+ localeKey = locale.replace('-', '_');
280
+ _context3.next = 2;
281
+ return getMessages(localeKey);
282
+ case 2:
283
+ messages = _context3.sent;
284
+ return _context3.abrupt("return", messages !== null && messages !== void 0 ? messages : getMessages(localeKey.split(/[-_]/)[0]));
285
+ case 3:
286
+ case "end":
287
+ return _context3.stop();
288
+ }
289
+ }, _callee3);
290
+ }));
291
+ return function getMessagesForLocale(_x3) {
292
+ return _ref3.apply(this, arguments);
70
293
  };
71
294
  }();
@@ -92,7 +92,7 @@ export default class FeedbackCollector extends Component {
92
92
  return FeedbackCollector.defaultProps.url;
93
93
  }
94
94
  getPackageVersion() {
95
- return "16.5.0" || 'Unknown, at least 11.0.0';
95
+ return "16.6.1" || 'Unknown, at least 11.0.0';
96
96
  }
97
97
  async getEntitlementInformation() {
98
98
  var _entitlementDetails, _entitlementDetails2, _productName, _entitlement, _productEntitlement;
@@ -189,7 +189,8 @@ const FeedbackForm = ({
189
189
  (_restProps$onChange = restProps.onChange) === null || _restProps$onChange === void 0 ? void 0 : _restProps$onChange.call(restProps, option.value);
190
190
  },
191
191
  menuPosition: "fixed",
192
- options: selectOptions
192
+ options: selectOptions,
193
+ shouldPreventEscapePropagation: fg('ak_feedback_collector_select_escape')
193
194
  // @ts-ignore
194
195
  ,
195
196
  ref: focusRef,
@@ -299,7 +300,8 @@ const FeedbackForm = ({
299
300
  (_restProps$onChange2 = restProps.onChange) === null || _restProps$onChange2 === void 0 ? void 0 : _restProps$onChange2.call(restProps, option.value);
300
301
  },
301
302
  menuPosition: "fixed",
302
- options: selectOptions
303
+ options: selectOptions,
304
+ shouldPreventEscapePropagation: fg('ak_feedback_collector_select_escape')
303
305
  // @ts-ignore
304
306
  ,
305
307
  ref: focusRef,
@@ -1,16 +1,60 @@
1
1
  function _tsRewriteRelativeImportExtensions(t, e) { return "string" == typeof t && /^\.\.?\//.test(t) ? t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+)?)\.([cm]?)ts$/i, function (t, s, r, n, o) { return s ? e ? ".jsx" : ".js" : !r || n && o ? r + n + "." + o.toLowerCase() + "js" : t; }) : t; }
2
+ import { fg } from '@atlaskit/platform-feature-flags';
3
+ const isNestedMessagesModule = value => 'default' in value && typeof value.default === 'object' && value.default !== null;
4
+ const unwrapMessages = messages => {
5
+ const defaultExport = messages.default;
6
+ return isNestedMessagesModule(defaultExport) ? defaultExport.default : defaultExport;
7
+ };
8
+ const messagesLoaders = {
9
+ cs: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-cs" */'../i18n/cs'),
10
+ da: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-da" */'../i18n/da'),
11
+ de: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-de" */'../i18n/de'),
12
+ en: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-en" */'../i18n/en'),
13
+ en_GB: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-en_GB" */'../i18n/en_GB'),
14
+ en_ZZ: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-en_ZZ" */'../i18n/en_ZZ'),
15
+ es: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-es" */'../i18n/es'),
16
+ fi: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-fi" */'../i18n/fi'),
17
+ fr: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-fr" */'../i18n/fr'),
18
+ hr: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-hr" */'../i18n/hr'),
19
+ hu: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-hu" */'../i18n/hu'),
20
+ it: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-it" */'../i18n/it'),
21
+ ja: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-ja" */'../i18n/ja'),
22
+ ko: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-ko" */'../i18n/ko'),
23
+ nb: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-nb" */'../i18n/nb'),
24
+ nl: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-nl" */'../i18n/nl'),
25
+ pl: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-pl" */'../i18n/pl'),
26
+ pt_BR: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-pt_BR" */'../i18n/pt_BR'),
27
+ ru: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-ru" */'../i18n/ru'),
28
+ sl: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sl" */'../i18n/sl'),
29
+ sr_RS: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sr_RS" */'../i18n/sr_RS'),
30
+ sr_YR: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sr_YR" */'../i18n/sr_YR'),
31
+ sv: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sv" */'../i18n/sv'),
32
+ th: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-th" */'../i18n/th'),
33
+ tr: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-tr" */'../i18n/tr'),
34
+ uk: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-uk" */'../i18n/uk'),
35
+ vi: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-vi" */'../i18n/vi'),
36
+ zh: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-zh" */'../i18n/zh'),
37
+ zh_TW: () => import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-zh_TW" */'../i18n/zh_TW')
38
+ };
39
+ const getMessages = async locale => {
40
+ const loadMessages = messagesLoaders[locale];
41
+ if (!loadMessages) {
42
+ return undefined;
43
+ }
44
+ try {
45
+ const messages = await loadMessages();
46
+ return unwrapMessages(messages);
47
+ } catch {
48
+ return undefined;
49
+ }
50
+ };
51
+
2
52
  /**
3
- * Tries to get the most specific messages bundle for a given locale.
4
- *
5
- * Strategy:
6
- * 1. Try to find messages with the exact string (i.e. 'fr_FR')
7
- * 2. If that doesn't work, try to find messages for the country locale (i.e. 'fr')
8
- * 3. If that doesn't work, return english messages as a fallback.
9
- *
10
- * @param locale string specifying the locale like 'en_GB', or 'fr'.
53
+ * Legacy loader preserved for the `fun-2388_fix_feedback_collector_i18n` gate-off
54
+ * path. It uses a free-form dynamic import which, in some builds (e.g. Jira),
55
+ * generates non-existent async chunk URLs and silently fails to localize.
11
56
  */
12
-
13
- export const getMessagesForLocale = async locale => {
57
+ const getMessagesForLocaleLegacy = async locale => {
14
58
  locale = locale.replace('-', '_');
15
59
  try {
16
60
  const messages = await import( /* webpackChunkName: "@atlaskit-internal_feedback-collector/i18n-tranlations" */_tsRewriteRelativeImportExtensions(`../i18n/${locale}`));
@@ -25,4 +69,23 @@ export const getMessagesForLocale = async locale => {
25
69
  } catch (e) {
26
70
  // ignore
27
71
  }
72
+ };
73
+
74
+ /**
75
+ * Tries to get the most specific messages bundle for a given locale.
76
+ *
77
+ * Strategy:
78
+ * 1. Try to find messages with the exact string (i.e. 'fr_FR')
79
+ * 2. If that doesn't work, try to find messages for the language locale (i.e. 'fr')
80
+ * 3. If that doesn't work, return undefined so react-intl uses english default messages.
81
+ *
82
+ * @param locale string specifying the locale like 'en_GB', or 'fr'.
83
+ */
84
+ export const getMessagesForLocale = async locale => {
85
+ if (!fg('fun-2388_fix_feedback_collector_i18n')) {
86
+ return getMessagesForLocaleLegacy(locale);
87
+ }
88
+ const localeKey = locale.replace('-', '_');
89
+ const messages = await getMessages(localeKey);
90
+ return messages !== null && messages !== void 0 ? messages : getMessages(localeKey.split(/[-_]/)[0]);
28
91
  };
@@ -155,7 +155,7 @@ var FeedbackCollector = /*#__PURE__*/function (_Component) {
155
155
  }, {
156
156
  key: "getPackageVersion",
157
157
  value: function getPackageVersion() {
158
- return "16.5.0" || 'Unknown, at least 11.0.0';
158
+ return "16.6.1" || 'Unknown, at least 11.0.0';
159
159
  }
160
160
  }, {
161
161
  key: "getEntitlementInformation",
@@ -229,7 +229,8 @@ var FeedbackForm = function FeedbackForm(_ref2) {
229
229
  (_restProps$onChange = restProps.onChange) === null || _restProps$onChange === void 0 || _restProps$onChange.call(restProps, option.value);
230
230
  },
231
231
  menuPosition: "fixed",
232
- options: selectOptions
232
+ options: selectOptions,
233
+ shouldPreventEscapePropagation: fg('ak_feedback_collector_select_escape')
233
234
  // @ts-ignore
234
235
  ,
235
236
  ref: focusRef,
@@ -360,7 +361,8 @@ var FeedbackForm = function FeedbackForm(_ref2) {
360
361
  (_restProps$onChange2 = restProps.onChange) === null || _restProps$onChange2 === void 0 || _restProps$onChange2.call(restProps, option.value);
361
362
  },
362
363
  menuPosition: "fixed",
363
- options: selectOptions
364
+ options: selectOptions,
365
+ shouldPreventEscapePropagation: fg('ak_feedback_collector_select_escape')
364
366
  // @ts-ignore
365
367
  ,
366
368
  ref: focusRef,
@@ -1,50 +1,215 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
- import _regeneratorRuntime from "@babel/runtime/regenerator";
2
+ import _typeof from "@babel/runtime/helpers/typeof";
3
3
  function _tsRewriteRelativeImportExtensions(t, e) { return "string" == typeof t && /^\.\.?\//.test(t) ? t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+)?)\.([cm]?)ts$/i, function (t, s, r, n, o) { return s ? e ? ".jsx" : ".js" : !r || n && o ? r + n + "." + o.toLowerCase() + "js" : t; }) : t; }
4
- /**
5
- * Tries to get the most specific messages bundle for a given locale.
6
- *
7
- * Strategy:
8
- * 1. Try to find messages with the exact string (i.e. 'fr_FR')
9
- * 2. If that doesn't work, try to find messages for the country locale (i.e. 'fr')
10
- * 3. If that doesn't work, return english messages as a fallback.
11
- *
12
- * @param locale string specifying the locale like 'en_GB', or 'fr'.
13
- */
14
-
15
- export var getMessagesForLocale = /*#__PURE__*/function () {
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
5
+ import { fg } from '@atlaskit/platform-feature-flags';
6
+ var isNestedMessagesModule = function isNestedMessagesModule(value) {
7
+ return 'default' in value && _typeof(value.default) === 'object' && value.default !== null;
8
+ };
9
+ var unwrapMessages = function unwrapMessages(messages) {
10
+ var defaultExport = messages.default;
11
+ return isNestedMessagesModule(defaultExport) ? defaultExport.default : defaultExport;
12
+ };
13
+ var messagesLoaders = {
14
+ cs: function cs() {
15
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-cs" */'../i18n/cs');
16
+ },
17
+ da: function da() {
18
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-da" */'../i18n/da');
19
+ },
20
+ de: function de() {
21
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-de" */'../i18n/de');
22
+ },
23
+ en: function en() {
24
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-en" */'../i18n/en');
25
+ },
26
+ en_GB: function en_GB() {
27
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-en_GB" */'../i18n/en_GB');
28
+ },
29
+ en_ZZ: function en_ZZ() {
30
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-en_ZZ" */'../i18n/en_ZZ');
31
+ },
32
+ es: function es() {
33
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-es" */'../i18n/es');
34
+ },
35
+ fi: function fi() {
36
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-fi" */'../i18n/fi');
37
+ },
38
+ fr: function fr() {
39
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-fr" */'../i18n/fr');
40
+ },
41
+ hr: function hr() {
42
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-hr" */'../i18n/hr');
43
+ },
44
+ hu: function hu() {
45
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-hu" */'../i18n/hu');
46
+ },
47
+ it: function it() {
48
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-it" */'../i18n/it');
49
+ },
50
+ ja: function ja() {
51
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-ja" */'../i18n/ja');
52
+ },
53
+ ko: function ko() {
54
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-ko" */'../i18n/ko');
55
+ },
56
+ nb: function nb() {
57
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-nb" */'../i18n/nb');
58
+ },
59
+ nl: function nl() {
60
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-nl" */'../i18n/nl');
61
+ },
62
+ pl: function pl() {
63
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-pl" */'../i18n/pl');
64
+ },
65
+ pt_BR: function pt_BR() {
66
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-pt_BR" */'../i18n/pt_BR');
67
+ },
68
+ ru: function ru() {
69
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-ru" */'../i18n/ru');
70
+ },
71
+ sl: function sl() {
72
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sl" */'../i18n/sl');
73
+ },
74
+ sr_RS: function sr_RS() {
75
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sr_RS" */'../i18n/sr_RS');
76
+ },
77
+ sr_YR: function sr_YR() {
78
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sr_YR" */'../i18n/sr_YR');
79
+ },
80
+ sv: function sv() {
81
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-sv" */'../i18n/sv');
82
+ },
83
+ th: function th() {
84
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-th" */'../i18n/th');
85
+ },
86
+ tr: function tr() {
87
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-tr" */'../i18n/tr');
88
+ },
89
+ uk: function uk() {
90
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-uk" */'../i18n/uk');
91
+ },
92
+ vi: function vi() {
93
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-vi" */'../i18n/vi');
94
+ },
95
+ zh: function zh() {
96
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-zh" */'../i18n/zh');
97
+ },
98
+ zh_TW: function zh_TW() {
99
+ return import( /* webpackChunkName: "@atlaskit-internal_@atlassian/feedback-collector-i18n-zh_TW" */'../i18n/zh_TW');
100
+ }
101
+ };
102
+ var getMessages = /*#__PURE__*/function () {
16
103
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(locale) {
17
- var messages, parentLocale, _messages, _t, _t2;
104
+ var loadMessages, messages, _t;
18
105
  return _regeneratorRuntime.wrap(function (_context) {
19
106
  while (1) switch (_context.prev = _context.next) {
20
107
  case 0:
21
- locale = locale.replace('-', '_');
108
+ loadMessages = messagesLoaders[locale];
109
+ if (loadMessages) {
110
+ _context.next = 1;
111
+ break;
112
+ }
113
+ return _context.abrupt("return", undefined);
114
+ case 1:
22
115
  _context.prev = 1;
23
116
  _context.next = 2;
24
- return import( /* webpackChunkName: "@atlaskit-internal_feedback-collector/i18n-tranlations" */_tsRewriteRelativeImportExtensions(_tsRewriteRelativeImportExtensions("../i18n/".concat(locale))));
117
+ return loadMessages();
25
118
  case 2:
26
119
  messages = _context.sent;
27
- return _context.abrupt("return", messages.default);
120
+ return _context.abrupt("return", unwrapMessages(messages));
28
121
  case 3:
29
122
  _context.prev = 3;
30
123
  _t = _context["catch"](1);
31
- _context.prev = 4;
124
+ return _context.abrupt("return", undefined);
125
+ case 4:
126
+ case "end":
127
+ return _context.stop();
128
+ }
129
+ }, _callee, null, [[1, 3]]);
130
+ }));
131
+ return function getMessages(_x) {
132
+ return _ref.apply(this, arguments);
133
+ };
134
+ }();
135
+
136
+ /**
137
+ * Legacy loader preserved for the `fun-2388_fix_feedback_collector_i18n` gate-off
138
+ * path. It uses a free-form dynamic import which, in some builds (e.g. Jira),
139
+ * generates non-existent async chunk URLs and silently fails to localize.
140
+ */
141
+ var getMessagesForLocaleLegacy = /*#__PURE__*/function () {
142
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(locale) {
143
+ var messages, parentLocale, _messages, _t2, _t3;
144
+ return _regeneratorRuntime.wrap(function (_context2) {
145
+ while (1) switch (_context2.prev = _context2.next) {
146
+ case 0:
147
+ locale = locale.replace('-', '_');
148
+ _context2.prev = 1;
149
+ _context2.next = 2;
150
+ return import( /* webpackChunkName: "@atlaskit-internal_feedback-collector/i18n-tranlations" */_tsRewriteRelativeImportExtensions(_tsRewriteRelativeImportExtensions("../i18n/".concat(locale))));
151
+ case 2:
152
+ messages = _context2.sent;
153
+ return _context2.abrupt("return", messages.default);
154
+ case 3:
155
+ _context2.prev = 3;
156
+ _t2 = _context2["catch"](1);
157
+ _context2.prev = 4;
32
158
  parentLocale = locale.split(/[-_]/)[0];
33
- _context.next = 5;
159
+ _context2.next = 5;
34
160
  return import( /* webpackChunkName: "@atlaskit-internal_feedback-collector/i18n-tranlations" */_tsRewriteRelativeImportExtensions(_tsRewriteRelativeImportExtensions("../i18n/".concat(parentLocale))));
35
161
  case 5:
36
- _messages = _context.sent;
37
- return _context.abrupt("return", _messages.default);
162
+ _messages = _context2.sent;
163
+ return _context2.abrupt("return", _messages.default);
38
164
  case 6:
39
- _context.prev = 6;
40
- _t2 = _context["catch"](4);
165
+ _context2.prev = 6;
166
+ _t3 = _context2["catch"](4);
41
167
  case 7:
42
168
  case "end":
43
- return _context.stop();
169
+ return _context2.stop();
44
170
  }
45
- }, _callee, null, [[1, 3], [4, 6]]);
171
+ }, _callee2, null, [[1, 3], [4, 6]]);
46
172
  }));
47
- return function getMessagesForLocale(_x) {
48
- return _ref.apply(this, arguments);
173
+ return function getMessagesForLocaleLegacy(_x2) {
174
+ return _ref2.apply(this, arguments);
175
+ };
176
+ }();
177
+
178
+ /**
179
+ * Tries to get the most specific messages bundle for a given locale.
180
+ *
181
+ * Strategy:
182
+ * 1. Try to find messages with the exact string (i.e. 'fr_FR')
183
+ * 2. If that doesn't work, try to find messages for the language locale (i.e. 'fr')
184
+ * 3. If that doesn't work, return undefined so react-intl uses english default messages.
185
+ *
186
+ * @param locale string specifying the locale like 'en_GB', or 'fr'.
187
+ */
188
+ export var getMessagesForLocale = /*#__PURE__*/function () {
189
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(locale) {
190
+ var localeKey, messages;
191
+ return _regeneratorRuntime.wrap(function (_context3) {
192
+ while (1) switch (_context3.prev = _context3.next) {
193
+ case 0:
194
+ if (fg('fun-2388_fix_feedback_collector_i18n')) {
195
+ _context3.next = 1;
196
+ break;
197
+ }
198
+ return _context3.abrupt("return", getMessagesForLocaleLegacy(locale));
199
+ case 1:
200
+ localeKey = locale.replace('-', '_');
201
+ _context3.next = 2;
202
+ return getMessages(localeKey);
203
+ case 2:
204
+ messages = _context3.sent;
205
+ return _context3.abrupt("return", messages !== null && messages !== void 0 ? messages : getMessages(localeKey.split(/[-_]/)[0]));
206
+ case 3:
207
+ case "end":
208
+ return _context3.stop();
209
+ }
210
+ }, _callee3);
211
+ }));
212
+ return function getMessagesForLocale(_x3) {
213
+ return _ref3.apply(this, arguments);
49
214
  };
50
215
  }();
@@ -1,11 +1,13 @@
1
+ type Messages = Record<string, string>;
1
2
  /**
2
3
  * Tries to get the most specific messages bundle for a given locale.
3
4
  *
4
5
  * Strategy:
5
6
  * 1. Try to find messages with the exact string (i.e. 'fr_FR')
6
- * 2. If that doesn't work, try to find messages for the country locale (i.e. 'fr')
7
- * 3. If that doesn't work, return english messages as a fallback.
7
+ * 2. If that doesn't work, try to find messages for the language locale (i.e. 'fr')
8
+ * 3. If that doesn't work, return undefined so react-intl uses english default messages.
8
9
  *
9
10
  * @param locale string specifying the locale like 'en_GB', or 'fr'.
10
11
  */
11
- export declare const getMessagesForLocale: (locale: string) => Promise<any>;
12
+ export declare const getMessagesForLocale: (locale: string) => Promise<Messages | undefined>;
13
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/feedback-collector",
3
- "version": "16.6.0",
3
+ "version": "16.6.2",
4
4
  "description": "A component that collects feedback across Atlassian products.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,14 +29,14 @@
29
29
  "@atlaskit/checkbox": "^18.2.0",
30
30
  "@atlaskit/flag": "^18.2.0",
31
31
  "@atlaskit/form": "^16.1.0",
32
- "@atlaskit/icon": "^37.0.0",
32
+ "@atlaskit/icon": "^37.1.0",
33
33
  "@atlaskit/link": "^4.3.0",
34
34
  "@atlaskit/modal-dialog": "^16.1.0",
35
- "@atlaskit/platform-feature-flags": "^2.0.0",
35
+ "@atlaskit/platform-feature-flags": "^2.1.0",
36
36
  "@atlaskit/section-message": "^9.2.0",
37
37
  "@atlaskit/select": "^22.5.0",
38
38
  "@atlaskit/textarea": "^9.1.0",
39
- "@atlaskit/tokens": "^16.0.0",
39
+ "@atlaskit/tokens": "^16.3.0",
40
40
  "@atlaskit/visually-hidden": "^4.2.0",
41
41
  "@babel/runtime": "^7.0.0"
42
42
  },
@@ -89,6 +89,12 @@
89
89
  },
90
90
  "ak_feedback_collector_hide_required_summary": {
91
91
  "type": "boolean"
92
+ },
93
+ "ak_feedback_collector_select_escape": {
94
+ "type": "boolean"
95
+ },
96
+ "fun-2388_fix_feedback_collector_i18n": {
97
+ "type": "boolean"
92
98
  }
93
99
  }
94
100
  }