@altazion/commerce-sdk-vue 1.0.0 → 26.331.7500
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/README.md +138 -0
- package/package.json +5 -2
package/README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# @altazion/commerce-sdk-vue
|
|
2
|
+
|
|
3
|
+
Plugin Vue 3 pour l'Altazion Commerce SDK. Fournit des stores Pinia réactifs, des composables et des composants prêts à l'emploi.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @altazion/commerce-sdk-vue @altazion/commerce-sdk-core
|
|
9
|
+
npm install vue pinia # peer dependencies
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Configuration
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
// main.ts
|
|
16
|
+
import { createApp } from 'vue'
|
|
17
|
+
import { createPinia } from 'pinia'
|
|
18
|
+
import { AltazionCommercePlugin } from '@altazion/commerce-sdk-vue'
|
|
19
|
+
|
|
20
|
+
const app = createApp(App)
|
|
21
|
+
app.use(createPinia())
|
|
22
|
+
app.use(AltazionCommercePlugin, {
|
|
23
|
+
baseUrl: 'https://votre-api.altazion.com',
|
|
24
|
+
siteUrl: 'https://votre-site.com',
|
|
25
|
+
})
|
|
26
|
+
app.mount('#app')
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Stores Pinia
|
|
30
|
+
|
|
31
|
+
### `useCartStore`
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { useCartStore } from '@altazion/commerce-sdk-vue'
|
|
35
|
+
|
|
36
|
+
const cartStore = useCartStore()
|
|
37
|
+
|
|
38
|
+
await cartStore.load() // charger le panier
|
|
39
|
+
await cartStore.addItem('REF-001', 2)
|
|
40
|
+
await cartStore.updateItem(lineId, 3)
|
|
41
|
+
await cartStore.removeItem(lineId)
|
|
42
|
+
await cartStore.applyCoupon('PROMO10')
|
|
43
|
+
await cartStore.clear()
|
|
44
|
+
|
|
45
|
+
cartStore.cart // Cart | null
|
|
46
|
+
cartStore.itemCount // nombre d'articles (computed)
|
|
47
|
+
cartStore.total // total TTC (computed)
|
|
48
|
+
cartStore.isEmpty // boolean (computed)
|
|
49
|
+
cartStore.loading // boolean
|
|
50
|
+
cartStore.isOffline // boolean
|
|
51
|
+
cartStore.hasPendingOperations // mutations en attente de sync
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### `useCatalogStore`
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { useCatalogStore } from '@altazion/commerce-sdk-vue'
|
|
58
|
+
|
|
59
|
+
const catalogStore = useCatalogStore()
|
|
60
|
+
|
|
61
|
+
await catalogStore.loadProduct('REF-001')
|
|
62
|
+
await catalogStore.loadCategory('chaussures', 0, 20)
|
|
63
|
+
|
|
64
|
+
catalogStore.currentProduct // ProductDetails | null
|
|
65
|
+
catalogStore.categoryResult // SearchResult | null
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### `useSearchStore`
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { useSearchStore } from '@altazion/commerce-sdk-vue'
|
|
72
|
+
|
|
73
|
+
const searchStore = useSearchStore()
|
|
74
|
+
|
|
75
|
+
await searchStore.search({ q: 'sneakers', offset: 0, length: 12 })
|
|
76
|
+
await searchStore.suggest('sneak')
|
|
77
|
+
|
|
78
|
+
searchStore.result // SearchResult | null
|
|
79
|
+
searchStore.suggestions // string[]
|
|
80
|
+
searchStore.query // string (dernière query)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `useSessionStore`
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
import { useSessionStore } from '@altazion/commerce-sdk-vue'
|
|
87
|
+
|
|
88
|
+
const sessionStore = useSessionStore()
|
|
89
|
+
|
|
90
|
+
await sessionStore.load()
|
|
91
|
+
|
|
92
|
+
sessionStore.session // SessionInfo | null
|
|
93
|
+
sessionStore.isOnline // boolean réactif
|
|
94
|
+
sessionStore.isKiosk // boolean
|
|
95
|
+
sessionStore.isReady // boolean
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Composants
|
|
99
|
+
|
|
100
|
+
### `<ProductCard>`
|
|
101
|
+
|
|
102
|
+
```vue
|
|
103
|
+
<ProductCard :product="product" :show-add-to-cart="true" />
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
| Prop | Type | Description |
|
|
107
|
+
|---|---|---|
|
|
108
|
+
| `product` | `WebProduct` | Produit à afficher |
|
|
109
|
+
| `showAddToCart` | `boolean` | Affiche le bouton d'ajout au panier |
|
|
110
|
+
|
|
111
|
+
### `<CartSummary>`
|
|
112
|
+
|
|
113
|
+
```vue
|
|
114
|
+
<CartSummary :show-lines="true" />
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
| Prop | Type | Description |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| `showLines` | `boolean` | Affiche le détail des lignes |
|
|
120
|
+
|
|
121
|
+
### `<AddToCartButton>`
|
|
122
|
+
|
|
123
|
+
```vue
|
|
124
|
+
<AddToCartButton reference="REF-001" :quantity="1" />
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Composable bas niveau
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { useCommerceClient } from '@altazion/commerce-sdk-vue'
|
|
131
|
+
|
|
132
|
+
// Accès direct au CommerceClient dans n'importe quel composant
|
|
133
|
+
const client = useCommerceClient()
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Licence
|
|
137
|
+
|
|
138
|
+
Propriétaire — © Altazion SAS. Tous droits réservés.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altazion/commerce-sdk-vue",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.331.7500",
|
|
4
4
|
"description": "Altazion Commerce SDK — Plugin Vue 3 avec stores Pinia et composants",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"files": [
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
17
20
|
"scripts": {
|
|
18
21
|
"build": "vite build",
|
|
19
22
|
"dev": "vite build --watch",
|