npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@djust-b2b/djust-shipping-module-nuxt

v3.0.0

Published

Djust Shipping Nuxt module

Readme

@djust-b2b/djust-shipping-module-nuxt

Plug-and-play Nuxt 3/4 module for the DJUST Front Office Client (FOC) shipping step: real delivery-mode selection (aligned on the backend rate matrix) and shipping fees display, on top of the existing checkout APIs.

It ships a framework-agnostic core (src/runtime/core, pure TypeScript, no Vue/Nuxt imports) so the business logic can be reused on Nuxt 2 or fully custom frontends.

The UI already supports offered shipping when the backend returns price: 0 with a non-zero baseShippingPrice (strikethrough + “Free”). If you want a dedicated “franco progress” bar (threshold/remaining), use the computeFranco helper from /core and build your own UI — it is not wired into V1 components.

Requirements

The host app must expose a request-scoped SDK on the Nitro event context:

// server/plugins/djust-sdk.ts (host)
event.context.djustSDK = () => useDjustSDK(event) // returns a DjustScopedClient

The module BFF calls sdk.services.logisticOrder.* and sdk.services.commercialOrder.updateShippingAddress with sdk.context. These service methods require @djust-b2b/djust-front-sdk v3+; if your project is still pinned to SDK v2, keep the module disabled until upgraded, or use core only with your own API layer.

Install

npm i @djust-b2b/djust-shipping-module-nuxt
# or, during local development against the starter:
# add "@djust-b2b/djust-shipping-module-nuxt": "file:../djust-shipping-module-nuxt"
// nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@djust-b2b/djust-shipping-module-nuxt'],
})

Activation flag

The module always registers its imports, components and BFF routes when installed. The runtime feature flag that gates the checkout UI is runtimeConfig.public.djustShipping.enabled. An explicit value set by the app (or hydrated from Studio, like djust-pay) takes precedence over the module default:

// nuxt.config.ts — off by default, toggle per tenant/Studio
runtimeConfig: {
  public: {
    djustShipping: { enabled: false },
  },
},

Local dev linking (against a consumer)

For live iteration, consume it as a portal: dependency (symlink) so a module rebuild is picked up after a consumer dev-server restart:

// consumer package.json
"@djust-b2b/djust-shipping-module-nuxt": "portal:../djust-shipping-module-nuxt"
# in djust-shipping-module-nuxt
yarn install
yarn prepack       # builds dist/ (re-run after each change)

# in the consumer
yarn install       # creates the portal symlink
npx nuxi prepare   # regenerates auto-import/component types
# then restart the dev server

What it provides

The module is layered so a theme picks the level it needs:

  • Composables (auto-imported):
    • useDjustShipping() — low level: per-logistic-order option fetching, selection state, auto-select, isResolved guard.
    • useDjustShippingCheckout({ getOrder, onRefetch }) — high-level checkout orchestration: applyAddress(shippingAddressId) (address at commercial + logistic levels, then resolves the eligible modes), isResolved, hasUnavailable, orderLogistics, refresh(), applying.
  • Components (auto-imported, global):
    • <DjShippingSelector :order-id> — delivery-mode selector for one logistic order.
    • <DjShippingFees :amount> — shipping fees line.
    • <DjShippingFrancoBar> — franco progress bar per logistic with CSS variable theming.
    • <DjShippingModesList :order> — loops order.orderLogistics, renders per-logistic blocks with franco bar, product lines, and mode selector. Slots title/blocked/ no-options/products/loading. Fully customizable via props and CSS variables. Emits change.
  • BFF routes:
    • GET /api/shipping/logistic-orders/:orderId/options
    • PUT /api/shipping/logistic-orders/:orderId/type
    • PUT /api/shipping/commercial-orders/:orderId/address
    • PUT /api/shipping/logistic-orders/:orderId/address

Integration (starter-like Nuxt 4 themes)

For themes derived from the partners starter, integration is ~5 lines per shipping screen. See the Docus guide (yarn docs:dev/en/getting-started/integration or /fr/getting-started/integration) and the djust-shipping-integrate skill.

  1. Add the dependency and register the module (nuxt.config.ts modules).
  2. Add the flag: runtimeConfig.public.djustShipping = { enabled: '' } (env-driven, off by default) — mirrors the djustPay pattern.
  3. In the shipping screen, on address selection call the module orchestration instead of the hardcoded shippingType: 'STD':
const { getUserCurrency } = useUser()
const { getCart } = useCheckout()
const config = useRuntimeConfig()

const shippingModuleEnabled = computed(() => !!config.public.djustShipping?.enabled)
const addressApplied = ref(false)
const order = computed(() => useCheckoutStore().currentCart)
const currency = computed(() => getUserCurrency())
const orderLogistics = computed(() => order.value?.orderLogistics ?? [])

const refreshOrder = async () => {
  const ref_ = order.value?.reference
  if (ref_) await getCart(ref_)
}

const { applyAddress, isResolved: shippingResolved } = useDjustShippingCheckout({
  getOrder: () => order.value,
  onRefetch: refreshOrder,
})

// on address selection (module path):
addressApplied.value = await applyAddress(address.externalId)
  1. Render the list (module-owned UI + i18n), gated by the flag:
<DjShippingModesList
  v-if="shippingModuleEnabled && addressApplied && orderLogistics.length"
  :order="order"
  :currency="currency"
  @change="refreshOrder"
/>
  1. Gate the Continue/Pay button on shippingResolved when the flag is on, and keep the existing 'STD' flow in the else branch.

All user-facing strings for the group/list live in the module locales (djustShipping.group.*, djustShipping.modes.*) — do not re-add them in the theme.

Core (agnostic)

  • mapShippingOptions(raw) — normalize the shipping-information response (array or SDK wrapper) into ShippingOption[].
  • selectDefaultShippingType(options, current?) — keep valid current, else auto-select when single, else null.
  • isShippingResolved(states) — all logistic orders have a selected type.
  • computeFranco(source, { eligibleAmount }) — optional helper to normalize a franco threshold object (defensive field-name mapping) and derive the remaining amount; returns null when no franco applies. Not wired into V1 components.

The core is published under /core for Nuxt 2 or fully custom frontends (no Nuxt module — use your own API layer):

import { mapShippingOptions, selectDefaultShippingType, isShippingResolved }
  from '@djust-b2b/djust-shipping-module-nuxt/core'

Development

yarn install
yarn dev        # runs the playground
yarn test       # unit tests (core)
yarn lint

Documentation (Docus)

Site Docus bilingue FR / EN dans docs/.

yarn docs:dev      # http://localhost:3000/en or /fr
yarn docs:build

Pages clés :