@aws-amplify/ui-react 1.2.26-unstable.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/dist/esm/index.css +1 -0
  2. package/dist/esm/index.css.map +7 -0
  3. package/dist/esm/index.js +1 -0
  4. package/dist/esm/index.js.map +7 -0
  5. package/dist/esm/legacy.js +1 -0
  6. package/dist/esm/legacy.js.map +7 -0
  7. package/dist/index.css +1 -0
  8. package/dist/index.css.map +7 -0
  9. package/dist/index.d.ts +7533 -0
  10. package/dist/index.js +1 -0
  11. package/dist/index.js.map +7 -0
  12. package/dist/legacy.d.ts +1 -0
  13. package/dist/legacy.js +1 -0
  14. package/dist/legacy.js.map +7 -0
  15. package/dist/primitives.json +22168 -0
  16. package/legacy/package.json +7 -0
  17. package/package.json +82 -40
  18. package/CHANGELOG.md +0 -339
  19. package/README.md +0 -1
  20. package/build.js +0 -5
  21. package/dist/0.js +0 -269
  22. package/dist/0.js.map +0 -1
  23. package/dist/1.js +0 -2111
  24. package/dist/1.js.map +0 -1
  25. package/dist/10.js +0 -707
  26. package/dist/10.js.map +0 -1
  27. package/dist/11.js +0 -45
  28. package/dist/11.js.map +0 -1
  29. package/dist/12.js +0 -1152
  30. package/dist/12.js.map +0 -1
  31. package/dist/13.js +0 -114
  32. package/dist/13.js.map +0 -1
  33. package/dist/14.js +0 -1194
  34. package/dist/14.js.map +0 -1
  35. package/dist/15.js +0 -61
  36. package/dist/15.js.map +0 -1
  37. package/dist/16.js +0 -37
  38. package/dist/16.js.map +0 -1
  39. package/dist/17.js +0 -127
  40. package/dist/17.js.map +0 -1
  41. package/dist/18.js +0 -90
  42. package/dist/18.js.map +0 -1
  43. package/dist/19.js +0 -267
  44. package/dist/19.js.map +0 -1
  45. package/dist/2.js +0 -766
  46. package/dist/2.js.map +0 -1
  47. package/dist/20.js +0 -74
  48. package/dist/20.js.map +0 -1
  49. package/dist/21.js +0 -50
  50. package/dist/21.js.map +0 -1
  51. package/dist/22.js +0 -57
  52. package/dist/22.js.map +0 -1
  53. package/dist/23.js +0 -50
  54. package/dist/23.js.map +0 -1
  55. package/dist/24.js +0 -271
  56. package/dist/24.js.map +0 -1
  57. package/dist/25.js +0 -102
  58. package/dist/25.js.map +0 -1
  59. package/dist/26.js +0 -64
  60. package/dist/26.js.map +0 -1
  61. package/dist/27.js +0 -379
  62. package/dist/27.js.map +0 -1
  63. package/dist/28.js +0 -47
  64. package/dist/28.js.map +0 -1
  65. package/dist/29.js +0 -46
  66. package/dist/29.js.map +0 -1
  67. package/dist/3.js +0 -2787
  68. package/dist/3.js.map +0 -1
  69. package/dist/30.js +0 -503
  70. package/dist/30.js.map +0 -1
  71. package/dist/31.js +0 -2
  72. package/dist/31.js.map +0 -1
  73. package/dist/32.js +0 -2
  74. package/dist/32.js.map +0 -1
  75. package/dist/33.js +0 -13
  76. package/dist/33.js.map +0 -1
  77. package/dist/4.js +0 -4126
  78. package/dist/4.js.map +0 -1
  79. package/dist/5.js +0 -817
  80. package/dist/5.js.map +0 -1
  81. package/dist/6.js +0 -619
  82. package/dist/6.js.map +0 -1
  83. package/dist/7.js +0 -662
  84. package/dist/7.js.map +0 -1
  85. package/dist/8.js +0 -614
  86. package/dist/8.js.map +0 -1
  87. package/dist/9.js +0 -665
  88. package/dist/9.js.map +0 -1
  89. package/dist/@aws-amplify/ui-react.js +0 -31875
  90. package/dist/@aws-amplify/ui-react.js.map +0 -1
  91. package/dist/aws-amplify-react.min.js +0 -28
  92. package/dist/aws-amplify-react.min.js.map +0 -1
  93. package/dist/polyfills-core-js.js +0 -5211
  94. package/dist/polyfills-core-js.js.map +0 -1
  95. package/dist/polyfills-css-shim.js +0 -467
  96. package/dist/polyfills-css-shim.js.map +0 -1
  97. package/dist/polyfills-dom.js +0 -2098
  98. package/dist/polyfills-dom.js.map +0 -1
  99. package/jest.config.js +0 -12
  100. package/lib/components.d.ts +0 -56
  101. package/lib/components.js +0 -64
  102. package/lib/components.js.map +0 -1
  103. package/lib/index.d.ts +0 -2
  104. package/lib/index.js +0 -9
  105. package/lib/index.js.map +0 -1
  106. package/lib/react-component-lib/createComponent.d.ts +0 -2
  107. package/lib/react-component-lib/createComponent.js +0 -91
  108. package/lib/react-component-lib/createComponent.js.map +0 -1
  109. package/lib/react-component-lib/createControllerComponent.d.ts +0 -43
  110. package/lib/react-component-lib/createControllerComponent.js +0 -152
  111. package/lib/react-component-lib/createControllerComponent.js.map +0 -1
  112. package/lib/react-component-lib/createOverlayComponent.d.ts +0 -45
  113. package/lib/react-component-lib/createOverlayComponent.js +0 -148
  114. package/lib/react-component-lib/createOverlayComponent.js.map +0 -1
  115. package/lib/react-component-lib/index.d.ts +0 -3
  116. package/lib/react-component-lib/index.js +0 -9
  117. package/lib/react-component-lib/index.js.map +0 -1
  118. package/lib/react-component-lib/utils/attachEventProps.d.ts +0 -8
  119. package/lib/react-component-lib/utils/attachEventProps.js +0 -85
  120. package/lib/react-component-lib/utils/attachEventProps.js.map +0 -1
  121. package/lib/react-component-lib/utils/index.d.ts +0 -8
  122. package/lib/react-component-lib/utils/index.js +0 -36
  123. package/lib/react-component-lib/utils/index.js.map +0 -1
  124. package/lib/withAuthenticator.d.ts +0 -3
  125. package/lib/withAuthenticator.js +0 -127
  126. package/lib/withAuthenticator.js.map +0 -1
  127. package/lib-esm/components.d.ts +0 -56
  128. package/lib-esm/components.js +0 -62
  129. package/lib-esm/components.js.map +0 -1
  130. package/lib-esm/index.d.ts +0 -2
  131. package/lib-esm/index.js +0 -3
  132. package/lib-esm/index.js.map +0 -1
  133. package/lib-esm/react-component-lib/createComponent.d.ts +0 -2
  134. package/lib-esm/react-component-lib/createComponent.js +0 -86
  135. package/lib-esm/react-component-lib/createComponent.js.map +0 -1
  136. package/lib-esm/react-component-lib/createControllerComponent.d.ts +0 -43
  137. package/lib-esm/react-component-lib/createControllerComponent.js +0 -146
  138. package/lib-esm/react-component-lib/createControllerComponent.js.map +0 -1
  139. package/lib-esm/react-component-lib/createOverlayComponent.d.ts +0 -45
  140. package/lib-esm/react-component-lib/createOverlayComponent.js +0 -142
  141. package/lib-esm/react-component-lib/createOverlayComponent.js.map +0 -1
  142. package/lib-esm/react-component-lib/index.d.ts +0 -3
  143. package/lib-esm/react-component-lib/index.js +0 -4
  144. package/lib-esm/react-component-lib/index.js.map +0 -1
  145. package/lib-esm/react-component-lib/utils/attachEventProps.d.ts +0 -8
  146. package/lib-esm/react-component-lib/utils/attachEventProps.js +0 -79
  147. package/lib-esm/react-component-lib/utils/attachEventProps.js.map +0 -1
  148. package/lib-esm/react-component-lib/utils/index.d.ts +0 -8
  149. package/lib-esm/react-component-lib/utils/index.js +0 -28
  150. package/lib-esm/react-component-lib/utils/index.js.map +0 -1
  151. package/lib-esm/withAuthenticator.d.ts +0 -3
  152. package/lib-esm/withAuthenticator.js +0 -121
  153. package/lib-esm/withAuthenticator.js.map +0 -1
  154. package/src/components.ts +0 -65
  155. package/src/index.ts +0 -3
  156. package/src/react-component-lib/createComponent.tsx +0 -69
  157. package/src/react-component-lib/createControllerComponent.tsx +0 -71
  158. package/src/react-component-lib/createOverlayComponent.tsx +0 -79
  159. package/src/react-component-lib/index.ts +0 -3
  160. package/src/react-component-lib/utils/attachEventProps.ts +0 -87
  161. package/src/react-component-lib/utils/index.tsx +0 -31
  162. package/src/withAuthenticator.tsx +0 -62
  163. package/webpack.config.dev.js +0 -6
  164. package/webpack.config.js +0 -56
package/dist/9.js DELETED
@@ -1,665 +0,0 @@
1
- (this["webpackJsonpaws_amplify_react"] = this["webpackJsonpaws_amplify_react"] || []).push([[9],{
2
-
3
- /***/ "../amplify-ui-components/dist/esm-es5/amplify-s3-text.entry.js":
4
- /*!**********************************************************************!*\
5
- !*** ../amplify-ui-components/dist/esm-es5/amplify-s3-text.entry.js ***!
6
- \**********************************************************************/
7
- /*! exports provided: amplify_s3_text */
8
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
9
-
10
- "use strict";
11
- __webpack_require__.r(__webpack_exports__);
12
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_s3_text", function() { return AmplifyS3Text; });
13
- /* harmony import */ var _index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index-83f2275b.js */ "../amplify-ui-components/dist/esm-es5/index-83f2275b.js");
14
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/core */ "@aws-amplify/core");
15
- /* harmony import */ var _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__);
16
- /* harmony import */ var _storage_types_f257c0f2_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./storage-types-f257c0f2.js */ "../amplify-ui-components/dist/esm-es5/storage-types-f257c0f2.js");
17
- /* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
18
- /* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_3__);
19
- /* harmony import */ var _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Translations-108d469f.js */ "../amplify-ui-components/dist/esm-es5/Translations-108d469f.js");
20
- /* harmony import */ var _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants-c8ecaa24.js */ "../amplify-ui-components/dist/esm-es5/constants-c8ecaa24.js");
21
- /* harmony import */ var _aws_amplify_storage__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @aws-amplify/storage */ "@aws-amplify/storage");
22
- /* harmony import */ var _aws_amplify_storage__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_storage__WEBPACK_IMPORTED_MODULE_6__);
23
- /* harmony import */ var _storage_helpers_1afafead_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./storage-helpers-1afafead.js */ "../amplify-ui-components/dist/esm-es5/storage-helpers-1afafead.js");
24
- var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
25
- function adopt(value) {
26
- return value instanceof P ? value : new P(function (resolve) {
27
- resolve(value);
28
- });
29
- }
30
-
31
- return new (P || (P = Promise))(function (resolve, reject) {
32
- function fulfilled(value) {
33
- try {
34
- step(generator.next(value));
35
- } catch (e) {
36
- reject(e);
37
- }
38
- }
39
-
40
- function rejected(value) {
41
- try {
42
- step(generator["throw"](value));
43
- } catch (e) {
44
- reject(e);
45
- }
46
- }
47
-
48
- function step(result) {
49
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
50
- }
51
-
52
- step((generator = generator.apply(thisArg, _arguments || [])).next());
53
- });
54
- };
55
-
56
- var __generator = undefined && undefined.__generator || function (thisArg, body) {
57
- var _ = {
58
- label: 0,
59
- sent: function sent() {
60
- if (t[0] & 1) throw t[1];
61
- return t[1];
62
- },
63
- trys: [],
64
- ops: []
65
- },
66
- f,
67
- y,
68
- t,
69
- g;
70
- return g = {
71
- next: verb(0),
72
- "throw": verb(1),
73
- "return": verb(2)
74
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
75
- return this;
76
- }), g;
77
-
78
- function verb(n) {
79
- return function (v) {
80
- return step([n, v]);
81
- };
82
- }
83
-
84
- function step(op) {
85
- if (f) throw new TypeError("Generator is already executing.");
86
-
87
- while (_) {
88
- try {
89
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
90
- if (y = 0, t) op = [op[0] & 2, t.value];
91
-
92
- switch (op[0]) {
93
- case 0:
94
- case 1:
95
- t = op;
96
- break;
97
-
98
- case 4:
99
- _.label++;
100
- return {
101
- value: op[1],
102
- done: false
103
- };
104
-
105
- case 5:
106
- _.label++;
107
- y = op[1];
108
- op = [0];
109
- continue;
110
-
111
- case 7:
112
- op = _.ops.pop();
113
-
114
- _.trys.pop();
115
-
116
- continue;
117
-
118
- default:
119
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
120
- _ = 0;
121
- continue;
122
- }
123
-
124
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
125
- _.label = op[1];
126
- break;
127
- }
128
-
129
- if (op[0] === 6 && _.label < t[1]) {
130
- _.label = t[1];
131
- t = op;
132
- break;
133
- }
134
-
135
- if (t && _.label < t[2]) {
136
- _.label = t[2];
137
-
138
- _.ops.push(op);
139
-
140
- break;
141
- }
142
-
143
- if (t[2]) _.ops.pop();
144
-
145
- _.trys.pop();
146
-
147
- continue;
148
- }
149
-
150
- op = body.call(thisArg, _);
151
- } catch (e) {
152
- op = [6, e];
153
- y = 0;
154
- } finally {
155
- f = t = 0;
156
- }
157
- }
158
-
159
- if (op[0] & 5) throw op[1];
160
- return {
161
- value: op[0] ? op[1] : void 0,
162
- done: true
163
- };
164
- }
165
- };
166
-
167
-
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
- var amplifyS3TextCss = ":host{--container-color:var(--amplify-smoke-white);--border-color:var(--amplify-light-grey);--font-size:var(--amplify-text-md);--text-color:var(--amplify-secondary-color)}.text-container{background-color:var(--container-color);border:1px solid var(--border-color);border-radius:5px;margin-bottom:10px}pre{display:block;margin:0.5rem 0;padding:0.5rem;line-height:1rem;max-height:50rem;font-size:var(--font-size);color:var(--text-color);word-break:break-all;overflow-y:scroll;overflow-x:auto}";
176
- var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Logger"]('S3Text');
177
-
178
- var AmplifyS3Text =
179
- /** @class */
180
- function () {
181
- function class_1(hostRef) {
182
- Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
183
- /** The content type header used when uploading to S3 */
184
-
185
- this.contentType = 'text/*';
186
- /** The access level of the text file */
187
-
188
- this.level = _storage_types_f257c0f2_js__WEBPACK_IMPORTED_MODULE_2__["A"].Public;
189
- /** Fallback content */
190
-
191
- this.fallbackText = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_4__["T"].TEXT_FALLBACK_CONTENT;
192
- }
193
-
194
- class_1.prototype.watchHandler = function () {
195
- return __awaiter(this, void 0, void 0, function () {
196
- return __generator(this, function (_a) {
197
- switch (_a.label) {
198
- case 0:
199
- return [4
200
- /*yield*/
201
- , this.load()];
202
-
203
- case 1:
204
- _a.sent();
205
-
206
- return [2
207
- /*return*/
208
- ];
209
- }
210
- });
211
- });
212
- };
213
-
214
- class_1.prototype.componentWillLoad = function () {
215
- return __awaiter(this, void 0, void 0, function () {
216
- return __generator(this, function (_a) {
217
- switch (_a.label) {
218
- case 0:
219
- return [4
220
- /*yield*/
221
- , this.load()];
222
-
223
- case 1:
224
- _a.sent();
225
-
226
- return [2
227
- /*return*/
228
- ];
229
- }
230
- });
231
- });
232
- };
233
-
234
- class_1.prototype.load = function () {
235
- return __awaiter(this, void 0, void 0, function () {
236
- var _a, path, textKey, body, contentType, level, track, identityId, key, _b, err_1;
237
-
238
- return __generator(this, function (_c) {
239
- switch (_c.label) {
240
- case 0:
241
- _a = this, path = _a.path, textKey = _a.textKey, body = _a.body, contentType = _a.contentType, level = _a.level, track = _a.track, identityId = _a.identityId;
242
-
243
- if (!textKey && !path) {
244
- logger.debug('empty textKey and path');
245
- return [2
246
- /*return*/
247
- ];
248
- }
249
-
250
- key = textKey || path;
251
- logger.debug('loading ' + key + '...');
252
- if (!body) return [3
253
- /*break*/
254
- , 2];
255
- return [4
256
- /*yield*/
257
- , Object(_storage_helpers_1afafead_js__WEBPACK_IMPORTED_MODULE_7__["p"])(textKey, body, level, track, contentType, logger)];
258
-
259
- case 1:
260
- _c.sent();
261
-
262
- _c.label = 2;
263
-
264
- case 2:
265
- _c.trys.push([2, 4,, 5]);
266
-
267
- _b = this;
268
- return [4
269
- /*yield*/
270
- , Object(_storage_helpers_1afafead_js__WEBPACK_IMPORTED_MODULE_7__["a"])(key, level, track, identityId, logger)];
271
-
272
- case 3:
273
- _b.src = _c.sent();
274
- return [3
275
- /*break*/
276
- , 5];
277
-
278
- case 4:
279
- err_1 = _c.sent();
280
- logger.debug(err_1);
281
- throw new Error(err_1);
282
-
283
- case 5:
284
- return [2
285
- /*return*/
286
- ];
287
- }
288
- });
289
- });
290
- };
291
-
292
- class_1.prototype.render = function () {
293
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
294
- "class": "text-container"
295
- }, this.src ? Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("pre", null, this.src) : Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("pre", null, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.fallbackText))));
296
- };
297
-
298
- Object.defineProperty(class_1, "watchers", {
299
- get: function get() {
300
- return {
301
- "textKey": ["watchHandler"],
302
- "body": ["watchHandler"]
303
- };
304
- },
305
- enumerable: false,
306
- configurable: true
307
- });
308
- return class_1;
309
- }();
310
-
311
- AmplifyS3Text.style = amplifyS3TextCss;
312
-
313
-
314
- /***/ }),
315
-
316
- /***/ "../amplify-ui-components/dist/esm-es5/storage-helpers-1afafead.js":
317
- /*!*************************************************************************!*\
318
- !*** ../amplify-ui-components/dist/esm-es5/storage-helpers-1afafead.js ***!
319
- \*************************************************************************/
320
- /*! exports provided: a, c, g, i, p */
321
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
322
-
323
- "use strict";
324
- __webpack_require__.r(__webpack_exports__);
325
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getTextSource; });
326
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return calcKey; });
327
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getStorageObject; });
328
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return imageFileType; });
329
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return putStorageObject; });
330
- /* harmony import */ var _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants-c8ecaa24.js */ "../amplify-ui-components/dist/esm-es5/constants-c8ecaa24.js");
331
- /* harmony import */ var _aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @aws-amplify/storage */ "@aws-amplify/storage");
332
- /* harmony import */ var _aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1__);
333
- var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
334
- function adopt(value) {
335
- return value instanceof P ? value : new P(function (resolve) {
336
- resolve(value);
337
- });
338
- }
339
-
340
- return new (P || (P = Promise))(function (resolve, reject) {
341
- function fulfilled(value) {
342
- try {
343
- step(generator.next(value));
344
- } catch (e) {
345
- reject(e);
346
- }
347
- }
348
-
349
- function rejected(value) {
350
- try {
351
- step(generator["throw"](value));
352
- } catch (e) {
353
- reject(e);
354
- }
355
- }
356
-
357
- function step(result) {
358
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
359
- }
360
-
361
- step((generator = generator.apply(thisArg, _arguments || [])).next());
362
- });
363
- };
364
-
365
- var __generator = undefined && undefined.__generator || function (thisArg, body) {
366
- var _ = {
367
- label: 0,
368
- sent: function sent() {
369
- if (t[0] & 1) throw t[1];
370
- return t[1];
371
- },
372
- trys: [],
373
- ops: []
374
- },
375
- f,
376
- y,
377
- t,
378
- g;
379
- return g = {
380
- next: verb(0),
381
- "throw": verb(1),
382
- "return": verb(2)
383
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
384
- return this;
385
- }), g;
386
-
387
- function verb(n) {
388
- return function (v) {
389
- return step([n, v]);
390
- };
391
- }
392
-
393
- function step(op) {
394
- if (f) throw new TypeError("Generator is already executing.");
395
-
396
- while (_) {
397
- try {
398
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
399
- if (y = 0, t) op = [op[0] & 2, t.value];
400
-
401
- switch (op[0]) {
402
- case 0:
403
- case 1:
404
- t = op;
405
- break;
406
-
407
- case 4:
408
- _.label++;
409
- return {
410
- value: op[1],
411
- done: false
412
- };
413
-
414
- case 5:
415
- _.label++;
416
- y = op[1];
417
- op = [0];
418
- continue;
419
-
420
- case 7:
421
- op = _.ops.pop();
422
-
423
- _.trys.pop();
424
-
425
- continue;
426
-
427
- default:
428
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
429
- _ = 0;
430
- continue;
431
- }
432
-
433
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
434
- _.label = op[1];
435
- break;
436
- }
437
-
438
- if (op[0] === 6 && _.label < t[1]) {
439
- _.label = t[1];
440
- t = op;
441
- break;
442
- }
443
-
444
- if (t && _.label < t[2]) {
445
- _.label = t[2];
446
-
447
- _.ops.push(op);
448
-
449
- break;
450
- }
451
-
452
- if (t[2]) _.ops.pop();
453
-
454
- _.trys.pop();
455
-
456
- continue;
457
- }
458
-
459
- op = body.call(thisArg, _);
460
- } catch (e) {
461
- op = [6, e];
462
- y = 0;
463
- } finally {
464
- f = t = 0;
465
- }
466
- }
467
-
468
- if (op[0] & 5) throw op[1];
469
- return {
470
- value: op[0] ? op[1] : void 0,
471
- done: true
472
- };
473
- }
474
- };
475
-
476
-
477
-
478
- var imageFileType = new Set(['apng', 'bmp', 'gif', 'ico', 'cur', 'jpg', 'jpeg', 'jfif', 'pjpeg', 'pjp', 'png', 'svg', 'tif', 'tiff', 'webp']);
479
-
480
- var calcKey = function calcKey(file, fileToKey) {
481
- var name = file.name,
482
- size = file.size,
483
- type = file.type;
484
- var key = encodeURI(name);
485
-
486
- if (fileToKey) {
487
- if (typeof fileToKey === 'string') {
488
- key = fileToKey;
489
- } else if (typeof fileToKey === 'function') {
490
- key = fileToKey({
491
- name: name,
492
- size: size,
493
- type: type
494
- });
495
- } else {
496
- key = encodeURI(JSON.stringify(fileToKey));
497
- }
498
-
499
- if (!key) {
500
- key = 'empty_key';
501
- }
502
- }
503
-
504
- return key.replace(/\s/g, '_');
505
- };
506
-
507
- var getStorageObject = function getStorageObject(key, level, track, identityId, logger) {
508
- return __awaiter(void 0, void 0, void 0, function () {
509
- var src, error_1;
510
- return __generator(this, function (_a) {
511
- switch (_a.label) {
512
- case 0:
513
- if (!_aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1__["Storage"] || typeof _aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1__["Storage"].get !== 'function') {
514
- throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_0__["d"]);
515
- }
516
-
517
- _a.label = 1;
518
-
519
- case 1:
520
- _a.trys.push([1, 3,, 4]);
521
-
522
- return [4
523
- /*yield*/
524
- , _aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1__["Storage"].get(key, {
525
- level: level,
526
- track: track,
527
- identityId: identityId
528
- })];
529
-
530
- case 2:
531
- src = _a.sent();
532
- logger.debug('Storage image get', src);
533
- return [2
534
- /*return*/
535
- , src];
536
-
537
- case 3:
538
- error_1 = _a.sent();
539
- throw new Error(error_1);
540
-
541
- case 4:
542
- return [2
543
- /*return*/
544
- ];
545
- }
546
- });
547
- });
548
- };
549
-
550
- var readFileAsync = function readFileAsync(blob) {
551
- return new Promise(function (resolve, reject) {
552
- var reader = new FileReader();
553
-
554
- reader.onload = function () {
555
- resolve(reader.result);
556
- };
557
-
558
- reader.onerror = function () {
559
- reject('Failed to read file!');
560
- reader.abort();
561
- };
562
-
563
- reader.readAsText(blob);
564
- });
565
- };
566
-
567
- var getTextSource = function getTextSource(key, level, track, identityId, logger) {
568
- return __awaiter(void 0, void 0, void 0, function () {
569
- var textSrc, text, error_2;
570
- return __generator(this, function (_a) {
571
- switch (_a.label) {
572
- case 0:
573
- if (!_aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1__["Storage"] || typeof _aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1__["Storage"].get !== 'function') {
574
- throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_0__["d"]);
575
- }
576
-
577
- _a.label = 1;
578
-
579
- case 1:
580
- _a.trys.push([1, 4,, 5]);
581
-
582
- return [4
583
- /*yield*/
584
- , _aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1__["Storage"].get(key, {
585
- download: true,
586
- level: level,
587
- track: track,
588
- identityId: identityId
589
- })];
590
-
591
- case 2:
592
- textSrc = _a.sent();
593
- logger.debug(textSrc);
594
- return [4
595
- /*yield*/
596
- , readFileAsync(textSrc['Body'])];
597
-
598
- case 3:
599
- text = _a.sent();
600
- return [2
601
- /*return*/
602
- , text];
603
-
604
- case 4:
605
- error_2 = _a.sent();
606
- throw new Error(error_2);
607
-
608
- case 5:
609
- return [2
610
- /*return*/
611
- ];
612
- }
613
- });
614
- });
615
- };
616
-
617
- var putStorageObject = function putStorageObject(key, body, level, track, contentType, logger) {
618
- return __awaiter(void 0, void 0, void 0, function () {
619
- var data, error_3;
620
- return __generator(this, function (_a) {
621
- switch (_a.label) {
622
- case 0:
623
- if (!_aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1__["Storage"] || typeof _aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1__["Storage"].put !== 'function') {
624
- throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_0__["d"]);
625
- }
626
-
627
- _a.label = 1;
628
-
629
- case 1:
630
- _a.trys.push([1, 3,, 4]);
631
-
632
- return [4
633
- /*yield*/
634
- , _aws_amplify_storage__WEBPACK_IMPORTED_MODULE_1__["Storage"].put(key, body, {
635
- contentType: contentType,
636
- level: level,
637
- track: track
638
- })];
639
-
640
- case 2:
641
- data = _a.sent();
642
- logger.debug('Upload data', data);
643
- return [3
644
- /*break*/
645
- , 4];
646
-
647
- case 3:
648
- error_3 = _a.sent();
649
- throw new Error(error_3);
650
-
651
- case 4:
652
- return [2
653
- /*return*/
654
- ];
655
- }
656
- });
657
- });
658
- };
659
-
660
-
661
-
662
- /***/ })
663
-
664
- }]);
665
- //# sourceMappingURL=9.js.map