@viur/shop-components 0.0.1-dev.9 → 0.1.1

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.
Files changed (56) hide show
  1. package/.editorconfig +16 -0
  2. package/.github/workflows/npm-publish.yml +42 -0
  3. package/.gitmodules +3 -0
  4. package/LICENSE +21 -0
  5. package/README.md +13 -2
  6. package/package.json +23 -11
  7. package/src/Shop.vue +232 -0
  8. package/src/ShopOrderStepper.vue +114 -0
  9. package/src/ShopSummary.vue +196 -0
  10. package/src/Steps/ShopCart.vue +57 -0
  11. package/src/Steps/ShopOrderComplete.vue +32 -0
  12. package/src/Steps/ShopOrderConfirm.vue +300 -0
  13. package/src/Steps/ShopPaymentProvider.vue +56 -0
  14. package/src/Steps/ShopShippingMethod.vue +67 -0
  15. package/src/Steps/ShopUserDataGuest.vue +82 -0
  16. package/src/Steps/index.js +15 -0
  17. package/src/components/AddressForm.vue +95 -0
  18. package/src/components/AddressFormLayout.vue +107 -0
  19. package/src/components/CardSelector.vue +68 -0
  20. package/src/components/CartItem.vue +353 -0
  21. package/src/components/CartItemSmall.vue +257 -0
  22. package/src/components/DiscountInput.vue +91 -0
  23. package/src/components/LoadingHandler.vue +76 -0
  24. package/src/components/PaymentOption.vue +78 -0
  25. package/src/components/PaymentProviderUnzer.vue +201 -0
  26. package/src/components/PaymentSelector.vue +55 -0
  27. package/src/components/ShopAlert.vue +30 -0
  28. package/src/components/StepperTab.vue +132 -0
  29. package/src/components/dialogButton.vue +49 -0
  30. package/src/composables/address.js +95 -0
  31. package/src/composables/cart.js +189 -0
  32. package/src/composables/order.js +80 -0
  33. package/src/composables/payment.js +75 -0
  34. package/src/composables/shipping.js +40 -0
  35. package/src/main.js +44 -0
  36. package/src/shop.js +252 -0
  37. package/src/translations/de.js +36 -0
  38. package/src/translations/en.js +5 -0
  39. package/src/utils.js +56 -0
  40. package/vite.config.js +51 -0
  41. package/src/components/cart/CartView.vue +0 -693
  42. package/src/components/cart/ConfirmView.vue +0 -314
  43. package/src/components/order/category/CategoryList.vue +0 -83
  44. package/src/components/order/category/CategoryView.vue +0 -143
  45. package/src/components/order/information/UserInfoMulti.vue +0 -427
  46. package/src/components/order/information/UserInformation.vue +0 -332
  47. package/src/components/order/information/adress/ShippingAdress.vue +0 -143
  48. package/src/components/order/item/ItemCard.vue +0 -168
  49. package/src/components/order/item/ItemView.vue +0 -233
  50. package/src/components/order/process/ExampleUsage.vue +0 -100
  51. package/src/components/order/process/OrderComplete.vue +0 -41
  52. package/src/components/order/process/OrderTabHeader.vue +0 -7
  53. package/src/components/order/process/OrderView.vue +0 -210
  54. package/src/router/index.js +0 -103
  55. package/src/stores/cart.js +0 -119
  56. package/src/views/ViewMissing.vue +0 -20
@@ -1,119 +0,0 @@
1
- import { reactive } from "vue";
2
- import { Request, ListRequest } 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 shopClient = new ViURShopClient({
8
- host_url:
9
- window.location.origin === "http://localhost:8081"
10
- ? "http://localhost:8080"
11
- : window.location.origin,
12
- });
13
-
14
- const state = reactive({
15
- basket: "",
16
- carts: {},
17
- structure: { address: {}, cart: {} },
18
- });
19
-
20
- async function init() {
21
- await getCarts();
22
- }
23
-
24
- async function getCarts() {
25
- let carts = await shopClient.cart_list();
26
-
27
- console.log("cartStore.init() carts", carts);
28
-
29
- carts.forEach(async (cart) => {
30
- console.log("cartStore.init().forEach cart", cart);
31
-
32
- state.carts[cart.key] = {};
33
- state.carts[cart.key].info = cart;
34
- if (cart.cart_type === "basket") {
35
- state.basket = cart.key;
36
- }
37
- await getCartItems(cart.key);
38
- });
39
- }
40
-
41
- async function getCartItems(cartKey) {
42
- shopClient.cart_list({ cart_key: cartKey }).then((resp) => {
43
- console.log("cartStore.init() cartItems", resp);
44
- state.carts[cartKey].items = resp;
45
- });
46
- }
47
-
48
- async function addToCart(articleKey, cartKey) {
49
- let resp = await shopClient.article_add({
50
- article_key: articleKey,
51
- parent_cart_key: cartKey,
52
- });
53
-
54
- await updateCart(cartKey);
55
- console.log("addToCart", resp); //TODO: Errorhandling as soon as shop module works again
56
- }
57
-
58
- async function getArticleView(articleKey, cartKey) {
59
- let article = await shopClient.article_view({
60
- article_key: articleKey,
61
- parent_cart_key: cartKey,
62
- });
63
-
64
- console.log("getArticleView", article); // ? Talk about necessarity
65
- }
66
-
67
- async function removeItem(articleKey, cartKey) {
68
- let resp = await shopClient.article_remove({
69
- article_key: articleKey,
70
- parent_cart_key: cartKey,
71
- });
72
-
73
- await updateCart(cartKey);
74
-
75
- console.log("remove Resp", resp); //TODO: Errorhandling as soon as shop module works again
76
- }
77
-
78
- async function updateItem(articleKey, cartKey, quantity) {
79
- let resp = await shopClient.article_update({
80
- article_key: articleKey,
81
- parent_cart_key: cartKey,
82
- quantity: quantity,
83
- quantity_mode: "replace",
84
- });
85
-
86
- if (quantity === 0) {
87
- await updateCart(cartKey);
88
- }
89
- console.log("update Resp", resp); //TODO: Errorhandling as soon as shop module works again
90
- }
91
-
92
- async function updateCart(cartKey) {
93
- await getCartItems(cartKey);
94
- }
95
-
96
- async function getAdressStructure() {
97
- let addSkel = await shopClient.address_structure();
98
- state.structure.address = addSkel.addSkel;
99
-
100
- console.log("adress add", state.structure.address);
101
-
102
- // Request.getStructure("shop.address").then(async (resp) => {
103
- // let data = await resp.json();
104
- // state.structure.address = data.addSkel;
105
-
106
- // console.log("adress add", state.structure.address);
107
- // });
108
- }
109
-
110
- return {
111
- state,
112
- addToCart,
113
- getArticleView,
114
- removeItem,
115
- updateItem,
116
- init,
117
- getAdressStructure,
118
- };
119
- });
@@ -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>