@replohq/canopy-sdk 0.12.0 → 0.13.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 (135) hide show
  1. package/_vendor/replo-utils/lib/errors.d.ts +83 -0
  2. package/_vendor/replo-utils/lib/fonts.mjs +2 -40
  3. package/_vendor/replo-utils/lib/json.mjs +1 -1
  4. package/_vendor/replo-utils/lib/misc.mjs +2 -2
  5. package/_vendor/schemas/agentTools/customIntegrations/loaders/levanta.d.ts +49 -0
  6. package/_vendor/schemas/agentTools/customIntegrations/loaders/levanta.mjs +36 -0
  7. package/_vendor/schemas/agentTools/customIntegrations/loaders/product.d.ts +340 -0
  8. package/_vendor/schemas/agentTools/customIntegrations/loaders/product.mjs +51 -0
  9. package/_vendor/schemas/agentTools/customIntegrations/loaders/yotpo.d.ts +37 -0
  10. package/_vendor/schemas/agentTools/customIntegrations/loaders/yotpo.mjs +37 -0
  11. package/{cart/cart-schema.js → _vendor/schemas/cart.mjs} +17 -26
  12. package/_vendor/schemas/designLibrary.d.ts +4 -4
  13. package/_vendor/schemas/errors.d.ts +438 -0
  14. package/_vendor/schemas/errors.mjs +932 -0
  15. package/_vendor/schemas/generated/errors.d.ts +61 -0
  16. package/_vendor/schemas/generated/selectMode.d.ts +102 -0
  17. package/{loaders/loader-keys.d.ts → _vendor/schemas/loaderKeys.d.ts} +4 -4
  18. package/{loaders/loader-keys.js → _vendor/schemas/loaderKeys.mjs} +7 -8
  19. package/_vendor/schemas/objectType.d.ts +1038 -0
  20. package/_vendor/schemas/objectType.mjs +2 -0
  21. package/_vendor/schemas/registry.d.ts +539 -0
  22. package/_vendor/schemas/sandboxFiles.d.ts +36 -0
  23. package/_vendor/schemas/savedStyles.d.ts +2 -2
  24. package/_vendor/schemas/selectMode.d.ts +471 -0
  25. package/_vendor/schemas/selectMode.mjs +120 -4
  26. package/_vendor/schemas/sellingPlan.d.ts +60 -0
  27. package/_vendor/schemas/sellingPlan.mjs +1 -0
  28. package/cart/buy-now-action.js +3 -3
  29. package/cart/buy-now-action.js.map +2 -2
  30. package/cart/cart-provider.js +2 -2
  31. package/cart/cart-provider.js.map +2 -2
  32. package/cart/cart-types.d.ts +2 -1
  33. package/cart/cart-types.js.map +2 -2
  34. package/cart/hooks/use-add-to-cart.js +1 -1
  35. package/cart/hooks/use-add-to-cart.js.map +2 -2
  36. package/cart/hooks/use-buy-now.js +2 -2
  37. package/cart/hooks/use-buy-now.js.map +2 -2
  38. package/cart/utils/variant-to-cart-line.d.ts +1 -2
  39. package/cart/utils/variant-to-cart-line.js.map +1 -1
  40. package/chunk-4XLTENDR.mjs +33 -0
  41. package/chunk-A7EUNWRQ.mjs +765 -0
  42. package/{chunk-ME5W2TJM.mjs → chunk-OCB5XQYL.mjs} +2 -2
  43. package/chunk-QFYIXADC.mjs +42 -0
  44. package/editor/LinkInterceptor.js +4 -0
  45. package/editor/LinkInterceptor.js.map +2 -2
  46. package/editor/select-mode/EditorSelection.js +74 -1
  47. package/editor/select-mode/EditorSelection.js.map +2 -2
  48. package/editor/select-mode/descriptor/elementDescriptor.d.ts +13 -2
  49. package/editor/select-mode/descriptor/elementDescriptor.js +19 -31
  50. package/editor/select-mode/descriptor/elementDescriptor.js.map +2 -2
  51. package/editor/select-mode/descriptor/styleExtraction.d.ts +3 -0
  52. package/editor/select-mode/descriptor/styleExtraction.js +271 -0
  53. package/editor/select-mode/descriptor/styleExtraction.js.map +7 -0
  54. package/editor/select-mode/displayModeStore.d.ts +10 -0
  55. package/editor/select-mode/displayModeStore.js +47 -0
  56. package/editor/select-mode/displayModeStore.js.map +7 -0
  57. package/editor/select-mode/fast-refresh-relay.d.ts +3 -0
  58. package/editor/select-mode/fast-refresh-relay.js +35 -0
  59. package/editor/select-mode/fast-refresh-relay.js.map +7 -0
  60. package/editor/select-mode/fiber.d.ts +17 -0
  61. package/editor/select-mode/fiber.js +103 -34
  62. package/editor/select-mode/fiber.js.map +2 -2
  63. package/editor/select-mode/hooks/useEditModeStateMachine.d.ts +20 -0
  64. package/editor/select-mode/hooks/useEditModeStateMachine.js +226 -0
  65. package/editor/select-mode/hooks/useEditModeStateMachine.js.map +7 -0
  66. package/editor/select-mode/hooks/useOptimisticOverrides.d.ts +20 -0
  67. package/editor/select-mode/hooks/useOptimisticOverrides.js +284 -0
  68. package/editor/select-mode/hooks/useOptimisticOverrides.js.map +7 -0
  69. package/editor/select-mode/hooks/useParentMessaging.d.ts +17 -2
  70. package/editor/select-mode/hooks/useParentMessaging.js +66 -1
  71. package/editor/select-mode/hooks/useParentMessaging.js.map +2 -2
  72. package/editor/select-mode/hooks/useSelectModeController.js +5 -6
  73. package/editor/select-mode/hooks/useSelectModeController.js.map +2 -2
  74. package/editor/select-mode/hooks/useSelectionHover.js +16 -1
  75. package/editor/select-mode/hooks/useSelectionHover.js.map +2 -2
  76. package/editor/select-mode/hooks/useSelectionInteractions.d.ts +7 -2
  77. package/editor/select-mode/hooks/useSelectionInteractions.js +57 -18
  78. package/editor/select-mode/hooks/useSelectionInteractions.js.map +2 -2
  79. package/editor/select-mode/hooks/useSiblingResolution.d.ts +6 -0
  80. package/editor/select-mode/hooks/useSiblingResolution.js +59 -0
  81. package/editor/select-mode/hooks/useSiblingResolution.js.map +7 -0
  82. package/editor/select-mode/inlineTextMarks.d.ts +6 -0
  83. package/editor/select-mode/inlineTextMarks.js +25 -0
  84. package/editor/select-mode/inlineTextMarks.js.map +7 -0
  85. package/editor/select-mode/interactions/selectionGeometry.js +4 -0
  86. package/editor/select-mode/interactions/selectionGeometry.js.map +2 -2
  87. package/editor/select-mode/selectionFrame.d.ts +5 -0
  88. package/editor/select-mode/selectionFrame.js +25 -1
  89. package/editor/select-mode/selectionFrame.js.map +2 -2
  90. package/editor/select-mode/symbolicate.js +32 -10
  91. package/editor/select-mode/symbolicate.js.map +2 -2
  92. package/editor/select-mode/tiptapInlineEditor.d.ts +23 -0
  93. package/editor/select-mode/tiptapInlineEditor.js +120 -0
  94. package/editor/select-mode/tiptapInlineEditor.js.map +7 -0
  95. package/gateways/canopy-api.d.ts +3 -3
  96. package/gateways/canopy-api.js +3 -3
  97. package/gateways/canopy-api.js.map +2 -2
  98. package/loaders/collection-loader.d.ts +1 -1
  99. package/loaders/collection-loader.js +1 -1
  100. package/loaders/collection-loader.js.map +2 -2
  101. package/loaders/collection-products-loader.d.ts +1 -1
  102. package/loaders/collection-products-loader.js +1 -1
  103. package/loaders/collection-products-loader.js.map +2 -2
  104. package/loaders/invoke-loader.d.ts +2 -2
  105. package/loaders/invoke-loader.js +2 -2
  106. package/loaders/invoke-loader.js.map +2 -2
  107. package/loaders/levanta-product-loader.d.ts +1 -1
  108. package/loaders/levanta-product-loader.js +1 -1
  109. package/loaders/levanta-product-loader.js.map +2 -2
  110. package/loaders/okendo-reviews-loader.js +1 -1
  111. package/loaders/okendo-reviews-loader.js.map +2 -2
  112. package/loaders/prefetch-loaders.d.ts +1 -1
  113. package/loaders/prefetch-loaders.js.map +1 -1
  114. package/loaders/product-loader.d.ts +1 -1
  115. package/loaders/product-loader.js +1 -1
  116. package/loaders/product-loader.js.map +2 -2
  117. package/loaders/rebuy-recommendations-loader.js +1 -1
  118. package/loaders/rebuy-recommendations-loader.js.map +2 -2
  119. package/loaders/yotpo-review-aggregate-loader.d.ts +1 -1
  120. package/loaders/yotpo-review-aggregate-loader.js +1 -1
  121. package/loaders/yotpo-review-aggregate-loader.js.map +2 -2
  122. package/loaders/yotpo-reviews-loader.d.ts +1 -1
  123. package/loaders/yotpo-reviews-loader.js +1 -1
  124. package/loaders/yotpo-reviews-loader.js.map +2 -2
  125. package/package.json +9 -1
  126. package/cart/cart-schema.js.map +0 -7
  127. package/lib/canopy-error.d.ts +0 -25
  128. package/lib/canopy-error.js +0 -24
  129. package/lib/canopy-error.js.map +0 -7
  130. package/loaders/loader-keys.js.map +0 -7
  131. package/loaders/loader-schemas.d.ts +0 -755
  132. package/loaders/loader-schemas.js +0 -257
  133. package/loaders/loader-schemas.js.map +0 -7
  134. package/{cart/cart-schema.d.ts → _vendor/schemas/cart.d.ts} +0 -0
  135. package/{chunk-NCKKAFF7.mjs → chunk-ILGEM42C.mjs} +7 -7
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+
3
+ // ../schemas/agentTools/customIntegrations/loaders/yotpo.ts
4
+ var yotpoNangoConnectionConfigSchema = z.object({
5
+ storeId: z.string().min(1)
6
+ });
7
+ var yotpoProductReviewsLoaderInputSchema = z.object({
8
+ productId: z.string().describe(
9
+ "Yotpo external product ID for the product (typically the numeric Shopify product ID)."
10
+ ),
11
+ perPage: z.number().int().min(1).max(150).optional().describe("Reviews to return (default 10, max 150)."),
12
+ page: z.number().int().min(1).optional().describe("Page number (1-indexed, default 1).")
13
+ });
14
+ var yotpoReviewLoaderItemSchema = z.object({
15
+ id: z.string(),
16
+ title: z.string().nullable(),
17
+ content: z.string().nullable(),
18
+ score: z.number().nullable(),
19
+ createdAt: z.string().nullable(),
20
+ verifiedBuyer: z.boolean(),
21
+ reviewerName: z.string().nullable()
22
+ });
23
+ var yotpoProductReviewsLoaderOutputSchema = z.object({
24
+ reviews: z.array(yotpoReviewLoaderItemSchema)
25
+ });
26
+ var yotpoProductReviewAggregateLoaderInputSchema = z.object({
27
+ productId: z.string().describe(
28
+ "Yotpo external product ID for the product (typically the numeric Shopify product ID)."
29
+ )
30
+ });
31
+ var yotpoProductReviewAggregateLoaderOutputSchema = z.object({
32
+ averageScore: z.number(),
33
+ totalReviews: z.number(),
34
+ starDistribution: z.record(z.string(), z.number())
35
+ });
36
+
37
+ export { yotpoNangoConnectionConfigSchema, yotpoProductReviewAggregateLoaderInputSchema, yotpoProductReviewAggregateLoaderOutputSchema, yotpoProductReviewsLoaderInputSchema, yotpoProductReviewsLoaderOutputSchema, yotpoReviewLoaderItemSchema };
@@ -1,20 +1,22 @@
1
- import { z } from "zod";
2
- const cartLineAttributeSchema = z.object({
1
+ import { z } from 'zod';
2
+
3
+ // ../schemas/cart.ts
4
+ var cartLineAttributeSchema = z.object({
3
5
  key: z.string(),
4
6
  value: z.union([z.string(), z.number(), z.boolean()])
5
7
  });
6
- const cartLineAttributesSchema = z.array(cartLineAttributeSchema);
7
- const cartImageSchema = z.object({
8
+ var cartLineAttributesSchema = z.array(cartLineAttributeSchema);
9
+ var cartImageSchema = z.object({
8
10
  url: z.string(),
9
11
  altText: z.string().nullable()
10
12
  });
11
- const sellingPlanPriceAdjustmentSchema = z.object({
13
+ var sellingPlanPriceAdjustmentSchema = z.object({
12
14
  compareAtPrice: z.object({ amount: z.number(), currencyCode: z.string() }),
13
15
  perDeliveryPrice: z.object({ amount: z.number(), currencyCode: z.string() }),
14
16
  price: z.object({ amount: z.number(), currencyCode: z.string() }),
15
17
  unitPrice: z.object({ amount: z.number(), currencyCode: z.string() }).nullable()
16
18
  });
17
- const sellingPlanAllocationSchema = z.object({
19
+ var sellingPlanAllocationSchema = z.object({
18
20
  sellingPlan: z.object({
19
21
  id: z.string(),
20
22
  name: z.string(),
@@ -30,7 +32,7 @@ const sellingPlanAllocationSchema = z.object({
30
32
  currencyCode: z.string()
31
33
  })
32
34
  });
33
- const cartLineMerchandiseSchema = z.object({
35
+ var cartLineMerchandiseSchema = z.object({
34
36
  id: z.string(),
35
37
  product: z.object({
36
38
  id: z.string(),
@@ -42,51 +44,40 @@ const cartLineMerchandiseSchema = z.object({
42
44
  image: cartImageSchema.nullable(),
43
45
  selectedOptions: z.array(z.object({ name: z.string(), value: z.string() }))
44
46
  });
45
- const cartLineSchema = z.object({
47
+ var cartLineSchema = z.object({
46
48
  id: z.string(),
47
49
  quantity: z.number(),
48
50
  merchandise: cartLineMerchandiseSchema,
49
51
  attributes: z.array(cartLineAttributeSchema),
50
52
  sellingPlanAllocation: sellingPlanAllocationSchema.nullish()
51
53
  });
52
- const cartCostSchema = z.object({
54
+ var cartCostSchema = z.object({
53
55
  subtotalAmount: z.number(),
54
56
  totalAmount: z.number(),
55
57
  currencyCode: z.string()
56
58
  });
57
- const cartDiscountCodeSchema = z.object({
59
+ var cartDiscountCodeSchema = z.object({
58
60
  code: z.string(),
59
61
  applicable: z.boolean()
60
62
  });
61
- const cartSchema = z.object({
63
+ var cartSchema = z.object({
62
64
  id: z.string(),
63
65
  lines: z.array(cartLineSchema),
64
66
  cost: cartCostSchema,
65
67
  checkoutUrl: z.string().optional(),
66
68
  discountCodes: z.array(cartDiscountCodeSchema).optional()
67
69
  });
68
- const addCartLinesInputSchema = z.object({
70
+ var addCartLinesInputSchema = z.object({
69
71
  merchandiseId: z.string(),
70
72
  quantity: z.number().int().positive(),
71
73
  attributes: z.array(cartLineAttributeSchema).optional(),
72
74
  sellingPlanId: z.string().nullish()
73
75
  });
74
- const updateCartLineInputSchema = z.object({
76
+ var updateCartLineInputSchema = z.object({
75
77
  lineId: z.string(),
76
78
  quantity: z.number().int().min(0),
77
79
  attributes: z.array(cartLineAttributeSchema).optional(),
78
80
  sellingPlanId: z.string().nullish()
79
81
  });
80
- export {
81
- addCartLinesInputSchema,
82
- cartCostSchema,
83
- cartDiscountCodeSchema,
84
- cartImageSchema,
85
- cartLineAttributeSchema,
86
- cartLineAttributesSchema,
87
- cartLineMerchandiseSchema,
88
- cartLineSchema,
89
- cartSchema,
90
- updateCartLineInputSchema
91
- };
92
- //# sourceMappingURL=cart-schema.js.map
82
+
83
+ export { addCartLinesInputSchema, cartCostSchema, cartDiscountCodeSchema, cartImageSchema, cartLineAttributeSchema, cartLineAttributesSchema, cartLineMerchandiseSchema, cartLineSchema, cartSchema, updateCartLineInputSchema };
@@ -57,9 +57,9 @@ export declare const savedTextStyleSchema: z.ZodObject<{
57
57
  }>>;
58
58
  textDecoration: z.ZodOptional<z.ZodEnum<{
59
59
  none: "none";
60
+ italic: "italic";
60
61
  underline: "underline";
61
62
  "line-through": "line-through";
62
- italic: "italic";
63
63
  }>>;
64
64
  textShadow: z.ZodOptional<z.ZodString>;
65
65
  textStroke: z.ZodOptional<z.ZodString>;
@@ -131,9 +131,9 @@ export declare const designLibrarySavedStylesSchema: z.ZodRecord<z.ZodString, z.
131
131
  }>>;
132
132
  textDecoration: z.ZodOptional<z.ZodEnum<{
133
133
  none: "none";
134
+ italic: "italic";
134
135
  underline: "underline";
135
136
  "line-through": "line-through";
136
- italic: "italic";
137
137
  }>>;
138
138
  textShadow: z.ZodOptional<z.ZodString>;
139
139
  textStroke: z.ZodOptional<z.ZodString>;
@@ -210,9 +210,9 @@ export declare const designLibrarySchema: z.ZodObject<{
210
210
  }>>;
211
211
  textDecoration: z.ZodOptional<z.ZodEnum<{
212
212
  none: "none";
213
+ italic: "italic";
213
214
  underline: "underline";
214
215
  "line-through": "line-through";
215
- italic: "italic";
216
216
  }>>;
217
217
  textShadow: z.ZodOptional<z.ZodString>;
218
218
  textStroke: z.ZodOptional<z.ZodString>;
@@ -287,9 +287,9 @@ export declare const designLibrarySavedStyleMetadataSchema: z.ZodObject<{
287
287
  }>>;
288
288
  textDecoration: z.ZodOptional<z.ZodEnum<{
289
289
  none: "none";
290
+ italic: "italic";
290
291
  underline: "underline";
291
292
  "line-through": "line-through";
292
- italic: "italic";
293
293
  }>>;
294
294
  textShadow: z.ZodOptional<z.ZodString>;
295
295
  textStroke: z.ZodOptional<z.ZodString>;
@@ -0,0 +1,438 @@
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
+ /**
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
+ * Errors thrown by the postMessage RPC layer between bedrock miniapp iframes
421
+ * and their agent-ui parent (see `packages/schemas/miniappRpc.ts` for the
422
+ * protocol). Both sides reject pending request promises with these so
423
+ * `instanceof` checks work regardless of which side surfaced the failure.
424
+ */
425
+ export declare abstract class MiniappRpcError extends ReploError {
426
+ }
427
+ /** Pending request exceeded `RPC_TIMEOUT_MS` without a response. */
428
+ export declare class MiniappRpcTimeoutError extends MiniappRpcError {
429
+ }
430
+ /**
431
+ * Other side posted a `kind: "error"` envelope; `config.message` carries the
432
+ * remote-supplied detail.
433
+ */
434
+ export declare class MiniappRpcRemoteError extends MiniappRpcError {
435
+ }
436
+ /** Parent-side hook unmounted while a request was in flight. */
437
+ export declare class MiniappRpcUnmountedError extends MiniappRpcError {
438
+ }