@strata-ds/core 2.1.21 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -0
- package/dist/cli/postinstall.js +1 -1
- package/dist/cli/snapshot.js +7 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -259,6 +259,9 @@ Wrap your application's root component with `StrataProvider`. This provider mana
|
|
|
259
259
|
| `userDesignSystem` | `DesignSystemData` | Override design system data — useful for storybook, testing, or static mode. Takes precedence over `initialData`. |
|
|
260
260
|
| `onSyncError` | `(error: { code: number; message: string; source: string }) => void` | Callback invoked when a sync cycle fails. `code` is the HTTP status (0 for non-HTTP errors), `message` is a human-readable description, and `source` is `"cdn"` or `"sync"`. |
|
|
261
261
|
| `onSyncSuccess` | `(data: DesignSystemData) => void` | Callback invoked whenever a sync cycle succeeds with new data. |
|
|
262
|
+
| `reportUsage` | `boolean` | Whether to send non-sensitive usage telemetry to power "See It in the Wild" in the dashboard. Defaults to `true` in production. Set to `false` to opt out. |
|
|
263
|
+
| `appName` | `string` | Optional human-readable display name for your app in the Strata dashboard (e.g. `"Storefront Web"`). |
|
|
264
|
+
| `environment` | `string` | Override automatic environment detection (`"production"`, `"staging"`, `"development"`). Heartbeat is paused when set to `"development"`. |
|
|
262
265
|
|
|
263
266
|
```tsx
|
|
264
267
|
// app/layout.tsx (Next.js App Router)
|
|
@@ -307,6 +310,55 @@ Projects with `syncToken` set are only readable by clients that present the corr
|
|
|
307
310
|
</StrataProvider>
|
|
308
311
|
```
|
|
309
312
|
|
|
313
|
+
### Connected Apps Telemetry ("See It in the Wild")
|
|
314
|
+
|
|
315
|
+
By default in production environments, `<StrataProvider>` sends a lightweight telemetry heartbeat every 5 minutes to report active design system surface integrations.
|
|
316
|
+
|
|
317
|
+
#### What is "Connected Apps"?
|
|
318
|
+
"Connected Apps" (featured as "See It in the Wild" on your public project page and Settings dashboard) provides real-time visibility into which live applications are consuming your design system, their active SDK version, environment, and health status (`Live`, `Stale`, or `Dormant`).
|
|
319
|
+
|
|
320
|
+
#### Data Transmitted
|
|
321
|
+
The telemetry heartbeat contains **only** non-sensitive metadata:
|
|
322
|
+
- Application origin / hostname (e.g. `https://app.example.com`)
|
|
323
|
+
- Strata SDK version (e.g. `2.2.0`)
|
|
324
|
+
- Sync mode (`cdn`, `legacy`, `static`) and polling interval
|
|
325
|
+
- User Agent string (browser family)
|
|
326
|
+
- Optional `appName` prop value
|
|
327
|
+
|
|
328
|
+
#### How to Opt Out
|
|
329
|
+
To disable telemetry heartbeats entirely, set `reportUsage={false}`:
|
|
330
|
+
|
|
331
|
+
```tsx
|
|
332
|
+
<StrataProvider
|
|
333
|
+
syncEnabled={true}
|
|
334
|
+
projectId="YOUR_PROJECT_ID"
|
|
335
|
+
snapshotCdnBase="https://cdn.strata.charisol.io"
|
|
336
|
+
reportUsage={false}
|
|
337
|
+
>
|
|
338
|
+
{children}
|
|
339
|
+
</StrataProvider>
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
#### CLI Setup & Build-Time Registration
|
|
343
|
+
You can also initialize project configuration using `npx strata init`:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
npx strata init
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
This generates a `strata.json` configuration file:
|
|
350
|
+
|
|
351
|
+
```json
|
|
352
|
+
{
|
|
353
|
+
"projectId": "YOUR_PROJECT_ID",
|
|
354
|
+
"snapshotCdnBase": "https://cdn.strata.charisol.io",
|
|
355
|
+
"appName": "Storefront Web",
|
|
356
|
+
"reportUsage": true
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
When `strata.json` is present, the `@strata-ds/core` `postinstall` script automatically registers build-time presence for your application.
|
|
361
|
+
|
|
310
362
|
## Using Design System Components
|
|
311
363
|
|
|
312
364
|
`@strata-ds/core` provides dynamic access to your components defined in Strata.
|
package/dist/cli/postinstall.js
CHANGED
|
@@ -175,7 +175,7 @@ async function run() {
|
|
|
175
175
|
const headers = { 'Content-Type': 'application/json' };
|
|
176
176
|
if (syncToken)
|
|
177
177
|
headers['Authorization'] = `Bearer ${syncToken}`;
|
|
178
|
-
let sdkVersion = '2.
|
|
178
|
+
let sdkVersion = '2.2.0';
|
|
179
179
|
try {
|
|
180
180
|
const pkgPath = path.resolve(__dirname, '../../package.json');
|
|
181
181
|
if (fs.existsSync(pkgPath)) {
|
package/dist/cli/snapshot.js
CHANGED
|
@@ -173,13 +173,20 @@ async function runInit() {
|
|
|
173
173
|
const outputCss = (await askQuestion('Enter path to write CSS fallback file (default: ./src/styles/strata-fallbacks.css): ')) || './src/styles/strata-fallbacks.css';
|
|
174
174
|
const varsOnlyInput = await askQuestion('Only output variables in snapshot JSON? (Y/n): ');
|
|
175
175
|
const variablesOnly = varsOnlyInput.toLowerCase() !== 'n';
|
|
176
|
+
const appNameInput = await askQuestion('Enter Application Name (optional, e.g. "Storefront Web"): ');
|
|
177
|
+
const reportUsageInput = await askQuestion('Report usage telemetry to Strata Dashboard? (Y/n): ');
|
|
178
|
+
const reportUsage = reportUsageInput.toLowerCase() !== 'n';
|
|
176
179
|
const config = {
|
|
177
180
|
projectId,
|
|
178
181
|
snapshotCdnBase: cdnBase,
|
|
179
182
|
output,
|
|
180
183
|
outputCss,
|
|
181
184
|
variablesOnly,
|
|
185
|
+
reportUsage,
|
|
182
186
|
};
|
|
187
|
+
if (appNameInput) {
|
|
188
|
+
config.appName = appNameInput;
|
|
189
|
+
}
|
|
183
190
|
const strataJsonPath = path.join(process.cwd(), 'strata.json');
|
|
184
191
|
fs.writeFileSync(strataJsonPath, JSON.stringify(config, null, 2), 'utf8');
|
|
185
192
|
console.log(`\nConfig file written successfully to: ${strataJsonPath}`);
|
package/dist/index.esm.js
CHANGED
|
@@ -1166,7 +1166,7 @@ var HeartbeatReporter = /*#__PURE__*/function () {
|
|
|
1166
1166
|
if (this.config.syncToken) {
|
|
1167
1167
|
headers["Authorization"] = "Bearer ".concat(this.config.syncToken);
|
|
1168
1168
|
}
|
|
1169
|
-
version = "2.1
|
|
1169
|
+
version = "2.2.1" ;
|
|
1170
1170
|
body = {
|
|
1171
1171
|
origin: window.location.origin,
|
|
1172
1172
|
sdkVersion: version,
|
package/dist/index.js
CHANGED
|
@@ -1168,7 +1168,7 @@ var HeartbeatReporter = /*#__PURE__*/function () {
|
|
|
1168
1168
|
if (this.config.syncToken) {
|
|
1169
1169
|
headers["Authorization"] = "Bearer ".concat(this.config.syncToken);
|
|
1170
1170
|
}
|
|
1171
|
-
version = "2.1
|
|
1171
|
+
version = "2.2.1" ;
|
|
1172
1172
|
body = {
|
|
1173
1173
|
origin: window.location.origin,
|
|
1174
1174
|
sdkVersion: version,
|