@aws-amplify/interactions 4.1.10-unstable.2 → 4.1.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 (83) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build.js +5 -0
  3. package/dist/aws-amplify-interactions.js +33213 -0
  4. package/dist/aws-amplify-interactions.js.map +1 -0
  5. package/dist/aws-amplify-interactions.min.js +116 -0
  6. package/dist/aws-amplify-interactions.min.js.map +1 -0
  7. package/index.js +7 -0
  8. package/lib/Interactions.js +50 -4
  9. package/lib/Interactions.js.map +1 -1
  10. package/lib/Providers/AWSLexProvider.js +76 -7
  11. package/lib/Providers/AWSLexProvider.js.map +1 -1
  12. package/lib/Providers/AWSLexProviderHelper/commonUtils.js +50 -5
  13. package/lib/Providers/AWSLexProviderHelper/commonUtils.js.map +1 -1
  14. package/lib/Providers/AWSLexProviderHelper/utils.js +52 -7
  15. package/lib/Providers/AWSLexProviderHelper/utils.js.map +1 -1
  16. package/lib/Providers/AWSLexProviderHelper/utils.native.js +56 -11
  17. package/lib/Providers/AWSLexProviderHelper/utils.native.js.map +1 -1
  18. package/lib/Providers/AWSLexV2Provider.js +86 -17
  19. package/lib/Providers/AWSLexV2Provider.js.map +1 -1
  20. package/lib/Providers/InteractionsProvider.js +25 -5
  21. package/lib/Providers/InteractionsProvider.js.map +1 -1
  22. package/lib/Providers/index.js +18 -8
  23. package/lib/Providers/index.js.map +1 -1
  24. package/lib/index.js +22 -8
  25. package/lib/index.js.map +1 -1
  26. package/lib/types/Response.js +12 -2
  27. package/lib/types/Response.js.map +1 -1
  28. package/lib-esm/Interactions.js +47 -1
  29. package/lib-esm/Interactions.js.map +1 -1
  30. package/lib-esm/Providers/AWSLexProvider.js +72 -3
  31. package/lib-esm/Providers/AWSLexProvider.js.map +1 -1
  32. package/lib-esm/Providers/AWSLexProviderHelper/commonUtils.js +48 -3
  33. package/lib-esm/Providers/AWSLexProviderHelper/commonUtils.js.map +1 -1
  34. package/lib-esm/Providers/AWSLexProviderHelper/utils.js +48 -3
  35. package/lib-esm/Providers/AWSLexProviderHelper/utils.js.map +1 -1
  36. package/lib-esm/Providers/AWSLexProviderHelper/utils.native.js +48 -3
  37. package/lib-esm/Providers/AWSLexProviderHelper/utils.native.js.map +1 -1
  38. package/lib-esm/Providers/AWSLexV2Provider.js +72 -3
  39. package/lib-esm/Providers/AWSLexV2Provider.js.map +1 -1
  40. package/lib-esm/Providers/InteractionsProvider.js +23 -3
  41. package/lib-esm/Providers/InteractionsProvider.js.map +1 -1
  42. package/lib-esm/Providers/index.d.ts +3 -3
  43. package/lib-esm/Providers/index.js +15 -5
  44. package/lib-esm/Providers/index.js.map +1 -1
  45. package/lib-esm/index.d.ts +9 -4
  46. package/lib-esm/index.js +21 -6
  47. package/lib-esm/index.js.map +1 -1
  48. package/lib-esm/types/Response.js +12 -2
  49. package/lib-esm/types/Response.js.map +1 -1
  50. package/package.json +9 -13
  51. package/src/Interactions.ts +12 -2
  52. package/src/Providers/AWSLexProvider.ts +12 -2
  53. package/src/Providers/AWSLexProviderHelper/commonUtils.ts +12 -2
  54. package/src/Providers/AWSLexProviderHelper/utils.native.ts +12 -2
  55. package/src/Providers/AWSLexProviderHelper/utils.ts +12 -2
  56. package/src/Providers/AWSLexV2Provider.ts +12 -2
  57. package/src/Providers/InteractionsProvider.ts +12 -2
  58. package/src/Providers/index.ts +15 -5
  59. package/src/index.ts +23 -6
  60. package/src/types/Interactions.ts +12 -2
  61. package/src/types/Provider.ts +12 -2
  62. package/src/types/Providers/AWSLexProvider.ts +12 -2
  63. package/src/types/Providers/AWSLexV2Provider.ts +12 -2
  64. package/src/types/Response.ts +12 -2
  65. package/src/types/index.ts +12 -2
  66. package/webpack.config.dev.js +6 -0
  67. package/lib/.tsbuildinfo +0 -3
  68. package/lib/Interactions.d.ts +0 -24
  69. package/lib/Providers/AWSLexProvider.d.ts +0 -24
  70. package/lib/Providers/AWSLexProviderHelper/commonUtils.d.ts +0 -1
  71. package/lib/Providers/AWSLexProviderHelper/utils.d.ts +0 -3
  72. package/lib/Providers/AWSLexProviderHelper/utils.native.d.ts +0 -3
  73. package/lib/Providers/AWSLexV2Provider.d.ts +0 -58
  74. package/lib/Providers/InteractionsProvider.d.ts +0 -11
  75. package/lib/Providers/index.d.ts +0 -3
  76. package/lib/index.d.ts +0 -5
  77. package/lib/types/Interactions.d.ts +0 -16
  78. package/lib/types/Provider.d.ts +0 -12
  79. package/lib/types/Providers/AWSLexProvider.d.ts +0 -10
  80. package/lib/types/Providers/AWSLexV2Provider.d.ts +0 -12
  81. package/lib/types/Response.d.ts +0 -3
  82. package/lib/types/index.d.ts +0 -5
  83. package/lib-esm/.tsbuildinfo +0 -3
package/src/index.ts CHANGED
@@ -1,8 +1,25 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
13
+ import { Interactions } from './Interactions';
14
+
15
+ /**
16
+ * @deprecated use named import
17
+ */
18
+ export default Interactions;
3
19
 
4
- export { Interactions } from './Interactions';
5
20
  export * from './types';
6
- export { AbstractInteractionsProvider } from './Providers/InteractionsProvider';
7
- export { AWSLexProvider } from './Providers/AWSLexProvider';
8
- export { AWSLexV2Provider } from './Providers/AWSLexV2Provider';
21
+ export * from './Providers/InteractionsProvider';
22
+ export * from './Providers/AWSLexProvider';
23
+ export * from './Providers/AWSLexV2Provider';
24
+
25
+ export { Interactions };
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
  export interface InteractionsOptions {
4
14
  [key: string]: any;
5
15
  }
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
  import { InteractionsOptions } from './Interactions';
4
14
  import { InteractionsResponse } from './Response';
5
15
 
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
  export interface AWSLexProviderOption {
4
14
  name: string;
5
15
  alias: string;
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
  export interface AWSLexV2ProviderOption {
4
14
  name: string;
5
15
  botId: string;
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
 
4
14
  export type InteractionsResponse = {
5
15
  [key: string]: any;
@@ -1,5 +1,15 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
1
+ /*
2
+ * Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5
+ * the License. A copy of the License is located at
6
+ *
7
+ * http://aws.amazon.com/apache2.0/
8
+ *
9
+ * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10
+ * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11
+ * and limitations under the License.
12
+ */
3
13
  export * from './Interactions';
4
14
  export * from './Provider';
5
15
  export * from './Providers/AWSLexProvider';
@@ -0,0 +1,6 @@
1
+ var config = require('./webpack.config.js');
2
+
3
+ var entry = {
4
+ 'aws-amplify-interactions': './lib-esm/index.js',
5
+ };
6
+ module.exports = Object.assign(config, { entry, mode: 'development' });
package/lib/.tsbuildinfo DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "version": "3.8.3"
3
- }
@@ -1,24 +0,0 @@
1
- import { InteractionsOptions, InteractionsProvider, InteractionsMessage, InteractionsResponse } from './types';
2
- export declare class InteractionsClass {
3
- private _options;
4
- private _pluggables;
5
- /**
6
- * Initialize PubSub with AWS configurations
7
- *
8
- * @param {InteractionsOptions} options - Configuration object for Interactions
9
- */
10
- constructor(options?: InteractionsOptions);
11
- getModuleName(): string;
12
- /**
13
- *
14
- * @param {InteractionsOptions} options - Configuration object for Interactions
15
- * @return {InteractionsOptions} - The current configuration
16
- */
17
- configure(options: InteractionsOptions): InteractionsOptions;
18
- addPluggable(pluggable: InteractionsProvider): void;
19
- send(botname: string, message: string): Promise<InteractionsResponse>;
20
- send(botname: string, message: InteractionsMessage): Promise<InteractionsResponse>;
21
- send(botname: string, message: object): Promise<InteractionsResponse>;
22
- onComplete(botname: string, callback: (err: any, confirmation: any) => void): void;
23
- }
24
- export declare const Interactions: InteractionsClass;
@@ -1,24 +0,0 @@
1
- import { AbstractInteractionsProvider } from './InteractionsProvider';
2
- import { InteractionsOptions, AWSLexProviderOptions, InteractionsResponse, InteractionsMessage } from '../types';
3
- import { PostTextCommandOutput, PostContentCommandOutput } from '@aws-sdk/client-lex-runtime-service';
4
- interface PostContentCommandOutputFormatted extends Omit<PostContentCommandOutput, 'audioStream'> {
5
- audioStream?: Uint8Array;
6
- }
7
- declare type AWSLexProviderSendResponse = PostTextCommandOutput | PostContentCommandOutputFormatted;
8
- export declare class AWSLexProvider extends AbstractInteractionsProvider {
9
- private lexRuntimeServiceClient;
10
- private _botsCompleteCallback;
11
- constructor(options?: InteractionsOptions);
12
- getProviderName(): string;
13
- configure(config?: AWSLexProviderOptions): AWSLexProviderOptions;
14
- /**
15
- * @private
16
- * @deprecated
17
- * This is used internally by 'sendMessage' to call onComplete callback
18
- * for a bot if configured
19
- */
20
- reportBotStatus(data: AWSLexProviderSendResponse, botname: string): void;
21
- sendMessage(botname: string, message: string | InteractionsMessage): Promise<InteractionsResponse>;
22
- onComplete(botname: string, callback: (err: any, confirmation: any) => void): void;
23
- }
24
- export {};
@@ -1 +0,0 @@
1
- export declare const unGzipBase64AsJson: (gzipBase64: string) => Promise<any>;
@@ -1,3 +0,0 @@
1
- export declare const convert: (stream: object) => Promise<Uint8Array>;
2
- export declare const base64ToArrayBuffer: (base64: string) => Uint8Array;
3
- export declare const gzipDecompressToString: (data: Uint8Array) => Promise<string>;
@@ -1,3 +0,0 @@
1
- export declare const convert: (stream: object) => Promise<Uint8Array>;
2
- export declare const base64ToArrayBuffer: (base64: string) => Uint8Array;
3
- export declare const gzipDecompressToString: (data: Uint8Array) => Promise<string>;
@@ -1,58 +0,0 @@
1
- import { AbstractInteractionsProvider } from './InteractionsProvider';
2
- import { InteractionsOptions, AWSLexV2ProviderOptions, InteractionsResponse, InteractionsMessage } from '../types';
3
- export declare class AWSLexV2Provider extends AbstractInteractionsProvider {
4
- private _lexRuntimeServiceV2Client;
5
- private _botsCompleteCallback;
6
- /**
7
- * Initialize Interactions with AWS configurations
8
- * @param {InteractionsOptions} options - Configuration object for Interactions
9
- */
10
- constructor(options?: InteractionsOptions);
11
- /**
12
- * get provider name of the plugin
13
- * @returns {string} name of the provider
14
- */
15
- getProviderName(): string;
16
- /**
17
- * Configure Interactions part with aws configuration
18
- * @param {AWSLexV2ProviderOptions} config - Configuration of the Interactions
19
- * @return {AWSLexV2ProviderOptions} - Current configuration
20
- */
21
- configure(config?: AWSLexV2ProviderOptions): AWSLexV2ProviderOptions;
22
- /**
23
- * Send a message to a bot
24
- * @async
25
- * @param {string} botname - Bot name to send the message
26
- * @param {string | InteractionsMessage} message - message to send to the bot
27
- * @return {Promise<InteractionsResponse>} A promise resolves to the response from the bot
28
- */
29
- sendMessage(botname: string, message: string | InteractionsMessage): Promise<InteractionsResponse>;
30
- /**
31
- * Attach a onComplete callback function to a bot.
32
- * The callback is called once the bot's intent is fulfilled
33
- * @param {string} botname - Bot name to attach the onComplete callback
34
- * @param {(err: Error | null, confirmation: InteractionsResponse) => void} callback - called when Intent Fulfilled
35
- */
36
- onComplete(botname: string, callback: (err: Error | null, confirmation: InteractionsResponse) => void): void;
37
- /**
38
- * @private
39
- * call onComplete callback for a bot if configured
40
- */
41
- private _reportBotStatus;
42
- /**
43
- * Format UtteranceCommandOutput's response
44
- * decompress attributes
45
- * update audioStream format
46
- */
47
- private _formatUtteranceCommandOutput;
48
- /**
49
- * handle client's `RecognizeTextCommand`
50
- * used for sending simple text message
51
- */
52
- private _handleRecognizeTextCommand;
53
- /**
54
- * handle client's `RecognizeUtteranceCommand`
55
- * used for obj text or obj voice message
56
- */
57
- private _handleRecognizeUtteranceCommand;
58
- }
@@ -1,11 +0,0 @@
1
- import { InteractionsProvider, InteractionsOptions, InteractionsResponse } from '../types';
2
- export declare abstract class AbstractInteractionsProvider implements InteractionsProvider {
3
- protected _config: InteractionsOptions;
4
- constructor(options?: InteractionsOptions);
5
- configure(config?: InteractionsOptions): InteractionsOptions;
6
- getCategory(): string;
7
- abstract getProviderName(): string;
8
- protected get options(): InteractionsOptions;
9
- abstract sendMessage(botname: string, message: string | Object): Promise<object>;
10
- abstract onComplete(botname: string, callback: (err: any, confirmation: InteractionsResponse) => void): any;
11
- }
@@ -1,3 +0,0 @@
1
- export { AWSLexProvider } from './AWSLexProvider';
2
- export { AWSLexV2Provider } from './AWSLexV2Provider';
3
- export { AbstractInteractionsProvider } from './InteractionsProvider';
package/lib/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export { Interactions } from './Interactions';
2
- export * from './types';
3
- export { AbstractInteractionsProvider } from './Providers/InteractionsProvider';
4
- export { AWSLexProvider } from './Providers/AWSLexProvider';
5
- export { AWSLexV2Provider } from './Providers/AWSLexV2Provider';
@@ -1,16 +0,0 @@
1
- export interface InteractionsOptions {
2
- [key: string]: any;
3
- }
4
- export declare type InteractionsTextMessage = {
5
- content: string;
6
- options: {
7
- messageType: 'text';
8
- };
9
- };
10
- export declare type InteractionsVoiceMessage = {
11
- content: object;
12
- options: {
13
- messageType: 'voice';
14
- };
15
- };
16
- export declare type InteractionsMessage = InteractionsTextMessage | InteractionsVoiceMessage;
@@ -1,12 +0,0 @@
1
- import { InteractionsOptions } from './Interactions';
2
- import { InteractionsResponse } from './Response';
3
- export interface InteractionsProvider {
4
- configure(config: InteractionsOptions): InteractionsOptions;
5
- getCategory(): string;
6
- getProviderName(): string;
7
- sendMessage(botname: string, message: string | Object): Promise<object>;
8
- onComplete(botname: string, callback: (err: any, confirmation: InteractionsResponse) => void): any;
9
- }
10
- export interface InteractionsProviders {
11
- [key: string]: InteractionsProvider;
12
- }
@@ -1,10 +0,0 @@
1
- export interface AWSLexProviderOption {
2
- name: string;
3
- alias: string;
4
- region: string;
5
- providerName?: string;
6
- onComplete?(botname: string, callback: (err: any, confirmation: any) => void): void;
7
- }
8
- export interface AWSLexProviderOptions {
9
- [key: string]: AWSLexProviderOption;
10
- }
@@ -1,12 +0,0 @@
1
- export interface AWSLexV2ProviderOption {
2
- name: string;
3
- botId: string;
4
- aliasId: string;
5
- localeId: string;
6
- region: string;
7
- providerName: string;
8
- onComplete?(botname: string, callback: (err: any, confirmation: any) => void): void;
9
- }
10
- export interface AWSLexV2ProviderOptions {
11
- [key: string]: AWSLexV2ProviderOption;
12
- }
@@ -1,3 +0,0 @@
1
- export declare type InteractionsResponse = {
2
- [key: string]: any;
3
- };
@@ -1,5 +0,0 @@
1
- export * from './Interactions';
2
- export * from './Provider';
3
- export * from './Providers/AWSLexProvider';
4
- export * from './Providers/AWSLexV2Provider';
5
- export * from './Response';
@@ -1,3 +0,0 @@
1
- {
2
- "version": "3.8.3"
3
- }