@replohq/canopy-sdk 3.0.5 → 3.0.7

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 (59) hide show
  1. package/_vendor/replo-utils/lib/crypto.d.ts +8 -0
  2. package/_vendor/replo-utils/lib/errors.d.ts +1 -0
  3. package/_vendor/replo-utils/lib/fonts.d.ts +12 -1
  4. package/_vendor/replo-utils/lib/fonts.mjs +61 -12
  5. package/_vendor/replo-utils/lib/geometry.mjs +0 -2
  6. package/_vendor/replo-utils/lib/json.d.ts +0 -4
  7. package/_vendor/replo-utils/lib/json.mjs +1 -4
  8. package/_vendor/replo-utils/lib/misc.d.ts +4 -0
  9. package/_vendor/replo-utils/lib/misc.mjs +2 -4
  10. package/_vendor/replo-utils/lib/posthogReplay.mjs +0 -2
  11. package/_vendor/replo-utils/lib/string.d.ts +0 -12
  12. package/_vendor/replo-utils/lib/url.d.ts +10 -3
  13. package/_vendor/replo-utils/lib/url.mjs +3 -4
  14. package/_vendor/replo-utils/react/use-iframe-rpc-channel.mjs +0 -1
  15. package/_vendor/schemas/agentBillingFeatureType.d.ts +1 -0
  16. package/_vendor/schemas/comments.d.ts +932 -0
  17. package/_vendor/schemas/designLibrary.d.ts +24 -1
  18. package/_vendor/schemas/designLibrary.mjs +76 -70
  19. package/_vendor/schemas/errors.d.ts +50 -45
  20. package/_vendor/schemas/generated/comments.d.ts +244 -0
  21. package/_vendor/schemas/generated/consent.d.ts +43 -2
  22. package/_vendor/schemas/generated/errors.d.ts +1 -0
  23. package/_vendor/schemas/generated/selectMode.d.ts +52 -1
  24. package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +64 -8
  25. package/_vendor/schemas/iframeRpcChannel.d.ts +13 -1
  26. package/_vendor/schemas/iframeRpcChannel.mjs +202 -19
  27. package/_vendor/schemas/loaderKeys.mjs +2 -4
  28. package/_vendor/schemas/{money.d.ts → moneyFormat.d.ts} +11 -9
  29. package/_vendor/schemas/moneyFormat.mjs +119 -0
  30. package/_vendor/schemas/pageAnnotations.d.ts +1 -1
  31. package/_vendor/schemas/pageAnnotations.mjs +1 -2
  32. package/_vendor/schemas/reploError.d.ts +43 -0
  33. package/_vendor/schemas/routing/match.mjs +0 -1
  34. package/_vendor/schemas/routing/rules.d.ts +2 -2
  35. package/_vendor/schemas/routing/rules.mjs +5 -8
  36. package/_vendor/schemas/savedStyles.d.ts +1 -1
  37. package/_vendor/schemas/selectMode.d.ts +272 -4
  38. package/_vendor/schemas/selectMode.mjs +4 -6
  39. package/_vendor/schemas/selectModeIframeRpc.d.ts +802 -111
  40. package/_vendor/schemas/selectModeIframeRpc.mjs +142 -47
  41. package/chunk-B7XDEXPL.mjs +19 -0
  42. package/chunk-CJIK4NVP.mjs +547 -0
  43. package/chunk-DINTPZM2.mjs +71 -0
  44. package/{chunk-AKZNN7F2.mjs → chunk-IQCJXNJU.mjs} +1 -1
  45. package/{chunk-H36NDYLG.mjs → chunk-PQEA6P4V.mjs} +40 -3
  46. package/{chunk-3A2F6BOM.mjs → chunk-YGLYUC6R.mjs} +21 -8
  47. package/editor/select-mode/iframeRpcChannel.d.ts +4 -4
  48. package/lib/tombstone.js +2 -2
  49. package/money.d.ts +1 -1
  50. package/orders/order-status-schema.d.ts +3 -3
  51. package/package.json +2 -2
  52. package/_vendor/replo-utils/lib/object.d.ts +0 -31
  53. package/_vendor/schemas/money.mjs +0 -1937
  54. package/chunk-544ZM65A.mjs +0 -203
  55. package/chunk-HGXQNZW7.mjs +0 -38
  56. package/chunk-ILGEM42C.mjs +0 -21
  57. package/chunk-QPGBIWJK.mjs +0 -195
  58. package/chunk-UJCSKKID.mjs +0 -23
  59. /package/{chunk-FNTGY7I5.mjs → chunk-JELVREEB.mjs} +0 -0
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import * as z from "zod";
2
2
  export declare const savedColorStyleSchema: z.ZodObject<{
3
3
  type: z.ZodLiteral<"color">;
4
4
  name: z.ZodString;
@@ -341,6 +341,29 @@ export declare const siteFontsSnapshotSchema: z.ZodObject<{
341
341
  }, z.core.$strip>>;
342
342
  defaultRole: z.ZodNullable<z.ZodString>;
343
343
  }, z.core.$strip>;
344
+ export declare const siteDesignLibraryStateSchema: z.ZodObject<{
345
+ siteId: z.ZodUUID;
346
+ globalsCss: z.ZodNullable<z.ZodObject<{
347
+ scopes: z.ZodArray<z.ZodObject<{
348
+ selector: z.ZodString;
349
+ tokens: z.ZodArray<z.ZodObject<{
350
+ name: z.ZodString;
351
+ value: z.ZodString;
352
+ }, z.core.$strip>>;
353
+ }, z.core.$strip>>;
354
+ }, z.core.$strip>>;
355
+ fonts: z.ZodNullable<z.ZodObject<{
356
+ roles: z.ZodArray<z.ZodObject<{
357
+ role: z.ZodString;
358
+ family: z.ZodNullable<z.ZodString>;
359
+ cssVar: z.ZodNullable<z.ZodString>;
360
+ rawValue: z.ZodString;
361
+ }, z.core.$strip>>;
362
+ defaultRole: z.ZodNullable<z.ZodString>;
363
+ }, z.core.$strip>>;
364
+ isLoading: z.ZodBoolean;
365
+ error: z.ZodNullable<z.ZodString>;
366
+ }, z.core.$strip>;
344
367
  export declare const DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE = "replo:design-library:applyOverrides";
345
368
  export declare const designLibraryPreviewFontSchema: z.ZodObject<{
346
369
  family: z.ZodString;
@@ -1,7 +1,6 @@
1
- import '../../chunk-UJCSKKID.mjs';
2
- import { z } from 'zod';
1
+ import * as z2 from 'zod';
3
2
 
4
- var colorTypeSchema = z.enum([
3
+ var colorTypeSchema = z2.enum([
5
4
  "basic",
6
5
  "foregroundPrimary",
7
6
  "foregroundSecondary",
@@ -10,12 +9,12 @@ var colorTypeSchema = z.enum([
10
9
  "backgroundSecondary",
11
10
  "backgroundTertiary"
12
11
  ]).describe("SavedStyleColorType");
13
- var savedStyleColorAttributesSchema = z.object({
14
- type: z.literal("color"),
15
- color: z.string(),
12
+ var savedStyleColorAttributesSchema = z2.object({
13
+ type: z2.literal("color"),
14
+ color: z2.string(),
16
15
  colorType: colorTypeSchema
17
16
  }).describe("SavedStyleColorAttributes");
18
- var savedStyleTextHtmlTagSchema = z.enum([
17
+ var savedStyleTextHtmlTagSchema = z2.enum([
19
18
  "h1",
20
19
  "h2",
21
20
  "h3",
@@ -24,13 +23,13 @@ var savedStyleTextHtmlTagSchema = z.enum([
24
23
  "h6",
25
24
  "p"
26
25
  ]);
27
- var savedStyleTextAttributesSchema = z.object({
28
- type: z.literal("text"),
26
+ var savedStyleTextAttributesSchema = z2.object({
27
+ type: z2.literal("text"),
29
28
  htmlTag: savedStyleTextHtmlTagSchema,
30
- color: z.string().optional(),
31
- fontFamily: z.string().nullish(),
32
- fontSize: z.string().optional(),
33
- fontWeight: z.enum([
29
+ color: z2.string().optional(),
30
+ fontFamily: z2.string().nullish(),
31
+ fontSize: z2.string().optional(),
32
+ fontWeight: z2.enum([
34
33
  "100",
35
34
  "200",
36
35
  "300",
@@ -42,84 +41,91 @@ var savedStyleTextAttributesSchema = z.object({
42
41
  "900",
43
42
  "950"
44
43
  ]).optional(),
45
- letterSpacing: z.string().optional(),
46
- lineHeight: z.string().optional(),
47
- textAlign: z.enum(["left", "center", "right"]).optional(),
48
- textDecoration: z.enum(["underline", "line-through", "italic", "none"]).optional(),
49
- textShadow: z.string().optional(),
50
- textStroke: z.string().optional(),
51
- textTransform: z.enum(["lowercase", "uppercase", "capitalize", "none"]).optional()
44
+ letterSpacing: z2.string().optional(),
45
+ lineHeight: z2.string().optional(),
46
+ textAlign: z2.enum(["left", "center", "right"]).optional(),
47
+ textDecoration: z2.enum(["underline", "line-through", "italic", "none"]).optional(),
48
+ textShadow: z2.string().optional(),
49
+ textStroke: z2.string().optional(),
50
+ textTransform: z2.enum(["lowercase", "uppercase", "capitalize", "none"]).optional()
52
51
  }).describe("SavedStyleTextAttributes");
53
- z.discriminatedUnion("type", [
52
+ z2.discriminatedUnion("type", [
54
53
  savedStyleColorAttributesSchema,
55
54
  savedStyleTextAttributesSchema
56
55
  ]).describe("SavedStyleAttributes");
57
56
 
58
- var savedColorStyleSchema = z.object({
59
- type: z.literal("color"),
60
- name: z.string(),
57
+ var savedColorStyleSchema = z2.object({
58
+ type: z2.literal("color"),
59
+ name: z2.string(),
61
60
  attributes: savedStyleColorAttributesSchema,
62
- optionalUsageGuidelines: z.string().nullish(),
63
- deletedAt: z.coerce.date().nullish(),
64
- isPrimary: z.boolean().optional()
61
+ optionalUsageGuidelines: z2.string().nullish(),
62
+ deletedAt: z2.coerce.date().nullish(),
63
+ isPrimary: z2.boolean().optional()
65
64
  }).describe("SavedColorStyle");
66
- var savedTextStyleSchema = z.object({
67
- type: z.literal("text"),
68
- name: z.string(),
65
+ var savedTextStyleSchema = z2.object({
66
+ type: z2.literal("text"),
67
+ name: z2.string(),
69
68
  attributes: savedStyleTextAttributesSchema,
70
- optionalUsageGuidelines: z.string().nullish(),
71
- deletedAt: z.coerce.date().nullish(),
72
- isPrimary: z.boolean().optional()
69
+ optionalUsageGuidelines: z2.string().nullish(),
70
+ deletedAt: z2.coerce.date().nullish(),
71
+ isPrimary: z2.boolean().optional()
73
72
  }).describe("SavedTextStyle");
74
- var designLibrarySavedStylesSchema = z.record(z.string(), z.union([savedColorStyleSchema, savedTextStyleSchema])).describe("DesignLibrarySavedStylesMapping");
75
- var designLibrarySchema = z.object({
76
- id: z.uuid(),
77
- createdAt: z.date(),
78
- updatedAt: z.date(),
79
- deletedAt: z.coerce.date().nullish(),
73
+ var designLibrarySavedStylesSchema = z2.record(z2.string(), z2.union([savedColorStyleSchema, savedTextStyleSchema])).describe("DesignLibrarySavedStylesMapping");
74
+ var designLibrarySchema = z2.object({
75
+ id: z2.uuid(),
76
+ createdAt: z2.date(),
77
+ updatedAt: z2.date(),
78
+ deletedAt: z2.coerce.date().nullish(),
80
79
  savedStyles: designLibrarySavedStylesSchema
81
80
  }).describe("DesignLibrary");
82
- var designLibrarySavedStyleMetadataSchema = z.object({
83
- library: z.record(
84
- z.string(),
85
- z.object({
81
+ var designLibrarySavedStyleMetadataSchema = z2.object({
82
+ library: z2.record(
83
+ z2.string(),
84
+ z2.object({
86
85
  styles: designLibrarySavedStylesSchema
87
86
  })
88
87
  )
89
88
  }).describe("DesignLibrarySavedStyleMetadata");
90
- var globalsCssTokenSchema = z.object({
91
- name: z.string(),
92
- value: z.string()
89
+ var globalsCssTokenSchema = z2.object({
90
+ name: z2.string(),
91
+ value: z2.string()
93
92
  }).describe("GlobalsCssToken");
94
- var globalsCssScopeSchema = z.object({
95
- selector: z.string(),
96
- tokens: z.array(globalsCssTokenSchema)
93
+ var globalsCssScopeSchema = z2.object({
94
+ selector: z2.string(),
95
+ tokens: z2.array(globalsCssTokenSchema)
97
96
  }).describe("GlobalsCssScope");
98
- var globalsCssSnapshotSchema = z.object({
99
- scopes: z.array(globalsCssScopeSchema)
97
+ var globalsCssSnapshotSchema = z2.object({
98
+ scopes: z2.array(globalsCssScopeSchema)
100
99
  }).describe("GlobalsCssSnapshot");
101
- var siteFontRoleSchema = z.object({
102
- role: z.string(),
103
- family: z.string().nullable(),
104
- cssVar: z.string().nullable(),
105
- rawValue: z.string()
100
+ var siteFontRoleSchema = z2.object({
101
+ role: z2.string(),
102
+ family: z2.string().nullable(),
103
+ cssVar: z2.string().nullable(),
104
+ rawValue: z2.string()
106
105
  }).describe("SiteFontRole");
107
- var siteFontsSnapshotSchema = z.object({
108
- roles: z.array(siteFontRoleSchema),
109
- defaultRole: z.string().nullable()
106
+ var siteFontsSnapshotSchema = z2.object({
107
+ roles: z2.array(siteFontRoleSchema),
108
+ defaultRole: z2.string().nullable()
110
109
  }).describe("SiteFontsSnapshot");
110
+ var siteDesignLibraryStateSchema = z2.object({
111
+ siteId: z2.uuid(),
112
+ globalsCss: globalsCssSnapshotSchema.nullable(),
113
+ fonts: siteFontsSnapshotSchema.nullable(),
114
+ isLoading: z2.boolean(),
115
+ error: z2.string().nullable()
116
+ }).describe("SiteDesignLibraryState");
111
117
  var DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE = "replo:design-library:applyOverrides";
112
- var designLibraryPreviewFontSchema = z.object({
113
- family: z.string(),
114
- cssVar: z.string(),
115
- faceUrl: z.string().optional(),
116
- format: z.string().optional()
118
+ var designLibraryPreviewFontSchema = z2.object({
119
+ family: z2.string(),
120
+ cssVar: z2.string(),
121
+ faceUrl: z2.string().optional(),
122
+ format: z2.string().optional()
117
123
  }).describe("DesignLibraryPreviewFont");
118
- var designLibraryPreviewMessageSchema = z.object({
119
- type: z.literal(DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE),
120
- cssVars: z.record(z.string(), z.string()),
121
- fonts: z.array(designLibraryPreviewFontSchema),
122
- defaultFontCssVar: z.string().nullable()
124
+ var designLibraryPreviewMessageSchema = z2.object({
125
+ type: z2.literal(DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE),
126
+ cssVars: z2.record(z2.string(), z2.string()),
127
+ fonts: z2.array(designLibraryPreviewFontSchema),
128
+ defaultFontCssVar: z2.string().nullable()
123
129
  }).describe("DesignLibraryPreviewMessage");
124
130
 
125
- export { DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE, designLibraryPreviewFontSchema, designLibraryPreviewMessageSchema, designLibrarySavedStyleMetadataSchema, designLibrarySavedStylesSchema, designLibrarySchema, globalsCssScopeSchema, globalsCssSnapshotSchema, globalsCssTokenSchema, savedColorStyleSchema, savedTextStyleSchema, siteFontRoleSchema, siteFontsSnapshotSchema };
131
+ export { DESIGN_LIBRARY_PREVIEW_MESSAGE_TYPE, designLibraryPreviewFontSchema, designLibraryPreviewMessageSchema, designLibrarySavedStyleMetadataSchema, designLibrarySavedStylesSchema, designLibrarySchema, globalsCssScopeSchema, globalsCssSnapshotSchema, globalsCssTokenSchema, savedColorStyleSchema, savedTextStyleSchema, siteDesignLibraryStateSchema, siteFontRoleSchema, siteFontsSnapshotSchema };
@@ -1,48 +1,7 @@
1
1
  import type { ErrorUserFacingDetails, ErrorUserFacingDetailsWithMessage } from "./generated/errors";
2
- import { z, ZodError } from "zod";
3
- /**
4
- * Config to use for any standard error we throw in Replo
5
- */
6
- export type ReploErrorConfig = {
7
- /**
8
- * Message of the error, used only internally. If not provided, defaults to
9
- * the error's class name
10
- */
11
- message?: string;
12
- /**
13
- * Any additional data about the error, e.g. ids of content that was trying
14
- * to be accessed, contextual variables, etc. This is included when the error
15
- * is logged to Sentry, etc
16
- */
17
- additionalData?: Record<string, unknown>;
18
- /** Meta details for error reporting */
19
- errorReportingDetails?: {
20
- /**
21
- * If true, tells Sentry that it should group this error differently when
22
- * it happens on different endpoints ("transactions" in Sentry are endpoints)
23
- */
24
- includeTransactionInFingerprint?: boolean;
25
- /**
26
- * If provided, these get added to the Sentry fingerprint for this error. Useful
27
- * for when you want to modify the grouping of an error, especially for reusing
28
- * errors in different places.
29
- */
30
- customFingerprint?: string[];
31
- };
32
- /**
33
- * Original cause of the error (useful for if you need to catch and re-throw errors
34
- * with more context). Will be reported in stacktraces, sentry, etc.
35
- */
36
- cause?: unknown;
37
- };
38
- /**
39
- * Base error that all errors in Replo inherit from
40
- */
41
- export declare abstract class ReploError extends Error {
42
- config: ReploErrorConfig;
43
- id: string;
44
- constructor(config: ReploErrorConfig);
45
- }
2
+ import type { ReploErrorConfig } from "./reploError";
3
+ import * as z from "zod";
4
+ import { ReploError } from "./reploError";
46
5
  /**
47
6
  * Wraps an error so `async-retry` stops immediately instead of scheduling
48
7
  * another attempt: the library rejects with any thrown error carrying a truthy
@@ -59,7 +18,10 @@ export type ReploAuthenticationErrorConfig = {
59
18
  type: AuthErrorType;
60
19
  userFacingDetails?: ErrorUserFacingDetailsWithMessage;
61
20
  additionalData?: ReploErrorConfig["additionalData"];
21
+ cause?: ReploErrorConfig["cause"];
62
22
  };
23
+ export declare const PROJECT_ACCESS_DENIED_ERROR_KEY = "project.accessDenied";
24
+ export declare const WORKSPACE_ACCESS_DENIED_ERROR_KEY = "workspace.accessDenied";
63
25
  export declare class ReploAuthenticationError extends ReploError {
64
26
  type: AuthErrorType;
65
27
  userFacingDetails?: ErrorUserFacingDetailsWithMessage;
@@ -82,6 +44,24 @@ export declare class ReploHTTPError extends ReploError {
82
44
  details?: object;
83
45
  });
84
46
  }
47
+ /**
48
+ * HTTP error for callers that branch on `key` in code (SDKs, other services)
49
+ * rather than showing it in Replo's own UI, so it has no display `type`. The
50
+ * worker error handler answers `{ key, message, details, errorId }`. Should
51
+ * only be thrown from routes.
52
+ */
53
+ export declare class ReploParseableHTTPError extends ReploError {
54
+ statusCode: number;
55
+ key: string;
56
+ userFacingMessage: string;
57
+ details?: Record<string, unknown>;
58
+ constructor(config: ReploErrorConfig & {
59
+ statusCode: number;
60
+ key: string;
61
+ userFacingMessage: string;
62
+ details?: Record<string, unknown>;
63
+ });
64
+ }
85
65
  /**
86
66
  * Error used to represent an HTTP error that should be surfaced as such. This
87
67
  * should be thrown when we want to pass the error through without changing the
@@ -120,6 +100,13 @@ export declare class Uncommon_GloballyMappedError extends ReploError {
120
100
  userFacingDetails: ErrorUserFacingDetails;
121
101
  });
122
102
  }
103
+ /**
104
+ * The `userFacingDetails.key` publisher puts on its 404 for a missing project.
105
+ * It lives here rather than next to the error class because a caller across a
106
+ * service boundary (airlock) matches on it to tell "this project is gone" apart
107
+ * from any other 404 that URL could produce.
108
+ */
109
+ export declare const PROJECT_NOT_FOUND_ERROR_KEY = "errors.project.notFound";
123
110
  export declare class ReploValidationError extends ReploError {
124
111
  constructor(message: string);
125
112
  }
@@ -264,6 +251,12 @@ export declare const errorUserFacingDetailsMessageSchema: z.ZodObject<{
264
251
  maximum: z.ZodNumber;
265
252
  }, z.core.$strip>>;
266
253
  plan: z.ZodOptional<z.ZodString>;
254
+ featureType: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
255
+ credits: "credits";
256
+ "shopifyThemeBuilder.publishedElements": "shopifyThemeBuilder.publishedElements";
257
+ sites: "sites";
258
+ "shopifyThemeBuilder.projects": "shopifyThemeBuilder.projects";
259
+ }>>>;
267
260
  callToAction: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
268
261
  type: z.ZodLiteral<"reload">;
269
262
  }, z.core.$strip>, z.ZodObject<{
@@ -331,6 +324,12 @@ export declare const errorUserFacingDetailsSchema: z.ZodDiscriminatedUnion<[z.Zo
331
324
  maximum: z.ZodNumber;
332
325
  }, z.core.$strip>>;
333
326
  plan: z.ZodOptional<z.ZodString>;
327
+ featureType: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
328
+ credits: "credits";
329
+ "shopifyThemeBuilder.publishedElements": "shopifyThemeBuilder.publishedElements";
330
+ sites: "sites";
331
+ "shopifyThemeBuilder.projects": "shopifyThemeBuilder.projects";
332
+ }>>>;
334
333
  callToAction: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
335
334
  type: z.ZodLiteral<"reload">;
336
335
  }, z.core.$strip>, z.ZodObject<{
@@ -429,6 +428,12 @@ export declare class IframeRpcChannelTimeoutError extends IframeRpcChannelError
429
428
  timeoutMs: number;
430
429
  });
431
430
  }
431
+ export declare class IframeRpcChannelTargetUnavailableError extends IframeRpcChannelError {
432
+ constructor({ callType, method, }: {
433
+ callType: "notify" | "request" | "response";
434
+ method?: string;
435
+ });
436
+ }
432
437
  export declare class IframeRpcChannelRemoteError extends IframeRpcChannelError {
433
438
  constructor({ method, message }: {
434
439
  method: string;
@@ -453,6 +458,6 @@ export declare class IframeRpcChannelConfigurationError extends IframeRpcChannel
453
458
  export declare class IframeRpcChannelInvalidInputError extends IframeRpcChannelError {
454
459
  constructor({ method, cause }: {
455
460
  method: string;
456
- cause: ZodError;
461
+ cause: z.ZodError;
457
462
  });
458
463
  }
@@ -0,0 +1,244 @@
1
+ export type CommentSource = "ui" | "agent" | "mcp" | "api";
2
+ export type CommentAnchorContext = {
3
+ url: string;
4
+ locale?: string | null;
5
+ };
6
+ export type CommentAnchorNone = {
7
+ type: "none";
8
+ context?: CommentAnchorContext;
9
+ };
10
+ export type CommentAnchorElement = {
11
+ type: "element";
12
+ semanticSelector?: string;
13
+ selector: string;
14
+ nthOfTypePath: string;
15
+ source?: {
16
+ filePath: string;
17
+ componentChain: string[];
18
+ line?: number;
19
+ col?: number;
20
+ };
21
+ listKey?: string;
22
+ tagName: string;
23
+ textPreview: string;
24
+ quote?: {
25
+ exact: string;
26
+ prefix: string;
27
+ suffix: string;
28
+ };
29
+ offset: {
30
+ x: number;
31
+ y: number;
32
+ };
33
+ context?: CommentAnchorContext;
34
+ };
35
+ export type CommentAnchorCanvas = {
36
+ type: "canvas";
37
+ nodeId: string;
38
+ layerId?: string;
39
+ point: {
40
+ x: number;
41
+ y: number;
42
+ };
43
+ world?: {
44
+ x: number;
45
+ y: number;
46
+ };
47
+ };
48
+ export type CommentAnchorPoint = {
49
+ type: "point";
50
+ page?: number;
51
+ x: number;
52
+ y: number;
53
+ };
54
+ export type CommentAnchor = CommentAnchorNone | CommentAnchorElement | CommentAnchorCanvas | CommentAnchorPoint;
55
+ export type CommentTarget = {
56
+ kind: "file";
57
+ fileId: string;
58
+ folderId?: string;
59
+ } | {
60
+ kind: "sitePage";
61
+ siteId: string;
62
+ url: string;
63
+ locale?: string | null;
64
+ routePatternHint?: string;
65
+ via?: {
66
+ fileId: string;
67
+ shareId: string;
68
+ };
69
+ } | {
70
+ kind: "order";
71
+ orderId: string;
72
+ } | {
73
+ kind: "asset";
74
+ assetId: string;
75
+ } | {
76
+ kind: "experiment";
77
+ experimentId: string;
78
+ };
79
+ export type CommentSurface = "artifact" | "canvas" | "image" | "markdown" | "pdf" | "file" | "websiteBuilder" | "embeddedPreview" | "orders" | "assets" | "experiments";
80
+ export type CommentAuthor = {
81
+ id: string;
82
+ name: string;
83
+ avatarUrl: string | null;
84
+ deleted: boolean;
85
+ };
86
+ export type Comment = {
87
+ id: string;
88
+ threadId: string;
89
+ authorUserId: string;
90
+ source: CommentSource;
91
+ body: string;
92
+ createdAt: string;
93
+ editedAt: string | null;
94
+ deletedAt: string | null;
95
+ };
96
+ export type CommentReaction = {
97
+ commentId: string;
98
+ userId: string;
99
+ emoji: string;
100
+ createdAt: string;
101
+ };
102
+ export type CommentThreadTarget = {
103
+ fileId?: string;
104
+ siteId?: string;
105
+ path?: string;
106
+ orderId?: string;
107
+ assetId?: string;
108
+ experimentId?: string;
109
+ };
110
+ export type CommentThread = {
111
+ id: string;
112
+ projectId: string;
113
+ target: Partial<CommentThreadTarget>;
114
+ viaFileId: string | null;
115
+ viaFileName: string | null;
116
+ anchor: CommentAnchor;
117
+ resolvedAt: string | null;
118
+ resolvedByUserId: string | null;
119
+ resolvedSource: CommentSource | null;
120
+ createdAt: string;
121
+ updatedAt: string;
122
+ deletedAt: string | null;
123
+ };
124
+ export type CommentThreadBundle = {
125
+ threads: CommentThread[];
126
+ comments: Comment[];
127
+ reactions: CommentReaction[];
128
+ authors: CommentAuthor[];
129
+ viewer: CommentViewer;
130
+ };
131
+ export type CreateCommentThreadBody = {
132
+ id: string;
133
+ target: CommentTarget;
134
+ anchor: CommentAnchor;
135
+ body: {
136
+ id: string;
137
+ body: string;
138
+ };
139
+ };
140
+ export type UpdateCommentThreadBody = {
141
+ resolved?: boolean;
142
+ path?: string;
143
+ anchor?: CommentAnchor;
144
+ };
145
+ export type CreateCommentBody = {
146
+ id: string;
147
+ body: string;
148
+ };
149
+ export type UpdateCommentBody = {
150
+ body: string;
151
+ };
152
+ export type CommentThreadStatus = "open" | "resolved";
153
+ export type ListCommentThreadsQuery = {
154
+ fileId?: string;
155
+ folderId?: string;
156
+ siteId?: string;
157
+ path?: string;
158
+ locale?: string;
159
+ viaFileId?: string;
160
+ orderId?: string;
161
+ assetId?: string;
162
+ experimentId?: string;
163
+ status?: CommentThreadStatus;
164
+ };
165
+ export type CommentThreadLocation = {
166
+ kind: "artifact" | "miniapp" | "commentsScreen" | "gone";
167
+ url?: string;
168
+ projectId?: string;
169
+ miniappId?: string;
170
+ miniappRoute?: string;
171
+ };
172
+ export type PresignCommentAttachmentBody = {
173
+ target: CommentTarget;
174
+ contentType: string;
175
+ contentLength: number;
176
+ };
177
+ export type PresignCommentAttachmentResponse = {
178
+ objectKey: string;
179
+ presignedPutUrl: string;
180
+ publicUrl: string;
181
+ };
182
+ export type CommitCommentAttachmentBody = {
183
+ target: CommentTarget;
184
+ objectKey: string;
185
+ };
186
+ export type CommitCommentAttachmentResponse = {
187
+ publicUrl: string;
188
+ };
189
+ export type CommentViewer = {
190
+ userId: string | null;
191
+ isMember: boolean;
192
+ canComment: boolean;
193
+ canModerate: boolean;
194
+ };
195
+ export type CommentSiteThreadPage = {
196
+ threads: CommentThread[];
197
+ comments: Comment[];
198
+ reactions: CommentReaction[];
199
+ authors: CommentAuthor[];
200
+ orphanedPaths: string[] | null;
201
+ nextCursor: string | null;
202
+ };
203
+ export type CommentSiteThreadSort = {
204
+ column: "page" | "excerpt" | "author" | "created" | "lastActivity" | "replies" | "status" | "from";
205
+ direction: "asc" | "desc";
206
+ };
207
+ export type CommentMentionPerson = {
208
+ id: string;
209
+ name: string;
210
+ avatarUrl: string | null;
211
+ };
212
+ export type MentionableDisplay = {
213
+ label: string;
214
+ imageUrl?: string;
215
+ };
216
+ export type MentionableResolution = {
217
+ state: "ok";
218
+ display: MentionableDisplay;
219
+ } | {
220
+ state: "forbidden";
221
+ category: string;
222
+ };
223
+ export type CommentThreadTargetSummary = {
224
+ kind: "file" | "sitePage" | "order" | "asset" | "experiment";
225
+ fileId?: string;
226
+ fileName?: string;
227
+ filePath?: string;
228
+ artifactFolderId?: string;
229
+ fileDeleted?: boolean;
230
+ siteId?: string;
231
+ path?: string;
232
+ url?: string;
233
+ orderId?: string;
234
+ assetId?: string;
235
+ experimentId?: string;
236
+ experimentName?: string;
237
+ };
238
+ export type CommentThreadDetail = {
239
+ thread: CommentThread;
240
+ comments: Comment[];
241
+ reactions: CommentReaction[];
242
+ authors: CommentAuthor[];
243
+ target: CommentThreadTargetSummary;
244
+ };