@getrheo/contracts 1.0.0
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/dist/animations.d.ts +226 -0
- package/dist/animations.js +1160 -0
- package/dist/animations.js.map +1 -0
- package/dist/appIntegrations.d.ts +175 -0
- package/dist/appIntegrations.js +60 -0
- package/dist/appIntegrations.js.map +1 -0
- package/dist/billingPeriod.d.ts +26 -0
- package/dist/billingPeriod.js +39 -0
- package/dist/billingPeriod.js.map +1 -0
- package/dist/canvasEditorGates.d.ts +81 -0
- package/dist/canvasEditorGates.js +1460 -0
- package/dist/canvasEditorGates.js.map +1 -0
- package/dist/constants/index.d.ts +30 -0
- package/dist/constants/index.js +67 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/dashboard.d.ts +181856 -0
- package/dist/dashboard.js +3348 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/decisions.d.ts +575 -0
- package/dist/decisions.js +1209 -0
- package/dist/decisions.js.map +1 -0
- package/dist/events.d.ts +231 -0
- package/dist/events.js +63 -0
- package/dist/events.js.map +1 -0
- package/dist/experiments-DN8pQa_D.d.ts +530 -0
- package/dist/externalSurfaceIntegrations.d.ts +20 -0
- package/dist/externalSurfaceIntegrations.js +49 -0
- package/dist/externalSurfaceIntegrations.js.map +1 -0
- package/dist/externalSurfaces.d.ts +177 -0
- package/dist/externalSurfaces.js +1190 -0
- package/dist/externalSurfaces.js.map +1 -0
- package/dist/fields.d.ts +8 -0
- package/dist/fields.js +15 -0
- package/dist/fields.js.map +1 -0
- package/dist/flowManifestSchema-CtqygXCK.d.ts +50857 -0
- package/dist/flowTemplateComments.d.ts +23 -0
- package/dist/flowTemplateComments.js +14 -0
- package/dist/flowTemplateComments.js.map +1 -0
- package/dist/flowTemplates.d.ts +22 -0
- package/dist/flowTemplates.js +73 -0
- package/dist/flowTemplates.js.map +1 -0
- package/dist/identity.d.ts +35 -0
- package/dist/identity.js +18 -0
- package/dist/identity.js.map +1 -0
- package/dist/imageContentType.d.ts +11 -0
- package/dist/imageContentType.js +54 -0
- package/dist/imageContentType.js.map +1 -0
- package/dist/index.d.ts +224 -0
- package/dist/index.js +4557 -0
- package/dist/index.js.map +1 -0
- package/dist/layerUnion-BzXoAJLY.d.ts +34 -0
- package/dist/layers.d.ts +89844 -0
- package/dist/layers.js +1507 -0
- package/dist/layers.js.map +1 -0
- package/dist/layout-D0LpaKG-.d.ts +12896 -0
- package/dist/localized.d.ts +17 -0
- package/dist/localized.js +18 -0
- package/dist/localized.js.map +1 -0
- package/dist/manifest.d.ts +22192 -0
- package/dist/manifest.js +2163 -0
- package/dist/manifest.js.map +1 -0
- package/dist/media.d.ts +53 -0
- package/dist/media.js +55 -0
- package/dist/media.js.map +1 -0
- package/dist/planEntitlements.d.ts +65 -0
- package/dist/planEntitlements.js +117 -0
- package/dist/planEntitlements.js.map +1 -0
- package/dist/publish-exports.json +102 -0
- package/dist/screens.d.ts +33586 -0
- package/dist/screens.js +1439 -0
- package/dist/screens.js.map +1 -0
- package/dist/sdk.d.ts +145942 -0
- package/dist/sdk.js +3424 -0
- package/dist/sdk.js.map +1 -0
- package/dist/sdkAttributes.d.ts +11 -0
- package/dist/sdkAttributes.js +17 -0
- package/dist/sdkAttributes.js.map +1 -0
- package/dist/workspaceCapabilities.d.ts +15 -0
- package/dist/workspaceCapabilities.js +116 -0
- package/dist/workspaceCapabilities.js.map +1 -0
- package/package.json +162 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants/index.ts","../src/identity.ts","../src/events.ts"],"names":["z"],"mappings":";;;AAqDO,IAAM,WAAA,GAAc;AAAA,EACzB,cAAA;AAAA,EACA,aAAA;AAAA,EACA,gBAAA;AAAA,EACA,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,gBAAA;AAAA,EACA,gBAAA;AAAA,EACA,gBAAA;AAAA,EACA,oBAAA;AAAA,EACA,sBAAA;AAAA,EACA,mBAAA;AAAA,EACA,iBAAA;AAAA,EACA,yBAAA;AAAA,EACA,6BAAA;AAAA;AAAA,EAEA,8BAAA;AAAA;AAAA,EAEA;AACF,CAAA;ACtEO,IAAM,iBAAA,GAAoB,EAAE,MAAA,CAAO;AAAA,EACxC,SAAA,EAAW,CAAA,CAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA;AAAA,EAC3B,cAAc,CAAA,CAAE,MAAA,GAAS,GAAA,CAAI,CAAC,EAAE,QAAA,EAAS;AAAA,EACzC,WAAW,CAAA,CAAE,MAAA,GAAS,GAAA,CAAI,CAAC,EAAE,QAAA;AAC/B,CAAC,CAAA;AAGM,IAAM,gBAAA,GAAmB,EAAE,MAAA,CAAO;AAAA,EACvC,QAAA,EAAU,EAAE,IAAA,CAAK,CAAC,OAAO,SAAA,EAAW,KAAK,CAAC,CAAA,CAAE,QAAA,EAAS;AAAA,EACrD,UAAA,EAAY,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,MAAA,EAAQ,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC5B,gBAAA,EAAkB,EAAE,MAAA,CAAO,CAAA,CAAE,QAAO,EAAG,CAAA,CAAE,MAAM,CAAC,CAAA,CAAE,QAAO,EAAG,CAAA,CAAE,QAAO,EAAG,CAAA,CAAE,SAAS,CAAC,CAAC,CAAA,CAAE,QAAA;AACzF,CAAC,CAAA;;;ACVM,IAAM,eAAA,GAAkBA,CAAAA,CAAE,IAAA,CAAK,WAAW;AAE1C,IAAM,cAAA,GAAiBA,EAAE,MAAA,CAAO;AAAA,EACrC,OAAA,EAASA,CAAAA,CAAE,MAAA,EAAO,CAAE,IAAA,EAAK;AAAA,EACzB,IAAA,EAAM,eAAA;AAAA,EACN,SAAA,EAAWA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAC/B,MAAA,EAAQA,CAAAA,CAAE,MAAA,EAAO,CAAE,IAAA,EAAK;AAAA;AAAA,EAExB,SAAA,EAAWA,CAAAA,CAAE,MAAA,EAAO,CAAE,IAAA,EAAK;AAAA,EAC3B,YAAA,EAAcA,EAAE,MAAA,EAAO,CAAE,MAAK,CAAE,QAAA,GAAW,QAAA,EAAS;AAAA,EACpD,WAAWA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA,EAAS;AAAA,EAC1C,QAAQA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,GAAW,QAAA,EAAS;AAAA,EACvC,QAAA,EAAU,iBAAA;AAAA,EACV,OAAA,EAAS,iBAAiB,QAAA,EAAS;AAAA,EACnC,YAAYA,CAAAA,CACT,MAAA;AAAA,IACCA,EAAE,MAAA,EAAO;AAAA,IACTA,CAAAA,CAAE,MAAM,CAACA,CAAAA,CAAE,QAAO,EAAGA,CAAAA,CAAE,QAAO,EAAGA,CAAAA,CAAE,SAAQ,EAAGA,CAAAA,CAAE,MAAK,EAAGA,CAAAA,CAAE,MAAMA,CAAAA,CAAE,MAAA,EAAQ,CAAC,CAAC;AAAA,IAE7E,QAAA,EAAS;AAAA;AAAA,EAEZ,mBAAA,EAAqBA,EAAE,IAAA,CAAK,CAAC,QAAQ,WAAW,CAAC,EAAE,QAAA;AACrD,CAAC;AAGM,IAAM,mBAAA,GAAsBA,EAAE,MAAA,CAAO;AAAA,EAC1C,MAAA,EAAQA,EAAE,KAAA,CAAM,cAAc,EAAE,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,GAAG;AAChD,CAAC","file":"events.js","sourcesContent":["export const ENVIRONMENTS = ['test', 'live'] as const;\nexport type Environment = (typeof ENVIRONMENTS)[number];\n\nexport const ROLES = ['owner', 'editor'] as const;\nexport type Role = (typeof ROLES)[number];\n\nexport const STEP_TYPES = [\n 'carousel',\n 'single_choice',\n 'multiple_choice',\n 'text_input',\n 'scale_input',\n 'cta',\n] as const;\nexport type StepType = (typeof STEP_TYPES)[number];\n\nexport const FIELD_CLASSIFICATIONS = ['safe', 'sensitive'] as const;\nexport type FieldClassification = (typeof FIELD_CLASSIFICATIONS)[number];\n\nexport const MEDIA_TYPES = ['image', 'font', 'lottie', 'video'] as const;\nexport type MediaType = (typeof MEDIA_TYPES)[number];\n\nexport const IMAGE_MIME_TYPES = [\n 'image/png',\n 'image/jpeg',\n 'image/webp',\n 'image/gif',\n 'image/svg+xml',\n] as const;\nexport const MAX_IMAGE_BYTES = 5 * 1024 * 1024;\n\n/** Lottie sources are JSON on the same CDN as images. */\nexport const LOTTIE_MIME_TYPES = ['application/json', 'text/json'] as const;\nexport const MAX_LOTTIE_BYTES = 10 * 1024 * 1024;\n\n/** Video files on the same CDN as images (mp4, webm, mov). */\nexport const VIDEO_MIME_TYPES = ['video/mp4', 'video/webm', 'video/quicktime'] as const;\nexport const MAX_VIDEO_BYTES = 50 * 1024 * 1024;\n\nexport const FONT_MIME_TYPES = [\n 'font/ttf',\n 'font/otf',\n 'font/woff',\n 'font/woff2',\n 'application/font-woff',\n 'application/font-woff2',\n 'application/x-font-ttf',\n 'application/x-font-otf',\n 'application/octet-stream',\n] as const;\nexport const FONT_FILE_EXTENSIONS = ['.ttf', '.otf', '.woff', '.woff2'] as const;\nexport const MAX_FONT_BYTES = 10 * 1024 * 1024;\n\nexport const EVENT_NAMES = [\n 'flow_started',\n 'step_viewed',\n 'step_completed',\n 'step_skipped',\n 'choice_selected',\n 'text_submitted',\n 'flow_completed',\n 'flow_abandoned',\n 'decision_evaluated',\n 'external_link_opened',\n 'surface_presented',\n 'surface_outcome',\n 'app_review_prompt_shown',\n 'app_review_prompt_dismissed',\n /** Emitted once per provider id when merged SDK attributes first expose that attribution source (used for integration health checks). */\n 'attribution_context_observed',\n /** Successful in-app purchase from an external surface (e.g. RevenueCat paywall); commerce fields live in `properties`. */\n 'iap_purchase',\n] as const;\nexport type EventName = (typeof EVENT_NAMES)[number];\n\nexport const PUBLISHABLE_KEY_PREFIX = 'ob_pk_';\nexport const API_VERSION = 'v1';\n\nexport const DEFAULT_LOCALE = 'en';\n\nexport const AUTOSAVE_DEBOUNCE_MS = 800;\nexport const SDK_EVENT_FLUSH_MS = 5000;\n","import { z } from 'zod';\n\nexport const SdkIdentitySchema = z.object({\n appUserId: z.string().min(1),\n customUserId: z.string().min(1).optional(),\n sessionId: z.string().min(1).optional(),\n});\nexport type SdkIdentity = z.infer<typeof SdkIdentitySchema>;\n\nexport const SdkContextSchema = z.object({\n platform: z.enum(['ios', 'android', 'web']).optional(),\n appVersion: z.string().optional(),\n locale: z.string().optional(),\n customProperties: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).optional(),\n});\nexport type SdkContext = z.infer<typeof SdkContextSchema>;\n","import { z } from 'zod';\nimport { EVENT_NAMES } from './constants/index';\nimport { SdkContextSchema, SdkIdentitySchema } from './identity';\n\nexport const EventNameSchema = z.enum(EVENT_NAMES);\n\nexport const SdkEventSchema = z.object({\n eventId: z.string().uuid(),\n name: EventNameSchema,\n timestamp: z.string().datetime(),\n flowId: z.string().uuid(),\n /** Resolved version the SDK was rendering when the event occurred. */\n versionId: z.string().uuid(),\n experimentId: z.string().uuid().nullable().optional(),\n variantId: z.string().nullable().optional(),\n stepId: z.string().nullable().optional(),\n identity: SdkIdentitySchema,\n context: SdkContextSchema.optional(),\n properties: z\n .record(\n z.string(),\n z.union([z.string(), z.number(), z.boolean(), z.null(), z.array(z.string())]),\n )\n .optional(),\n /** for text_submitted, marks this value as sensitive so backend redacts */\n fieldClassification: z.enum(['safe', 'sensitive']).optional(),\n});\nexport type SdkEvent = z.infer<typeof SdkEventSchema>;\n\nexport const SdkEventBatchSchema = z.object({\n events: z.array(SdkEventSchema).min(1).max(500),\n});\nexport type SdkEventBatch = z.infer<typeof SdkEventBatchSchema>;\n"]}
|
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Experiment lifecycle:
|
|
5
|
+
* * draft — being configured; no traffic.
|
|
6
|
+
* * running — bucketing live SDK requests across arms.
|
|
7
|
+
* * pending_decision — endsAt has passed but the experiment keeps
|
|
8
|
+
* serving traffic (frozen bucketing). The
|
|
9
|
+
* operator must promote a winner or extend.
|
|
10
|
+
* * stopped — terminal; channel typically pinned to a
|
|
11
|
+
* winner version at stop time.
|
|
12
|
+
*/
|
|
13
|
+
declare const ExperimentStatusSchema: z.ZodEnum<["draft", "running", "pending_decision", "stopped"]>;
|
|
14
|
+
type ExperimentStatus = z.infer<typeof ExperimentStatusSchema>;
|
|
15
|
+
/**
|
|
16
|
+
* One arm of an experiment. Each arm pins its own version of a (possibly
|
|
17
|
+
* different) flow, so cross-flow A/Bs are first-class.
|
|
18
|
+
*/
|
|
19
|
+
declare const VariantSchema: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
experimentId: z.ZodString;
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
weight: z.ZodNumber;
|
|
24
|
+
flowId: z.ZodNullable<z.ZodString>;
|
|
25
|
+
versionId: z.ZodNullable<z.ZodString>;
|
|
26
|
+
/** Convenience read fields populated by list/get endpoints. */
|
|
27
|
+
flowName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
versionNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
29
|
+
versionLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
flowId: string | null;
|
|
34
|
+
weight: number;
|
|
35
|
+
versionId: string | null;
|
|
36
|
+
experimentId: string;
|
|
37
|
+
versionNumber?: number | null | undefined;
|
|
38
|
+
flowName?: string | null | undefined;
|
|
39
|
+
versionLabel?: string | null | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
id: string;
|
|
42
|
+
name: string;
|
|
43
|
+
flowId: string | null;
|
|
44
|
+
weight: number;
|
|
45
|
+
versionId: string | null;
|
|
46
|
+
experimentId: string;
|
|
47
|
+
versionNumber?: number | null | undefined;
|
|
48
|
+
flowName?: string | null | undefined;
|
|
49
|
+
versionLabel?: string | null | undefined;
|
|
50
|
+
}>;
|
|
51
|
+
type Variant = z.infer<typeof VariantSchema>;
|
|
52
|
+
declare const ExperimentEndedReasonSchema: z.ZodEnum<["manual", "scheduled_resolved"]>;
|
|
53
|
+
type ExperimentEndedReason = z.infer<typeof ExperimentEndedReasonSchema>;
|
|
54
|
+
declare const ExperimentSchema: z.ZodObject<{
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
appId: z.ZodString;
|
|
57
|
+
/** Internal channel uuid. */
|
|
58
|
+
channelId: z.ZodString;
|
|
59
|
+
/** Display name of the channel (denormalized for list views). */
|
|
60
|
+
channelName: z.ZodString;
|
|
61
|
+
/** Test/live env of the channel — kept for badges and analytics filters. */
|
|
62
|
+
channelEnvironment: z.ZodEnum<["test", "live"]>;
|
|
63
|
+
name: z.ZodString;
|
|
64
|
+
status: z.ZodEnum<["draft", "running", "pending_decision", "stopped"]>;
|
|
65
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
experimentId: z.ZodString;
|
|
68
|
+
name: z.ZodString;
|
|
69
|
+
weight: z.ZodNumber;
|
|
70
|
+
flowId: z.ZodNullable<z.ZodString>;
|
|
71
|
+
versionId: z.ZodNullable<z.ZodString>;
|
|
72
|
+
/** Convenience read fields populated by list/get endpoints. */
|
|
73
|
+
flowName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
74
|
+
versionNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
75
|
+
versionLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
id: string;
|
|
78
|
+
name: string;
|
|
79
|
+
flowId: string | null;
|
|
80
|
+
weight: number;
|
|
81
|
+
versionId: string | null;
|
|
82
|
+
experimentId: string;
|
|
83
|
+
versionNumber?: number | null | undefined;
|
|
84
|
+
flowName?: string | null | undefined;
|
|
85
|
+
versionLabel?: string | null | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
flowId: string | null;
|
|
90
|
+
weight: number;
|
|
91
|
+
versionId: string | null;
|
|
92
|
+
experimentId: string;
|
|
93
|
+
versionNumber?: number | null | undefined;
|
|
94
|
+
flowName?: string | null | undefined;
|
|
95
|
+
versionLabel?: string | null | undefined;
|
|
96
|
+
}>, "many">;
|
|
97
|
+
startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
stoppedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
99
|
+
endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
+
endedReason: z.ZodOptional<z.ZodNullable<z.ZodEnum<["manual", "scheduled_resolved"]>>>;
|
|
101
|
+
archivedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
+
createdAt: z.ZodString;
|
|
103
|
+
/** Dashboard user who created the experiment (null for legacy rows). */
|
|
104
|
+
createdByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
105
|
+
/** Display: full name, else @username, else email; null when unknown. */
|
|
106
|
+
createdByLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
107
|
+
tags: z.ZodArray<z.ZodString, "many">;
|
|
108
|
+
/** Power-analysis inputs; nulls → dashboard defaults for sample accumulation. */
|
|
109
|
+
statsDesignBaselineCvr: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
110
|
+
statsDesignMdePp: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
111
|
+
statsDesignAlpha: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
112
|
+
statsDesignPower: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
113
|
+
}, "strip", z.ZodTypeAny, {
|
|
114
|
+
status: "draft" | "running" | "pending_decision" | "stopped";
|
|
115
|
+
id: string;
|
|
116
|
+
name: string;
|
|
117
|
+
createdAt: string;
|
|
118
|
+
tags: string[];
|
|
119
|
+
appId: string;
|
|
120
|
+
channelId: string;
|
|
121
|
+
channelName: string;
|
|
122
|
+
channelEnvironment: "test" | "live";
|
|
123
|
+
variants: {
|
|
124
|
+
id: string;
|
|
125
|
+
name: string;
|
|
126
|
+
flowId: string | null;
|
|
127
|
+
weight: number;
|
|
128
|
+
versionId: string | null;
|
|
129
|
+
experimentId: string;
|
|
130
|
+
versionNumber?: number | null | undefined;
|
|
131
|
+
flowName?: string | null | undefined;
|
|
132
|
+
versionLabel?: string | null | undefined;
|
|
133
|
+
}[];
|
|
134
|
+
archivedAt?: string | null | undefined;
|
|
135
|
+
createdByUserId?: string | null | undefined;
|
|
136
|
+
startedAt?: string | null | undefined;
|
|
137
|
+
stoppedAt?: string | null | undefined;
|
|
138
|
+
endsAt?: string | null | undefined;
|
|
139
|
+
endedReason?: "manual" | "scheduled_resolved" | null | undefined;
|
|
140
|
+
createdByLabel?: string | null | undefined;
|
|
141
|
+
statsDesignBaselineCvr?: number | null | undefined;
|
|
142
|
+
statsDesignMdePp?: number | null | undefined;
|
|
143
|
+
statsDesignAlpha?: number | null | undefined;
|
|
144
|
+
statsDesignPower?: number | null | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
status: "draft" | "running" | "pending_decision" | "stopped";
|
|
147
|
+
id: string;
|
|
148
|
+
name: string;
|
|
149
|
+
createdAt: string;
|
|
150
|
+
tags: string[];
|
|
151
|
+
appId: string;
|
|
152
|
+
channelId: string;
|
|
153
|
+
channelName: string;
|
|
154
|
+
channelEnvironment: "test" | "live";
|
|
155
|
+
variants: {
|
|
156
|
+
id: string;
|
|
157
|
+
name: string;
|
|
158
|
+
flowId: string | null;
|
|
159
|
+
weight: number;
|
|
160
|
+
versionId: string | null;
|
|
161
|
+
experimentId: string;
|
|
162
|
+
versionNumber?: number | null | undefined;
|
|
163
|
+
flowName?: string | null | undefined;
|
|
164
|
+
versionLabel?: string | null | undefined;
|
|
165
|
+
}[];
|
|
166
|
+
archivedAt?: string | null | undefined;
|
|
167
|
+
createdByUserId?: string | null | undefined;
|
|
168
|
+
startedAt?: string | null | undefined;
|
|
169
|
+
stoppedAt?: string | null | undefined;
|
|
170
|
+
endsAt?: string | null | undefined;
|
|
171
|
+
endedReason?: "manual" | "scheduled_resolved" | null | undefined;
|
|
172
|
+
createdByLabel?: string | null | undefined;
|
|
173
|
+
statsDesignBaselineCvr?: number | null | undefined;
|
|
174
|
+
statsDesignMdePp?: number | null | undefined;
|
|
175
|
+
statsDesignAlpha?: number | null | undefined;
|
|
176
|
+
statsDesignPower?: number | null | undefined;
|
|
177
|
+
}>;
|
|
178
|
+
type Experiment = z.infer<typeof ExperimentSchema>;
|
|
179
|
+
/** Defaults for sample accumulation / required-N (aligned with `resolveExperimentSampleDesign` in this package). */
|
|
180
|
+
declare const EXPERIMENT_STATS_DESIGN_DEFAULTS: {
|
|
181
|
+
readonly statsDesignBaselineCvr: 0.342;
|
|
182
|
+
readonly statsDesignMdePp: 3;
|
|
183
|
+
readonly statsDesignAlpha: 0.05;
|
|
184
|
+
readonly statsDesignPower: 0.8;
|
|
185
|
+
};
|
|
186
|
+
declare const ExperimentStatsDesignInputSchema: z.ZodObject<{
|
|
187
|
+
statsDesignBaselineCvr: z.ZodNumber;
|
|
188
|
+
statsDesignMdePp: z.ZodNumber;
|
|
189
|
+
statsDesignAlpha: z.ZodNumber;
|
|
190
|
+
statsDesignPower: z.ZodNumber;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
statsDesignBaselineCvr: number;
|
|
193
|
+
statsDesignMdePp: number;
|
|
194
|
+
statsDesignAlpha: number;
|
|
195
|
+
statsDesignPower: number;
|
|
196
|
+
}, {
|
|
197
|
+
statsDesignBaselineCvr: number;
|
|
198
|
+
statsDesignMdePp: number;
|
|
199
|
+
statsDesignAlpha: number;
|
|
200
|
+
statsDesignPower: number;
|
|
201
|
+
}>;
|
|
202
|
+
type ExperimentStatsDesignInput = z.infer<typeof ExperimentStatsDesignInputSchema>;
|
|
203
|
+
declare const CreateExperimentRequestSchema: z.ZodObject<{
|
|
204
|
+
channelId: z.ZodString;
|
|
205
|
+
name: z.ZodString;
|
|
206
|
+
/** Required auto-stop. Hour granularity is enforced server-side. */
|
|
207
|
+
endsAt: z.ZodString;
|
|
208
|
+
tags: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>, string[], string[]>>;
|
|
209
|
+
statsDesignBaselineCvr: z.ZodOptional<z.ZodNumber>;
|
|
210
|
+
statsDesignMdePp: z.ZodOptional<z.ZodNumber>;
|
|
211
|
+
statsDesignAlpha: z.ZodOptional<z.ZodNumber>;
|
|
212
|
+
statsDesignPower: z.ZodOptional<z.ZodNumber>;
|
|
213
|
+
}, "strip", z.ZodTypeAny, {
|
|
214
|
+
name: string;
|
|
215
|
+
channelId: string;
|
|
216
|
+
endsAt: string;
|
|
217
|
+
tags?: string[] | undefined;
|
|
218
|
+
statsDesignBaselineCvr?: number | undefined;
|
|
219
|
+
statsDesignMdePp?: number | undefined;
|
|
220
|
+
statsDesignAlpha?: number | undefined;
|
|
221
|
+
statsDesignPower?: number | undefined;
|
|
222
|
+
}, {
|
|
223
|
+
name: string;
|
|
224
|
+
channelId: string;
|
|
225
|
+
endsAt: string;
|
|
226
|
+
tags?: string[] | undefined;
|
|
227
|
+
statsDesignBaselineCvr?: number | undefined;
|
|
228
|
+
statsDesignMdePp?: number | undefined;
|
|
229
|
+
statsDesignAlpha?: number | undefined;
|
|
230
|
+
statsDesignPower?: number | undefined;
|
|
231
|
+
}>;
|
|
232
|
+
type CreateExperimentRequest = z.infer<typeof CreateExperimentRequestSchema>;
|
|
233
|
+
/** Patch shape for editing experiments. Name/channel/endsAt only apply while `draft`; tags may be updated in any status. */
|
|
234
|
+
declare const UpdateExperimentRequestSchema: z.ZodObject<{
|
|
235
|
+
name: z.ZodOptional<z.ZodString>;
|
|
236
|
+
channelId: z.ZodOptional<z.ZodString>;
|
|
237
|
+
endsAt: z.ZodOptional<z.ZodString>;
|
|
238
|
+
tags: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>, string[], string[]>>;
|
|
239
|
+
statsDesignBaselineCvr: z.ZodOptional<z.ZodNumber>;
|
|
240
|
+
statsDesignMdePp: z.ZodOptional<z.ZodNumber>;
|
|
241
|
+
statsDesignAlpha: z.ZodOptional<z.ZodNumber>;
|
|
242
|
+
statsDesignPower: z.ZodOptional<z.ZodNumber>;
|
|
243
|
+
}, "strip", z.ZodTypeAny, {
|
|
244
|
+
name?: string | undefined;
|
|
245
|
+
tags?: string[] | undefined;
|
|
246
|
+
channelId?: string | undefined;
|
|
247
|
+
endsAt?: string | undefined;
|
|
248
|
+
statsDesignBaselineCvr?: number | undefined;
|
|
249
|
+
statsDesignMdePp?: number | undefined;
|
|
250
|
+
statsDesignAlpha?: number | undefined;
|
|
251
|
+
statsDesignPower?: number | undefined;
|
|
252
|
+
}, {
|
|
253
|
+
name?: string | undefined;
|
|
254
|
+
tags?: string[] | undefined;
|
|
255
|
+
channelId?: string | undefined;
|
|
256
|
+
endsAt?: string | undefined;
|
|
257
|
+
statsDesignBaselineCvr?: number | undefined;
|
|
258
|
+
statsDesignMdePp?: number | undefined;
|
|
259
|
+
statsDesignAlpha?: number | undefined;
|
|
260
|
+
statsDesignPower?: number | undefined;
|
|
261
|
+
}>;
|
|
262
|
+
type UpdateExperimentRequest = z.infer<typeof UpdateExperimentRequestSchema>;
|
|
263
|
+
/**
|
|
264
|
+
* Push back the auto-stop time on a `pending_decision` experiment. The
|
|
265
|
+
* server flips it back to `running` and leaves the channel assignment
|
|
266
|
+
* untouched (the channel was already pointing at this experiment).
|
|
267
|
+
*/
|
|
268
|
+
declare const ExtendExperimentRequestSchema: z.ZodObject<{
|
|
269
|
+
endsAt: z.ZodString;
|
|
270
|
+
}, "strip", z.ZodTypeAny, {
|
|
271
|
+
endsAt: string;
|
|
272
|
+
}, {
|
|
273
|
+
endsAt: string;
|
|
274
|
+
}>;
|
|
275
|
+
type ExtendExperimentRequest = z.infer<typeof ExtendExperimentRequestSchema>;
|
|
276
|
+
/**
|
|
277
|
+
* Stop an experiment with an explicit channel fallback. The two writes
|
|
278
|
+
* (status flip + channel pin) are atomic on the server. The fallback
|
|
279
|
+
* either re-pins to one of the experiment's variant versions, or to
|
|
280
|
+
* any other version in the app.
|
|
281
|
+
*/
|
|
282
|
+
declare const StopExperimentRequestSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
283
|
+
kind: z.ZodLiteral<"variant">;
|
|
284
|
+
variantId: z.ZodString;
|
|
285
|
+
}, "strip", z.ZodTypeAny, {
|
|
286
|
+
kind: "variant";
|
|
287
|
+
variantId: string;
|
|
288
|
+
}, {
|
|
289
|
+
kind: "variant";
|
|
290
|
+
variantId: string;
|
|
291
|
+
}>, z.ZodObject<{
|
|
292
|
+
kind: z.ZodLiteral<"version">;
|
|
293
|
+
flowId: z.ZodString;
|
|
294
|
+
versionId: z.ZodString;
|
|
295
|
+
}, "strip", z.ZodTypeAny, {
|
|
296
|
+
kind: "version";
|
|
297
|
+
flowId: string;
|
|
298
|
+
versionId: string;
|
|
299
|
+
}, {
|
|
300
|
+
kind: "version";
|
|
301
|
+
flowId: string;
|
|
302
|
+
versionId: string;
|
|
303
|
+
}>]>;
|
|
304
|
+
type StopExperimentRequest = z.infer<typeof StopExperimentRequestSchema>;
|
|
305
|
+
declare const CreateVariantRequestSchema: z.ZodObject<{
|
|
306
|
+
weight: z.ZodNumber;
|
|
307
|
+
flowId: z.ZodOptional<z.ZodString>;
|
|
308
|
+
versionId: z.ZodOptional<z.ZodString>;
|
|
309
|
+
}, "strip", z.ZodTypeAny, {
|
|
310
|
+
weight: number;
|
|
311
|
+
flowId?: string | undefined;
|
|
312
|
+
versionId?: string | undefined;
|
|
313
|
+
}, {
|
|
314
|
+
weight: number;
|
|
315
|
+
flowId?: string | undefined;
|
|
316
|
+
versionId?: string | undefined;
|
|
317
|
+
}>;
|
|
318
|
+
type CreateVariantRequest = z.infer<typeof CreateVariantRequestSchema>;
|
|
319
|
+
declare const ReorderExperimentVariantsRequestSchema: z.ZodObject<{
|
|
320
|
+
variantIds: z.ZodArray<z.ZodString, "many">;
|
|
321
|
+
}, "strip", z.ZodTypeAny, {
|
|
322
|
+
variantIds: string[];
|
|
323
|
+
}, {
|
|
324
|
+
variantIds: string[];
|
|
325
|
+
}>;
|
|
326
|
+
type ReorderExperimentVariantsRequest = z.infer<typeof ReorderExperimentVariantsRequestSchema>;
|
|
327
|
+
declare const UpdateExperimentStatusRequestSchema: z.ZodObject<{
|
|
328
|
+
status: z.ZodEnum<["draft", "running", "pending_decision", "stopped"]>;
|
|
329
|
+
}, "strip", z.ZodTypeAny, {
|
|
330
|
+
status: "draft" | "running" | "pending_decision" | "stopped";
|
|
331
|
+
}, {
|
|
332
|
+
status: "draft" | "running" | "pending_decision" | "stopped";
|
|
333
|
+
}>;
|
|
334
|
+
type UpdateExperimentStatusRequest = z.infer<typeof UpdateExperimentStatusRequestSchema>;
|
|
335
|
+
declare const ListExperimentsResponseSchema: z.ZodObject<{
|
|
336
|
+
items: z.ZodArray<z.ZodObject<{
|
|
337
|
+
id: z.ZodString;
|
|
338
|
+
appId: z.ZodString;
|
|
339
|
+
/** Internal channel uuid. */
|
|
340
|
+
channelId: z.ZodString;
|
|
341
|
+
/** Display name of the channel (denormalized for list views). */
|
|
342
|
+
channelName: z.ZodString;
|
|
343
|
+
/** Test/live env of the channel — kept for badges and analytics filters. */
|
|
344
|
+
channelEnvironment: z.ZodEnum<["test", "live"]>;
|
|
345
|
+
name: z.ZodString;
|
|
346
|
+
status: z.ZodEnum<["draft", "running", "pending_decision", "stopped"]>;
|
|
347
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
348
|
+
id: z.ZodString;
|
|
349
|
+
experimentId: z.ZodString;
|
|
350
|
+
name: z.ZodString;
|
|
351
|
+
weight: z.ZodNumber;
|
|
352
|
+
flowId: z.ZodNullable<z.ZodString>;
|
|
353
|
+
versionId: z.ZodNullable<z.ZodString>;
|
|
354
|
+
/** Convenience read fields populated by list/get endpoints. */
|
|
355
|
+
flowName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
356
|
+
versionNumber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
357
|
+
versionLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
358
|
+
}, "strip", z.ZodTypeAny, {
|
|
359
|
+
id: string;
|
|
360
|
+
name: string;
|
|
361
|
+
flowId: string | null;
|
|
362
|
+
weight: number;
|
|
363
|
+
versionId: string | null;
|
|
364
|
+
experimentId: string;
|
|
365
|
+
versionNumber?: number | null | undefined;
|
|
366
|
+
flowName?: string | null | undefined;
|
|
367
|
+
versionLabel?: string | null | undefined;
|
|
368
|
+
}, {
|
|
369
|
+
id: string;
|
|
370
|
+
name: string;
|
|
371
|
+
flowId: string | null;
|
|
372
|
+
weight: number;
|
|
373
|
+
versionId: string | null;
|
|
374
|
+
experimentId: string;
|
|
375
|
+
versionNumber?: number | null | undefined;
|
|
376
|
+
flowName?: string | null | undefined;
|
|
377
|
+
versionLabel?: string | null | undefined;
|
|
378
|
+
}>, "many">;
|
|
379
|
+
startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
380
|
+
stoppedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
381
|
+
endsAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
382
|
+
endedReason: z.ZodOptional<z.ZodNullable<z.ZodEnum<["manual", "scheduled_resolved"]>>>;
|
|
383
|
+
archivedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
384
|
+
createdAt: z.ZodString;
|
|
385
|
+
/** Dashboard user who created the experiment (null for legacy rows). */
|
|
386
|
+
createdByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
387
|
+
/** Display: full name, else @username, else email; null when unknown. */
|
|
388
|
+
createdByLabel: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
389
|
+
tags: z.ZodArray<z.ZodString, "many">;
|
|
390
|
+
/** Power-analysis inputs; nulls → dashboard defaults for sample accumulation. */
|
|
391
|
+
statsDesignBaselineCvr: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
392
|
+
statsDesignMdePp: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
393
|
+
statsDesignAlpha: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
394
|
+
statsDesignPower: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
395
|
+
}, "strip", z.ZodTypeAny, {
|
|
396
|
+
status: "draft" | "running" | "pending_decision" | "stopped";
|
|
397
|
+
id: string;
|
|
398
|
+
name: string;
|
|
399
|
+
createdAt: string;
|
|
400
|
+
tags: string[];
|
|
401
|
+
appId: string;
|
|
402
|
+
channelId: string;
|
|
403
|
+
channelName: string;
|
|
404
|
+
channelEnvironment: "test" | "live";
|
|
405
|
+
variants: {
|
|
406
|
+
id: string;
|
|
407
|
+
name: string;
|
|
408
|
+
flowId: string | null;
|
|
409
|
+
weight: number;
|
|
410
|
+
versionId: string | null;
|
|
411
|
+
experimentId: string;
|
|
412
|
+
versionNumber?: number | null | undefined;
|
|
413
|
+
flowName?: string | null | undefined;
|
|
414
|
+
versionLabel?: string | null | undefined;
|
|
415
|
+
}[];
|
|
416
|
+
archivedAt?: string | null | undefined;
|
|
417
|
+
createdByUserId?: string | null | undefined;
|
|
418
|
+
startedAt?: string | null | undefined;
|
|
419
|
+
stoppedAt?: string | null | undefined;
|
|
420
|
+
endsAt?: string | null | undefined;
|
|
421
|
+
endedReason?: "manual" | "scheduled_resolved" | null | undefined;
|
|
422
|
+
createdByLabel?: string | null | undefined;
|
|
423
|
+
statsDesignBaselineCvr?: number | null | undefined;
|
|
424
|
+
statsDesignMdePp?: number | null | undefined;
|
|
425
|
+
statsDesignAlpha?: number | null | undefined;
|
|
426
|
+
statsDesignPower?: number | null | undefined;
|
|
427
|
+
}, {
|
|
428
|
+
status: "draft" | "running" | "pending_decision" | "stopped";
|
|
429
|
+
id: string;
|
|
430
|
+
name: string;
|
|
431
|
+
createdAt: string;
|
|
432
|
+
tags: string[];
|
|
433
|
+
appId: string;
|
|
434
|
+
channelId: string;
|
|
435
|
+
channelName: string;
|
|
436
|
+
channelEnvironment: "test" | "live";
|
|
437
|
+
variants: {
|
|
438
|
+
id: string;
|
|
439
|
+
name: string;
|
|
440
|
+
flowId: string | null;
|
|
441
|
+
weight: number;
|
|
442
|
+
versionId: string | null;
|
|
443
|
+
experimentId: string;
|
|
444
|
+
versionNumber?: number | null | undefined;
|
|
445
|
+
flowName?: string | null | undefined;
|
|
446
|
+
versionLabel?: string | null | undefined;
|
|
447
|
+
}[];
|
|
448
|
+
archivedAt?: string | null | undefined;
|
|
449
|
+
createdByUserId?: string | null | undefined;
|
|
450
|
+
startedAt?: string | null | undefined;
|
|
451
|
+
stoppedAt?: string | null | undefined;
|
|
452
|
+
endsAt?: string | null | undefined;
|
|
453
|
+
endedReason?: "manual" | "scheduled_resolved" | null | undefined;
|
|
454
|
+
createdByLabel?: string | null | undefined;
|
|
455
|
+
statsDesignBaselineCvr?: number | null | undefined;
|
|
456
|
+
statsDesignMdePp?: number | null | undefined;
|
|
457
|
+
statsDesignAlpha?: number | null | undefined;
|
|
458
|
+
statsDesignPower?: number | null | undefined;
|
|
459
|
+
}>, "many">;
|
|
460
|
+
}, "strip", z.ZodTypeAny, {
|
|
461
|
+
items: {
|
|
462
|
+
status: "draft" | "running" | "pending_decision" | "stopped";
|
|
463
|
+
id: string;
|
|
464
|
+
name: string;
|
|
465
|
+
createdAt: string;
|
|
466
|
+
tags: string[];
|
|
467
|
+
appId: string;
|
|
468
|
+
channelId: string;
|
|
469
|
+
channelName: string;
|
|
470
|
+
channelEnvironment: "test" | "live";
|
|
471
|
+
variants: {
|
|
472
|
+
id: string;
|
|
473
|
+
name: string;
|
|
474
|
+
flowId: string | null;
|
|
475
|
+
weight: number;
|
|
476
|
+
versionId: string | null;
|
|
477
|
+
experimentId: string;
|
|
478
|
+
versionNumber?: number | null | undefined;
|
|
479
|
+
flowName?: string | null | undefined;
|
|
480
|
+
versionLabel?: string | null | undefined;
|
|
481
|
+
}[];
|
|
482
|
+
archivedAt?: string | null | undefined;
|
|
483
|
+
createdByUserId?: string | null | undefined;
|
|
484
|
+
startedAt?: string | null | undefined;
|
|
485
|
+
stoppedAt?: string | null | undefined;
|
|
486
|
+
endsAt?: string | null | undefined;
|
|
487
|
+
endedReason?: "manual" | "scheduled_resolved" | null | undefined;
|
|
488
|
+
createdByLabel?: string | null | undefined;
|
|
489
|
+
statsDesignBaselineCvr?: number | null | undefined;
|
|
490
|
+
statsDesignMdePp?: number | null | undefined;
|
|
491
|
+
statsDesignAlpha?: number | null | undefined;
|
|
492
|
+
statsDesignPower?: number | null | undefined;
|
|
493
|
+
}[];
|
|
494
|
+
}, {
|
|
495
|
+
items: {
|
|
496
|
+
status: "draft" | "running" | "pending_decision" | "stopped";
|
|
497
|
+
id: string;
|
|
498
|
+
name: string;
|
|
499
|
+
createdAt: string;
|
|
500
|
+
tags: string[];
|
|
501
|
+
appId: string;
|
|
502
|
+
channelId: string;
|
|
503
|
+
channelName: string;
|
|
504
|
+
channelEnvironment: "test" | "live";
|
|
505
|
+
variants: {
|
|
506
|
+
id: string;
|
|
507
|
+
name: string;
|
|
508
|
+
flowId: string | null;
|
|
509
|
+
weight: number;
|
|
510
|
+
versionId: string | null;
|
|
511
|
+
experimentId: string;
|
|
512
|
+
versionNumber?: number | null | undefined;
|
|
513
|
+
flowName?: string | null | undefined;
|
|
514
|
+
versionLabel?: string | null | undefined;
|
|
515
|
+
}[];
|
|
516
|
+
archivedAt?: string | null | undefined;
|
|
517
|
+
createdByUserId?: string | null | undefined;
|
|
518
|
+
startedAt?: string | null | undefined;
|
|
519
|
+
stoppedAt?: string | null | undefined;
|
|
520
|
+
endsAt?: string | null | undefined;
|
|
521
|
+
endedReason?: "manual" | "scheduled_resolved" | null | undefined;
|
|
522
|
+
createdByLabel?: string | null | undefined;
|
|
523
|
+
statsDesignBaselineCvr?: number | null | undefined;
|
|
524
|
+
statsDesignMdePp?: number | null | undefined;
|
|
525
|
+
statsDesignAlpha?: number | null | undefined;
|
|
526
|
+
statsDesignPower?: number | null | undefined;
|
|
527
|
+
}[];
|
|
528
|
+
}>;
|
|
529
|
+
|
|
530
|
+
export { type CreateExperimentRequest as C, type ExperimentStatus as E, ListExperimentsResponseSchema as L, type ReorderExperimentVariantsRequest as R, type StopExperimentRequest as S, type UpdateExperimentRequest as U, type Variant as V, CreateExperimentRequestSchema as a, type CreateVariantRequest as b, CreateVariantRequestSchema as c, EXPERIMENT_STATS_DESIGN_DEFAULTS as d, type Experiment as e, type ExperimentEndedReason as f, ExperimentEndedReasonSchema as g, ExperimentSchema as h, type ExperimentStatsDesignInput as i, ExperimentStatsDesignInputSchema as j, ExperimentStatusSchema as k, type ExtendExperimentRequest as l, ExtendExperimentRequestSchema as m, ReorderExperimentVariantsRequestSchema as n, StopExperimentRequestSchema as o, UpdateExperimentRequestSchema as p, type UpdateExperimentStatusRequest as q, UpdateExperimentStatusRequestSchema as r, VariantSchema as s };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ResolvedAppIntegrations } from './appIntegrations.js';
|
|
2
|
+
import { RevenueCatSurfacePresentation, SurfaceProvider, ExternalSurfaceConfig } from './externalSurfaces.js';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import './decisions.js';
|
|
5
|
+
|
|
6
|
+
/** Enabled app integrations that can be chosen for an external integration step (excludes `unspecified`). */
|
|
7
|
+
type ExternalSurfaceIntegrationProvider = Exclude<SurfaceProvider, 'unspecified'>;
|
|
8
|
+
/** App integrations that are turned on and may power an external integration canvas step. */
|
|
9
|
+
declare const listEnabledExternalSurfaceProviders: (integrations: ResolvedAppIntegrations) => ExternalSurfaceIntegrationProvider[];
|
|
10
|
+
declare const externalSurfaceProviderLabel: (provider: SurfaceProvider) => string;
|
|
11
|
+
declare const externalSurfaceProviderMenuDescription: (provider: ExternalSurfaceIntegrationProvider) => string;
|
|
12
|
+
type CreateExternalSurfaceConfigOptions = {
|
|
13
|
+
offeringId?: string;
|
|
14
|
+
placementId?: string;
|
|
15
|
+
presentation?: RevenueCatSurfacePresentation;
|
|
16
|
+
};
|
|
17
|
+
/** Build manifest `config` for a surface provider (extend the switch as new providers ship). */
|
|
18
|
+
declare const createExternalSurfaceConfig: (provider: SurfaceProvider, options?: CreateExternalSurfaceConfigOptions) => ExternalSurfaceConfig;
|
|
19
|
+
|
|
20
|
+
export { type CreateExternalSurfaceConfigOptions, type ExternalSurfaceIntegrationProvider, createExternalSurfaceConfig, externalSurfaceProviderLabel, externalSurfaceProviderMenuDescription, listEnabledExternalSurfaceProviders };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/externalSurfaceIntegrations.ts
|
|
2
|
+
var listEnabledExternalSurfaceProviders = (integrations) => {
|
|
3
|
+
const out = [];
|
|
4
|
+
if (integrations.revenuecat.enabled) out.push("revenuecat");
|
|
5
|
+
return out;
|
|
6
|
+
};
|
|
7
|
+
var externalSurfaceProviderLabel = (provider) => {
|
|
8
|
+
switch (provider) {
|
|
9
|
+
case "unspecified":
|
|
10
|
+
return "Not selected";
|
|
11
|
+
case "revenuecat":
|
|
12
|
+
return "RevenueCat";
|
|
13
|
+
default: {
|
|
14
|
+
const _exhaustive = provider;
|
|
15
|
+
return _exhaustive;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var externalSurfaceProviderMenuDescription = (provider) => {
|
|
20
|
+
switch (provider) {
|
|
21
|
+
case "revenuecat":
|
|
22
|
+
return "Present the host RevenueCat paywall and branch on purchase, restore, dismiss, or failure.";
|
|
23
|
+
default: {
|
|
24
|
+
const _exhaustive = provider;
|
|
25
|
+
return _exhaustive;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var createExternalSurfaceConfig = (provider, options) => {
|
|
30
|
+
switch (provider) {
|
|
31
|
+
case "unspecified":
|
|
32
|
+
return { provider: "unspecified" };
|
|
33
|
+
case "revenuecat":
|
|
34
|
+
return {
|
|
35
|
+
provider: "revenuecat",
|
|
36
|
+
...options?.offeringId ? { offeringId: options.offeringId } : {},
|
|
37
|
+
...options?.placementId ? { placementId: options.placementId } : {},
|
|
38
|
+
...options?.presentation ? { presentation: options.presentation } : {}
|
|
39
|
+
};
|
|
40
|
+
default: {
|
|
41
|
+
const _exhaustive = provider;
|
|
42
|
+
return _exhaustive;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export { createExternalSurfaceConfig, externalSurfaceProviderLabel, externalSurfaceProviderMenuDescription, listEnabledExternalSurfaceProviders };
|
|
48
|
+
//# sourceMappingURL=externalSurfaceIntegrations.js.map
|
|
49
|
+
//# sourceMappingURL=externalSurfaceIntegrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/externalSurfaceIntegrations.ts"],"names":[],"mappings":";AAWO,IAAM,mCAAA,GAAsC,CACjD,YAAA,KACyC;AACzC,EAAA,MAAM,MAA4C,EAAC;AACnD,EAAA,IAAI,YAAA,CAAa,UAAA,CAAW,OAAA,EAAS,GAAA,CAAI,KAAK,YAAY,CAAA;AAC1D,EAAA,OAAO,GAAA;AACT;AAEO,IAAM,4BAAA,GAA+B,CAAC,QAAA,KAAsC;AACjF,EAAA,QAAQ,QAAA;AAAU,IAChB,KAAK,aAAA;AACH,MAAA,OAAO,cAAA;AAAA,IACT,KAAK,YAAA;AACH,MAAA,OAAO,YAAA;AAAA,IACT,SAAS;AACP,MAAA,MAAM,WAAA,GAAqB,QAAA;AAC3B,MAAA,OAAO,WAAA;AAAA,IACT;AAAA;AAEJ;AAEO,IAAM,sCAAA,GAAyC,CACpD,QAAA,KACW;AACX,EAAA,QAAQ,QAAA;AAAU,IAChB,KAAK,YAAA;AACH,MAAA,OAAO,2FAAA;AAAA,IACT,SAAS;AACP,MAAA,MAAM,WAAA,GAAqB,QAAA;AAC3B,MAAA,OAAO,WAAA;AAAA,IACT;AAAA;AAEJ;AASO,IAAM,2BAAA,GAA8B,CACzC,QAAA,EACA,OAAA,KAC0B;AAC1B,EAAA,QAAQ,QAAA;AAAU,IAChB,KAAK,aAAA;AACH,MAAA,OAAO,EAAE,UAAU,aAAA,EAAc;AAAA,IACnC,KAAK,YAAA;AACH,MAAA,OAAO;AAAA,QACL,QAAA,EAAU,YAAA;AAAA,QACV,GAAI,SAAS,UAAA,GAAa,EAAE,YAAY,OAAA,CAAQ,UAAA,KAAe,EAAC;AAAA,QAChE,GAAI,SAAS,WAAA,GAAc,EAAE,aAAa,OAAA,CAAQ,WAAA,KAAgB,EAAC;AAAA,QACnE,GAAI,SAAS,YAAA,GAAe,EAAE,cAAc,OAAA,CAAQ,YAAA,KAAiB;AAAC,OACxE;AAAA,IACF,SAAS;AACP,MAAA,MAAM,WAAA,GAAqB,QAAA;AAC3B,MAAA,OAAO,WAAA;AAAA,IACT;AAAA;AAEJ","file":"externalSurfaceIntegrations.js","sourcesContent":["import type { ResolvedAppIntegrations } from './appIntegrations';\nimport type {\n ExternalSurfaceConfig,\n RevenueCatSurfacePresentation,\n SurfaceProvider,\n} from './externalSurfaces';\n\n/** Enabled app integrations that can be chosen for an external integration step (excludes `unspecified`). */\nexport type ExternalSurfaceIntegrationProvider = Exclude<SurfaceProvider, 'unspecified'>;\n\n/** App integrations that are turned on and may power an external integration canvas step. */\nexport const listEnabledExternalSurfaceProviders = (\n integrations: ResolvedAppIntegrations,\n): ExternalSurfaceIntegrationProvider[] => {\n const out: ExternalSurfaceIntegrationProvider[] = [];\n if (integrations.revenuecat.enabled) out.push('revenuecat');\n return out;\n};\n\nexport const externalSurfaceProviderLabel = (provider: SurfaceProvider): string => {\n switch (provider) {\n case 'unspecified':\n return 'Not selected';\n case 'revenuecat':\n return 'RevenueCat';\n default: {\n const _exhaustive: never = provider;\n return _exhaustive;\n }\n }\n};\n\nexport const externalSurfaceProviderMenuDescription = (\n provider: ExternalSurfaceIntegrationProvider,\n): string => {\n switch (provider) {\n case 'revenuecat':\n return 'Present the host RevenueCat paywall and branch on purchase, restore, dismiss, or failure.';\n default: {\n const _exhaustive: never = provider;\n return _exhaustive;\n }\n }\n};\n\nexport type CreateExternalSurfaceConfigOptions = {\n offeringId?: string;\n placementId?: string;\n presentation?: RevenueCatSurfacePresentation;\n};\n\n/** Build manifest `config` for a surface provider (extend the switch as new providers ship). */\nexport const createExternalSurfaceConfig = (\n provider: SurfaceProvider,\n options?: CreateExternalSurfaceConfigOptions,\n): ExternalSurfaceConfig => {\n switch (provider) {\n case 'unspecified':\n return { provider: 'unspecified' };\n case 'revenuecat':\n return {\n provider: 'revenuecat',\n ...(options?.offeringId ? { offeringId: options.offeringId } : {}),\n ...(options?.placementId ? { placementId: options.placementId } : {}),\n ...(options?.presentation ? { presentation: options.presentation } : {}),\n };\n default: {\n const _exhaustive: never = provider;\n return _exhaustive;\n }\n }\n};\n"]}
|