@brytdesigns/shopify-ajax-cart-api 1.0.43 → 3.0.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.
- package/dist/effect/api/CartAdd.js +36 -9
- package/dist/effect/api/CartAdd.js.map +1 -1
- package/dist/effect/api/CartChange.js +32 -9
- package/dist/effect/api/CartChange.js.map +1 -1
- package/dist/effect/api/CartClear.js +26 -9
- package/dist/effect/api/CartClear.js.map +1 -1
- package/dist/effect/api/CartGet.js +35 -9
- package/dist/effect/api/CartGet.js.map +1 -1
- package/dist/effect/api/CartUpdate.js +31 -9
- package/dist/effect/api/CartUpdate.js.map +1 -1
- package/dist/effect/index.d.ts +1746 -899
- package/dist/effect/index.js +13 -13
- package/dist/effect/index.js.map +1 -1
- package/dist/effect/schema.js +970 -1059
- package/dist/effect/schema.js.map +1 -1
- package/dist/main/effect/api/CartAdd.js +36 -9
- package/dist/main/effect/api/CartAdd.js.map +1 -1
- package/dist/main/effect/api/CartChange.js +32 -9
- package/dist/main/effect/api/CartChange.js.map +1 -1
- package/dist/main/effect/api/CartClear.js +26 -9
- package/dist/main/effect/api/CartClear.js.map +1 -1
- package/dist/main/effect/api/CartGet.js +35 -9
- package/dist/main/effect/api/CartGet.js.map +1 -1
- package/dist/main/effect/api/CartUpdate.js +31 -9
- package/dist/main/effect/api/CartUpdate.js.map +1 -1
- package/dist/main/effect/index.js +13 -13
- package/dist/main/effect/index.js.map +1 -1
- package/dist/main/effect/schema.js +970 -1059
- package/dist/main/effect/schema.js.map +1 -1
- package/dist/main/index.d.ts +586 -1808
- package/dist/main/index.js +123 -235
- package/dist/main/index.js.map +1 -1
- package/package.json +11 -13
- package/dist/esm/index.js +0 -19525
- package/dist/esm/index.js.map +0 -1
|
@@ -1,12 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as AjaxClient from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { CartAddInput, makeCartAddOutput } from "../schema.js";
|
|
2
|
+
import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
|
|
3
|
+
//#region src/effect/api/CartAdd.ts
|
|
4
|
+
/**
|
|
5
|
+
* Describes a request that adds items to the cart.
|
|
6
|
+
*
|
|
7
|
+
* Returns a description rather than an effect: pipe it through the
|
|
8
|
+
* `shopify-ajax-client` combinators and finish with `execute`.
|
|
9
|
+
*
|
|
10
|
+
* @param input - The items to add.
|
|
11
|
+
* @returns An `AjaxRequest` decoding to the updated cart.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
|
|
16
|
+
* import * as Effect from "effect/Effect";
|
|
17
|
+
* import { make as addToCart } from "./CartAdd.js";
|
|
18
|
+
*
|
|
19
|
+
* const cart = await Effect.runPromise(
|
|
20
|
+
* addToCart({ items: [{ id: 123, quantity: 2 }] }).pipe(
|
|
21
|
+
* AjaxClient.execute,
|
|
22
|
+
* Effect.provide(AjaxClient.layer),
|
|
23
|
+
* ),
|
|
24
|
+
* );
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* A non-200 fails with `AjaxResponseError` rather than resolving to an
|
|
28
|
+
* envelope, so a sold-out variant is a failure you catch, not a field you
|
|
29
|
+
* check.
|
|
30
|
+
*/
|
|
31
|
+
var make = AjaxClient.makeRoute({
|
|
32
|
+
routeName: "cart_add_url",
|
|
33
|
+
inputSchema: CartAddInput,
|
|
34
|
+
outputSchema: makeCartAddOutput
|
|
8
35
|
});
|
|
9
|
-
|
|
36
|
+
//#endregion
|
|
10
37
|
export { make };
|
|
11
|
-
|
|
38
|
+
|
|
12
39
|
//# sourceMappingURL=CartAdd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"CartAdd.js","names":[],"sources":["../../../src/effect/api/CartAdd.ts"],"sourcesContent":["import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\nimport { CartAddInput, makeCartAddOutput } from \"../schema.js\";\n\nexport type AddInput = CartAddInput;\n\n/**\n * Describes a request that adds items to the cart.\n *\n * Returns a description rather than an effect: pipe it through the\n * `shopify-ajax-client` combinators and finish with `execute`.\n *\n * @param input - The items to add.\n * @returns An `AjaxRequest` decoding to the updated cart.\n *\n * @example\n * ```typescript\n * import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n * import * as Effect from \"effect/Effect\";\n * import { make as addToCart } from \"./CartAdd.js\";\n *\n * const cart = await Effect.runPromise(\n * addToCart({ items: [{ id: 123, quantity: 2 }] }).pipe(\n * AjaxClient.execute,\n * Effect.provide(AjaxClient.layer),\n * ),\n * );\n * ```\n *\n * A non-200 fails with `AjaxResponseError` rather than resolving to an\n * envelope, so a sold-out variant is a failure you catch, not a field you\n * check.\n */\nexport const make = AjaxClient.makeRoute({\n\trouteName: \"cart_add_url\",\n\tinputSchema: CartAddInput,\n\toutputSchema: makeCartAddOutput,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,IAAa,OAAO,WAAW,UAAU;CACxC,WAAW;CACX,aAAa;CACb,cAAc;AACf,CAAC"}
|
|
@@ -1,12 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as AjaxClient from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { CartChangeInput, makeCartChangeOutput } from "../schema.js";
|
|
2
|
+
import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
|
|
3
|
+
//#region src/effect/api/CartChange.ts
|
|
4
|
+
/**
|
|
5
|
+
* Describes a request that changes one cart line.
|
|
6
|
+
*
|
|
7
|
+
* Identify the line by `id` (its key) or by `line` (its 1-based position), and
|
|
8
|
+
* supply any of `quantity`, `properties` or `selling_plan`.
|
|
9
|
+
*
|
|
10
|
+
* @param input - The line to change, and what to change about it.
|
|
11
|
+
* @returns An `AjaxRequest` decoding to the updated cart.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
|
|
16
|
+
* import * as Effect from "effect/Effect";
|
|
17
|
+
* import { make as changeLine } from "./CartChange.js";
|
|
18
|
+
*
|
|
19
|
+
* const cart = await Effect.runPromise(
|
|
20
|
+
* changeLine({ id: "44632334532825:694d7922", quantity: 2 }).pipe(
|
|
21
|
+
* AjaxClient.execute,
|
|
22
|
+
* Effect.provide(AjaxClient.layer),
|
|
23
|
+
* ),
|
|
24
|
+
* );
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
var make = AjaxClient.makeRoute({
|
|
28
|
+
routeName: "cart_change_url",
|
|
29
|
+
inputSchema: CartChangeInput,
|
|
30
|
+
outputSchema: makeCartChangeOutput
|
|
8
31
|
});
|
|
9
|
-
|
|
32
|
+
//#endregion
|
|
10
33
|
export { make };
|
|
11
|
-
|
|
34
|
+
|
|
12
35
|
//# sourceMappingURL=CartChange.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"CartChange.js","names":[],"sources":["../../../src/effect/api/CartChange.ts"],"sourcesContent":["import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\nimport { CartChangeInput, makeCartChangeOutput } from \"../schema.js\";\n\nexport type ChangeInput = CartChangeInput;\n\n/**\n * Describes a request that changes one cart line.\n *\n * Identify the line by `id` (its key) or by `line` (its 1-based position), and\n * supply any of `quantity`, `properties` or `selling_plan`.\n *\n * @param input - The line to change, and what to change about it.\n * @returns An `AjaxRequest` decoding to the updated cart.\n *\n * @example\n * ```typescript\n * import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n * import * as Effect from \"effect/Effect\";\n * import { make as changeLine } from \"./CartChange.js\";\n *\n * const cart = await Effect.runPromise(\n * changeLine({ id: \"44632334532825:694d7922\", quantity: 2 }).pipe(\n * AjaxClient.execute,\n * Effect.provide(AjaxClient.layer),\n * ),\n * );\n * ```\n */\nexport const make = AjaxClient.makeRoute({\n\trouteName: \"cart_change_url\",\n\tinputSchema: CartChangeInput,\n\toutputSchema: makeCartChangeOutput,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,OAAO,WAAW,UAAU;CACxC,WAAW;CACX,aAAa;CACb,cAAc;AACf,CAAC"}
|
|
@@ -1,12 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as AjaxClient from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { CartClearInput, makeCartOutput } from "../schema.js";
|
|
2
|
+
import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
|
|
3
|
+
//#region src/effect/api/CartClear.ts
|
|
4
|
+
/**
|
|
5
|
+
* Describes a request that empties the cart.
|
|
6
|
+
*
|
|
7
|
+
* @param input - Optional request input; carries the `sections` to re-render.
|
|
8
|
+
* @returns An `AjaxRequest` decoding to the emptied cart.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
|
|
13
|
+
* import * as Effect from "effect/Effect";
|
|
14
|
+
* import { make as clearCart } from "./CartClear.js";
|
|
15
|
+
*
|
|
16
|
+
* const cart = await Effect.runPromise(
|
|
17
|
+
* clearCart().pipe(AjaxClient.execute, Effect.provide(AjaxClient.layer)),
|
|
18
|
+
* );
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
var make = AjaxClient.makeRoute({
|
|
22
|
+
routeName: "cart_clear_url",
|
|
23
|
+
inputSchema: CartClearInput,
|
|
24
|
+
outputSchema: makeCartOutput
|
|
8
25
|
});
|
|
9
|
-
|
|
26
|
+
//#endregion
|
|
10
27
|
export { make };
|
|
11
|
-
|
|
28
|
+
|
|
12
29
|
//# sourceMappingURL=CartClear.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"CartClear.js","names":[],"sources":["../../../src/effect/api/CartClear.ts"],"sourcesContent":["import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\nimport { CartClearInput, makeCartOutput } from \"../schema.js\";\n\nexport type ClearInput = CartClearInput;\n\n/**\n * Describes a request that empties the cart.\n *\n * @param input - Optional request input; carries the `sections` to re-render.\n * @returns An `AjaxRequest` decoding to the emptied cart.\n *\n * @example\n * ```typescript\n * import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n * import * as Effect from \"effect/Effect\";\n * import { make as clearCart } from \"./CartClear.js\";\n *\n * const cart = await Effect.runPromise(\n * clearCart().pipe(AjaxClient.execute, Effect.provide(AjaxClient.layer)),\n * );\n * ```\n */\nexport const make = AjaxClient.makeRoute({\n\trouteName: \"cart_clear_url\",\n\tinputSchema: CartClearInput,\n\toutputSchema: makeCartOutput,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,OAAO,WAAW,UAAU;CACxC,WAAW;CACX,aAAa;CACb,cAAc;AACf,CAAC"}
|
|
@@ -1,12 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as AjaxClient from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { CartGetInput, makeCartOutput } from "../schema.js";
|
|
2
|
+
import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
|
|
3
|
+
//#region src/effect/api/CartGet.ts
|
|
4
|
+
/**
|
|
5
|
+
* Describes a request for the current cart.
|
|
6
|
+
*
|
|
7
|
+
* Returns a description rather than an effect: pipe it through the
|
|
8
|
+
* `shopify-ajax-client` combinators and finish with `execute`.
|
|
9
|
+
*
|
|
10
|
+
* @param input - Optional request input; carries the `sections` to re-render.
|
|
11
|
+
* @returns An `AjaxRequest` decoding to the cart.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
|
|
16
|
+
* import * as Effect from "effect/Effect";
|
|
17
|
+
* import { pipe } from "effect/Function";
|
|
18
|
+
* import { make as getCart } from "./CartGet.js";
|
|
19
|
+
*
|
|
20
|
+
* const cart = await Effect.runPromise(
|
|
21
|
+
* pipe(
|
|
22
|
+
* getCart(),
|
|
23
|
+
* AjaxClient.withSections("cart-drawer"),
|
|
24
|
+
* AjaxClient.execute,
|
|
25
|
+
* Effect.provide(AjaxClient.layer),
|
|
26
|
+
* ),
|
|
27
|
+
* );
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
var make = AjaxClient.makeRoute({
|
|
31
|
+
routeName: "cart_url",
|
|
32
|
+
inputSchema: CartGetInput,
|
|
33
|
+
outputSchema: makeCartOutput
|
|
8
34
|
});
|
|
9
|
-
|
|
35
|
+
//#endregion
|
|
10
36
|
export { make };
|
|
11
|
-
|
|
37
|
+
|
|
12
38
|
//# sourceMappingURL=CartGet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"CartGet.js","names":[],"sources":["../../../src/effect/api/CartGet.ts"],"sourcesContent":["import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\nimport { CartGetInput, makeCartOutput } from \"../schema.js\";\n\nexport type GetInput = CartGetInput;\n\n/**\n * Describes a request for the current cart.\n *\n * Returns a description rather than an effect: pipe it through the\n * `shopify-ajax-client` combinators and finish with `execute`.\n *\n * @param input - Optional request input; carries the `sections` to re-render.\n * @returns An `AjaxRequest` decoding to the cart.\n *\n * @example\n * ```typescript\n * import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n * import * as Effect from \"effect/Effect\";\n * import { pipe } from \"effect/Function\";\n * import { make as getCart } from \"./CartGet.js\";\n *\n * const cart = await Effect.runPromise(\n * pipe(\n * getCart(),\n * AjaxClient.withSections(\"cart-drawer\"),\n * AjaxClient.execute,\n * Effect.provide(AjaxClient.layer),\n * ),\n * );\n * ```\n */\nexport const make = AjaxClient.makeRoute({\n\trouteName: \"cart_url\",\n\tinputSchema: CartGetInput,\n\toutputSchema: makeCartOutput,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAa,OAAO,WAAW,UAAU;CACxC,WAAW;CACX,aAAa;CACb,cAAc;AACf,CAAC"}
|
|
@@ -1,12 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as AjaxClient from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { CartUpdateInput, makeCartUpdateOutput } from "../schema.js";
|
|
2
|
+
import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
|
|
3
|
+
//#region src/effect/api/CartUpdate.ts
|
|
4
|
+
/**
|
|
5
|
+
* Describes a request that updates cart-level data.
|
|
6
|
+
*
|
|
7
|
+
* Covers notes, attributes, discount codes and bulk line `updates`.
|
|
8
|
+
*
|
|
9
|
+
* @param input - The cart-level changes to apply.
|
|
10
|
+
* @returns An `AjaxRequest` decoding to the updated cart.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import * as AjaxClient from "@brytdesigns/shopify-ajax-client";
|
|
15
|
+
* import * as Effect from "effect/Effect";
|
|
16
|
+
* import { make as updateCart } from "./CartUpdate.js";
|
|
17
|
+
*
|
|
18
|
+
* const cart = await Effect.runPromise(
|
|
19
|
+
* updateCart({ note: "Leave at door", discount: ["SPRING"] }).pipe(
|
|
20
|
+
* AjaxClient.execute,
|
|
21
|
+
* Effect.provide(AjaxClient.layer),
|
|
22
|
+
* ),
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
var make = AjaxClient.makeRoute({
|
|
27
|
+
routeName: "cart_update_url",
|
|
28
|
+
inputSchema: CartUpdateInput,
|
|
29
|
+
outputSchema: makeCartUpdateOutput
|
|
8
30
|
});
|
|
9
|
-
|
|
31
|
+
//#endregion
|
|
10
32
|
export { make };
|
|
11
|
-
|
|
33
|
+
|
|
12
34
|
//# sourceMappingURL=CartUpdate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"CartUpdate.js","names":[],"sources":["../../../src/effect/api/CartUpdate.ts"],"sourcesContent":["import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\nimport { CartUpdateInput, makeCartUpdateOutput } from \"../schema.js\";\n\nexport type UpdateInput = CartUpdateInput;\n\n/**\n * Describes a request that updates cart-level data.\n *\n * Covers notes, attributes, discount codes and bulk line `updates`.\n *\n * @param input - The cart-level changes to apply.\n * @returns An `AjaxRequest` decoding to the updated cart.\n *\n * @example\n * ```typescript\n * import * as AjaxClient from \"@brytdesigns/shopify-ajax-client\";\n * import * as Effect from \"effect/Effect\";\n * import { make as updateCart } from \"./CartUpdate.js\";\n *\n * const cart = await Effect.runPromise(\n * updateCart({ note: \"Leave at door\", discount: [\"SPRING\"] }).pipe(\n * AjaxClient.execute,\n * Effect.provide(AjaxClient.layer),\n * ),\n * );\n * ```\n */\nexport const make = AjaxClient.makeRoute({\n\trouteName: \"cart_update_url\",\n\tinputSchema: CartUpdateInput,\n\toutputSchema: makeCartUpdateOutput,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAa,OAAO,WAAW,UAAU;CACxC,WAAW;CACX,aAAa;CACb,cAAc;AACf,CAAC"}
|