@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.
- package/LICENSE +11 -0
- package/_vendor/replo-utils/lib/crypto.d.ts +30 -0
- package/_vendor/replo-utils/lib/errors.d.ts +83 -0
- package/_vendor/replo-utils/lib/json.d.ts +6 -0
- package/_vendor/replo-utils/lib/json.mjs +43 -0
- package/_vendor/replo-utils/lib/misc.d.ts +145 -0
- package/_vendor/replo-utils/lib/object.d.ts +31 -0
- package/_vendor/schemas/errors.d.ts +459 -0
- package/_vendor/schemas/generated/consent.d.ts +55 -0
- package/_vendor/schemas/generated/errors.d.ts +61 -0
- package/_vendor/schemas/loaderKeys.d.ts +1 -0
- package/_vendor/schemas/loaderKeys.mjs +27 -0
- package/_vendor/schemas/money.d.ts +60 -0
- package/_vendor/schemas/money.mjs +2051 -0
- package/analytics/analytics-provider.d.ts +16 -0
- package/analytics/analytics-provider.js +113 -0
- package/analytics/analytics-provider.js.map +7 -0
- package/analytics/analytics-sink.d.ts +26 -0
- package/analytics/analytics-sink.js +1 -0
- package/analytics/analytics-sink.js.map +7 -0
- package/analytics/get-analytics-sinks.d.ts +27 -0
- package/analytics/get-analytics-sinks.js +52 -0
- package/analytics/get-analytics-sinks.js.map +7 -0
- package/analytics/hooks/use-product-viewed-analytics.d.ts +23 -0
- package/analytics/hooks/use-product-viewed-analytics.js +34 -0
- package/analytics/hooks/use-product-viewed-analytics.js.map +7 -0
- package/analytics/replo-first-party-pixel.d.ts +12 -0
- package/analytics/replo-first-party-pixel.js +31 -0
- package/analytics/replo-first-party-pixel.js.map +7 -0
- package/analytics/replo-pixel-script.d.ts +13 -0
- package/analytics/replo-pixel-script.js +30 -0
- package/analytics/replo-pixel-script.js.map +7 -0
- package/analytics/sinks/ga4-sink.d.ts +15 -0
- package/analytics/sinks/ga4-sink.js +60 -0
- package/analytics/sinks/ga4-sink.js.map +7 -0
- package/analytics/sinks/meta-sink.d.ts +14 -0
- package/analytics/sinks/meta-sink.js +56 -0
- package/analytics/sinks/meta-sink.js.map +7 -0
- package/analytics/sinks/pinterest-sink.d.ts +14 -0
- package/analytics/sinks/pinterest-sink.js +76 -0
- package/analytics/sinks/pinterest-sink.js.map +7 -0
- package/analytics/sinks/reddit-sink.d.ts +14 -0
- package/analytics/sinks/reddit-sink.js +80 -0
- package/analytics/sinks/reddit-sink.js.map +7 -0
- package/analytics/sinks/replo-sink.d.ts +14 -0
- package/analytics/sinks/replo-sink.js +57 -0
- package/analytics/sinks/replo-sink.js.map +7 -0
- package/analytics/sinks/snapchat-sink.d.ts +14 -0
- package/analytics/sinks/snapchat-sink.js +67 -0
- package/analytics/sinks/snapchat-sink.js.map +7 -0
- package/analytics/sinks/tiktok-sink.d.ts +14 -0
- package/analytics/sinks/tiktok-sink.js +79 -0
- package/analytics/sinks/tiktok-sink.js.map +7 -0
- package/analytics/sinks/window-sink.d.ts +18 -0
- package/analytics/sinks/window-sink.js +46 -0
- package/analytics/sinks/window-sink.js.map +7 -0
- package/analytics/utils/analytics-utils.d.ts +7 -0
- package/analytics/utils/analytics-utils.js +130 -0
- package/analytics/utils/analytics-utils.js.map +7 -0
- package/analytics/utils/navigation-tracker.d.ts +16 -0
- package/analytics/utils/navigation-tracker.js +44 -0
- package/analytics/utils/navigation-tracker.js.map +7 -0
- package/analytics/utils/shopify-funnel-gate.d.ts +8 -0
- package/analytics/utils/shopify-funnel-gate.js +22 -0
- package/analytics/utils/shopify-funnel-gate.js.map +7 -0
- package/cart/buy-now-action.d.ts +21 -0
- package/cart/buy-now-action.js +104 -0
- package/cart/buy-now-action.js.map +7 -0
- package/cart/cart-actions.d.ts +63 -0
- package/cart/cart-actions.js +90 -0
- package/cart/cart-actions.js.map +7 -0
- package/cart/cart-loader.d.ts +9 -0
- package/cart/cart-loader.js +11 -0
- package/cart/cart-loader.js.map +7 -0
- package/cart/cart-provider.d.ts +85 -0
- package/cart/cart-provider.js +372 -0
- package/cart/cart-provider.js.map +7 -0
- package/cart/cart-schema.d.ts +74 -0
- package/cart/cart-schema.js +69 -0
- package/cart/cart-schema.js.map +7 -0
- package/cart/cart-types.d.ts +132 -0
- package/cart/cart-types.js +8 -0
- package/cart/cart-types.js.map +7 -0
- package/cart/gateways/cart-constants.d.ts +1 -0
- package/cart/gateways/cart-constants.js +5 -0
- package/cart/gateways/cart-constants.js.map +7 -0
- package/cart/gateways/cart-gateway.d.ts +10 -0
- package/cart/gateways/cart-gateway.js +19 -0
- package/cart/gateways/cart-gateway.js.map +7 -0
- package/cart/gateways/cookie-cart-gateway.d.ts +28 -0
- package/cart/gateways/cookie-cart-gateway.js +109 -0
- package/cart/gateways/cookie-cart-gateway.js.map +7 -0
- package/cart/gateways/default-cart-gateway.d.ts +19 -0
- package/cart/gateways/default-cart-gateway.js +30 -0
- package/cart/gateways/default-cart-gateway.js.map +7 -0
- package/cart/gateways/resolver-cart-gateway.d.ts +2 -0
- package/cart/gateways/resolver-cart-gateway.js +109 -0
- package/cart/gateways/resolver-cart-gateway.js.map +7 -0
- package/cart/gateways/stripe-cart-gateway.d.ts +19 -0
- package/cart/gateways/stripe-cart-gateway.js +28 -0
- package/cart/gateways/stripe-cart-gateway.js.map +7 -0
- package/cart/hooks/use-add-to-cart.d.ts +63 -0
- package/cart/hooks/use-add-to-cart.js +124 -0
- package/cart/hooks/use-add-to-cart.js.map +7 -0
- package/cart/hooks/use-buy-now.d.ts +49 -0
- package/cart/hooks/use-buy-now.js +62 -0
- package/cart/hooks/use-buy-now.js.map +7 -0
- package/cart/utils/cart-utils.d.ts +43 -0
- package/cart/utils/cart-utils.js +46 -0
- package/cart/utils/cart-utils.js.map +7 -0
- package/cart/utils/cookie-cart-persistence.d.ts +55 -0
- package/cart/utils/cookie-cart-persistence.js +166 -0
- package/cart/utils/cookie-cart-persistence.js.map +7 -0
- package/cart/utils/variant-to-cart-line.d.ts +74 -0
- package/cart/utils/variant-to-cart-line.js +162 -0
- package/cart/utils/variant-to-cart-line.js.map +7 -0
- package/chunk-UJCSKKID.mjs +27 -0
- package/consent/consent-action.d.ts +9 -0
- package/consent/consent-action.js +25 -0
- package/consent/consent-action.js.map +7 -0
- package/consent/consent-actions.d.ts +28 -0
- package/consent/consent-actions.js +36 -0
- package/consent/consent-actions.js.map +7 -0
- package/consent/consent-store.d.ts +69 -0
- package/consent/consent-store.js +194 -0
- package/consent/consent-store.js.map +7 -0
- package/consent/cookie.d.ts +36 -0
- package/consent/cookie.js +82 -0
- package/consent/cookie.js.map +7 -0
- package/consent/replo-scripts.d.ts +23 -0
- package/consent/replo-scripts.js +102 -0
- package/consent/replo-scripts.js.map +7 -0
- package/consent/script-registration-store.d.ts +25 -0
- package/consent/script-registration-store.js +61 -0
- package/consent/script-registration-store.js.map +7 -0
- package/consent/script-snippets.d.ts +24 -0
- package/consent/script-snippets.js +122 -0
- package/consent/script-snippets.js.map +7 -0
- package/consent/types.d.ts +34 -0
- package/consent/types.js +1 -0
- package/consent/types.js.map +7 -0
- package/consent/window-api.d.ts +41 -0
- package/consent/window-api.js +73 -0
- package/consent/window-api.js.map +7 -0
- package/env.d.ts +9 -0
- package/env.js +42 -0
- package/env.js.map +7 -0
- package/gateways/canopy-api.d.ts +83 -0
- package/gateways/canopy-api.js +197 -0
- package/gateways/canopy-api.js.map +7 -0
- package/hooks/use-client-value.d.ts +10 -0
- package/hooks/use-client-value.js +12 -0
- package/hooks/use-client-value.js.map +7 -0
- package/hooks/use-formatted-price.d.ts +15 -0
- package/hooks/use-formatted-price.js +20 -0
- package/hooks/use-formatted-price.js.map +7 -0
- package/lib/canopy-error.d.ts +25 -0
- package/lib/canopy-error.js +24 -0
- package/lib/canopy-error.js.map +7 -0
- package/lib/get-query-client.d.ts +2 -0
- package/lib/get-query-client.js +34 -0
- package/lib/get-query-client.js.map +7 -0
- package/lib/integration-utils.d.ts +2 -0
- package/lib/integration-utils.js +9 -0
- package/lib/integration-utils.js.map +7 -0
- package/lib/shopify-utils.d.ts +10 -0
- package/lib/shopify-utils.js +7 -0
- package/lib/shopify-utils.js.map +7 -0
- package/lib/url-utils.d.ts +4 -0
- package/lib/url-utils.js +8 -0
- package/lib/url-utils.js.map +7 -0
- package/loaders/collection-loader.d.ts +11 -0
- package/loaders/collection-loader.js +55 -0
- package/loaders/collection-loader.js.map +7 -0
- package/loaders/collection-products-loader.d.ts +12 -0
- package/loaders/collection-products-loader.js +58 -0
- package/loaders/collection-products-loader.js.map +7 -0
- package/loaders/contentful-entries-loader.d.ts +17 -0
- package/loaders/contentful-entries-loader.js +78 -0
- package/loaders/contentful-entries-loader.js.map +7 -0
- package/loaders/contentful-entry-loader.d.ts +14 -0
- package/loaders/contentful-entry-loader.js +60 -0
- package/loaders/contentful-entry-loader.js.map +7 -0
- package/loaders/invoke-loader-action.d.ts +11 -0
- package/loaders/invoke-loader-action.js +14 -0
- package/loaders/invoke-loader-action.js.map +7 -0
- package/loaders/invoke-loader-server.d.ts +18 -0
- package/loaders/invoke-loader-server.js +40 -0
- package/loaders/invoke-loader-server.js.map +7 -0
- package/loaders/invoke-loader.d.ts +16 -0
- package/loaders/invoke-loader.js +37 -0
- package/loaders/invoke-loader.js.map +7 -0
- package/loaders/levanta-product-loader.d.ts +11 -0
- package/loaders/levanta-product-loader.js +53 -0
- package/loaders/levanta-product-loader.js.map +7 -0
- package/loaders/loader-error-boundary.d.ts +25 -0
- package/loaders/loader-error-boundary.js +24 -0
- package/loaders/loader-error-boundary.js.map +7 -0
- package/loaders/loader-keys.d.ts +34 -0
- package/loaders/loader-keys.js +26 -0
- package/loaders/loader-keys.js.map +7 -0
- package/loaders/loader-schemas.d.ts +946 -0
- package/loaders/loader-schemas.js +353 -0
- package/loaders/loader-schemas.js.map +7 -0
- package/loaders/metaobject-loader.d.ts +12 -0
- package/loaders/metaobject-loader.js +54 -0
- package/loaders/metaobject-loader.js.map +7 -0
- package/loaders/metaobjects-loader.d.ts +14 -0
- package/loaders/metaobjects-loader.js +60 -0
- package/loaders/metaobjects-loader.js.map +7 -0
- package/loaders/okendo-review-aggregate-loader.d.ts +17 -0
- package/loaders/okendo-review-aggregate-loader.js +56 -0
- package/loaders/okendo-review-aggregate-loader.js.map +7 -0
- package/loaders/okendo-reviews-loader.d.ts +23 -0
- package/loaders/okendo-reviews-loader.js +54 -0
- package/loaders/okendo-reviews-loader.js.map +7 -0
- package/loaders/prefetch-loaders.d.ts +33 -0
- package/loaders/prefetch-loaders.js +46 -0
- package/loaders/prefetch-loaders.js.map +7 -0
- package/loaders/preview-placeholder.d.ts +25 -0
- package/loaders/preview-placeholder.js +222 -0
- package/loaders/preview-placeholder.js.map +7 -0
- package/loaders/product-loader-args.d.ts +21 -0
- package/loaders/product-loader-args.js +17 -0
- package/loaders/product-loader-args.js.map +7 -0
- package/loaders/product-loader.d.ts +10 -0
- package/loaders/product-loader.js +52 -0
- package/loaders/product-loader.js.map +7 -0
- package/loaders/rebuy-recommendations-loader.d.ts +165 -0
- package/loaders/rebuy-recommendations-loader.js +57 -0
- package/loaders/rebuy-recommendations-loader.js.map +7 -0
- package/loaders/reviews-io-review-aggregate-loader.d.ts +12 -0
- package/loaders/reviews-io-review-aggregate-loader.js +43 -0
- package/loaders/reviews-io-review-aggregate-loader.js.map +7 -0
- package/loaders/reviews-io-reviews-loader.d.ts +14 -0
- package/loaders/reviews-io-reviews-loader.js +65 -0
- package/loaders/reviews-io-reviews-loader.js.map +7 -0
- package/loaders/smile-earning-rules-loader.d.ts +19 -0
- package/loaders/smile-earning-rules-loader.js +44 -0
- package/loaders/smile-earning-rules-loader.js.map +7 -0
- package/loaders/smile-rewards-loader.d.ts +19 -0
- package/loaders/smile-rewards-loader.js +44 -0
- package/loaders/smile-rewards-loader.js.map +7 -0
- package/loaders/smile-vip-tiers-loader.d.ts +18 -0
- package/loaders/smile-vip-tiers-loader.js +43 -0
- package/loaders/smile-vip-tiers-loader.js.map +7 -0
- package/loaders/statsig-experiment-loader.d.ts +20 -0
- package/loaders/statsig-experiment-loader.js +81 -0
- package/loaders/statsig-experiment-loader.js.map +7 -0
- package/loaders/yotpo-review-aggregate-loader.d.ts +12 -0
- package/loaders/yotpo-review-aggregate-loader.js +50 -0
- package/loaders/yotpo-review-aggregate-loader.js.map +7 -0
- package/loaders/yotpo-reviews-loader.d.ts +14 -0
- package/loaders/yotpo-reviews-loader.js +65 -0
- package/loaders/yotpo-reviews-loader.js.map +7 -0
- package/money.d.ts +9 -0
- package/money.js +13 -0
- package/money.js.map +7 -0
- package/next/config.d.ts +4 -0
- package/next/config.js +91 -0
- package/next/config.js.map +7 -0
- package/next/image-loader.d.ts +2 -0
- package/next/image-loader.js +52 -0
- package/next/image-loader.js.map +7 -0
- package/next/open-next.d.ts +2 -0
- package/next/open-next.js +24 -0
- package/next/open-next.js.map +7 -0
- package/orders/order-status-schema.d.ts +161 -0
- package/orders/order-status-schema.js +83 -0
- package/orders/order-status-schema.js.map +7 -0
- package/orders/order-status.d.ts +11 -0
- package/orders/order-status.js +41 -0
- package/orders/order-status.js.map +7 -0
- package/package.json +216 -0
- package/providers/query-provider.d.ts +1 -0
- package/providers/query-provider.js +12 -0
- package/providers/query-provider.js.map +7 -0
- package/providers/replo-provider.d.ts +1 -0
- package/providers/replo-provider.js +22 -0
- 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>;
|