@kubuild/schema 0.6.0 → 0.7.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/actions.d.ts +21 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/document.d.ts +1 -82
- package/dist/document.d.ts.map +1 -1
- package/dist/index.cjs +269 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +252 -49
- package/dist/index.js.map +1 -1
- package/dist/json-schema.d.ts +251 -6
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/template.d.ts +0 -18
- package/dist/template.d.ts.map +1 -1
- package/dist/tracking.d.ts +178 -31
- package/dist/tracking.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
CopyClipboardStepPayloadSchema: () => CopyClipboardStepPayloadSchema,
|
|
42
42
|
CustomEventStepPayloadSchema: () => CustomEventStepPayloadSchema,
|
|
43
43
|
CustomTrackingProviderConfigSchema: () => CustomTrackingProviderConfigSchema,
|
|
44
|
+
CustomTrackingSecretsSchema: () => CustomTrackingSecretsSchema,
|
|
44
45
|
DEFAULT_ANIMATION_CONFIG: () => DEFAULT_ANIMATION_CONFIG,
|
|
45
46
|
DocumentMetadataSchema: () => DocumentMetadataSchema,
|
|
46
47
|
FORM_CONFIG_JSON_SCHEMA_V1: () => FORM_CONFIG_JSON_SCHEMA_V1,
|
|
@@ -48,11 +49,14 @@ __export(index_exports, {
|
|
|
48
49
|
FormConfigSchema: () => FormConfigSchema,
|
|
49
50
|
FormFieldBindingSchema: () => FormFieldBindingSchema,
|
|
50
51
|
GoogleTrackingProviderConfigSchema: () => GoogleTrackingProviderConfigSchema,
|
|
52
|
+
GoogleTrackingSecretsSchema: () => GoogleTrackingSecretsSchema,
|
|
51
53
|
GtmTrackingProviderConfigSchema: () => GtmTrackingProviderConfigSchema,
|
|
54
|
+
LEGACY_TRACKING_SECRET_KEYS: () => LEGACY_TRACKING_SECRET_KEYS,
|
|
52
55
|
MANIFEST_JSON_SCHEMA_V1: () => MANIFEST_JSON_SCHEMA_V1,
|
|
53
56
|
ManifestAssetItemSchema: () => ManifestAssetItemSchema,
|
|
54
57
|
ManifestSchema: () => ManifestSchema,
|
|
55
58
|
MetaTrackingProviderConfigSchema: () => MetaTrackingProviderConfigSchema,
|
|
59
|
+
MetaTrackingSecretsSchema: () => MetaTrackingSecretsSchema,
|
|
56
60
|
NavigateStepPayloadSchema: () => NavigateStepPayloadSchema,
|
|
57
61
|
NodeSchema: () => NodeSchema,
|
|
58
62
|
OpenModalStepPayloadSchema: () => OpenModalStepPayloadSchema,
|
|
@@ -68,6 +72,7 @@ __export(index_exports, {
|
|
|
68
72
|
SafeThumbnailObjectSchema: () => SafeThumbnailObjectSchema,
|
|
69
73
|
SafeThumbnailSchema: () => SafeThumbnailSchema,
|
|
70
74
|
SafeThumbnailUrlSchema: () => SafeThumbnailUrlSchema,
|
|
75
|
+
ServerTrackingEventSchema: () => ServerTrackingEventSchema,
|
|
71
76
|
SetStateStepPayloadSchema: () => SetStateStepPayloadSchema,
|
|
72
77
|
ShowToastStepPayloadSchema: () => ShowToastStepPayloadSchema,
|
|
73
78
|
StandardTrackingEventSchema: () => StandardTrackingEventSchema,
|
|
@@ -75,14 +80,22 @@ __export(index_exports, {
|
|
|
75
80
|
StyleDefinitionSchema: () => StyleDefinitionSchema,
|
|
76
81
|
StyleValueSchema: () => StyleValueSchema,
|
|
77
82
|
TEMPLATE_RECORD_JSON_SCHEMA_V1: () => TEMPLATE_RECORD_JSON_SCHEMA_V1,
|
|
83
|
+
TRACKING_RELAY_PROTOCOL_VERSION: () => TRACKING_RELAY_PROTOCOL_VERSION,
|
|
78
84
|
TemplatePackageRefSchema: () => TemplatePackageRefSchema,
|
|
79
85
|
TemplateRecordSchema: () => TemplateRecordSchema,
|
|
80
86
|
TemplateRequirementsSchema: () => TemplateRequirementsSchema,
|
|
81
87
|
TikTokTrackingProviderConfigSchema: () => TikTokTrackingProviderConfigSchema,
|
|
88
|
+
TikTokTrackingSecretsSchema: () => TikTokTrackingSecretsSchema,
|
|
89
|
+
ToggleModalStepPayloadSchema: () => ToggleModalStepPayloadSchema,
|
|
90
|
+
TrackEventProviderSchema: () => TrackEventProviderSchema,
|
|
82
91
|
TrackEventStepPayloadSchema: () => TrackEventStepPayloadSchema,
|
|
83
92
|
TrackingConfigSchema: () => TrackingConfigSchema,
|
|
84
93
|
TrackingDeliverySchema: () => TrackingDeliverySchema,
|
|
85
94
|
TrackingProviderTypeSchema: () => TrackingProviderTypeSchema,
|
|
95
|
+
TrackingRelayErrorCodeSchema: () => TrackingRelayErrorCodeSchema,
|
|
96
|
+
TrackingRelayProviderResultSchema: () => TrackingRelayProviderResultSchema,
|
|
97
|
+
TrackingRelayRequestSchema: () => TrackingRelayRequestSchema,
|
|
98
|
+
TrackingRelayResponseSchema: () => TrackingRelayResponseSchema,
|
|
86
99
|
ValidateOnEventSchema: () => ValidateOnEventSchema,
|
|
87
100
|
ValidationRuleSchema: () => ValidationRuleSchema,
|
|
88
101
|
ValidationRuleTypeSchema: () => ValidationRuleTypeSchema,
|
|
@@ -95,6 +108,9 @@ __export(index_exports, {
|
|
|
95
108
|
getManifestJsonSchema: () => getManifestJsonSchema,
|
|
96
109
|
getPageDocumentJsonSchema: () => getPageDocumentJsonSchema,
|
|
97
110
|
getTemplateRecordJsonSchema: () => getTemplateRecordJsonSchema,
|
|
111
|
+
getTrackingProviderSecretsJsonSchema: () => getTrackingProviderSecretsJsonSchema,
|
|
112
|
+
getTrackingRelayRequestJsonSchema: () => getTrackingRelayRequestJsonSchema,
|
|
113
|
+
getTrackingRelayResponseJsonSchema: () => getTrackingRelayResponseJsonSchema,
|
|
98
114
|
isActionBinding: () => isActionBinding,
|
|
99
115
|
isActionPipeline: () => isActionPipeline,
|
|
100
116
|
isActionStep: () => isActionStep,
|
|
@@ -115,6 +131,7 @@ __export(index_exports, {
|
|
|
115
131
|
isTemplateRecord: () => isTemplateRecord,
|
|
116
132
|
isTrackEventStepPayload: () => isTrackEventStepPayload,
|
|
117
133
|
isTrackingConfig: () => isTrackingConfig,
|
|
134
|
+
isTrackingRelayRequest: () => isTrackingRelayRequest,
|
|
118
135
|
isValidateOnEvent: () => isValidateOnEvent,
|
|
119
136
|
isValidationRule: () => isValidationRule,
|
|
120
137
|
isValidationRuleType: () => isValidationRuleType,
|
|
@@ -150,69 +167,51 @@ var TrackingProviderTypeSchema = import_zod.z.enum([
|
|
|
150
167
|
var TrackingDeliverySchema = import_zod.z.enum(["both", "client_only", "server_only"]);
|
|
151
168
|
var MetaTrackingProviderConfigSchema = import_zod.z.object({
|
|
152
169
|
enabled: import_zod.z.boolean().default(true),
|
|
153
|
-
/**
|
|
170
|
+
/** Host credential id; the server resolves the CAPI access token from it. */
|
|
154
171
|
credentialId: import_zod.z.string().optional(),
|
|
155
|
-
/** Meta Pixel ID (e.g. 123456789012345) */
|
|
172
|
+
/** Meta Pixel ID (e.g. 123456789012345) — public */
|
|
156
173
|
pixelId: import_zod.z.string().optional().default(""),
|
|
157
|
-
/** Enable Server-Side Conversions API */
|
|
174
|
+
/** Enable Server-Side Conversions API (delivered through the host relay) */
|
|
158
175
|
capiEnabled: import_zod.z.boolean().optional().default(false),
|
|
159
|
-
/**
|
|
160
|
-
|
|
161
|
-
* Note: For security in production, prefer configuring tokens on your server backend
|
|
162
|
-
* or proxying via `serverRelayUrl`.
|
|
163
|
-
*/
|
|
164
|
-
capiAccessToken: import_zod.z.string().optional().default(""),
|
|
165
|
-
/** Test Event Code from Meta Events Manager (e.g. "TEST12345") */
|
|
166
|
-
testEventCode: import_zod.z.string().optional().default(""),
|
|
167
|
-
/**
|
|
168
|
-
* Host Server Relay URL (e.g. "/api/tracking/meta").
|
|
169
|
-
* Recommended for browser clients to post CAPI events safely without exposing the secret token.
|
|
170
|
-
*/
|
|
171
|
-
serverRelayUrl: import_zod.z.string().optional().default("")
|
|
176
|
+
/** Test Event Code from Meta Events Manager (e.g. "TEST12345") — not a secret */
|
|
177
|
+
testEventCode: import_zod.z.string().optional().default("")
|
|
172
178
|
});
|
|
173
179
|
var GoogleTrackingProviderConfigSchema = import_zod.z.object({
|
|
174
180
|
enabled: import_zod.z.boolean().default(true),
|
|
175
|
-
/**
|
|
181
|
+
/** Host credential id; the server resolves the Measurement Protocol API secret from it. */
|
|
176
182
|
credentialId: import_zod.z.string().optional(),
|
|
177
|
-
/** GA4 Measurement ID (e.g. "G-XXXXXXXXXX") */
|
|
178
|
-
measurementId: import_zod.z.string().optional().default("")
|
|
179
|
-
/** GA4 Measurement Protocol API Secret (for server-side events) */
|
|
180
|
-
measurementProtocolSecret: import_zod.z.string().optional().default(""),
|
|
181
|
-
/** Host Server Relay URL (e.g. "/api/tracking/ga4") */
|
|
182
|
-
serverRelayUrl: import_zod.z.string().optional().default("")
|
|
183
|
+
/** GA4 Measurement ID (e.g. "G-XXXXXXXXXX") — public */
|
|
184
|
+
measurementId: import_zod.z.string().optional().default("")
|
|
183
185
|
});
|
|
184
186
|
var GtmTrackingProviderConfigSchema = import_zod.z.object({
|
|
185
187
|
enabled: import_zod.z.boolean().default(true),
|
|
186
188
|
/** Optional linked account/workspace credential ID */
|
|
187
189
|
credentialId: import_zod.z.string().optional(),
|
|
188
|
-
/** GTM Container ID (e.g. "GTM-XXXXXXX") */
|
|
189
|
-
containerId: import_zod.z.string().optional().default("")
|
|
190
|
-
/** Host Server Relay URL */
|
|
191
|
-
serverRelayUrl: import_zod.z.string().optional().default("")
|
|
190
|
+
/** GTM Container ID (e.g. "GTM-XXXXXXX") — public */
|
|
191
|
+
containerId: import_zod.z.string().optional().default("")
|
|
192
192
|
});
|
|
193
193
|
var TikTokTrackingProviderConfigSchema = import_zod.z.object({
|
|
194
194
|
enabled: import_zod.z.boolean().default(true),
|
|
195
|
-
/**
|
|
195
|
+
/** Host credential id; the server resolves the Events API access token from it. */
|
|
196
196
|
credentialId: import_zod.z.string().optional(),
|
|
197
|
-
/** TikTok Pixel ID (e.g. "C1234567890") */
|
|
197
|
+
/** TikTok Pixel ID (e.g. "C1234567890") — public */
|
|
198
198
|
pixelId: import_zod.z.string().optional().default(""),
|
|
199
|
-
/** Enable TikTok Events API (server-side) */
|
|
199
|
+
/** Enable TikTok Events API (server-side, delivered through the host relay) */
|
|
200
200
|
eventsApiEnabled: import_zod.z.boolean().optional().default(false),
|
|
201
|
-
/**
|
|
202
|
-
|
|
203
|
-
/** Test Event Code from TikTok Event Manager */
|
|
204
|
-
testEventCode: import_zod.z.string().optional().default(""),
|
|
205
|
-
/** Host Server Relay URL (e.g. "/api/tracking/tiktok") */
|
|
206
|
-
serverRelayUrl: import_zod.z.string().optional().default("")
|
|
201
|
+
/** Test Event Code from TikTok Event Manager — not a secret */
|
|
202
|
+
testEventCode: import_zod.z.string().optional().default("")
|
|
207
203
|
});
|
|
208
204
|
var CustomTrackingProviderConfigSchema = import_zod.z.object({
|
|
209
205
|
enabled: import_zod.z.boolean().default(true),
|
|
210
|
-
/**
|
|
211
|
-
credentialId: import_zod.z.string().optional()
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
206
|
+
/** Host credential id; the server resolves the webhook `endpointUrl` + `headers` from it. */
|
|
207
|
+
credentialId: import_zod.z.string().optional()
|
|
208
|
+
});
|
|
209
|
+
var LEGACY_TRACKING_SECRET_KEYS = Object.freeze({
|
|
210
|
+
meta: ["capiAccessToken", "serverRelayUrl"],
|
|
211
|
+
google: ["measurementProtocolSecret", "serverRelayUrl"],
|
|
212
|
+
gtm: ["serverRelayUrl"],
|
|
213
|
+
tiktok: ["accessToken", "serverRelayUrl"],
|
|
214
|
+
custom: ["endpointUrl", "headers"]
|
|
216
215
|
});
|
|
217
216
|
var TrackingConfigSchema = import_zod.z.object({
|
|
218
217
|
/** Master toggle: dynamically enables or disables all tracking operations */
|
|
@@ -232,6 +231,22 @@ var TrackingConfigSchema = import_zod.z.object({
|
|
|
232
231
|
custom: CustomTrackingProviderConfigSchema.optional()
|
|
233
232
|
}).optional().default({})
|
|
234
233
|
});
|
|
234
|
+
var MetaTrackingSecretsSchema = import_zod.z.object({
|
|
235
|
+
/** System User access token for the Meta Graph API. */
|
|
236
|
+
capiAccessToken: import_zod.z.string().min(1)
|
|
237
|
+
});
|
|
238
|
+
var GoogleTrackingSecretsSchema = import_zod.z.object({
|
|
239
|
+
/** Measurement Protocol `api_secret`. */
|
|
240
|
+
measurementProtocolSecret: import_zod.z.string().min(1)
|
|
241
|
+
});
|
|
242
|
+
var TikTokTrackingSecretsSchema = import_zod.z.object({
|
|
243
|
+
/** Long-term Events API access token. */
|
|
244
|
+
accessToken: import_zod.z.string().min(1)
|
|
245
|
+
});
|
|
246
|
+
var CustomTrackingSecretsSchema = import_zod.z.object({
|
|
247
|
+
endpointUrl: import_zod.z.string().url(),
|
|
248
|
+
headers: import_zod.z.record(import_zod.z.string(), import_zod.z.string()).optional()
|
|
249
|
+
});
|
|
235
250
|
var StandardTrackingEventSchema = import_zod.z.enum([
|
|
236
251
|
"PageView",
|
|
237
252
|
"ViewContent",
|
|
@@ -246,13 +261,17 @@ var StandardTrackingEventSchema = import_zod.z.enum([
|
|
|
246
261
|
"SubmitApplication",
|
|
247
262
|
"Schedule"
|
|
248
263
|
]);
|
|
264
|
+
var TrackEventProviderSchema = import_zod.z.enum(["all", "meta", "google", "gtm", "tiktok", "custom"]);
|
|
249
265
|
var TrackEventStepPayloadSchema = import_zod.z.object({
|
|
250
266
|
/** Event name: e.g. "Purchase", "Lead", or custom string */
|
|
251
267
|
eventName: import_zod.z.string().min(1, "Event name cannot be empty"),
|
|
252
268
|
/** Standard event vs custom event identifier */
|
|
253
269
|
eventType: import_zod.z.enum(["standard", "custom"]).optional().default("standard"),
|
|
254
|
-
/**
|
|
255
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Target provider: 'all' or a specific provider.
|
|
272
|
+
* 'gtm' pushes the event to `window.dataLayer` (client-side only).
|
|
273
|
+
*/
|
|
274
|
+
provider: TrackEventProviderSchema.optional().default("all"),
|
|
256
275
|
/** Delivery channel: 'both', 'client_only', or 'server_only' */
|
|
257
276
|
delivery: TrackingDeliverySchema.optional().default("both"),
|
|
258
277
|
/**
|
|
@@ -274,12 +293,66 @@ var TrackEventStepPayloadSchema = import_zod.z.object({
|
|
|
274
293
|
/** Step-level active toggle */
|
|
275
294
|
enabled: import_zod.z.boolean().optional().default(true)
|
|
276
295
|
});
|
|
296
|
+
var TRACKING_RELAY_PROTOCOL_VERSION = 1;
|
|
297
|
+
var ServerTrackingEventSchema = import_zod.z.object({
|
|
298
|
+
eventName: import_zod.z.string().min(1).max(256),
|
|
299
|
+
eventType: import_zod.z.enum(["standard", "custom"]).optional(),
|
|
300
|
+
eventId: import_zod.z.string().max(256).optional(),
|
|
301
|
+
/** Unix epoch seconds. */
|
|
302
|
+
eventTime: import_zod.z.number().int().nonnegative().optional(),
|
|
303
|
+
eventSourceUrl: import_zod.z.string().max(4096).optional(),
|
|
304
|
+
actionSource: import_zod.z.enum(["website", "app", "system_generated"]).optional(),
|
|
305
|
+
params: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional(),
|
|
306
|
+
/** Raw (unhashed) user data; the relay hashes PII per provider spec before forwarding. */
|
|
307
|
+
userData: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional(),
|
|
308
|
+
customData: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional()
|
|
309
|
+
});
|
|
310
|
+
var TrackingRelayRequestSchema = import_zod.z.object({
|
|
311
|
+
version: import_zod.z.literal(TRACKING_RELAY_PROTOCOL_VERSION),
|
|
312
|
+
event: ServerTrackingEventSchema,
|
|
313
|
+
provider: TrackEventProviderSchema.optional().default("all"),
|
|
314
|
+
/** Optional hint only; the relay uses the credentialId from its trusted config. */
|
|
315
|
+
credentialId: import_zod.z.string().max(256).optional(),
|
|
316
|
+
/** Host document/page id so the relay can look up the trusted tracking config. */
|
|
317
|
+
documentId: import_zod.z.string().max(256).optional()
|
|
318
|
+
});
|
|
319
|
+
var TrackingRelayProviderResultSchema = import_zod.z.object({
|
|
320
|
+
provider: import_zod.z.string(),
|
|
321
|
+
success: import_zod.z.boolean(),
|
|
322
|
+
status: import_zod.z.number().int().optional(),
|
|
323
|
+
skipped: import_zod.z.boolean().optional(),
|
|
324
|
+
reason: import_zod.z.string().optional(),
|
|
325
|
+
error: import_zod.z.string().optional()
|
|
326
|
+
});
|
|
327
|
+
var TrackingRelayErrorCodeSchema = import_zod.z.enum([
|
|
328
|
+
"INVALID_REQUEST",
|
|
329
|
+
"UNSUPPORTED_VERSION",
|
|
330
|
+
"FORBIDDEN_ORIGIN",
|
|
331
|
+
"METHOD_NOT_ALLOWED",
|
|
332
|
+
"CONFIG_NOT_FOUND",
|
|
333
|
+
"INTERNAL_ERROR"
|
|
334
|
+
]);
|
|
335
|
+
var TrackingRelayResponseSchema = import_zod.z.object({
|
|
336
|
+
version: import_zod.z.literal(TRACKING_RELAY_PROTOCOL_VERSION),
|
|
337
|
+
success: import_zod.z.boolean(),
|
|
338
|
+
eventId: import_zod.z.string().optional(),
|
|
339
|
+
skipped: import_zod.z.boolean().optional(),
|
|
340
|
+
reason: import_zod.z.string().optional(),
|
|
341
|
+
results: import_zod.z.record(import_zod.z.string(), TrackingRelayProviderResultSchema).optional(),
|
|
342
|
+
error: import_zod.z.object({
|
|
343
|
+
code: TrackingRelayErrorCodeSchema,
|
|
344
|
+
message: import_zod.z.string()
|
|
345
|
+
}).optional()
|
|
346
|
+
});
|
|
277
347
|
function isTrackingConfig(value) {
|
|
278
348
|
return TrackingConfigSchema.safeParse(value).success;
|
|
279
349
|
}
|
|
280
350
|
function isTrackEventStepPayload(value) {
|
|
281
351
|
return TrackEventStepPayloadSchema.safeParse(value).success;
|
|
282
352
|
}
|
|
353
|
+
function isTrackingRelayRequest(value) {
|
|
354
|
+
return TrackingRelayRequestSchema.safeParse(value).success;
|
|
355
|
+
}
|
|
283
356
|
|
|
284
357
|
// src/actions.ts
|
|
285
358
|
var ActionTriggerTypeSchema = import_zod2.z.enum([
|
|
@@ -299,6 +372,7 @@ var ActionStepTypeSchema = import_zod2.z.enum([
|
|
|
299
372
|
"show_toast",
|
|
300
373
|
"open_modal",
|
|
301
374
|
"close_modal",
|
|
375
|
+
"toggle_modal",
|
|
302
376
|
"copy_clipboard",
|
|
303
377
|
"custom_event",
|
|
304
378
|
"track_event"
|
|
@@ -381,6 +455,19 @@ var CloseModalStepPayloadSchema = import_zod2.z.object({
|
|
|
381
455
|
modalId: import_zod2.z.string().optional(),
|
|
382
456
|
modalNodeId: import_zod2.z.string().optional()
|
|
383
457
|
});
|
|
458
|
+
var ToggleModalStepPayloadSchema = import_zod2.z.object({
|
|
459
|
+
modalId: import_zod2.z.string().optional(),
|
|
460
|
+
modalNodeId: import_zod2.z.string().optional(),
|
|
461
|
+
targetNodeId: import_zod2.z.string().optional(),
|
|
462
|
+
nodeId: import_zod2.z.string().optional()
|
|
463
|
+
}).refine(
|
|
464
|
+
(data) => [data.modalId, data.modalNodeId, data.targetNodeId, data.nodeId].some(
|
|
465
|
+
(id) => typeof id === "string" && id.trim().length > 0
|
|
466
|
+
),
|
|
467
|
+
{
|
|
468
|
+
message: "Modal ID or Modal Node ID cannot be empty"
|
|
469
|
+
}
|
|
470
|
+
);
|
|
384
471
|
var CopyClipboardStepPayloadSchema = import_zod2.z.object({
|
|
385
472
|
text: import_zod2.z.string().optional(),
|
|
386
473
|
value: import_zod2.z.unknown().optional(),
|
|
@@ -401,6 +488,7 @@ var StepPayloadSchemas = {
|
|
|
401
488
|
show_toast: ShowToastStepPayloadSchema,
|
|
402
489
|
open_modal: OpenModalStepPayloadSchema,
|
|
403
490
|
close_modal: CloseModalStepPayloadSchema,
|
|
491
|
+
toggle_modal: ToggleModalStepPayloadSchema,
|
|
404
492
|
copy_clipboard: CopyClipboardStepPayloadSchema,
|
|
405
493
|
custom_event: CustomEventStepPayloadSchema,
|
|
406
494
|
track_event: TrackEventStepPayloadSchema
|
|
@@ -595,7 +683,7 @@ function isFormConfig(value) {
|
|
|
595
683
|
|
|
596
684
|
// src/document.ts
|
|
597
685
|
var SCHEMA_NAME = "stora.page";
|
|
598
|
-
var CURRENT_SCHEMA_VERSION = "1.
|
|
686
|
+
var CURRENT_SCHEMA_VERSION = "1.1.0";
|
|
599
687
|
var AssetReferenceSchema = import_zod4.z.object({
|
|
600
688
|
type: import_zod4.z.literal("asset"),
|
|
601
689
|
assetId: import_zod4.z.string().min(1, "Asset ID cannot be empty"),
|
|
@@ -875,7 +963,7 @@ function isSafeThumbnail(value) {
|
|
|
875
963
|
// src/fixtures/starter-page.json
|
|
876
964
|
var starter_page_default = {
|
|
877
965
|
schema: "stora.page",
|
|
878
|
-
version: "1.
|
|
966
|
+
version: "1.1.0",
|
|
879
967
|
metadata: {
|
|
880
968
|
title: "Welcome to KUBUILD",
|
|
881
969
|
description: "A starter template built with KUBUILD portable web builder",
|
|
@@ -1034,6 +1122,7 @@ var starter_page_default = {
|
|
|
1034
1122
|
var starterPageFixture = starter_page_default;
|
|
1035
1123
|
|
|
1036
1124
|
// src/json-schema.ts
|
|
1125
|
+
var import_zod7 = require("zod");
|
|
1037
1126
|
var PAGE_DOCUMENT_JSON_SCHEMA_V1 = {
|
|
1038
1127
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
1039
1128
|
$id: "https://schema.stora.page/v1/page.json",
|
|
@@ -1052,16 +1141,84 @@ var PAGE_DOCUMENT_JSON_SCHEMA_V1 = {
|
|
|
1052
1141
|
type: "string",
|
|
1053
1142
|
pattern: "^\\d+(\\.\\d+)*$",
|
|
1054
1143
|
description: "Schema version of the document",
|
|
1055
|
-
default: "1.
|
|
1144
|
+
default: "1.1.0"
|
|
1056
1145
|
},
|
|
1057
1146
|
metadata: {
|
|
1058
1147
|
$ref: "#/definitions/documentMetadata"
|
|
1059
1148
|
},
|
|
1060
1149
|
document: {
|
|
1061
1150
|
$ref: "#/definitions/rootPageNode"
|
|
1151
|
+
},
|
|
1152
|
+
tracking: {
|
|
1153
|
+
$ref: "#/definitions/trackingConfig"
|
|
1062
1154
|
}
|
|
1063
1155
|
},
|
|
1064
1156
|
definitions: {
|
|
1157
|
+
trackingConfig: {
|
|
1158
|
+
type: "object",
|
|
1159
|
+
description: "Tracking configuration. Contains only public ids, flags and opaque credential ids \u2014 secrets are host-owned.",
|
|
1160
|
+
properties: {
|
|
1161
|
+
enabled: { type: "boolean", default: true },
|
|
1162
|
+
debugMode: { type: "boolean", default: false },
|
|
1163
|
+
autoPageView: { type: "boolean", default: true },
|
|
1164
|
+
defaultDelivery: { type: "string", enum: ["both", "client_only", "server_only"], default: "both" },
|
|
1165
|
+
providers: {
|
|
1166
|
+
type: "object",
|
|
1167
|
+
properties: {
|
|
1168
|
+
meta: {
|
|
1169
|
+
type: "object",
|
|
1170
|
+
properties: {
|
|
1171
|
+
enabled: { type: "boolean" },
|
|
1172
|
+
credentialId: { type: "string" },
|
|
1173
|
+
pixelId: { type: "string" },
|
|
1174
|
+
capiEnabled: { type: "boolean" },
|
|
1175
|
+
testEventCode: { type: "string" }
|
|
1176
|
+
},
|
|
1177
|
+
additionalProperties: false
|
|
1178
|
+
},
|
|
1179
|
+
google: {
|
|
1180
|
+
type: "object",
|
|
1181
|
+
properties: {
|
|
1182
|
+
enabled: { type: "boolean" },
|
|
1183
|
+
credentialId: { type: "string" },
|
|
1184
|
+
measurementId: { type: "string" }
|
|
1185
|
+
},
|
|
1186
|
+
additionalProperties: false
|
|
1187
|
+
},
|
|
1188
|
+
gtm: {
|
|
1189
|
+
type: "object",
|
|
1190
|
+
properties: {
|
|
1191
|
+
enabled: { type: "boolean" },
|
|
1192
|
+
credentialId: { type: "string" },
|
|
1193
|
+
containerId: { type: "string" }
|
|
1194
|
+
},
|
|
1195
|
+
additionalProperties: false
|
|
1196
|
+
},
|
|
1197
|
+
tiktok: {
|
|
1198
|
+
type: "object",
|
|
1199
|
+
properties: {
|
|
1200
|
+
enabled: { type: "boolean" },
|
|
1201
|
+
credentialId: { type: "string" },
|
|
1202
|
+
pixelId: { type: "string" },
|
|
1203
|
+
eventsApiEnabled: { type: "boolean" },
|
|
1204
|
+
testEventCode: { type: "string" }
|
|
1205
|
+
},
|
|
1206
|
+
additionalProperties: false
|
|
1207
|
+
},
|
|
1208
|
+
custom: {
|
|
1209
|
+
type: "object",
|
|
1210
|
+
properties: {
|
|
1211
|
+
enabled: { type: "boolean" },
|
|
1212
|
+
credentialId: { type: "string" }
|
|
1213
|
+
},
|
|
1214
|
+
additionalProperties: false
|
|
1215
|
+
}
|
|
1216
|
+
},
|
|
1217
|
+
additionalProperties: false
|
|
1218
|
+
}
|
|
1219
|
+
},
|
|
1220
|
+
additionalProperties: false
|
|
1221
|
+
},
|
|
1065
1222
|
styleValue: {
|
|
1066
1223
|
type: ["string", "number", "boolean", "null"],
|
|
1067
1224
|
description: "A CSS property or design token value"
|
|
@@ -1201,8 +1358,10 @@ var PAGE_DOCUMENT_JSON_SCHEMA_V1 = {
|
|
|
1201
1358
|
"show_toast",
|
|
1202
1359
|
"open_modal",
|
|
1203
1360
|
"close_modal",
|
|
1361
|
+
"toggle_modal",
|
|
1204
1362
|
"copy_clipboard",
|
|
1205
|
-
"custom_event"
|
|
1363
|
+
"custom_event",
|
|
1364
|
+
"track_event"
|
|
1206
1365
|
]
|
|
1207
1366
|
},
|
|
1208
1367
|
label: { type: "string" },
|
|
@@ -1723,8 +1882,10 @@ var ACTION_PIPELINE_JSON_SCHEMA_V1 = {
|
|
|
1723
1882
|
"show_toast",
|
|
1724
1883
|
"open_modal",
|
|
1725
1884
|
"close_modal",
|
|
1885
|
+
"toggle_modal",
|
|
1726
1886
|
"copy_clipboard",
|
|
1727
|
-
"custom_event"
|
|
1887
|
+
"custom_event",
|
|
1888
|
+
"track_event"
|
|
1728
1889
|
]
|
|
1729
1890
|
},
|
|
1730
1891
|
label: { type: "string" },
|
|
@@ -1891,6 +2052,48 @@ var FORM_FIELD_BINDING_JSON_SCHEMA_V1 = {
|
|
|
1891
2052
|
function getFormFieldBindingJsonSchema() {
|
|
1892
2053
|
return FORM_FIELD_BINDING_JSON_SCHEMA_V1;
|
|
1893
2054
|
}
|
|
2055
|
+
function toDraft7(schema, id, title, io) {
|
|
2056
|
+
return {
|
|
2057
|
+
...import_zod7.z.toJSONSchema(schema, { target: "draft-7", io }),
|
|
2058
|
+
$id: id,
|
|
2059
|
+
title
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
var trackingRelayRequestJsonSchema;
|
|
2063
|
+
var trackingRelayResponseJsonSchema;
|
|
2064
|
+
var trackingProviderSecretsJsonSchema;
|
|
2065
|
+
function getTrackingRelayRequestJsonSchema() {
|
|
2066
|
+
trackingRelayRequestJsonSchema ??= toDraft7(
|
|
2067
|
+
TrackingRelayRequestSchema,
|
|
2068
|
+
"https://schema.stora.page/v1/tracking-relay-request.json",
|
|
2069
|
+
"StoraTrackingRelayRequest",
|
|
2070
|
+
"input"
|
|
2071
|
+
);
|
|
2072
|
+
return trackingRelayRequestJsonSchema;
|
|
2073
|
+
}
|
|
2074
|
+
function getTrackingRelayResponseJsonSchema() {
|
|
2075
|
+
trackingRelayResponseJsonSchema ??= toDraft7(
|
|
2076
|
+
TrackingRelayResponseSchema,
|
|
2077
|
+
"https://schema.stora.page/v1/tracking-relay-response.json",
|
|
2078
|
+
"StoraTrackingRelayResponse",
|
|
2079
|
+
"output"
|
|
2080
|
+
);
|
|
2081
|
+
return trackingRelayResponseJsonSchema;
|
|
2082
|
+
}
|
|
2083
|
+
function getTrackingProviderSecretsJsonSchema() {
|
|
2084
|
+
trackingProviderSecretsJsonSchema ??= toDraft7(
|
|
2085
|
+
import_zod7.z.object({
|
|
2086
|
+
meta: MetaTrackingSecretsSchema.optional(),
|
|
2087
|
+
google: GoogleTrackingSecretsSchema.optional(),
|
|
2088
|
+
tiktok: TikTokTrackingSecretsSchema.optional(),
|
|
2089
|
+
custom: CustomTrackingSecretsSchema.optional()
|
|
2090
|
+
}),
|
|
2091
|
+
"https://schema.stora.page/v1/tracking-provider-secrets.json",
|
|
2092
|
+
"StoraTrackingProviderSecrets",
|
|
2093
|
+
"input"
|
|
2094
|
+
);
|
|
2095
|
+
return trackingProviderSecretsJsonSchema;
|
|
2096
|
+
}
|
|
1894
2097
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1895
2098
|
0 && (module.exports = {
|
|
1896
2099
|
ACTION_PIPELINE_JSON_SCHEMA_V1,
|
|
@@ -1914,6 +2117,7 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1914
2117
|
CopyClipboardStepPayloadSchema,
|
|
1915
2118
|
CustomEventStepPayloadSchema,
|
|
1916
2119
|
CustomTrackingProviderConfigSchema,
|
|
2120
|
+
CustomTrackingSecretsSchema,
|
|
1917
2121
|
DEFAULT_ANIMATION_CONFIG,
|
|
1918
2122
|
DocumentMetadataSchema,
|
|
1919
2123
|
FORM_CONFIG_JSON_SCHEMA_V1,
|
|
@@ -1921,11 +2125,14 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1921
2125
|
FormConfigSchema,
|
|
1922
2126
|
FormFieldBindingSchema,
|
|
1923
2127
|
GoogleTrackingProviderConfigSchema,
|
|
2128
|
+
GoogleTrackingSecretsSchema,
|
|
1924
2129
|
GtmTrackingProviderConfigSchema,
|
|
2130
|
+
LEGACY_TRACKING_SECRET_KEYS,
|
|
1925
2131
|
MANIFEST_JSON_SCHEMA_V1,
|
|
1926
2132
|
ManifestAssetItemSchema,
|
|
1927
2133
|
ManifestSchema,
|
|
1928
2134
|
MetaTrackingProviderConfigSchema,
|
|
2135
|
+
MetaTrackingSecretsSchema,
|
|
1929
2136
|
NavigateStepPayloadSchema,
|
|
1930
2137
|
NodeSchema,
|
|
1931
2138
|
OpenModalStepPayloadSchema,
|
|
@@ -1941,6 +2148,7 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1941
2148
|
SafeThumbnailObjectSchema,
|
|
1942
2149
|
SafeThumbnailSchema,
|
|
1943
2150
|
SafeThumbnailUrlSchema,
|
|
2151
|
+
ServerTrackingEventSchema,
|
|
1944
2152
|
SetStateStepPayloadSchema,
|
|
1945
2153
|
ShowToastStepPayloadSchema,
|
|
1946
2154
|
StandardTrackingEventSchema,
|
|
@@ -1948,14 +2156,22 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1948
2156
|
StyleDefinitionSchema,
|
|
1949
2157
|
StyleValueSchema,
|
|
1950
2158
|
TEMPLATE_RECORD_JSON_SCHEMA_V1,
|
|
2159
|
+
TRACKING_RELAY_PROTOCOL_VERSION,
|
|
1951
2160
|
TemplatePackageRefSchema,
|
|
1952
2161
|
TemplateRecordSchema,
|
|
1953
2162
|
TemplateRequirementsSchema,
|
|
1954
2163
|
TikTokTrackingProviderConfigSchema,
|
|
2164
|
+
TikTokTrackingSecretsSchema,
|
|
2165
|
+
ToggleModalStepPayloadSchema,
|
|
2166
|
+
TrackEventProviderSchema,
|
|
1955
2167
|
TrackEventStepPayloadSchema,
|
|
1956
2168
|
TrackingConfigSchema,
|
|
1957
2169
|
TrackingDeliverySchema,
|
|
1958
2170
|
TrackingProviderTypeSchema,
|
|
2171
|
+
TrackingRelayErrorCodeSchema,
|
|
2172
|
+
TrackingRelayProviderResultSchema,
|
|
2173
|
+
TrackingRelayRequestSchema,
|
|
2174
|
+
TrackingRelayResponseSchema,
|
|
1959
2175
|
ValidateOnEventSchema,
|
|
1960
2176
|
ValidationRuleSchema,
|
|
1961
2177
|
ValidationRuleTypeSchema,
|
|
@@ -1968,6 +2184,9 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1968
2184
|
getManifestJsonSchema,
|
|
1969
2185
|
getPageDocumentJsonSchema,
|
|
1970
2186
|
getTemplateRecordJsonSchema,
|
|
2187
|
+
getTrackingProviderSecretsJsonSchema,
|
|
2188
|
+
getTrackingRelayRequestJsonSchema,
|
|
2189
|
+
getTrackingRelayResponseJsonSchema,
|
|
1971
2190
|
isActionBinding,
|
|
1972
2191
|
isActionPipeline,
|
|
1973
2192
|
isActionStep,
|
|
@@ -1988,6 +2207,7 @@ function getFormFieldBindingJsonSchema() {
|
|
|
1988
2207
|
isTemplateRecord,
|
|
1989
2208
|
isTrackEventStepPayload,
|
|
1990
2209
|
isTrackingConfig,
|
|
2210
|
+
isTrackingRelayRequest,
|
|
1991
2211
|
isValidateOnEvent,
|
|
1992
2212
|
isValidationRule,
|
|
1993
2213
|
isValidationRuleType,
|