Files
moreminimore-chat/app/javascript/shared/store/globalConfig.js
Muhsin Keloth 950d871830 fix(meta): add independent incident runtime controls (#15318)
This restores the temporary Meta incident safeguards with two
independent runtime controls for Chatwoot Cloud. Super admins can now
re-enable Instagram messaging first and keep new Meta inbox creation
disabled until onboarding is stable.

When messaging is disabled, Instagram conversations show the incident
notice and remain in private-note mode. The separate inbox-creation
control disables Facebook, Instagram, and WhatsApp Embedded Signup entry
points. Self-hosted installations remain unchanged.

Related: https://github.com/chatwoot/chatwoot/pull/15210
Related: https://status.chatwoot.com/incident/976975

### Things to know

- `DISABLE_META_MESSAGE_SENDING` affects Instagram messaging only.
- `DISABLE_META_INBOX_CREATION` affects Facebook, Instagram, and
WhatsApp Embedded Signup inbox creation.
- Both controls default to `true` for the active incident and are
editable from Super Admin installation configs.
- The Cloud-only boundary is enforced by the dashboard configuration
getters.

### How to test

1. Open Super Admin → Installation Configs and set
`DISABLE_META_MESSAGE_SENDING` to `false`.
2. Reload an Instagram conversation and confirm the incident banner
disappears and the runtime restriction no longer forces private-note
mode.
3. Set the flag back to `true`, reload, and confirm the banner and
restriction return.
4. Set `DISABLE_META_INBOX_CREATION` to `false`, reload the Facebook,
Instagram, or WhatsApp Embedded Signup setup flow, and confirm
connection is enabled.
5. Set the flag back to `true`, reload, and confirm the incident notice
appears and connection is disabled.

---------

Co-authored-by: Muhsin <12408980+muhsin-k@users.noreply.github.com>
2026-08-04 15:13:59 +04:00

82 lines
2.5 KiB
JavaScript

import { parseBoolean } from '@chatwoot/utils';
import { resolveMaximumFileUploadSize } from 'shared/helpers/FileHelper';
const {
API_CHANNEL_NAME: apiChannelName,
API_CHANNEL_THUMBNAIL: apiChannelThumbnail,
APP_VERSION: appVersion,
AZURE_APP_ID: azureAppId,
BRAND_NAME: brandName,
CHATWOOT_INBOX_TOKEN: chatwootInboxToken,
CREATE_NEW_ACCOUNT_FROM_DASHBOARD: createNewAccountFromDashboard,
DIRECT_UPLOADS_ENABLED: directUploadsEnabled,
DISPLAY_MANIFEST: displayManifest,
GIT_SHA: gitSha,
MAXIMUM_FILE_UPLOAD_SIZE: maximumFileUploadSize,
HCAPTCHA_SITE_KEY: hCaptchaSiteKey,
INSTALLATION_NAME: installationName,
LOGO_THUMBNAIL: logoThumbnail,
LOGO: logo,
LOGO_DARK: logoDark,
PRIVACY_URL: privacyURL,
IS_ENTERPRISE: isEnterprise,
TERMS_URL: termsURL,
WIDGET_BRAND_URL: widgetBrandURL,
DISABLE_USER_PROFILE_UPDATE: disableUserProfileUpdate,
DISABLE_META_INBOX_CREATION: disableMetaInboxCreation,
DISABLE_META_MESSAGE_SENDING: disableMetaMessageSending,
DEPLOYMENT_ENV: deploymentEnv,
ACTIVE_PLATFORM_BANNERS: activePlatformBanners,
} = window.globalConfig || {};
const state = {
apiChannelName,
apiChannelThumbnail,
appVersion,
azureAppId,
brandName,
chatwootInboxToken,
deploymentEnv,
createNewAccountFromDashboard,
directUploadsEnabled: parseBoolean(directUploadsEnabled),
disableUserProfileUpdate: parseBoolean(disableUserProfileUpdate),
disableMetaInboxCreation: parseBoolean(disableMetaInboxCreation),
disableMetaMessageSending: parseBoolean(disableMetaMessageSending),
displayManifest,
gitSha,
maximumFileUploadSize: resolveMaximumFileUploadSize(maximumFileUploadSize),
hCaptchaSiteKey,
installationName,
logo,
logoDark,
logoThumbnail,
privacyURL,
termsURL,
widgetBrandURL,
isEnterprise: parseBoolean(isEnterprise),
activePlatformBanners: activePlatformBanners || [],
};
export const getters = {
get: $state => $state,
isOnChatwootCloud: $state => $state.deploymentEnv === 'cloud',
isMetaInboxCreationDisabled: $state =>
$state.deploymentEnv === 'cloud' && $state.disableMetaInboxCreation,
isMetaMessageSendingDisabled: $state =>
$state.deploymentEnv === 'cloud' && $state.disableMetaMessageSending,
isACustomBrandedInstance: $state => $state.installationName !== 'Chatwoot',
isAChatwootInstance: $state => $state.installationName === 'Chatwoot',
};
export const actions = {};
export const mutations = {};
export default {
namespaced: true,
state,
getters,
actions,
mutations,
};