@replohq/sandbox-runtime 0.1.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/ClientErrorBoundary.d.ts +10 -0
- package/ClientErrorBoundary.js +61 -0
- package/ClientErrorBoundary.js.map +7 -0
- package/DocumentReadyBeacon.d.ts +1 -0
- package/DocumentReadyBeacon.js +9 -0
- package/DocumentReadyBeacon.js.map +7 -0
- package/LICENSE +11 -0
- package/LinkInterceptor.d.ts +1 -0
- package/LinkInterceptor.js +128 -0
- package/LinkInterceptor.js.map +7 -0
- package/NextErrorReporter.d.ts +1 -0
- package/NextErrorReporter.js +92 -0
- package/NextErrorReporter.js.map +7 -0
- package/_vendor/replo-utils/lib/crypto.d.ts +30 -0
- package/_vendor/replo-utils/lib/errors.d.ts +83 -0
- package/_vendor/replo-utils/lib/fonts.d.ts +49 -0
- package/_vendor/replo-utils/lib/fonts.mjs +221 -0
- package/_vendor/replo-utils/lib/geometry.d.ts +18 -0
- package/_vendor/replo-utils/lib/geometry.mjs +9 -0
- package/_vendor/replo-utils/lib/json.d.ts +6 -0
- package/_vendor/replo-utils/lib/log.d.ts +11 -0
- package/_vendor/replo-utils/lib/misc.d.ts +145 -0
- package/_vendor/replo-utils/lib/misc.mjs +2 -0
- package/_vendor/replo-utils/lib/object.d.ts +31 -0
- package/_vendor/replo-utils/lib/parse.d.ts +15 -0
- package/_vendor/replo-utils/lib/posthogReplay.d.ts +43 -0
- package/_vendor/replo-utils/lib/posthogReplay.mjs +121 -0
- package/_vendor/replo-utils/react/use-iframe-rpc-channel.d.ts +14 -0
- package/_vendor/replo-utils/react/use-iframe-rpc-channel.mjs +14 -0
- package/_vendor/schemas/designLibrary.d.ts +361 -0
- package/_vendor/schemas/designLibrary.mjs +126 -0
- package/_vendor/schemas/errors.d.ts +459 -0
- package/_vendor/schemas/generated/errors.d.ts +61 -0
- package/_vendor/schemas/generated/pageAnnotations.d.ts +48 -0
- package/_vendor/schemas/generated/pageAnnotations.mjs +1 -0
- package/_vendor/schemas/generated/selectMode.d.ts +119 -0
- package/_vendor/schemas/generated/selectMode.mjs +1 -0
- package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +100 -0
- package/_vendor/schemas/generated/selectModeIframeRpc.mjs +1 -0
- package/_vendor/schemas/iframeRpcChannel.d.ts +82 -0
- package/_vendor/schemas/iframeRpcChannel.mjs +520 -0
- package/_vendor/schemas/pageAnnotations.d.ts +134 -0
- package/_vendor/schemas/pageAnnotations.mjs +61 -0
- package/_vendor/schemas/savedStyles.d.ts +140 -0
- package/_vendor/schemas/selectMode.d.ts +522 -0
- package/_vendor/schemas/selectMode.mjs +3 -0
- package/_vendor/schemas/selectModeIframeRpc.d.ts +900 -0
- package/_vendor/schemas/selectModeIframeRpc.mjs +223 -0
- package/annotations/AnnotationLayerMount.d.ts +1 -0
- package/annotations/AnnotationLayerMount.js +13 -0
- package/annotations/AnnotationLayerMount.js.map +7 -0
- package/annotations/annotationController.d.ts +1 -0
- package/annotations/annotationController.js +384 -0
- package/annotations/annotationController.js.map +7 -0
- package/annotations/bridgeGate.d.ts +7 -0
- package/annotations/bridgeGate.js +22 -0
- package/annotations/bridgeGate.js.map +7 -0
- package/chunk-3UFG7XTQ.mjs +205 -0
- package/chunk-FNTGY7I5.mjs +68 -0
- package/chunk-N5EI2MOZ.mjs +1535 -0
- package/design-library-preview/DesignLibraryPreview.d.ts +1 -0
- package/design-library-preview/DesignLibraryPreview.js +93 -0
- package/design-library-preview/DesignLibraryPreview.js.map +7 -0
- package/package.json +41 -0
- package/posthog-relay.d.ts +11 -0
- package/posthog-relay.js +72 -0
- package/posthog-relay.js.map +7 -0
- package/sandbox-runtime.d.ts +1 -0
- package/sandbox-runtime.js +29 -0
- package/sandbox-runtime.js.map +7 -0
- package/select-mode/EditorSelection.d.ts +24 -0
- package/select-mode/EditorSelection.js +95 -0
- package/select-mode/EditorSelection.js.map +7 -0
- package/select-mode/annotationFrames.d.ts +33 -0
- package/select-mode/annotationFrames.js +119 -0
- package/select-mode/annotationFrames.js.map +7 -0
- package/select-mode/descriptor/elementDescriptor.d.ts +26 -0
- package/select-mode/descriptor/elementDescriptor.js +201 -0
- package/select-mode/descriptor/elementDescriptor.js.map +7 -0
- package/select-mode/descriptor/styleExtraction.d.ts +3 -0
- package/select-mode/descriptor/styleExtraction.js +271 -0
- package/select-mode/descriptor/styleExtraction.js.map +7 -0
- package/select-mode/displayModeStore.d.ts +10 -0
- package/select-mode/displayModeStore.js +47 -0
- package/select-mode/displayModeStore.js.map +7 -0
- package/select-mode/fast-refresh-relay.d.ts +3 -0
- package/select-mode/fast-refresh-relay.js +33 -0
- package/select-mode/fast-refresh-relay.js.map +7 -0
- package/select-mode/fiber.d.ts +49 -0
- package/select-mode/fiber.js +306 -0
- package/select-mode/fiber.js.map +7 -0
- package/select-mode/hooks/useCrosshairCursor.d.ts +12 -0
- package/select-mode/hooks/useCrosshairCursor.js +20 -0
- package/select-mode/hooks/useCrosshairCursor.js.map +7 -0
- package/select-mode/hooks/useEditModeStateMachine.d.ts +16 -0
- package/select-mode/hooks/useEditModeStateMachine.js +235 -0
- package/select-mode/hooks/useEditModeStateMachine.js.map +7 -0
- package/select-mode/hooks/useOptimisticOverrides.d.ts +17 -0
- package/select-mode/hooks/useOptimisticOverrides.js +283 -0
- package/select-mode/hooks/useOptimisticOverrides.js.map +7 -0
- package/select-mode/hooks/useParentMessaging.d.ts +36 -0
- package/select-mode/hooks/useParentMessaging.js +74 -0
- package/select-mode/hooks/useParentMessaging.js.map +7 -0
- package/select-mode/hooks/useSelectModeController.d.ts +8 -0
- package/select-mode/hooks/useSelectModeController.js +46 -0
- package/select-mode/hooks/useSelectModeController.js.map +7 -0
- package/select-mode/hooks/useSelectionHover.d.ts +22 -0
- package/select-mode/hooks/useSelectionHover.js +110 -0
- package/select-mode/hooks/useSelectionHover.js.map +7 -0
- package/select-mode/hooks/useSelectionInteractions.d.ts +37 -0
- package/select-mode/hooks/useSelectionInteractions.js +353 -0
- package/select-mode/hooks/useSelectionInteractions.js.map +7 -0
- package/select-mode/hooks/useSelectionScrollSync.d.ts +28 -0
- package/select-mode/hooks/useSelectionScrollSync.js +70 -0
- package/select-mode/hooks/useSelectionScrollSync.js.map +7 -0
- package/select-mode/hooks/useSiblingResolution.d.ts +6 -0
- package/select-mode/hooks/useSiblingResolution.js +59 -0
- package/select-mode/hooks/useSiblingResolution.js.map +7 -0
- package/select-mode/iframeRpcChannel.d.ts +356 -0
- package/select-mode/iframeRpcChannel.js +92 -0
- package/select-mode/iframeRpcChannel.js.map +7 -0
- package/select-mode/inlineTextMarks.d.ts +6 -0
- package/select-mode/inlineTextMarks.js +25 -0
- package/select-mode/inlineTextMarks.js.map +7 -0
- package/select-mode/interactions/selectionGeometry.d.ts +105 -0
- package/select-mode/interactions/selectionGeometry.js +192 -0
- package/select-mode/interactions/selectionGeometry.js.map +7 -0
- package/select-mode/selectModeSession.d.ts +21 -0
- package/select-mode/selectModeSession.js +7 -0
- package/select-mode/selectModeSession.js.map +7 -0
- package/select-mode/selectionFrame.d.ts +81 -0
- package/select-mode/selectionFrame.js +132 -0
- package/select-mode/selectionFrame.js.map +7 -0
- package/select-mode/symbolicate.d.ts +2 -0
- package/select-mode/symbolicate.js +200 -0
- package/select-mode/symbolicate.js.map +7 -0
- package/select-mode/tiptapInlineEditor.d.ts +23 -0
- package/select-mode/tiptapInlineEditor.js +120 -0
- package/select-mode/tiptapInlineEditor.js.map +7 -0
|
@@ -0,0 +1,459 @@
|
|
|
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
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Wraps an error so `async-retry` stops immediately instead of scheduling
|
|
48
|
+
* another attempt: the library rejects with any thrown error carrying a truthy
|
|
49
|
+
* `bail` property. Preserves the underlying error's message and keeps it as the
|
|
50
|
+
* cause so callers still surface the real failure.
|
|
51
|
+
*/
|
|
52
|
+
export declare class AsyncRetryBailError extends ReploError {
|
|
53
|
+
readonly bail = true;
|
|
54
|
+
constructor(cause: unknown);
|
|
55
|
+
}
|
|
56
|
+
export type AuthErrorType = "unauthenticated" | "unauthorized" | "notFound";
|
|
57
|
+
export type ReploAuthenticationErrorConfig = {
|
|
58
|
+
message: string;
|
|
59
|
+
type: AuthErrorType;
|
|
60
|
+
userFacingDetails?: ErrorUserFacingDetailsWithMessage;
|
|
61
|
+
additionalData?: ReploErrorConfig["additionalData"];
|
|
62
|
+
};
|
|
63
|
+
export declare class ReploAuthenticationError extends ReploError {
|
|
64
|
+
type: AuthErrorType;
|
|
65
|
+
userFacingDetails?: ErrorUserFacingDetailsWithMessage;
|
|
66
|
+
constructor(config: ReploAuthenticationErrorConfig);
|
|
67
|
+
getHttpStatusCode(): 401 | 403 | 404;
|
|
68
|
+
getTRPCErrorCode(): "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND";
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Error which automatically makes all Replo services respond with a specific
|
|
72
|
+
* HTTP status code when caught. Should only be thrown from routes, makes it
|
|
73
|
+
* easier to provide a standardized way of implementing user-facing messages
|
|
74
|
+
*/
|
|
75
|
+
export declare class ReploHTTPError extends ReploError {
|
|
76
|
+
userFacingDetails: ErrorUserFacingDetails;
|
|
77
|
+
statusCode: number;
|
|
78
|
+
details?: object;
|
|
79
|
+
constructor(config: ReploErrorConfig & {
|
|
80
|
+
statusCode: number;
|
|
81
|
+
userFacingDetails: ErrorUserFacingDetails;
|
|
82
|
+
details?: object;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Error used to represent an HTTP error that should be surfaced as such. This
|
|
87
|
+
* should be thrown when we want to pass the error through without changing the
|
|
88
|
+
* status code and without providing any user facing details (because this route
|
|
89
|
+
* is not serving the client e.g. when we're calling Mirror through the
|
|
90
|
+
* Publisher)
|
|
91
|
+
*/
|
|
92
|
+
export declare class ReploRawHTTPError extends ReploError {
|
|
93
|
+
statusCode: number;
|
|
94
|
+
errorType: string;
|
|
95
|
+
data?: object;
|
|
96
|
+
constructor(config: {
|
|
97
|
+
statusCode: number;
|
|
98
|
+
message: string;
|
|
99
|
+
errorType: string;
|
|
100
|
+
data?: object;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Error which is automatically mapped to a status code response wherever it's
|
|
105
|
+
* thrown. Errors which are thrown from many different places where we want to
|
|
106
|
+
* always respond in the same way should inherit this, e.g. an error thrown for
|
|
107
|
+
* any Shopify call when the user has uninstalled the app.
|
|
108
|
+
*
|
|
109
|
+
* Inheriting from this should be uncommon, for most errors we want to inherit
|
|
110
|
+
* from ReploError and catch/map them to ReploHTTPErrors in our routes. For the
|
|
111
|
+
* uncommon cases where we want to globally map errors this reduces boilerplate.
|
|
112
|
+
*
|
|
113
|
+
* Globally mapped errors are never reported to Sentry or logged.
|
|
114
|
+
*/
|
|
115
|
+
export declare class Uncommon_GloballyMappedError extends ReploError {
|
|
116
|
+
userFacingDetails: ErrorUserFacingDetails;
|
|
117
|
+
statusCode: number;
|
|
118
|
+
constructor(config: ReploErrorConfig & {
|
|
119
|
+
statusCode: number;
|
|
120
|
+
userFacingDetails: ErrorUserFacingDetails;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
export declare class ReploValidationError extends ReploError {
|
|
124
|
+
constructor(message: string);
|
|
125
|
+
}
|
|
126
|
+
export declare class UnexpectedMutationError extends ReploError {
|
|
127
|
+
constructor();
|
|
128
|
+
}
|
|
129
|
+
export declare class UnexpectedRawGraphqlClientError extends ReploError {
|
|
130
|
+
originalError: unknown;
|
|
131
|
+
errors: unknown[];
|
|
132
|
+
data: unknown;
|
|
133
|
+
constructor(opts: {
|
|
134
|
+
originalError: unknown;
|
|
135
|
+
errors: unknown[];
|
|
136
|
+
data: unknown;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
export declare const DEFAULT_ERROR_MESSAGE_CONFIG: {
|
|
140
|
+
header: string;
|
|
141
|
+
message: string;
|
|
142
|
+
isFullPage: boolean;
|
|
143
|
+
};
|
|
144
|
+
export type ErrorDetails = {
|
|
145
|
+
header: string;
|
|
146
|
+
subheader?: string;
|
|
147
|
+
message?: string | string[] | React.ReactNode;
|
|
148
|
+
messageDetail?: string;
|
|
149
|
+
isRecoverable?: boolean;
|
|
150
|
+
isFullPage?: boolean;
|
|
151
|
+
usage?: {
|
|
152
|
+
current: number;
|
|
153
|
+
maximum: number;
|
|
154
|
+
};
|
|
155
|
+
callToAction?: {
|
|
156
|
+
type: "installApp";
|
|
157
|
+
} | {
|
|
158
|
+
type: "callback";
|
|
159
|
+
name: string;
|
|
160
|
+
onClick(): void;
|
|
161
|
+
} | {
|
|
162
|
+
type: "link";
|
|
163
|
+
name: string;
|
|
164
|
+
to: string;
|
|
165
|
+
target?: string;
|
|
166
|
+
} | {
|
|
167
|
+
type: "closeModal";
|
|
168
|
+
name: string;
|
|
169
|
+
} | {
|
|
170
|
+
type: "navigate";
|
|
171
|
+
location: {
|
|
172
|
+
type: "integrationHub";
|
|
173
|
+
} | {
|
|
174
|
+
type: "home";
|
|
175
|
+
} | {
|
|
176
|
+
type: "workspace";
|
|
177
|
+
workspaceId: string;
|
|
178
|
+
workspaceName: string;
|
|
179
|
+
};
|
|
180
|
+
} | {
|
|
181
|
+
type: "custom";
|
|
182
|
+
callToActionType: ErrorUserFacingDetailsWithMessage["callToAction"];
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Map of error keys to custom user-facing details. Should ONLY be used
|
|
187
|
+
* in cases where we want to override the default behavior of ErrorUserFacingDetails
|
|
188
|
+
* from the backend.
|
|
189
|
+
*
|
|
190
|
+
* TODO (Noah, 2024-01-15): Clean up these custom configs, all of them
|
|
191
|
+
* are only used by Django (and 'base' can be moved directly into the reducer function)
|
|
192
|
+
*/
|
|
193
|
+
export declare const CUSTOM_ERROR_KEY_TO_PROPS: {
|
|
194
|
+
"shopifyArticle.failedToPublish": () => {
|
|
195
|
+
header: string;
|
|
196
|
+
message: string;
|
|
197
|
+
};
|
|
198
|
+
"shopifySection.failedToPublish": () => {
|
|
199
|
+
header: string;
|
|
200
|
+
message: string;
|
|
201
|
+
};
|
|
202
|
+
"page.failedToPublish": () => {
|
|
203
|
+
header: string;
|
|
204
|
+
message: string;
|
|
205
|
+
};
|
|
206
|
+
"shopifyProductTemplate.failedToPublish": () => {
|
|
207
|
+
header: string;
|
|
208
|
+
message: string;
|
|
209
|
+
};
|
|
210
|
+
"element.failedToPublish": () => {
|
|
211
|
+
header: string;
|
|
212
|
+
message: string;
|
|
213
|
+
};
|
|
214
|
+
"element.failedToUpdate": () => {
|
|
215
|
+
header: string;
|
|
216
|
+
message: string;
|
|
217
|
+
};
|
|
218
|
+
"store.billingPlan.alreadyExist": () => {
|
|
219
|
+
header: string;
|
|
220
|
+
message: string;
|
|
221
|
+
};
|
|
222
|
+
"error.assets.unsupportedFileType": ({ serverMessage }: {
|
|
223
|
+
type: string;
|
|
224
|
+
serverMessage?: string;
|
|
225
|
+
endpoint: string | null;
|
|
226
|
+
}) => {
|
|
227
|
+
header: string;
|
|
228
|
+
message: string;
|
|
229
|
+
};
|
|
230
|
+
"error.assets.fileTooLarge": () => {
|
|
231
|
+
header: string;
|
|
232
|
+
message: string;
|
|
233
|
+
};
|
|
234
|
+
"error.files.fileTooLarge": () => {
|
|
235
|
+
header: string;
|
|
236
|
+
message: string;
|
|
237
|
+
};
|
|
238
|
+
base: () => {
|
|
239
|
+
header: string;
|
|
240
|
+
message: string;
|
|
241
|
+
isFullPage: boolean;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
export declare function extractErrorId(error: unknown): string | undefined;
|
|
245
|
+
export declare function addErrorIdIfNeeded(error: unknown): void;
|
|
246
|
+
export declare const errorUserFacingDetailsMessageSchema: z.ZodObject<{
|
|
247
|
+
type: z.ZodEnum<{
|
|
248
|
+
toast: "toast";
|
|
249
|
+
fullPageModal: "fullPageModal";
|
|
250
|
+
shopifyStorePassword: "shopifyStorePassword";
|
|
251
|
+
"billing.addPublishedElements": "billing.addPublishedElements";
|
|
252
|
+
"billing.addShopifyThemeProject": "billing.addShopifyThemeProject";
|
|
253
|
+
"billing.addReploSite": "billing.addReploSite";
|
|
254
|
+
"agentBilling.shopifyThemeBuilder.publishedElements.exceeded": "agentBilling.shopifyThemeBuilder.publishedElements.exceeded";
|
|
255
|
+
"agentBilling.shopifyThemeBuilder.projects.exceeded": "agentBilling.shopifyThemeBuilder.projects.exceeded";
|
|
256
|
+
"agentBilling.sites.exceeded": "agentBilling.sites.exceeded";
|
|
257
|
+
"agentBilling.credits.exceeded": "agentBilling.credits.exceeded";
|
|
258
|
+
"agentBilling.upgradeRequired": "agentBilling.upgradeRequired";
|
|
259
|
+
}>;
|
|
260
|
+
message: z.ZodString;
|
|
261
|
+
isRecoverable: z.ZodOptional<z.ZodBoolean>;
|
|
262
|
+
detail: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString>, z.ZodString]>>;
|
|
263
|
+
key: z.ZodString;
|
|
264
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
265
|
+
current: z.ZodNumber;
|
|
266
|
+
maximum: z.ZodNumber;
|
|
267
|
+
}, z.core.$strip>>;
|
|
268
|
+
plan: z.ZodOptional<z.ZodString>;
|
|
269
|
+
callToAction: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
270
|
+
type: z.ZodLiteral<"reload">;
|
|
271
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
272
|
+
type: z.ZodLiteral<"installApp">;
|
|
273
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
274
|
+
type: z.ZodLiteral<"goToHomepage">;
|
|
275
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
276
|
+
type: z.ZodLiteral<"navigateToProjectEditor">;
|
|
277
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
278
|
+
type: z.ZodLiteral<"closeModal">;
|
|
279
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
280
|
+
type: z.ZodLiteral<"navigateToLink">;
|
|
281
|
+
link: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
282
|
+
type: z.ZodLiteral<"errors.wrongJsonExtension">;
|
|
283
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
284
|
+
type: z.ZodLiteral<"errors.chunkingError">;
|
|
285
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
286
|
+
type: z.ZodLiteral<"errors.indexBackupError">;
|
|
287
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
288
|
+
type: z.ZodLiteral<"errors.shopifyIntegrationAlreadyAssigned">;
|
|
289
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
290
|
+
type: z.ZodLiteral<"errors.shopifyIntegrationMissingAccessScopes">;
|
|
291
|
+
url: z.ZodString;
|
|
292
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
293
|
+
type: z.ZodLiteral<"customLink">;
|
|
294
|
+
url: z.ZodString;
|
|
295
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
296
|
+
type: z.ZodLiteral<"errors.projectConnectedToBillingIntegrationForShopifyWorkspace">;
|
|
297
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
298
|
+
type: z.ZodLiteral<"errors.themeAssetSizeLimitExceeded">;
|
|
299
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
300
|
+
type: z.ZodLiteral<"errors.themeTotalSizeLimitExceeded">;
|
|
301
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
302
|
+
type: z.ZodLiteral<"errors.pageMetafieldDefinitionsChanged">;
|
|
303
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
304
|
+
type: z.ZodLiteral<"settings.billing">;
|
|
305
|
+
}, z.core.$strip>], "type">;
|
|
306
|
+
}, z.core.$strip>], "type">>;
|
|
307
|
+
}, z.core.$strip>;
|
|
308
|
+
/**
|
|
309
|
+
* Schema for user-facing details which the frontend uses to show toasts, modals, etc
|
|
310
|
+
* when an error is thrown from the backend
|
|
311
|
+
*/
|
|
312
|
+
export declare const errorUserFacingDetailsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
313
|
+
type: z.ZodEnum<{
|
|
314
|
+
toast: "toast";
|
|
315
|
+
fullPageModal: "fullPageModal";
|
|
316
|
+
shopifyStorePassword: "shopifyStorePassword";
|
|
317
|
+
"billing.addPublishedElements": "billing.addPublishedElements";
|
|
318
|
+
"billing.addShopifyThemeProject": "billing.addShopifyThemeProject";
|
|
319
|
+
"billing.addReploSite": "billing.addReploSite";
|
|
320
|
+
"agentBilling.shopifyThemeBuilder.publishedElements.exceeded": "agentBilling.shopifyThemeBuilder.publishedElements.exceeded";
|
|
321
|
+
"agentBilling.shopifyThemeBuilder.projects.exceeded": "agentBilling.shopifyThemeBuilder.projects.exceeded";
|
|
322
|
+
"agentBilling.sites.exceeded": "agentBilling.sites.exceeded";
|
|
323
|
+
"agentBilling.credits.exceeded": "agentBilling.credits.exceeded";
|
|
324
|
+
"agentBilling.upgradeRequired": "agentBilling.upgradeRequired";
|
|
325
|
+
}>;
|
|
326
|
+
message: z.ZodString;
|
|
327
|
+
isRecoverable: z.ZodOptional<z.ZodBoolean>;
|
|
328
|
+
detail: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString>, z.ZodString]>>;
|
|
329
|
+
key: z.ZodString;
|
|
330
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
331
|
+
current: z.ZodNumber;
|
|
332
|
+
maximum: z.ZodNumber;
|
|
333
|
+
}, z.core.$strip>>;
|
|
334
|
+
plan: z.ZodOptional<z.ZodString>;
|
|
335
|
+
callToAction: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
336
|
+
type: z.ZodLiteral<"reload">;
|
|
337
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
338
|
+
type: z.ZodLiteral<"installApp">;
|
|
339
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
340
|
+
type: z.ZodLiteral<"goToHomepage">;
|
|
341
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
342
|
+
type: z.ZodLiteral<"navigateToProjectEditor">;
|
|
343
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
344
|
+
type: z.ZodLiteral<"closeModal">;
|
|
345
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
346
|
+
type: z.ZodLiteral<"navigateToLink">;
|
|
347
|
+
link: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
348
|
+
type: z.ZodLiteral<"errors.wrongJsonExtension">;
|
|
349
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
350
|
+
type: z.ZodLiteral<"errors.chunkingError">;
|
|
351
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
352
|
+
type: z.ZodLiteral<"errors.indexBackupError">;
|
|
353
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
354
|
+
type: z.ZodLiteral<"errors.shopifyIntegrationAlreadyAssigned">;
|
|
355
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
356
|
+
type: z.ZodLiteral<"errors.shopifyIntegrationMissingAccessScopes">;
|
|
357
|
+
url: z.ZodString;
|
|
358
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
359
|
+
type: z.ZodLiteral<"customLink">;
|
|
360
|
+
url: z.ZodString;
|
|
361
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
362
|
+
type: z.ZodLiteral<"errors.projectConnectedToBillingIntegrationForShopifyWorkspace">;
|
|
363
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
364
|
+
type: z.ZodLiteral<"errors.themeAssetSizeLimitExceeded">;
|
|
365
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
366
|
+
type: z.ZodLiteral<"errors.themeTotalSizeLimitExceeded">;
|
|
367
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
368
|
+
type: z.ZodLiteral<"errors.pageMetafieldDefinitionsChanged">;
|
|
369
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
370
|
+
type: z.ZodLiteral<"settings.billing">;
|
|
371
|
+
}, z.core.$strip>], "type">;
|
|
372
|
+
}, z.core.$strip>], "type">>;
|
|
373
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
374
|
+
type: z.ZodLiteral<"uncommon_none">;
|
|
375
|
+
key: z.ZodString;
|
|
376
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
377
|
+
current: z.ZodNumber;
|
|
378
|
+
maximum: z.ZodNumber;
|
|
379
|
+
}, z.core.$strip>>;
|
|
380
|
+
message: z.ZodOptional<z.ZodString>;
|
|
381
|
+
isRecoverable: z.ZodOptional<z.ZodBoolean>;
|
|
382
|
+
detail: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString>, z.ZodString]>>;
|
|
383
|
+
}, z.core.$strip>], "type">;
|
|
384
|
+
export declare const extractErrorTrackingEventDetails: (error: unknown, transaction: string | undefined, tags?: Record<string, string>) => {
|
|
385
|
+
fingerprint: string[];
|
|
386
|
+
extra: {
|
|
387
|
+
zodIssues: z.core.$ZodIssue[];
|
|
388
|
+
cause?: undefined;
|
|
389
|
+
};
|
|
390
|
+
tags: {
|
|
391
|
+
errorId?: string | undefined;
|
|
392
|
+
};
|
|
393
|
+
} | {
|
|
394
|
+
fingerprint: string[];
|
|
395
|
+
extra: Record<string, unknown> | undefined;
|
|
396
|
+
tags: {
|
|
397
|
+
errorId: string;
|
|
398
|
+
};
|
|
399
|
+
} | {
|
|
400
|
+
extra: {
|
|
401
|
+
cause: unknown;
|
|
402
|
+
zodIssues?: undefined;
|
|
403
|
+
};
|
|
404
|
+
tags: {
|
|
405
|
+
errorId?: string | undefined;
|
|
406
|
+
};
|
|
407
|
+
fingerprint?: undefined;
|
|
408
|
+
} | {
|
|
409
|
+
tags: {
|
|
410
|
+
errorId?: string | undefined;
|
|
411
|
+
};
|
|
412
|
+
fingerprint?: undefined;
|
|
413
|
+
extra?: undefined;
|
|
414
|
+
} | null;
|
|
415
|
+
export declare const shouldReportErrorToSentry: (error: Error) => boolean;
|
|
416
|
+
export declare class CloudflareAgentCoordinatorRpcError extends ReploError {
|
|
417
|
+
constructor(error: unknown);
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Failures on the shared iframe RPC channel (miniapp ↔ parent, canopy ↔ WB).
|
|
421
|
+
* Live next to other domain errors so callers get ReploError reporting without
|
|
422
|
+
* a `replo-utils → schemas` workspace cycle (schemas already depends on
|
|
423
|
+
* replo-utils; the channel implementation lives in `schemas/iframeRpcChannel`).
|
|
424
|
+
*/
|
|
425
|
+
export declare abstract class IframeRpcChannelError extends ReploError {
|
|
426
|
+
}
|
|
427
|
+
export declare class IframeRpcChannelTimeoutError extends IframeRpcChannelError {
|
|
428
|
+
constructor({ method, timeoutMs }: {
|
|
429
|
+
method: string;
|
|
430
|
+
timeoutMs: number;
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
export declare class IframeRpcChannelRemoteError extends IframeRpcChannelError {
|
|
434
|
+
constructor({ method, message }: {
|
|
435
|
+
method: string;
|
|
436
|
+
message: string;
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
export declare class IframeRpcChannelUnsubscribedError extends IframeRpcChannelError {
|
|
440
|
+
constructor({ method }: {
|
|
441
|
+
method: string;
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
export declare class IframeRpcChannelUnknownMethodError extends IframeRpcChannelError {
|
|
445
|
+
constructor({ method }: {
|
|
446
|
+
method: string;
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
export declare class IframeRpcChannelConfigurationError extends IframeRpcChannelError {
|
|
450
|
+
constructor({ message }: {
|
|
451
|
+
message: string;
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
export declare class IframeRpcChannelInvalidInputError extends IframeRpcChannelError {
|
|
455
|
+
constructor({ method, cause }: {
|
|
456
|
+
method: string;
|
|
457
|
+
cause: ZodError;
|
|
458
|
+
});
|
|
459
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type ErrorUserFacingDetailsWithMessage = {
|
|
2
|
+
type: "toast" | "fullPageModal" | "shopifyStorePassword" | "billing.addPublishedElements" | "billing.addShopifyThemeProject" | "billing.addReploSite" | "agentBilling.shopifyThemeBuilder.publishedElements.exceeded" | "agentBilling.shopifyThemeBuilder.projects.exceeded" | "agentBilling.sites.exceeded" | "agentBilling.credits.exceeded" | "agentBilling.upgradeRequired";
|
|
3
|
+
message: string;
|
|
4
|
+
isRecoverable?: boolean;
|
|
5
|
+
detail?: string[] | string;
|
|
6
|
+
key: string;
|
|
7
|
+
usage?: {
|
|
8
|
+
current: number;
|
|
9
|
+
maximum: number;
|
|
10
|
+
};
|
|
11
|
+
plan?: string;
|
|
12
|
+
callToAction?: {
|
|
13
|
+
type: "reload";
|
|
14
|
+
} | {
|
|
15
|
+
type: "installApp";
|
|
16
|
+
} | {
|
|
17
|
+
type: "goToHomepage";
|
|
18
|
+
} | {
|
|
19
|
+
type: "navigateToProjectEditor";
|
|
20
|
+
} | {
|
|
21
|
+
type: "closeModal";
|
|
22
|
+
} | {
|
|
23
|
+
type: "navigateToLink";
|
|
24
|
+
link: {
|
|
25
|
+
type: "errors.wrongJsonExtension";
|
|
26
|
+
} | {
|
|
27
|
+
type: "errors.chunkingError";
|
|
28
|
+
} | {
|
|
29
|
+
type: "errors.indexBackupError";
|
|
30
|
+
} | {
|
|
31
|
+
type: "errors.shopifyIntegrationAlreadyAssigned";
|
|
32
|
+
} | {
|
|
33
|
+
type: "errors.shopifyIntegrationMissingAccessScopes";
|
|
34
|
+
url: string;
|
|
35
|
+
} | {
|
|
36
|
+
type: "customLink";
|
|
37
|
+
url: string;
|
|
38
|
+
} | {
|
|
39
|
+
type: "errors.projectConnectedToBillingIntegrationForShopifyWorkspace";
|
|
40
|
+
} | {
|
|
41
|
+
type: "errors.themeAssetSizeLimitExceeded";
|
|
42
|
+
} | {
|
|
43
|
+
type: "errors.themeTotalSizeLimitExceeded";
|
|
44
|
+
} | {
|
|
45
|
+
type: "errors.pageMetafieldDefinitionsChanged";
|
|
46
|
+
} | {
|
|
47
|
+
type: "settings.billing";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export type ErrorUserFacingDetails = ErrorUserFacingDetailsWithMessage | {
|
|
52
|
+
type: "uncommon_none";
|
|
53
|
+
key: string;
|
|
54
|
+
usage?: {
|
|
55
|
+
current: number;
|
|
56
|
+
maximum: number;
|
|
57
|
+
};
|
|
58
|
+
message?: string;
|
|
59
|
+
isRecoverable?: boolean;
|
|
60
|
+
detail?: string[] | string;
|
|
61
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type PageAnnotationColor = "red" | "purple" | "amber";
|
|
2
|
+
export type PageAnnotationPlacement = "element" | "pageTop";
|
|
3
|
+
export type PageAnnotationMarker = {
|
|
4
|
+
id: string;
|
|
5
|
+
number: number;
|
|
6
|
+
color: PageAnnotationColor;
|
|
7
|
+
selector: string;
|
|
8
|
+
placement: PageAnnotationPlacement;
|
|
9
|
+
};
|
|
10
|
+
export type PageAnnotationViewportRect = {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
export type PageAnnotationsSetMessage = {
|
|
17
|
+
type: "replo:annotations:set";
|
|
18
|
+
protocolVersion: 1;
|
|
19
|
+
setId: string;
|
|
20
|
+
markers: PageAnnotationMarker[];
|
|
21
|
+
};
|
|
22
|
+
export type PageAnnotationsClearMessage = {
|
|
23
|
+
type: "replo:annotations:clear";
|
|
24
|
+
};
|
|
25
|
+
export type PageAnnotationsRequestReadyMessage = {
|
|
26
|
+
type: "replo:annotations:requestReady";
|
|
27
|
+
};
|
|
28
|
+
export type PageAnnotationsParentMessage = PageAnnotationsSetMessage | PageAnnotationsClearMessage | PageAnnotationsRequestReadyMessage;
|
|
29
|
+
export type PageAnnotationsReadyMessage = {
|
|
30
|
+
type: "replo:annotations:ready";
|
|
31
|
+
protocolVersion: 1;
|
|
32
|
+
};
|
|
33
|
+
export type PageAnnotationsClickedMessage = {
|
|
34
|
+
type: "replo:annotations:clicked";
|
|
35
|
+
id: string;
|
|
36
|
+
viewportRect: PageAnnotationViewportRect;
|
|
37
|
+
};
|
|
38
|
+
export type PageAnnotationsActiveRectMessage = {
|
|
39
|
+
type: "replo:annotations:activeRect";
|
|
40
|
+
id: string;
|
|
41
|
+
viewportRect: PageAnnotationViewportRect;
|
|
42
|
+
};
|
|
43
|
+
export type PageAnnotationsUnresolvedMessage = {
|
|
44
|
+
type: "replo:annotations:unresolved";
|
|
45
|
+
setId: string;
|
|
46
|
+
ids: string[];
|
|
47
|
+
};
|
|
48
|
+
export type PageAnnotationsIframeMessage = PageAnnotationsReadyMessage | PageAnnotationsClickedMessage | PageAnnotationsActiveRectMessage | PageAnnotationsUnresolvedMessage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export type DisplayMode = "browse" | "selection";
|
|
2
|
+
export type SelectModeSelectionType = "none" | "element" | "area" | "drag";
|
|
3
|
+
export type SelectModeInlineTextStatus = "editable" | "dynamic" | null;
|
|
4
|
+
export type SelectModeTextMetrics = {
|
|
5
|
+
tightWidth: number;
|
|
6
|
+
lineCount: number;
|
|
7
|
+
lineHeight: number;
|
|
8
|
+
};
|
|
9
|
+
export type SelectModeClickPosition = {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
export type SelectModeSourceLocation = {
|
|
14
|
+
filePath: string;
|
|
15
|
+
lineNumber: number;
|
|
16
|
+
columnNumber?: number;
|
|
17
|
+
componentName?: string;
|
|
18
|
+
};
|
|
19
|
+
export type SelectModeFiberChainEntry = {
|
|
20
|
+
sourceLocation: SelectModeSourceLocation;
|
|
21
|
+
tagName?: string;
|
|
22
|
+
componentName?: string;
|
|
23
|
+
props?: {
|
|
24
|
+
[x: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type SelectModeBoundingRect = {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
left: number;
|
|
31
|
+
top: number;
|
|
32
|
+
right: number;
|
|
33
|
+
bottom: number;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
};
|
|
37
|
+
export type SelectModeSelectionRect = {
|
|
38
|
+
id: string;
|
|
39
|
+
rect: SelectModeBoundingRect;
|
|
40
|
+
};
|
|
41
|
+
export type SelectModeStyleAtRule = {
|
|
42
|
+
type: string;
|
|
43
|
+
text: string;
|
|
44
|
+
};
|
|
45
|
+
export type SelectModeStyleVariant = {
|
|
46
|
+
atRules: SelectModeStyleAtRule[];
|
|
47
|
+
pseudo: string | null;
|
|
48
|
+
};
|
|
49
|
+
export type SelectModeDefinedStyle = {
|
|
50
|
+
property: string;
|
|
51
|
+
variant: SelectModeStyleVariant | null;
|
|
52
|
+
className: string | null;
|
|
53
|
+
raw: string;
|
|
54
|
+
resolved: string;
|
|
55
|
+
};
|
|
56
|
+
export type SelectedElement = {
|
|
57
|
+
kind: "react-element";
|
|
58
|
+
selector: string;
|
|
59
|
+
tagName: string;
|
|
60
|
+
elementType: string;
|
|
61
|
+
textContent: string | null;
|
|
62
|
+
rect: SelectModeBoundingRect;
|
|
63
|
+
textMetrics: SelectModeTextMetrics | null;
|
|
64
|
+
outerHTML: string;
|
|
65
|
+
definedStyles: SelectModeDefinedStyle[];
|
|
66
|
+
inheritedStyles: {
|
|
67
|
+
[x: string]: string;
|
|
68
|
+
};
|
|
69
|
+
clickPosition: SelectModeClickPosition;
|
|
70
|
+
sourceLocation?: SelectModeSourceLocation;
|
|
71
|
+
fiberChain: SelectModeFiberChainEntry[];
|
|
72
|
+
siblingSelectors: string[];
|
|
73
|
+
};
|
|
74
|
+
export type SelectablePlanData = {
|
|
75
|
+
kind: "plan";
|
|
76
|
+
planId: string;
|
|
77
|
+
label: string;
|
|
78
|
+
rect: SelectModeBoundingRect;
|
|
79
|
+
};
|
|
80
|
+
export type SelectablePlanPayload = {
|
|
81
|
+
kind: "plan";
|
|
82
|
+
planId: string;
|
|
83
|
+
label: string;
|
|
84
|
+
};
|
|
85
|
+
export type SelectableDataPayload = SelectablePlanPayload;
|
|
86
|
+
export type SelectableData = SelectedElement | SelectablePlanData;
|
|
87
|
+
export type SelectModeOptimisticUpdatePayload = {
|
|
88
|
+
kind: "css";
|
|
89
|
+
property: string;
|
|
90
|
+
value: string | null;
|
|
91
|
+
} | {
|
|
92
|
+
kind: "content";
|
|
93
|
+
innerHTML: string;
|
|
94
|
+
} | {
|
|
95
|
+
kind: "attribute";
|
|
96
|
+
name: string;
|
|
97
|
+
value: string;
|
|
98
|
+
};
|
|
99
|
+
export type SelectModeTiptapActiveMarks = {
|
|
100
|
+
bold: boolean;
|
|
101
|
+
italic: boolean;
|
|
102
|
+
underline: boolean;
|
|
103
|
+
strike: boolean;
|
|
104
|
+
};
|
|
105
|
+
export type SelectModeFormatCommand = "toggleBold" | "toggleItalic" | "toggleUnderline" | "toggleStrike";
|
|
106
|
+
export type SelectModeSelection = {
|
|
107
|
+
type: "none";
|
|
108
|
+
} | {
|
|
109
|
+
type: "element";
|
|
110
|
+
data: SelectableData;
|
|
111
|
+
} | {
|
|
112
|
+
type: "area";
|
|
113
|
+
rect: SelectModeBoundingRect;
|
|
114
|
+
items: SelectableData[];
|
|
115
|
+
} | {
|
|
116
|
+
type: "drag";
|
|
117
|
+
dragRect: SelectModeBoundingRect;
|
|
118
|
+
selectionRects: SelectModeSelectionRect[];
|
|
119
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|