diff --git a/README.md b/README.md index 63a9ee5..3a7c164 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ You can find more information here. https://support.bigcommerce.com/s/article/St ? What is the Client ID? xxxxxxxxxxxxx ? What is the Access Token? xxxxxxxxxxxxx ? What is the API Path? https://api.bigcommerce.com/stores/xxxxx/v3/ +? What is the Channel ID or ID\'s you would like to publish your widgets to? Seperate channel ID\'s with comma.? (1,2,3,4) [2021-09-08T15:12:40.271Z] Successfully created your configuration, you're all set! ``` ### Resetting configurations diff --git a/src/cli/run/init.ts b/src/cli/run/init.ts index bdd78c1..90c6c90 100644 --- a/src/cli/run/init.ts +++ b/src/cli/run/init.ts @@ -34,6 +34,12 @@ const configQuestionnaire = [ }); }, }, + { + type: 'input', + name: 'channelId', + message: `What is the Channel ID or ID's you would like to publish your widgets to? + Seperate channel ID's with comma.`, + }, ]; const init = () => { diff --git a/src/services/auth/generate.test.ts b/src/services/auth/generate.test.ts index f2c9c33..24dd10d 100644 --- a/src/services/auth/generate.test.ts +++ b/src/services/auth/generate.test.ts @@ -11,12 +11,13 @@ const config = { clientId: 'someClientId', accessToken: 'sometokenvalue', apiPath: 'https://api.bigcommerce.com/stores/storeHash/v3/', + channelId: 'someString', }; const configuration = ` WIDGET_BUILDER_AUTH_ID=${config.clientId} WIDGET_BUILDER_AUTH_TOKEN=${config.accessToken} -WIDGET_BUILDER_CHANNEL_ID=1 +WIDGET_BUILDER_CHANNEL_ID=${config.channelId} WIDGET_BUILDER_API_GATEWAY_BASE=${config.apiPath.replace(/\/$/, '')} `; diff --git a/src/services/auth/generate.ts b/src/services/auth/generate.ts index 76fb415..d2613af 100644 --- a/src/services/auth/generate.ts +++ b/src/services/auth/generate.ts @@ -9,16 +9,17 @@ interface EnvironmentInterface { clientId: string; accessToken: string; apiPath: string; + channelId: string; } const generateConfig = ({ - clientId, accessToken, apiPath, + clientId, accessToken, channelId, apiPath, }: EnvironmentInterface) => { const dir = resolve('.'); const configuration = ` WIDGET_BUILDER_AUTH_ID=${clientId} WIDGET_BUILDER_AUTH_TOKEN=${accessToken} -WIDGET_BUILDER_CHANNEL_ID=1 +WIDGET_BUILDER_CHANNEL_ID=${channelId} WIDGET_BUILDER_API_GATEWAY_BASE=${apiPath.replace(/\/$/, '')} `;