diff --git a/README.md b/README.md index 37ec1c4..bbefee0 100644 --- a/README.md +++ b/README.md @@ -137,13 +137,13 @@ Never pass raw internal IDs from the client. ### `` -| Prop | Type | Required | Description | -| -------------- | ----------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | -| `clientKey` | `string` | ✅ | Project client key. | -| `clientSecret` | `string` | ✅ | Project bearer token. | -| `environment` | `"production"` \| `"staging"` \| `string` | | Default `"production"`. Pass any custom URL to point at a self-hosted loader. | -| `dataLayer` | `string` | | Default `"stromCom"`. The global JS variable name. Change it if `stromCom` collides with something else on the page. | -| `language` | `string` | | Initial UI language (e.g. `"cs"`, `"en"`, `"sk"`). Omit to auto-detect from the browser. To change it at runtime, use ``. | +| Prop | Type | Required | Description | +| -------------- | ----------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `clientKey` | `string` | ✅ | Project client key. | +| `clientSecret` | `string` | ✅ | Project bearer token. | +| `environment` | `"production"` \| `"staging"` \| `string` | | Default `"production"`. Pass any custom URL to point at a self-hosted loader. | +| `dataLayer` | `string` | | Default `"stromCom"`. The global JS variable name. Change it if `stromCom` collides with something else on the page. | +| `language` | `string` | | Initial UI language (e.g. `"cs"`, `"en"`, `"sk"`). Any code is accepted; one without a translation falls back to the browser language, then English. Omit to auto-detect from the browser. To change it at runtime, use ``. | ### `` @@ -185,15 +185,15 @@ Sends SDK configuration. Place once inside the provider, before threads. Notable options: -| Prop | Type | Description | -| ----------------------------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -| `notificationRenderer` | `Function` | Custom notification rendering function. | -| `onNotification` | `Function` | Called when unread count changes. | -| `pageCSSPath` | `string` | CSS file URL injected into the widget iframe. | -| `notificationElementPosition` | `1\|2\|3\|4` | Icon position: 1=TL, 2=TR, 3=BR, 4=BL. | -| `language` | `"en"\|"cs"\|"sk"\|null` | UI language. `null` follows the browser, falling back to English. Overrides ``. | -| `theme` | `"stromcom-light"\|"stromcom-dark"\|null` | Theme. `null` follows browser preference. | -| `entityResolve` | `Function` | `async ({type, id}) => detail` — resolves business-entity detail (order, ticket…) for the message editor's chip hover-card. | +| Prop | Type | Description | +| ----------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `notificationRenderer` | `Function` | Custom notification rendering function. | +| `onNotification` | `Function` | Called when unread count changes. | +| `pageCSSPath` | `string` | CSS file URL injected into the widget iframe. | +| `notificationElementPosition` | `1\|2\|3\|4` | Icon position: 1=TL, 2=TR, 3=BR, 4=BL. | +| `language` | `string\|null` | UI language. Any code is accepted; one without a translation falls back to the browser language, then English. `null` follows the browser. Overrides ``. | +| `theme` | `"stromcom-light"\|"stromcom-dark"\|null` | Theme. `null` follows browser preference. | +| `entityResolve` | `Function` | `async ({type, id}) => detail` — resolves business-entity detail (order, ticket…) for the message editor's chip hover-card. | See [`src/StromcomConf.jsx`](./src/StromcomConf.jsx) for the full list. diff --git a/package.json b/package.json index 885c5b9..d054b8d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@stromcom/react-snippet", - "version": "0.2.0", + "version": "0.3.0", "description": "React integration for the STROMCOM chat widget. Loads the SDK, identifies users, and embeds threads as plain React components.", "keywords": [ "stromcom", diff --git a/src/StromcomConf.jsx b/src/StromcomConf.jsx index 9a83d9f..4ab571d 100644 --- a/src/StromcomConf.jsx +++ b/src/StromcomConf.jsx @@ -21,9 +21,10 @@ import { useStromcom } from './StromcomProvider.jsx'; * @param {Function} [props.homeBeforeRender] - Callback before notification center opens * @param {Function} [props.notificationElementBeforeRender]- Callback before notification icon renders * @param {Function} [props.notificationElementAfterRender] - Callback after notification icon renders - * @param {('en'|'cs'|'sk'|null)} [props.language] - UI language. null follows the browser, falling back to English. - * Overrides the `language` prop on StromcomProvider, which is only - * the initial value; this one can be changed at runtime. + * @param {(string|null)} [props.language] - UI language. Any code is accepted; one without a translation falls + * back to the browser language, then English. null follows the browser. Overrides the `language` + * prop on StromcomProvider, which is only the initial value; this one + * can be changed at runtime. * @param {('stromcom-light'|'stromcom-dark'|null)} [props.theme] - Theme. null follows browser preference. * @param {Function} [props.entityResolve] - async ({type, id}) => detail; resolves business-entity detail for the message editor's chip hover-card * diff --git a/src/index.d.ts b/src/index.d.ts index 6e84301..4f0109f 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -20,7 +20,8 @@ export interface StromcomProviderProps { /** `"production"`, `"staging"`, or a full custom loader URL. Default `"production"`. */ environment?: StromcomEnvironment; /** - * Initial UI language (e.g. `"cs"`, `"en"`, `"sk"`). Omit to auto-detect from the browser. + * Initial UI language (e.g. `"cs"`, `"en"`, `"sk"`). Any code is accepted; one without a + * translation falls back to the browser language, then English. Omit to auto-detect from the browser. * Use `StromcomConf`'s `language` prop to change it at runtime. */ language?: string; @@ -84,10 +85,11 @@ export interface StromcomConfOptions { notificationElementBeforeRender?: () => void | Promise; notificationElementAfterRender?: () => void; /** - * UI language, or `null` to follow the browser (falling back to English). + * UI language, or `null` to follow the browser. Any language code is accepted; + * one the widget has no translation for falls back to the browser language, then English. * Overrides `StromcomProviderProps.language`, which is only the initial value. */ - language?: 'en' | 'cs' | 'sk' | null; + language?: string | null; /** Theme: `"stromcom-light"`, `"stromcom-dark"`, or `null` to follow browser preference. */ theme?: 'stromcom-light' | 'stromcom-dark' | null; /** Resolves business-entity detail (order, ticket…) for the message editor's chip hover-card. */