Skip to content

Commit

Permalink
Merge pull request #232 from nthorn552/include-default-treatment-in-s…
Browse files Browse the repository at this point in the history
…plit-view

Include default treatment in SplitView
  • Loading branch information
EmilianoSanchez authored Oct 20, 2023
2 parents 042c5cf + 3171374 commit eaebd04
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/sdkManager/__tests__/mocks/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"treatments": ["on", "off"],
"configs": {
"on": "\"color\": \"green\""
}
},
"defaultTreatment": "off"
}
3 changes: 2 additions & 1 deletion src/sdkManager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ function objectToView(splitObject: ISplit | null): SplitIO.SplitView | null {
killed: splitObject.killed,
changeNumber: splitObject.changeNumber || 0,
treatments: collectTreatments(splitObject),
configs: splitObject.configurations || {}
configs: splitObject.configurations || {},
defaultTreatment: splitObject.defaultTreatment
};
}

Expand Down
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,11 @@ export namespace SplitIO {
configs: {
[treatmentName: string]: string
}
/**
* Default treatment value for feature flag.
* @property {string} defaultTreatment
*/
defaultTreatment: string,
};
/**
* A promise that resolves to a feature flag view.
Expand Down

0 comments on commit eaebd04

Please sign in to comment.