@rebuy/rebuy 2.25.0 → 2.26.0-rc.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/dist/routes.d.ts +36 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +41 -0
- package/dist/routes.js.map +7 -0
- package/dist/routes.mjs +20 -0
- package/dist/routes.mjs.map +7 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +45 -0
- package/dist/server/index.js.map +7 -0
- package/dist/server/index.mjs +22 -0
- package/dist/server/index.mjs.map +7 -0
- package/dist/server/shared.d.ts +135 -0
- package/dist/server/shared.d.ts.map +1 -0
- package/dist/transforms/contentBlockV1/convertContentBlockImageToV2.d.ts +3 -3
- package/dist/transforms/contentBlockV1/convertContentBlockTextToV2.d.ts +2 -2
- package/dist/transforms/contentBlockV1/convertContentBlockToV2.d.ts +2 -2
- package/dist/transforms/contentBlockV1/convertTextToTiptapParagraph.d.ts +1 -1
- package/dist/transforms/htmlToTiptap/buildDefaultTextStyleMark.d.ts +2 -2
- package/dist/transforms/htmlToTiptap/buildLinkMark.d.ts +1 -1
- package/dist/transforms/htmlToTiptap/closeTag.d.ts +1 -1
- package/dist/transforms/htmlToTiptap/flushParagraph.d.ts +1 -1
- package/dist/transforms/htmlToTiptap/htmlToTiptap.d.ts +2 -2
- package/dist/transforms/htmlToTiptap/isSkipping.d.ts +1 -1
- package/dist/transforms/htmlToTiptap/makeDoc.d.ts +2 -2
- package/dist/transforms/htmlToTiptap/makeParagraph.d.ts +1 -1
- package/dist/transforms/htmlToTiptap/openTag.d.ts +1 -1
- package/dist/transforms/htmlToTiptap/pushText.d.ts +1 -1
- package/dist/transforms/htmlToTiptap/types.d.ts +1 -1
- package/dist/transforms/index.d.ts +12 -12
- package/package.json +13 -2
package/dist/routes.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type ApiRouteMethod = 'delete' | 'get' | 'post' | 'put';
|
|
2
|
+
export type ApiRoute = {
|
|
3
|
+
method: ApiRouteMethod;
|
|
4
|
+
path: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const apiRoutes: {
|
|
7
|
+
/** Checkout and Beyond — the Shopify checkout UI extension surface (every route the extension calls). */
|
|
8
|
+
readonly cab: {
|
|
9
|
+
/** Fire-and-forget analytics events. */
|
|
10
|
+
readonly analytics: {
|
|
11
|
+
readonly method: "post";
|
|
12
|
+
readonly path: "/cab/analytics";
|
|
13
|
+
};
|
|
14
|
+
/** Evaluate a data source against the live cart → offers (`limit > 0`) or a rule verdict (`limit: 0`). */
|
|
15
|
+
readonly dataSource: {
|
|
16
|
+
readonly method: "post";
|
|
17
|
+
readonly path: "/cab/data-source";
|
|
18
|
+
};
|
|
19
|
+
/** Validate gift-with-purchase lines → the cart-line ids to remove. */
|
|
20
|
+
readonly giftValidation: {
|
|
21
|
+
readonly method: "post";
|
|
22
|
+
readonly path: "/cab/gift-validation";
|
|
23
|
+
};
|
|
24
|
+
/** Server-composed CAB section tree for Monetize. */
|
|
25
|
+
readonly monetize: {
|
|
26
|
+
readonly method: "post";
|
|
27
|
+
readonly path: "/cab/monetize";
|
|
28
|
+
};
|
|
29
|
+
/** The composed CAB section tree for a widget id. */
|
|
30
|
+
readonly sections: {
|
|
31
|
+
readonly method: "get";
|
|
32
|
+
readonly path: "/cab/sections";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAE/D,MAAM,MAAM,QAAQ,GAAG;IAAE,MAAM,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,eAAO,MAAM,SAAS;IAClB,yGAAyG;;QAErG,wCAAwC;;;;;QAExC,0GAA0G;;;;;QAE1G,uEAAuE;;;;;QAEvE,qDAAqD;;;;;QAErD,qDAAqD;;;;;;CAGW,CAAC"}
|
package/dist/routes.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/routes.ts
|
|
21
|
+
var routes_exports = {};
|
|
22
|
+
__export(routes_exports, {
|
|
23
|
+
apiRoutes: () => apiRoutes
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(routes_exports);
|
|
26
|
+
var apiRoutes = {
|
|
27
|
+
/** Checkout and Beyond — the Shopify checkout UI extension surface (every route the extension calls). */
|
|
28
|
+
cab: {
|
|
29
|
+
/** Fire-and-forget analytics events. */
|
|
30
|
+
analytics: { method: "post", path: "/cab/analytics" },
|
|
31
|
+
/** Evaluate a data source against the live cart → offers (`limit > 0`) or a rule verdict (`limit: 0`). */
|
|
32
|
+
dataSource: { method: "post", path: "/cab/data-source" },
|
|
33
|
+
/** Validate gift-with-purchase lines → the cart-line ids to remove. */
|
|
34
|
+
giftValidation: { method: "post", path: "/cab/gift-validation" },
|
|
35
|
+
/** Server-composed CAB section tree for Monetize. */
|
|
36
|
+
monetize: { method: "post", path: "/cab/monetize" },
|
|
37
|
+
/** The composed CAB section tree for a widget id. */
|
|
38
|
+
sections: { method: "get", path: "/cab/sections" }
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=routes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/routes.ts"],
|
|
4
|
+
"sourcesContent": ["export type ApiRouteMethod = 'delete' | 'get' | 'post' | 'put';\n\nexport type ApiRoute = { method: ApiRouteMethod; path: string };\n\nexport const apiRoutes = {\n /** Checkout and Beyond \u2014 the Shopify checkout UI extension surface (every route the extension calls). */\n cab: {\n /** Fire-and-forget analytics events. */\n analytics: { method: 'post', path: '/cab/analytics' },\n /** Evaluate a data source against the live cart \u2192 offers (`limit > 0`) or a rule verdict (`limit: 0`). */\n dataSource: { method: 'post', path: '/cab/data-source' },\n /** Validate gift-with-purchase lines \u2192 the cart-line ids to remove. */\n giftValidation: { method: 'post', path: '/cab/gift-validation' },\n /** Server-composed CAB section tree for Monetize. */\n monetize: { method: 'post', path: '/cab/monetize' },\n /** The composed CAB section tree for a widget id. */\n sections: { method: 'get', path: '/cab/sections' },\n },\n} as const satisfies Record<string, ApiRoute | Record<string, ApiRoute>>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,YAAY;AAAA;AAAA,EAErB,KAAK;AAAA;AAAA,IAED,WAAW,EAAE,QAAQ,QAAQ,MAAM,iBAAiB;AAAA;AAAA,IAEpD,YAAY,EAAE,QAAQ,QAAQ,MAAM,mBAAmB;AAAA;AAAA,IAEvD,gBAAgB,EAAE,QAAQ,QAAQ,MAAM,uBAAuB;AAAA;AAAA,IAE/D,UAAU,EAAE,QAAQ,QAAQ,MAAM,gBAAgB;AAAA;AAAA,IAElD,UAAU,EAAE,QAAQ,OAAO,MAAM,gBAAgB;AAAA,EACrD;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/routes.mjs
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/routes.ts
|
|
2
|
+
var apiRoutes = {
|
|
3
|
+
/** Checkout and Beyond — the Shopify checkout UI extension surface (every route the extension calls). */
|
|
4
|
+
cab: {
|
|
5
|
+
/** Fire-and-forget analytics events. */
|
|
6
|
+
analytics: { method: "post", path: "/cab/analytics" },
|
|
7
|
+
/** Evaluate a data source against the live cart → offers (`limit > 0`) or a rule verdict (`limit: 0`). */
|
|
8
|
+
dataSource: { method: "post", path: "/cab/data-source" },
|
|
9
|
+
/** Validate gift-with-purchase lines → the cart-line ids to remove. */
|
|
10
|
+
giftValidation: { method: "post", path: "/cab/gift-validation" },
|
|
11
|
+
/** Server-composed CAB section tree for Monetize. */
|
|
12
|
+
monetize: { method: "post", path: "/cab/monetize" },
|
|
13
|
+
/** The composed CAB section tree for a widget id. */
|
|
14
|
+
sections: { method: "get", path: "/cab/sections" }
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
apiRoutes
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=routes.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/routes.ts"],
|
|
4
|
+
"sourcesContent": ["export type ApiRouteMethod = 'delete' | 'get' | 'post' | 'put';\n\nexport type ApiRoute = { method: ApiRouteMethod; path: string };\n\nexport const apiRoutes = {\n /** Checkout and Beyond \u2014 the Shopify checkout UI extension surface (every route the extension calls). */\n cab: {\n /** Fire-and-forget analytics events. */\n analytics: { method: 'post', path: '/cab/analytics' },\n /** Evaluate a data source against the live cart \u2192 offers (`limit > 0`) or a rule verdict (`limit: 0`). */\n dataSource: { method: 'post', path: '/cab/data-source' },\n /** Validate gift-with-purchase lines \u2192 the cart-line ids to remove. */\n giftValidation: { method: 'post', path: '/cab/gift-validation' },\n /** Server-composed CAB section tree for Monetize. */\n monetize: { method: 'post', path: '/cab/monetize' },\n /** The composed CAB section tree for a widget id. */\n sections: { method: 'get', path: '/cab/sections' },\n },\n} as const satisfies Record<string, ApiRoute | Record<string, ApiRoute>>;\n"],
|
|
5
|
+
"mappings": ";AAIO,IAAM,YAAY;AAAA;AAAA,EAErB,KAAK;AAAA;AAAA,IAED,WAAW,EAAE,QAAQ,QAAQ,MAAM,iBAAiB;AAAA;AAAA,IAEpD,YAAY,EAAE,QAAQ,QAAQ,MAAM,mBAAmB;AAAA;AAAA,IAEvD,gBAAgB,EAAE,QAAQ,QAAQ,MAAM,uBAAuB;AAAA;AAAA,IAE/D,UAAU,EAAE,QAAQ,QAAQ,MAAM,gBAAgB;AAAA;AAAA,IAElD,UAAU,EAAE,QAAQ,OAAO,MAAM,gBAAgB;AAAA,EACrD;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@rebuy/rebuy/server` — server-only foundations for the CAB proxy (rebuy-api). Phase 2 exposes the
|
|
3
|
+
* shared rail: the error taxonomy (`UpstreamError`/`NotFoundError`) and the injection contract
|
|
4
|
+
* (`UpstreamFetch`/`ServerContext`) plus the input types. The widget-conversion / section-composition
|
|
5
|
+
* orchestrators are added to this barrel in their later phases.
|
|
6
|
+
*/
|
|
7
|
+
export { NotFoundError, REBUY_ENGINE_HOST, UpstreamError, type AnalyticsEventInput, type AnalyticsInput, type CartInput, type CartLineInput, type DataSourceInput, type GiftInput, type GiftValidationInput, type MonetizeInput, type ServerContext, type UpstreamFetch, type UserConfigInput, type WidgetSettingsInput, } from '../server/shared';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACH,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,mBAAmB,GAC3B,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/server/index.ts
|
|
21
|
+
var server_exports = {};
|
|
22
|
+
__export(server_exports, {
|
|
23
|
+
NotFoundError: () => NotFoundError,
|
|
24
|
+
REBUY_ENGINE_HOST: () => REBUY_ENGINE_HOST,
|
|
25
|
+
UpstreamError: () => UpstreamError
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(server_exports);
|
|
28
|
+
|
|
29
|
+
// src/server/shared.ts
|
|
30
|
+
var REBUY_ENGINE_HOST = "rebuyengine.com";
|
|
31
|
+
var UpstreamError = class extends Error {
|
|
32
|
+
constructor(status, body, message) {
|
|
33
|
+
super(message ?? `Upstream returned ${status}`);
|
|
34
|
+
this.body = body;
|
|
35
|
+
this.name = "UpstreamError";
|
|
36
|
+
this.status = status;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var NotFoundError = class extends Error {
|
|
40
|
+
constructor(message) {
|
|
41
|
+
super(message);
|
|
42
|
+
this.name = "NotFoundError";
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/server/index.ts", "../../src/server/shared.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * `@rebuy/rebuy/server` \u2014 server-only foundations for the CAB proxy (rebuy-api). Phase 2 exposes the\n * shared rail: the error taxonomy (`UpstreamError`/`NotFoundError`) and the injection contract\n * (`UpstreamFetch`/`ServerContext`) plus the input types. The widget-conversion / section-composition\n * orchestrators are added to this barrel in their later phases.\n */\nexport {\n NotFoundError,\n REBUY_ENGINE_HOST,\n UpstreamError,\n type AnalyticsEventInput,\n type AnalyticsInput,\n type CartInput,\n type CartLineInput,\n type DataSourceInput,\n type GiftInput,\n type GiftValidationInput,\n type MonetizeInput,\n type ServerContext,\n type UpstreamFetch,\n type UserConfigInput,\n type WidgetSettingsInput,\n} from '~/server/shared';\n", "/**\n * Server-only foundations for the widget-conversion / section-composition orchestrators. This subpath\n * (`@rebuy/rebuy/server`) is never imported by the browser extension \u2014 it owns the logic a thin API\n * service (rebuy-api) delegates to, with the actual network egress injected as {@link UpstreamFetch}.\n */\n\n/** Production engine host; any other host is a staging/ephemeral upstream. */\nexport const REBUY_ENGINE_HOST = 'rebuyengine.com';\n\n/**\n * Calls the legacy Rebuy engine at `https://<host><path>` and returns parsed JSON. Injected by the\n * caller (rebuy-api owns the egress, timeouts, and the `X-Rebuy-Upstream` proxy header); MUST throw\n * {@link UpstreamError} on a non-2xx response so orchestrators can interpret the status.\n *\n * Defaults to GET with `params`/`search` as the query string. Pass `method: 'POST'` with `body` (JSON\n * body) and optional `headers` (e.g. an auth token) for write-style calls like analytics ingest.\n */\nexport type UpstreamFetch = (\n path: string,\n params: Record<string, string>,\n options?: {\n body?: unknown;\n headers?: Record<string, string>;\n host?: string;\n method?: 'GET' | 'POST';\n search?: string;\n }\n) => Promise<unknown>;\n\n/** Request-scoped dependencies every orchestrator needs. */\nexport type ServerContext = {\n fetchUpstream: UpstreamFetch;\n host: string;\n /** Browser user-agent forwarded to the ads engine (the checkout worker can't read it). Monetize only. */\n userAgent?: string;\n};\n\n/** Thrown by the injected {@link UpstreamFetch} when the engine returns a non-2xx response. */\nexport class UpstreamError extends Error {\n readonly body: unknown;\n readonly status: number;\n\n constructor(status: number, body: unknown, message?: string) {\n super(message ?? `Upstream returned ${status}`);\n this.body = body;\n this.name = 'UpstreamError';\n this.status = status;\n }\n}\n\n/** Thrown when the requested widget / shop / data source doesn't exist; the route maps it to 404. */\nexport class NotFoundError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'NotFoundError';\n }\n}\n\n/** A cart line in the live-cart context the engine evaluates against. */\nexport type CartLineInput = {\n productId: string;\n /** Line-item properties (raw key/value pairs); the engine receives them JSON-encoded. */\n properties?: { key: string; value?: string }[];\n quantity: number;\n subscriptionId?: string;\n variantId: string;\n};\n\n/** The live cart context shared by the data-source, gift-validation, and monetize inputs. */\nexport type CartInput = {\n /** Cart-level attributes (raw key/value pairs); the engine receives them JSON-encoded. */\n attributes?: { key: string; value?: string }[];\n /** Applied discount codes; the engine evaluates `discount_code` rules against them (sent as `[{code}]`). */\n discountCodes?: string[];\n /** Presentment cents of cart-level discount allocations, subtracted from `subtotal` for the engine. */\n discountTotal?: number;\n items: CartLineInput[];\n /** Presentment subtotal in cents. */\n subtotal: number;\n};\n\n/** Input for `convertWidgetSettings`. */\nexport type WidgetSettingsInput = {\n cacheKey?: number;\n id: number;\n key?: string;\n shop: string;\n /** Stable per-buyer id; when present, enables sticky server-side A/B variant selection. */\n visitorId?: string;\n};\n\n/** Input for `fetchUserConfig`. */\nexport type UserConfigInput = { shop: string };\n\n/** Input for `fetchDataSourceResults`. */\nexport type DataSourceInput = {\n cart: CartInput;\n customerId?: string;\n dataSourcePath: string;\n integrations?: Record<string, boolean>;\n limit: number;\n productType?: 'both' | 'one-time' | 'subscription';\n shop: string;\n visitorId?: string;\n};\n\n/** A gift line the gift-validation watcher asks the server to validate. */\nexport type GiftInput = {\n cost: number;\n discounted: boolean;\n lineId: string;\n productId: number;\n widgetId: number;\n};\n\n/** Input for `validateGifts`. */\nexport type GiftValidationInput = {\n cart: CartInput;\n customerId?: string;\n gifts: GiftInput[];\n shop: string;\n visitorId?: string;\n};\n\n/** Input for `fetchMonetizeOffers`. */\nexport type MonetizeInput = {\n cart: CartInput;\n country?: string;\n currency?: string;\n customerId?: string;\n placement: 'order_status' | 'thank_you_page';\n shop: string;\n visitorId?: string;\n};\n\n/** A generic analytics event from the extension; the server maps `name` \u2192 the engine's noun/verb/subject. */\nexport type AnalyticsEventInput = {\n name: string;\n properties?: Record<string, unknown>;\n sentAt?: string;\n};\n\n/** Input for `postAnalyticsEvents`: a batch of events plus the request-scoped identity fields. */\nexport type AnalyticsInput = {\n /** Rebuy cart token (the `r_cart_token` cart attribute), when available \u2014 primary aggregation key. */\n cartToken?: string;\n /** Shopify checkout token, when available \u2014 drives cart/checkout aggregation downstream. */\n checkoutToken?: string;\n events: AnalyticsEventInput[];\n shop: string;\n visitorId: string;\n /** The widget id (smartBlockId) the events belong to. */\n widgetId?: string;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,IAAM,oBAAoB;AA+B1B,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAIrC,YAAY,QAAgB,MAAe,SAAkB;AACzD,UAAM,WAAW,qBAAqB,MAAM,EAAE;AAC9C,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AAAA,EAClB;AACJ;AAGO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACrC,YAAY,SAAiB;AACzB,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EAChB;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/server/shared.ts
|
|
2
|
+
var REBUY_ENGINE_HOST = "rebuyengine.com";
|
|
3
|
+
var UpstreamError = class extends Error {
|
|
4
|
+
constructor(status, body, message) {
|
|
5
|
+
super(message ?? `Upstream returned ${status}`);
|
|
6
|
+
this.body = body;
|
|
7
|
+
this.name = "UpstreamError";
|
|
8
|
+
this.status = status;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
var NotFoundError = class extends Error {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "NotFoundError";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
NotFoundError,
|
|
19
|
+
REBUY_ENGINE_HOST,
|
|
20
|
+
UpstreamError
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/server/shared.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Server-only foundations for the widget-conversion / section-composition orchestrators. This subpath\n * (`@rebuy/rebuy/server`) is never imported by the browser extension \u2014 it owns the logic a thin API\n * service (rebuy-api) delegates to, with the actual network egress injected as {@link UpstreamFetch}.\n */\n\n/** Production engine host; any other host is a staging/ephemeral upstream. */\nexport const REBUY_ENGINE_HOST = 'rebuyengine.com';\n\n/**\n * Calls the legacy Rebuy engine at `https://<host><path>` and returns parsed JSON. Injected by the\n * caller (rebuy-api owns the egress, timeouts, and the `X-Rebuy-Upstream` proxy header); MUST throw\n * {@link UpstreamError} on a non-2xx response so orchestrators can interpret the status.\n *\n * Defaults to GET with `params`/`search` as the query string. Pass `method: 'POST'` with `body` (JSON\n * body) and optional `headers` (e.g. an auth token) for write-style calls like analytics ingest.\n */\nexport type UpstreamFetch = (\n path: string,\n params: Record<string, string>,\n options?: {\n body?: unknown;\n headers?: Record<string, string>;\n host?: string;\n method?: 'GET' | 'POST';\n search?: string;\n }\n) => Promise<unknown>;\n\n/** Request-scoped dependencies every orchestrator needs. */\nexport type ServerContext = {\n fetchUpstream: UpstreamFetch;\n host: string;\n /** Browser user-agent forwarded to the ads engine (the checkout worker can't read it). Monetize only. */\n userAgent?: string;\n};\n\n/** Thrown by the injected {@link UpstreamFetch} when the engine returns a non-2xx response. */\nexport class UpstreamError extends Error {\n readonly body: unknown;\n readonly status: number;\n\n constructor(status: number, body: unknown, message?: string) {\n super(message ?? `Upstream returned ${status}`);\n this.body = body;\n this.name = 'UpstreamError';\n this.status = status;\n }\n}\n\n/** Thrown when the requested widget / shop / data source doesn't exist; the route maps it to 404. */\nexport class NotFoundError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'NotFoundError';\n }\n}\n\n/** A cart line in the live-cart context the engine evaluates against. */\nexport type CartLineInput = {\n productId: string;\n /** Line-item properties (raw key/value pairs); the engine receives them JSON-encoded. */\n properties?: { key: string; value?: string }[];\n quantity: number;\n subscriptionId?: string;\n variantId: string;\n};\n\n/** The live cart context shared by the data-source, gift-validation, and monetize inputs. */\nexport type CartInput = {\n /** Cart-level attributes (raw key/value pairs); the engine receives them JSON-encoded. */\n attributes?: { key: string; value?: string }[];\n /** Applied discount codes; the engine evaluates `discount_code` rules against them (sent as `[{code}]`). */\n discountCodes?: string[];\n /** Presentment cents of cart-level discount allocations, subtracted from `subtotal` for the engine. */\n discountTotal?: number;\n items: CartLineInput[];\n /** Presentment subtotal in cents. */\n subtotal: number;\n};\n\n/** Input for `convertWidgetSettings`. */\nexport type WidgetSettingsInput = {\n cacheKey?: number;\n id: number;\n key?: string;\n shop: string;\n /** Stable per-buyer id; when present, enables sticky server-side A/B variant selection. */\n visitorId?: string;\n};\n\n/** Input for `fetchUserConfig`. */\nexport type UserConfigInput = { shop: string };\n\n/** Input for `fetchDataSourceResults`. */\nexport type DataSourceInput = {\n cart: CartInput;\n customerId?: string;\n dataSourcePath: string;\n integrations?: Record<string, boolean>;\n limit: number;\n productType?: 'both' | 'one-time' | 'subscription';\n shop: string;\n visitorId?: string;\n};\n\n/** A gift line the gift-validation watcher asks the server to validate. */\nexport type GiftInput = {\n cost: number;\n discounted: boolean;\n lineId: string;\n productId: number;\n widgetId: number;\n};\n\n/** Input for `validateGifts`. */\nexport type GiftValidationInput = {\n cart: CartInput;\n customerId?: string;\n gifts: GiftInput[];\n shop: string;\n visitorId?: string;\n};\n\n/** Input for `fetchMonetizeOffers`. */\nexport type MonetizeInput = {\n cart: CartInput;\n country?: string;\n currency?: string;\n customerId?: string;\n placement: 'order_status' | 'thank_you_page';\n shop: string;\n visitorId?: string;\n};\n\n/** A generic analytics event from the extension; the server maps `name` \u2192 the engine's noun/verb/subject. */\nexport type AnalyticsEventInput = {\n name: string;\n properties?: Record<string, unknown>;\n sentAt?: string;\n};\n\n/** Input for `postAnalyticsEvents`: a batch of events plus the request-scoped identity fields. */\nexport type AnalyticsInput = {\n /** Rebuy cart token (the `r_cart_token` cart attribute), when available \u2014 primary aggregation key. */\n cartToken?: string;\n /** Shopify checkout token, when available \u2014 drives cart/checkout aggregation downstream. */\n checkoutToken?: string;\n events: AnalyticsEventInput[];\n shop: string;\n visitorId: string;\n /** The widget id (smartBlockId) the events belong to. */\n widgetId?: string;\n};\n"],
|
|
5
|
+
"mappings": ";AAOO,IAAM,oBAAoB;AA+B1B,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAIrC,YAAY,QAAgB,MAAe,SAAkB;AACzD,UAAM,WAAW,qBAAqB,MAAM,EAAE;AAC9C,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,SAAS;AAAA,EAClB;AACJ;AAGO,IAAM,gBAAN,cAA4B,MAAM;AAAA,EACrC,YAAY,SAAiB;AACzB,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EAChB;AACJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-only foundations for the widget-conversion / section-composition orchestrators. This subpath
|
|
3
|
+
* (`@rebuy/rebuy/server`) is never imported by the browser extension — it owns the logic a thin API
|
|
4
|
+
* service (rebuy-api) delegates to, with the actual network egress injected as {@link UpstreamFetch}.
|
|
5
|
+
*/
|
|
6
|
+
/** Production engine host; any other host is a staging/ephemeral upstream. */
|
|
7
|
+
export declare const REBUY_ENGINE_HOST = "rebuyengine.com";
|
|
8
|
+
/**
|
|
9
|
+
* Calls the legacy Rebuy engine at `https://<host><path>` and returns parsed JSON. Injected by the
|
|
10
|
+
* caller (rebuy-api owns the egress, timeouts, and the `X-Rebuy-Upstream` proxy header); MUST throw
|
|
11
|
+
* {@link UpstreamError} on a non-2xx response so orchestrators can interpret the status.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to GET with `params`/`search` as the query string. Pass `method: 'POST'` with `body` (JSON
|
|
14
|
+
* body) and optional `headers` (e.g. an auth token) for write-style calls like analytics ingest.
|
|
15
|
+
*/
|
|
16
|
+
export type UpstreamFetch = (path: string, params: Record<string, string>, options?: {
|
|
17
|
+
body?: unknown;
|
|
18
|
+
headers?: Record<string, string>;
|
|
19
|
+
host?: string;
|
|
20
|
+
method?: 'GET' | 'POST';
|
|
21
|
+
search?: string;
|
|
22
|
+
}) => Promise<unknown>;
|
|
23
|
+
/** Request-scoped dependencies every orchestrator needs. */
|
|
24
|
+
export type ServerContext = {
|
|
25
|
+
fetchUpstream: UpstreamFetch;
|
|
26
|
+
host: string;
|
|
27
|
+
/** Browser user-agent forwarded to the ads engine (the checkout worker can't read it). Monetize only. */
|
|
28
|
+
userAgent?: string;
|
|
29
|
+
};
|
|
30
|
+
/** Thrown by the injected {@link UpstreamFetch} when the engine returns a non-2xx response. */
|
|
31
|
+
export declare class UpstreamError extends Error {
|
|
32
|
+
readonly body: unknown;
|
|
33
|
+
readonly status: number;
|
|
34
|
+
constructor(status: number, body: unknown, message?: string);
|
|
35
|
+
}
|
|
36
|
+
/** Thrown when the requested widget / shop / data source doesn't exist; the route maps it to 404. */
|
|
37
|
+
export declare class NotFoundError extends Error {
|
|
38
|
+
constructor(message: string);
|
|
39
|
+
}
|
|
40
|
+
/** A cart line in the live-cart context the engine evaluates against. */
|
|
41
|
+
export type CartLineInput = {
|
|
42
|
+
productId: string;
|
|
43
|
+
/** Line-item properties (raw key/value pairs); the engine receives them JSON-encoded. */
|
|
44
|
+
properties?: {
|
|
45
|
+
key: string;
|
|
46
|
+
value?: string;
|
|
47
|
+
}[];
|
|
48
|
+
quantity: number;
|
|
49
|
+
subscriptionId?: string;
|
|
50
|
+
variantId: string;
|
|
51
|
+
};
|
|
52
|
+
/** The live cart context shared by the data-source, gift-validation, and monetize inputs. */
|
|
53
|
+
export type CartInput = {
|
|
54
|
+
/** Cart-level attributes (raw key/value pairs); the engine receives them JSON-encoded. */
|
|
55
|
+
attributes?: {
|
|
56
|
+
key: string;
|
|
57
|
+
value?: string;
|
|
58
|
+
}[];
|
|
59
|
+
/** Applied discount codes; the engine evaluates `discount_code` rules against them (sent as `[{code}]`). */
|
|
60
|
+
discountCodes?: string[];
|
|
61
|
+
/** Presentment cents of cart-level discount allocations, subtracted from `subtotal` for the engine. */
|
|
62
|
+
discountTotal?: number;
|
|
63
|
+
items: CartLineInput[];
|
|
64
|
+
/** Presentment subtotal in cents. */
|
|
65
|
+
subtotal: number;
|
|
66
|
+
};
|
|
67
|
+
/** Input for `convertWidgetSettings`. */
|
|
68
|
+
export type WidgetSettingsInput = {
|
|
69
|
+
cacheKey?: number;
|
|
70
|
+
id: number;
|
|
71
|
+
key?: string;
|
|
72
|
+
shop: string;
|
|
73
|
+
/** Stable per-buyer id; when present, enables sticky server-side A/B variant selection. */
|
|
74
|
+
visitorId?: string;
|
|
75
|
+
};
|
|
76
|
+
/** Input for `fetchUserConfig`. */
|
|
77
|
+
export type UserConfigInput = {
|
|
78
|
+
shop: string;
|
|
79
|
+
};
|
|
80
|
+
/** Input for `fetchDataSourceResults`. */
|
|
81
|
+
export type DataSourceInput = {
|
|
82
|
+
cart: CartInput;
|
|
83
|
+
customerId?: string;
|
|
84
|
+
dataSourcePath: string;
|
|
85
|
+
integrations?: Record<string, boolean>;
|
|
86
|
+
limit: number;
|
|
87
|
+
productType?: 'both' | 'one-time' | 'subscription';
|
|
88
|
+
shop: string;
|
|
89
|
+
visitorId?: string;
|
|
90
|
+
};
|
|
91
|
+
/** A gift line the gift-validation watcher asks the server to validate. */
|
|
92
|
+
export type GiftInput = {
|
|
93
|
+
cost: number;
|
|
94
|
+
discounted: boolean;
|
|
95
|
+
lineId: string;
|
|
96
|
+
productId: number;
|
|
97
|
+
widgetId: number;
|
|
98
|
+
};
|
|
99
|
+
/** Input for `validateGifts`. */
|
|
100
|
+
export type GiftValidationInput = {
|
|
101
|
+
cart: CartInput;
|
|
102
|
+
customerId?: string;
|
|
103
|
+
gifts: GiftInput[];
|
|
104
|
+
shop: string;
|
|
105
|
+
visitorId?: string;
|
|
106
|
+
};
|
|
107
|
+
/** Input for `fetchMonetizeOffers`. */
|
|
108
|
+
export type MonetizeInput = {
|
|
109
|
+
cart: CartInput;
|
|
110
|
+
country?: string;
|
|
111
|
+
currency?: string;
|
|
112
|
+
customerId?: string;
|
|
113
|
+
placement: 'order_status' | 'thank_you_page';
|
|
114
|
+
shop: string;
|
|
115
|
+
visitorId?: string;
|
|
116
|
+
};
|
|
117
|
+
/** A generic analytics event from the extension; the server maps `name` → the engine's noun/verb/subject. */
|
|
118
|
+
export type AnalyticsEventInput = {
|
|
119
|
+
name: string;
|
|
120
|
+
properties?: Record<string, unknown>;
|
|
121
|
+
sentAt?: string;
|
|
122
|
+
};
|
|
123
|
+
/** Input for `postAnalyticsEvents`: a batch of events plus the request-scoped identity fields. */
|
|
124
|
+
export type AnalyticsInput = {
|
|
125
|
+
/** Rebuy cart token (the `r_cart_token` cart attribute), when available — primary aggregation key. */
|
|
126
|
+
cartToken?: string;
|
|
127
|
+
/** Shopify checkout token, when available — drives cart/checkout aggregation downstream. */
|
|
128
|
+
checkoutToken?: string;
|
|
129
|
+
events: AnalyticsEventInput[];
|
|
130
|
+
shop: string;
|
|
131
|
+
visitorId: string;
|
|
132
|
+
/** The widget id (smartBlockId) the events belong to. */
|
|
133
|
+
widgetId?: string;
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/server/shared.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CABImageSection } from '
|
|
2
|
-
import { CABLayoutSection } from '
|
|
3
|
-
import { type V1ImageBlock } from '
|
|
1
|
+
import { CABImageSection } from '../../schema/widgets/checkout-and-beyond/image';
|
|
2
|
+
import { CABLayoutSection } from '../../schema/widgets/checkout-and-beyond/layout';
|
|
3
|
+
import { type V1ImageBlock } from '../../transforms/contentBlockV1/types';
|
|
4
4
|
export declare const convertContentBlockImageToV2: (block: V1ImageBlock) => CABImageSection | CABLayoutSection;
|
|
5
5
|
//# sourceMappingURL=convertContentBlockImageToV2.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TiptapDocument } from '
|
|
2
|
-
import { type V1Language } from '
|
|
1
|
+
import { TiptapDocument } from '../../schema/widgets/checkout-and-beyond/text';
|
|
2
|
+
import { type V1Language } from '../../transforms/contentBlockV1/types';
|
|
3
3
|
export declare const convertContentBlockTextToV2: (language: V1Language | undefined) => TiptapDocument;
|
|
4
4
|
//# sourceMappingURL=convertContentBlockTextToV2.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CABRootSection } from '
|
|
2
|
-
import { type V1ConvertInput } from '
|
|
1
|
+
import { CABRootSection } from '../../schema/widgets/checkout-and-beyond/root';
|
|
2
|
+
import { type V1ConvertInput } from '../../transforms/contentBlockV1/types';
|
|
3
3
|
/** Translates a v1 content-block widget into a fully-formed `CABRootSection`. */
|
|
4
4
|
export declare const convertContentBlockToV2: ({ id, settings }: V1ConvertInput) => CABRootSection;
|
|
5
5
|
//# sourceMappingURL=convertContentBlockToV2.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type TextColorName, type TextSizeName } from '
|
|
2
|
-
import { type Mark } from '
|
|
1
|
+
import { type TextColorName, type TextSizeName } from '../../schema/widgets/checkout-and-beyond/common';
|
|
2
|
+
import { type Mark } from '../../transforms/htmlToTiptap/types';
|
|
3
3
|
export declare const buildDefaultTextStyleMark: (style: {
|
|
4
4
|
color?: TextColorName;
|
|
5
5
|
fontSize?: TextSizeName;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Spacing, type TextColorName, type TextSizeName } from '
|
|
2
|
-
import { type TiptapDocument } from '
|
|
1
|
+
import { type Spacing, type TextColorName, type TextSizeName } from '../../schema/widgets/checkout-and-beyond/common';
|
|
2
|
+
import { type TiptapDocument } from '../../schema/widgets/checkout-and-beyond/text';
|
|
3
3
|
export type HtmlToTiptapOptions = {
|
|
4
4
|
blockSpacing?: Spacing;
|
|
5
5
|
defaultTextStyle?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Spacing } from '
|
|
2
|
-
import { TiptapDocument, type TiptapParagraph } from '
|
|
1
|
+
import { type Spacing } from '../../schema/widgets/checkout-and-beyond/common';
|
|
2
|
+
import { TiptapDocument, type TiptapParagraph } from '../../schema/widgets/checkout-and-beyond/text';
|
|
3
3
|
export declare const makeDoc: (content: TiptapParagraph[], blockSpacing: Spacing) => TiptapDocument;
|
|
4
4
|
//# sourceMappingURL=makeDoc.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TiptapParagraph, type TiptapText } from '
|
|
1
|
+
import { TiptapParagraph, type TiptapText } from '../../schema/widgets/checkout-and-beyond/text';
|
|
2
2
|
export declare const makeParagraph: (content: TiptapText[]) => TiptapParagraph;
|
|
3
3
|
//# sourceMappingURL=makeParagraph.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TiptapParagraph, type TiptapText } from '
|
|
1
|
+
import { type TiptapParagraph, type TiptapText } from '../../schema/widgets/checkout-and-beyond/text';
|
|
2
2
|
export type Mark = NonNullable<TiptapText['marks']>[number];
|
|
3
3
|
export type StackEntry = {
|
|
4
4
|
marks: Mark[];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { convertNumericObjects } from '
|
|
2
|
-
export { type DeepCamelCase, deepCamelCase, type ToCamelCase } from '
|
|
3
|
-
export { type HtmlToTiptapOptions, htmlToTiptap } from '
|
|
4
|
-
export { isCABRootSection } from '
|
|
5
|
-
export { normalizeTextContent } from '
|
|
6
|
-
export { normalizeTokens } from '
|
|
7
|
-
export { parseShielded } from '
|
|
8
|
-
export { CONTENT_BLOCK_MAX_IMAGE_WIDTH, isContentBlockV1, SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK, type V1ConvertInput, type V1ImageBlock, type V1ImagePlacement, type V1Language, type V1Settings, } from '
|
|
9
|
-
export { convertContentBlockImageToV2 } from '
|
|
10
|
-
export { convertContentBlockTextToV2 } from '
|
|
11
|
-
export { convertContentBlockToV2 } from '
|
|
12
|
-
export { convertTextToTiptapParagraph } from '
|
|
1
|
+
export { convertNumericObjects } from '../transforms/convertNumericObjects';
|
|
2
|
+
export { type DeepCamelCase, deepCamelCase, type ToCamelCase } from '../transforms/deepCamelCase';
|
|
3
|
+
export { type HtmlToTiptapOptions, htmlToTiptap } from '../transforms/htmlToTiptap/htmlToTiptap';
|
|
4
|
+
export { isCABRootSection } from '../transforms/isCABRootSection';
|
|
5
|
+
export { normalizeTextContent } from '../transforms/normalizeTextContent';
|
|
6
|
+
export { normalizeTokens } from '../transforms/normalizeTokens';
|
|
7
|
+
export { parseShielded } from '../transforms/parseShielded';
|
|
8
|
+
export { CONTENT_BLOCK_MAX_IMAGE_WIDTH, isContentBlockV1, SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK, type V1ConvertInput, type V1ImageBlock, type V1ImagePlacement, type V1Language, type V1Settings, } from '../transforms/contentBlockV1/types';
|
|
9
|
+
export { convertContentBlockImageToV2 } from '../transforms/contentBlockV1/convertContentBlockImageToV2';
|
|
10
|
+
export { convertContentBlockTextToV2 } from '../transforms/contentBlockV1/convertContentBlockTextToV2';
|
|
11
|
+
export { convertContentBlockToV2 } from '../transforms/contentBlockV1/convertContentBlockToV2';
|
|
12
|
+
export { convertTextToTiptapParagraph } from '../transforms/contentBlockV1/convertTextToTiptapParagraph';
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebuy/rebuy",
|
|
3
3
|
"description": "This is the default library for Rebuy",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.26.0-rc.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Rebuy, Inc.",
|
|
7
7
|
"type": "module",
|
|
@@ -20,6 +20,16 @@
|
|
|
20
20
|
"import": "./dist/client.mjs",
|
|
21
21
|
"require": "./dist/client.js"
|
|
22
22
|
},
|
|
23
|
+
"./routes": {
|
|
24
|
+
"types": "./dist/routes.d.ts",
|
|
25
|
+
"import": "./dist/routes.mjs",
|
|
26
|
+
"require": "./dist/routes.js"
|
|
27
|
+
},
|
|
28
|
+
"./server": {
|
|
29
|
+
"types": "./dist/server/index.d.ts",
|
|
30
|
+
"import": "./dist/server/index.mjs",
|
|
31
|
+
"require": "./dist/server/index.js"
|
|
32
|
+
},
|
|
23
33
|
"./utilities": {
|
|
24
34
|
"types": "./dist/utilities.d.ts",
|
|
25
35
|
"import": "./dist/utilities.mjs",
|
|
@@ -66,7 +76,7 @@
|
|
|
66
76
|
"scripts": {
|
|
67
77
|
"build": "npm run clean && npm run build:types && npm run build:code",
|
|
68
78
|
"build:code": "node esbuild.config.mjs",
|
|
69
|
-
"build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly --outDir dist",
|
|
79
|
+
"build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly --outDir dist && tsc-alias --project tsconfig.build.json",
|
|
70
80
|
"build:watch": "npm run clean && npm run build:types && node esbuild.config.mjs --watch",
|
|
71
81
|
"check-types": "tsc --noEmit",
|
|
72
82
|
"clean": "rm -rf dist",
|
|
@@ -126,6 +136,7 @@
|
|
|
126
136
|
"react-hook-form": "^7.69.0",
|
|
127
137
|
"semantic-release": "^24.2.5",
|
|
128
138
|
"sort-package-json": "^3.2.1",
|
|
139
|
+
"tsc-alias": "^1.8.16",
|
|
129
140
|
"typescript": "^5.8.3",
|
|
130
141
|
"vitest": "^4.1.8",
|
|
131
142
|
"zod": "^3.25.76"
|