### Install Project Dependencies Source: https://github.com/elasticpath/composable-frontend/blob/main/README.md Install all necessary dependencies for the project using PNPM, the package manager. ```bash pnpm install ``` -------------------------------- ### Get Catalog Release Example Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md An example demonstrating how to use the `getByContextRelease` function to retrieve catalog release information, including optional headers. ```typescript import { getByContextRelease, type GetByContextReleaseData, type GetByContextReleaseResponse } from "@epcc-sdk/sdks-shopper"; const params: GetByContextReleaseData = { headers: { "accept-language": "en-US", // OPTIONAL "EP-Channel": "web", // OPTIONAL }, }; const result: GetByContextReleaseResponse = await getByContextRelease(params); ``` -------------------------------- ### Install @epcc-sdk/sdks-shopper SDK Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Installs the core @epcc-sdk/sdks-shopper SDK package using npm, pnpm, or yarn. ```bash npm install @epcc-sdk/sdks-shopper # or pnpm install @epcc-sdk/sdks-shopper # or yarn add @epcc-sdk/sdks-shopper ``` -------------------------------- ### Get All Hierarchies Example Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Illustrates how to call `getByContextAllHierarchies` to fetch all hierarchies, with options for filtering and pagination via query parameters and optional headers. ```typescript import { getByContextAllHierarchies, type GetByContextAllHierarchiesData, type GetByContextAllHierarchiesResponse } from "@epcc-sdk/sdks-shopper"; const params: GetByContextAllHierarchiesData = { query: { "filter": "eq(name,\"Product Name\")", // OPTIONAL "page[limit]": 10, // OPTIONAL "page[offset]": 0, // OPTIONAL }, headers: { "accept-language": "en-US", // OPTIONAL "EP-Channel": "web", // OPTIONAL }, }; const result: GetByContextAllHierarchiesResponse = await getByContextAllHierarchies(params); ``` -------------------------------- ### Example Storefront Structures Source: https://github.com/elasticpath/composable-frontend/blob/main/CLAUDE.md Details the structure of example implementations, ranging from basic storefronts to those with advanced features like Algolia search and multi-location inventory. ```plaintext - `simple/` - Basic storefront implementation - `commerce-essentials/` - Full-featured storefront - `list-products/` - Product listing with multi-location inventory - `algolia/` - Algolia search integration - `payments/` - Payment gateway examples - `memberships/` - Account membership features ``` -------------------------------- ### Install React Query Peer Dependency Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/readme-fragments/afterIntro.md Installs the necessary `@tanstack/react-query` package, which is a peer dependency required for using the React Query hooks provided by the SDK. ```bash npm install @tanstack/react-query # or pnpm install @tanstack/react-query # or yarn add @tanstack/react-query ``` -------------------------------- ### GET /v2/subscriptions/offerings/{offering_uuid}/pricing-options Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Lists all pricing options available for a specific offering. This GET operation facilitates the retrieval of pricing details associated with an offering. ```APIDOC ## GET /v2/subscriptions/offerings/{offering_uuid}/pricing-options ### Description Lists all pricing options available for a specific offering. This GET operation facilitates the retrieval of pricing details associated with an offering. ### Method GET ### Endpoint `/v2/subscriptions/offerings/{offering_uuid}/pricing-options` ### Parameters #### Path Parameters - **offering_uuid** (string) - Required - The unique identifier of the offering. #### Query Parameters - **page[offset]** (integer) - Optional - The number of records to skip for pagination. - **page[limit]** (integer) - Optional - The maximum number of records to return. ### Request Example ```json { "path": { "offering_uuid": "12345678-1234-5678-9012-123456789012" }, "query": { "page[offset]": 0, "page[limit]": 10 } } ``` ### Response #### Success Response (200) - **pricing_options** (array) - A list of pricing options for the offering. #### Response Example ```json { "pricing_options": [ ... ] } ``` ``` -------------------------------- ### Operation Usage Example Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Illustrates the general pattern for using operation functions to make API requests. ```APIDOC ## Operation Usage The following examples demonstrate the typical usage pattern for operation functions within the SDK. ### General Example ```typescript import { getByContextProduct } from "@epcc-sdk/sdks-shopper"; const product = await getByContextProduct({ // client: localClient, // Optional: Use a specific client instance path: { // ... path parameters }, query: { // ... query parameters }, }); ``` ``` -------------------------------- ### GET /v2/subscriptions/offerings/{offering_uuid}/plans Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Lists all plans available for a specific offering. This GET operation retrieves the subscription plans associated with an offering. ```APIDOC ## GET /v2/subscriptions/offerings/{offering_uuid}/plans ### Description Lists all plans available for a specific offering. This GET operation retrieves the subscription plans associated with an offering. ### Method GET ### Endpoint `/v2/subscriptions/offerings/{offering_uuid}/plans` ### Parameters #### Path Parameters - **offering_uuid** (string) - Required - The unique identifier of the offering. #### Query Parameters - **page[offset]** (integer) - Optional - The number of records to skip for pagination. - **page[limit]** (integer) - Optional - The maximum number of records to return. ### Request Example ```json { "path": { "offering_uuid": "12345678-1234-5678-9012-123456789012" }, "query": { "page[offset]": 0, "page[limit]": 10 } } ``` ### Response #### Success Response (200) - **plans** (array) - A list of plans for the offering. #### Response Example ```json { "plans": [ ... ] } ``` ``` -------------------------------- ### Get All Files - TypeScript Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Retrieves a list of all files stored in the system. This GET operation allows filtering by file name, width, height, and file size, and supports pagination. ```typescript import { getAllFiles, type GetAllFilesData, type GetAllFilesResponse } from "@epcc-sdk/sdks-shopper"; const params: GetAllFilesData = { query: { "filter": "eq(name,\"Product Name\")", // OPTIONAL "page[limit]": 10, // OPTIONAL "page[offset]": 0, // OPTIONAL }, }; const result: GetAllFilesResponse = await getAllFiles(params); ``` -------------------------------- ### GET /v2/subscriptions/offerings/{offering_uuid}/plans/{plan_uuid}/relationships/pricing_options Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Lists the pricing options available to a specific plan within an offering. This GET operation retrieves the pricing options linked to a plan. ```APIDOC ## GET /v2/subscriptions/offerings/{offering_uuid}/plans/{plan_uuid}/relationships/pricing_options ### Description Lists the pricing options available to a specific plan within an offering. This GET operation retrieves the pricing options linked to a plan. ### Method GET ### Endpoint `/v2/subscriptions/offerings/{offering_uuid}/plans/{plan_uuid}/relationships/pricing_options` ### Parameters #### Path Parameters - **offering_uuid** (string) - Required - The unique identifier of the offering. - **plan_uuid** (string) - Required - The unique identifier of the plan. ### Request Example ```json { "path": { "offering_uuid": "12345678-1234-5678-9012-123456789012", "plan_uuid": "12345678-1234-5678-9012-123456789012" } } ``` ### Response #### Success Response (200) - **pricing_options** (array) - A list of pricing options for the plan. #### Response Example ```json { "pricing_options": [ ... ] } ``` ``` -------------------------------- ### GET /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Get a list of component product IDs for a specified bundle in Product Experience Manager, including key attributes like SKU or slug. Use the `include` parameter to retrieve additional resources like main images and files. ```APIDOC ## GET /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products ### Description Get a list of component product IDs for a specified bundle in Product Experience Manager, including key attributes like SKU or slug. Use the `include` parameter to retrieve additional resources like main images and files. ### Method GET ### Endpoint `/catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products` #### Path Parameters - **catalog_id** (string) - Required - The ID of the catalog. - **release_id** (string) - Required - The ID of the release. - **product_id** (string) - Required - The ID of the product. #### Query Parameters - **include** (array) - Optional - Specifies related resources to include in the response, such as `files` or `main_images`. - **page[limit]** (integer) - Optional - The maximum number of results to return per page. - **page[offset]** (integer) - Optional - The offset for pagination. #### Headers - **EP-Pricebook-IDs-For-Price-Segmentation-Preview** (string) - Optional - Header for pricebook ID preview. ### Response #### Success Response (200) - **data** (array) - Contains component product IDs and their attributes. #### Response Example ```json { "data": [ { "id": "component-product-id-1", "type": "product" }, { "id": "component-product-id-2", "type": "product" } ] } ``` ``` -------------------------------- ### GET /catalog Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Retrieves the catalog release information for shoppers. ```APIDOC ## GET /catalog ### Description Returns a list of all published releases of the specified catalog. ### Method GET ### Endpoint `/catalog` ### Parameters #### Query Parameters None directly documented for this primary call, but underlying catalog retrieval might involve context. #### Headers - **accept-language** (string) - Optional - Specifies the preferred language for the response. - **EP-Channel** (string) - Optional - Indicates the channel through which the request is made (e.g., 'web'). ### Request Example ```typescript import { getByContextRelease, type GetByContextReleaseData, type GetByContextReleaseResponse } from "@epcc-sdk/sdks-shopper"; const params: GetByContextReleaseData = { headers: { "accept-language": "en-US", "EP-Channel": "web", }, }; const result: GetByContextReleaseResponse = await getByContextRelease(params); ``` ### Response #### Success Response (200) - **Data Structure**: Varies based on catalog release details. #### Response Example *(Example response structure would be provided here based on actual API contract)* ``` -------------------------------- ### GET /v2/files Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Retrieves a list of all files, with options to filter by name, dimensions, and size. ```APIDOC ## GET /v2/files ### Description Retrieves all files with options to filter by file name, width, height, and file size. ### Method GET ### Endpoint /v2/files #### Query Parameters - **filter** (string) - Optional - Filters files based on criteria like name (e.g., `eq(name,"Product Name")`). - **page[limit]** (integer) - Optional - The maximum number of results to return. - **page[offset]** (integer) - Optional - The number of results to skip. ### Request Example ```json { "query": { "filter": "eq(name,\"Product Name\")", "page[limit]": 10, "page[offset]": 0 } } ``` ### Response #### Success Response (200) - **data** (array) - An array of file objects. - **type** (string) - The type of the file resource. - **id** (string) - The unique identifier for the file. - **attributes** (object) - Contains file-specific attributes. - **name** (string) - The name of the file. - **url** (string) - The URL to access the file. - **width** (integer) - The width of the file (if applicable). - **height** (integer) - The height of the file (if applicable). - **size** (integer) - The size of the file in bytes. #### Response Example ```json { "data": [ { "type": "file", "id": "file-123", "attributes": { "name": "Product Image", "url": "https://example.com/images/product.jpg", "width": 1000, "height": 800, "size": 51200 } } ] } ``` ``` -------------------------------- ### GET /v2/accounts Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Retrieves all accounts, with options for filtering and pagination. ```APIDOC ## GET /v2/accounts ### Description Retrieve all accounts with the option to filter by attributes such as name, legal name, registration ID, external reference, ID, creation date, and update date. ### Method GET ### Endpoint /v2/accounts ### Parameters #### Query Parameters - **filter** (string) - Optional - Filter criteria for accounts, e.g., `eq(name,"Product Name")`. - **page[limit]** (integer) - Optional - The maximum number of results to return per page. - **page[offset]** (integer) - Optional - The starting point for pagination. ### Response #### Success Response (200) - **data** (array) - An array of account objects. - **links** (object) - Pagination links. #### Response Example { "data": [ { "type": "account", "id": "acc_abc", "name": "Test Account" } ], "links": { "self": "/v2/accounts?page[offset]=0&page[limit]=10" } } ``` -------------------------------- ### GET /v2/subscriptions/offerings Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Retrieves a list of all subscription offerings, with optional filtering. ```APIDOC ## GET /v2/subscriptions/offerings ### Description Retrieves a list of all subscription offerings with support for filtering by attributes like external reference and proration policy ID. ### Method GET ### Endpoint `/v2/subscriptions/offerings` ### Parameters #### Query Parameters - **filter** (string) - Optional - Filters the offerings (e.g., `eq(name,"Product Name")`). - **page[offset]** (integer) - Optional - The offset for pagination. - **page[limit]** (integer) - Optional - The limit for the number of results per page. ### Request Example ```typescript import { listOfferings, type ListOfferingsData, type ListOfferingsResponse } from "@epcc-sdk/sdks-shopper"; const params: ListOfferingsData = { query: { "filter": "eq(name,\"Product Name\")", // OPTIONAL "page[offset]": 0, // OPTIONAL "page[limit]": 10, // OPTIONAL }, }; const result: ListOfferingsResponse = await listOfferings(params); ``` ### Response #### Success Response (200) - **offerings** (array) - A list of subscription offerings. #### Response Example ```json { "offerings": [ ... ] } ``` ``` -------------------------------- ### GET /v2/currencies Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Retrieves a list of all available currencies. This endpoint is intended for administrator use only. ```APIDOC ## GET /v2/currencies ### Description Retrieves all currencies. This endpoint is for Administrator use only. ### Method GET ### Endpoint /v2/currencies #### Query Parameters - **page[offset]** (integer) - Optional - The number of results to skip. - **page[limit]** (integer) - Optional - The maximum number of results to return. ### Request Example ```json { "query": { "page[offset]": 0, "page[limit]": 10 } } ``` ### Response #### Success Response (200) - **data** (array) - An array of currency objects. - **type** (string) - The type of the currency resource. - **id** (string) - The unique identifier for the currency. - **attributes** (object) - Contains currency-specific attributes. - **name** (string) - The name of the currency. - **code** (string) - The ISO currency code. #### Response Example ```json { "data": [ { "type": "currency", "id": "USD", "attributes": { "name": "United States Dollar", "code": "USD" } }, { "type": "currency", "id": "EUR", "attributes": { "name": "Euro", "code": "EUR" } } ] } ``` ``` -------------------------------- ### Client Initialization Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Demonstrates how to create a client instance with custom configurations like baseUrl and headers. ```APIDOC ## Client Initialization This section explains how to create a new instance of the client using the `createClient` function. This is useful for managing different client configurations within an application. ### Method ```typescript createClient(config: ClientConfig) ``` ### Parameters #### Request Body - **baseUrl** (string) - Required - The base URL for API requests. - **headers** (object) - Optional - Default headers to be included in all requests made by this client. - **Custom-Header** (string) - Example custom header. ### Request Example ```typescript import { createClient } from "@epcc-sdk/sdks-shopper"; const client = createClient({ baseUrl: "https://euwest.api.elasticpath.com", headers: { "Custom-Header": 'My Value', }, }); ``` ### Usage with SDK Functions An initialized client instance can be passed to SDK functions to override the default client. ```typescript import { getByContextProduct } from "@epcc-sdk/sdks-shopper"; const response = await getByContextProduct({ client: myClient, }); ``` ``` -------------------------------- ### GET /v2/orders/{orderID}/transactions Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Get order transactions ```APIDOC ## GET /v2/orders/{orderID}/transactions ### Description Get order transactions ### Method GET ### Endpoint /v2/orders/{orderID}/transactions ### Parameters #### Path Parameters - **orderID** (string) - Required - The unique identifier of the order for which to retrieve transactions. ### Response #### Success Response (200) - **data** (array) - An array of transaction objects associated with the order. - Each object in the array represents a transaction and contains fields like: - **type** (string) - The type of the resource. - **id** (string) - The unique identifier of the transaction. - **attributes** (object) - Transaction-specific attributes. - **status** (string) - The status of the transaction. - **amount** (number) - The transaction amount. - **created_at** (string) - The timestamp when the transaction was created. #### Response Example ```json { "data": [ { "type": "transaction", "id": "txn_123abc", "attributes": { "status": "authorized", "amount": 100.00, "created_at": "2023-10-27T09:00:00Z" } }, { "type": "transaction", "id": "txn_456def", "attributes": { "status": "captured", "amount": 75.00, "created_at": "2023-10-27T11:00:00Z" } } ] } ``` ``` -------------------------------- ### Build All Apps and Packages Source: https://github.com/elasticpath/composable-frontend/blob/main/README.md Execute this command to build all applications and packages within the Turborepo project. ```bash pnpm build ``` -------------------------------- ### GET /v2/subscriptions/features/{feature_uuid} Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md GET operation to retrieve a specific feature. ```APIDOC ## GET /v2/subscriptions/features/{feature_uuid} ### Description GET operation to retrieve a specific feature. ### Method GET ### Endpoint /v2/subscriptions/features/{feature_uuid} #### Path Parameters - **feature_uuid** (string) - Required - The unique identifier of the feature. ### Request Example ```json { "path": { "feature_uuid": "12345678-1234-5678-9012-123456789012" } } ``` ### Response #### Success Response (200) - **example** (object) - Description of the response structure for a successful request. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Generate a New Composable Starter App Source: https://github.com/elasticpath/composable-frontend/blob/main/README.md Use this command in your terminal to create a new Composable Starter app, specifying your desired storefront project name. ```bash ep generate my-storefront ``` -------------------------------- ### GET /v2/subscriptions/invoices/{invoice_uuid} Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md GET operation to retrieve a specific invoice. ```APIDOC ## GET /v2/subscriptions/invoices/{invoice_uuid} ### Description GET operation to retrieve a specific invoice. ### Method GET ### Endpoint /v2/subscriptions/invoices/{invoice_uuid} #### Path Parameters - **invoice_uuid** (string) - Required - The unique identifier of the invoice. ### Request Example ```json { "path": { "invoice_uuid": "12345678-1234-5678-9012-123456789012" } } ``` ### Response #### Success Response (200) - **example** (object) - Description of the response structure for a successful request. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### GET /v2/subscriptions/subscriptions/{subscription_uuid}/states Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md GET operation to list subscription states. ```APIDOC ## GET /v2/subscriptions/subscriptions/{subscription_uuid}/states ### Description List all states associated with a specific subscription. ### Method GET ### Endpoint /v2/subscriptions/subscriptions/{subscription_uuid}/states #### Path Parameters - **subscription_uuid** (string) - Required - The unique identifier of the subscription. ### Request Example ```json { "path": { "subscription_uuid": "12345678-1234-5678-9012-123456789012" } } ``` ### Response #### Success Response (200) - **data** (array) - A list of subscription states. - **data[].attributes.name** (string) - The name of the state (e.g., 'pending', 'active', 'canceled'). - **data[].attributes.description** (string) - A description of the state. #### Response Example ```json { "data": [ { "type": "subscription-state", "id": "state-id-1", "attributes": { "name": "active", "description": "The subscription is currently active." } }, { "type": "subscription-state", "id": "state-id-2", "attributes": { "name": "paused", "description": "The subscription has been temporarily paused." } } ] } ``` ``` -------------------------------- ### Build URL Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Demonstrates how to use the `buildUrl` method to construct URLs with type hinting. ```APIDOC ## Build URL The `buildUrl()` method assists in constructing API request URLs. It is loosely typed by default but benefits from type hints for better accuracy. ### Method ```typescript client.buildUrl(urlConfig: UrlConfig) ``` ### Parameters #### Request Body - **path** (object) - Contains path parameters for the URL. - **query** (object) - Contains query parameters for the URL. - **url** (string) - The URL template string with placeholders. ### Request Example ```typescript type FooData = { path: { fooId: number; }; query?: { bar?: string; }; url: '/foo/{fooId}'; }; const url = client.buildUrl({ path: { fooId: 1, }, query: { bar: 'baz', }, url: '/foo/{fooId}', }); console.log(url); // prints '/foo/1?bar=baz' ``` ``` -------------------------------- ### GET /v2/inventories/{product_uuid} Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Gets the stock for the product matching the specified unique identifier. ```APIDOC ## GET /v2/inventories/{product_uuid} ### Description Gets the stock for the product matching the specified unique identifier. ### Method GET ### Endpoint /v2/inventories/{product_uuid} #### Path Parameters - **product_uuid** (string) - Required - The unique identifier of the product. ### Request Example ```json { "path": { "product_uuid": "12345678-1234-5678-9012-123456789012" } } ``` ### Response #### Success Response (200) - **example** (object) - Description of the response structure for a successful request. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### POST /catalogs Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Creates a new catalog by defining hierarchies, products, and price books. ```APIDOC ## POST /catalogs ### Description Creates a new catalog by defining hierarchies, products, and price books with priorities for displaying product prices. Up to five price books can be specified for different scenarios. ### Method POST ### Endpoint /catalogs ### Parameters #### Request Body - **data** (object) - Required - The catalog resource data. - **type** (string) - Required - Must be "resource". - **attributes** (object) - Required - The catalog attributes. - **name** (string) - Required - The name of the catalog. - **description** (string) - Optional - A description for the catalog. ### Request Example ```json { "data": { "type": "resource", "attributes": { "name": "Resource Name", "description": "Resource Description" } } } ``` ### Response #### Success Response (200) - **data** (object) - The created catalog resource. #### Response Example ```json { "data": { "type": "catalog", "id": "12345678-1234-5678-9012-123456789012", "attributes": { "name": "Resource Name", "description": "Resource Description" } } } ``` ``` -------------------------------- ### Create Shopper Client Instance Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Demonstrates how to create a custom client instance for the shopper SDK, allowing for different configurations and base URLs. ```typescript import { createClient } from "@epcc-sdk/sdks-shopper"; // Create the client with your API base URL. const client = createClient({ // set default base url for requests baseUrl: "https://euwest.api.elasticpath.com", /** * Set default headers only for requests made by this client. */ headers: { "Custom-Header": 'My Value', }, }); ``` -------------------------------- ### GET /v2/subscriptions/subscriptions/{subscription_uuid}/invoices/{invoice_uuid} Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Gets a specific invoice for a given subscription. ```APIDOC ## GET /v2/subscriptions/subscriptions/{subscription_uuid}/invoices/{invoice_uuid} ### Description Gets a specific invoice for a given subscription. ### Method GET ### Endpoint /v2/subscriptions/subscriptions/{subscription_uuid}/invoices/{invoice_uuid} #### Path Parameters - **subscription_uuid** (string) - Required - The unique identifier of the subscription. - **invoice_uuid** (string) - Required - The unique identifier of the invoice. ### Request Example ```json { "path": { "subscription_uuid": "12345678-1234-5678-9012-123456789012", "invoice_uuid": "12345678-1234-5678-9012-123456789012" } } ``` ### Response #### Success Response (200) - **example** (object) - Description of the response structure for a successful request. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### GET /v2/subscriptions/subscriptions/{subscription_uuid}/states/{state_uuid} Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md GET operation to retrieve a specific subscription state. ```APIDOC ## GET /v2/subscriptions/subscriptions/{subscription_uuid}/states/{state_uuid} ### Description Retrieve details of a specific subscription state. ### Method GET ### Endpoint /v2/subscriptions/subscriptions/{subscription_uuid}/states/{state_uuid} #### Path Parameters - **subscription_uuid** (string) - Required - The unique identifier of the subscription. - **state_uuid** (string) - Required - The unique identifier of the subscription state. ### Request Example ```json { "path": { "subscription_uuid": "12345678-1234-5678-9012-123456789012", "state_uuid": "12345678-1234-5678-9012-123456789012" } } ``` ### Response #### Success Response (200) - **data** (object) - The subscription state details. - **data.id** (string) - The unique identifier of the state. - **data.attributes.name** (string) - The name of the state. - **data.attributes.description** (string) - The description of the state. #### Response Example ```json { "data": { "type": "subscription-state", "id": "state-id-1", "attributes": { "name": "active", "description": "The subscription is currently active." } } } ``` ``` -------------------------------- ### Direct Configuration for SDK Functions Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Illustrates configuring SDK functions directly with options like baseUrl, useful for one-off requests without a dedicated client instance. ```typescript const response = await getByContextProduct({ baseUrl: 'https://example.com', // <-- override default configuration }); ``` -------------------------------- ### GET /v2/subscriptions/subscriptions/{subscription_uuid}/invoices/{invoice_uuid}/payments/{payment_uuid} Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Gets a specific payment for a given invoice. ```APIDOC ## GET /v2/subscriptions/subscriptions/{subscription_uuid}/invoices/{invoice_uuid}/payments/{payment_uuid} ### Description Gets a specific payment for a given invoice. ### Method GET ### Endpoint /v2/subscriptions/subscriptions/{subscription_uuid}/invoices/{invoice_uuid}/payments/{payment_uuid} #### Path Parameters - **subscription_uuid** (string) - Required - The unique identifier of the subscription. - **invoice_uuid** (string) - Required - The unique identifier of the invoice. - **payment_uuid** (string) - Required - The unique identifier of the payment. ### Request Example ```json { "path": { "subscription_uuid": "12345678-1234-5678-9012-123456789012", "invoice_uuid": "12345678-1234-5678-9012-123456789012", "payment_uuid": "12345678-1234-5678-9012-123456789012" } } ``` ### Response #### Success Response (200) - **example** (object) - Description of the response structure for a successful request. #### Response Example ```json { "example": "response body" } ``` ``` -------------------------------- ### Set Up Payment for Order with Composable Frontend SDK Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Sets up payments for an order, supporting different transaction types like immediate charging or authorization. This operation uses the `paymentSetup` function and requires the order ID and payment gateway details. ```typescript import { paymentSetup, type PaymentSetupData, type PaymentSetupResponse } from "@epcc-sdk/sdks-shopper"; const params: PaymentSetupData = { path: { orderID: "orderID", }, body: { data: { gateway: "stripe", method: "purchase" } }, }; const result: PaymentSetupResponse = await paymentSetup(params); ``` -------------------------------- ### Direct Configuration Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Shows how to configure client options directly within SDK function calls for one-off requests. ```APIDOC ## Direct Configuration Alternatively, client configuration options can be passed directly to each SDK function. This is suitable for use cases where a dedicated client instance is not necessary. ### Method Signature ```typescript (options: OperationOptions) ``` ### Parameters #### Request Body - **baseUrl** (string) - Optional - Overrides the default base URL for this specific request. ### Request Example ```typescript import { getByContextProduct } from "@epcc-sdk/sdks-shopper"; const response = await getByContextProduct({ baseUrl: 'https://example.com', }); ``` ``` -------------------------------- ### GET /v2/subscriptions/subscriptions/{subscription_uuid} Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Retrieves a specific subscription by its UUID. This GET operation fetches detailed information about a single subscription. ```APIDOC ## GET /v2/subscriptions/subscriptions/{subscription_uuid} ### Description Retrieves a specific subscription by its UUID. This GET operation fetches detailed information about a single subscription. ### Method GET ### Endpoint `/v2/subscriptions/subscriptions/{subscription_uuid}` ### Parameters #### Path Parameters - **subscription_uuid** (string) - Required - The unique identifier of the subscription. #### Query Parameters - **include** (array of strings) - Optional - Specifies related resources to include in the response, e.g., `["files", "main_images"]`. ### Request Example ```json { "path": { "subscription_uuid": "12345678-1234-5678-9012-123456789012" }, "query": { "include": ["files", "main_images"] } } ``` ### Response #### Success Response (200) - **subscription_data** (object) - Contains the details of the subscription. #### Response Example ```json { "subscription_data": { ... } } ``` ``` -------------------------------- ### GET /v2/subscriptions/offerings/{offering_uuid} Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Retrieves a specific offering by its UUID. This GET operation allows for fetching detailed information about a subscription offering. ```APIDOC ## GET /v2/subscriptions/offerings/{offering_uuid} ### Description Retrieves a specific offering by its UUID. This GET operation allows for fetching detailed information about a subscription offering. ### Method GET ### Endpoint `/v2/subscriptions/offerings/{offering_uuid}` ### Parameters #### Path Parameters - **offering_uuid** (string) - Required - The unique identifier of the offering. #### Query Parameters - **include** (array of strings) - Optional - Specifies related resources to include in the response, e.g., `["files", "main_images"]`. ### Request Example ```json { "path": { "offering_uuid": "12345678-1234-5678-9012-123456789012" }, "query": { "include": ["files", "main_images"] } } ``` ### Response #### Success Response (200) - **offering_data** (object) - Contains the details of the offering. #### Response Example ```json { "offering_data": { ... } } ``` ``` -------------------------------- ### Create Catalog using TypeScript Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Creates a new catalog with specified hierarchies, products, and price books. Supports up to five price books for different scenarios. ```typescript import { createCatalog, type CreateCatalogData, type CreateCatalogResponse } from "@epcc-sdk/sdks-shopper"; const params: CreateCatalogData = { body: { data: { type: "resource", attributes: { name: "Resource Name", description: "Resource Description" } } }, }; const result: CreateCatalogResponse = await createCatalog(params); ``` -------------------------------- ### Make `getByContextProduct` Request Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Shows a basic example of how to call the `getByContextProduct` operation, optionally providing a client instance, path, and query parameters. ```typescript import { getByContextProduct } from "@epcc-sdk/sdks-shopper"; const product = await getByContextProduct({ // client: localClient, // optional if you have a client instance you want to use otherwise the global client will be used path: { ... }, query: { ... }, }); ``` -------------------------------- ### GET /v2/subscriptions/offerings/{offering_uuid}/features Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Lists all features associated with a specific offering. This GET operation is used to retrieve the features included in a subscription offering. ```APIDOC ## GET /v2/subscriptions/offerings/{offering_uuid}/features ### Description Lists all features associated with a specific offering. This GET operation is used to retrieve the features included in a subscription offering. ### Method GET ### Endpoint `/v2/subscriptions/offerings/{offering_uuid}/features` ### Parameters #### Path Parameters - **offering_uuid** (string) - Required - The unique identifier of the offering. #### Query Parameters - **page[offset]** (integer) - Optional - The number of records to skip for pagination. - **page[limit]** (integer) - Optional - The maximum number of records to return. ### Request Example ```json { "path": { "offering_uuid": "12345678-1234-5678-9012-123456789012" }, "query": { "page[offset]": 0, "page[limit]": 10 } } ``` ### Response #### Success Response (200) - **features** (array) - A list of features for the offering. #### Response Example ```json { "features": [ ... ] } ``` ``` -------------------------------- ### Get Catalog Rule by ID using TypeScript Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Retrieves a specific catalog rule using its unique catalog_rule_id. This is a GET operation. Returns a GetRuleByIdResponse. ```typescript import { getRuleById, type GetRuleByIdData, type GetRuleByIdResponse } from "@epcc-sdk/sdks-shopper"; const params: GetRuleByIdData = { path: { catalog_rule_id: "12345678-1234-5678-9012-123456789012", }, }; const result: GetRuleByIdResponse = await getRuleById(params); ``` -------------------------------- ### Create Account with POST /v2/accounts Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Demonstrates creating a new account using the `postV2Accounts` function. Requires the `PostV2AccountsData` type for parameters and `PostV2AccountsResponse` for the result. The body must include at least a `data` object with a `type` property. ```typescript import { postV2Accounts, type PostV2AccountsData, type PostV2AccountsResponse } from "@epcc-sdk/sdks-shopper"; const params: PostV2AccountsData = { body: { data: { type: "resource" } }, }; const result: PostV2AccountsResponse = await postV2Accounts(params); ``` -------------------------------- ### Get Subscription State with Elastic Path SDK Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Performs a GET operation to retrieve a specific subscription state. Requires both subscription UUID and state UUID. ```typescript import { getSubscriptionState, type GetSubscriptionStateData, type GetSubscriptionStateResponse } from "@epcc-sdk/sdks-shopper"; const params: GetSubscriptionStateData = { path: { subscription_uuid: "12345678-1234-5678-9012-123456789012", state_uuid: "12345678-1234-5678-9012-123456789012", }, }; const result: GetSubscriptionStateResponse = await getSubscriptionState(params); ``` -------------------------------- ### List Offering Pricing Options (TypeScript) Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Lists the pricing options available for a specific offering. Allows for pagination using offset and limit parameters. ```typescript import { listOfferingPricingOptions, type ListOfferingPricingOptionsData, type ListOfferingPricingOptionsResponse } from "@epcc-sdk/sdks-shopper"; const params: ListOfferingPricingOptionsData = { path: { offering_uuid: "12345678-1234-5678-9012-123456789012", }, query: { "page[offset]": 0, // OPTIONAL "page[limit]": 10, // OPTIONAL }, }; const result: ListOfferingPricingOptionsResponse = await listOfferingPricingOptions(params); ``` -------------------------------- ### Build URL with Type Hinting Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Demonstrates the use of the `buildUrl` method to construct URLs with path and query parameters, including type safety using generics. ```typescript type FooData = { path: { fooId: number; }; query?: { bar?: string; }; url: '/foo/{fooId}'; }; const url = client.buildUrl({ path: { fooId: 1, }, query: { bar: 'baz', }, url: '/foo/{fooId}', }); console.log(url); // prints '/foo/1?bar=baz' ``` -------------------------------- ### POST /catalog/products/{product_id}/configure Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Configures product bundles, allowing shoppers to select options within defined limits. This updates the bundle configuration and displays the selections on the storefront. ```APIDOC ## POST /catalog/products/{product_id}/configure ### Description Configure a Shopper Bundle. Configure product bundles in your catalog by allowing shoppers to select product options within specified minimum and maximum values, updating the bundle configuration with selected options and displaying them in the storefront. ### Method POST ### Endpoint `/catalog/products/{product_id}/configure` ### Parameters #### Path Parameters - **product_id** (string) - Required - The ID of the product bundle to configure. #### Query Parameters - **include** (string) - Optional - Comma-separated list of related data to include (e.g., `"files", "main_images"`). #### Headers - **accept-language** (string) - Optional - Specifies the preferred language for the response (e.g., `"en-US"`). - **EP-Channel** (string) - Optional - The channel for the request (e.g., `"web"`). #### Request Body - **data** (object) - Required - Contains the type of the resource being configured. - **type** (string) - Required - The type of resource, typically "resource". ### Request Example ```json { "path": { "product_id": "12345678-1234-5678-9012-123456789012" }, "query": { "include": ["files", "main_images"] }, "headers": { "accept-language": "en-US", "EP-Channel": "web" }, "body": { "data": { "type": "resource" } } } ``` ### Response #### Success Response (200) - **data** (object) - Configuration details for the bundle. - **meta** (object) - Metadata about the response. #### Response Example ```json { "data": { "type": "product-configuration", "id": "config-id-1", "attributes": { "selected_options": [] } }, "meta": {} } ``` ``` -------------------------------- ### Get All Currencies - TypeScript Source: https://github.com/elasticpath/composable-frontend/blob/main/packages/sdks/shopper/README.md Retrieves a list of all available currencies. This GET operation is intended for administrator use only and should not be used in customer-facing applications. It supports optional pagination parameters. ```typescript import { getAllCurrencies, type GetAllCurrenciesData, type GetAllCurrenciesResponse } from "@epcc-sdk/sdks-shopper"; const params: GetAllCurrenciesData = { query: { "page[offset]": 0, // OPTIONAL "page[limit]": 10, // OPTIONAL }, }; const result: GetAllCurrenciesResponse = await getAllCurrencies(params); ```