@guideify/react 0.1.1 → 0.3.0

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/dist/index.cjs CHANGED
@@ -4,8 +4,12 @@
4
4
  var react = require('react');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
7
+ // ../shared/src/paths.ts
8
+ var DEFAULT_CDN_HOST = "https://cdn.guideify.in";
9
+ var LOADER_PATH = "/v1/loader.js";
10
+
7
11
  // ../snippet/src/index.ts
8
- var DEFAULT_CDN = "https://cdn.guideify.in";
12
+ var DEFAULT_CDN = DEFAULT_CDN_HOST;
9
13
  function isCore(candidate) {
10
14
  return typeof candidate?.on === "function";
11
15
  }
@@ -23,7 +27,7 @@ function installLoader(options) {
23
27
  const cdn = options.cdnHost ?? DEFAULT_CDN;
24
28
  const tag = document.createElement("script");
25
29
  tag.async = true;
26
- tag.src = `${cdn}/v1/loader.js`;
30
+ tag.src = `${cdn}${LOADER_PATH}`;
27
31
  tag.setAttribute("data-guideify-key", options.apiKey);
28
32
  if (options.cdnHost) tag.setAttribute("data-cdn", options.cdnHost);
29
33
  if (options.ingestHost) tag.setAttribute("data-ingest", options.ingestHost);
package/dist/index.d.cts CHANGED
@@ -186,6 +186,56 @@ interface Flow {
186
186
  dismissible?: boolean;
187
187
  steps: Step[];
188
188
  }
189
+ /**
190
+ * What marks a checklist item done.
191
+ *
192
+ * A flow this environment already publishes, or an event the customer already
193
+ * sends us — both of which exist before the checklist does. There is
194
+ * deliberately no third variant for "the user ticked it": the surface is only
195
+ * worth its corner of somebody's application if it reflects what has actually
196
+ * happened in the product, and a box you can tick yourself reports nothing.
197
+ */
198
+ type ChecklistItemGoal = {
199
+ type: 'flow';
200
+ flowId: string;
201
+ } | {
202
+ type: 'event';
203
+ name: string;
204
+ };
205
+ interface ChecklistItem {
206
+ id: string;
207
+ label: string;
208
+ /** Optional one-liner under the label. The renderer's document, not a string. */
209
+ body?: ContentNode;
210
+ goal: ChecklistItemGoal;
211
+ }
212
+ /**
213
+ * The persistent surface — BUILD_REPORT §8, J-02.
214
+ *
215
+ * **It carries no `trigger`, no `frequency` and no `priority`, and the three
216
+ * absences are the design.** A checklist is not triggered, it is present:
217
+ * `Trigger`'s five variants each describe a moment, which is precisely what
218
+ * this is not, and `Frequency` answers *how often does this fire* about
219
+ * something that never fires. It does not compete for the screen either — §8
220
+ * puts it outside the one-blocking-flow rule, so it never enters the sort that
221
+ * `priority` exists to break. Three fields pinned to a constant would each be a
222
+ * question the reader has to answer before discovering it was never asked.
223
+ *
224
+ * `audience` is the same `RuleNode` a flow takes, read by the same
225
+ * `evaluateRules`. Reusing the evaluator is what stops a second rule engine
226
+ * existing.
227
+ */
228
+ interface Checklist {
229
+ id: string;
230
+ name: string;
231
+ version: number;
232
+ audience?: RuleNode;
233
+ items: ChecklistItem[];
234
+ /** Where the launcher sits. The host app's other corner is usually taken. */
235
+ position?: 'bottom-end' | 'bottom-start';
236
+ /** Hidden once every item is done, which is the default a customer expects. */
237
+ dismissWhenComplete?: boolean;
238
+ }
189
239
  interface ThemeTokens {
190
240
  accent?: string;
191
241
  scrim?: string;
@@ -203,6 +253,21 @@ interface GuideifyConfig {
203
253
  envKey: string;
204
254
  flows: Flow[];
205
255
  settings?: ConfigSettings;
256
+ /**
257
+ * The one persistent surface this environment publishes, if it has one.
258
+ *
259
+ * **Singular, deliberately.** A corner of somebody else's application has
260
+ * room for one launcher; a list invites two of them fighting over the same
261
+ * 56 pixels, and nothing in this product could arbitrate between them.
262
+ *
263
+ * Additive with a safe default, which is the header's rule and is what makes
264
+ * it publishable to environments held on an older core by `sdkPin` (R-04): a
265
+ * core built before this field existed parses the artifact, ignores the key
266
+ * and runs its flows. `packages/sdk/test/checklist-config.test.mjs` pins
267
+ * that, because it is an accident of `validateConfig` until something asserts
268
+ * it.
269
+ */
270
+ checklist?: Checklist;
206
271
  }
207
272
  interface UserTraits {
208
273
  [key: string]: unknown;
@@ -297,7 +362,15 @@ interface SnippetOptions extends Pick<InitOptions, 'apiKey'> {
297
362
  */
298
363
  nonce?: string | undefined;
299
364
  }
300
- /** Where the loader lives when nothing says otherwise. Mirrors `loader.ts`. */
365
+ /**
366
+ * Where the loader lives when nothing says otherwise.
367
+ *
368
+ * Re-exported under this package's own name rather than renamed at the call
369
+ * site, because `@guideify/react` and `@guideify/vue` both re-export it again
370
+ * and it is public API in three places. The value is `@guideify/shared`'s —
371
+ * this used to say *mirrors `loader.ts`*, and a mirror is the thing T-110 was
372
+ * filed about.
373
+ */
301
374
  declare const DEFAULT_CDN = "https://cdn.guideify.in";
302
375
 
303
376
  interface GuideifyProviderProps extends SnippetOptions {
package/dist/index.d.ts CHANGED
@@ -186,6 +186,56 @@ interface Flow {
186
186
  dismissible?: boolean;
187
187
  steps: Step[];
188
188
  }
189
+ /**
190
+ * What marks a checklist item done.
191
+ *
192
+ * A flow this environment already publishes, or an event the customer already
193
+ * sends us — both of which exist before the checklist does. There is
194
+ * deliberately no third variant for "the user ticked it": the surface is only
195
+ * worth its corner of somebody's application if it reflects what has actually
196
+ * happened in the product, and a box you can tick yourself reports nothing.
197
+ */
198
+ type ChecklistItemGoal = {
199
+ type: 'flow';
200
+ flowId: string;
201
+ } | {
202
+ type: 'event';
203
+ name: string;
204
+ };
205
+ interface ChecklistItem {
206
+ id: string;
207
+ label: string;
208
+ /** Optional one-liner under the label. The renderer's document, not a string. */
209
+ body?: ContentNode;
210
+ goal: ChecklistItemGoal;
211
+ }
212
+ /**
213
+ * The persistent surface — BUILD_REPORT §8, J-02.
214
+ *
215
+ * **It carries no `trigger`, no `frequency` and no `priority`, and the three
216
+ * absences are the design.** A checklist is not triggered, it is present:
217
+ * `Trigger`'s five variants each describe a moment, which is precisely what
218
+ * this is not, and `Frequency` answers *how often does this fire* about
219
+ * something that never fires. It does not compete for the screen either — §8
220
+ * puts it outside the one-blocking-flow rule, so it never enters the sort that
221
+ * `priority` exists to break. Three fields pinned to a constant would each be a
222
+ * question the reader has to answer before discovering it was never asked.
223
+ *
224
+ * `audience` is the same `RuleNode` a flow takes, read by the same
225
+ * `evaluateRules`. Reusing the evaluator is what stops a second rule engine
226
+ * existing.
227
+ */
228
+ interface Checklist {
229
+ id: string;
230
+ name: string;
231
+ version: number;
232
+ audience?: RuleNode;
233
+ items: ChecklistItem[];
234
+ /** Where the launcher sits. The host app's other corner is usually taken. */
235
+ position?: 'bottom-end' | 'bottom-start';
236
+ /** Hidden once every item is done, which is the default a customer expects. */
237
+ dismissWhenComplete?: boolean;
238
+ }
189
239
  interface ThemeTokens {
190
240
  accent?: string;
191
241
  scrim?: string;
@@ -203,6 +253,21 @@ interface GuideifyConfig {
203
253
  envKey: string;
204
254
  flows: Flow[];
205
255
  settings?: ConfigSettings;
256
+ /**
257
+ * The one persistent surface this environment publishes, if it has one.
258
+ *
259
+ * **Singular, deliberately.** A corner of somebody else's application has
260
+ * room for one launcher; a list invites two of them fighting over the same
261
+ * 56 pixels, and nothing in this product could arbitrate between them.
262
+ *
263
+ * Additive with a safe default, which is the header's rule and is what makes
264
+ * it publishable to environments held on an older core by `sdkPin` (R-04): a
265
+ * core built before this field existed parses the artifact, ignores the key
266
+ * and runs its flows. `packages/sdk/test/checklist-config.test.mjs` pins
267
+ * that, because it is an accident of `validateConfig` until something asserts
268
+ * it.
269
+ */
270
+ checklist?: Checklist;
206
271
  }
207
272
  interface UserTraits {
208
273
  [key: string]: unknown;
@@ -297,7 +362,15 @@ interface SnippetOptions extends Pick<InitOptions, 'apiKey'> {
297
362
  */
298
363
  nonce?: string | undefined;
299
364
  }
300
- /** Where the loader lives when nothing says otherwise. Mirrors `loader.ts`. */
365
+ /**
366
+ * Where the loader lives when nothing says otherwise.
367
+ *
368
+ * Re-exported under this package's own name rather than renamed at the call
369
+ * site, because `@guideify/react` and `@guideify/vue` both re-export it again
370
+ * and it is public API in three places. The value is `@guideify/shared`'s —
371
+ * this used to say *mirrors `loader.ts`*, and a mirror is the thing T-110 was
372
+ * filed about.
373
+ */
301
374
  declare const DEFAULT_CDN = "https://cdn.guideify.in";
302
375
 
303
376
  interface GuideifyProviderProps extends SnippetOptions {
package/dist/index.js CHANGED
@@ -2,8 +2,12 @@
2
2
  import { createContext, useContext, useMemo, useState, useEffect, isValidElement, cloneElement } from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
+ // ../shared/src/paths.ts
6
+ var DEFAULT_CDN_HOST = "https://cdn.guideify.in";
7
+ var LOADER_PATH = "/v1/loader.js";
8
+
5
9
  // ../snippet/src/index.ts
6
- var DEFAULT_CDN = "https://cdn.guideify.in";
10
+ var DEFAULT_CDN = DEFAULT_CDN_HOST;
7
11
  function isCore(candidate) {
8
12
  return typeof candidate?.on === "function";
9
13
  }
@@ -21,7 +25,7 @@ function installLoader(options) {
21
25
  const cdn = options.cdnHost ?? DEFAULT_CDN;
22
26
  const tag = document.createElement("script");
23
27
  tag.async = true;
24
- tag.src = `${cdn}/v1/loader.js`;
28
+ tag.src = `${cdn}${LOADER_PATH}`;
25
29
  tag.setAttribute("data-guideify-key", options.apiKey);
26
30
  if (options.cdnHost) tag.setAttribute("data-cdn", options.cdnHost);
27
31
  if (options.ingestHost) tag.setAttribute("data-ingest", options.ingestHost);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guideify/react",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",