@sanity/personalization-plugin 2.2.0-launch-darkly.1 → 2.3.0-growthbook.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 +2 -0
- package/dist/growthbook/index.d.mts +15 -0
- package/dist/growthbook/index.d.ts +15 -0
- package/dist/growthbook/index.js +118 -0
- package/dist/growthbook/index.js.map +1 -0
- package/dist/growthbook/index.mjs +122 -0
- package/dist/growthbook/index.mjs.map +1 -0
- package/dist/index.d.mts +174 -178
- package/dist/index.d.ts +174 -178
- package/dist/index.js +56 -105
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -109
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -3
- package/src/components/ExperimentContext.tsx +4 -7
- package/src/components/ExperimentField.tsx +56 -32
- package/src/components/ExperimentInput.tsx +14 -4
- package/src/fieldExperiments.tsx +6 -1
- package/src/growthbook/Components/GrowthbookContext.tsx +38 -0
- package/src/{components → growthbook/Components}/Secrets.tsx +7 -5
- package/src/growthbook/index.ts +52 -0
- package/src/growthbook/types.ts +15 -0
- package/src/growthbook/utils.ts +94 -0
- package/src/index.ts +0 -1
- package/src/types.ts +163 -170
- package/src/launchDarklyExperiments.tsx +0 -48
- package/src/utils/launchDarkly.ts +0 -54
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {ArrayOfObjectsInputProps} from 'sanity'
|
|
2
|
-
import {Dispatch} from 'react'
|
|
3
2
|
import {FieldDefinition} from 'sanity'
|
|
4
3
|
import {ObjectField} from 'sanity'
|
|
5
4
|
import {Path} from 'sanity'
|
|
@@ -7,7 +6,6 @@ import {Plugin as Plugin_2} from 'sanity'
|
|
|
7
6
|
import {PreviewProps} from 'sanity'
|
|
8
7
|
import {SanityClient} from 'sanity'
|
|
9
8
|
import {SchemaType} from 'sanity'
|
|
10
|
-
import {SetStateAction} from 'react'
|
|
11
9
|
|
|
12
10
|
export declare type ArrayInputProps = ArrayOfObjectsInputProps & {
|
|
13
11
|
variantName: string
|
|
@@ -17,8 +15,6 @@ export declare type ArrayInputProps = ArrayOfObjectsInputProps & {
|
|
|
17
15
|
|
|
18
16
|
export declare type ExperimentContextProps = Required<FieldPluginConfig> & {
|
|
19
17
|
experiments: ExperimentType[]
|
|
20
|
-
setSecret: Dispatch<SetStateAction<string | undefined>>
|
|
21
|
-
secret: string | undefined
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
export declare type ExperimentGeneric<T> = {
|
|
@@ -46,7 +42,9 @@ export declare const fieldLevelExperiments: Plugin_2<FieldPluginConfig>
|
|
|
46
42
|
|
|
47
43
|
export declare type FieldPluginConfig = {
|
|
48
44
|
fields: (string | FieldDefinition)[]
|
|
49
|
-
experiments:
|
|
45
|
+
experiments:
|
|
46
|
+
| ExperimentType[]
|
|
47
|
+
| ((client: SanityClient, secret?: string) => Promise<ExperimentType[]>)
|
|
50
48
|
apiVersion?: string
|
|
51
49
|
experimentNameOverride?: string
|
|
52
50
|
variantNameOverride?: string
|
|
@@ -60,194 +58,192 @@ export declare type FieldPluginConfig = {
|
|
|
60
58
|
*/
|
|
61
59
|
export declare function flattenSchemaType(schemaType: SchemaType): ObjectFieldWithPath[]
|
|
62
60
|
|
|
63
|
-
export declare
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
projectKey: string
|
|
68
|
-
tags?: string[]
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export declare type LaunchDarklyFlagItem = {
|
|
61
|
+
export declare type GrowthbookExperiment = {
|
|
62
|
+
id: string
|
|
63
|
+
dateCreated: string
|
|
64
|
+
dateUpdated: string
|
|
72
65
|
name: string
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
66
|
+
project: string
|
|
67
|
+
hypothesis: string
|
|
68
|
+
description: string
|
|
69
|
+
tags: [string]
|
|
70
|
+
owner: string
|
|
71
|
+
archived: boolean
|
|
72
|
+
status: string
|
|
73
|
+
autoRefresh: boolean
|
|
74
|
+
hashAttribute: string
|
|
75
|
+
fallbackAttribute: string
|
|
76
|
+
hashVersion: number
|
|
77
|
+
disableStickyBucketing: boolean
|
|
78
|
+
bucketVersion: number
|
|
79
|
+
minBucketVersion: number
|
|
80
|
+
variations: [
|
|
81
|
+
{
|
|
82
|
+
variationId: string
|
|
83
|
+
key: string
|
|
84
|
+
name: string
|
|
85
|
+
description: string
|
|
86
|
+
screenshots: [string]
|
|
87
|
+
},
|
|
88
|
+
]
|
|
89
|
+
phases: [
|
|
90
|
+
{
|
|
91
|
+
name: string
|
|
92
|
+
dateStarted: string
|
|
93
|
+
dateEnded: string
|
|
94
|
+
reasonForStopping: string
|
|
95
|
+
seed: string
|
|
96
|
+
coverage: 0
|
|
97
|
+
trafficSplit: [
|
|
98
|
+
{
|
|
99
|
+
variationId: string
|
|
100
|
+
weight: 0
|
|
101
|
+
},
|
|
102
|
+
]
|
|
103
|
+
namespace: {
|
|
104
|
+
namespaceId: string
|
|
105
|
+
range: []
|
|
106
|
+
}
|
|
107
|
+
targetingCondition: string
|
|
108
|
+
savedGroupTargeting: [
|
|
109
|
+
{
|
|
110
|
+
matchType: string
|
|
111
|
+
savedGroups: [string]
|
|
112
|
+
},
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
]
|
|
116
|
+
settings: {
|
|
117
|
+
datasourceId: string
|
|
118
|
+
assignmentQueryId: string
|
|
119
|
+
experimentId: string
|
|
120
|
+
segmentId: string
|
|
121
|
+
queryFilter: string
|
|
122
|
+
inProgressConversions: string
|
|
123
|
+
attributionModel: string
|
|
124
|
+
statsEngine: string
|
|
125
|
+
regressionAdjustmentEnabled: boolean
|
|
126
|
+
goals: [
|
|
127
|
+
{
|
|
128
|
+
metricId: string
|
|
129
|
+
overrides: {
|
|
130
|
+
delayHours: 0
|
|
131
|
+
windowHours: 0
|
|
132
|
+
window: string
|
|
133
|
+
winRiskThreshold: 0
|
|
134
|
+
loseRiskThreshold: 0
|
|
113
135
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
_id: string
|
|
128
|
-
role: string
|
|
129
|
-
email: string
|
|
130
|
-
firstName: string
|
|
131
|
-
lastName: string
|
|
136
|
+
},
|
|
137
|
+
]
|
|
138
|
+
secondaryMetrics: [
|
|
139
|
+
{
|
|
140
|
+
metricId: string
|
|
141
|
+
overrides: {
|
|
142
|
+
delayHours: 0
|
|
143
|
+
windowHours: 0
|
|
144
|
+
window: string
|
|
145
|
+
winRiskThreshold: 0
|
|
146
|
+
loseRiskThreshold: 0
|
|
132
147
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
148
|
+
},
|
|
149
|
+
]
|
|
150
|
+
guardrails: [
|
|
151
|
+
{
|
|
152
|
+
metricId: string
|
|
153
|
+
overrides: {
|
|
154
|
+
delayHours: 0
|
|
155
|
+
windowHours: 0
|
|
156
|
+
window: string
|
|
157
|
+
winRiskThreshold: 0
|
|
158
|
+
loseRiskThreshold: 0
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
]
|
|
162
|
+
activationMetric: {
|
|
163
|
+
metricId: string
|
|
164
|
+
overrides: {
|
|
165
|
+
delayHours: 0
|
|
166
|
+
windowHours: 0
|
|
167
|
+
window: string
|
|
168
|
+
winRiskThreshold: 0
|
|
169
|
+
loseRiskThreshold: 0
|
|
136
170
|
}
|
|
137
|
-
}>
|
|
138
|
-
}
|
|
139
|
-
customProperties: {
|
|
140
|
-
key: {
|
|
141
|
-
name: string
|
|
142
|
-
value: string[]
|
|
143
171
|
}
|
|
144
172
|
}
|
|
173
|
+
resultSummary: {
|
|
174
|
+
status: string
|
|
175
|
+
winner: string
|
|
176
|
+
conclusions: string
|
|
177
|
+
releasedVariationId: string
|
|
178
|
+
excludeFromPayload: boolean
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export declare type GrowthbookFeature = {
|
|
183
|
+
id: string
|
|
184
|
+
dateCreated: string
|
|
185
|
+
dateUpdated: string
|
|
145
186
|
archived: boolean
|
|
146
187
|
description: string
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
type: string
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
_id: string
|
|
156
|
-
role: string
|
|
157
|
-
email: string
|
|
158
|
-
firstName: string
|
|
159
|
-
lastName: string
|
|
160
|
-
}
|
|
161
|
-
maintainerTeamKey: string
|
|
162
|
-
_maintainerTeam: {
|
|
163
|
-
key: string
|
|
164
|
-
name: string
|
|
165
|
-
_links: {
|
|
166
|
-
parent: {
|
|
167
|
-
href: string
|
|
168
|
-
type: string
|
|
169
|
-
}
|
|
170
|
-
roles: {
|
|
171
|
-
href: string
|
|
172
|
-
type: string
|
|
173
|
-
}
|
|
174
|
-
self: {
|
|
175
|
-
href: string
|
|
176
|
-
type: string
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
archivedDate: number
|
|
181
|
-
deprecated: boolean
|
|
182
|
-
deprecatedDate: number
|
|
183
|
-
defaults: {
|
|
184
|
-
onVariation: number
|
|
185
|
-
offVariation: number
|
|
186
|
-
}
|
|
187
|
-
_purpose: string
|
|
188
|
-
migrationSettings: {
|
|
189
|
-
contextKind: string
|
|
190
|
-
stageCount: number
|
|
191
|
-
}
|
|
188
|
+
owner: string
|
|
189
|
+
project: string
|
|
190
|
+
valueType: string
|
|
191
|
+
defaultValue: string
|
|
192
|
+
tags: string[]
|
|
192
193
|
environments: {
|
|
193
194
|
[key: string]: {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
195
|
+
enabled: boolean
|
|
196
|
+
defaultValue: string
|
|
197
|
+
rules: {
|
|
198
|
+
description: string
|
|
199
|
+
condition: string
|
|
200
|
+
savedGroupTargeting: {
|
|
201
|
+
matchType: string
|
|
202
|
+
savedGroups: string[]
|
|
203
|
+
}[]
|
|
204
|
+
id: string
|
|
205
|
+
enabled: boolean
|
|
202
206
|
type: string
|
|
203
|
-
|
|
204
|
-
_environmentName: string
|
|
205
|
-
trackEvents: boolean
|
|
206
|
-
trackEventsFallthrough: boolean
|
|
207
|
-
targets: Array<{
|
|
208
|
-
values: string[]
|
|
209
|
-
variation: number
|
|
210
|
-
contextKind: string
|
|
211
|
-
}>
|
|
212
|
-
contextTargets: Array<{
|
|
213
|
-
values: string[]
|
|
214
|
-
variation: number
|
|
215
|
-
contextKind: string
|
|
216
|
-
}>
|
|
217
|
-
rules: Array<{
|
|
218
|
-
clauses: Array<{
|
|
219
|
-
attribute: string
|
|
220
|
-
op: string
|
|
221
|
-
values: unknown[]
|
|
222
|
-
negate: boolean
|
|
223
|
-
}>
|
|
224
|
-
trackEvents: boolean
|
|
225
|
-
}>
|
|
226
|
-
fallthrough: {
|
|
227
|
-
variation: number
|
|
228
|
-
}
|
|
229
|
-
offVariation: number
|
|
230
|
-
prerequisites: Array<{
|
|
231
|
-
key: string
|
|
232
|
-
variation: number
|
|
233
|
-
}>
|
|
234
|
-
_summary: {
|
|
207
|
+
value: string
|
|
235
208
|
variations: {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
209
|
+
value: string
|
|
210
|
+
variationId: string
|
|
211
|
+
}[]
|
|
212
|
+
}[]
|
|
213
|
+
definition: string
|
|
214
|
+
draft: {
|
|
215
|
+
enabled: boolean
|
|
216
|
+
defaultValue: string
|
|
217
|
+
rules: {
|
|
218
|
+
description: string
|
|
219
|
+
condition: string
|
|
220
|
+
savedGroupTargeting: {
|
|
221
|
+
matchType: string
|
|
222
|
+
savedGroups: string[]
|
|
223
|
+
}[]
|
|
224
|
+
id: string
|
|
225
|
+
enabled: boolean
|
|
226
|
+
type: string
|
|
227
|
+
value: string
|
|
228
|
+
variations: {
|
|
229
|
+
value: string
|
|
230
|
+
variationId: string
|
|
231
|
+
}[]
|
|
232
|
+
}[]
|
|
233
|
+
definition: string
|
|
246
234
|
}
|
|
247
235
|
}
|
|
248
236
|
}
|
|
249
|
-
|
|
250
|
-
|
|
237
|
+
prerequisites: {
|
|
238
|
+
parentId: string
|
|
239
|
+
parentCondition: string
|
|
240
|
+
}[]
|
|
241
|
+
revision: {
|
|
242
|
+
version: number
|
|
243
|
+
comment: string
|
|
244
|
+
date: string
|
|
245
|
+
publishedBy: string
|
|
246
|
+
}
|
|
251
247
|
}
|
|
252
248
|
|
|
253
249
|
export declare type ObjectFieldWithPath = ObjectField<SchemaType> & {
|