@replohq/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 (280) hide show
  1. package/LICENSE +11 -0
  2. package/_vendor/replo-utils/lib/crypto.d.ts +30 -0
  3. package/_vendor/replo-utils/lib/errors.d.ts +83 -0
  4. package/_vendor/replo-utils/lib/json.d.ts +6 -0
  5. package/_vendor/replo-utils/lib/json.mjs +43 -0
  6. package/_vendor/replo-utils/lib/misc.d.ts +145 -0
  7. package/_vendor/replo-utils/lib/object.d.ts +31 -0
  8. package/_vendor/schemas/errors.d.ts +459 -0
  9. package/_vendor/schemas/generated/consent.d.ts +55 -0
  10. package/_vendor/schemas/generated/errors.d.ts +61 -0
  11. package/_vendor/schemas/loaderKeys.d.ts +1 -0
  12. package/_vendor/schemas/loaderKeys.mjs +27 -0
  13. package/_vendor/schemas/money.d.ts +60 -0
  14. package/_vendor/schemas/money.mjs +2051 -0
  15. package/analytics/analytics-provider.d.ts +16 -0
  16. package/analytics/analytics-provider.js +113 -0
  17. package/analytics/analytics-provider.js.map +7 -0
  18. package/analytics/analytics-sink.d.ts +26 -0
  19. package/analytics/analytics-sink.js +1 -0
  20. package/analytics/analytics-sink.js.map +7 -0
  21. package/analytics/get-analytics-sinks.d.ts +27 -0
  22. package/analytics/get-analytics-sinks.js +52 -0
  23. package/analytics/get-analytics-sinks.js.map +7 -0
  24. package/analytics/hooks/use-product-viewed-analytics.d.ts +23 -0
  25. package/analytics/hooks/use-product-viewed-analytics.js +34 -0
  26. package/analytics/hooks/use-product-viewed-analytics.js.map +7 -0
  27. package/analytics/replo-first-party-pixel.d.ts +12 -0
  28. package/analytics/replo-first-party-pixel.js +31 -0
  29. package/analytics/replo-first-party-pixel.js.map +7 -0
  30. package/analytics/replo-pixel-script.d.ts +13 -0
  31. package/analytics/replo-pixel-script.js +30 -0
  32. package/analytics/replo-pixel-script.js.map +7 -0
  33. package/analytics/sinks/ga4-sink.d.ts +15 -0
  34. package/analytics/sinks/ga4-sink.js +60 -0
  35. package/analytics/sinks/ga4-sink.js.map +7 -0
  36. package/analytics/sinks/meta-sink.d.ts +14 -0
  37. package/analytics/sinks/meta-sink.js +56 -0
  38. package/analytics/sinks/meta-sink.js.map +7 -0
  39. package/analytics/sinks/pinterest-sink.d.ts +14 -0
  40. package/analytics/sinks/pinterest-sink.js +76 -0
  41. package/analytics/sinks/pinterest-sink.js.map +7 -0
  42. package/analytics/sinks/reddit-sink.d.ts +14 -0
  43. package/analytics/sinks/reddit-sink.js +80 -0
  44. package/analytics/sinks/reddit-sink.js.map +7 -0
  45. package/analytics/sinks/replo-sink.d.ts +14 -0
  46. package/analytics/sinks/replo-sink.js +57 -0
  47. package/analytics/sinks/replo-sink.js.map +7 -0
  48. package/analytics/sinks/snapchat-sink.d.ts +14 -0
  49. package/analytics/sinks/snapchat-sink.js +67 -0
  50. package/analytics/sinks/snapchat-sink.js.map +7 -0
  51. package/analytics/sinks/tiktok-sink.d.ts +14 -0
  52. package/analytics/sinks/tiktok-sink.js +79 -0
  53. package/analytics/sinks/tiktok-sink.js.map +7 -0
  54. package/analytics/sinks/window-sink.d.ts +18 -0
  55. package/analytics/sinks/window-sink.js +46 -0
  56. package/analytics/sinks/window-sink.js.map +7 -0
  57. package/analytics/utils/analytics-utils.d.ts +7 -0
  58. package/analytics/utils/analytics-utils.js +130 -0
  59. package/analytics/utils/analytics-utils.js.map +7 -0
  60. package/analytics/utils/navigation-tracker.d.ts +16 -0
  61. package/analytics/utils/navigation-tracker.js +44 -0
  62. package/analytics/utils/navigation-tracker.js.map +7 -0
  63. package/analytics/utils/shopify-funnel-gate.d.ts +8 -0
  64. package/analytics/utils/shopify-funnel-gate.js +22 -0
  65. package/analytics/utils/shopify-funnel-gate.js.map +7 -0
  66. package/cart/buy-now-action.d.ts +21 -0
  67. package/cart/buy-now-action.js +104 -0
  68. package/cart/buy-now-action.js.map +7 -0
  69. package/cart/cart-actions.d.ts +63 -0
  70. package/cart/cart-actions.js +90 -0
  71. package/cart/cart-actions.js.map +7 -0
  72. package/cart/cart-loader.d.ts +9 -0
  73. package/cart/cart-loader.js +11 -0
  74. package/cart/cart-loader.js.map +7 -0
  75. package/cart/cart-provider.d.ts +85 -0
  76. package/cart/cart-provider.js +372 -0
  77. package/cart/cart-provider.js.map +7 -0
  78. package/cart/cart-schema.d.ts +74 -0
  79. package/cart/cart-schema.js +69 -0
  80. package/cart/cart-schema.js.map +7 -0
  81. package/cart/cart-types.d.ts +132 -0
  82. package/cart/cart-types.js +8 -0
  83. package/cart/cart-types.js.map +7 -0
  84. package/cart/gateways/cart-constants.d.ts +1 -0
  85. package/cart/gateways/cart-constants.js +5 -0
  86. package/cart/gateways/cart-constants.js.map +7 -0
  87. package/cart/gateways/cart-gateway.d.ts +10 -0
  88. package/cart/gateways/cart-gateway.js +19 -0
  89. package/cart/gateways/cart-gateway.js.map +7 -0
  90. package/cart/gateways/cookie-cart-gateway.d.ts +28 -0
  91. package/cart/gateways/cookie-cart-gateway.js +109 -0
  92. package/cart/gateways/cookie-cart-gateway.js.map +7 -0
  93. package/cart/gateways/default-cart-gateway.d.ts +19 -0
  94. package/cart/gateways/default-cart-gateway.js +30 -0
  95. package/cart/gateways/default-cart-gateway.js.map +7 -0
  96. package/cart/gateways/resolver-cart-gateway.d.ts +2 -0
  97. package/cart/gateways/resolver-cart-gateway.js +109 -0
  98. package/cart/gateways/resolver-cart-gateway.js.map +7 -0
  99. package/cart/gateways/stripe-cart-gateway.d.ts +19 -0
  100. package/cart/gateways/stripe-cart-gateway.js +28 -0
  101. package/cart/gateways/stripe-cart-gateway.js.map +7 -0
  102. package/cart/hooks/use-add-to-cart.d.ts +63 -0
  103. package/cart/hooks/use-add-to-cart.js +124 -0
  104. package/cart/hooks/use-add-to-cart.js.map +7 -0
  105. package/cart/hooks/use-buy-now.d.ts +49 -0
  106. package/cart/hooks/use-buy-now.js +62 -0
  107. package/cart/hooks/use-buy-now.js.map +7 -0
  108. package/cart/utils/cart-utils.d.ts +43 -0
  109. package/cart/utils/cart-utils.js +46 -0
  110. package/cart/utils/cart-utils.js.map +7 -0
  111. package/cart/utils/cookie-cart-persistence.d.ts +55 -0
  112. package/cart/utils/cookie-cart-persistence.js +166 -0
  113. package/cart/utils/cookie-cart-persistence.js.map +7 -0
  114. package/cart/utils/variant-to-cart-line.d.ts +74 -0
  115. package/cart/utils/variant-to-cart-line.js +162 -0
  116. package/cart/utils/variant-to-cart-line.js.map +7 -0
  117. package/chunk-UJCSKKID.mjs +27 -0
  118. package/consent/consent-action.d.ts +9 -0
  119. package/consent/consent-action.js +25 -0
  120. package/consent/consent-action.js.map +7 -0
  121. package/consent/consent-actions.d.ts +28 -0
  122. package/consent/consent-actions.js +36 -0
  123. package/consent/consent-actions.js.map +7 -0
  124. package/consent/consent-store.d.ts +69 -0
  125. package/consent/consent-store.js +194 -0
  126. package/consent/consent-store.js.map +7 -0
  127. package/consent/cookie.d.ts +36 -0
  128. package/consent/cookie.js +82 -0
  129. package/consent/cookie.js.map +7 -0
  130. package/consent/replo-scripts.d.ts +23 -0
  131. package/consent/replo-scripts.js +102 -0
  132. package/consent/replo-scripts.js.map +7 -0
  133. package/consent/script-registration-store.d.ts +25 -0
  134. package/consent/script-registration-store.js +61 -0
  135. package/consent/script-registration-store.js.map +7 -0
  136. package/consent/script-snippets.d.ts +24 -0
  137. package/consent/script-snippets.js +122 -0
  138. package/consent/script-snippets.js.map +7 -0
  139. package/consent/types.d.ts +34 -0
  140. package/consent/types.js +1 -0
  141. package/consent/types.js.map +7 -0
  142. package/consent/window-api.d.ts +41 -0
  143. package/consent/window-api.js +73 -0
  144. package/consent/window-api.js.map +7 -0
  145. package/env.d.ts +9 -0
  146. package/env.js +42 -0
  147. package/env.js.map +7 -0
  148. package/gateways/canopy-api.d.ts +83 -0
  149. package/gateways/canopy-api.js +197 -0
  150. package/gateways/canopy-api.js.map +7 -0
  151. package/hooks/use-client-value.d.ts +10 -0
  152. package/hooks/use-client-value.js +12 -0
  153. package/hooks/use-client-value.js.map +7 -0
  154. package/hooks/use-formatted-price.d.ts +15 -0
  155. package/hooks/use-formatted-price.js +20 -0
  156. package/hooks/use-formatted-price.js.map +7 -0
  157. package/lib/canopy-error.d.ts +25 -0
  158. package/lib/canopy-error.js +24 -0
  159. package/lib/canopy-error.js.map +7 -0
  160. package/lib/get-query-client.d.ts +2 -0
  161. package/lib/get-query-client.js +34 -0
  162. package/lib/get-query-client.js.map +7 -0
  163. package/lib/integration-utils.d.ts +2 -0
  164. package/lib/integration-utils.js +9 -0
  165. package/lib/integration-utils.js.map +7 -0
  166. package/lib/shopify-utils.d.ts +10 -0
  167. package/lib/shopify-utils.js +7 -0
  168. package/lib/shopify-utils.js.map +7 -0
  169. package/lib/url-utils.d.ts +4 -0
  170. package/lib/url-utils.js +8 -0
  171. package/lib/url-utils.js.map +7 -0
  172. package/loaders/collection-loader.d.ts +11 -0
  173. package/loaders/collection-loader.js +55 -0
  174. package/loaders/collection-loader.js.map +7 -0
  175. package/loaders/collection-products-loader.d.ts +12 -0
  176. package/loaders/collection-products-loader.js +58 -0
  177. package/loaders/collection-products-loader.js.map +7 -0
  178. package/loaders/contentful-entries-loader.d.ts +17 -0
  179. package/loaders/contentful-entries-loader.js +78 -0
  180. package/loaders/contentful-entries-loader.js.map +7 -0
  181. package/loaders/contentful-entry-loader.d.ts +14 -0
  182. package/loaders/contentful-entry-loader.js +60 -0
  183. package/loaders/contentful-entry-loader.js.map +7 -0
  184. package/loaders/invoke-loader-action.d.ts +11 -0
  185. package/loaders/invoke-loader-action.js +14 -0
  186. package/loaders/invoke-loader-action.js.map +7 -0
  187. package/loaders/invoke-loader-server.d.ts +18 -0
  188. package/loaders/invoke-loader-server.js +40 -0
  189. package/loaders/invoke-loader-server.js.map +7 -0
  190. package/loaders/invoke-loader.d.ts +16 -0
  191. package/loaders/invoke-loader.js +37 -0
  192. package/loaders/invoke-loader.js.map +7 -0
  193. package/loaders/levanta-product-loader.d.ts +11 -0
  194. package/loaders/levanta-product-loader.js +53 -0
  195. package/loaders/levanta-product-loader.js.map +7 -0
  196. package/loaders/loader-error-boundary.d.ts +25 -0
  197. package/loaders/loader-error-boundary.js +24 -0
  198. package/loaders/loader-error-boundary.js.map +7 -0
  199. package/loaders/loader-keys.d.ts +34 -0
  200. package/loaders/loader-keys.js +26 -0
  201. package/loaders/loader-keys.js.map +7 -0
  202. package/loaders/loader-schemas.d.ts +946 -0
  203. package/loaders/loader-schemas.js +353 -0
  204. package/loaders/loader-schemas.js.map +7 -0
  205. package/loaders/metaobject-loader.d.ts +12 -0
  206. package/loaders/metaobject-loader.js +54 -0
  207. package/loaders/metaobject-loader.js.map +7 -0
  208. package/loaders/metaobjects-loader.d.ts +14 -0
  209. package/loaders/metaobjects-loader.js +60 -0
  210. package/loaders/metaobjects-loader.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/preview-placeholder.d.ts +25 -0
  221. package/loaders/preview-placeholder.js +222 -0
  222. package/loaders/preview-placeholder.js.map +7 -0
  223. package/loaders/product-loader-args.d.ts +21 -0
  224. package/loaders/product-loader-args.js +17 -0
  225. package/loaders/product-loader-args.js.map +7 -0
  226. package/loaders/product-loader.d.ts +10 -0
  227. package/loaders/product-loader.js +52 -0
  228. package/loaders/product-loader.js.map +7 -0
  229. package/loaders/rebuy-recommendations-loader.d.ts +165 -0
  230. package/loaders/rebuy-recommendations-loader.js +57 -0
  231. package/loaders/rebuy-recommendations-loader.js.map +7 -0
  232. package/loaders/reviews-io-review-aggregate-loader.d.ts +12 -0
  233. package/loaders/reviews-io-review-aggregate-loader.js +43 -0
  234. package/loaders/reviews-io-review-aggregate-loader.js.map +7 -0
  235. package/loaders/reviews-io-reviews-loader.d.ts +14 -0
  236. package/loaders/reviews-io-reviews-loader.js +65 -0
  237. package/loaders/reviews-io-reviews-loader.js.map +7 -0
  238. package/loaders/smile-earning-rules-loader.d.ts +19 -0
  239. package/loaders/smile-earning-rules-loader.js +44 -0
  240. package/loaders/smile-earning-rules-loader.js.map +7 -0
  241. package/loaders/smile-rewards-loader.d.ts +19 -0
  242. package/loaders/smile-rewards-loader.js +44 -0
  243. package/loaders/smile-rewards-loader.js.map +7 -0
  244. package/loaders/smile-vip-tiers-loader.d.ts +18 -0
  245. package/loaders/smile-vip-tiers-loader.js +43 -0
  246. package/loaders/smile-vip-tiers-loader.js.map +7 -0
  247. package/loaders/statsig-experiment-loader.d.ts +20 -0
  248. package/loaders/statsig-experiment-loader.js +81 -0
  249. package/loaders/statsig-experiment-loader.js.map +7 -0
  250. package/loaders/yotpo-review-aggregate-loader.d.ts +12 -0
  251. package/loaders/yotpo-review-aggregate-loader.js +50 -0
  252. package/loaders/yotpo-review-aggregate-loader.js.map +7 -0
  253. package/loaders/yotpo-reviews-loader.d.ts +14 -0
  254. package/loaders/yotpo-reviews-loader.js +65 -0
  255. package/loaders/yotpo-reviews-loader.js.map +7 -0
  256. package/money.d.ts +9 -0
  257. package/money.js +13 -0
  258. package/money.js.map +7 -0
  259. package/next/config.d.ts +4 -0
  260. package/next/config.js +91 -0
  261. package/next/config.js.map +7 -0
  262. package/next/image-loader.d.ts +2 -0
  263. package/next/image-loader.js +52 -0
  264. package/next/image-loader.js.map +7 -0
  265. package/next/open-next.d.ts +2 -0
  266. package/next/open-next.js +24 -0
  267. package/next/open-next.js.map +7 -0
  268. package/orders/order-status-schema.d.ts +161 -0
  269. package/orders/order-status-schema.js +83 -0
  270. package/orders/order-status-schema.js.map +7 -0
  271. package/orders/order-status.d.ts +11 -0
  272. package/orders/order-status.js +41 -0
  273. package/orders/order-status.js.map +7 -0
  274. package/package.json +216 -0
  275. package/providers/query-provider.d.ts +1 -0
  276. package/providers/query-provider.js +12 -0
  277. package/providers/query-provider.js.map +7 -0
  278. package/providers/replo-provider.d.ts +1 -0
  279. package/providers/replo-provider.js +22 -0
  280. package/providers/replo-provider.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,55 @@
1
+ export type ReploScriptType = "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "Hotjar" | "MicrosoftClarity" | "Segment" | "Northbeam" | "snippet" | "custom";
2
+ export type ConsentCategory = "necessary" | "analytics" | "marketing" | "preferences" | "sale_of_data";
3
+ export type ConsentMode = "off" | "simple" | "per-category";
4
+ export type ScriptTagDescriptor = {
5
+ kind: "external";
6
+ src: string;
7
+ attributes?: {
8
+ [x: string]: string;
9
+ };
10
+ } | {
11
+ kind: "inline";
12
+ body: string;
13
+ };
14
+ export type ReploScriptEntry = {
15
+ type: "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "Hotjar" | "MicrosoftClarity" | "Segment" | "Northbeam";
16
+ identifier: string;
17
+ requiredConsent?: ConsentCategory[];
18
+ } | {
19
+ type: "snippet";
20
+ id: string;
21
+ body: string;
22
+ requiredConsent: ConsentCategory[];
23
+ } | {
24
+ type: "custom";
25
+ id: string;
26
+ requiredConsent: ConsentCategory[];
27
+ src?: string;
28
+ body?: string;
29
+ };
30
+ export type ConsentAction = "accept" | "reject" | "update" | "withdraw";
31
+ export type ConsentRecordRequest = {
32
+ consentId: string;
33
+ projectId: string;
34
+ decidedAt: number;
35
+ action: ConsentAction;
36
+ categories: {
37
+ [x: string]: boolean;
38
+ };
39
+ consentMode: ConsentMode;
40
+ policyVersion: number;
41
+ };
42
+ export type ConsentEventMessage = {
43
+ consentId: string;
44
+ projectId: string;
45
+ decidedAt: number;
46
+ action: ConsentAction;
47
+ categories: {
48
+ [x: string]: boolean;
49
+ };
50
+ consentMode: ConsentMode;
51
+ policyVersion: number;
52
+ useragent: string;
53
+ referrer: string;
54
+ ipCountry: string;
55
+ };
@@ -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 @@
1
+ export * from "../../loaders/loader-keys";
@@ -0,0 +1,27 @@
1
+ import '../../chunk-UJCSKKID.mjs';
2
+
3
+ // loaders/loader-keys.ts
4
+ var DATA_LOADER_KEYS = {
5
+ SHOPIFY_PRODUCT: "shopify_storefront.product",
6
+ SHOPIFY_COLLECTION: "shopify_storefront.collection",
7
+ SHOPIFY_COLLECTION_PRODUCTS: "shopify_storefront.collection_products",
8
+ SHOPIFY_METAOBJECT: "shopify_storefront.metaobject",
9
+ SHOPIFY_METAOBJECTS: "shopify_storefront.metaobjects",
10
+ REPLO_PRODUCT: "replo_products.product",
11
+ OKENDO_PRODUCT_REVIEWS: "okendo.product_reviews",
12
+ OKENDO_PRODUCT_REVIEW_AGGREGATE: "okendo.product_review_aggregate",
13
+ REBUY_RECOMMENDATIONS: "rebuy.recommendations",
14
+ LEVANTA_PRODUCT: "levanta_products.product",
15
+ SMILE_IO_VIP_TIERS: "smile_io.vip_tiers",
16
+ SMILE_IO_EARNING_RULES: "smile_io.earning_rules",
17
+ SMILE_IO_REWARDS: "smile_io.rewards",
18
+ YOTPO_PRODUCT_REVIEWS: "yotpo.product_reviews",
19
+ YOTPO_PRODUCT_REVIEW_AGGREGATE: "yotpo.product_review_aggregate",
20
+ REVIEWS_IO_PRODUCT_REVIEWS: "reviews_io.product_reviews",
21
+ REVIEWS_IO_PRODUCT_REVIEW_AGGREGATE: "reviews_io.product_review_aggregate",
22
+ STATSIG_EXPERIMENT: "statsig.experiment",
23
+ CONTENTFUL_ENTRY: "contentful.entry",
24
+ CONTENTFUL_ENTRIES: "contentful.entries"
25
+ };
26
+
27
+ export { DATA_LOADER_KEYS };
@@ -0,0 +1,60 @@
1
+ import { z } from "zod";
2
+ import { ReploError } from "./errors";
3
+ export declare class InvalidAmountError extends ReploError {
4
+ }
5
+ export declare class UnsupportedCurrencyError extends ReploError {
6
+ }
7
+ /**
8
+ * Converts a decimal major-unit amount (e.g. "19.99", 19.99) into integer
9
+ * minor units (1999) using the currency's Stripe exponent. Half-away-from-zero
10
+ * rounding for the non-negative amounts this domain uses (prices, totals),
11
+ * matching Stripe. Throws on non-numeric input.
12
+ */
13
+ export declare function fromMajorUnitsToMinorUnits({ amount, currencyCode, }: {
14
+ amount: number | string;
15
+ currencyCode: string;
16
+ }): number;
17
+ /**
18
+ * NOTE (Max, 2026-08-03): safe companion to fromMajorUnitsToMinorUnits for
19
+ * possibly-blank or user/CSV/provider-entered decimal strings — returns null
20
+ * for blank or non-numeric input instead of throwing. Callers with a
21
+ * source-specific cleaning or validation policy sanitize first, then convert
22
+ * here, so every "decimal string → minor units" path shares one converter.
23
+ */
24
+ export declare function parseDecimalToMinorUnits({ value, currencyCode, }: {
25
+ value: string | null;
26
+ currencyCode: string;
27
+ }): number | null;
28
+ /**
29
+ * Converts integer minor units (1999) back into a decimal major-unit number
30
+ * (19.99). Only for true decimal boundaries: display, analytics events, and
31
+ * third-party APIs that speak major units.
32
+ */
33
+ export declare function fromMinorUnitsToMajorUnits({ amount, currencyCode, }: {
34
+ amount: number;
35
+ currencyCode: string;
36
+ }): number;
37
+ /**
38
+ * Renders integer minor units as a plain decimal string for providers that
39
+ * speak decimal money (e.g. Printful retail_price): 1999 -> "19.99" (USD),
40
+ * "1999" (JPY), "1.999" (KWD).
41
+ */
42
+ export declare function fromMinorUnitsToMajorUnitsString({ amount, currencyCode, }: {
43
+ amount: number;
44
+ currencyCode: string;
45
+ }): string;
46
+ /**
47
+ * Formats integer minor units for display, e.g. 1999 -> "$19.99" (USD),
48
+ * "¥1,999" (JPY).
49
+ */
50
+ export declare function formatAmount({ amount, currencyCode, locale, }: {
51
+ amount: number;
52
+ currencyCode: string;
53
+ locale?: string;
54
+ }): string;
55
+ export declare const amountSchema: z.ZodNumber;
56
+ /** An amount in minor units paired with its ISO 4217 currency code. */
57
+ export declare const amountWithCurrencyCodeSchema: z.ZodObject<{
58
+ amount: z.ZodNumber;
59
+ currencyCode: z.ZodString;
60
+ }, z.core.$strip>;