@sanity/personalization-plugin 2.2.1 → 2.3.0-growthbook.2
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 +191 -1
- package/dist/index.d.ts +191 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -1
- package/src/components/ExperimentField.tsx +2 -5
- package/src/growthbook/Components/GrowthbookContext.tsx +38 -0
- package/src/growthbook/Components/Secrets.tsx +47 -0
- package/src/growthbook/index.ts +52 -0
- package/src/growthbook/types.ts +15 -0
- package/src/growthbook/utils.ts +94 -0
- package/src/types.ts +179 -1
package/dist/index.d.ts
CHANGED
|
@@ -42,7 +42,9 @@ export declare const fieldLevelExperiments: Plugin_2<FieldPluginConfig>
|
|
|
42
42
|
|
|
43
43
|
export declare type FieldPluginConfig = {
|
|
44
44
|
fields: (string | FieldDefinition)[]
|
|
45
|
-
experiments:
|
|
45
|
+
experiments:
|
|
46
|
+
| ExperimentType[]
|
|
47
|
+
| ((client: SanityClient, secret?: string) => Promise<ExperimentType[]>)
|
|
46
48
|
apiVersion?: string
|
|
47
49
|
experimentNameOverride?: string
|
|
48
50
|
variantNameOverride?: string
|
|
@@ -56,6 +58,194 @@ export declare type FieldPluginConfig = {
|
|
|
56
58
|
*/
|
|
57
59
|
export declare function flattenSchemaType(schemaType: SchemaType): ObjectFieldWithPath[]
|
|
58
60
|
|
|
61
|
+
export declare type GrowthbookExperiment = {
|
|
62
|
+
id: string
|
|
63
|
+
dateCreated: string
|
|
64
|
+
dateUpdated: string
|
|
65
|
+
name: string
|
|
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
|
|
135
|
+
}
|
|
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
|
|
147
|
+
}
|
|
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
|
|
170
|
+
}
|
|
171
|
+
}
|
|
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
|
|
186
|
+
archived: boolean
|
|
187
|
+
description: string
|
|
188
|
+
owner: string
|
|
189
|
+
project: string
|
|
190
|
+
valueType: string
|
|
191
|
+
defaultValue: string
|
|
192
|
+
tags: string[]
|
|
193
|
+
environments: {
|
|
194
|
+
[key: string]: {
|
|
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
|
|
206
|
+
type: string
|
|
207
|
+
value: string
|
|
208
|
+
variations: {
|
|
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
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
prerequisites: {
|
|
238
|
+
parentId: string
|
|
239
|
+
parentCondition: string
|
|
240
|
+
}[]
|
|
241
|
+
revision: {
|
|
242
|
+
version: number
|
|
243
|
+
comment: string
|
|
244
|
+
date: string
|
|
245
|
+
publishedBy: string
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
59
249
|
export declare type ObjectFieldWithPath = ObjectField<SchemaType> & {
|
|
60
250
|
path: Path
|
|
61
251
|
}
|
package/dist/index.js
CHANGED
|
@@ -6419,7 +6419,7 @@ const useAddExperimentAction = (props) => {
|
|
|
6419
6419
|
const { onChange, active, experimentId, experimentNameOverride, variantNameOverride } = props, handleClearAction = react.useCallback(() => {
|
|
6420
6420
|
const activeId = ["active"], experiment = [experimentId], variants = [`${variantNameOverride}s`];
|
|
6421
6421
|
onChange([sanity.set(!active, activeId), sanity.unset(experiment), sanity.unset(variants)]);
|
|
6422
|
-
}, [onChange, active, experimentId,
|
|
6422
|
+
}, [onChange, active, experimentId, variantNameOverride]);
|
|
6423
6423
|
return {
|
|
6424
6424
|
title: `Remove ${experimentNameOverride}`,
|
|
6425
6425
|
type: "action",
|