npm.io
0.5.0 • Published 4h ago

@misiki/commercetools-connector

Licence
MIT
Version
0.5.0
Deps
0
Size
2.2 MB
Vulns
0
Weekly
0

@misiki/commercetools-connector

NPM Version License TypeScript

The Official TypeScript API Connector for connecting svelte-commerce to commercetools E-Commerce Backend.

@misiki/commercetools-connector provides a production-ready, fully-typed API client and integration layer that seamlessly bridges svelte-commerce storefronts with commercetools headless e-commerce backends — part of the Litekart connector suite, mirroring the full 43-service surface of @misiki/litekart-connector.

Coverage: 21 of 43 services are wired to the live commercetools API. The remaining 22 have no commercetools equivalent and return empty placeholder data. Each placeholder says why in a comment at the top of its service file.


Step-by-Step Integration Guide

Follow these steps to connect svelte-commerce with commercetools-connector and your commercetools backend.

1. Install the Connector

Inside your svelte-commerce project directory, run:

bun i @misiki/commercetools-connector

(Or using npm / pnpm / yarn):

npm install @misiki/commercetools-connector
# or
pnpm add @misiki/commercetools-connector
2. Configure kitcommerce.config.ts

In svelte-commerce, open kitcommerce.config.ts and change the export * line to import from @misiki/commercetools-connector:

// kitcommerce.config.ts
export * from '@misiki/commercetools-connector';
3. Configure Credentials

Pass apiUrl ({apiUrl}/{projectKey}), accessToken (OAuth2 token). API docs: https://docs.commercetools.com/api/

import { commercetoolsConnector } from '@misiki/commercetools-connector'

// Credentials are set once, statically — the constructor only takes an optional fetch.
commercetoolsConnector.setCredentials({
  apiUrl: 'https://api.us-central1.gcp.commercetools.com/my-project',
  accessToken: 'oauth_token'
})

const client = new commercetoolsConnector()

const products = await client.product.list({ page: 1, sort: '-createdAt' })
4. Build and Run the Project

Run the development server in svelte-commerce:

bun dev

To build and run the production application:

# Build the project
bun run build

# Preview the built application
bun run preview

Service coverage

Service Status
client.product live
client.category live
client.collection live
client.order live
client.coupon live
client.address live
client.review live
client.cart live
client.country placeholder (no commercetools equivalent)
client.state live
client.currency placeholder (no commercetools equivalent)
client.region live
client.page placeholder (no commercetools equivalent)
client.blog placeholder (no commercetools equivalent)
client.settings live
client.store placeholder (no commercetools equivalent)
client.paymentMethod live
client.search live
client.autocomplete live
client.user live
client.auth live
client.profile live
client.wishlist live
client.vendor placeholder (no commercetools equivalent)
client.checkout live
client.upload placeholder (no commercetools equivalent)
client.banner placeholder (no commercetools equivalent)
client.chat placeholder (no commercetools equivalent)
client.contact placeholder (no commercetools equivalent)
client.deal placeholder (no commercetools equivalent)
client.demoRequest placeholder (no commercetools equivalent)
client.enquiry placeholder (no commercetools equivalent)
client.faq placeholder (no commercetools equivalent)
client.feedback placeholder (no commercetools equivalent)
client.gallery placeholder (no commercetools equivalent)
client.home placeholder (no commercetools equivalent)
client.init placeholder (no commercetools equivalent)
client.meilisearch live
client.menu live
client.plugins placeholder (no commercetools equivalent)
client.popularSearch placeholder (no commercetools equivalent)
client.popularity placeholder (no commercetools equivalent)
client.reels placeholder (no commercetools equivalent)

Development

bun install && bun run typecheck && bun run build

License

MIT misiki-in

Keywords