@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.
- package/_vendor/replo-utils/lib/json.mjs +0 -1
- package/_vendor/replo-utils/lib/misc.mjs +0 -1
- package/_vendor/replo-utils/lib/object.mjs +0 -1
- package/_vendor/schemas/contentCollection.mjs +0 -1
- package/_vendor/schemas/contentEntry.mjs +0 -1
- package/_vendor/schemas/contentManifest.mjs +0 -1
- package/_vendor/schemas/loaderKeys.mjs +0 -2
- package/_vendor/schemas/moneyFormat.mjs +42 -1853
- package/_vendor/schemas/routing/locale.mjs +0 -1
- package/_vendor/schemas/routing/localeNegotiation.mjs +0 -1
- package/_vendor/schemas/routing/match.mjs +0 -1
- package/_vendor/schemas/routing/rules.mjs +0 -1
- package/cart/cart-actions.js +12 -1
- package/cart/cart-types.d.ts +4 -1
- package/cart/hooks/use-add-to-cart.js +1 -6
- package/lib/buildMetadata.js +3 -3
- package/package.json +4 -4
- package/chunk-UJCSKKID.mjs +0 -23
|
@@ -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) {
|
package/cart/cart-actions.js
CHANGED
|
@@ -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
|
-
|
|
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();
|
package/cart/cart-types.d.ts
CHANGED
|
@@ -29,7 +29,10 @@ export interface CartLineAttribute {
|
|
|
29
29
|
key: string;
|
|
30
30
|
value: string | number | boolean;
|
|
31
31
|
}
|
|
32
|
-
/**
|
|
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
|
});
|
package/lib/buildMetadata.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const BUILD_METADATA = {
|
|
2
2
|
"packageName": "@replohq/sdk",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"branch": "HEAD",
|
|
5
|
-
"commit": "
|
|
6
|
-
"builtAt": "2026-10-
|
|
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.
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"reploBuild": {
|
|
5
5
|
"packageName": "@replohq/sdk",
|
|
6
|
-
"version": "2.10.
|
|
6
|
+
"version": "2.10.2",
|
|
7
7
|
"branch": "HEAD",
|
|
8
|
-
"commit": "
|
|
9
|
-
"builtAt": "2026-10-
|
|
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",
|
package/chunk-UJCSKKID.mjs
DELETED
|
@@ -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 };
|