@replohq/sdk 1.11.1 → 1.12.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/cart/cart-loader.js +1 -1
- package/cart/gateways/cart-constants.js +1 -1
- package/content.js +2 -2
- package/env.js +1 -1
- package/gateways/canopy-api.js +2 -2
- package/lib/buildMetadata.js +3 -3
- package/loaders/loader-error-boundary.js +2 -2
- package/loaders/loader-error-details.js +1 -1
- package/loaders/loader-schemas.d.ts +77 -0
- package/loaders/loader-schemas.js +11 -1
- package/loaders/preview-placeholder.js +1 -1
- package/loaders/rebuy-recommendations-loader.d.ts +11 -0
- package/next/image-loader.js +1 -1
- package/package.json +4 -4
package/cart/cart-loader.js
CHANGED
|
@@ -8,7 +8,7 @@ async function CartLoader({
|
|
|
8
8
|
country,
|
|
9
9
|
shouldReconcileSuppliedCart
|
|
10
10
|
}) {
|
|
11
|
-
const cart =
|
|
11
|
+
const cart = process.env.NODE_ENV === "development" ? null : await getCartAction().catch((error) => {
|
|
12
12
|
unstable_rethrow(error);
|
|
13
13
|
console.warn("[Replo] Failed to load cart:", error);
|
|
14
14
|
return null;
|
package/content.js
CHANGED
|
@@ -370,7 +370,7 @@ async function getEntryListingStatus({
|
|
|
370
370
|
slug,
|
|
371
371
|
contentSource
|
|
372
372
|
}) {
|
|
373
|
-
if (
|
|
373
|
+
if (process.env.NODE_ENV !== "development") {
|
|
374
374
|
return "published";
|
|
375
375
|
}
|
|
376
376
|
const [draft, publishedCopy] = await Promise.all([
|
|
@@ -445,7 +445,7 @@ async function readVisibleEntry({
|
|
|
445
445
|
if (getContentEntryFieldValidationIssues({
|
|
446
446
|
fields: collectionSchema.fields,
|
|
447
447
|
values,
|
|
448
|
-
requireRequiredFields:
|
|
448
|
+
requireRequiredFields: process.env.NODE_ENV !== "development"
|
|
449
449
|
}).length > 0) {
|
|
450
450
|
return null;
|
|
451
451
|
}
|
package/env.js
CHANGED
|
@@ -13,7 +13,7 @@ const wranglerConfigSchema = z.object({ vars: envSchema });
|
|
|
13
13
|
class MissingWranglerConfigError extends CanopyError {
|
|
14
14
|
}
|
|
15
15
|
const isDeployedWorker = () => {
|
|
16
|
-
return process.env.BUILD_ENV !== "build" && process.env.NEXT_PHASE !== "phase-production-build";
|
|
16
|
+
return process.env.NODE_ENV === "production" && process.env.BUILD_ENV !== "build" && process.env.NEXT_PHASE !== "phase-production-build";
|
|
17
17
|
};
|
|
18
18
|
const getEnv = async () => {
|
|
19
19
|
if (isDeployedWorker()) {
|
package/gateways/canopy-api.js
CHANGED
|
@@ -78,7 +78,7 @@ class CanopyApiGateway {
|
|
|
78
78
|
});
|
|
79
79
|
} catch (error) {
|
|
80
80
|
let message = `Failed to POST to canopy-api at ${url}: ${error}`;
|
|
81
|
-
if (
|
|
81
|
+
if (process.env.NODE_ENV !== "production") {
|
|
82
82
|
message += `
|
|
83
83
|
|
|
84
84
|
apiHost: ${this.apiHost}
|
|
@@ -98,7 +98,7 @@ If you're running locally, make sure the canopy-api cloudflare worker is running
|
|
|
98
98
|
return await fetch(url, { signal: abortController.signal });
|
|
99
99
|
} catch (error) {
|
|
100
100
|
let message = `Failed to GET from canopy-api at ${url}: ${error}`;
|
|
101
|
-
if (
|
|
101
|
+
if (process.env.NODE_ENV !== "production") {
|
|
102
102
|
message += `
|
|
103
103
|
|
|
104
104
|
apiHost: ${this.apiHost}
|
package/lib/buildMetadata.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const BUILD_METADATA = {
|
|
2
2
|
"packageName": "@replohq/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"branch": "HEAD",
|
|
5
|
-
"commit": "
|
|
6
|
-
"builtAt": "2026-09-
|
|
5
|
+
"commit": "3d57d078085b1361b40fd9feb54651a1fca5a985",
|
|
6
|
+
"builtAt": "2026-09-22T02:12:30.362Z"
|
|
7
7
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
const LoaderErrorDetailsContext = React.createContext(false);
|
|
5
5
|
function LoaderErrorDetailsProvider({
|
|
@@ -52,7 +52,7 @@ class LoaderErrorBoundary extends React.Component {
|
|
|
52
52
|
if (!this.state.hasError) {
|
|
53
53
|
return this.props.children;
|
|
54
54
|
}
|
|
55
|
-
if (
|
|
55
|
+
if (process.env.NODE_ENV !== "production" && this.context) {
|
|
56
56
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
57
|
this.props.fallback,
|
|
58
58
|
/* @__PURE__ */ jsx(LoaderErrorDetails, { error: this.state.error })
|
|
@@ -128,6 +128,17 @@ export declare const metafieldSchema: z.ZodObject<{
|
|
|
128
128
|
namespace: z.ZodString;
|
|
129
129
|
type: z.ZodString;
|
|
130
130
|
value: z.ZodString;
|
|
131
|
+
reference: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
132
|
+
kind: z.ZodLiteral<"image">;
|
|
133
|
+
url: z.ZodNullable<z.ZodString>;
|
|
134
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
135
|
+
kind: z.ZodLiteral<"file">;
|
|
136
|
+
url: z.ZodNullable<z.ZodString>;
|
|
137
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
138
|
+
kind: z.ZodLiteral<"video">;
|
|
139
|
+
url: z.ZodNullable<z.ZodString>;
|
|
140
|
+
previewUrl: z.ZodNullable<z.ZodString>;
|
|
141
|
+
}, z.core.$strip>], "kind">>>;
|
|
131
142
|
}, z.core.$strip>;
|
|
132
143
|
export declare const sellingPlanPriceAdjustmentSchema: z.ZodObject<{
|
|
133
144
|
value: z.ZodNumber;
|
|
@@ -365,6 +376,17 @@ export declare const productSchema: z.ZodObject<{
|
|
|
365
376
|
namespace: z.ZodString;
|
|
366
377
|
type: z.ZodString;
|
|
367
378
|
value: z.ZodString;
|
|
379
|
+
reference: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
380
|
+
kind: z.ZodLiteral<"image">;
|
|
381
|
+
url: z.ZodNullable<z.ZodString>;
|
|
382
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
383
|
+
kind: z.ZodLiteral<"file">;
|
|
384
|
+
url: z.ZodNullable<z.ZodString>;
|
|
385
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
386
|
+
kind: z.ZodLiteral<"video">;
|
|
387
|
+
url: z.ZodNullable<z.ZodString>;
|
|
388
|
+
previewUrl: z.ZodNullable<z.ZodString>;
|
|
389
|
+
}, z.core.$strip>], "kind">>>;
|
|
368
390
|
}, z.core.$strip>>>;
|
|
369
391
|
}, z.core.$strip>;
|
|
370
392
|
export type Product = z.infer<typeof productSchema>;
|
|
@@ -408,6 +430,17 @@ export declare const fullVariantSchema: z.ZodObject<{
|
|
|
408
430
|
namespace: z.ZodString;
|
|
409
431
|
type: z.ZodString;
|
|
410
432
|
value: z.ZodString;
|
|
433
|
+
reference: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
434
|
+
kind: z.ZodLiteral<"image">;
|
|
435
|
+
url: z.ZodNullable<z.ZodString>;
|
|
436
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
437
|
+
kind: z.ZodLiteral<"file">;
|
|
438
|
+
url: z.ZodNullable<z.ZodString>;
|
|
439
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
440
|
+
kind: z.ZodLiteral<"video">;
|
|
441
|
+
url: z.ZodNullable<z.ZodString>;
|
|
442
|
+
previewUrl: z.ZodNullable<z.ZodString>;
|
|
443
|
+
}, z.core.$strip>], "kind">>>;
|
|
411
444
|
}, z.core.$strip>>>;
|
|
412
445
|
}, z.core.$strip>;
|
|
413
446
|
export declare const fullProductSchema: z.ZodObject<{
|
|
@@ -466,6 +499,17 @@ export declare const fullProductSchema: z.ZodObject<{
|
|
|
466
499
|
namespace: z.ZodString;
|
|
467
500
|
type: z.ZodString;
|
|
468
501
|
value: z.ZodString;
|
|
502
|
+
reference: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
503
|
+
kind: z.ZodLiteral<"image">;
|
|
504
|
+
url: z.ZodNullable<z.ZodString>;
|
|
505
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
506
|
+
kind: z.ZodLiteral<"file">;
|
|
507
|
+
url: z.ZodNullable<z.ZodString>;
|
|
508
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
509
|
+
kind: z.ZodLiteral<"video">;
|
|
510
|
+
url: z.ZodNullable<z.ZodString>;
|
|
511
|
+
previewUrl: z.ZodNullable<z.ZodString>;
|
|
512
|
+
}, z.core.$strip>], "kind">>>;
|
|
469
513
|
}, z.core.$strip>>>;
|
|
470
514
|
}, z.core.$strip>>;
|
|
471
515
|
images: z.ZodArray<z.ZodObject<{
|
|
@@ -544,6 +588,17 @@ export declare const fullProductSchema: z.ZodObject<{
|
|
|
544
588
|
namespace: z.ZodString;
|
|
545
589
|
type: z.ZodString;
|
|
546
590
|
value: z.ZodString;
|
|
591
|
+
reference: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
592
|
+
kind: z.ZodLiteral<"image">;
|
|
593
|
+
url: z.ZodNullable<z.ZodString>;
|
|
594
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
595
|
+
kind: z.ZodLiteral<"file">;
|
|
596
|
+
url: z.ZodNullable<z.ZodString>;
|
|
597
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
598
|
+
kind: z.ZodLiteral<"video">;
|
|
599
|
+
url: z.ZodNullable<z.ZodString>;
|
|
600
|
+
previewUrl: z.ZodNullable<z.ZodString>;
|
|
601
|
+
}, z.core.$strip>], "kind">>>;
|
|
547
602
|
}, z.core.$strip>>;
|
|
548
603
|
}, z.core.$strip>;
|
|
549
604
|
export declare const fullCollectionSchema: z.ZodObject<{
|
|
@@ -562,6 +617,17 @@ export declare const fullCollectionSchema: z.ZodObject<{
|
|
|
562
617
|
namespace: z.ZodString;
|
|
563
618
|
type: z.ZodString;
|
|
564
619
|
value: z.ZodString;
|
|
620
|
+
reference: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
621
|
+
kind: z.ZodLiteral<"image">;
|
|
622
|
+
url: z.ZodNullable<z.ZodString>;
|
|
623
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
624
|
+
kind: z.ZodLiteral<"file">;
|
|
625
|
+
url: z.ZodNullable<z.ZodString>;
|
|
626
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
627
|
+
kind: z.ZodLiteral<"video">;
|
|
628
|
+
url: z.ZodNullable<z.ZodString>;
|
|
629
|
+
previewUrl: z.ZodNullable<z.ZodString>;
|
|
630
|
+
}, z.core.$strip>], "kind">>>;
|
|
565
631
|
}, z.core.$strip>>>;
|
|
566
632
|
}, z.core.$strip>;
|
|
567
633
|
export declare const paginatedProductsSchema: z.ZodObject<{
|
|
@@ -715,6 +781,17 @@ export declare const paginatedProductsSchema: z.ZodObject<{
|
|
|
715
781
|
namespace: z.ZodString;
|
|
716
782
|
type: z.ZodString;
|
|
717
783
|
value: z.ZodString;
|
|
784
|
+
reference: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
785
|
+
kind: z.ZodLiteral<"image">;
|
|
786
|
+
url: z.ZodNullable<z.ZodString>;
|
|
787
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
788
|
+
kind: z.ZodLiteral<"file">;
|
|
789
|
+
url: z.ZodNullable<z.ZodString>;
|
|
790
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
791
|
+
kind: z.ZodLiteral<"video">;
|
|
792
|
+
url: z.ZodNullable<z.ZodString>;
|
|
793
|
+
previewUrl: z.ZodNullable<z.ZodString>;
|
|
794
|
+
}, z.core.$strip>], "kind">>>;
|
|
718
795
|
}, z.core.$strip>>>;
|
|
719
796
|
}, z.core.$strip>>;
|
|
720
797
|
pageInfo: z.ZodObject<{
|
|
@@ -67,11 +67,21 @@ const productOptionSchema = z.object({
|
|
|
67
67
|
values: z.array(z.string()),
|
|
68
68
|
optionValues: z.array(optionValueSchema).optional()
|
|
69
69
|
});
|
|
70
|
+
const metafieldReferenceSchema = z.discriminatedUnion("kind", [
|
|
71
|
+
z.object({ kind: z.literal("image"), url: z.string().nullable() }),
|
|
72
|
+
z.object({ kind: z.literal("file"), url: z.string().nullable() }),
|
|
73
|
+
z.object({
|
|
74
|
+
kind: z.literal("video"),
|
|
75
|
+
url: z.string().nullable(),
|
|
76
|
+
previewUrl: z.string().nullable()
|
|
77
|
+
})
|
|
78
|
+
]);
|
|
70
79
|
const metafieldSchema = z.object({
|
|
71
80
|
key: z.string(),
|
|
72
81
|
namespace: z.string(),
|
|
73
82
|
type: z.string(),
|
|
74
|
-
value: z.string()
|
|
83
|
+
value: z.string(),
|
|
84
|
+
reference: metafieldReferenceSchema.nullish()
|
|
75
85
|
});
|
|
76
86
|
const sellingPlanPriceAdjustmentSchema = z.object({
|
|
77
87
|
value: z.number(),
|
|
@@ -180,7 +180,7 @@ function resolvePreviewPlaceholderData({
|
|
|
180
180
|
return null;
|
|
181
181
|
}
|
|
182
182
|
if (typeof window === "undefined") {
|
|
183
|
-
return
|
|
183
|
+
return process.env.NODE_ENV === "development" ? placeholderData : null;
|
|
184
184
|
}
|
|
185
185
|
return window.parent === window ? null : placeholderData;
|
|
186
186
|
}
|
|
@@ -151,6 +151,17 @@ declare const rebuyRecommendationsOutputSchema: z.ZodObject<{
|
|
|
151
151
|
namespace: z.ZodString;
|
|
152
152
|
type: z.ZodString;
|
|
153
153
|
value: z.ZodString;
|
|
154
|
+
reference: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
155
|
+
kind: z.ZodLiteral<"image">;
|
|
156
|
+
url: z.ZodNullable<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
158
|
+
kind: z.ZodLiteral<"file">;
|
|
159
|
+
url: z.ZodNullable<z.ZodString>;
|
|
160
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
+
kind: z.ZodLiteral<"video">;
|
|
162
|
+
url: z.ZodNullable<z.ZodString>;
|
|
163
|
+
previewUrl: z.ZodNullable<z.ZodString>;
|
|
164
|
+
}, z.core.$strip>], "kind">>>;
|
|
154
165
|
}, z.core.$strip>>>;
|
|
155
166
|
}, z.core.$strip>>;
|
|
156
167
|
}, z.core.$strip>;
|
package/next/image-loader.js
CHANGED
|
@@ -20,7 +20,7 @@ function cloudflareLoader({
|
|
|
20
20
|
width,
|
|
21
21
|
quality
|
|
22
22
|
}) {
|
|
23
|
-
const isDevelopment =
|
|
23
|
+
const isDevelopment = process.env.NODE_ENV === "development";
|
|
24
24
|
const params = [`width=${width}`, `quality=${quality ?? 75}`, "format=auto"];
|
|
25
25
|
if (/^https:\/\//i.test(src)) {
|
|
26
26
|
let hostname;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replohq/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"reploBuild": {
|
|
5
5
|
"packageName": "@replohq/sdk",
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.12.0",
|
|
7
7
|
"branch": "HEAD",
|
|
8
|
-
"commit": "
|
|
9
|
-
"builtAt": "2026-09-
|
|
8
|
+
"commit": "3d57d078085b1361b40fd9feb54651a1fca5a985",
|
|
9
|
+
"builtAt": "2026-09-22T02:12:30.362Z"
|
|
10
10
|
},
|
|
11
11
|
"description": "Replo SDK — cart, analytics, and data loaders for agent-built Next.js sites.",
|
|
12
12
|
"license": "SEE LICENSE IN LICENSE",
|