Skip to content

Commit c142a44

Browse files
authored
Add support for configuring a base endpoint URL (#366)
1 parent b544ded commit c142a44

File tree

8 files changed

+282
-275
lines changed

8 files changed

+282
-275
lines changed

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -499,21 +499,20 @@ a React component tree.
499499

500500
The component takes the followings properties:
501501

502-
| Option | Type | Required | Default Value | Description |
503-
|-------------------------|--------------|----------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
504-
| `appId` | string | Yes | None | The ID of the application you set up on Croct. |
505-
| `debug` | boolean | No | `false` | If `true`, turns on debug mode, which logs helpful messages to the console. |
506-
| `track` | boolean | No | `true` | If `true`, enables the automatic event tracking on initialization. |
507-
| `clientId` | string | No | None | The ID of the client using the application. |
508-
| `token` | string\|null | No | None | The JWT token issued by Croct. If `null`, clears any token specified on previous calls. |
509-
| `userId` | string | No | None | The ID of the user logged into the application. Internally, the SDK will issue a token using the specified ID as the subject claim of the token. The `token` and `userId` options are mutually exclusive. |
510-
| `tokenScope` | string | No | `global` | Defines how the SDK should synchronize the token across multiple tabs, see [token scopes](#token-scopes) for more details. |
511-
| `eventMetadata` | JSON | No | None | Any additional information that may be useful to include as part of the event metadata. A common use case is to record the version of the application for future reference. |
512-
| `logger` | object | No | None | A custom logger to handle log messages. By default, all logs are suppressed. |
513-
| `urlSanitizer` | function | No | None | A function to sanitize URLs that allows removing sensitive information from URLs, such as tokens, that should not be sent to the platform. |
514-
| `trackerEndpointUrl` | string | No | None | The URL of the tracker service, used by Croct's development team for testing purposes. |
515-
| `evaluationEndpointUrl` | string | No | None | The URL of the evaluation service, used by Croct's development team for testing purposes. |
516-
| `bootstrapEndpointUrl` | string | No | None | The URL of the bootstrap service, used by Croct's development team for testing purposes. |
502+
| Option | Type | Required | Default Value | Description |
503+
|--------------------------|--------------|----------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
504+
| `appId` | string | Yes | None | The ID of the application you set up on Croct. |
505+
| `debug` | boolean | No | `false` | If `true`, turns on debug mode, which logs helpful messages to the console. |
506+
| `track` | boolean | No | `true` | If `true`, enables the automatic event tracking on initialization. |
507+
| `clientId` | string | No | None | The ID of the client using the application. |
508+
| `token` | string\|null | No | None | The JWT token issued by Croct. If `null`, clears any token specified on previous calls. |
509+
| `userId` | string | No | None | The ID of the user logged into the application. Internally, the SDK will issue a token using the specified ID as the subject claim of the token. The `token` and `userId` options are mutually exclusive. |
510+
| `tokenScope` | string | No | `global` | Defines how the SDK should synchronize the token across multiple tabs, see [token scopes](#token-scopes) for more details. |
511+
| `eventMetadata` | JSON | No | None | Any additional information that may be useful to include as part of the event metadata. A common use case is to record the version of the application for future reference. |
512+
| `logger` | object | No | None | A custom logger to handle log messages. By default, all logs are suppressed. |
513+
| `urlSanitizer` | function | No | None | A function to sanitize URLs that allows removing sensitive information from URLs, such as tokens, that should not be sent to the platform. |
514+
| `baseEndpointUrl` | string | No | None | The base URL to use for the API calls. By default, the SDK will use the production endpoint. |
515+
| `cidAssignerEndpointUrl` | string | No | None | The URL to use for the client ID assignment. By default, the SDK will use the production endpoint. |
517516

518517
#### Code Sample
519518

@@ -758,6 +757,7 @@ These are the currently supported options:
758757
| Option | Type | Required | Description |
759758
|----------------------------|--------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
760759
| `apiKey` | string | Yes | The private API key of the application. This is a private key that should never be exposed to the client-side. |
760+
| `baseEndpointUrl` | string | No | The base URL of the Evaluation API. Defaults to the production endpoint. |
761761
| `fallback` | JSON | No | The value returned when the evaluation fails. If not specified, the function will throw an exception in case of failures. |
762762
| `timeout` | number | No | The maximum evaluation time in milliseconds. Once reached, the evaluation will fail. |
763763
| `clientId` | string | No | A UUID v4 that uniquely identifies the client across multiple evaluations. You should generate this identifier on your server-side using a random, cryptographically secure generator and ensure it doesn't change throughout the user journey (e.g. store in cookies). If not specified, the evaluation will run in an anonymous context. |
@@ -809,6 +809,7 @@ These are the currently supported options:
809809
| Option | Type | Required | Description |
810810
|----------------------------|---------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
811811
| `apiKey` | string | Yes | The private API key of the application. This is a private key that should never be exposed to the client-side. |
812+
| `baseEndpointUrl` | string | No | The base URL of the Content API. Defaults to the production endpoint. |
812813
| `fallback` | JSON | No | The value returned when the fetch fails. If not specified, the function will throw an exception in case of failures. |
813814
| `static` | boolean | No | Whether to fetch the static content. If not specified, the function will fetch the dynamic content. |
814815
| `timeout` | number | No | The maximum fetch time in milliseconds. Once reached, the fetch will fail. |

0 commit comments

Comments
 (0)