{"_id":"@djust-b2b/djust-shipping-nuxt","_rev":"3-fc49546e19daed178767e486c2adb1b0","name":"@djust-b2b/djust-shipping-nuxt","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@djust-b2b/djust-shipping-nuxt","version":"1.0.0","author":{"name":"kevin.zounhon@djust.io"},"license":"MIT","_id":"@djust-b2b/djust-shipping-nuxt@1.0.0","maintainers":[{"name":"baccouche-sami","email":"sami@djust.io"}],"homepage":"https://gitlab.com/djustlab/front/core/djust-shipping-module-nuxt#readme","bugs":{"url":"https://gitlab.com/djustlab/front/core/djust-shipping-module-nuxt/issues"},"dist":{"shasum":"17966da44522086b6fb3cb74dde23711a4090da7","tarball":"https://registry.npmjs.org/@djust-b2b/djust-shipping-nuxt/-/djust-shipping-nuxt-1.0.0.tgz","fileCount":61,"integrity":"sha512-cSmb/hc1zAdM84Jw/ubZTlf8Me5eDB1HcvOVQNf+cZ6OYCbqnQFOiFS4VhNmbYoSmFJCWxjTV+x/wnKxl8So0A==","signatures":[{"sig":"MEQCIA17mDNIKbSOYHwbInSOVvPIrzpKl4v1KWDbpAU5FjISAiAIOe/HYUHpmwEg1wjkMuPFfO6AG98B0nmacd+HX0KOdQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":130766},"main":"./dist/module.mjs","type":"module","exports":{".":{"types":"./dist/types.d.mts","import":"./dist/module.mjs"},"./core":{"types":"./dist/runtime/core/index.d.ts","import":"./dist/runtime/core/index.js"}},"gitHead":"1bcad2a405a950f1c4a51473a3fe0c640d43264e","scripts":{"dev":"npm run dev:prepare && nuxi dev playground","lint":"eslint .","test":"vitest run","prepack":"nuxt-module-build build","release":"npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags","docs:dev":"cd docs && npm run dev","dev:build":"nuxi build playground","docs:build":"cd docs && npm run build","test:types":"vue-tsc --noEmit && cd playground && vue-tsc --noEmit","test:watch":"vitest watch","dev:prepare":"nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground"},"_npmUser":{"name":"baccouche-sami","email":"sami@djust.io"},"repository":{"url":"git+https://gitlab.com/djustlab/front/core/djust-shipping-module-nuxt.git","type":"git"},"_npmVersion":"11.18.0","description":"Djust Shipping Nuxt module","directories":{},"_nodeVersion":"22.23.1","dependencies":{"defu":"^6.1.4","@nuxt/kit":"^3.17.7","@nuxtjs/i18n":"^10.0.5"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"typesVersions":{"*":{".":["./dist/types.d.mts"],"core":["./dist/runtime/core/index.d.ts"]}},"_hasShrinkwrap":false,"packageManager":"yarn@4.9.3","devDependencies":{"nuxt":"^3.17.7","eslint":"^9.30.1","vitest":"^3.2.4","vue-tsc":"^3.0.1","typescript":"~5.8.3","@types/node":"latest","changelogen":"^0.6.2","@nuxt/schema":"^3.17.7","@nuxt/devtools":"^2.6.2","@nuxt/test-utils":"^3.19.2","semantic-release":"^22.0.12","@nuxt/eslint-config":"^1.5.2","@vitest/coverage-v8":"^3.2.4","@nuxt/module-builder":"^1.0.1","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^11.0.2","@semantic-release/gitlab":"^12.1.1","@semantic-release/changelog":"^6.0.3"},"peerDependencies":{"@nuxt/ui":"^4.0.1","@djust-b2b/djust-front-sdk":"^3.1.0"},"_npmOperationalInternal":{"tmp":"tmp/djust-shipping-nuxt_1.0.0_1785261571579_0.8008368467797733","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@djust-b2b/djust-shipping-nuxt","version":"1.0.1","author":{"name":"kevin.zounhon@djust.io"},"license":"MIT","_id":"@djust-b2b/djust-shipping-nuxt@1.0.1","maintainers":[{"name":"baccouche-sami","email":"sami@djust.io"}],"homepage":"https://gitlab.com/djustlab/front/core/djust-shipping-module-nuxt#readme","bugs":{"url":"https://gitlab.com/djustlab/front/core/djust-shipping-module-nuxt/issues"},"dist":{"shasum":"b06839d0a89fa3b7a1e46869c2c542e90f6d94f2","tarball":"https://registry.npmjs.org/@djust-b2b/djust-shipping-nuxt/-/djust-shipping-nuxt-1.0.1.tgz","fileCount":61,"integrity":"sha512-b0Qk8QSG4J/C4OZ0z3jBWNycDSoq6Tg1zwu+frPzRQAuisloN5W0eu0oTOe+2ej2lJyuVY2TQwkdHYGfSd2mLA==","signatures":[{"sig":"MEYCIQCQxSOpafTmyqEJSHiJ8tXxDvxbMMOdKuh8hQduUEvjrQIhAKRiqGX+eT8TWq8Ick+4u7CnOWxCXwORprZfzt0MondQ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":131079},"main":"./dist/module.mjs","type":"module","exports":{".":{"types":"./dist/types.d.mts","import":"./dist/module.mjs"},"./core":{"types":"./dist/runtime/core/index.d.ts","import":"./dist/runtime/core/index.js"}},"gitHead":"9719ff3775ffccbfd72e96fe67e32f4ad10ddf12","scripts":{"dev":"npm run dev:prepare && nuxi dev playground","lint":"eslint .","test":"vitest run","prepack":"nuxt-module-build build","release":"npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags","docs:dev":"cd docs && npm run dev","dev:build":"nuxi build playground","docs:build":"cd docs && npm run build","test:types":"vue-tsc --noEmit && cd playground && vue-tsc --noEmit","test:watch":"vitest watch","dev:prepare":"nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground"},"_npmUser":{"name":"baccouche-sami","email":"sami@djust.io"},"repository":{"url":"git+https://gitlab.com/djustlab/front/core/djust-shipping-module-nuxt.git","type":"git"},"_npmVersion":"11.19.0","description":"Djust Shipping Nuxt module","directories":{},"_nodeVersion":"22.23.2","dependencies":{"defu":"^6.1.4","@nuxt/kit":"^3.17.7","@nuxtjs/i18n":"^10.0.5"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"typesVersions":{"*":{".":["./dist/types.d.mts"],"core":["./dist/runtime/core/index.d.ts"]}},"_hasShrinkwrap":false,"packageManager":"yarn@4.9.3","devDependencies":{"nuxt":"^3.17.7","eslint":"^9.30.1","vitest":"^3.2.4","vue-tsc":"^3.0.1","typescript":"~5.8.3","@types/node":"latest","changelogen":"^0.6.2","@nuxt/schema":"^3.17.7","@nuxt/devtools":"^2.6.2","@nuxt/test-utils":"^3.19.2","semantic-release":"^22.0.12","@nuxt/eslint-config":"^1.5.2","@vitest/coverage-v8":"^3.2.4","@nuxt/module-builder":"^1.0.1","@semantic-release/git":"^10.0.1","@semantic-release/npm":"^11.0.2","@semantic-release/gitlab":"^12.1.1","@semantic-release/changelog":"^6.0.3"},"peerDependencies":{"@nuxt/ui":"^4.0.1","@djust-b2b/djust-front-sdk":"^3.1.0"},"_npmOperationalInternal":{"tmp":"tmp/djust-shipping-nuxt_1.0.1_1787650624164_0.5043577174038083","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-07-28T17:59:31.333Z","modified":"2026-09-11T09:03:31.579Z","1.0.0":"2026-07-28T17:59:31.715Z","1.0.1":"2026-08-25T09:37:04.302Z"},"bugs":{"url":"https://gitlab.com/djustlab/front/core/djust-shipping-module-nuxt/issues"},"author":{"name":"kevin.zounhon@djust.io"},"license":"MIT","homepage":"https://gitlab.com/djustlab/front/core/djust-shipping-module-nuxt#readme","repository":{"url":"git+https://gitlab.com/djustlab/front/core/djust-shipping-module-nuxt.git","type":"git"},"description":"Djust Shipping Nuxt module","maintainers":[{"email":"sami@djust.io","name":"baccouche-sami"},{"email":"quentin.roulland@djust.io","name":"roulland.quentin"}],"readme":"# @djust-b2b/djust-shipping-nuxt\n\nPlug-and-play Nuxt 3/4 module for the DJUST Front Office Client (FOC) shipping\nstep: real delivery-mode selection (aligned on the backend rate matrix) and\nshipping fees display, on top of the existing checkout APIs.\n\nIt ships a framework-agnostic core (`src/runtime/core`, pure TypeScript, no\nVue/Nuxt imports) so the business logic can be reused on Nuxt 2 or fully custom frontends.\n\n> The UI already supports **offered shipping** when the backend returns `price: 0`\n> with a non-zero `baseShippingPrice` (strikethrough + “Free”). If you want a\n> dedicated “franco progress” bar (threshold/remaining), use the `computeFranco`\n> helper from `/core` and build your own UI — it is not wired into V1 components.\n\n## Requirements\n\nThe host app must expose a request-scoped SDK on the Nitro event context:\n\n```ts\n// server/plugins/djust-sdk.ts (host)\nevent.context.djustSDK = () => useDjustSDK(event) // returns a DjustScopedClient\n```\n\nThe module BFF calls `sdk.services.logisticOrder.*` and\n`sdk.services.commercialOrder.updateShippingAddress` with `sdk.context`. These\nservice methods require **`@djust-b2b/djust-front-sdk` v3+**; if your project is still\npinned to SDK v2, keep the module disabled until upgraded, or use **core only** with your own API layer.\n\n## Install\n\n```bash\nnpm i @djust-b2b/djust-shipping-nuxt\n# or, during local development against the starter:\n# add \"@djust-b2b/djust-shipping-nuxt\": \"file:../djust-shipping-module-nuxt\"\n```\n\n```ts\n// nuxt.config.ts\nexport default defineNuxtConfig({\n  modules: ['@djust-b2b/djust-shipping-nuxt'],\n})\n```\n\n### Activation flag\n\nThe module always registers its imports, components and BFF routes when installed.\nThe **runtime feature flag** that gates the checkout UI is\n`runtimeConfig.public.djustShipping.enabled`. An explicit value set by the app\n(or hydrated from Studio, like `djust-pay`) takes precedence over the module\ndefault:\n\n```ts\n// nuxt.config.ts — off by default, toggle per tenant/Studio\nruntimeConfig: {\n  public: {\n    djustShipping: { enabled: false },\n  },\n},\n```\n\n### Local dev linking (against a consumer)\n\nFor live iteration, consume it as a `portal:` dependency (symlink) so a module\nrebuild is picked up after a consumer dev-server restart:\n\n```jsonc\n// consumer package.json\n\"@djust-b2b/djust-shipping-nuxt\": \"portal:../djust-shipping-module-nuxt\"\n```\n\n```bash\n# in djust-shipping-module-nuxt\nyarn install\nyarn prepack       # builds dist/ (re-run after each change)\n\n# in the consumer\nyarn install       # creates the portal symlink\nnpx nuxi prepare   # regenerates auto-import/component types\n# then restart the dev server\n```\n\n## What it provides\n\nThe module is layered so a theme picks the level it needs:\n\n- **Composables** (auto-imported):\n  - `useDjustShipping()` — low level: per-logistic-order option fetching,\n    selection state, auto-select, `isResolved` guard.\n  - `useDjustShippingCheckout({ getOrder, onRefetch })` — high-level checkout\n    orchestration: `applyAddress(shippingAddressId)` (address at commercial +\n    logistic levels, then resolves the eligible modes), `isResolved`,\n    `hasUnavailable`, `orderLogistics`, `refresh()`, `applying`.\n- **Components** (auto-imported, global):\n  - `<DjShippingSelector :order-id>` — delivery-mode selector for one logistic order.\n  - `<DjShippingFees :amount>` — shipping fees line.\n  - `<DjShippingFrancoBar>` — franco progress bar per logistic with CSS variable theming.\n  - `<DjShippingModesList :order>` — loops `order.orderLogistics`, renders per-logistic\n    blocks with franco bar, product lines, and mode selector. Slots `title`/`blocked`/\n    `no-options`/`products`/`loading`. Fully customizable via props and CSS variables.\n    Emits `change`.\n- **BFF routes**:\n  - `GET /api/shipping/logistic-orders/:orderId/options`\n  - `PUT /api/shipping/logistic-orders/:orderId/type`\n  - `PUT /api/shipping/commercial-orders/:orderId/address`\n  - `PUT /api/shipping/logistic-orders/:orderId/address`\n\n## Integration (starter-like Nuxt 4 themes)\n\nFor themes derived from the **partners starter**, integration is ~5 lines per shipping screen.\nSee the Docus guide (`yarn docs:dev` → `/en/getting-started/integration` or `/fr/getting-started/integration`) and the `djust-shipping-integrate` skill.\n\n1. Add the dependency and register the module (`nuxt.config.ts` `modules`).\n2. Add the flag: `runtimeConfig.public.djustShipping = { enabled: '' }` (env-driven,\n   off by default) — mirrors the `djustPay` pattern.\n3. In the shipping screen, on address selection call the module orchestration\n   instead of the hardcoded `shippingType: 'STD'`:\n\n```ts\nconst { getUserCurrency } = useUser()\nconst { getCart } = useCheckout()\nconst config = useRuntimeConfig()\n\nconst shippingModuleEnabled = computed(() => !!config.public.djustShipping?.enabled)\nconst addressApplied = ref(false)\nconst order = computed(() => useCheckoutStore().currentCart)\nconst currency = computed(() => getUserCurrency())\nconst orderLogistics = computed(() => order.value?.orderLogistics ?? [])\n\nconst refreshOrder = async () => {\n  const ref_ = order.value?.reference\n  if (ref_) await getCart(ref_)\n}\n\nconst { applyAddress, isResolved: shippingResolved } = useDjustShippingCheckout({\n  getOrder: () => order.value,\n  onRefetch: refreshOrder,\n})\n\n// on address selection (module path):\naddressApplied.value = await applyAddress(address.externalId)\n```\n\n4. Render the list (module-owned UI + i18n), gated by the flag:\n\n```vue\n<DjShippingModesList\n  v-if=\"shippingModuleEnabled && addressApplied && orderLogistics.length\"\n  :order=\"order\"\n  :currency=\"currency\"\n  @change=\"refreshOrder\"\n/>\n```\n\n5. Gate the Continue/Pay button on `shippingResolved` when the flag is on, and\n   keep the existing `'STD'` flow in the `else` branch.\n\nAll user-facing strings for the group/list live in the module locales\n(`djustShipping.group.*`, `djustShipping.modes.*`) — do not re-add them in the\ntheme.\n\n## Core (agnostic)\n\n- `mapShippingOptions(raw)` — normalize the shipping-information response\n  (array or SDK wrapper) into `ShippingOption[]`.\n- `selectDefaultShippingType(options, current?)` — keep valid current, else\n  auto-select when single, else `null`.\n- `isShippingResolved(states)` — all logistic orders have a selected type.\n- `computeFranco(source, { eligibleAmount })` — optional helper to normalize a\n  franco threshold object (defensive field-name mapping) and derive the remaining\n  amount; returns `null` when no franco applies. Not wired into V1 components.\n\nThe core is published under `/core` for **Nuxt 2 or fully custom frontends** (no Nuxt module — use your own API layer):\n\n```ts\nimport { mapShippingOptions, selectDefaultShippingType, isShippingResolved }\n  from '@djust-b2b/djust-shipping-nuxt/core'\n```\n\n## Development\n\n```bash\nyarn install\nyarn dev        # runs the playground\nyarn test       # unit tests (core)\nyarn lint\n```\n\n## Documentation (Docus)\n\nSite [Docus](https://docus.dev) bilingue **FR / EN** dans `docs/`.\n\n```bash\nyarn docs:dev      # http://localhost:3000/en or /fr\nyarn docs:build\n```\n\nPages clés :\n\n- [Integration guide (EN)](docs/content/en/1.getting-started/5.integration.md)\n- [Guide d'intégration (FR)](docs/content/fr/1.getting-started/5.integration.md)\n- [AI Integration / MCP (EN)](docs/content/en/3.ai-integration/1.mcp.md) — endpoint `/mcp`\n- [Intégration IA / MCP (FR)](docs/content/fr/3.ai-integration/1.mcp.md)\n- [Skills (EN)](docs/content/en/3.ai-integration/2.skills.md) — `djust-shipping-integrate`\n","readmeFilename":"README.md"}