@replohq/sdk 1.10.0 → 1.10.1
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/_vendor/schemas/errors.d.ts +7 -0
- package/_vendor/schemas/money.mjs +1 -1
- package/_vendor/schemas/routing/locale.mjs +1 -1
- package/_vendor/schemas/routing/rules.mjs +1 -1
- package/analytics/analytics-provider.js +1 -37
- package/analytics/combine-sinks.d.ts +2 -0
- package/analytics/combine-sinks.js +38 -0
- package/analytics/utils/analytics-log.d.ts +20 -0
- package/analytics/utils/analytics-log.js +6 -0
- package/analytics/utils/analytics-products.js +1 -2
- package/analytics/utils/analytics-utils.js +9 -11
- 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/preview-placeholder.js +1 -1
- package/next/image-loader.js +1 -1
- package/package.json +4 -4
- /package/{chunk-YJQVNUW7.mjs → chunk-Y3AYABMK.mjs} +0 -0
|
@@ -120,6 +120,13 @@ export declare class Uncommon_GloballyMappedError extends ReploError {
|
|
|
120
120
|
userFacingDetails: ErrorUserFacingDetails;
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* The `userFacingDetails.key` publisher puts on its 404 for a missing project.
|
|
125
|
+
* It lives here rather than next to the error class because a caller across a
|
|
126
|
+
* service boundary (airlock) matches on it to tell "this project is gone" apart
|
|
127
|
+
* from any other 404 that URL could produce.
|
|
128
|
+
*/
|
|
129
|
+
export declare const PROJECT_NOT_FOUND_ERROR_KEY = "errors.project.notFound";
|
|
123
130
|
export declare class ReploValidationError extends ReploError {
|
|
124
131
|
constructor(message: string);
|
|
125
132
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getParamSegment, getRouteParams, hasRouteParam, matchSource } from '../../../chunk-VPEVERWE.mjs';
|
|
2
|
-
import { ReploError } from '../../../chunk-
|
|
2
|
+
import { ReploError } from '../../../chunk-Y3AYABMK.mjs';
|
|
3
3
|
import '../../../chunk-ZKAX2FW3.mjs';
|
|
4
4
|
import '../../../chunk-EUIVDITZ.mjs';
|
|
5
5
|
import '../../../chunk-SSBIMQES.mjs';
|
|
@@ -3,45 +3,9 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { createContext, useContext, useEffect, useMemo, useRef } from "react";
|
|
4
4
|
import { useConsent } from "../consent/consent-store";
|
|
5
5
|
import { useRegisteredScripts } from "../consent/script-registration-store";
|
|
6
|
+
import { combineSinks } from "./combine-sinks";
|
|
6
7
|
import { getAnalyticsSinks } from "./get-analytics-sinks";
|
|
7
8
|
import { NavigationTracker } from "./utils/navigation-tracker";
|
|
8
|
-
function combineSinks(sinks) {
|
|
9
|
-
const broadcast = async (method, ...args) => {
|
|
10
|
-
if (typeof window !== "undefined") {
|
|
11
|
-
console.debug(
|
|
12
|
-
"[analytics] broadcast",
|
|
13
|
-
method,
|
|
14
|
-
"to",
|
|
15
|
-
sinks.length,
|
|
16
|
-
"sinks",
|
|
17
|
-
{ args }
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
await Promise.all(
|
|
21
|
-
sinks.map(async (sink) => {
|
|
22
|
-
try {
|
|
23
|
-
const sinkMethod = sink[method];
|
|
24
|
-
await sinkMethod.apply(sink, args);
|
|
25
|
-
} catch {
|
|
26
|
-
if (typeof window !== "undefined") {
|
|
27
|
-
console.warn("[analytics] sink error", { method, sink });
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
return {
|
|
34
|
-
pageView: (...args) => broadcast("pageView", ...args),
|
|
35
|
-
purchase: (...args) => broadcast("purchase", ...args),
|
|
36
|
-
click: (...args) => broadcast("click", ...args),
|
|
37
|
-
productViewed: (...args) => broadcast("productViewed", ...args),
|
|
38
|
-
addToCart: (...args) => broadcast("addToCart", ...args),
|
|
39
|
-
removeFromCart: (...args) => broadcast("removeFromCart", ...args),
|
|
40
|
-
viewCart: (...args) => broadcast("viewCart", ...args),
|
|
41
|
-
startCheckout: (...args) => broadcast("startCheckout", ...args),
|
|
42
|
-
viewCollection: (...args) => broadcast("viewCollection", ...args)
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
9
|
const AnalyticsContext = createContext(null);
|
|
46
10
|
function AnalyticsProvider({
|
|
47
11
|
children,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { logAnalyticsActivity } from "./utils/analytics-log";
|
|
2
|
+
function combineSinks(sinks) {
|
|
3
|
+
const broadcast = async (method, ...args) => {
|
|
4
|
+
if (typeof window !== "undefined") {
|
|
5
|
+
logAnalyticsActivity({
|
|
6
|
+
kind: "broadcast",
|
|
7
|
+
method,
|
|
8
|
+
sinkCount: sinks.length
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
await Promise.all(
|
|
12
|
+
sinks.map(async (sink) => {
|
|
13
|
+
try {
|
|
14
|
+
const sinkMethod = sink[method];
|
|
15
|
+
await sinkMethod.apply(sink, args);
|
|
16
|
+
} catch {
|
|
17
|
+
if (typeof window !== "undefined") {
|
|
18
|
+
console.warn("[analytics] sink error", { method });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
pageView: (...args) => broadcast("pageView", ...args),
|
|
26
|
+
purchase: (...args) => broadcast("purchase", ...args),
|
|
27
|
+
click: (...args) => broadcast("click", ...args),
|
|
28
|
+
productViewed: (...args) => broadcast("productViewed", ...args),
|
|
29
|
+
addToCart: (...args) => broadcast("addToCart", ...args),
|
|
30
|
+
removeFromCart: (...args) => broadcast("removeFromCart", ...args),
|
|
31
|
+
viewCart: (...args) => broadcast("viewCart", ...args),
|
|
32
|
+
startCheckout: (...args) => broadcast("startCheckout", ...args),
|
|
33
|
+
viewCollection: (...args) => broadcast("viewCollection", ...args)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
combineSinks
|
|
38
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type AnalyticsActivity = {
|
|
2
|
+
kind: "broadcast";
|
|
3
|
+
method: string;
|
|
4
|
+
sinkCount: number;
|
|
5
|
+
} | {
|
|
6
|
+
kind: "flush";
|
|
7
|
+
eventCount: number;
|
|
8
|
+
queueName: string;
|
|
9
|
+
} | {
|
|
10
|
+
kind: "queueTimeout";
|
|
11
|
+
queueName: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: "drop";
|
|
14
|
+
queueName: string;
|
|
15
|
+
} | {
|
|
16
|
+
kind: "methodQueueTimeout";
|
|
17
|
+
queueName: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function logAnalyticsActivity(activity: AnalyticsActivity): void;
|
|
20
|
+
export {};
|
|
@@ -31,8 +31,7 @@ function splitCollectionProducts(data) {
|
|
|
31
31
|
const lines = parseAnalyticsProductLines(products);
|
|
32
32
|
if (Array.isArray(products) && products.length > 0 && lines.length === 0) {
|
|
33
33
|
console.warn(
|
|
34
|
-
"[analytics] collection view products did not match the per-line shape and were dropped"
|
|
35
|
-
{ products }
|
|
34
|
+
"[analytics] collection view products did not match the per-line shape and were dropped"
|
|
36
35
|
);
|
|
37
36
|
}
|
|
38
37
|
return { products: lines, rest };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { logAnalyticsActivity } from "./analytics-log";
|
|
1
2
|
const QUEUE_TIMEOUT_MS = 3e4;
|
|
2
3
|
function createAnalyticsQueue({
|
|
3
4
|
isReady,
|
|
@@ -22,9 +23,11 @@ function createAnalyticsQueue({
|
|
|
22
23
|
if (!isReady()) {
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
logAnalyticsActivity({
|
|
27
|
+
kind: "flush",
|
|
28
|
+
eventCount: queue.length,
|
|
29
|
+
queueName
|
|
30
|
+
});
|
|
28
31
|
try {
|
|
29
32
|
queue.forEach(send);
|
|
30
33
|
} finally {
|
|
@@ -40,16 +43,13 @@ function createAnalyticsQueue({
|
|
|
40
43
|
timeoutTimer = window.setTimeout(() => {
|
|
41
44
|
queue.length = 0;
|
|
42
45
|
permanentlyDisabled = true;
|
|
43
|
-
|
|
46
|
+
logAnalyticsActivity({ kind: "queueTimeout", queueName });
|
|
44
47
|
cleanup();
|
|
45
48
|
}, QUEUE_TIMEOUT_MS);
|
|
46
49
|
};
|
|
47
50
|
return (payload) => {
|
|
48
51
|
if (permanentlyDisabled) {
|
|
49
|
-
|
|
50
|
-
`[analytics] ${queueName} queue is disabled, dropping event`,
|
|
51
|
-
payload
|
|
52
|
-
);
|
|
52
|
+
logAnalyticsActivity({ kind: "drop", queueName });
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
55
|
if (isReady()) {
|
|
@@ -113,9 +113,7 @@ function createMethodQueue(checkInstanceReady, options) {
|
|
|
113
113
|
queue.length = 0;
|
|
114
114
|
permanentlyDisabled = true;
|
|
115
115
|
if (typeof window !== "undefined") {
|
|
116
|
-
|
|
117
|
-
`[analytics] ${queueName} timed out and has been disabled`
|
|
118
|
-
);
|
|
116
|
+
logAnalyticsActivity({ kind: "methodQueueTimeout", queueName });
|
|
119
117
|
}
|
|
120
118
|
options?.onTimeout?.();
|
|
121
119
|
cleanup();
|
package/cart/cart-loader.js
CHANGED
|
@@ -6,7 +6,7 @@ async function CartLoader({
|
|
|
6
6
|
children,
|
|
7
7
|
country
|
|
8
8
|
}) {
|
|
9
|
-
const cart =
|
|
9
|
+
const cart = false ? null : await getCartAction().catch((error) => {
|
|
10
10
|
unstable_rethrow(error);
|
|
11
11
|
console.warn("[Replo] Failed to load cart:", error);
|
|
12
12
|
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 (true) {
|
|
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: true
|
|
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.
|
|
16
|
+
return 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 (false) {
|
|
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 (false) {
|
|
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.10.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"branch": "HEAD",
|
|
5
|
-
"commit": "
|
|
6
|
-
"builtAt": "2026-09-
|
|
5
|
+
"commit": "bad30733ed6d9f37c3fe49876e818d01dad78e77",
|
|
6
|
+
"builtAt": "2026-09-20T21:19:55.438Z"
|
|
7
7
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { 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 (false) {
|
|
56
56
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
57
57
|
this.props.fallback,
|
|
58
58
|
/* @__PURE__ */ jsx(LoaderErrorDetails, { error: this.state.error })
|
|
@@ -180,7 +180,7 @@ function resolvePreviewPlaceholderData({
|
|
|
180
180
|
return null;
|
|
181
181
|
}
|
|
182
182
|
if (typeof window === "undefined") {
|
|
183
|
-
return
|
|
183
|
+
return false ? placeholderData : null;
|
|
184
184
|
}
|
|
185
185
|
return window.parent === window ? null : placeholderData;
|
|
186
186
|
}
|
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 = false;
|
|
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.10.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"reploBuild": {
|
|
5
5
|
"packageName": "@replohq/sdk",
|
|
6
|
-
"version": "1.10.
|
|
6
|
+
"version": "1.10.1",
|
|
7
7
|
"branch": "HEAD",
|
|
8
|
-
"commit": "
|
|
9
|
-
"builtAt": "2026-09-
|
|
8
|
+
"commit": "bad30733ed6d9f37c3fe49876e818d01dad78e77",
|
|
9
|
+
"builtAt": "2026-09-20T21:19:55.438Z"
|
|
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",
|
|
File without changes
|