@aws-amplify/ui-react 1.2.26 → 1.2.54-legacy-ui.10

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 (77) hide show
  1. package/CHANGELOG.md +224 -0
  2. package/dist/0.js.map +1 -1
  3. package/dist/1.js +656 -2000
  4. package/dist/1.js.map +1 -1
  5. package/dist/10.js +23 -681
  6. package/dist/10.js.map +1 -1
  7. package/dist/11.js +1157 -20
  8. package/dist/11.js.map +1 -1
  9. package/dist/12.js +61 -1087
  10. package/dist/12.js.map +1 -1
  11. package/dist/13.js +1146 -64
  12. package/dist/13.js.map +1 -1
  13. package/dist/14.js +34 -1163
  14. package/dist/14.js.map +1 -1
  15. package/dist/15.js +17 -37
  16. package/dist/15.js.map +1 -1
  17. package/dist/16.js +109 -13
  18. package/dist/16.js.map +1 -1
  19. package/dist/17.js +32 -67
  20. package/dist/17.js.map +1 -1
  21. package/dist/18.js +236 -46
  22. package/dist/18.js.map +1 -1
  23. package/dist/19.js +35 -224
  24. package/dist/19.js.map +1 -1
  25. package/dist/2.js +2190 -159
  26. package/dist/2.js.map +1 -1
  27. package/dist/20.js +28 -48
  28. package/dist/20.js.map +1 -1
  29. package/dist/21.js +46 -25
  30. package/dist/21.js.map +1 -1
  31. package/dist/22.js +22 -25
  32. package/dist/22.js.map +1 -1
  33. package/dist/23.js +254 -25
  34. package/dist/23.js.map +1 -1
  35. package/dist/24.js +62 -230
  36. package/dist/24.js.map +1 -1
  37. package/dist/25.js +28 -62
  38. package/dist/25.js.map +1 -1
  39. package/dist/26.js +349 -30
  40. package/dist/26.js.map +1 -1
  41. package/dist/27.js +24 -352
  42. package/dist/27.js.map +1 -1
  43. package/dist/28.js +25 -22
  44. package/dist/28.js.map +1 -1
  45. package/dist/29.js +483 -26
  46. package/dist/29.js.map +1 -1
  47. package/dist/3.js +2710 -1818
  48. package/dist/3.js.map +1 -1
  49. package/dist/30.js +1 -502
  50. package/dist/30.js.map +1 -1
  51. package/dist/31.js +1 -1
  52. package/dist/31.js.map +1 -1
  53. package/dist/32.js +12 -1
  54. package/dist/32.js.map +1 -1
  55. package/dist/4.js +361 -3669
  56. package/dist/4.js.map +1 -1
  57. package/dist/5.js +48 -242
  58. package/dist/5.js.map +1 -1
  59. package/dist/6.js +118 -74
  60. package/dist/6.js.map +1 -1
  61. package/dist/7.js +55 -99
  62. package/dist/7.js.map +1 -1
  63. package/dist/8.js +98 -46
  64. package/dist/8.js.map +1 -1
  65. package/dist/9.js +474 -412
  66. package/dist/9.js.map +1 -1
  67. package/dist/@aws-amplify/ui-react.js +50 -44
  68. package/dist/@aws-amplify/ui-react.js.map +1 -1
  69. package/dist/aws-amplify-react.min.js +2 -2
  70. package/dist/aws-amplify-react.min.js.map +1 -1
  71. package/dist/polyfills-core-js.js +5 -11
  72. package/dist/polyfills-core-js.js.map +1 -1
  73. package/dist/polyfills-css-shim.js.map +1 -1
  74. package/dist/polyfills-dom.js.map +1 -1
  75. package/package.json +3 -3
  76. package/dist/33.js +0 -13
  77. package/dist/33.js.map +0 -1
package/dist/14.js CHANGED
@@ -1,1191 +1,62 @@
1
1
  (this["webpackJsonpaws_amplify_react"] = this["webpackJsonpaws_amplify_react"] || []).push([[14],{
2
2
 
3
- /***/ "../amplify-ui-components/dist/esm-es5/amplify-chatbot.entry.js":
4
- /*!**********************************************************************!*\
5
- !*** ../amplify-ui-components/dist/esm-es5/amplify-chatbot.entry.js ***!
6
- \**********************************************************************/
7
- /*! exports provided: amplify_chatbot */
3
+ /***/ "../amplify-ui-components/dist/esm-es5/amplify-checkbox.entry.js":
4
+ /*!***********************************************************************!*\
5
+ !*** ../amplify-ui-components/dist/esm-es5/amplify-checkbox.entry.js ***!
6
+ \***********************************************************************/
7
+ /*! exports provided: amplify_checkbox */
8
8
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
9
9
 
10
10
  "use strict";
11
11
  __webpack_require__.r(__webpack_exports__);
12
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_chatbot", function() { return AmplifyChatbot; });
12
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "amplify_checkbox", function() { return AmplifyCheckbox; });
13
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 _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aws-amplify/auth */ "@aws-amplify/auth");
17
- /* harmony import */ var _aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_auth__WEBPACK_IMPORTED_MODULE_2__);
18
- /* harmony import */ var _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Translations-108d469f.js */ "../amplify-ui-components/dist/esm-es5/Translations-108d469f.js");
19
- /* harmony import */ var _constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./constants-c8ecaa24.js */ "../amplify-ui-components/dist/esm-es5/constants-c8ecaa24.js");
20
- /* harmony import */ var _aws_amplify_interactions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @aws-amplify/interactions */ "@aws-amplify/interactions");
21
- /* harmony import */ var _aws_amplify_interactions__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_aws_amplify_interactions__WEBPACK_IMPORTED_MODULE_5__);
22
- var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
23
- function adopt(value) {
24
- return value instanceof P ? value : new P(function (resolve) {
25
- resolve(value);
26
- });
27
- }
28
-
29
- return new (P || (P = Promise))(function (resolve, reject) {
30
- function fulfilled(value) {
31
- try {
32
- step(generator.next(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- }
37
-
38
- function rejected(value) {
39
- try {
40
- step(generator["throw"](value));
41
- } catch (e) {
42
- reject(e);
43
- }
44
- }
45
-
46
- function step(result) {
47
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
48
- }
49
-
50
- step((generator = generator.apply(thisArg, _arguments || [])).next());
51
- });
52
- };
53
-
54
- var __generator = undefined && undefined.__generator || function (thisArg, body) {
55
- var _ = {
56
- label: 0,
57
- sent: function sent() {
58
- if (t[0] & 1) throw t[1];
59
- return t[1];
60
- },
61
- trys: [],
62
- ops: []
63
- },
64
- f,
65
- y,
66
- t,
67
- g;
68
- return g = {
69
- next: verb(0),
70
- "throw": verb(1),
71
- "return": verb(2)
72
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
73
- return this;
74
- }), g;
75
-
76
- function verb(n) {
77
- return function (v) {
78
- return step([n, v]);
79
- };
80
- }
81
-
82
- function step(op) {
83
- if (f) throw new TypeError("Generator is already executing.");
84
-
85
- while (_) {
86
- try {
87
- 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;
88
- if (y = 0, t) op = [op[0] & 2, t.value];
89
-
90
- switch (op[0]) {
91
- case 0:
92
- case 1:
93
- t = op;
94
- break;
95
-
96
- case 4:
97
- _.label++;
98
- return {
99
- value: op[1],
100
- done: false
101
- };
102
-
103
- case 5:
104
- _.label++;
105
- y = op[1];
106
- op = [0];
107
- continue;
108
-
109
- case 7:
110
- op = _.ops.pop();
111
-
112
- _.trys.pop();
113
-
114
- continue;
115
-
116
- default:
117
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
118
- _ = 0;
119
- continue;
120
- }
121
-
122
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
123
- _.label = op[1];
124
- break;
125
- }
126
-
127
- if (op[0] === 6 && _.label < t[1]) {
128
- _.label = t[1];
129
- t = op;
130
- break;
131
- }
132
-
133
- if (t && _.label < t[2]) {
134
- _.label = t[2];
135
-
136
- _.ops.push(op);
137
-
138
- break;
139
- }
140
-
141
- if (t[2]) _.ops.pop();
142
-
143
- _.trys.pop();
144
-
145
- continue;
146
- }
147
-
148
- op = body.call(thisArg, _);
149
- } catch (e) {
150
- op = [6, e];
151
- y = 0;
152
- } finally {
153
- f = t = 0;
154
- }
155
- }
156
-
157
- if (op[0] & 5) throw op[1];
158
- return {
159
- value: op[0] ? op[1] : void 0,
160
- done: true
161
- };
162
- }
163
- };
164
-
165
- var __spreadArrays = undefined && undefined.__spreadArrays || function () {
166
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
167
- s += arguments[i].length;
168
- }
169
-
170
- for (var r = Array(s), k = 0, i = 0; i < il; i++) {
171
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
172
- r[k] = a[j];
173
- }
174
- }
175
-
176
- return r;
177
- };
178
-
179
-
180
-
181
-
182
-
183
-
184
- // AudioRecorder settings
185
-
186
- var RECORDER_EXPORT_MIME_TYPE = 'application/octet-stream';
187
- var DEFAULT_EXPORT_SAMPLE_RATE = 16000;
188
- var FFT_SIZE = 2048; // window size in samples for Fast Fourier Transform (FFT)
189
-
190
- var FFT_MAX_DECIBELS = -10; // maximum power value in the scaling range for the FFT analysis data
191
-
192
- var FFT_MIN_DECIBELS = -90; // minimum power value in the scaling range for the FFT analysis data
193
-
194
- var FFT_SMOOTHING_TIME_CONSTANT = 0.85; // averaging constant with the last analysis frame
195
-
196
- /**
197
- * Merges multiple buffers into one.
198
- */
199
-
200
- var mergeBuffers = function mergeBuffers(bufferArray, recLength) {
201
- var result = new Float32Array(recLength);
202
- var offset = 0;
203
-
204
- for (var i = 0; i < bufferArray.length; i++) {
205
- result.set(bufferArray[i], offset);
206
- offset += bufferArray[i].length;
207
- }
208
-
209
- return result;
210
- };
211
- /**
212
- * Downsamples audio to desired export sample rate.
213
- */
214
-
215
-
216
- var downsampleBuffer = function downsampleBuffer(buffer, recordSampleRate, exportSampleRate) {
217
- if (exportSampleRate === recordSampleRate) {
218
- return buffer;
219
- }
220
-
221
- var sampleRateRatio = recordSampleRate / exportSampleRate;
222
- var newLength = Math.round(buffer.length / sampleRateRatio);
223
- var result = new Float32Array(newLength);
224
- var offsetResult = 0;
225
- var offsetBuffer = 0;
226
-
227
- while (offsetResult < result.length) {
228
- var nextOffsetBuffer = Math.round((offsetResult + 1) * sampleRateRatio);
229
- var accum = 0,
230
- count = 0;
231
-
232
- for (var i = offsetBuffer; i < nextOffsetBuffer && i < buffer.length; i++) {
233
- accum += buffer[i];
234
- count++;
235
- }
236
-
237
- result[offsetResult] = accum / count;
238
- offsetResult++;
239
- offsetBuffer = nextOffsetBuffer;
240
- }
241
-
242
- return result;
243
- };
244
- /**
245
- * converts raw audio values to 16 bit pcm.
246
- */
247
-
248
-
249
- var floatTo16BitPCM = function floatTo16BitPCM(output, offset, input) {
250
- var byteOffset = offset;
251
-
252
- for (var i = 0; i < input.length; i++, byteOffset += 2) {
253
- var s = Math.max(-1, Math.min(1, input[i]));
254
- output.setInt16(byteOffset, s < 0 ? s * 0x8000 : s * 0x7fff, true);
255
- }
256
- };
257
- /**
258
- * Write given strings in big-endian order.
259
- */
260
-
261
-
262
- var writeString = function writeString(view, offset, string) {
263
- for (var i = 0; i < string.length; i++) {
264
- view.setUint8(offset + i, string.charCodeAt(i));
265
- }
266
- };
267
- /**
268
- * Encodes raw pcm audio into a wav file.
269
- */
270
-
271
-
272
- var encodeWAV = function encodeWAV(samples, exportSampleRate) {
273
- /**
274
- * WAV file consists of three parts: RIFF header, WAVE subchunk, and data subchunk. We precompute the size of them.
275
- */
276
- var audioSize = samples.length * 2; // We use 16-bit samples, so we have (2 * sampleLength) bytes.
277
-
278
- var fmtSize = 24; // Byte size of the fmt subchunk: 24 bytes that the audio information that we'll set below.
279
-
280
- var dataSize = 8 + audioSize; // Byte size of the data subchunk: raw sound data plus 8 bytes for the subchunk descriptions.
281
-
282
- var totalByteSize = 12 + fmtSize + dataSize; // Byte size of the whole file, including the chunk header / descriptor.
283
- // create DataView object to write byte values into
284
-
285
- var buffer = new ArrayBuffer(totalByteSize); // buffer to write the chunk values in.
286
-
287
- var view = new DataView(buffer);
288
- /**
289
- * Start writing the .wav file. We write top to bottom, so byte offset (first numeric argument) increases strictly.
290
- */
291
- // RIFF header
292
-
293
- writeString(view, 0, 'RIFF'); // At offset 0, write the letters "RIFF"
294
-
295
- view.setUint32(4, fmtSize + dataSize, true); // At offset 4, write the size of fmt and data chunk size combined.
296
-
297
- writeString(view, 8, 'WAVE'); // At offset 8, write the format type "WAVE"
298
- // fmt subchunk
299
-
300
- writeString(view, 12, 'fmt '); //chunkdId 'fmt '
301
-
302
- view.setUint32(16, fmtSize - 8, true); // fmt subchunk size below this value. We set 8 bytes already, so subtract 8 bytes from fmtSize.
303
-
304
- view.setUint16(20, 1, true); // Audio format code, which is 1 for PCM.
305
-
306
- view.setUint16(22, 1, true); // Number of audio channels. We use mono, ie 1.
307
-
308
- view.setUint32(24, exportSampleRate, true); // Sample rate of the audio file.
309
-
310
- view.setUint32(28, exportSampleRate * 2, true); // Data rate, or # of data bytes per second. Since each sample is 2 bytes, this is 2 * sampleRate.
311
-
312
- view.setUint16(32, 2, true); // block align, # of bytes per sample including all channels, ie. 2 bytes.
313
-
314
- view.setUint16(34, 16, true); // bits per sample, ie. 16 bits
315
- // data subchunk
316
-
317
- writeString(view, 36, 'data'); // write the chunkId 'data'
318
-
319
- view.setUint32(40, audioSize, true); // Audio byte size
320
-
321
- floatTo16BitPCM(view, 44, samples); // raw pcm values then go here.
322
-
323
- return view;
324
- };
325
- /**
326
- * Given arrays of raw pcm audio, downsamples the audio to desired sample rate and encodes it to a wav audio file.
327
- *
328
- * @param recBuffer {Float32Array[]} - 2d float array containing the recorded raw audio
329
- * @param recLength {number} - total length of recorded audio
330
- * @param recordSampleRate {number} - sample rate of the recorded audio
331
- * @param exportSampleRate {number} - desired sample rate of the exported file
332
- */
333
-
334
-
335
- var exportBuffer = function exportBuffer(recBuffer, recLength, recordSampleRate, exportSampleRate) {
336
- var mergedBuffers = mergeBuffers(recBuffer, recLength);
337
- var downsampledBuffer = downsampleBuffer(mergedBuffers, recordSampleRate, exportSampleRate);
338
- var encodedWav = encodeWAV(downsampledBuffer, exportSampleRate);
339
- var audioBlob = new Blob([encodedWav], {
340
- type: RECORDER_EXPORT_MIME_TYPE
341
- });
342
- return audioBlob;
343
- };
344
-
345
- var logger = new _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["Logger"]('AudioRecorder');
346
-
347
- var AudioRecorder =
348
- /** @class */
349
- function () {
350
- function AudioRecorder(options) {
351
- // input mic stream is stored in a buffer
352
- this.streamBuffer = [];
353
- this.streamBufferLength = 0;
354
- this.recording = false;
355
- this.options = options;
356
- }
357
- /**
358
- * This must be called first to enable audio context and request microphone access.
359
- * Once access granted, it connects all the necessary audio nodes to the context so that it can begin recording or playing.
360
- */
361
-
362
-
363
- AudioRecorder.prototype.init = function () {
364
- return __awaiter(this, void 0, void 0, function () {
365
- var _this = this;
366
-
367
- return __generator(this, function (_a) {
368
- switch (_a.label) {
369
- case 0:
370
- if (!Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["browserOrNode"])().isBrowser) return [3
371
- /*break*/
372
- , 2];
373
- window.AudioContext = window.AudioContext || window.webkitAudioContext;
374
- this.audioContext = new AudioContext();
375
- return [4
376
- /*yield*/
377
- , navigator.mediaDevices.getUserMedia({
378
- audio: true
379
- }).then(function (stream) {
380
- _this.audioSupported = true;
381
-
382
- _this.setupAudioNodes(stream);
383
- })["catch"](function () {
384
- _this.audioSupported = false;
385
- return Promise.reject('Audio is not supported');
386
- })];
387
-
388
- case 1:
389
- _a.sent();
390
-
391
- return [3
392
- /*break*/
393
- , 3];
394
-
395
- case 2:
396
- this.audioSupported = false;
397
- return [2
398
- /*return*/
399
- , Promise.reject('Audio is not supported')];
400
-
401
- case 3:
402
- return [2
403
- /*return*/
404
- ];
405
- }
406
- });
407
- });
408
- };
409
- /**
410
- * Setup audio nodes after successful `init`.
411
- */
412
-
413
-
414
- AudioRecorder.prototype.setupAudioNodes = function (stream) {
415
- return __awaiter(this, void 0, void 0, function () {
416
- var err_1, sourceNode, processorNode, analyserNode;
417
-
418
- var _this = this;
419
-
420
- return __generator(this, function (_a) {
421
- switch (_a.label) {
422
- case 0:
423
- _a.trys.push([0, 2,, 3]);
424
-
425
- return [4
426
- /*yield*/
427
- , this.audioContext.resume()];
428
-
429
- case 1:
430
- _a.sent();
431
-
432
- return [3
433
- /*break*/
434
- , 3];
435
-
436
- case 2:
437
- err_1 = _a.sent();
438
- logger.error(err_1);
439
- return [3
440
- /*break*/
441
- , 3];
442
-
443
- case 3:
444
- sourceNode = this.audioContext.createMediaStreamSource(stream);
445
- processorNode = this.audioContext.createScriptProcessor(4096, 1, 1);
446
-
447
- processorNode.onaudioprocess = function (audioProcessingEvent) {
448
- if (!_this.recording) return;
449
- var stream = audioProcessingEvent.inputBuffer.getChannelData(0);
450
-
451
- _this.streamBuffer.push(new Float32Array(stream)); // set to a copy of the stream
452
-
453
-
454
- _this.streamBufferLength += stream.length;
455
-
456
- _this.analyse();
457
- };
458
-
459
- analyserNode = this.audioContext.createAnalyser();
460
- analyserNode.minDecibels = FFT_MIN_DECIBELS;
461
- analyserNode.maxDecibels = FFT_MAX_DECIBELS;
462
- analyserNode.smoothingTimeConstant = FFT_SMOOTHING_TIME_CONSTANT;
463
- sourceNode.connect(analyserNode);
464
- analyserNode.connect(processorNode);
465
- processorNode.connect(sourceNode.context.destination);
466
- this.analyserNode = analyserNode;
467
- return [2
468
- /*return*/
469
- ];
470
- }
471
- });
472
- });
473
- };
474
- /**
475
- * Start recording audio and listen for silence.
476
- *
477
- * @param onSilence {SilenceHandler} - called whenever silence is detected
478
- * @param visualizer {Visualizer} - called with audio data on each audio process to be used for visualization.
479
- */
480
-
481
-
482
- AudioRecorder.prototype.startRecording = function (onSilence, visualizer) {
483
- return __awaiter(this, void 0, void 0, function () {
484
- var context, err_2;
485
- return __generator(this, function (_a) {
486
- switch (_a.label) {
487
- case 0:
488
- if (this.recording || !this.audioSupported) return [2
489
- /*return*/
490
- ];
491
-
492
- this.onSilence = onSilence || function () {};
493
-
494
- this.visualizer = visualizer || function () {};
495
-
496
- context = this.audioContext;
497
- _a.label = 1;
498
-
499
- case 1:
500
- _a.trys.push([1, 3,, 4]);
501
-
502
- return [4
503
- /*yield*/
504
- , context.resume()];
505
-
506
- case 2:
507
- _a.sent();
508
-
509
- return [3
510
- /*break*/
511
- , 4];
512
-
513
- case 3:
514
- err_2 = _a.sent();
515
- logger.error(err_2);
516
- return [3
517
- /*break*/
518
- , 4];
519
-
520
- case 4:
521
- this.start = Date.now();
522
- this.recording = true;
523
- return [2
524
- /*return*/
525
- ];
526
- }
527
- });
528
- });
529
- };
530
- /**
531
- * Pause recording
532
- */
533
-
534
-
535
- AudioRecorder.prototype.stopRecording = function () {
536
- if (!this.audioSupported) return;
537
- this.recording = false;
538
- };
539
- /**
540
- * Pause recording and clear audio buffer
541
- */
542
-
543
-
544
- AudioRecorder.prototype.clear = function () {
545
- this.stopRecording();
546
- this.streamBufferLength = 0;
547
- this.streamBuffer = [];
548
- };
549
- /**
550
- * Plays given audioStream with audioContext
551
- *
552
- * @param buffer {Uint8Array} - audioStream to be played
553
- */
554
-
555
-
556
- AudioRecorder.prototype.play = function (buffer) {
557
- var _this = this;
558
14
 
559
- if (!buffer || !this.audioSupported) return;
560
- var myBlob = new Blob([buffer]);
561
- return new Promise(function (res, rej) {
562
- var fileReader = new FileReader();
15
+ var amplifyCheckboxCss = ":host{--font-family:var(--amplify-font-family)}.checkbox{margin-bottom:22px;display:block;width:100%;padding:16px;font-size:var(--amplify-text-sm);font-family:var(--font-family)}.checkbox input{margin-right:12px}";
563
16
 
564
- fileReader.onload = function () {
565
- if (_this.playbackSource) _this.playbackSource.disconnect(); // disconnect previous playback source
566
-
567
- _this.playbackSource = _this.audioContext.createBufferSource();
568
-
569
- var successCallback = function successCallback(buf) {
570
- _this.playbackSource.buffer = buf;
571
-
572
- _this.playbackSource.connect(_this.audioContext.destination);
573
-
574
- _this.playbackSource.onended = function () {
575
- return res();
576
- };
577
-
578
- _this.playbackSource.start(0);
579
- };
580
-
581
- var errorCallback = function errorCallback(err) {
582
- return rej(err);
583
- };
584
-
585
- _this.audioContext.decodeAudioData(fileReader.result, successCallback, errorCallback);
586
- };
587
-
588
- fileReader.onerror = function () {
589
- return rej();
590
- };
591
-
592
- fileReader.readAsArrayBuffer(myBlob);
593
- });
594
- };
595
- /**
596
- * Stops playing audio if there's a playback source connected.
597
- */
598
-
599
-
600
- AudioRecorder.prototype.stop = function () {
601
- if (this.playbackSource) {
602
- this.playbackSource.stop();
603
- }
604
- };
605
- /**
606
- * Called after each audioProcess. Check for silence and give fft time domain data to visualizer.
607
- */
608
-
609
-
610
- AudioRecorder.prototype.analyse = function () {
611
- if (!this.audioSupported) return;
612
- var analyser = this.analyserNode;
613
- analyser.fftSize = FFT_SIZE;
614
- var bufferLength = analyser.fftSize;
615
- var dataArray = new Uint8Array(bufferLength);
616
- var amplitude = this.options.amplitude;
617
- var time = this.options.time;
618
- analyser.getByteTimeDomainData(dataArray);
619
- this.visualizer(dataArray, bufferLength);
620
-
621
- for (var i = 0; i < bufferLength; i++) {
622
- // Normalize between -1 and 1.
623
- var curr_value_time = dataArray[i] / 128 - 1.0;
624
-
625
- if (curr_value_time > amplitude || curr_value_time < -1 * amplitude) {
626
- this.start = Date.now();
627
- }
628
- }
629
-
630
- var newtime = Date.now();
631
- var elapsedTime = newtime - this.start;
632
-
633
- if (elapsedTime > time) {
634
- this.onSilence();
635
- }
636
- };
637
- /**
638
- * Encodes recorded buffer to a wav file and exports it to a blob.
639
- *
640
- * @param exportSampleRate {number} - desired sample rate of the exported buffer
641
- */
642
-
643
-
644
- AudioRecorder.prototype.exportWAV = function (exportSampleRate) {
645
- if (exportSampleRate === void 0) {
646
- exportSampleRate = DEFAULT_EXPORT_SAMPLE_RATE;
647
- }
648
-
649
- return __awaiter(this, void 0, void 0, function () {
650
- var recordSampleRate, blob;
651
- return __generator(this, function (_a) {
652
- if (!this.audioSupported) return [2
653
- /*return*/
654
- ];
655
- recordSampleRate = this.audioContext.sampleRate;
656
- blob = exportBuffer(this.streamBuffer, this.streamBufferLength, recordSampleRate, exportSampleRate);
657
- this.clear();
658
- return [2
659
- /*return*/
660
- , blob];
661
- });
662
- });
663
- };
664
-
665
- return AudioRecorder;
666
- }();
667
-
668
- var visualize = function visualize(dataArray, bufferLength, canvas) {
669
- if (!canvas) return;
670
- if (!Object(_aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["browserOrNode"])().isBrowser) throw new Error('Visualization is not supported on non-browsers.');
671
-
672
- var _a = canvas.getBoundingClientRect(),
673
- width = _a.width,
674
- height = _a.height; // need to update the default canvas width and height
675
-
676
-
677
- canvas.width = width;
678
- canvas.height = height;
679
- var canvasCtx = canvas.getContext('2d');
680
- canvasCtx.fillStyle = 'white';
681
- canvasCtx.clearRect(0, 0, width, height);
682
-
683
- var draw = function draw() {
684
- canvasCtx.fillRect(0, 0, width, height);
685
- canvasCtx.lineWidth = 1;
686
- var color = getComputedStyle(document.documentElement).getPropertyValue('--amplify-primary-color');
687
- canvasCtx.strokeStyle = !color || color === '' ? '#ff9900' : color; // TODO: try separate css variable
688
-
689
- canvasCtx.beginPath();
690
- var sliceWidth = width * 1.0 / bufferLength;
691
- var x = 0;
692
-
693
- for (var i = 0; i < bufferLength || i % 3 === 0; i++) {
694
- var value = dataArray[i] / 128.0;
695
- var y = value * height / 2;
696
-
697
- if (i === 0) {
698
- canvasCtx.moveTo(x, y);
699
- } else {
700
- canvasCtx.lineTo(x, y);
701
- }
702
-
703
- x += sliceWidth;
704
- }
705
-
706
- canvasCtx.lineTo(canvas.width, canvas.height / 2);
707
- canvasCtx.stroke();
708
- }; // Register our draw function with requestAnimationFrame.
709
-
710
-
711
- requestAnimationFrame(draw);
712
- };
713
-
714
- var amplifyChatbotCss = ".bot .dot{background-color:var(--bot-dot-color)}.user .dot{background-color:var(--user-dot-color)}.dot-flashing{width:2.625rem}.dot-flashing .dot{display:inline-block;width:0.625rem;height:0.625rem;border-radius:10rem;opacity:0.65}.dot-flashing .left{-webkit-animation:dot-flashing 1s infinite alternate;animation:dot-flashing 1s infinite alternate;-webkit-animation-delay:0s;animation-delay:0s}.dot-flashing .middle{margin-left:0.375rem;margin-right:0.375rem;-webkit-animation:dot-flashing 1s infinite linear alternate;animation:dot-flashing 1s infinite linear alternate;-webkit-animation-delay:0.5s;animation-delay:0.5s}.dot-flashing .right{-webkit-animation:dot-flashing 1s infinite alternate;animation:dot-flashing 1s infinite alternate;-webkit-animation-delay:1s;animation-delay:1s}@-webkit-keyframes dot-flashing{0%{opacity:0.65}50%,100%{opacity:0.1}}@keyframes dot-flashing{0%{opacity:0.65}50%,100%{opacity:0.1}}:host{--width:28.75rem;--height:37.5rem;--header-color:var(--amplify-secondary-color);--header-size:var(--amplify-text-lg);--bot-background-color:rgb(230, 230, 230);--bot-text-color:black;--bot-dot-color:var(--bot-text-color);--user-background-color:var(--amplify-blue);--user-text-color:var(--amplify-white);--user-dot-color:var(--user-text-color)}.amplify-chatbot{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;background-color:var(--background-color);border-radius:0.375rem;-webkit-box-shadow:0.0625rem 0rem 0.25rem 0 rgba(0, 0, 0, 0.15);box-shadow:0.0625rem 0rem 0.25rem 0 rgba(0, 0, 0, 0.15);-webkit-box-sizing:border-box;box-sizing:border-box;font-family:var(--amplify-font-family);margin-bottom:1rem;width:100%;height:var(--height);max-width:var(--width)}@media (min-width: 672px){.amplify-chatbot{width:var(--width)}}.header{padding:1.25rem 0.375rem 1.25rem 0.375rem;color:var(--header-color);font-size:var(--header-size);font-weight:bold;text-align:center;word-wrap:break-word}.body{border-top:0.0625rem solid rgba(0, 0, 0, 0.05);padding:1.5rem 1rem 0 1rem;display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-direction:column;flex-direction:column;overflow:auto}.bubble{max-width:100%;padding:0.8em 1.4em;text-align:left;word-wrap:break-word;margin-bottom:0.625rem}.bot{margin-right:auto;background-color:var(--bot-background-color);color:var(--bot-text-color);border-radius:1.5rem 1.5rem 1.5rem 0}.user{margin-left:auto;background-color:var(--user-background-color);color:var(--user-text-color);border-radius:1.5rem 1.5rem 0 1.5rem}.footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;border-top:0.062rem solid rgba(0, 0, 0, 0.05);padding-right:0.625rem;min-height:3.125rem}.footer amplify-input{--border:none;--margin:0;-ms-flex-positive:1;flex-grow:1}canvas{margin-left:0.625rem;margin-right:0.625rem;-ms-flex-positive:1;flex-grow:1;height:3.125rem}.icon-button{--icon-height:1.25rem;--icon-fill:var(--amplify-primary-color);--padding:0.625rem;--width:auto}"; // enum for possible bot states
715
-
716
- var ChatState;
717
-
718
- (function (ChatState) {
719
- ChatState[ChatState["Initial"] = 0] = "Initial";
720
- ChatState[ChatState["Listening"] = 1] = "Listening";
721
- ChatState[ChatState["SendingText"] = 2] = "SendingText";
722
- ChatState[ChatState["SendingVoice"] = 3] = "SendingVoice";
723
- ChatState[ChatState["Error"] = 4] = "Error";
724
- })(ChatState || (ChatState = {})); // Message types
725
-
726
-
727
- var MessageFrom;
728
-
729
- (function (MessageFrom) {
730
- MessageFrom["Bot"] = "bot";
731
- MessageFrom["User"] = "user";
732
- })(MessageFrom || (MessageFrom = {})); // Error types
733
-
734
-
735
- var ChatErrorType;
736
-
737
- (function (ChatErrorType) {
738
- ChatErrorType[ChatErrorType["Recoverable"] = 0] = "Recoverable";
739
- ChatErrorType[ChatErrorType["Unrecoverable"] = 1] = "Unrecoverable";
740
- })(ChatErrorType || (ChatErrorType = {}));
741
-
742
- var AmplifyChatbot =
17
+ var AmplifyCheckbox =
743
18
  /** @class */
744
19
  function () {
745
- function class_1(hostRef) {
20
+ function AmplifyCheckbox(hostRef) {
746
21
  var _this = this;
747
22
 
748
23
  Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["r"])(this, hostRef);
749
- /** Clear messages when conversation finishes */
750
-
751
- this.clearOnComplete = false;
752
- /** Continue listening to users after they send the message */
753
-
754
- this.conversationModeOn = false;
755
- /** Text placed in the top header */
756
-
757
- this.botTitle = _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].CHATBOT_TITLE;
758
- /** Whether voice chat is enabled */
759
-
760
- this.voiceEnabled = false;
761
- /** Whether text chat is enabled */
762
-
763
- this.textEnabled = true;
764
- /** Amount of silence (in ms) to wait for */
765
-
766
- this.silenceTime = 1500;
767
- /** Noise threshold between -1 and 1. Anything below is considered a silence. */
24
+ /** If `true`, the checkbox is selected. */
768
25
 
769
- this.silenceThreshold = 0.2;
770
- /** Messages in current session */
26
+ this.checked = false;
27
+ /** If `true`, the checkbox is disabled */
771
28
 
772
- this.messages = [];
773
- /** Text input box value */
29
+ this.disabled = false;
774
30
 
775
- this.text = '';
776
- /** Current app state */
777
-
778
- this.chatState = ChatState.Initial;
779
- /**
780
- * Rendering methods
781
- */
782
-
783
- this.messageJSX = function (messages) {
784
- var messageList = messages.map(function (message) {
785
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
786
- "class": "bubble " + message.from
787
- }, message.content);
788
- });
789
-
790
- if (_this.chatState === ChatState.SendingText || _this.chatState === ChatState.SendingVoice) {
791
- // if waiting for voice message, show animation on user side because app is waiting for transcript. Else put it on bot side.
792
- var client = _this.chatState === ChatState.SendingText ? MessageFrom.Bot : MessageFrom.User;
793
- messageList.push(Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
794
- "class": "bubble " + client
795
- }, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
796
- "class": "dot-flashing " + client
797
- }, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", {
798
- "class": "dot left"
799
- }), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", {
800
- "class": "dot middle"
801
- }), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", {
802
- "class": "dot right"
803
- }))));
804
- }
805
-
806
- return messageList;
31
+ this.onClick = function () {
32
+ _this.checked = !_this.checked;
807
33
  };
34
+ }
808
35
 
809
- this.chatCompleted = Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["c"])(this, "chatCompleted", 7);
810
- } // Occurs when user presses enter in input box
811
-
812
-
813
- class_1.prototype.submitHandler = function (_event) {
814
- this.sendTextMessage();
815
- };
816
- /**
817
- * Lifecycle functions
818
- */
819
-
820
-
821
- class_1.prototype.componentWillLoad = function () {
822
- if (!_aws_amplify_interactions__WEBPACK_IMPORTED_MODULE_5__["Interactions"] || typeof _aws_amplify_interactions__WEBPACK_IMPORTED_MODULE_5__["Interactions"].onComplete !== 'function') {
823
- throw new Error(_constants_c8ecaa24_js__WEBPACK_IMPORTED_MODULE_4__["c"]);
824
- }
825
-
826
- this.validateProps();
827
- };
828
-
829
- class_1.prototype.componentDidRender = function () {
830
- // scroll to the bottom if necessary
831
- var body = this.element.shadowRoot.querySelector('.body');
832
- body.scrollTop = body.scrollHeight;
833
- };
834
-
835
- class_1.prototype.validateProps = function () {
836
- var _this = this;
837
-
838
- if (!this.voiceEnabled && !this.textEnabled) {
839
- this.setError(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].CHAT_DISABLED_ERROR, ChatErrorType.Unrecoverable);
840
- return;
841
- } else if (!this.botName) {
842
- this.setError(_Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].NO_BOT_NAME_ERROR, ChatErrorType.Unrecoverable);
843
- return;
844
- }
845
-
846
- if (this.welcomeMessage) this.appendToChat(this.welcomeMessage, MessageFrom.Bot); // Initialize AudioRecorder if voice is enabled
847
-
848
- if (this.voiceEnabled) {
849
- this.audioRecorder = new AudioRecorder({
850
- time: this.silenceTime,
851
- amplitude: this.silenceThreshold
852
- });
853
- this.audioRecorder.init()["catch"](function (err) {
854
- _this.setError(err, ChatErrorType.Recoverable);
855
- });
856
- } // Callback function to be called after chat is completed
857
-
858
-
859
- var onComplete = function onComplete(err, data) {
860
- _this.chatCompleted.emit({
861
- data: data,
862
- err: err
863
- });
864
-
865
- if (_this.clearOnComplete) {
866
- _this.reset();
867
- } else {
868
- _this.chatState = ChatState.Initial;
869
- }
870
- };
871
-
872
- try {
873
- _aws_amplify_interactions__WEBPACK_IMPORTED_MODULE_5__["Interactions"].onComplete(this.botName, onComplete);
874
- } catch (err) {
875
- this.setError(err, ChatErrorType.Unrecoverable);
876
- }
877
- };
878
- /**
879
- * Handlers
880
- */
881
-
882
-
883
- class_1.prototype.handleSubmit = function (event) {
884
- event.preventDefault();
885
- this.sendTextMessage();
886
- };
887
-
888
- class_1.prototype.handleMicButton = function () {
889
- var _this = this;
890
-
891
- if (this.chatState !== ChatState.Initial) return;
892
- this.audioRecorder.stop();
893
- this.chatState = ChatState.Listening;
894
- this.audioRecorder.startRecording(function () {
895
- return _this.handleSilence();
896
- }, function (data, length) {
897
- return _this.visualizer(data, length);
898
- });
899
- };
900
-
901
- class_1.prototype.handleSilence = function () {
902
- var _this = this;
903
-
904
- this.chatState = ChatState.SendingVoice;
905
- this.audioRecorder.stopRecording();
906
- this.audioRecorder.exportWAV().then(function (blob) {
907
- _this.sendVoiceMessage(blob);
908
- });
909
- };
910
-
911
- class_1.prototype.handleTextChange = function (event) {
912
- var target = event.target;
913
- this.text = target.value;
914
- };
915
-
916
- class_1.prototype.handleCancelButton = function () {
917
- this.audioRecorder.clear();
918
- this.chatState = ChatState.Initial;
919
- };
920
-
921
- class_1.prototype.handleToastClose = function (errorType) {
922
- this.error = undefined; // clear error
923
- // if error is recoverable, reset the app state to initial
924
-
925
- if (errorType === ChatErrorType.Recoverable) {
926
- this.chatState = ChatState.Initial;
927
- }
928
- };
929
- /**
930
- * Visualization
931
- */
932
-
933
-
934
- class_1.prototype.visualizer = function (dataArray, bufferLength) {
935
- var canvas = this.element.shadowRoot.querySelector('canvas');
936
- visualize(dataArray, bufferLength, canvas);
937
- };
938
- /**
939
- * Interactions helpers
940
- */
941
-
942
-
943
- class_1.prototype.sendTextMessage = function () {
944
- return __awaiter(this, void 0, void 0, function () {
945
- var text, response, err_3;
946
- return __generator(this, function (_a) {
947
- switch (_a.label) {
948
- case 0:
949
- if (this.text.length === 0 || this.chatState !== ChatState.Initial) return [2
950
- /*return*/
951
- ];
952
- text = this.text;
953
- this.text = '';
954
- this.appendToChat(text, MessageFrom.User);
955
- this.chatState = ChatState.SendingText;
956
- _a.label = 1;
957
-
958
- case 1:
959
- _a.trys.push([1, 3,, 4]);
960
-
961
- return [4
962
- /*yield*/
963
- , _aws_amplify_interactions__WEBPACK_IMPORTED_MODULE_5__["Interactions"].send(this.botName, text)];
964
-
965
- case 2:
966
- response = _a.sent();
967
- return [3
968
- /*break*/
969
- , 4];
970
-
971
- case 3:
972
- err_3 = _a.sent();
973
- this.setError(err_3, ChatErrorType.Recoverable);
974
- return [2
975
- /*return*/
976
- ];
977
-
978
- case 4:
979
- if (response.message) {
980
- this.appendToChat(response.message, MessageFrom.Bot);
981
- }
982
-
983
- this.chatState = ChatState.Initial;
984
- return [2
985
- /*return*/
986
- ];
987
- }
988
- });
989
- });
990
- };
991
-
992
- class_1.prototype.sendVoiceMessage = function (audioInput) {
993
- return __awaiter(this, void 0, void 0, function () {
994
- var interactionsMessage, response, err_4, dialogState;
995
-
996
- var _this = this;
997
-
998
- return __generator(this, function (_a) {
999
- switch (_a.label) {
1000
- case 0:
1001
- interactionsMessage = {
1002
- content: audioInput,
1003
- options: {
1004
- messageType: 'voice'
1005
- }
1006
- };
1007
- _a.label = 1;
1008
-
1009
- case 1:
1010
- _a.trys.push([1, 3,, 4]);
1011
-
1012
- return [4
1013
- /*yield*/
1014
- , _aws_amplify_interactions__WEBPACK_IMPORTED_MODULE_5__["Interactions"].send(this.botName, interactionsMessage)];
1015
-
1016
- case 2:
1017
- response = _a.sent();
1018
- return [3
1019
- /*break*/
1020
- , 4];
1021
-
1022
- case 3:
1023
- err_4 = _a.sent();
1024
- this.setError(err_4, ChatErrorType.Recoverable);
1025
- return [2
1026
- /*return*/
1027
- ];
1028
-
1029
- case 4:
1030
- this.chatState = ChatState.Initial;
1031
- dialogState = response.dialogState;
1032
- if (response.inputTranscript) this.appendToChat(response.inputTranscript, MessageFrom.User);
1033
- this.appendToChat(response.message, MessageFrom.Bot);
1034
- return [4
1035
- /*yield*/
1036
- , this.audioRecorder.play(response.audioStream).then(function () {
1037
- // if conversationMode is on, chat is incomplete, and mic button isn't pressed yet, resume listening.
1038
- if (_this.conversationModeOn && dialogState !== 'Fulfilled' && dialogState !== 'Failed' && _this.chatState === ChatState.Initial) {
1039
- _this.handleMicButton();
1040
- }
1041
- })["catch"](function (err) {
1042
- return _this.setError(err, ChatErrorType.Recoverable);
1043
- })];
1044
-
1045
- case 5:
1046
- _a.sent();
1047
-
1048
- return [2
1049
- /*return*/
1050
- ];
1051
- }
1052
- });
1053
- });
1054
- };
1055
-
1056
- class_1.prototype.appendToChat = function (content, from) {
1057
- this.messages = __spreadArrays(this.messages, [{
1058
- content: content,
1059
- from: from
1060
- }]);
1061
- };
1062
- /**
1063
- * State control methods
1064
- */
1065
-
1066
-
1067
- class_1.prototype.setError = function (error, errorType) {
1068
- var message = typeof error === 'string' ? error : error.message;
1069
- this.chatState = ChatState.Error;
1070
- this.error = {
1071
- message: message,
1072
- errorType: errorType
1073
- };
1074
- };
1075
-
1076
- class_1.prototype.reset = function () {
1077
- this.chatState = ChatState.Initial;
1078
- this.text = '';
1079
- this.error = undefined;
1080
- this.messages = [];
1081
- if (this.welcomeMessage) this.appendToChat(this.welcomeMessage, MessageFrom.Bot);
1082
- this.audioRecorder && this.audioRecorder.clear();
1083
- };
1084
-
1085
- class_1.prototype.listeningFooterJSX = function () {
1086
- var _this = this;
1087
-
1088
- var visualization = Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("canvas", {
1089
- height: "50"
1090
- });
1091
- var cancelButton = Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
1092
- "data-test": "chatbot-cancel-button",
1093
- handleButtonClick: function handleButtonClick() {
1094
- return _this.handleCancelButton();
1095
- },
1096
- "class": "icon-button",
1097
- variant: "icon",
1098
- icon: "ban"
1099
- });
1100
- return [visualization, cancelButton];
1101
- };
1102
-
1103
- class_1.prototype.footerJSX = function () {
1104
- var _this = this;
1105
-
1106
- if (this.chatState === ChatState.Listening) return this.listeningFooterJSX();
1107
- var inputPlaceholder = this.textEnabled ? _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].TEXT_INPUT_PLACEHOLDER : _Translations_108d469f_js__WEBPACK_IMPORTED_MODULE_3__["T"].VOICE_INPUT_PLACEHOLDER;
1108
- var textInput = Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-input", {
1109
- placeholder: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(inputPlaceholder),
1110
- description: "text",
1111
- handleInputChange: function handleInputChange(evt) {
1112
- return _this.handleTextChange(evt);
1113
- },
1114
- value: this.text,
1115
- disabled: this.chatState === ChatState.Error || !this.textEnabled
1116
- });
1117
- var micButton = this.voiceEnabled && Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
1118
- "data-test": "chatbot-mic-button",
1119
- handleButtonClick: function handleButtonClick() {
1120
- return _this.handleMicButton();
1121
- },
1122
- "class": "icon-button",
1123
- variant: "icon",
1124
- icon: "microphone",
1125
- disabled: this.chatState === ChatState.Error || this.chatState !== ChatState.Initial
1126
- });
1127
- var sendButton = this.textEnabled && Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-button", {
1128
- "data-test": "chatbot-send-button",
1129
- "class": "icon-button",
1130
- variant: "icon",
1131
- icon: "send",
1132
- handleButtonClick: function handleButtonClick() {
1133
- return _this.sendTextMessage();
1134
- },
1135
- disabled: this.chatState === ChatState.Error || this.chatState !== ChatState.Initial
1136
- });
1137
- return [textInput, micButton, sendButton];
1138
- };
1139
-
1140
- class_1.prototype.errorToast = function () {
1141
- var _this = this;
1142
-
1143
- if (!this.error) return;
1144
- var _a = this.error,
1145
- message = _a.message,
1146
- errorType = _a.errorType;
1147
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-toast", {
1148
- message: _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(message),
1149
- handleClose: function handleClose() {
1150
- return _this.handleToastClose(errorType);
1151
- }
1152
- });
36
+ AmplifyCheckbox.prototype.componentWillLoad = function () {
37
+ console.warn('Version `1.x` of Amplify UI has been deprecated and will be removed in a future major version of `aws-amplify`. Please visit https://ui.docs.amplify.aws/ for the current version of Amplify UI.');
1153
38
  };
1154
39
 
1155
- class_1.prototype.render = function () {
1156
- var _this = this;
1157
-
1158
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["H"], null, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
1159
- "class": "amplify-chatbot"
1160
- }, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("slot", {
1161
- name: "header"
1162
- }, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
1163
- "class": "header",
1164
- "data-test": "chatbot-header"
1165
- }, _aws_amplify_core__WEBPACK_IMPORTED_MODULE_1__["I18n"].get(this.botTitle))), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
1166
- "class": "body",
1167
- "data-test": "chatbot-body"
1168
- }, this.messageJSX(this.messages)), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("form", {
1169
- onSubmit: function onSubmit(e) {
1170
- return _this.handleSubmit(e);
1171
- }
1172
- }, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("div", {
1173
- "class": "footer",
1174
- "data-test": "chatbot-footer"
1175
- }, this.footerJSX())), this.errorToast()));
40
+ AmplifyCheckbox.prototype.render = function () {
41
+ return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("span", {
42
+ "class": "checkbox"
43
+ }, Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("input", {
44
+ onClick: this.onClick,
45
+ type: "checkbox",
46
+ name: this.name,
47
+ value: this.value,
48
+ id: this.fieldId,
49
+ checked: this.checked,
50
+ disabled: this.disabled
51
+ }), Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["h"])("amplify-label", {
52
+ htmlFor: this.fieldId
53
+ }, this.label));
1176
54
  };
1177
55
 
1178
- Object.defineProperty(class_1.prototype, "element", {
1179
- get: function get() {
1180
- return Object(_index_83f2275b_js__WEBPACK_IMPORTED_MODULE_0__["g"])(this);
1181
- },
1182
- enumerable: false,
1183
- configurable: true
1184
- });
1185
- return class_1;
56
+ return AmplifyCheckbox;
1186
57
  }();
1187
58
 
1188
- AmplifyChatbot.style = amplifyChatbotCss;
59
+ AmplifyCheckbox.style = amplifyCheckboxCss;
1189
60
 
1190
61
 
1191
62
  /***/ })