@replohq/sdk 1.9.5 → 1.10.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.
@@ -6,6 +6,7 @@ var DATA_LOADER_KEYS = {
6
6
  SHOPIFY_COLLECTION_PRODUCTS: "shopify_storefront.collection_products",
7
7
  SHOPIFY_METAOBJECT: "shopify_storefront.metaobject",
8
8
  SHOPIFY_METAOBJECTS: "shopify_storefront.metaobjects",
9
+ SHOPIFY_KACHING_BUNDLES: "shopify_storefront.kaching_bundles",
9
10
  REPLO_PRODUCT: "replo_products.product",
10
11
  OKENDO_PRODUCT_REVIEWS: "okendo.product_reviews",
11
12
  OKENDO_PRODUCT_REVIEW_AGGREGATE: "okendo.product_review_aggregate",
@@ -1,3 +1,4 @@
1
+ import type { CartLineAttribute } from "../cart-types";
1
2
  /**
2
3
  * What a `buyNow` call did. Out of stock is an expected storefront outcome
3
4
  * (a buyer can race the last unit), so it rides the return value rather than
@@ -17,6 +18,8 @@ export interface VariantBuyNowInfo {
17
18
  variantId: string;
18
19
  quantity?: number;
19
20
  sellingPlanId?: string | null;
21
+ /** Custom line item properties (appear on the order). */
22
+ properties?: CartLineAttribute[];
20
23
  }
21
24
  /**
22
25
  * React hook that returns a `buyNow` function for express checkout flows.
@@ -32,7 +32,7 @@ function useBuyNow() {
32
32
  variantId: variant.variantId,
33
33
  quantity: variant.quantity ?? 1,
34
34
  sellingPlanId: variant.sellingPlanId ?? null,
35
- properties: []
35
+ properties: variant.properties ?? []
36
36
  })),
37
37
  discountCodes: options?.discountCodes ?? [],
38
38
  pageUrl: window.location.href
@@ -1,7 +1,7 @@
1
1
  export const BUILD_METADATA = {
2
2
  "packageName": "@replohq/sdk",
3
- "version": "1.9.5",
3
+ "version": "1.10.0",
4
4
  "branch": "HEAD",
5
- "commit": "0a035b21ce1b041469758df14644035659d54252",
6
- "builtAt": "2026-09-18T18:40:51.491Z"
5
+ "commit": "24c482167732242f8a358ac9f85c39183293880a",
6
+ "builtAt": "2026-09-18T23:32:34.853Z"
7
7
  };
@@ -0,0 +1,23 @@
1
+ import type { ReactNode } from "react";
2
+ import type { AddToCartItem } from "../cart/hooks/use-add-to-cart";
3
+ type KachingBundlesLoaderProps = {
4
+ loaderKey: string;
5
+ productId: string;
6
+ dealBlockId?: string;
7
+ country?: string;
8
+ language?: string;
9
+ selectedVariantId?: string;
10
+ /**
11
+ * Rendered under Kaching's widget with the shopper's current pick. The lines
12
+ * are ready for `addToCart` and carry the Kaching line attributes that
13
+ * Checkout uses to apply the discount; they are empty until the shopper picks.
14
+ */
15
+ children: (bundle: {
16
+ lines: AddToCartItem[];
17
+ }) => ReactNode;
18
+ fallback?: ReactNode;
19
+ /** Rendered instead of the widget when Kaching has no active deal for this product. */
20
+ noDealFallback?: ReactNode;
21
+ };
22
+ export declare function KachingBundlesLoader({ loaderKey, productId, dealBlockId, country, language, selectedVariantId, children, fallback, noDealFallback, }: KachingBundlesLoaderProps): import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -0,0 +1,75 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { Suspense, useState } from "react";
4
+ import { KachingBundle } from "@kachingappz/bundles-react";
5
+ import { useSuspenseQuery } from "@tanstack/react-query";
6
+ import { invokeLoader } from "./invoke-loader";
7
+ import { LoaderErrorBoundary } from "./loader-error-boundary";
8
+ import { shopifyKachingBundlesLoaderOutputSchema } from "./loader-schemas";
9
+ function KachingBundlesLoaderInner({
10
+ loaderKey,
11
+ args,
12
+ selectedVariantId,
13
+ children,
14
+ noDealFallback
15
+ }) {
16
+ const [lines, setLines] = useState([]);
17
+ const { data } = useSuspenseQuery({
18
+ queryKey: [loaderKey, args],
19
+ queryFn: async () => {
20
+ const loadedData = await invokeLoader({ loaderKey, args });
21
+ return shopifyKachingBundlesLoaderOutputSchema.parse(loadedData);
22
+ }
23
+ });
24
+ if (data.bundles === null) {
25
+ return /* @__PURE__ */ jsx(Fragment, { children: noDealFallback ?? null });
26
+ }
27
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ /* @__PURE__ */ jsx(
29
+ KachingBundle,
30
+ {
31
+ data: data.bundles,
32
+ selectedVariantId,
33
+ onLinesChange: (widgetLines) => {
34
+ setLines(
35
+ widgetLines.map((line) => ({
36
+ merchandiseId: line.merchandiseId,
37
+ quantity: line.quantity,
38
+ sellingPlanId: line.sellingPlanId ?? null,
39
+ properties: line.attributes
40
+ }))
41
+ );
42
+ }
43
+ }
44
+ ),
45
+ children({ lines })
46
+ ] });
47
+ }
48
+ function KachingBundlesLoader({
49
+ loaderKey,
50
+ productId,
51
+ dealBlockId,
52
+ country,
53
+ language,
54
+ selectedVariantId,
55
+ children,
56
+ fallback,
57
+ noDealFallback
58
+ }) {
59
+ const args = { productId, dealBlockId, country, language };
60
+ const instanceKey = `${loaderKey}:${JSON.stringify(args)}`;
61
+ return /* @__PURE__ */ jsx(LoaderErrorBoundary, { fallback: fallback ?? null, resetKey: instanceKey, children: /* @__PURE__ */ jsx(Suspense, { fallback: fallback ?? null, children: /* @__PURE__ */ jsx(
62
+ KachingBundlesLoaderInner,
63
+ {
64
+ loaderKey,
65
+ args,
66
+ selectedVariantId,
67
+ noDealFallback,
68
+ children
69
+ },
70
+ instanceKey
71
+ ) }) });
72
+ }
73
+ export {
74
+ KachingBundlesLoader
75
+ };
@@ -15,6 +15,7 @@ export declare const DATA_LOADER_KEYS: {
15
15
  readonly SHOPIFY_COLLECTION_PRODUCTS: "shopify_storefront.collection_products";
16
16
  readonly SHOPIFY_METAOBJECT: "shopify_storefront.metaobject";
17
17
  readonly SHOPIFY_METAOBJECTS: "shopify_storefront.metaobjects";
18
+ readonly SHOPIFY_KACHING_BUNDLES: "shopify_storefront.kaching_bundles";
18
19
  readonly REPLO_PRODUCT: "replo_products.product";
19
20
  readonly OKENDO_PRODUCT_REVIEWS: "okendo.product_reviews";
20
21
  readonly OKENDO_PRODUCT_REVIEW_AGGREGATE: "okendo.product_review_aggregate";
@@ -4,6 +4,7 @@ const DATA_LOADER_KEYS = {
4
4
  SHOPIFY_COLLECTION_PRODUCTS: "shopify_storefront.collection_products",
5
5
  SHOPIFY_METAOBJECT: "shopify_storefront.metaobject",
6
6
  SHOPIFY_METAOBJECTS: "shopify_storefront.metaobjects",
7
+ SHOPIFY_KACHING_BUNDLES: "shopify_storefront.kaching_bundles",
7
8
  REPLO_PRODUCT: "replo_products.product",
8
9
  OKENDO_PRODUCT_REVIEWS: "okendo.product_reviews",
9
10
  OKENDO_PRODUCT_REVIEW_AGGREGATE: "okendo.product_review_aggregate",
@@ -1011,6 +1011,10 @@ export declare const shopifyMetaobjectsLoaderOutputSchema: z.ZodObject<{
1011
1011
  endCursor: z.ZodNullable<z.ZodString>;
1012
1012
  }, z.core.$strip>;
1013
1013
  }, z.core.$strip>;
1014
+ export declare const shopifyKachingBundlesLoaderOutputSchema: z.ZodObject<{
1015
+ bundles: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1016
+ }, z.core.$strip>;
1017
+ export type ShopifyKachingBundlesLoaderOutput = z.infer<typeof shopifyKachingBundlesLoaderOutputSchema>;
1014
1018
  export type StorefrontMetaobject = z.infer<typeof storefrontMetaobjectSchema>;
1015
1019
  export type ShopifyMetaobjectLoaderOutput = z.infer<typeof shopifyMetaobjectLoaderOutputSchema>;
1016
1020
  export type ShopifyMetaobjectsLoaderOutput = z.infer<typeof shopifyMetaobjectsLoaderOutputSchema>;
@@ -347,6 +347,9 @@ const shopifyMetaobjectsLoaderOutputSchema = z.object({
347
347
  endCursor: z.string().nullable()
348
348
  })
349
349
  }).describe("ShopifyMetaobjectsLoaderOutput");
350
+ const shopifyKachingBundlesLoaderOutputSchema = z.object({
351
+ bundles: z.record(z.string(), z.unknown()).nullable()
352
+ }).describe("ShopifyKachingBundles");
350
353
  export {
351
354
  contentfulAssetObjectSchema,
352
355
  contentfulEntriesLoaderOutputSchema,
@@ -385,6 +388,7 @@ export {
385
388
  sellingPlanOptionValueSchema,
386
389
  sellingPlanPriceAdjustmentSchema,
387
390
  sellingPlanSchema,
391
+ shopifyKachingBundlesLoaderOutputSchema,
388
392
  shopifyMetaobjectLoaderOutputSchema,
389
393
  shopifyMetaobjectsLoaderOutputSchema,
390
394
  statsigExperimentLoaderOutputSchema,
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@replohq/sdk",
3
- "version": "1.9.5",
3
+ "version": "1.10.0",
4
4
  "reploBuild": {
5
5
  "packageName": "@replohq/sdk",
6
- "version": "1.9.5",
6
+ "version": "1.10.0",
7
7
  "branch": "HEAD",
8
- "commit": "0a035b21ce1b041469758df14644035659d54252",
9
- "builtAt": "2026-09-18T18:40:51.491Z"
8
+ "commit": "24c482167732242f8a358ac9f85c39183293880a",
9
+ "builtAt": "2026-09-18T23:32:34.853Z"
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",
@@ -117,6 +117,10 @@
117
117
  "types": "./loaders/judgeme-reviews-loader.d.ts",
118
118
  "default": "./loaders/judgeme-reviews-loader.js"
119
119
  },
120
+ "./loaders/kaching-bundles-loader": {
121
+ "types": "./loaders/kaching-bundles-loader.d.ts",
122
+ "default": "./loaders/kaching-bundles-loader.js"
123
+ },
120
124
  "./loaders/levanta-product-loader": {
121
125
  "types": "./loaders/levanta-product-loader.d.ts",
122
126
  "default": "./loaders/levanta-product-loader.js"
@@ -269,6 +273,7 @@
269
273
  },
270
274
  "dependencies": {
271
275
  "@formatjs/intl-localematcher": "^0.8.13",
276
+ "@kachingappz/bundles-react": "0.5.3",
272
277
  "negotiator": "^1.0.0",
273
278
  "react-markdown": "^9.1.0",
274
279
  "remark-gfm": "^4.0.1",