@sanity/personalization-plugin 2.5.0 → 3.0.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.
Files changed (48) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +570 -144
  3. package/dist/growthbook/index.d.ts +12 -15
  4. package/dist/growthbook/index.d.ts.map +1 -0
  5. package/dist/growthbook/index.js +104 -68
  6. package/dist/growthbook/index.js.map +1 -1
  7. package/dist/index.d.ts +212 -252
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +398 -301
  10. package/dist/index.js.map +1 -1
  11. package/dist/launchDarkly/index.d.ts +9 -12
  12. package/dist/launchDarkly/index.d.ts.map +1 -0
  13. package/dist/launchDarkly/index.js +74 -46
  14. package/dist/launchDarkly/index.js.map +1 -1
  15. package/package.json +37 -79
  16. package/dist/growthbook/index.d.mts +0 -15
  17. package/dist/growthbook/index.mjs +0 -124
  18. package/dist/growthbook/index.mjs.map +0 -1
  19. package/dist/index.d.mts +0 -267
  20. package/dist/index.mjs +0 -472
  21. package/dist/index.mjs.map +0 -1
  22. package/dist/launchDarkly/index.d.mts +0 -12
  23. package/dist/launchDarkly/index.mjs +0 -107
  24. package/dist/launchDarkly/index.mjs.map +0 -1
  25. package/sanity.json +0 -8
  26. package/src/components/Array.tsx +0 -68
  27. package/src/components/ExperimentContext.tsx +0 -65
  28. package/src/components/ExperimentField.tsx +0 -138
  29. package/src/components/ExperimentInput.tsx +0 -75
  30. package/src/components/ExperimentItem.tsx +0 -10
  31. package/src/components/Select.tsx +0 -43
  32. package/src/components/VariantInput.tsx +0 -19
  33. package/src/components/VariantPreview.tsx +0 -75
  34. package/src/fieldExperiments.tsx +0 -266
  35. package/src/growthbook/Components/GrowthbookContext.tsx +0 -38
  36. package/src/growthbook/Components/Secrets.tsx +0 -47
  37. package/src/growthbook/index.ts +0 -54
  38. package/src/growthbook/types.ts +0 -15
  39. package/src/growthbook/utils.ts +0 -94
  40. package/src/index.ts +0 -3
  41. package/src/launchDarkly/components/LaunchDarklyContext.tsx +0 -36
  42. package/src/launchDarkly/components/Secrets.tsx +0 -46
  43. package/src/launchDarkly/index.ts +0 -52
  44. package/src/launchDarkly/types.ts +0 -193
  45. package/src/launchDarkly/utils.ts +0 -54
  46. package/src/types.ts +0 -245
  47. package/src/utils/flattenSchemaType.ts +0 -47
  48. package/v2-incompatible.js +0 -11
package/dist/index.d.mts DELETED
@@ -1,267 +0,0 @@
1
- import {ArrayOfObjectsInputProps} from 'sanity'
2
- import {FieldDefinition} from 'sanity'
3
- import {ObjectField} from 'sanity'
4
- import {Path} from 'sanity'
5
- import {Plugin as Plugin_2} from 'sanity'
6
- import {PreviewProps} from 'sanity'
7
- import {SanityClient} from 'sanity'
8
- import {SchemaType} from 'sanity'
9
-
10
- export declare type ArrayInputProps = ArrayOfObjectsInputProps & {
11
- variantName: string
12
- variantId: string
13
- experimentId: string
14
- }
15
-
16
- export declare type ExperimentContextProps = Required<FieldPluginConfig> & {
17
- experiments: ExperimentType[]
18
- }
19
-
20
- export declare type ExperimentGeneric<T> = {
21
- _type: string
22
- default?: T
23
- experimentValue?: string
24
- [key: string]:
25
- | Array<
26
- {
27
- _key: string
28
- } & VariantGeneric<T>
29
- >
30
- | string
31
- | T
32
- | undefined
33
- }
34
-
35
- export declare type ExperimentType = {
36
- id: string
37
- label: string
38
- variants: VariantType[]
39
- }
40
-
41
- export declare const fieldLevelExperiments: Plugin_2<FieldPluginConfig>
42
-
43
- export declare type FieldPluginConfig = {
44
- fields: (string | FieldDefinition)[]
45
- experiments: ExperimentType[] | ((client: SanityClient) => Promise<ExperimentType[]>)
46
- apiVersion?: string
47
- experimentNameOverride?: string
48
- variantNameOverride?: string
49
- variantId?: string
50
- variantArrayName?: string
51
- experimentId?: string
52
- }
53
-
54
- /**
55
- * Flattens a document's schema type into a flat array of fields and includes their path
56
- */
57
- export declare function flattenSchemaType(schemaType: SchemaType): ObjectFieldWithPath[]
58
-
59
- export declare type GrowthbookExperiment = {
60
- id: string
61
- dateCreated: string
62
- dateUpdated: string
63
- name: string
64
- project: string
65
- hypothesis: string
66
- description: string
67
- tags: [string]
68
- owner: string
69
- archived: boolean
70
- status: string
71
- autoRefresh: boolean
72
- hashAttribute: string
73
- fallbackAttribute: string
74
- hashVersion: number
75
- disableStickyBucketing: boolean
76
- bucketVersion: number
77
- minBucketVersion: number
78
- variations: [
79
- {
80
- variationId: string
81
- key: string
82
- name: string
83
- description: string
84
- screenshots: [string]
85
- },
86
- ]
87
- phases: [
88
- {
89
- name: string
90
- dateStarted: string
91
- dateEnded: string
92
- reasonForStopping: string
93
- seed: string
94
- coverage: 0
95
- trafficSplit: [
96
- {
97
- variationId: string
98
- weight: 0
99
- },
100
- ]
101
- namespace: {
102
- namespaceId: string
103
- range: []
104
- }
105
- targetingCondition: string
106
- savedGroupTargeting: [
107
- {
108
- matchType: string
109
- savedGroups: [string]
110
- },
111
- ]
112
- },
113
- ]
114
- settings: {
115
- datasourceId: string
116
- assignmentQueryId: string
117
- experimentId: string
118
- segmentId: string
119
- queryFilter: string
120
- inProgressConversions: string
121
- attributionModel: string
122
- statsEngine: string
123
- regressionAdjustmentEnabled: boolean
124
- goals: [
125
- {
126
- metricId: string
127
- overrides: {
128
- delayHours: 0
129
- windowHours: 0
130
- window: string
131
- winRiskThreshold: 0
132
- loseRiskThreshold: 0
133
- }
134
- },
135
- ]
136
- secondaryMetrics: [
137
- {
138
- metricId: string
139
- overrides: {
140
- delayHours: 0
141
- windowHours: 0
142
- window: string
143
- winRiskThreshold: 0
144
- loseRiskThreshold: 0
145
- }
146
- },
147
- ]
148
- guardrails: [
149
- {
150
- metricId: string
151
- overrides: {
152
- delayHours: 0
153
- windowHours: 0
154
- window: string
155
- winRiskThreshold: 0
156
- loseRiskThreshold: 0
157
- }
158
- },
159
- ]
160
- activationMetric: {
161
- metricId: string
162
- overrides: {
163
- delayHours: 0
164
- windowHours: 0
165
- window: string
166
- winRiskThreshold: 0
167
- loseRiskThreshold: 0
168
- }
169
- }
170
- }
171
- resultSummary: {
172
- status: string
173
- winner: string
174
- conclusions: string
175
- releasedVariationId: string
176
- excludeFromPayload: boolean
177
- }
178
- }
179
-
180
- export declare type GrowthbookFeature = {
181
- id: string
182
- dateCreated: string
183
- dateUpdated: string
184
- archived: boolean
185
- description: string
186
- owner: string
187
- project: string
188
- valueType: string
189
- defaultValue: string
190
- tags: string[]
191
- environments: {
192
- [key: string]: {
193
- enabled: boolean
194
- defaultValue: string
195
- rules: {
196
- description: string
197
- condition: string
198
- savedGroupTargeting: {
199
- matchType: string
200
- savedGroups: string[]
201
- }[]
202
- id: string
203
- enabled: boolean
204
- type: string
205
- value: string
206
- variations: {
207
- value: string
208
- variationId: string
209
- }[]
210
- }[]
211
- definition: string
212
- draft: {
213
- enabled: boolean
214
- defaultValue: string
215
- rules: {
216
- description: string
217
- condition: string
218
- savedGroupTargeting: {
219
- matchType: string
220
- savedGroups: string[]
221
- }[]
222
- id: string
223
- enabled: boolean
224
- type: string
225
- value: string
226
- variations: {
227
- value: string
228
- variationId: string
229
- }[]
230
- }[]
231
- definition: string
232
- }
233
- }
234
- }
235
- prerequisites: {
236
- parentId: string
237
- parentCondition: string
238
- }[]
239
- revision: {
240
- version: number
241
- comment: string
242
- date: string
243
- publishedBy: string
244
- }
245
- }
246
-
247
- export declare type ObjectFieldWithPath = ObjectField<SchemaType> & {
248
- path: Path
249
- }
250
-
251
- export declare type VariantGeneric<T> = {
252
- [key: string]: string | T | undefined
253
- _type: string
254
- value?: T
255
- }
256
-
257
- export declare type VariantPreviewProps = Omit<PreviewProps, 'SchemaType'> & {
258
- [key: string]: string
259
- value: any
260
- }
261
-
262
- export declare type VariantType = {
263
- id: string
264
- label: string
265
- }
266
-
267
- export {}