Skip to content

Commit 3cd8d0b

Browse files
committed
fix: add version number to the flow model
1 parent 9c269d9 commit 3cd8d0b

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

.changeset/dull-buckets-yawn.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@frigade/js": patch
3+
"@frigade/react": patch
4+
---
5+
6+
Adds version number to the `Flow` model

packages/js-api/src/core/flow.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export class Flow extends Fetchable {
3030
* The Flow's ID.
3131
*/
3232
public id: string
33+
/**
34+
* The version of the Flow.
35+
*/
36+
public version: number
3337
/**
3438
* The Flow's component ID.
3539
*/
@@ -125,7 +129,7 @@ export class Flow extends Fetchable {
125129
this.subtitle = statefulFlow?.data?.subtitle
126130
this.type = statefulFlow?.data?.type
127131
this.props = statefulFlow?.data?.props ?? {}
128-
132+
this.version = statefulFlow?.version
129133
this.isCompleted = statefulFlow.$state.completed
130134
this.isStarted = statefulFlow.$state.started
131135
this.isSkipped = statefulFlow.$state.skipped

packages/js-api/src/core/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ export interface StatefulFlow {
371371
flowSlug: string
372372
flowName: string
373373
flowType: FlowType
374+
version: number
374375
/**
375376
* Contains the raw data of the Flow as defined in the YAML config as well as the user's state of each step.
376377
*/

packages/js-api/test/frigade.int.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ describe('Basic Checklist integration test', () => {
4444
expect(step.id).toBeDefined()
4545
expect(step.title).toBeDefined()
4646
})
47+
expect(flow.version).toBeDefined()
4748
})
4849

4950
test('read and set flow state', async () => {
@@ -67,6 +68,7 @@ describe('Basic Checklist integration test', () => {
6768
flowSlug: 'some-flow',
6869
flowName: 'Some flow',
6970
flowType: FlowType.CHECKLIST,
71+
version: 1,
7072
data: {
7173
steps: [
7274
{
@@ -125,6 +127,7 @@ describe('Basic Checklist integration test', () => {
125127
[madeUpFlowId]: {
126128
flowSlug: 'some-flow',
127129
flowName: 'Some flow',
130+
version: 1,
128131
flowType: FlowType.CHECKLIST,
129132
data: {
130133
steps: [
@@ -180,6 +183,7 @@ describe('Basic Checklist integration test', () => {
180183
[madeUpFlowId]: {
181184
flowSlug: 'some-flow',
182185
flowName: 'Some flow',
186+
version: 1,
183187
flowType: FlowType.CHECKLIST,
184188
data: {
185189
steps: [

0 commit comments

Comments
 (0)