@viur/shop-components 0.0.1-dev.2 → 0.0.1-dev.3
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 +11 -0
- package/dist/shop-components.js +36284 -0
- package/dist/shop-components.umd.cjs +6974 -0
- package/dist/style.css +1 -0
- package/package.json +28 -20
- package/src/App.vue +0 -30
- package/src/components/cart/BasketView.vue +0 -569
- package/src/components/order/category/CategoryList.vue +0 -83
- package/src/components/order/category/CategoryView.vue +0 -103
- package/src/components/order/item/ItemCard.vue +0 -182
- package/src/components/order/item/ItemView.vue +0 -233
- package/src/index.html +0 -13
- package/src/index.js +0 -4
- package/src/main.js +0 -9
- package/src/router/index.js +0 -93
- package/src/shoelaceConfig.js +0 -54
- package/src/stores/cart.js +0 -98
- package/src/style.css +0 -79
- package/src/views/ViewMissing.vue +0 -20
- package/vite.config.js +0 -23
package/src/stores/cart.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { reactive } from "vue";
|
|
2
|
-
import { Request } from "@viur/vue-utils";
|
|
3
|
-
import { defineStore } from "pinia";
|
|
4
|
-
import { ViURShopClient } from "@viur/viur-shop-client";
|
|
5
|
-
|
|
6
|
-
export const useCartStore = defineStore("cartstore", () => {
|
|
7
|
-
const state = reactive({
|
|
8
|
-
currentCart: "",
|
|
9
|
-
allCarts: {},
|
|
10
|
-
cartItems: {},
|
|
11
|
-
basketArticle: [],
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
function init() {
|
|
15
|
-
listCarts().then(async (resp) => {
|
|
16
|
-
let data = await resp.json();
|
|
17
|
-
getBasket(data);
|
|
18
|
-
data.forEach((cart) => {
|
|
19
|
-
state.allCarts[cart.key] = cart;
|
|
20
|
-
getCartItems(cart.key).then(async (resp) => {
|
|
21
|
-
let data = await resp.json();
|
|
22
|
-
state.cartItems[cart.key] = data;
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
console.log("hier", state.currentCart);
|
|
28
|
-
|
|
29
|
-
getBasketItems(state.currentCart).then(async (resp) => {
|
|
30
|
-
let data = await resp.json();
|
|
31
|
-
console.log("cartStore basket article", data);
|
|
32
|
-
state.basketArticle = data;
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// state.allCarts.forEach((cart) => {
|
|
36
|
-
// getCartItems(cart.key).then(async (resp) => {
|
|
37
|
-
// let data = await resp.json();
|
|
38
|
-
// state.cartItems[cartKey] = data;
|
|
39
|
-
// });
|
|
40
|
-
// });
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function listCarts() {
|
|
44
|
-
return Request.get("/shop/api/cart_list");
|
|
45
|
-
// const sc = new ViURShopClient();
|
|
46
|
-
|
|
47
|
-
// sc.cart_list().then(async (resp) => console.log("test", await resp.json));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function getBasket(skellist) {
|
|
51
|
-
skellist.forEach((cart) => {
|
|
52
|
-
if ((cart.cart_type = "basket")) {
|
|
53
|
-
state.currentCart = cart.key;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function getBasketItems(cartKey) {
|
|
59
|
-
return Request.get(`/shop/api/cart_list`, {
|
|
60
|
-
dataObj: { cart_key: cartKey },
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function getCartItems(cartKey) {
|
|
65
|
-
return Request.get(`/shop/api/cart_list`, {
|
|
66
|
-
dataObj: { cart_key: cartKey },
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function addToCart(articleKey, cartKey) {
|
|
71
|
-
// let skey = "";
|
|
72
|
-
// Request.get("/vi/skey?amount=1").then(async (resp) => {
|
|
73
|
-
// let data = await resp.json();
|
|
74
|
-
// console.log("skey", data);
|
|
75
|
-
// skey = data;
|
|
76
|
-
// });
|
|
77
|
-
Request.securePost("/shop/api/article_add", {
|
|
78
|
-
dataObj: {
|
|
79
|
-
article_key: articleKey,
|
|
80
|
-
parent_cart_key: cartKey,
|
|
81
|
-
quantity: 1,
|
|
82
|
-
quantity_mode: "increase",
|
|
83
|
-
// skey: skey,
|
|
84
|
-
},
|
|
85
|
-
}).then(async (resp) => {
|
|
86
|
-
let data = await resp.json();
|
|
87
|
-
console.log("article add", data);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return {
|
|
92
|
-
state,
|
|
93
|
-
listCarts,
|
|
94
|
-
addToCart,
|
|
95
|
-
getBasketItems,
|
|
96
|
-
init,
|
|
97
|
-
};
|
|
98
|
-
});
|
package/src/style.css
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
-
line-height: 1.5;
|
|
4
|
-
font-weight: 400;
|
|
5
|
-
|
|
6
|
-
color-scheme: light dark;
|
|
7
|
-
color: rgba(255, 255, 255, 0.87);
|
|
8
|
-
background-color: #242424;
|
|
9
|
-
|
|
10
|
-
font-synthesis: none;
|
|
11
|
-
text-rendering: optimizeLegibility;
|
|
12
|
-
-webkit-font-smoothing: antialiased;
|
|
13
|
-
-moz-osx-font-smoothing: grayscale;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
a {
|
|
17
|
-
font-weight: 500;
|
|
18
|
-
color: #646cff;
|
|
19
|
-
text-decoration: inherit;
|
|
20
|
-
}
|
|
21
|
-
a:hover {
|
|
22
|
-
color: #535bf2;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
body {
|
|
26
|
-
margin: 0;
|
|
27
|
-
display: flex;
|
|
28
|
-
place-items: center;
|
|
29
|
-
min-width: 320px;
|
|
30
|
-
min-height: 100vh;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
h1 {
|
|
34
|
-
font-size: 3.2em;
|
|
35
|
-
line-height: 1.1;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
button {
|
|
39
|
-
border-radius: 8px;
|
|
40
|
-
border: 1px solid transparent;
|
|
41
|
-
padding: 0.6em 1.2em;
|
|
42
|
-
font-size: 1em;
|
|
43
|
-
font-weight: 500;
|
|
44
|
-
font-family: inherit;
|
|
45
|
-
background-color: #1a1a1a;
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
transition: border-color 0.25s;
|
|
48
|
-
}
|
|
49
|
-
button:hover {
|
|
50
|
-
border-color: #646cff;
|
|
51
|
-
}
|
|
52
|
-
button:focus,
|
|
53
|
-
button:focus-visible {
|
|
54
|
-
outline: 4px auto -webkit-focus-ring-color;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.card {
|
|
58
|
-
padding: 2em;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
#app {
|
|
62
|
-
max-width: 1280px;
|
|
63
|
-
margin: 0 auto;
|
|
64
|
-
padding: 2rem;
|
|
65
|
-
text-align: center;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@media (prefers-color-scheme: light) {
|
|
69
|
-
:root {
|
|
70
|
-
color: #213547;
|
|
71
|
-
background-color: #ffffff;
|
|
72
|
-
}
|
|
73
|
-
a:hover {
|
|
74
|
-
color: #747bff;
|
|
75
|
-
}
|
|
76
|
-
button {
|
|
77
|
-
background-color: #f9f9f9;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="home">View {{ route.path }} is missing.</div>
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
import { defineComponent, reactive } from "vue"
|
|
7
|
-
import { useRoute } from "vue-router"
|
|
8
|
-
|
|
9
|
-
export default defineComponent({
|
|
10
|
-
props: {},
|
|
11
|
-
components: {},
|
|
12
|
-
setup(props, context) {
|
|
13
|
-
const route = useRoute()
|
|
14
|
-
const state = reactive({})
|
|
15
|
-
return { state, route }
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
</script>
|
|
19
|
-
|
|
20
|
-
<style scoped></style>
|
package/vite.config.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite'
|
|
2
|
-
import vue from '@vitejs/plugin-vue'
|
|
3
|
-
import { resolve } from "node:path";
|
|
4
|
-
|
|
5
|
-
// https://vitejs.dev/config/
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
plugins: [vue()],
|
|
8
|
-
build: {
|
|
9
|
-
lib: {
|
|
10
|
-
entry: resolve(__dirname, "src/index.js"),
|
|
11
|
-
name: "ShopComponents",
|
|
12
|
-
fileName: "shop-components",
|
|
13
|
-
},
|
|
14
|
-
rollupOptions: {
|
|
15
|
-
external: ["vue"],
|
|
16
|
-
output: {
|
|
17
|
-
globals: {
|
|
18
|
-
vue: "Vue",
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
});
|