Skip to content

Commit

Permalink
Merged PR 35607: prepare azure chat configuration
Browse files Browse the repository at this point in the history
prepare azure chat configuration

Related work items: #129933
  • Loading branch information
RikSchefferAmsterdam committed Nov 5, 2024
2 parents 9376728 + eb63932 commit 1196eab
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 12 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module.exports = {
{
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
rules: {
'no-process-env': 'error',
'depend/ban-dependencies': 'warn',
'@typescript-eslint/no-empty-function': 'warn',
'react-hooks/exhaustive-deps': [
Expand Down
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const config: StorybookConfig = {
__DEV__: false,
// process.env is causing a conflict with immer (dependency of redux) and Vite requires us to fix it like so
'process.env': {
// eslint-disable-next-line no-process-env
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
},
},
Expand Down
12 changes: 12 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ module.exports = {
'APPLICATION_INSIGHTS_INSTRUMENTATION_KEY_TEST',
'APPLICATION_INSIGHTS_INSTRUMENTATION_KEY_ACC',
'APPLICATION_INSIGHTS_INSTRUMENTATION_KEY_PROD',
'CHAT_DEVELOPER_NAME_DEV',
'CHAT_ORGANIZATION_ID_DEV',
'CHAT_URL_DEV',
'CHAT_DEVELOPER_NAME_TEST',
'CHAT_ORGANIZATION_ID_TEST',
'CHAT_URL_TEST',
'CHAT_DEVELOPER_NAME_ACC',
'CHAT_ORGANIZATION_ID_ACC',
'CHAT_URL_ACC',
'CHAT_DEVELOPER_NAME_PROD',
'CHAT_ORGANIZATION_ID_PROD',
'CHAT_URL_PROD',
],
},
],
Expand Down
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Config} from 'jest'

// eslint-disable-next-line no-process-env
process.env.TZ = 'UTC+1'

const config: Config = {
Expand Down
6 changes: 6 additions & 0 deletions pipelines/templates/app-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,16 @@ steps:
FILTER_API_KEY_PROD: $(API_KEY_PROD)
CHAT_DEVELOPER_NAME_DEV: $(CHAT_DEVELOPER_NAME_DEV)
CHAT_DEVELOPER_NAME_TEST: $(CHAT_DEVELOPER_NAME_TEST)
CHAT_DEVELOPER_NAME_ACC: $(CHAT_DEVELOPER_NAME_ACC)
CHAT_DEVELOPER_NAME_PROD: $(CHAT_DEVELOPER_NAME_PROD)
CHAT_ORGANIZATION_ID_DEV: $(CHAT_ORGANIZATION_ID_DEV)
CHAT_ORGANIZATION_ID_TEST: $(CHAT_ORGANIZATION_ID_TEST)
CHAT_ORGANIZATION_ID_ACC: $(CHAT_ORGANIZATION_ID_ACC)
CHAT_ORGANIZATION_ID_PROD: $(CHAT_ORGANIZATION_ID_PROD)
CHAT_URL_DEV: $(CHAT_URL_DEV)
CHAT_URL_TEST: $(CHAT_URL_TEST)
CHAT_URL_ACC: $(CHAT_URL_ACC)
CHAT_URL_PROD: $(CHAT_URL_PROD)
# Handle artifacts
- template: ./copy-generic-artifacts.yml
Expand Down
12 changes: 12 additions & 0 deletions src/custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,16 @@ declare module '@env' {
export const APPLICATION_INSIGHTS_INSTRUMENTATION_KEY_TEST: string | undefined
export const APPLICATION_INSIGHTS_INSTRUMENTATION_KEY_ACC: string | undefined
export const APPLICATION_INSIGHTS_INSTRUMENTATION_KEY_PROD: string | undefined
export const CHAT_DEVELOPER_NAME_DEV: string | undefined
export const CHAT_ORGANIZATION_ID_DEV: string | undefined
export const CHAT_URL_DEV: string | undefined
export const CHAT_DEVELOPER_NAME_TEST: string | undefined
export const CHAT_ORGANIZATION_ID_TEST: string | undefined
export const CHAT_URL_TEST: string | undefined
export const CHAT_DEVELOPER_NAME_ACC: string | undefined
export const CHAT_ORGANIZATION_ID_ACC: string | undefined
export const CHAT_URL_ACC: string | undefined
export const CHAT_DEVELOPER_NAME_PROD: string | undefined
export const CHAT_ORGANIZATION_ID_PROD: string | undefined
export const CHAT_URL_PROD: string | undefined
}
38 changes: 26 additions & 12 deletions src/modules/chat/hooks/useCoreConfig.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
import {
CHAT_DEVELOPER_NAME_DEV,
CHAT_ORGANIZATION_ID_DEV,
CHAT_URL_DEV,
CHAT_DEVELOPER_NAME_TEST,
CHAT_ORGANIZATION_ID_TEST,
CHAT_URL_TEST,
CHAT_DEVELOPER_NAME_ACC,
CHAT_ORGANIZATION_ID_ACC,
CHAT_URL_ACC,
CHAT_DEVELOPER_NAME_PROD,
CHAT_ORGANIZATION_ID_PROD,
CHAT_URL_PROD,
} from '@env'
import {CoreConfig} from 'react-native-salesforce-messaging-in-app/src/types'
import {Environment} from '@/environment'
import {useSelector} from '@/hooks/redux/useSelector'
Expand All @@ -10,24 +24,24 @@ export const useCoreConfig = () => {
switch (environment) {
case Environment.development:
case Environment.custom:
config.developerName = process.env.CHAT_DEVELOPER_NAME_DEV ?? ''
config.organizationId = process.env.CHAT_ORGANIZATION_ID_DEV ?? ''
config.url = process.env.CHAT_URL_DEV ?? ''
config.developerName = CHAT_DEVELOPER_NAME_DEV ?? ''
config.organizationId = CHAT_ORGANIZATION_ID_DEV ?? ''
config.url = CHAT_URL_DEV ?? ''
break
case Environment.test:
config.developerName = process.env.CHAT_DEVELOPER_NAME_TEST ?? ''
config.organizationId = process.env.CHAT_ORGANIZATION_ID_TEST ?? ''
config.url = process.env.CHAT_URL_TEST ?? ''
config.developerName = CHAT_DEVELOPER_NAME_TEST ?? ''
config.organizationId = CHAT_ORGANIZATION_ID_TEST ?? ''
config.url = CHAT_URL_TEST ?? ''
break
case Environment.acceptance:
config.developerName = process.env.CHAT_DEVELOPER_NAME_ACC ?? ''
config.organizationId = process.env.CHAT_ORGANIZATION_ID_ACC ?? ''
config.url = process.env.CHAT_URL_ACC ?? ''
config.developerName = CHAT_DEVELOPER_NAME_ACC ?? ''
config.organizationId = CHAT_ORGANIZATION_ID_ACC ?? ''
config.url = CHAT_URL_ACC ?? ''
break
case Environment.production:
config.developerName = process.env.CHAT_DEVELOPER_NAME_PROD ?? ''
config.organizationId = process.env.CHAT_ORGANIZATION_ID_PROD ?? ''
config.url = process.env.CHAT_URL_PROD ?? ''
config.developerName = CHAT_DEVELOPER_NAME_PROD ?? ''
config.organizationId = CHAT_ORGANIZATION_ID_PROD ?? ''
config.url = CHAT_URL_PROD ?? ''
break
}

Expand Down

0 comments on commit 1196eab

Please sign in to comment.