@replohq/sdk 1.19.0 → 1.20.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.
@@ -83,6 +83,24 @@ export declare class ReploHTTPError extends ReploError {
83
83
  details?: object;
84
84
  });
85
85
  }
86
+ /**
87
+ * HTTP error for callers that branch on `key` in code (SDKs, other services)
88
+ * rather than showing it in Replo's own UI, so it has no display `type`. The
89
+ * worker error handler answers `{ key, message, details, errorId }`. Should
90
+ * only be thrown from routes.
91
+ */
92
+ export declare class ReploParseableHTTPError extends ReploError {
93
+ statusCode: number;
94
+ key: string;
95
+ userFacingMessage: string;
96
+ details?: Record<string, unknown>;
97
+ constructor(config: ReploErrorConfig & {
98
+ statusCode: number;
99
+ key: string;
100
+ userFacingMessage: string;
101
+ details?: Record<string, unknown>;
102
+ });
103
+ }
86
104
  /**
87
105
  * Error used to represent an HTTP error that should be surfaced as such. This
88
106
  * should be thrown when we want to pass the error through without changing the
@@ -1,4 +1,4 @@
1
- export type ReploScriptType = "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "X" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam" | "Gorgias" | "Converge" | "Cookiebot" | "snippet" | "custom" | "consentPlatform";
1
+ export type ReploScriptType = "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "X" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam" | "Gorgias" | "Converge" | "HubSpot" | "Cookiebot" | "snippet" | "custom" | "consentPlatform";
2
2
  export type ConsentCategory = "necessary" | "analytics" | "marketing" | "preferences" | "sale_of_data";
3
3
  export type ConsentMode = "off" | "simple" | "per-category";
4
4
  export type ScriptTagDescriptor = {
@@ -20,7 +20,7 @@ export type XPixelEvents = {
20
20
  purchase?: string;
21
21
  };
22
22
  export type ReploScriptEntry = {
23
- type: "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam" | "Gorgias" | "Converge";
23
+ type: "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam" | "Gorgias" | "Converge" | "HubSpot";
24
24
  identifier: string;
25
25
  requiredConsent?: ConsentCategory[];
26
26
  } | {
@@ -1,4 +1,4 @@
1
- import { ReploError } from '../../chunk-Y3AYABMK.mjs';
1
+ import { ReploError } from '../../chunk-NDJ5N6HI.mjs';
2
2
  import '../../chunk-HFKL4ZR5.mjs';
3
3
  import '../../chunk-EUIVDITZ.mjs';
4
4
  import '../../chunk-SSBIMQES.mjs';
@@ -1,4 +1,4 @@
1
- import { ReploError } from '../../../chunk-Y3AYABMK.mjs';
1
+ import { ReploError } from '../../../chunk-NDJ5N6HI.mjs';
2
2
  import '../../../chunk-HFKL4ZR5.mjs';
3
3
  import '../../../chunk-EUIVDITZ.mjs';
4
4
  import '../../../chunk-SSBIMQES.mjs';
@@ -1,5 +1,5 @@
1
1
  import { getParamSegment, getRouteParams, hasRouteParam, matchSource } from '../../../chunk-VPEVERWE.mjs';
2
- import { ReploError } from '../../../chunk-Y3AYABMK.mjs';
2
+ import { ReploError } from '../../../chunk-NDJ5N6HI.mjs';
3
3
  import '../../../chunk-HFKL4ZR5.mjs';
4
4
  import '../../../chunk-EUIVDITZ.mjs';
5
5
  import '../../../chunk-SSBIMQES.mjs';
@@ -147,6 +147,16 @@ gtag('config', '${id}');`
147
147
  attributes: { id: "gorgias-chat-widget-install-v3" }
148
148
  }
149
149
  ]
150
+ },
151
+ HubSpot: {
152
+ defaultConsent: ["analytics", "marketing"],
153
+ buildTags: (id) => [
154
+ {
155
+ kind: "external",
156
+ src: `https://js.hs-scripts.com/${id}.js`,
157
+ attributes: { id: "hs-script-loader", async: "true", defer: "true" }
158
+ }
159
+ ]
150
160
  }
151
161
  };
152
162
  function isXEventIdForPixel({
@@ -1,4 +1,4 @@
1
- export type ReploScriptType = "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "X" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam" | "Gorgias" | "Converge" | "Cookiebot" | "snippet" | "custom" | "consentPlatform";
1
+ export type ReploScriptType = "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "X" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam" | "Gorgias" | "Converge" | "HubSpot" | "Cookiebot" | "snippet" | "custom" | "consentPlatform";
2
2
  export type ConsentCategory = "necessary" | "analytics" | "marketing" | "preferences" | "sale_of_data";
3
3
  export type ConsentMode = "off" | "simple" | "per-category";
4
4
  declare module "react" {
@@ -24,7 +24,7 @@ export type XPixelEvents = {
24
24
  purchase?: string;
25
25
  };
26
26
  export type ReploScriptEntry = {
27
- type: "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam" | "Gorgias" | "Converge" | "Cookiebot";
27
+ type: "GA4" | "GoogleTagManager" | "Meta" | "TikTok" | "Pinterest" | "Reddit" | "Snapchat" | "Hotjar" | "MicrosoftClarity" | "Contentsquare" | "Segment" | "Northbeam" | "Gorgias" | "Converge" | "HubSpot" | "Cookiebot";
28
28
  identifier: string;
29
29
  requiredConsent?: ConsentCategory[];
30
30
  } | {
@@ -15,19 +15,13 @@ const mailchimpSubscribeErrorCodeSchema = z.enum([
15
15
  "rateLimited",
16
16
  "upstreamError"
17
17
  ]);
18
- const mailchimpSubscribeResponseSchema = z.discriminatedUnion("ok", [
19
- z.object({
20
- ok: z.literal(true),
21
- status: z.enum(["subscribed", "pending"])
22
- }),
23
- z.object({
24
- ok: z.literal(false),
25
- error: z.object({
26
- code: mailchimpSubscribeErrorCodeSchema,
27
- message: z.string()
28
- })
29
- })
30
- ]);
18
+ const mailchimpSubscribeSuccessSchema = z.object({
19
+ status: z.enum(["subscribed", "pending"])
20
+ });
21
+ const mailchimpSubscribeFailureSchema = z.object({
22
+ key: mailchimpSubscribeErrorCodeSchema,
23
+ message: z.string()
24
+ });
31
25
  class MailchimpSubscribeError extends CanopyError {
32
26
  code;
33
27
  constructor({
@@ -50,9 +44,10 @@ async function postSubscribe({
50
44
  cause: null
51
45
  });
52
46
  }
47
+ let response;
53
48
  let responseText;
54
49
  try {
55
- const response = await fetch(
50
+ response = await fetch(
56
51
  `${config.canopyApiBaseUrl}/api/v1/integrations/mailchimp/subscribe`,
57
52
  {
58
53
  method: "POST",
@@ -68,20 +63,26 @@ async function postSubscribe({
68
63
  cause: error
69
64
  });
70
65
  }
71
- const parsed = mailchimpSubscribeResponseSchema.safeParse(
72
- parseJsonOrNull(responseText)
73
- );
74
- if (!parsed.success) {
66
+ const body = parseJsonOrNull(responseText);
67
+ if (!response.ok) {
68
+ const failure = mailchimpSubscribeFailureSchema.safeParse(body);
69
+ throw new MailchimpSubscribeError(
70
+ failure.success ? { code: failure.data.key, message: failure.data.message, cause: null } : {
71
+ code: "upstreamError",
72
+ message: `The Mailchimp subscribe endpoint failed with status ${response.status}`,
73
+ cause: failure.error
74
+ }
75
+ );
76
+ }
77
+ const success = mailchimpSubscribeSuccessSchema.safeParse(body);
78
+ if (!success.success) {
75
79
  throw new MailchimpSubscribeError({
76
80
  code: "upstreamError",
77
81
  message: "The Mailchimp subscribe endpoint returned an unexpected response",
78
- cause: parsed.error
82
+ cause: success.error
79
83
  });
80
84
  }
81
- if (!parsed.data.ok) {
82
- throw new MailchimpSubscribeError({ ...parsed.data.error, cause: null });
83
- }
84
- return parsed.data.status;
85
+ return success.data.status;
85
86
  }
86
87
  function useMailchimpSubscribe({
87
88
  listId,
@@ -1,7 +1,7 @@
1
1
  export const BUILD_METADATA = {
2
2
  "packageName": "@replohq/sdk",
3
- "version": "1.19.0",
3
+ "version": "1.20.1",
4
4
  "branch": "HEAD",
5
- "commit": "e3b248dbf12d7b2d1f401d36170686e094d40e3a",
6
- "builtAt": "2026-10-14T22:19:29.297Z"
5
+ "commit": "c6e9b3d61d0bf34192be5846e24fc07bb4768b83",
6
+ "builtAt": "2026-10-17T03:28:27.431Z"
7
7
  };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@replohq/sdk",
3
- "version": "1.19.0",
3
+ "version": "1.20.1",
4
4
  "reploBuild": {
5
5
  "packageName": "@replohq/sdk",
6
- "version": "1.19.0",
6
+ "version": "1.20.1",
7
7
  "branch": "HEAD",
8
- "commit": "e3b248dbf12d7b2d1f401d36170686e094d40e3a",
9
- "builtAt": "2026-10-14T22:19:29.297Z"
8
+ "commit": "c6e9b3d61d0bf34192be5846e24fc07bb4768b83",
9
+ "builtAt": "2026-10-17T03:28:27.431Z"
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