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