Skip to content

Commit 9bd7014

Browse files
author
Adeola Adeyemo
committed
chore: add gif for options builder
Signed-off-by: Adeola Adeyemo <adeola.adeyemo@epilot.cloud>
1 parent bfb8e22 commit 9bd7014

4 files changed

Lines changed: 91 additions & 64 deletions

File tree

docs/journeys/embedding.md

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ export type DataInjectionOptions = {
5757
* - recommended: an object keyed by the block's stable, journey-wide id -> block value
5858
* - deprecated (legacy): an array indexed by step position, each entry keyed by block name
5959
* */
60-
initialState?: Record<string, Record<string, unknown>> | Record<string, unknown>[]
60+
initialState?:
61+
| Record<string, Record<string, unknown>>
62+
| Record<string, unknown>[]
6163
/** the display options to be passed to the journey, for now it is used to disable some fields */
6264
blocksDisplaySettings?: BlockDisplaySetting[]
6365
}
@@ -74,9 +76,7 @@ export type BlockDisplaySetting = {
7476
}
7577
```
7678
77-
The **recommended** form keys `initialState` by **block ID** — the block's stable, journey-wide identifier. Block IDs are unique across the whole journey and are unaffected by block renames or by reordering steps, so an embed keyed by block ID keeps working even after the journey is restructured. To find a block's ID, open the journey in **debug mode** (see video below) and copy the block IDs from the journey state.
78-
79-
![Journey Embed Mode](../../static/img/journey-debug-mode.gif)
79+
The **recommended** form keys `initialState` by **block ID** — the block's stable, journey-wide identifier. Block IDs are unique across the whole journey and are unaffected by block renames or by reordering steps, so an embed keyed by block ID keeps working even after the journey is restructured. To find a block's ID, open the block configurator in the Journey builder.
8080
8181
A complete example combines all three: start the journey at a step by its stable `initialStepId`, prefill `initialState` keyed by block ID, and disable a block by `blockId`. Pass `dataInjectionOptions` alongside the rest of the options in `__epilot.init()`:
8282
@@ -102,37 +102,39 @@ __epilot.init([
102102
])
103103
```
104104
105-
With the block-ID form you only list the blocks you actually want to prefill — there is no need to pad earlier steps with empty objects, and the mapping is unaffected by block renames or step reordering.
105+
With the block-ID form you only list the blocks you actually want to prefill — there is no need to pad earlier steps with empty objects, and the mapping is unaffected by block renames or step reordering. To find a block's ID, open the block configurator in the Journey builder.
106+
107+
### Data Injection builder (preview)
108+
109+
You don't have to hand-write block IDs. The Journey Builder includes a **Data Injection (preview)** tool that lets you build the configuration visually: pick the blocks and fields to prefill, set their pre-fill values, mark blocks as read-only, choose the starting step, then copy the generated snippet straight into your `__epilot.init()` call.
110+
111+
![Data injection preview builder](../../static/img/data-injection-demo.gif)
106112
107113
:::note Legacy step-index form (deprecated)
108114
109115
The earlier array form of `initialState` (one entry per step indexed by **step position**, keyed by block **name**, with empty `{}` objects for steps you don't prefill) and the `blockName` + `stepIndex` form of `blocksDisplaySettings` are **deprecated but still supported** for backward compatibility. They break silently when blocks are renamed or steps are reordered, so prefer the block-ID form for new integrations.
110116
111117
```typescript title="Injecting data by step index + block name (deprecated)"
112-
initialState: [
113-
{},
114-
{
115-
"Binary Input": false
118+
initialState: [
119+
{},
120+
{
121+
'Binary Input': false,
122+
},
123+
{
124+
'Personal Data Input': {
125+
salutation: 'Ms. / Mrs.',
126+
firstName: 'Test Name',
127+
_isValid: false,
116128
},
117-
{
118-
"Personal Data Input": {
119-
"salutation": "Ms. / Mrs.",
120-
"firstName": "Test Name",
121-
"_isValid": false
122-
}
123-
}
124-
]
129+
},
130+
]
125131
```
126132
127-
:::
128-
129-
### Data Injection builder (preview)
133+
Open your Journey in **debug mode** from the Journey Builder and inspect the state for each step. See below:
130134
131-
You don't have to hand-write block IDs. The Journey Builder includes a **Data Injection (preview)** tool that lets you build the configuration visually: pick the blocks and fields to prefill, set their pre-fill values, mark blocks as read-only, choose the starting step, then copy the generated snippet straight into your `__epilot.init()` call.
132-
133-
<!-- TODO: replace with recording -->
135+
![Journey Embed Mode](../../static/img/journey-debug-mode.gif)
134136
135-
![Data injection preview builder](../../static/img/journey-data-injection-builder.gif)
137+
:::
136138
137139
## Configuration Possibilities
138140

docs/journeys/sdk.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,9 @@ type DataInjectionOptions = {
507507
* - recommended: an object keyed by stable block id -> block value
508508
* - deprecated (legacy): an array indexed by step position, each entry keyed by block name
509509
*/
510-
initialState?: Record<string, Record<string, unknown>> | Record<string, unknown>[]
510+
initialState?:
511+
| Record<string, Record<string, unknown>>
512+
| Record<string, unknown>[]
511513
/** Control which blocks/fields are disabled */
512514
blocksDisplaySettings?: BlockDisplaySetting[]
513515
}
@@ -555,11 +557,13 @@ The same `.dataInjectionOptions({ ... })` call works with either backend — swa
555557
556558
### Populating `initialState`
557559
558-
The recommended form keys `initialState` by **block ID**. Each entry is an object of the field values for that block. Because the state is keyed by block ID, you only list the blocks you actually want to prefill — no per-step ordering or empty `{}` placeholders are needed, and the mapping is unaffected by block renames or step reordering.
560+
The recommended form keys `initialState` by **block ID**. Each entry is an object of the field values for that block. Because the state is keyed by block ID, you only list the blocks you actually want to prefill — no per-step ordering or empty `{}` placeholders are needed, and the mapping is unaffected by block renames or step reordering. To find a block's ID, open the block configurator in the Journey builder.
559561
560-
To discover the correct block IDs and field structure, open your Journey in **debug mode** from the Journey Builder and inspect the state for each step. See below:
562+
### Data Injection Options builder
561563
562-
![Journey Embed Mode](../../static/img/journey-debug-mode.gif)
564+
You don't have to hand-write block IDs. The Journey Builder includes a **Data Injection (preview)** tool that lets you build the configuration visually: pick the blocks and fields to prefill, set their pre-fill values, mark blocks as read-only, choose the starting step, then copy the generated options straight into your `.dataInjectionOptions()` call.
565+
566+
![Data injection preview builder](../../static/img/data-injection-demo.gif)
563567
564568
:::note Legacy step-index form (deprecated)
565569
@@ -572,23 +576,32 @@ $epilot
572576
.mode('inline')
573577
.dataInjectionOptions({
574578
initialStepIndex: 1,
575-
initialState: [{}, { 'Product Selection': { selectedProduct: 'solar-panel-basic', _isValid: true } }],
579+
initialState: [
580+
{},
581+
{
582+
'Product Selection': {
583+
selectedProduct: 'solar-panel-basic',
584+
_isValid: true,
585+
},
586+
},
587+
],
576588
blocksDisplaySettings: [
577-
{ type: 'DISABLED', blockName: 'Product Selection', stepIndex: 1, blockFields: ['selectedProduct'] },
589+
{
590+
type: 'DISABLED',
591+
blockName: 'Product Selection',
592+
stepIndex: 1,
593+
blockFields: ['selectedProduct'],
594+
},
578595
],
579596
})
580597
.append('#embed-target')
581598
```
582599
583-
:::
584-
585-
### Data Injection builder (preview)
600+
Open your Journey in **debug mode** from the Journey Builder and inspect the state for each step. See below:
586601
587-
You don't have to hand-write block IDs. The Journey Builder includes a **Data Injection (preview)** tool that lets you build the configuration visually: pick the blocks and fields to prefill, set their pre-fill values, mark blocks as read-only, choose the starting step, then copy the generated options straight into your `.dataInjectionOptions()` call.
588-
589-
<!-- TODO: replace with recording -->
602+
![Journey Embed Mode](../../static/img/journey-debug-mode.gif)
590603
591-
![Data injection preview builder](../../static/img/journey-data-injection-builder.gif)
604+
:::
592605
593606
## Events
594607

docs/journeys/web-components.md

Lines changed: 39 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,21 @@ The Journey will render inline on your page. Read on for the full attribute refe
6464

6565
All attributes are set as standard HTML attributes on the `<epilot-journey>` element. Boolean attributes accept `"true"` or `"false"` as string values.
6666

67-
| Attribute | Type | Default | Description |
68-
| ------------------------ | ----------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
69-
| `journey-id` | `string` || **Required.** The ID of the Journey to render. |
70-
| `mode` | `"inline"` \| `"full-screen"` | `"full-screen"` | The display mode. `inline` renders the Journey within the page flow. `full-screen` renders it as an overlay. |
71-
| `lang` | `"de"` \| `"en"` \| `"fr"` | `"de"` | Overrides the UI language. This affects UI labels and copy, but does not automatically translate static content configured in the Journey Builder. |
72-
| `top-bar` | `"true"` \| `"false"` | `"true"` | Whether to show the top navigation bar. Only applies in `inline` mode — in `full-screen` mode the top bar is always visible and cannot be hidden. |
73-
| `scroll-to-top` | `"true"` \| `"false"` | `"true"` | Whether to scroll the page to the top of the Journey when the user navigates to a new step. |
74-
| `close-button` | `"true"` \| `"false"` | `"true"` | Whether to show the close button in the top bar. |
75-
| `context-data` | JSON string || Additional contextual data passed to the Journey and included with the submission. Must be a JSON-encoded string of key-value pairs. See [Context Data](#context-data). |
76-
| `data-injection-options` | JSON string || Pre-fill Journey fields and control the starting step. Must be a JSON-encoded string. See [Data Injection](#data-injection). |
77-
| `journey-token` | `string` || A JWT token used for [post-qualification Journeys](./post-qualification.md). |
67+
| Attribute | Type | Default | Description |
68+
| ------------------------ | ----------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
69+
| `journey-id` | `string` || **Required.** The ID of the Journey to render. |
70+
| `mode` | `"inline"` \| `"full-screen"` | `"full-screen"` | The display mode. `inline` renders the Journey within the page flow. `full-screen` renders it as an overlay. |
71+
| `lang` | `"de"` \| `"en"` \| `"fr"` | `"de"` | Overrides the UI language. This affects UI labels and copy, but does not automatically translate static content configured in the Journey Builder. |
72+
| `top-bar` | `"true"` \| `"false"` | `"true"` | Whether to show the top navigation bar. Only applies in `inline` mode — in `full-screen` mode the top bar is always visible and cannot be hidden. |
73+
| `scroll-to-top` | `"true"` \| `"false"` | `"true"` | Whether to scroll the page to the top of the Journey when the user navigates to a new step. |
74+
| `close-button` | `"true"` \| `"false"` | `"true"` | Whether to show the close button in the top bar. |
75+
| `context-data` | JSON string || Additional contextual data passed to the Journey and included with the submission. Must be a JSON-encoded string of key-value pairs. See [Context Data](#context-data). |
76+
| `data-injection-options` | JSON string || Pre-fill Journey fields and control the starting step. Must be a JSON-encoded string. See [Data Injection](#data-injection). |
77+
| `journey-token` | `string` || A JWT token used for [post-qualification Journeys](./post-qualification.md). |
7878
| `as-organization-id` | `string` || Organization ID to use as the Journey's organization context. Sent as the `x-epilot-org-id` header on entity requests. Useful in partner / shared-entities scenarios where the Journey needs to access data owned by a different organization. |
79-
| `is-full-screen-entered` | `"true"` \| `"false"` | `"false"` | Controls whether a full-screen Journey is visible. Set to `"true"` to open it. Only applies when `mode` is `"full-screen"`. |
80-
| `is-embedded` | `"true"` \| `"false"` | `"false"` | Indicates the Journey is embedded on a host app. |
81-
| `debug` | `"true"` \| `"false"` | `"false"` | Enables debug mode for development and troubleshooting. |
79+
| `is-full-screen-entered` | `"true"` \| `"false"` | `"false"` | Controls whether a full-screen Journey is visible. Set to `"true"` to open it. Only applies when `mode` is `"full-screen"`. |
80+
| `is-embedded` | `"true"` \| `"false"` | `"false"` | Indicates the Journey is embedded on a host app. |
81+
| `debug` | `"true"` \| `"false"` | `"false"` | Enables debug mode for development and troubleshooting. |
8282

8383
:::tip Accessible name
8484

@@ -190,7 +190,9 @@ type DataInjectionOptions = {
190190
* - recommended: an object keyed by stable block id -> block value
191191
* - deprecated (legacy): an array indexed by step position, each entry keyed by block name
192192
*/
193-
initialState?: Record<string, Record<string, unknown>> | Record<string, unknown>[]
193+
initialState?:
194+
| Record<string, Record<string, unknown>>
195+
| Record<string, unknown>[]
194196
/** Control which blocks/fields are disabled */
195197
blocksDisplaySettings?: BlockDisplaySetting[]
196198
}
@@ -248,9 +250,11 @@ el.setAttribute(
248250

249251
The recommended form keys `initialState` by **block ID**. Each entry is an object of the field values for that block. Because the state is keyed by block ID, you only list the blocks you actually want to prefill — no per-step ordering or empty `{}` placeholders are needed, and the mapping is unaffected by block renames or step reordering.
250252

251-
To discover the correct block IDs and field structure, open your Journey in **debug mode** from the Journey Builder and inspect the state for each step. See below:
253+
### Data Injection builder (preview)
252254

253-
![Journey Embed Mode](../../static/img/journey-debug-mode.gif)
255+
You don't have to hand-write block IDs. The Journey Builder includes a **Data Injection (preview)** tool that lets you build the configuration visually: pick the blocks and fields to prefill, set their pre-fill values, mark blocks as read-only, choose the starting step, then copy the generated `data-injection-options` snippet straight onto your `<epilot-journey>` element.
256+
257+
![Data injection preview builder](../../static/img/data-injection-demo.gif)
254258

255259
:::note Legacy step-index form (deprecated)
256260

@@ -261,23 +265,31 @@ el.setAttribute(
261265
'data-injection-options',
262266
JSON.stringify({
263267
initialStepIndex: 1,
264-
initialState: [{}, { 'Product Selection': { selectedProduct: 'solar-panel-basic', _isValid: true } }],
268+
initialState: [
269+
{},
270+
{
271+
'Product Selection': {
272+
selectedProduct: 'solar-panel-basic',
273+
_isValid: true,
274+
},
275+
},
276+
],
265277
blocksDisplaySettings: [
266-
{ type: 'DISABLED', blockName: 'Product Selection', stepIndex: 1, blockFields: ['selectedProduct'] },
278+
{
279+
type: 'DISABLED',
280+
blockName: 'Product Selection',
281+
stepIndex: 1,
282+
blockFields: ['selectedProduct'],
283+
},
267284
],
268285
})
269286
)
270287
```
271288

272-
:::
289+
Open your Journey in **debug mode** from the Journey Builder and inspect the state for each step. See below:
273290

274-
### Data Injection builder (preview)
275-
276-
You don't have to hand-write block IDs. The Journey Builder includes a **Data Injection (preview)** tool that lets you build the configuration visually: pick the blocks and fields to prefill, set their pre-fill values, mark blocks as read-only, choose the starting step, then copy the generated `data-injection-options` snippet straight onto your `<epilot-journey>` element.
277-
278-
<!-- TODO: replace with recording -->
279-
280-
![Data injection preview builder](../../static/img/journey-data-injection-builder.gif)
291+
![Journey Embed Mode](../../static/img/journey-debug-mode.gif)
292+
:::
281293

282294
## Dynamic Attribute Updates
283295

static/img/data-injection-demo.gif

3.31 MB
Loading

0 commit comments

Comments
 (0)