@replohq/sdk 2.10.0 → 2.10.2

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.
@@ -1,5 +1,4 @@
1
1
  import { ReploError } from '../../../chunk-AE5H7AJS.mjs';
2
- import '../../../chunk-UJCSKKID.mjs';
3
2
  import * as z from 'zod';
4
3
 
5
4
  var LocaleRoutingValidationError = class extends ReploError {
@@ -1,4 +1,3 @@
1
- import '../../../chunk-UJCSKKID.mjs';
2
1
  import { match } from '@formatjs/intl-localematcher';
3
2
  import Negotiator from 'negotiator';
4
3
 
@@ -1,2 +1 @@
1
1
  export { applyParams, getParamSegment, getRouteParams, hasRouteParam, matchSource } from '../../../chunk-VPEVERWE.mjs';
2
- import '../../../chunk-UJCSKKID.mjs';
@@ -1,6 +1,5 @@
1
1
  import { getParamSegment, getRouteParams, hasRouteParam, matchSource } from '../../../chunk-VPEVERWE.mjs';
2
2
  import { ReploError } from '../../../chunk-AE5H7AJS.mjs';
3
- import '../../../chunk-UJCSKKID.mjs';
4
3
  import * as z from 'zod';
5
4
 
6
5
  function parseUrl(value, base) {
@@ -1,6 +1,7 @@
1
1
  "use server";
2
2
  import { cookies } from "next/headers";
3
3
  import { getCheckoutProvider } from "../lib/integration-utils";
4
+ import { REPLO_ATTRIBUTION_PROPERTY } from "./cart-types";
4
5
  import {
5
6
  getCartCookieOptions,
6
7
  REPLO_CART_COOKIE_NAME
@@ -116,7 +117,17 @@ async function createCartAction(options) {
116
117
  }
117
118
  async function addToCartAction(lines, cartId) {
118
119
  const cartGateway = await getCartGateway();
119
- return await cartGateway.addToCart({ lines, cartId });
120
+ const cart = await cartGateway.addToCart({ lines, cartId });
121
+ if (!cart || await getCheckoutProvider() !== "shopify" || cart.attributes?.some(
122
+ (attribute) => attribute.key === REPLO_ATTRIBUTION_PROPERTY.key
123
+ )) {
124
+ return cart;
125
+ }
126
+ const attributedCart = await cartGateway.replaceCartAttributes({
127
+ cartId: cart.id,
128
+ attributes: [...cart.attributes ?? [], REPLO_ATTRIBUTION_PROPERTY]
129
+ });
130
+ return attributedCart ?? cart;
120
131
  }
121
132
  async function updateCartLineItemAction(line, cartId) {
122
133
  const cartGateway = await getCartGateway();
@@ -29,7 +29,10 @@ export interface CartLineAttribute {
29
29
  key: string;
30
30
  value: string | number | boolean;
31
31
  }
32
- /** Replo attribution property added to cart/buy-now line items for order attribution in Shopify. */
32
+ /**
33
+ * Replo order attribution. Shopify carts the SDK adds to carry it as a cart
34
+ * attribute; buy-now and Stripe checkout lines carry it as a line property.
35
+ */
33
36
  export declare const REPLO_ATTRIBUTION_PROPERTY: CartLineAttribute;
34
37
  export interface SellingPlanPriceAdjustment {
35
38
  compareAtPrice: {
@@ -4,7 +4,6 @@ import { useQueryClient } from "@tanstack/react-query";
4
4
  import { fromMajorUnitsToMinorUnits } from "../../_vendor/schemas/moneyFormat.mjs";
5
5
  import { DATA_LOADER_KEYS } from "../../loaders/loader-keys";
6
6
  import { useCartInternal } from "../cart-provider";
7
- import { REPLO_ATTRIBUTION_PROPERTY } from "../cart-types";
8
7
  import { toCartError } from "../utils/cart-error";
9
8
  const PRODUCT_LOADER_KEYS = [
10
9
  DATA_LOADER_KEYS.SHOPIFY_PRODUCT,
@@ -90,10 +89,6 @@ function useAddToCart() {
90
89
  setIsAdding(true);
91
90
  try {
92
91
  const cartLines = items.map((item) => {
93
- const hasReploAttribution = item.properties?.some(
94
- (prop) => prop.key === REPLO_ATTRIBUTION_PROPERTY.key
95
- );
96
- const properties = hasReploAttribution ? item.properties ?? [] : [REPLO_ATTRIBUTION_PROPERTY, ...item.properties ?? []];
97
92
  const merchandise = item.merchandise ?? findMerchandiseInQueryCache({
98
93
  queryClient,
99
94
  merchandiseId: item.merchandiseId
@@ -102,7 +97,7 @@ function useAddToCart() {
102
97
  id: item.merchandiseId,
103
98
  quantity: item.quantity ?? 1,
104
99
  sellingPlanId: item.sellingPlanId ?? void 0,
105
- properties,
100
+ properties: item.properties,
106
101
  merchandise
107
102
  };
108
103
  });
@@ -1,7 +1,7 @@
1
1
  export const BUILD_METADATA = {
2
2
  "packageName": "@replohq/sdk",
3
- "version": "2.10.0",
3
+ "version": "2.10.2",
4
4
  "branch": "HEAD",
5
- "commit": "96a07333d34af59c46f8874351df866542e7c2e9",
6
- "builtAt": "2026-10-26T22:54:01.502Z"
5
+ "commit": "988eaafe9d388438b46bf5e9893778332751a290",
6
+ "builtAt": "2026-10-27T20:34:10.030Z"
7
7
  };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@replohq/sdk",
3
- "version": "2.10.0",
3
+ "version": "2.10.2",
4
4
  "reploBuild": {
5
5
  "packageName": "@replohq/sdk",
6
- "version": "2.10.0",
6
+ "version": "2.10.2",
7
7
  "branch": "HEAD",
8
- "commit": "96a07333d34af59c46f8874351df866542e7c2e9",
9
- "builtAt": "2026-10-26T22:54:01.502Z"
8
+ "commit": "988eaafe9d388438b46bf5e9893778332751a290",
9
+ "builtAt": "2026-10-27T20:34:10.030Z"
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",
@@ -1,23 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
20
- mod
21
- ));
22
-
23
- export { __commonJS, __toESM };