@cxbuilder/flow-config 1.0.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/.jsii +145 -68
  2. package/CHANGELOG.md +38 -0
  3. package/README.md +8 -5
  4. package/dist/backend/FlowConfig/index.js +111 -16
  5. package/dist/backend/FlowConfig/index.js.map +3 -3
  6. package/dist/backend/GetConfig/index.js +1 -1
  7. package/dist/backend/GetConfig/index.js.map +2 -2
  8. package/dist/backend/Init/index.js +2 -1
  9. package/dist/backend/Init/index.js.map +2 -2
  10. package/dist/backend/Settings/index.js +255 -0
  11. package/dist/backend/Settings/index.js.map +7 -0
  12. package/dist/backend/Static/static/assets/index-Cejunttu.js +61 -0
  13. package/dist/backend/Static/static/assets/{index-NRh8x3FI.css → index-SZuscj14.css} +1 -1
  14. package/dist/backend/Static/static/index.html +3 -3
  15. package/dist/infrastructure/FlowConfigStack.d.ts +36 -14
  16. package/dist/infrastructure/FlowConfigStack.js +54 -18
  17. package/dist/infrastructure/GetConfig/index.js +2 -2
  18. package/dist/infrastructure/api/Api.d.ts +5 -2
  19. package/dist/infrastructure/api/Api.js +21 -15
  20. package/dist/infrastructure/api/Init/Init.interface.d.ts +4 -0
  21. package/dist/infrastructure/api/Init/Init.interface.js +1 -1
  22. package/dist/infrastructure/api/Init/index.js +2 -1
  23. package/dist/infrastructure/api/Settings/Settings.interface.d.ts +3 -0
  24. package/dist/infrastructure/api/Settings/Settings.interface.js +3 -0
  25. package/dist/infrastructure/api/Settings/index.d.ts +7 -0
  26. package/dist/infrastructure/api/Settings/index.js +21 -0
  27. package/dist/infrastructure/api/spec.yaml +122 -0
  28. package/dist/infrastructure/createLambda.js +1 -1
  29. package/dist/infrastructure/index.d.ts +1 -1
  30. package/dist/infrastructure/index.js +1 -1
  31. package/dist/infrastructure/tsconfig.tsbuildinfo +1 -1
  32. package/docs/Permissions-v1.md +132 -0
  33. package/docs/{Permissions.md → Permissions-v2.md} +15 -15
  34. package/package.json +1 -1
  35. package/dist/backend/Static/static/assets/index-Bx9Z3cF9.js +0 -61
package/.jsii CHANGED
@@ -3984,7 +3984,7 @@
3984
3984
  },
3985
3985
  "name": "@cxbuilder/flow-config",
3986
3986
  "readme": {
3987
- "markdown": "# @cxbuilder/flow-config\n\nAWS CDK constructs for Amazon Connect FlowConfig - a third-party app for configuring variables and prompts in Connect contact flows.\n\n## Links\n\n- [Screenshots](./docs/screenshots/)\n- [Architecture](./docs/Architecture.md)\n- [DataModel](./docs/DataModel.md)\n\n## Installation\n\n```bash\nnpm install @cxbuilder/flow-config\n```\n\n## Usage\n\n### Standard Deployment (Public)\n\n```typescript\nimport { FlowConfigStack } from '@cxbuilder/flow-config';\nimport * as cdk from 'aws-cdk-lib';\n\nconst app = new cdk.App();\nnew FlowConfigStack(app, 'FlowConfigStack', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-east-1',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-east-1_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n});\n```\n\n### VPC Private Deployment\n\nFor enhanced security, you can deploy the application to run entirely within a VPC with private endpoints:\n\n```typescript\nimport { FlowConfigStack, VpcConfig } from '@cxbuilder/flow-config';\nimport * as cdk from 'aws-cdk-lib';\n\nconst app = new cdk.App();\n\n// Configure VPC using string IDs - the stack will resolve these to CDK objects\nconst vpcConfig: VpcConfig = {\n vpcId: 'vpc-12345678',\n lambdaSecurityGroupIds: ['sg-lambda123'],\n privateSubnetIds: ['subnet-12345', 'subnet-67890'],\n vpcEndpointSecurityGroupIds: ['sg-endpoint123'],\n};\n\nnew FlowConfigStack(app, 'FlowConfigStack', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-east-1',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-east-1_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n vpc: vpcConfig, // Enable VPC private deployment\n});\n```\n\n### Multi-Region Global Table Deployment\n\nFor global resilience, deploy the application across multiple regions with DynamoDB Global Tables:\n\n#### Primary Region Setup\n\n```typescript\nimport { FlowConfigStack, GlobalTableConfig } from '@cxbuilder/flow-config';\nimport * as cdk from 'aws-cdk-lib';\n\nconst app = new cdk.App();\n\n// Primary region creates the global table with replicas\nconst primaryGlobalTable: GlobalTableConfig = {\n isPrimaryRegion: true,\n replicaRegions: ['us-west-2', 'eu-west-1'],\n};\n\nnew FlowConfigStack(app, 'FlowConfigStack-Primary', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-east-1',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-east-1_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n globalTable: primaryGlobalTable, // Enable global table\n});\n```\n\n#### Secondary Region Setup\n\n```typescript\nnew FlowConfigStack(app, 'FlowConfigStack-Secondary', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-west-2',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-west-2_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-west-2:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n globalTable: {\n isPrimaryRegion: false, // Reference global table\n },\n});\n```\n\n## Features\n\n- **Serverless Architecture**: Built with AWS Lambda, DynamoDB, and API Gateway\n- **Amazon Connect Integration**: GetConfig Lambda function integrated directly with Connect contact flows\n- **Third-Party App**: Web-based interface embedded in Amazon Connect Agent Workspace\n- **Multi-Language Support**: Configure prompts for different languages and channels (voice/chat)\n- **Real-time Preview**: Text-to-speech preview using Amazon Polly\n- **Secure Access**: Integration with Amazon Connect and AWS Verified Permissions\n- **Flexible Deployment Options**:\n - **Single-Region**: Standard deployment with regional DynamoDB table\n - **Multi-Region**: Global table support with automatic replication across regions\n - **Public Deployment**: Standard internet-accessible API Gateway and Lambda functions\n - **VPC Private Deployment**: Private API Gateway endpoints, VPC-enabled Lambda functions, and VPC endpoints for enhanced security\n\n## GetConfig Lambda Integration\n\nThe GetConfig Lambda function is used within contact flows to access your flow configs. This function is automatically integrated with your Amazon Connect instance during deployment.\n\n### Contact Flow Event Structure\n\nThe Lambda function handles Amazon Connect Contact Flow events with the following structure:\n\n```json\n{\n \"Details\": {\n \"Parameters\": {\n \"id\": \"main-queue\",\n \"lang\": \"es-US\"\n },\n \"ContactData\": {\n \"Channel\": \"VOICE\",\n \"Attributes\": {\n \"lang\": \"en-US\"\n }\n }\n }\n}\n```\n\n### Input Parameters and Priority\n\n1. **Required Parameters**:\n\n - **`id`**: Flow configuration identifier (always required)\n - Provided via `Details.Parameters.id`\n\n2. **Optional Language Selection** (in order of precedence):\n\n - `Details.Parameters.lang` (highest priority)\n - `Details.ContactData.Attributes.lang`\n - Defaults to `\"en-US\"`\n\n3. **Channel Detection**:\n - Automatically read from `Details.ContactData.Channel`\n - Supports `\"VOICE\"` and `\"CHAT\"`\n - Defaults to `\"voice\"`\n\n### Alternative Input Format (Testing)\n\nFor direct testing or non-Connect invocation:\n\n```json\n{\n \"id\": \"main-queue\",\n \"lang\": \"es-US\",\n \"channel\": \"voice\"\n}\n```\n\n### Function Behavior\n\n1. **Parameter Resolution**:\n\n - Extracts `id` from Connect event parameters (required)\n - Resolves language from parameters → attributes → default\n - Determines channel from Contact Flow event data\n\n2. **Processing Steps**:\n\n - Retrieves the flow config from DynamoDB using the provided ID\n - Includes all variables from the flow config in the result\n - For each prompt in the flow config:\n - Selects the appropriate language version\n - Uses voice content by default\n - For chat channel:\n - Uses chat-specific content if available\n - Strips SSML tags from voice content if no chat content exists\n\n3. **Output**:\n - Returns a flattened object containing:\n - All variable key-value pairs from the flow config\n - All prompt values resolved for the specified language and channel\n\n### Setting Up in Contact Flow\n\n1. **Add \"Invoke AWS Lambda function\" block** to your contact flow\n2. **Select the GetConfig Lambda function** (deployed as `${prefix}-get-config`)\n3. **Configure parameters**:\n\n```json\n{\n \"id\": \"main-queue\"\n}\n```\n\nOr with explicit language:\n\n```json\n{\n \"id\": \"main-queue\",\n \"lang\": \"es-US\"\n}\n```\n\n### Using Returned Data\n\nThe Lambda response is automatically available in subsequent blocks:\n\n- **Set contact attributes**: Use `$.External.variableName`\n- **Play prompt**: Use `$.External.promptName`\n- **Check contact attributes**: Reference returned variables for routing decisions\n\n### Example Contact Flow Integration\n\n```\n[Get customer input] → [Invoke Lambda: GetConfig]\n ↓\n [Set contact attributes]\n ↓\n [Play prompt: $.External.welcomeMessage]\n ↓\n [Route based on: $.External.routingMode]\n```\n\n### Size Considerations\n\n- Amazon Connect has a Lambda response size limit of 32KB\n- The combined size of returned variables and prompts should be less than this limit\n- For large flow configs with many prompts or languages, consider implementing pagination or selective loading\n\n### Logger\n\n[Lambda PowerTools Logger](https://docs.powertools.aws.dev/lambda/typescript/latest/core/logger/) provides a lightweight logger implementation with JSON output.\n\nTips:\n\n- Use the `appendKeys()` method to add `ContactId` to your connect log lambda output.\n\n### Open API Spec\n\nThis template defines an Open API Spec for the API GW Lambdas. This allows use to generate a TypeScript api client to be used by the frontend app. We can also generate a API client in any language from the same spec to allow the client to better integrate with our apps.\n\n- [constructs/aws-openapigateway-lambda](https://docs.aws.amazon.com/solutions/latest/constructs/aws-openapigateway-lambda.html)\n- [OpenAPI Editor](https://marketplace.visualstudio.com/items?itemName=42Crunch.vscode-openapi)\n- [OpenApy TypeScript Generator](https://openapi-ts.pages.dev/introduction)\n\n## Development\n\n### Frontend Development\n\nThe frontend React application integrates with Amazon Connect Agent Workspace using the Connect SDK:\n\n```bash\n# Start local development server\nnpm start\n\n# Build for production\nnpm run build\n```\n\nFor local development, point your Amazon Connect third-party app configuration to `localhost:3000`. The application requires execution within Agent Workspace for Connect SDK functionality.\n\n### Lambda Development\n\nLambda functions are bundled automatically during the build process:\n\n```bash\n# Bundle Lambda functions\nnpm run build:lambdas\n\n# Full build (CDK + Frontend + Lambdas)\nnpm run build\n```\n"
3987
+ "markdown": "# @cxbuilder/flow-config\n\n[![CI/CD Pipeline](https://github.com/cxbuilder/flow-config/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/cxbuilder/flow-config/actions/workflows/ci-cd.yml)\n[![npm version](https://badge.fury.io/js/@cxbuilder%2Fflow-config.svg)](https://badge.fury.io/js/@cxbuilder%2Fflow-config)\n[![PyPI version](https://badge.fury.io/py/cxbuilder-flow-config.svg)](https://badge.fury.io/py/cxbuilder-flow-config)\n[![View on Construct Hub](https://constructs.dev/badge?package=%40cxbuilder%2Fflow-config)](https://constructs.dev/packages/@cxbuilder/flow-config)\n\nAWS CDK constructs for Amazon Connect FlowConfig - a third-party app for configuring variables and prompts in Connect contact flows.\n\n## Links\n\n- [Screenshots](./docs/screenshots/)\n- [Architecture](./docs/Architecture.md)\n- [DataModel](./docs/DataModel.md)\n\n## Installation\n\n```bash\nnpm install @cxbuilder/flow-config\n```\n\n## Usage\n\n### Standard Deployment (Public)\n\n```typescript\nimport { FlowConfigStack } from '@cxbuilder/flow-config';\nimport * as cdk from 'aws-cdk-lib';\n\nconst app = new cdk.App();\nnew FlowConfigStack(app, 'FlowConfigStack', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-east-1',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-east-1_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n});\n```\n\n### VPC Private Deployment\n\nFor enhanced security, you can deploy the application to run entirely within a VPC with private endpoints:\n\n```typescript\nimport { FlowConfigStack, VpcConfig } from '@cxbuilder/flow-config';\nimport * as cdk from 'aws-cdk-lib';\n\nconst app = new cdk.App();\n\n// Configure VPC using string IDs - the stack will resolve these to CDK objects\nconst vpcConfig: VpcConfig = {\n vpcId: 'vpc-12345678',\n lambdaSecurityGroupIds: ['sg-lambda123'],\n privateSubnetIds: ['subnet-12345', 'subnet-67890'],\n vpcEndpointSecurityGroupIds: ['sg-endpoint123'],\n};\n\nnew FlowConfigStack(app, 'FlowConfigStack', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-east-1',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-east-1_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n vpc: vpcConfig, // Enable VPC private deployment\n});\n```\n\n### Multi-Region Global Table Deployment\n\nFor global resilience, deploy the application across multiple regions with DynamoDB Global Tables:\n\n#### Primary Region Setup\n\n```typescript\nimport { FlowConfigStack, GlobalTableConfig } from '@cxbuilder/flow-config';\nimport * as cdk from 'aws-cdk-lib';\n\nconst app = new cdk.App();\n\n// Primary region creates the global table with replicas\nconst primaryGlobalTable: GlobalTableConfig = {\n isPrimaryRegion: true,\n replicaRegions: ['us-west-2', 'eu-west-1'],\n};\n\nnew FlowConfigStack(app, 'FlowConfigStack-Primary', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-east-1',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-east-1_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-east-1:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n globalTable: primaryGlobalTable, // Enable global table\n});\n```\n\n#### Secondary Region Setup\n\n```typescript\nnew FlowConfigStack(app, 'FlowConfigStack-Secondary', {\n prefix: 'my-flow-config',\n env: {\n region: 'us-west-2',\n account: 'YOUR_ACCOUNT_ID',\n },\n cognito: {\n domain: 'https://your-auth-domain.com',\n userPoolId: 'us-west-2_YourPoolId',\n },\n connectInstanceArn:\n 'arn:aws:connect:us-west-2:YOUR_ACCOUNT:instance/YOUR_INSTANCE_ID',\n alertEmails: ['admin@yourcompany.com'],\n globalTable: {\n isPrimaryRegion: false, // Reference global table\n },\n});\n```\n\n## Features\n\n- **Serverless Architecture**: Built with AWS Lambda, DynamoDB, and API Gateway\n- **Amazon Connect Integration**: GetConfig Lambda function integrated directly with Connect contact flows\n- **Third-Party App**: Web-based interface embedded in Amazon Connect Agent Workspace\n- **Multi-Language Support**: Configure prompts for different languages and channels (voice/chat)\n- **Real-time Preview**: Text-to-speech preview using Amazon Polly\n- **Secure Access**: Integration with Amazon Connect and AWS Verified Permissions\n- **Flexible Deployment Options**:\n - **Single-Region**: Standard deployment with regional DynamoDB table\n - **Multi-Region**: Global table support with automatic replication across regions\n - **Public Deployment**: Standard internet-accessible API Gateway and Lambda functions\n - **VPC Private Deployment**: Private API Gateway endpoints, VPC-enabled Lambda functions, and VPC endpoints for enhanced security\n\n## GetConfig Lambda Integration\n\nThe GetConfig Lambda function is used within contact flows to access your flow configs. This function is automatically integrated with your Amazon Connect instance during deployment.\n\n### Contact Flow Event Structure\n\nThe Lambda function handles Amazon Connect Contact Flow events with the following structure:\n\n```json\n{\n \"Details\": {\n \"Parameters\": {\n \"id\": \"main-queue\",\n \"lang\": \"es-US\"\n },\n \"ContactData\": {\n \"Channel\": \"VOICE\",\n \"LanguageCode\": \"en-US\"\n }\n }\n}\n```\n\n### Input Parameters and Priority\n\n1. **Required Parameters**:\n\n - **`id`**: Flow configuration identifier (always required)\n - Provided via `Details.Parameters.id`\n\n2. **Optional Language Selection** (in order of precedence):\n\n - `Details.Parameters.lang` (highest priority)\n - `Details.ContactData.LanguageCode`\n - Defaults to `\"en-US\"`\n\n3. **Channel Detection**:\n - Automatically read from `Details.ContactData.Channel`\n - Supports `\"VOICE\"` and `\"CHAT\"`\n - Defaults to `\"voice\"`\n\n### Alternative Input Format (Testing)\n\nFor direct testing or non-Connect invocation:\n\n```json\n{\n \"id\": \"main-queue\",\n \"lang\": \"es-US\",\n \"channel\": \"voice\"\n}\n```\n\n### Function Behavior\n\n1. **Parameter Resolution**:\n\n - Extracts `id` from Connect event parameters (required)\n - Resolves language from parameters → attributes → default\n - Determines channel from Contact Flow event data\n\n2. **Processing Steps**:\n\n - Retrieves the flow config from DynamoDB using the provided ID\n - Includes all variables from the flow config in the result\n - For each prompt in the flow config:\n - Selects the appropriate language version\n - Uses voice content by default\n - For chat channel:\n - Uses chat-specific content if available\n - Strips SSML tags from voice content if no chat content exists\n\n3. **Output**:\n - Returns a flattened object containing:\n - All variable key-value pairs from the flow config\n - All prompt values resolved for the specified language and channel\n\n### Setting Up in Contact Flow\n\n1. **Add \"Invoke AWS Lambda function\" block** to your contact flow\n2. **Select the GetConfig Lambda function** (deployed as `${prefix}`)\n3. **Configure parameters**:\n\n```json\n{\n \"id\": \"main-queue\"\n}\n```\n\nOr with explicit language:\n\n```json\n{\n \"id\": \"main-queue\",\n \"lang\": \"es-US\"\n}\n```\n\n### Using Returned Data\n\nThe Lambda response is automatically available in subsequent blocks:\n\n- **Set contact attributes**: Use `$.External.variableName`\n- **Play prompt**: Use `$.External.promptName`\n- **Check contact attributes**: Reference returned variables for routing decisions\n\n### Example Contact Flow Integration\n\n```\n[Get customer input] → [Invoke Lambda: GetConfig]\n ↓\n [Set contact attributes]\n ↓\n [Play prompt: $.External.welcomeMessage]\n ↓\n [Route based on: $.External.routingMode]\n```\n\n### Size Considerations\n\n- Amazon Connect has a Lambda response size limit of 32KB\n- The combined size of returned variables and prompts should be less than this limit\n- For large flow configs with many prompts or languages, consider implementing pagination or selective loading\n\n### Logger\n\n[Lambda PowerTools Logger](https://docs.powertools.aws.dev/lambda/typescript/latest/core/logger/) provides a lightweight logger implementation with JSON output.\n\nTips:\n\n- Use the `appendKeys()` method to add `ContactId` to your connect log lambda output.\n\n### Open API Spec\n\nThis template defines an Open API Spec for the API GW Lambdas. This allows use to generate a TypeScript api client to be used by the frontend app. We can also generate a API client in any language from the same spec to allow the client to better integrate with our apps.\n\n- [constructs/aws-openapigateway-lambda](https://docs.aws.amazon.com/solutions/latest/constructs/aws-openapigateway-lambda.html)\n- [OpenAPI Editor](https://marketplace.visualstudio.com/items?itemName=42Crunch.vscode-openapi)\n- [OpenApy TypeScript Generator](https://openapi-ts.pages.dev/introduction)\n\n## Development\n\n### Frontend Development\n\nThe frontend React application integrates with Amazon Connect Agent Workspace using the Connect SDK:\n\n```bash\n# Start local development server\nnpm start\n\n# Build for production\nnpm run build\n```\n\nFor local development, point your Amazon Connect third-party app configuration to `localhost:3000`. The application requires execution within Agent Workspace for Connect SDK functionality.\n\n### Lambda Development\n\nLambda functions are bundled automatically during the build process:\n\n```bash\n# Bundle Lambda functions\nnpm run build:lambdas\n\n# Full build (CDK + Frontend + Lambdas)\nnpm run build\n```\n"
3988
3988
  },
3989
3989
  "repository": {
3990
3990
  "type": "git",
@@ -4005,6 +4005,56 @@
4005
4005
  }
4006
4006
  },
4007
4007
  "types": {
4008
+ "@cxbuilder/flow-config.ApiVpcConfig": {
4009
+ "assembly": "@cxbuilder/flow-config",
4010
+ "datatype": true,
4011
+ "docs": {
4012
+ "stability": "stable",
4013
+ "summary": "VPC configuration for API Gateway If provided, the API will be deployed in a private VPC."
4014
+ },
4015
+ "fqn": "@cxbuilder/flow-config.ApiVpcConfig",
4016
+ "kind": "interface",
4017
+ "locationInModule": {
4018
+ "filename": "infrastructure/FlowConfigStack.ts",
4019
+ "line": 42
4020
+ },
4021
+ "name": "ApiVpcConfig",
4022
+ "properties": [
4023
+ {
4024
+ "abstract": true,
4025
+ "docs": {
4026
+ "stability": "stable",
4027
+ "summary": "The VPC endpoint ID to use for the API."
4028
+ },
4029
+ "immutable": true,
4030
+ "locationInModule": {
4031
+ "filename": "infrastructure/FlowConfigStack.ts",
4032
+ "line": 50
4033
+ },
4034
+ "name": "vpcEndpointId",
4035
+ "type": {
4036
+ "primitive": "string"
4037
+ }
4038
+ },
4039
+ {
4040
+ "abstract": true,
4041
+ "docs": {
4042
+ "stability": "stable",
4043
+ "summary": "The VPC ID to use for the API."
4044
+ },
4045
+ "immutable": true,
4046
+ "locationInModule": {
4047
+ "filename": "infrastructure/FlowConfigStack.ts",
4048
+ "line": 46
4049
+ },
4050
+ "name": "vpcId",
4051
+ "type": {
4052
+ "primitive": "string"
4053
+ }
4054
+ }
4055
+ ],
4056
+ "symbolId": "infrastructure/FlowConfigStack:ApiVpcConfig"
4057
+ },
4008
4058
  "@cxbuilder/flow-config.CognitoConfig": {
4009
4059
  "assembly": "@cxbuilder/flow-config",
4010
4060
  "datatype": true,
@@ -4016,7 +4066,7 @@
4016
4066
  "kind": "interface",
4017
4067
  "locationInModule": {
4018
4068
  "filename": "infrastructure/FlowConfigStack.ts",
4019
- "line": 23
4069
+ "line": 24
4020
4070
  },
4021
4071
  "name": "CognitoConfig",
4022
4072
  "properties": [
@@ -4029,7 +4079,7 @@
4029
4079
  "immutable": true,
4030
4080
  "locationInModule": {
4031
4081
  "filename": "infrastructure/FlowConfigStack.ts",
4032
- "line": 29
4082
+ "line": 30
4033
4083
  },
4034
4084
  "name": "domain",
4035
4085
  "type": {
@@ -4044,7 +4094,7 @@
4044
4094
  "immutable": true,
4045
4095
  "locationInModule": {
4046
4096
  "filename": "infrastructure/FlowConfigStack.ts",
4047
- "line": 24
4097
+ "line": 25
4048
4098
  },
4049
4099
  "name": "userPoolId",
4050
4100
  "type": {
@@ -4061,7 +4111,7 @@
4061
4111
  "immutable": true,
4062
4112
  "locationInModule": {
4063
4113
  "filename": "infrastructure/FlowConfigStack.ts",
4064
- "line": 34
4114
+ "line": 35
4065
4115
  },
4066
4116
  "name": "ssoProviderName",
4067
4117
  "optional": true,
@@ -4085,7 +4135,7 @@
4085
4135
  },
4086
4136
  "locationInModule": {
4087
4137
  "filename": "infrastructure/FlowConfigStack.ts",
4088
- "line": 142
4138
+ "line": 162
4089
4139
  },
4090
4140
  "parameters": [
4091
4141
  {
@@ -4111,7 +4161,7 @@
4111
4161
  "kind": "class",
4112
4162
  "locationInModule": {
4113
4163
  "filename": "infrastructure/FlowConfigStack.ts",
4114
- "line": 117
4164
+ "line": 138
4115
4165
  },
4116
4166
  "methods": [
4117
4167
  {
@@ -4121,7 +4171,7 @@
4121
4171
  },
4122
4172
  "locationInModule": {
4123
4173
  "filename": "infrastructure/FlowConfigStack.ts",
4124
- "line": 233
4174
+ "line": 288
4125
4175
  },
4126
4176
  "name": "associate3pApp"
4127
4177
  },
@@ -4131,7 +4181,7 @@
4131
4181
  },
4132
4182
  "locationInModule": {
4133
4183
  "filename": "infrastructure/FlowConfigStack.ts",
4134
- "line": 205
4184
+ "line": 228
4135
4185
  },
4136
4186
  "name": "createUserPoolClient",
4137
4187
  "returns": {
@@ -4139,6 +4189,17 @@
4139
4189
  "fqn": "aws-cdk-lib.aws_cognito.UserPoolClient"
4140
4190
  }
4141
4191
  }
4192
+ },
4193
+ {
4194
+ "docs": {
4195
+ "stability": "stable",
4196
+ "summary": "Create Cognito User Groups for role-based access control."
4197
+ },
4198
+ "locationInModule": {
4199
+ "filename": "infrastructure/FlowConfigStack.ts",
4200
+ "line": 256
4201
+ },
4202
+ "name": "createUserPoolGroups"
4142
4203
  }
4143
4204
  ],
4144
4205
  "name": "FlowConfigStack",
@@ -4150,7 +4211,7 @@
4150
4211
  "immutable": true,
4151
4212
  "locationInModule": {
4152
4213
  "filename": "infrastructure/FlowConfigStack.ts",
4153
- "line": 137
4214
+ "line": 158
4154
4215
  },
4155
4216
  "name": "appUrl",
4156
4217
  "type": {
@@ -4163,7 +4224,7 @@
4163
4224
  },
4164
4225
  "locationInModule": {
4165
4226
  "filename": "infrastructure/FlowConfigStack.ts",
4166
- "line": 121
4227
+ "line": 142
4167
4228
  },
4168
4229
  "name": "alertTopic",
4169
4230
  "type": {
@@ -4176,7 +4237,7 @@
4176
4237
  },
4177
4238
  "locationInModule": {
4178
4239
  "filename": "infrastructure/FlowConfigStack.ts",
4179
- "line": 145
4240
+ "line": 165
4180
4241
  },
4181
4242
  "name": "props",
4182
4243
  "type": {
@@ -4189,7 +4250,7 @@
4189
4250
  },
4190
4251
  "locationInModule": {
4191
4252
  "filename": "infrastructure/FlowConfigStack.ts",
4192
- "line": 122
4253
+ "line": 143
4193
4254
  },
4194
4255
  "name": "table",
4195
4256
  "type": {
@@ -4202,7 +4263,7 @@
4202
4263
  },
4203
4264
  "locationInModule": {
4204
4265
  "filename": "infrastructure/FlowConfigStack.ts",
4205
- "line": 118
4266
+ "line": 139
4206
4267
  },
4207
4268
  "name": "userPool",
4208
4269
  "type": {
@@ -4215,7 +4276,7 @@
4215
4276
  },
4216
4277
  "locationInModule": {
4217
4278
  "filename": "infrastructure/FlowConfigStack.ts",
4218
- "line": 120
4279
+ "line": 141
4219
4280
  },
4220
4281
  "name": "userPoolClient",
4221
4282
  "type": {
@@ -4238,7 +4299,7 @@
4238
4299
  "kind": "interface",
4239
4300
  "locationInModule": {
4240
4301
  "filename": "infrastructure/FlowConfigStack.ts",
4241
- "line": 88
4302
+ "line": 98
4242
4303
  },
4243
4304
  "name": "FlowConfigStackProps",
4244
4305
  "properties": [
@@ -4251,7 +4312,7 @@
4251
4312
  "immutable": true,
4252
4313
  "locationInModule": {
4253
4314
  "filename": "infrastructure/FlowConfigStack.ts",
4254
- "line": 99
4315
+ "line": 110
4255
4316
  },
4256
4317
  "name": "alertEmails",
4257
4318
  "type": {
@@ -4271,7 +4332,7 @@
4271
4332
  "immutable": true,
4272
4333
  "locationInModule": {
4273
4334
  "filename": "infrastructure/FlowConfigStack.ts",
4274
- "line": 93
4335
+ "line": 104
4275
4336
  },
4276
4337
  "name": "cognito",
4277
4338
  "type": {
@@ -4286,7 +4347,7 @@
4286
4347
  "immutable": true,
4287
4348
  "locationInModule": {
4288
4349
  "filename": "infrastructure/FlowConfigStack.ts",
4289
- "line": 94
4350
+ "line": 105
4290
4351
  },
4291
4352
  "name": "connectInstanceArn",
4292
4353
  "type": {
@@ -4296,19 +4357,56 @@
4296
4357
  {
4297
4358
  "abstract": true,
4298
4359
  "docs": {
4360
+ "example": "`cxbuilder-flow-config`",
4361
+ "remarks": "Will also be the name of the Connect Lambda",
4299
4362
  "stability": "stable",
4300
4363
  "summary": "Used for resource naming."
4301
4364
  },
4302
4365
  "immutable": true,
4303
4366
  "locationInModule": {
4304
4367
  "filename": "infrastructure/FlowConfigStack.ts",
4305
- "line": 92
4368
+ "line": 103
4306
4369
  },
4307
4370
  "name": "prefix",
4308
4371
  "type": {
4309
4372
  "primitive": "string"
4310
4373
  }
4311
4374
  },
4375
+ {
4376
+ "abstract": true,
4377
+ "docs": {
4378
+ "stability": "stable",
4379
+ "summary": "If provided, the API will be deployed in a VPC."
4380
+ },
4381
+ "immutable": true,
4382
+ "locationInModule": {
4383
+ "filename": "infrastructure/FlowConfigStack.ts",
4384
+ "line": 116
4385
+ },
4386
+ "name": "apiVpcConfig",
4387
+ "optional": true,
4388
+ "type": {
4389
+ "fqn": "@cxbuilder/flow-config.ApiVpcConfig"
4390
+ }
4391
+ },
4392
+ {
4393
+ "abstract": true,
4394
+ "docs": {
4395
+ "default": "true",
4396
+ "stability": "stable",
4397
+ "summary": "Set to false to remove CXBuilder branding from the web app."
4398
+ },
4399
+ "immutable": true,
4400
+ "locationInModule": {
4401
+ "filename": "infrastructure/FlowConfigStack.ts",
4402
+ "line": 135
4403
+ },
4404
+ "name": "branding",
4405
+ "optional": true,
4406
+ "type": {
4407
+ "primitive": "boolean"
4408
+ }
4409
+ },
4312
4410
  {
4313
4411
  "abstract": true,
4314
4412
  "docs": {
@@ -4319,7 +4417,7 @@
4319
4417
  "immutable": true,
4320
4418
  "locationInModule": {
4321
4419
  "filename": "infrastructure/FlowConfigStack.ts",
4322
- "line": 114
4420
+ "line": 129
4323
4421
  },
4324
4422
  "name": "globalTable",
4325
4423
  "optional": true,
@@ -4330,35 +4428,35 @@
4330
4428
  {
4331
4429
  "abstract": true,
4332
4430
  "docs": {
4333
- "stability": "stable"
4431
+ "remarks": "Note: VPC should contain endpoints to: CloudFormation, Lambda, DynamoDB, SNS, and Polly.",
4432
+ "stability": "stable",
4433
+ "summary": "If provided, the Lambda functions will be deployed in a VPC."
4334
4434
  },
4335
4435
  "immutable": true,
4336
4436
  "locationInModule": {
4337
4437
  "filename": "infrastructure/FlowConfigStack.ts",
4338
- "line": 100
4438
+ "line": 122
4339
4439
  },
4340
- "name": "prod",
4440
+ "name": "lambdaVpcConfig",
4341
4441
  "optional": true,
4342
4442
  "type": {
4343
- "primitive": "boolean"
4443
+ "fqn": "@cxbuilder/flow-config.LambdaVpcConfig"
4344
4444
  }
4345
4445
  },
4346
4446
  {
4347
4447
  "abstract": true,
4348
4448
  "docs": {
4349
- "remarks": "If provided, the application will be configured for VPC-only access.\nIf undefined, uses the current public configuration.",
4350
- "stability": "stable",
4351
- "summary": "VPC configuration for private deployment."
4449
+ "stability": "stable"
4352
4450
  },
4353
4451
  "immutable": true,
4354
4452
  "locationInModule": {
4355
4453
  "filename": "infrastructure/FlowConfigStack.ts",
4356
- "line": 107
4454
+ "line": 111
4357
4455
  },
4358
- "name": "vpc",
4456
+ "name": "prod",
4359
4457
  "optional": true,
4360
4458
  "type": {
4361
- "fqn": "@cxbuilder/flow-config.VpcConfig"
4459
+ "primitive": "boolean"
4362
4460
  }
4363
4461
  }
4364
4462
  ],
@@ -4375,7 +4473,7 @@
4375
4473
  "kind": "interface",
4376
4474
  "locationInModule": {
4377
4475
  "filename": "infrastructure/FlowConfigStack.ts",
4378
- "line": 65
4476
+ "line": 76
4379
4477
  },
4380
4478
  "name": "GlobalTableConfig",
4381
4479
  "properties": [
@@ -4388,7 +4486,7 @@
4388
4486
  "immutable": true,
4389
4487
  "locationInModule": {
4390
4488
  "filename": "infrastructure/FlowConfigStack.ts",
4391
- "line": 69
4489
+ "line": 80
4392
4490
  },
4393
4491
  "name": "isPrimaryRegion",
4394
4492
  "type": {
@@ -4404,7 +4502,7 @@
4404
4502
  "immutable": true,
4405
4503
  "locationInModule": {
4406
4504
  "filename": "infrastructure/FlowConfigStack.ts",
4407
- "line": 75
4505
+ "line": 86
4408
4506
  },
4409
4507
  "name": "replicaRegions",
4410
4508
  "optional": true,
@@ -4420,20 +4518,20 @@
4420
4518
  ],
4421
4519
  "symbolId": "infrastructure/FlowConfigStack:GlobalTableConfig"
4422
4520
  },
4423
- "@cxbuilder/flow-config.VpcConfig": {
4521
+ "@cxbuilder/flow-config.LambdaVpcConfig": {
4424
4522
  "assembly": "@cxbuilder/flow-config",
4425
4523
  "datatype": true,
4426
4524
  "docs": {
4427
4525
  "stability": "stable",
4428
- "summary": "VPC configuration for private deployment using string IDs."
4526
+ "summary": "Lambda VPC configuration."
4429
4527
  },
4430
- "fqn": "@cxbuilder/flow-config.VpcConfig",
4528
+ "fqn": "@cxbuilder/flow-config.LambdaVpcConfig",
4431
4529
  "kind": "interface",
4432
4530
  "locationInModule": {
4433
4531
  "filename": "infrastructure/FlowConfigStack.ts",
4434
- "line": 40
4532
+ "line": 56
4435
4533
  },
4436
- "name": "VpcConfig",
4534
+ "name": "LambdaVpcConfig",
4437
4535
  "properties": [
4438
4536
  {
4439
4537
  "abstract": true,
@@ -4444,9 +4542,9 @@
4444
4542
  "immutable": true,
4445
4543
  "locationInModule": {
4446
4544
  "filename": "infrastructure/FlowConfigStack.ts",
4447
- "line": 49
4545
+ "line": 65
4448
4546
  },
4449
- "name": "lambdaSecurityGroupIds",
4547
+ "name": "securityGroupIds",
4450
4548
  "type": {
4451
4549
  "collection": {
4452
4550
  "elementtype": {
@@ -4465,30 +4563,9 @@
4465
4563
  "immutable": true,
4466
4564
  "locationInModule": {
4467
4565
  "filename": "infrastructure/FlowConfigStack.ts",
4468
- "line": 54
4469
- },
4470
- "name": "privateSubnetIds",
4471
- "type": {
4472
- "collection": {
4473
- "elementtype": {
4474
- "primitive": "string"
4475
- },
4476
- "kind": "array"
4477
- }
4478
- }
4479
- },
4480
- {
4481
- "abstract": true,
4482
- "docs": {
4483
- "stability": "stable",
4484
- "summary": "Security group IDs for VPC endpoints."
4485
- },
4486
- "immutable": true,
4487
- "locationInModule": {
4488
- "filename": "infrastructure/FlowConfigStack.ts",
4489
- "line": 59
4566
+ "line": 70
4490
4567
  },
4491
- "name": "vpcEndpointSecurityGroupIds",
4568
+ "name": "subnetIds",
4492
4569
  "type": {
4493
4570
  "collection": {
4494
4571
  "elementtype": {
@@ -4507,7 +4584,7 @@
4507
4584
  "immutable": true,
4508
4585
  "locationInModule": {
4509
4586
  "filename": "infrastructure/FlowConfigStack.ts",
4510
- "line": 44
4587
+ "line": 60
4511
4588
  },
4512
4589
  "name": "vpcId",
4513
4590
  "type": {
@@ -4515,9 +4592,9 @@
4515
4592
  }
4516
4593
  }
4517
4594
  ],
4518
- "symbolId": "infrastructure/FlowConfigStack:VpcConfig"
4595
+ "symbolId": "infrastructure/FlowConfigStack:LambdaVpcConfig"
4519
4596
  }
4520
4597
  },
4521
- "version": "1.0.2",
4522
- "fingerprint": "w9Ycg9k4gI4a60byR9Aq9YQSosFtZL/sCppEdcuzvDU="
4598
+ "version": "2.0.0",
4599
+ "fingerprint": "mEFp1ROr+Au/ufIID0Esh7NWFl2JNdCBQ+JSyXCGr3o="
4523
4600
  }
package/CHANGELOG.md CHANGED
@@ -5,6 +5,44 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.0.0] - 2025-07-16
9
+
10
+ - Add an admin page where users can select available locale an available voice ids.
11
+ - Add ability to import/export configs
12
+ - Fix Private API GW URL
13
+ - Sort flows/prompts/variables by name
14
+ - Add ability to remove CXBuilder branding from frontend
15
+
16
+ ### v2.0.0 Breaking Changes
17
+
18
+ - Changed DDB from `Table` to `TableV2` to better support ACGR
19
+ - Mitigation: **Backup existing Flow Config table and delete it. Deploy the new version of the app. Restore your table backup.**
20
+ - Removed the `-get-config` suffix from the Amazon Connect lambda to reduce function name length. Lambda name now matches the app prefix.
21
+ - Mitigation: Update your flows accordingly
22
+ - Use `event.Details.ContactData.LanguageCode` instead of `event.Details.ContactData.Attributes.lang`
23
+ - Mitigation: take advantage fo the LanguageCode feature instead of using a `lang` attribute
24
+ - The `lang` parameter is still available for backwards compatibility - will be removed in a future version
25
+ - Split VPC configuration parameters into: `apiVpcConfig` and `lambdaVpcConfig`
26
+ - Mitigation: migrate to the new props
27
+
28
+ ## [1.1.0] - 2025-06-23
29
+
30
+ ### Added
31
+
32
+ - Role-based access control (RBAC) using Amazon Cognito User Groups
33
+ - Three permission levels: FlowConfigAdmin, FlowConfigEdit, and FlowConfigRead
34
+ - Backend permission validation for all API endpoints
35
+ - Frontend UI adapts based on user permissions
36
+ - Read-only mode for users without edit access
37
+ - Access denied screen for users without any FlowConfig permissions
38
+
39
+ ### Changed
40
+
41
+ - Replaced placeholder permission system with full Cognito Groups implementation
42
+ - FlowConfigEdit users can add languages to prompts but cannot remove existing ones
43
+ - FlowConfigEdit users can add/remove channels but cannot modify structure
44
+ - Preview functionality remains available to all permission levels
45
+
8
46
  ## [1.0.2] - 2025-06-20
9
47
 
10
48
  - Converted to `SpecRestApi` because `@aws-solutions-constructs/aws-openapigateway-lambda` is not compatible with `Role.customizeRoles`
package/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # @cxbuilder/flow-config
2
2
 
3
+ [![CI/CD Pipeline](https://github.com/cxbuilder/flow-config/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/cxbuilder/flow-config/actions/workflows/ci-cd.yml)
4
+ [![npm version](https://badge.fury.io/js/@cxbuilder%2Fflow-config.svg)](https://badge.fury.io/js/@cxbuilder%2Fflow-config)
5
+ [![PyPI version](https://badge.fury.io/py/cxbuilder-flow-config.svg)](https://badge.fury.io/py/cxbuilder-flow-config)
6
+ [![View on Construct Hub](https://constructs.dev/badge?package=%40cxbuilder%2Fflow-config)](https://constructs.dev/packages/@cxbuilder/flow-config)
7
+
3
8
  AWS CDK constructs for Amazon Connect FlowConfig - a third-party app for configuring variables and prompts in Connect contact flows.
4
9
 
5
10
  ## Links
@@ -162,9 +167,7 @@ The Lambda function handles Amazon Connect Contact Flow events with the followin
162
167
  },
163
168
  "ContactData": {
164
169
  "Channel": "VOICE",
165
- "Attributes": {
166
- "lang": "en-US"
167
- }
170
+ "LanguageCode": "en-US"
168
171
  }
169
172
  }
170
173
  }
@@ -180,7 +183,7 @@ The Lambda function handles Amazon Connect Contact Flow events with the followin
180
183
  2. **Optional Language Selection** (in order of precedence):
181
184
 
182
185
  - `Details.Parameters.lang` (highest priority)
183
- - `Details.ContactData.Attributes.lang`
186
+ - `Details.ContactData.LanguageCode`
184
187
  - Defaults to `"en-US"`
185
188
 
186
189
  3. **Channel Detection**:
@@ -227,7 +230,7 @@ For direct testing or non-Connect invocation:
227
230
  ### Setting Up in Contact Flow
228
231
 
229
232
  1. **Add "Invoke AWS Lambda function" block** to your contact flow
230
- 2. **Select the GetConfig Lambda function** (deployed as `${prefix}-get-config`)
233
+ 2. **Select the GetConfig Lambda function** (deployed as `${prefix}`)
231
234
  3. **Configure parameters**:
232
235
 
233
236
  ```json