@replohq/canopy-sdk 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.
Files changed (241) hide show
  1. package/_vendor/replo-utils/lib/errors.d.ts +83 -0
  2. package/_vendor/replo-utils/lib/json.d.ts +6 -0
  3. package/_vendor/replo-utils/lib/misc.d.ts +128 -0
  4. package/_vendor/replo-utils/lib/misc.mjs +1 -0
  5. package/_vendor/replo-utils/lib/object.d.ts +31 -0
  6. package/_vendor/replo-utils/lib/parse.d.ts +15 -0
  7. package/_vendor/schemas/agentTools/customIntegrations/loaders/levanta.d.ts +49 -0
  8. package/_vendor/schemas/agentTools/customIntegrations/loaders/levanta.mjs +36 -0
  9. package/_vendor/schemas/agentTools/customIntegrations/loaders/product.d.ts +334 -0
  10. package/_vendor/schemas/agentTools/customIntegrations/loaders/product.mjs +50 -0
  11. package/_vendor/schemas/cart.d.ts +198 -0
  12. package/_vendor/schemas/cart.mjs +83 -0
  13. package/_vendor/schemas/errors.d.ts +428 -0
  14. package/_vendor/schemas/errors.mjs +955 -0
  15. package/_vendor/schemas/generated/errors.d.ts +61 -0
  16. package/_vendor/schemas/generated/selectMode.d.ts +95 -0
  17. package/_vendor/schemas/generated/selectMode.mjs +1 -0
  18. package/_vendor/schemas/loaderKeys.d.ts +39 -0
  19. package/_vendor/schemas/loaderKeys.mjs +23 -0
  20. package/_vendor/schemas/objectType.d.ts +895 -0
  21. package/_vendor/schemas/objectType.mjs +2 -0
  22. package/_vendor/schemas/registry.d.ts +243 -0
  23. package/_vendor/schemas/sandboxFiles.d.ts +35 -0
  24. package/_vendor/schemas/selectMode.d.ts +507 -0
  25. package/_vendor/schemas/selectMode.mjs +194 -0
  26. package/_vendor/schemas/sellingPlan.d.ts +60 -0
  27. package/_vendor/schemas/sellingPlan.mjs +1 -0
  28. package/analytics/analytics-provider.d.ts +13 -0
  29. package/analytics/analytics-provider.js +104 -0
  30. package/analytics/analytics-provider.js.map +7 -0
  31. package/analytics/analytics-sink.d.ts +20 -0
  32. package/analytics/analytics-sink.js +1 -0
  33. package/analytics/analytics-sink.js.map +7 -0
  34. package/analytics/hooks/use-product-viewed-analytics.d.ts +23 -0
  35. package/analytics/hooks/use-product-viewed-analytics.js +34 -0
  36. package/analytics/hooks/use-product-viewed-analytics.js.map +7 -0
  37. package/analytics/sinks/ga4-sink.d.ts +15 -0
  38. package/analytics/sinks/ga4-sink.js +52 -0
  39. package/analytics/sinks/ga4-sink.js.map +7 -0
  40. package/analytics/sinks/meta-sink.d.ts +14 -0
  41. package/analytics/sinks/meta-sink.js +44 -0
  42. package/analytics/sinks/meta-sink.js.map +7 -0
  43. package/analytics/sinks/pinterest-sink.d.ts +14 -0
  44. package/analytics/sinks/pinterest-sink.js +76 -0
  45. package/analytics/sinks/pinterest-sink.js.map +7 -0
  46. package/analytics/sinks/reddit-sink.d.ts +14 -0
  47. package/analytics/sinks/reddit-sink.js +80 -0
  48. package/analytics/sinks/reddit-sink.js.map +7 -0
  49. package/analytics/sinks/replo-sink.d.ts +14 -0
  50. package/analytics/sinks/replo-sink.js +57 -0
  51. package/analytics/sinks/replo-sink.js.map +7 -0
  52. package/analytics/sinks/snapchat-sink.d.ts +14 -0
  53. package/analytics/sinks/snapchat-sink.js +67 -0
  54. package/analytics/sinks/snapchat-sink.js.map +7 -0
  55. package/analytics/sinks/tiktok-sink.d.ts +14 -0
  56. package/analytics/sinks/tiktok-sink.js +79 -0
  57. package/analytics/sinks/tiktok-sink.js.map +7 -0
  58. package/analytics/sinks/window-sink.d.ts +18 -0
  59. package/analytics/sinks/window-sink.js +46 -0
  60. package/analytics/sinks/window-sink.js.map +7 -0
  61. package/analytics/utils/analytics-utils.d.ts +7 -0
  62. package/analytics/utils/analytics-utils.js +130 -0
  63. package/analytics/utils/analytics-utils.js.map +7 -0
  64. package/analytics/utils/navigation-tracker.d.ts +16 -0
  65. package/analytics/utils/navigation-tracker.js +44 -0
  66. package/analytics/utils/navigation-tracker.js.map +7 -0
  67. package/cart/buy-now-action.d.ts +21 -0
  68. package/cart/buy-now-action.js +104 -0
  69. package/cart/buy-now-action.js.map +7 -0
  70. package/cart/cart-actions.d.ts +63 -0
  71. package/cart/cart-actions.js +90 -0
  72. package/cart/cart-actions.js.map +7 -0
  73. package/cart/cart-loader.d.ts +9 -0
  74. package/cart/cart-loader.js +11 -0
  75. package/cart/cart-loader.js.map +7 -0
  76. package/cart/cart-provider.d.ts +85 -0
  77. package/cart/cart-provider.js +358 -0
  78. package/cart/cart-provider.js.map +7 -0
  79. package/cart/cart-types.d.ts +154 -0
  80. package/cart/cart-types.js +16 -0
  81. package/cart/cart-types.js.map +7 -0
  82. package/cart/gateways/cart-gateway.d.ts +10 -0
  83. package/cart/gateways/cart-gateway.js +19 -0
  84. package/cart/gateways/cart-gateway.js.map +7 -0
  85. package/cart/gateways/cookie-cart-gateway.d.ts +28 -0
  86. package/cart/gateways/cookie-cart-gateway.js +109 -0
  87. package/cart/gateways/cookie-cart-gateway.js.map +7 -0
  88. package/cart/gateways/default-cart-gateway.d.ts +19 -0
  89. package/cart/gateways/default-cart-gateway.js +30 -0
  90. package/cart/gateways/default-cart-gateway.js.map +7 -0
  91. package/cart/gateways/resolver-cart-gateway.d.ts +2 -0
  92. package/cart/gateways/resolver-cart-gateway.js +106 -0
  93. package/cart/gateways/resolver-cart-gateway.js.map +7 -0
  94. package/cart/gateways/stripe-cart-gateway.d.ts +19 -0
  95. package/cart/gateways/stripe-cart-gateway.js +28 -0
  96. package/cart/gateways/stripe-cart-gateway.js.map +7 -0
  97. package/cart/gateways/stripe-constants.d.ts +1 -0
  98. package/cart/gateways/stripe-constants.js +5 -0
  99. package/cart/gateways/stripe-constants.js.map +7 -0
  100. package/cart/hooks/use-add-to-cart.d.ts +63 -0
  101. package/cart/hooks/use-add-to-cart.js +120 -0
  102. package/cart/hooks/use-add-to-cart.js.map +7 -0
  103. package/cart/hooks/use-buy-now.d.ts +49 -0
  104. package/cart/hooks/use-buy-now.js +62 -0
  105. package/cart/hooks/use-buy-now.js.map +7 -0
  106. package/cart/utils/cart-utils.d.ts +31 -0
  107. package/cart/utils/cart-utils.js +48 -0
  108. package/cart/utils/cart-utils.js.map +7 -0
  109. package/cart/utils/cookie-cart-persistence.d.ts +55 -0
  110. package/cart/utils/cookie-cart-persistence.js +153 -0
  111. package/cart/utils/cookie-cart-persistence.js.map +7 -0
  112. package/cart/utils/variant-to-cart-line.d.ts +124 -0
  113. package/cart/utils/variant-to-cart-line.js +202 -0
  114. package/cart/utils/variant-to-cart-line.js.map +7 -0
  115. package/chunk-46YU2W6T.mjs +538 -0
  116. package/chunk-4TZVNC3W.mjs +33 -0
  117. package/chunk-INHK6MYI.mjs +1598 -0
  118. package/editor/ClientErrorBoundary.d.ts +7 -0
  119. package/editor/ClientErrorBoundary.js +48 -0
  120. package/editor/ClientErrorBoundary.js.map +7 -0
  121. package/editor/LinkInterceptor.d.ts +1 -0
  122. package/editor/LinkInterceptor.js +124 -0
  123. package/editor/LinkInterceptor.js.map +7 -0
  124. package/editor/posthog-relay.d.ts +10 -0
  125. package/editor/posthog-relay.js +60 -0
  126. package/editor/posthog-relay.js.map +7 -0
  127. package/editor/select-mode/EditorSelection.d.ts +24 -0
  128. package/editor/select-mode/EditorSelection.js +34 -0
  129. package/editor/select-mode/EditorSelection.js.map +7 -0
  130. package/editor/select-mode/descriptor/elementDescriptor.d.ts +15 -0
  131. package/editor/select-mode/descriptor/elementDescriptor.js +213 -0
  132. package/editor/select-mode/descriptor/elementDescriptor.js.map +7 -0
  133. package/editor/select-mode/fiber.d.ts +52 -0
  134. package/editor/select-mode/fiber.js +269 -0
  135. package/editor/select-mode/fiber.js.map +7 -0
  136. package/editor/select-mode/hooks/useCrosshairCursor.d.ts +12 -0
  137. package/editor/select-mode/hooks/useCrosshairCursor.js +20 -0
  138. package/editor/select-mode/hooks/useCrosshairCursor.js.map +7 -0
  139. package/editor/select-mode/hooks/useParentMessaging.d.ts +24 -0
  140. package/editor/select-mode/hooks/useParentMessaging.js +33 -0
  141. package/editor/select-mode/hooks/useParentMessaging.js.map +7 -0
  142. package/editor/select-mode/hooks/useSelectModeController.d.ts +8 -0
  143. package/editor/select-mode/hooks/useSelectModeController.js +49 -0
  144. package/editor/select-mode/hooks/useSelectModeController.js.map +7 -0
  145. package/editor/select-mode/hooks/useSelectionHover.d.ts +22 -0
  146. package/editor/select-mode/hooks/useSelectionHover.js +98 -0
  147. package/editor/select-mode/hooks/useSelectionHover.js.map +7 -0
  148. package/editor/select-mode/hooks/useSelectionInteractions.d.ts +32 -0
  149. package/editor/select-mode/hooks/useSelectionInteractions.js +293 -0
  150. package/editor/select-mode/hooks/useSelectionInteractions.js.map +7 -0
  151. package/editor/select-mode/hooks/useSelectionScrollSync.d.ts +28 -0
  152. package/editor/select-mode/hooks/useSelectionScrollSync.js +77 -0
  153. package/editor/select-mode/hooks/useSelectionScrollSync.js.map +7 -0
  154. package/editor/select-mode/interactions/selectionGeometry.d.ts +80 -0
  155. package/editor/select-mode/interactions/selectionGeometry.js +160 -0
  156. package/editor/select-mode/interactions/selectionGeometry.js.map +7 -0
  157. package/editor/select-mode/selectModeSession.d.ts +21 -0
  158. package/editor/select-mode/selectModeSession.js +7 -0
  159. package/editor/select-mode/selectModeSession.js.map +7 -0
  160. package/editor/select-mode/selectionFrame.d.ts +48 -0
  161. package/editor/select-mode/selectionFrame.js +74 -0
  162. package/editor/select-mode/selectionFrame.js.map +7 -0
  163. package/editor/select-mode/symbolicate.d.ts +3 -0
  164. package/editor/select-mode/symbolicate.js +139 -0
  165. package/editor/select-mode/symbolicate.js.map +7 -0
  166. package/env.d.ts +13 -0
  167. package/env.js +20 -0
  168. package/env.js.map +7 -0
  169. package/gateways/canopy-api.d.ts +84 -0
  170. package/gateways/canopy-api.js +203 -0
  171. package/gateways/canopy-api.js.map +7 -0
  172. package/hooks/use-client-value.d.ts +10 -0
  173. package/hooks/use-client-value.js +12 -0
  174. package/hooks/use-client-value.js.map +7 -0
  175. package/hooks/use-formatted-price.d.ts +15 -0
  176. package/hooks/use-formatted-price.js +19 -0
  177. package/hooks/use-formatted-price.js.map +7 -0
  178. package/lib/get-query-client.d.ts +2 -0
  179. package/lib/get-query-client.js +34 -0
  180. package/lib/get-query-client.js.map +7 -0
  181. package/lib/integration-utils.d.ts +2 -0
  182. package/lib/integration-utils.js +9 -0
  183. package/lib/integration-utils.js.map +7 -0
  184. package/lib/shopify-utils.d.ts +16 -0
  185. package/lib/shopify-utils.js +11 -0
  186. package/lib/shopify-utils.js.map +7 -0
  187. package/lib/url-utils.d.ts +4 -0
  188. package/lib/url-utils.js +8 -0
  189. package/lib/url-utils.js.map +7 -0
  190. package/loaders/collection-loader.d.ts +11 -0
  191. package/loaders/collection-loader.js +53 -0
  192. package/loaders/collection-loader.js.map +7 -0
  193. package/loaders/collection-products-loader.d.ts +12 -0
  194. package/loaders/collection-products-loader.js +56 -0
  195. package/loaders/collection-products-loader.js.map +7 -0
  196. package/loaders/invoke-loader-action.d.ts +11 -0
  197. package/loaders/invoke-loader-action.js +14 -0
  198. package/loaders/invoke-loader-action.js.map +7 -0
  199. package/loaders/invoke-loader-server.d.ts +18 -0
  200. package/loaders/invoke-loader-server.js +35 -0
  201. package/loaders/invoke-loader-server.js.map +7 -0
  202. package/loaders/invoke-loader.d.ts +14 -0
  203. package/loaders/invoke-loader.js +36 -0
  204. package/loaders/invoke-loader.js.map +7 -0
  205. package/loaders/levanta-product-loader.d.ts +11 -0
  206. package/loaders/levanta-product-loader.js +53 -0
  207. package/loaders/levanta-product-loader.js.map +7 -0
  208. package/loaders/loader-error-boundary.d.ts +25 -0
  209. package/loaders/loader-error-boundary.js +24 -0
  210. package/loaders/loader-error-boundary.js.map +7 -0
  211. package/loaders/okendo-review-aggregate-loader.d.ts +17 -0
  212. package/loaders/okendo-review-aggregate-loader.js +56 -0
  213. package/loaders/okendo-review-aggregate-loader.js.map +7 -0
  214. package/loaders/okendo-reviews-loader.d.ts +23 -0
  215. package/loaders/okendo-reviews-loader.js +54 -0
  216. package/loaders/okendo-reviews-loader.js.map +7 -0
  217. package/loaders/prefetch-loaders.d.ts +33 -0
  218. package/loaders/prefetch-loaders.js +46 -0
  219. package/loaders/prefetch-loaders.js.map +7 -0
  220. package/loaders/product-loader.d.ts +11 -0
  221. package/loaders/product-loader.js +53 -0
  222. package/loaders/product-loader.js.map +7 -0
  223. package/loaders/rebuy-recommendations-loader.d.ts +159 -0
  224. package/loaders/rebuy-recommendations-loader.js +57 -0
  225. package/loaders/rebuy-recommendations-loader.js.map +7 -0
  226. package/loaders/smile-earning-rules-loader.d.ts +19 -0
  227. package/loaders/smile-earning-rules-loader.js +44 -0
  228. package/loaders/smile-earning-rules-loader.js.map +7 -0
  229. package/loaders/smile-rewards-loader.d.ts +19 -0
  230. package/loaders/smile-rewards-loader.js +44 -0
  231. package/loaders/smile-rewards-loader.js.map +7 -0
  232. package/loaders/smile-vip-tiers-loader.d.ts +18 -0
  233. package/loaders/smile-vip-tiers-loader.js +43 -0
  234. package/loaders/smile-vip-tiers-loader.js.map +7 -0
  235. package/package.json +29 -0
  236. package/providers/query-provider.d.ts +1 -0
  237. package/providers/query-provider.js +12 -0
  238. package/providers/query-provider.js.map +7 -0
  239. package/providers/replo-provider.d.ts +1 -0
  240. package/providers/replo-provider.js +20 -0
  241. package/providers/replo-provider.js.map +7 -0
@@ -0,0 +1,428 @@
1
+ import type { ErrorUserFacingDetails, ErrorUserFacingDetailsWithMessage } from "./generated/errors";
2
+ import { z } 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
+ export type AuthErrorType = "unauthenticated" | "unauthorized" | "notFound";
47
+ export type ReploAuthenticationErrorConfig = {
48
+ message: string;
49
+ type: AuthErrorType;
50
+ userFacingDetails?: ErrorUserFacingDetailsWithMessage;
51
+ additionalData?: ReploErrorConfig["additionalData"];
52
+ };
53
+ export declare class ReploAuthenticationError extends ReploError {
54
+ type: AuthErrorType;
55
+ userFacingDetails?: ErrorUserFacingDetailsWithMessage;
56
+ constructor(config: ReploAuthenticationErrorConfig);
57
+ getHttpStatusCode(): 401 | 403 | 404;
58
+ getTRPCErrorCode(): "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND";
59
+ }
60
+ /**
61
+ * Error which automatically makes all Replo services respond with a specific
62
+ * HTTP status code when caught. Should only be thrown from routes, makes it
63
+ * easier to provide a standardized way of implementing user-facing messages
64
+ */
65
+ export declare class ReploHTTPError extends ReploError {
66
+ userFacingDetails: ErrorUserFacingDetails;
67
+ statusCode: number;
68
+ details?: object;
69
+ constructor(config: {
70
+ statusCode: number;
71
+ userFacingDetails: ErrorUserFacingDetails;
72
+ details?: object;
73
+ });
74
+ }
75
+ /**
76
+ * Error used to represent an HTTP error that should be surfaced as such. This
77
+ * should be thrown when we want to pass the error through without changing the
78
+ * status code and without providing any user facing details (because this route
79
+ * is not serving the client e.g. when we're calling Mirror through the
80
+ * Publisher)
81
+ */
82
+ export declare class ReploRawHTTPError extends ReploError {
83
+ statusCode: number;
84
+ errorType: string;
85
+ data?: object;
86
+ constructor(config: {
87
+ statusCode: number;
88
+ message: string;
89
+ errorType: string;
90
+ data?: object;
91
+ });
92
+ }
93
+ /**
94
+ * Error which is automatically mapped to a status code response wherever it's
95
+ * thrown. Errors which are thrown from many different places where we want to
96
+ * always respond in the same way should inherit this, e.g. an error thrown for
97
+ * any Shopify call when the user has uninstalled the app.
98
+ *
99
+ * Inheriting from this should be uncommon, for most errors we want to inherit
100
+ * from ReploError and catch/map them to ReploHTTPErrors in our routes. For the
101
+ * uncommon cases where we want to globally map errors this reduces boilerplate.
102
+ *
103
+ * Globally mapped errors are never reported to Sentry or logged.
104
+ */
105
+ export declare class Uncommon_GloballyMappedError extends ReploError {
106
+ userFacingDetails: ErrorUserFacingDetails;
107
+ statusCode: number;
108
+ constructor(config: ReploErrorConfig & {
109
+ statusCode: number;
110
+ userFacingDetails: ErrorUserFacingDetails;
111
+ });
112
+ }
113
+ export declare class ReploValidationError extends ReploError {
114
+ constructor(message: string);
115
+ }
116
+ export declare class UnexpectedMutationError extends ReploError {
117
+ constructor();
118
+ }
119
+ export declare class UnexpectedRawGraphqlClientError extends ReploError {
120
+ originalError: unknown;
121
+ errors: unknown[];
122
+ data: unknown;
123
+ constructor(opts: {
124
+ originalError: unknown;
125
+ errors: unknown[];
126
+ data: unknown;
127
+ });
128
+ }
129
+ export declare const DEFAULT_ERROR_MESSAGE_CONFIG: {
130
+ header: string;
131
+ message: string;
132
+ isFullPage: boolean;
133
+ };
134
+ export type ErrorDetails = {
135
+ header: string;
136
+ subheader?: string;
137
+ message?: string | string[] | React.ReactNode;
138
+ messageDetail?: string;
139
+ isRecoverable?: boolean;
140
+ isFullPage?: boolean;
141
+ usage?: {
142
+ current: number;
143
+ maximum: number;
144
+ };
145
+ callToAction?: {
146
+ type: "installApp";
147
+ } | {
148
+ type: "callback";
149
+ name: string;
150
+ onClick(): void;
151
+ } | {
152
+ type: "link";
153
+ name: string;
154
+ to: string;
155
+ target?: string;
156
+ } | {
157
+ type: "closeModal";
158
+ name: string;
159
+ } | {
160
+ type: "navigate";
161
+ location: {
162
+ type: "integrationHub";
163
+ } | {
164
+ type: "home";
165
+ } | {
166
+ type: "workspace";
167
+ workspaceId: string;
168
+ workspaceName: string;
169
+ };
170
+ } | {
171
+ type: "custom";
172
+ callToActionType: ErrorUserFacingDetailsWithMessage["callToAction"];
173
+ };
174
+ };
175
+ /**
176
+ * Map of error keys to custom user-facing details. Should ONLY be used
177
+ * in cases where we want to override the default behavior of ErrorUserFacingDetails
178
+ * from the backend.
179
+ *
180
+ * TODO (Noah, 2024-01-15): Clean up these custom configs, all of them
181
+ * are only used by Django (and 'base' can be moved directly into the reducer function)
182
+ */
183
+ export declare const CUSTOM_ERROR_KEY_TO_PROPS: {
184
+ "shopifyArticle.failedToPublish": () => {
185
+ header: string;
186
+ message: string;
187
+ };
188
+ "shopifySection.failedToPublish": () => {
189
+ header: string;
190
+ message: string;
191
+ };
192
+ "page.failedToPublish": () => {
193
+ header: string;
194
+ message: string;
195
+ };
196
+ "shopifyProductTemplate.failedToPublish": () => {
197
+ header: string;
198
+ message: string;
199
+ };
200
+ "element.failedToPublish": () => {
201
+ header: string;
202
+ message: string;
203
+ };
204
+ "element.failedToUpdate": () => {
205
+ header: string;
206
+ message: string;
207
+ };
208
+ "store.billingPlan.alreadyExist": () => {
209
+ header: string;
210
+ message: string;
211
+ };
212
+ "error.assets.unsupportedFileType": ({ serverMessage }: {
213
+ type: string;
214
+ serverMessage?: string;
215
+ endpoint: string | null;
216
+ }) => {
217
+ header: string;
218
+ message: string;
219
+ };
220
+ "error.assets.fileTooLarge": () => {
221
+ header: string;
222
+ message: string;
223
+ };
224
+ "error.files.fileTooLarge": () => {
225
+ header: string;
226
+ message: string;
227
+ };
228
+ base: () => {
229
+ header: string;
230
+ message: string;
231
+ isFullPage: boolean;
232
+ };
233
+ };
234
+ export declare function extractErrorId(error: unknown): string | undefined;
235
+ export declare function addErrorIdIfNeeded(error: unknown): void;
236
+ export declare const errorUserFacingDetailsMessageSchema: z.ZodObject<{
237
+ type: z.ZodEnum<{
238
+ toast: "toast";
239
+ fullPageModal: "fullPageModal";
240
+ shopifyStorePassword: "shopifyStorePassword";
241
+ "billing.addPublishedElements": "billing.addPublishedElements";
242
+ "billing.addShopifyThemeProject": "billing.addShopifyThemeProject";
243
+ "billing.addReploSite": "billing.addReploSite";
244
+ "agentBilling.shopifyThemeBuilder.publishedElements.exceeded": "agentBilling.shopifyThemeBuilder.publishedElements.exceeded";
245
+ "agentBilling.shopifyThemeBuilder.projects.exceeded": "agentBilling.shopifyThemeBuilder.projects.exceeded";
246
+ "agentBilling.sites.exceeded": "agentBilling.sites.exceeded";
247
+ "agentBilling.credits.exceeded": "agentBilling.credits.exceeded";
248
+ "agentBilling.upgradeRequired": "agentBilling.upgradeRequired";
249
+ }>;
250
+ message: z.ZodString;
251
+ isRecoverable: z.ZodOptional<z.ZodBoolean>;
252
+ detail: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString>, z.ZodString]>>;
253
+ key: z.ZodString;
254
+ usage: z.ZodOptional<z.ZodObject<{
255
+ current: z.ZodNumber;
256
+ maximum: z.ZodNumber;
257
+ }, z.core.$strip>>;
258
+ plan: z.ZodOptional<z.ZodString>;
259
+ callToAction: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
260
+ type: z.ZodLiteral<"reload">;
261
+ }, z.core.$strip>, z.ZodObject<{
262
+ type: z.ZodLiteral<"installApp">;
263
+ }, z.core.$strip>, z.ZodObject<{
264
+ type: z.ZodLiteral<"goToHomepage">;
265
+ }, z.core.$strip>, z.ZodObject<{
266
+ type: z.ZodLiteral<"navigateToProjectEditor">;
267
+ }, z.core.$strip>, z.ZodObject<{
268
+ type: z.ZodLiteral<"closeModal">;
269
+ }, z.core.$strip>, z.ZodObject<{
270
+ type: z.ZodLiteral<"navigateToLink">;
271
+ link: z.ZodDiscriminatedUnion<[z.ZodObject<{
272
+ type: z.ZodLiteral<"errors.wrongJsonExtension">;
273
+ }, z.core.$strip>, z.ZodObject<{
274
+ type: z.ZodLiteral<"errors.chunkingError">;
275
+ }, z.core.$strip>, z.ZodObject<{
276
+ type: z.ZodLiteral<"errors.indexBackupError">;
277
+ }, z.core.$strip>, z.ZodObject<{
278
+ type: z.ZodLiteral<"errors.shopifyIntegrationAlreadyAssigned">;
279
+ }, z.core.$strip>, z.ZodObject<{
280
+ type: z.ZodLiteral<"errors.shopifyIntegrationMissingAccessScopes">;
281
+ url: z.ZodString;
282
+ }, z.core.$strip>, z.ZodObject<{
283
+ type: z.ZodLiteral<"customLink">;
284
+ url: z.ZodString;
285
+ }, z.core.$strip>, z.ZodObject<{
286
+ type: z.ZodLiteral<"errors.projectConnectedToBillingIntegrationForShopifyWorkspace">;
287
+ }, z.core.$strip>, z.ZodObject<{
288
+ type: z.ZodLiteral<"errors.themeAssetSizeLimitExceeded">;
289
+ }, z.core.$strip>, z.ZodObject<{
290
+ type: z.ZodLiteral<"errors.themeTotalSizeLimitExceeded">;
291
+ }, z.core.$strip>, z.ZodObject<{
292
+ type: z.ZodLiteral<"errors.pageMetafieldDefinitionsChanged">;
293
+ }, z.core.$strip>, z.ZodObject<{
294
+ type: z.ZodLiteral<"settings.billing">;
295
+ }, z.core.$strip>], "type">;
296
+ }, z.core.$strip>], "type">>;
297
+ }, z.core.$strip>;
298
+ /**
299
+ * Schema for user-facing details which the frontend uses to show toasts, modals, etc
300
+ * when an error is thrown from the backend
301
+ */
302
+ export declare const errorUserFacingDetailsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
303
+ type: z.ZodEnum<{
304
+ toast: "toast";
305
+ fullPageModal: "fullPageModal";
306
+ shopifyStorePassword: "shopifyStorePassword";
307
+ "billing.addPublishedElements": "billing.addPublishedElements";
308
+ "billing.addShopifyThemeProject": "billing.addShopifyThemeProject";
309
+ "billing.addReploSite": "billing.addReploSite";
310
+ "agentBilling.shopifyThemeBuilder.publishedElements.exceeded": "agentBilling.shopifyThemeBuilder.publishedElements.exceeded";
311
+ "agentBilling.shopifyThemeBuilder.projects.exceeded": "agentBilling.shopifyThemeBuilder.projects.exceeded";
312
+ "agentBilling.sites.exceeded": "agentBilling.sites.exceeded";
313
+ "agentBilling.credits.exceeded": "agentBilling.credits.exceeded";
314
+ "agentBilling.upgradeRequired": "agentBilling.upgradeRequired";
315
+ }>;
316
+ message: z.ZodString;
317
+ isRecoverable: z.ZodOptional<z.ZodBoolean>;
318
+ detail: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString>, z.ZodString]>>;
319
+ key: z.ZodString;
320
+ usage: z.ZodOptional<z.ZodObject<{
321
+ current: z.ZodNumber;
322
+ maximum: z.ZodNumber;
323
+ }, z.core.$strip>>;
324
+ plan: z.ZodOptional<z.ZodString>;
325
+ callToAction: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
326
+ type: z.ZodLiteral<"reload">;
327
+ }, z.core.$strip>, z.ZodObject<{
328
+ type: z.ZodLiteral<"installApp">;
329
+ }, z.core.$strip>, z.ZodObject<{
330
+ type: z.ZodLiteral<"goToHomepage">;
331
+ }, z.core.$strip>, z.ZodObject<{
332
+ type: z.ZodLiteral<"navigateToProjectEditor">;
333
+ }, z.core.$strip>, z.ZodObject<{
334
+ type: z.ZodLiteral<"closeModal">;
335
+ }, z.core.$strip>, z.ZodObject<{
336
+ type: z.ZodLiteral<"navigateToLink">;
337
+ link: z.ZodDiscriminatedUnion<[z.ZodObject<{
338
+ type: z.ZodLiteral<"errors.wrongJsonExtension">;
339
+ }, z.core.$strip>, z.ZodObject<{
340
+ type: z.ZodLiteral<"errors.chunkingError">;
341
+ }, z.core.$strip>, z.ZodObject<{
342
+ type: z.ZodLiteral<"errors.indexBackupError">;
343
+ }, z.core.$strip>, z.ZodObject<{
344
+ type: z.ZodLiteral<"errors.shopifyIntegrationAlreadyAssigned">;
345
+ }, z.core.$strip>, z.ZodObject<{
346
+ type: z.ZodLiteral<"errors.shopifyIntegrationMissingAccessScopes">;
347
+ url: z.ZodString;
348
+ }, z.core.$strip>, z.ZodObject<{
349
+ type: z.ZodLiteral<"customLink">;
350
+ url: z.ZodString;
351
+ }, z.core.$strip>, z.ZodObject<{
352
+ type: z.ZodLiteral<"errors.projectConnectedToBillingIntegrationForShopifyWorkspace">;
353
+ }, z.core.$strip>, z.ZodObject<{
354
+ type: z.ZodLiteral<"errors.themeAssetSizeLimitExceeded">;
355
+ }, z.core.$strip>, z.ZodObject<{
356
+ type: z.ZodLiteral<"errors.themeTotalSizeLimitExceeded">;
357
+ }, z.core.$strip>, z.ZodObject<{
358
+ type: z.ZodLiteral<"errors.pageMetafieldDefinitionsChanged">;
359
+ }, z.core.$strip>, z.ZodObject<{
360
+ type: z.ZodLiteral<"settings.billing">;
361
+ }, z.core.$strip>], "type">;
362
+ }, z.core.$strip>], "type">>;
363
+ }, z.core.$strip>, z.ZodObject<{
364
+ type: z.ZodLiteral<"uncommon_none">;
365
+ key: z.ZodString;
366
+ usage: z.ZodOptional<z.ZodObject<{
367
+ current: z.ZodNumber;
368
+ maximum: z.ZodNumber;
369
+ }, z.core.$strip>>;
370
+ message: z.ZodOptional<z.ZodString>;
371
+ isRecoverable: z.ZodOptional<z.ZodBoolean>;
372
+ detail: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString>, z.ZodString]>>;
373
+ }, z.core.$strip>], "type">;
374
+ export declare const extractErrorTrackingEventDetails: (error: unknown, transaction: string | undefined, tags?: Record<string, string>) => {
375
+ fingerprint: string[];
376
+ extra: {
377
+ zodIssues: z.core.$ZodIssue[];
378
+ cause?: undefined;
379
+ };
380
+ tags: {
381
+ errorId?: string | undefined;
382
+ };
383
+ } | {
384
+ fingerprint: string[];
385
+ extra: Record<string, unknown> | undefined;
386
+ tags: {
387
+ errorId: string;
388
+ };
389
+ } | {
390
+ extra: {
391
+ cause: unknown;
392
+ zodIssues?: undefined;
393
+ };
394
+ tags: {
395
+ errorId?: string | undefined;
396
+ };
397
+ fingerprint?: undefined;
398
+ } | {
399
+ tags: {
400
+ errorId?: string | undefined;
401
+ };
402
+ fingerprint?: undefined;
403
+ extra?: undefined;
404
+ } | null;
405
+ export declare const shouldReportErrorToSentry: (error: Error) => boolean;
406
+ export declare class CloudflareAgentCoordinatorRpcError extends ReploError {
407
+ constructor(error: unknown);
408
+ }
409
+ /**
410
+ * Errors thrown by the postMessage RPC layer between bedrock miniapp iframes
411
+ * and their agent-ui parent (see `packages/schemas/miniappRpc.ts` for the
412
+ * protocol). Both sides reject pending request promises with these so
413
+ * `instanceof` checks work regardless of which side surfaced the failure.
414
+ */
415
+ export declare abstract class MiniappRpcError extends ReploError {
416
+ }
417
+ /** Pending request exceeded `RPC_TIMEOUT_MS` without a response. */
418
+ export declare class MiniappRpcTimeoutError extends MiniappRpcError {
419
+ }
420
+ /**
421
+ * Other side posted a `kind: "error"` envelope; `config.message` carries the
422
+ * remote-supplied detail.
423
+ */
424
+ export declare class MiniappRpcRemoteError extends MiniappRpcError {
425
+ }
426
+ /** Parent-side hook unmounted while a request was in flight. */
427
+ export declare class MiniappRpcUnmountedError extends MiniappRpcError {
428
+ }