@viur/shop-components 0.14.3 → 0.14.5

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.
@@ -8,6 +8,10 @@ on:
8
8
  tags:
9
9
  - v*
10
10
 
11
+ permissions:
12
+ contents: read
13
+ id-token: write
14
+
11
15
  jobs:
12
16
  publish-npm:
13
17
  runs-on: ubuntu-latest
@@ -18,11 +22,28 @@ jobs:
18
22
  with:
19
23
  node-version: 22
20
24
  registry-url: https://registry.npmjs.org/
25
+
26
+ - name: Ensure npm supports trusted publishing
27
+ run: npm install -g npm@latest
21
28
  - run: npm ci
22
- - name: Publish npm package
23
- run: npm publish
24
- env:
25
- NODE_AUTH_TOKEN: ${{secrets.NPM_API_TOKEN}}
29
+
30
+ - name: Determine npm tag
31
+ id: npm_tag
32
+ run: |
33
+ TAG_NAME="${GITHUB_REF_NAME}"
34
+ echo "Detected tag: $TAG_NAME"
35
+
36
+ if [[ "$TAG_NAME" =~ -alpha[0-9]*$ ]]; then
37
+ echo "tag=alpha" >> $GITHUB_OUTPUT
38
+ elif [[ "$TAG_NAME" =~ -beta[0-9]*$ ]]; then
39
+ echo "tag=beta" >> $GITHUB_OUTPUT
40
+ elif [[ "$TAG_NAME" =~ -rc[0-9]*$ ]]; then
41
+ echo "tag=rc" >> $GITHUB_OUTPUT
42
+ else
43
+ echo "tag=latest" >> $GITHUB_OUTPUT
44
+ fi
45
+ - name: Publish to npm (Trusted Publishing)
46
+ run: npm publish --access public --tag ${{ steps.npm_tag.outputs.tag }}
26
47
 
27
48
 
28
49
  gh-release:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viur/shop-components",
3
- "version": "0.14.3",
3
+ "version": "0.14.5",
4
4
  "description": "Frontend Vue components for the shop module of ViUR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,7 +25,7 @@
25
25
  "dependencies": {
26
26
  "@viur/ignite": "^5.1.2",
27
27
  "@viur/shoelace": "^1.0.10-v2.20.0",
28
- "@viur/vue-utils": "^3.1.4",
28
+ "@viur/vue-utils": "^3.3.1",
29
29
  "@vueuse/core": "^13.1.0",
30
30
  "pinia": "^2.3.1",
31
31
  "vue": "^3.5.13",
package/src/Shop.vue CHANGED
@@ -26,7 +26,9 @@
26
26
  </div>
27
27
 
28
28
  <div class="viur-shop-sidebar-wrap" :class="{ bottom: (summary==='bottom') }" v-if="shopStore.state.currentTab!=='complete'">
29
- <shop-summary ></shop-summary>
29
+ <slot name="summary">
30
+ <shop-summary ></shop-summary>
31
+ </slot>
30
32
  </div>
31
33
  </div>
32
34
  <template v-if="shopStore.state.debug">
@@ -1,11 +1,12 @@
1
1
  <template>
2
2
  <sl-tab-group
3
- class="viur-shop-order-tabgroup"
4
- noScrollControls
5
3
  ref="stepper"
4
+ class="viur-shop-order-tabgroup"
5
+ no-scroll-controls
6
6
  >
7
7
  <template v-for="(tab,name) in shopStore.state.tabs">
8
- <StepperTab v-show="shopStore.state.currentTab!=='complete'"
8
+ <StepperTab
9
+ v-show="shopStore.state.currentTab!=='complete'"
9
10
  :tab="name"
10
11
  >
11
12
  </StepperTab>
@@ -16,20 +17,9 @@
16
17
  <component :is="tab['component']" :params="tab['params']">
17
18
  <template #top_actions="slotProps">
18
19
  <sl-bar class="viur-shop-stepper-bar">
19
- <div v-if="slotProps.left" slot="left" :id="slotProps.left"></div>
20
+ <div v-if="slotProps.left" :id="slotProps.left" slot="left"></div>
20
21
  <div slot="right">
21
- <span v-if="slotProps.hint" class="hint">{{ slotProps.hint }}</span>
22
- <sl-button
23
- :class="{'action-button-hint':slotProps.hint}"
24
- variant="success"
25
- size="large"
26
- :disabled="active(slotProps)"
27
- @click="nextStep(slotProps)"
28
- :loading="tab['validating']"
29
- >
30
- {{slotProps.nextName}}
31
- <sl-icon slot="suffix" name="chevron-right"></sl-icon>
32
- </sl-button>
22
+
33
23
  </div>
34
24
  </sl-bar>
35
25
  </template>
@@ -38,22 +28,11 @@
38
28
  <slot :name="'template_'+name"></slot>
39
29
  </template>
40
30
 
41
- <template v-slot="slotProps">
31
+ <template #default="slotProps">
42
32
  <sl-bar class="viur-shop-stepper-bar">
43
- <div v-if="slotProps.left" slot="left" :id="slotProps.left"></div>
33
+ <div v-if="slotProps.left" :id="slotProps.left" slot="left"></div>
44
34
  <div slot="right">
45
- <span v-if="slotProps.hint" class="hint">{{ slotProps.hint }}</span>
46
- <sl-button
47
- :class="{'action-button-hint':slotProps.hint}"
48
- variant="success"
49
- size="large"
50
- :disabled="active(slotProps)"
51
- @click="nextStep(slotProps)"
52
- :loading="tab['validating']"
53
- >
54
- {{slotProps.nextName}}
55
- <sl-icon slot="suffix" name="chevron-right"></sl-icon>
56
- </sl-button>
35
+ <component :is="shopStore.state.stepperActionComponent" :conf="slotProps" :tab="tab"></component>
57
36
  </div>
58
37
  </sl-bar>
59
38
  </template>
@@ -88,18 +67,11 @@ onMounted(()=>{
88
67
  })
89
68
  })
90
69
 
91
- function nextStep(obj){
92
- shopStore.tabValidation(obj.nextfunction, shopStore.navigateToNext)
93
- }
94
70
 
95
- function active(obj){
96
- return !obj.activefunction()
97
- }
98
71
 
99
72
  </script>
100
73
 
101
74
  <style scoped>
102
-
103
75
  sl-tab-group {
104
76
  flex-grow: 1;
105
77
  &::part(base) {
@@ -134,20 +106,4 @@ sl-tab-panel {
134
106
  }
135
107
  }
136
108
 
137
- .hint{
138
- border:1px solid var(--sl-color-neutral-200);
139
- border-top-left-radius: var(--sl-input-border-radius-medium);
140
- border-bottom-left-radius: var(--sl-input-border-radius-medium);
141
- background-color: var(--sl-color-neutral-100);
142
- color:var(--sl-color-neutral-800);
143
- padding: 0 var(--sl-spacing-small);
144
- height: auto;
145
- min-height: var(--sl-input-height-large);
146
- font-size: var(--sl-button-font-size-large);
147
- line-height: calc(var(--sl-input-height-large) - var(--sl-input-border-width) * 2);
148
- }
149
- .action-button-hint::part(base){
150
- border-top-left-radius: 0;
151
- border-bottom-left-radius: 0;
152
- }
153
109
  </style>
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <span v-if="conf.hint" class="hint">{{ conf.hint }}</span>
3
+ <sl-button
4
+ :class="{'action-button-hint':conf.hint}"
5
+ variant="success"
6
+ size="large"
7
+ :disabled="active(conf)"
8
+ :loading="tab['validating']"
9
+ @click="nextStep(conf)"
10
+ >
11
+ {{conf.nextName}}
12
+ <sl-icon slot="suffix" name="chevron-right"></sl-icon>
13
+ </sl-button>
14
+
15
+ </template>
16
+ <script setup>
17
+ import {useViurShopStore} from './shop'
18
+ const shopStore = useViurShopStore()
19
+
20
+ const props = defineProps({
21
+ conf:{
22
+ type:Object,
23
+ reuqired:true
24
+ },
25
+ tab:{
26
+ type:Object,
27
+ reuqired:true
28
+ }
29
+
30
+ })
31
+
32
+ function nextStep(obj){
33
+ shopStore.tabValidation(obj.nextfunction, shopStore.navigateToNext)
34
+ }
35
+
36
+ function active(obj){
37
+ return !obj.activefunction()
38
+ }
39
+
40
+ </script>
41
+
42
+ <style scoped>
43
+ .hint{
44
+ border:1px solid var(--sl-color-neutral-200);
45
+ border-top-left-radius: var(--sl-input-border-radius-medium);
46
+ border-bottom-left-radius: var(--sl-input-border-radius-medium);
47
+ background-color: var(--sl-color-neutral-100);
48
+ color:var(--sl-color-neutral-800);
49
+ padding: 0 var(--sl-spacing-small);
50
+ height: auto;
51
+ min-height: var(--sl-input-height-large);
52
+ font-size: var(--sl-button-font-size-large);
53
+ line-height: calc(var(--sl-input-height-large) - var(--sl-input-border-width) * 2);
54
+ }
55
+ .action-button-hint::part(base){
56
+ border-top-left-radius: 0;
57
+ border-bottom-left-radius: 0;
58
+ }
59
+ </style>
@@ -16,7 +16,7 @@
16
16
  </template>
17
17
 
18
18
  <script setup>
19
- import {computed, reactive, watch} from 'vue'
19
+ import {computed, onMounted, reactive, watch} from 'vue'
20
20
  import LoadingHandler from './LoadingHandler.vue';
21
21
  import ViForm from "@viur/vue-utils/forms/ViForm.vue";
22
22
  import {useViurShopStore} from "../shop";
@@ -80,6 +80,15 @@ function formChange(data){
80
80
  }
81
81
  }
82
82
 
83
+ onMounted(()=>{
84
+ // Set form language based on locale (use locale if not de-DE, otherwise use store language)
85
+ if (shopStore.state.locale!=="de-DE"){
86
+ state.language = shopStore.state.locale.split("-")[1].toLowerCase() // use country
87
+ }else{
88
+ state.language = shopStore.state.language
89
+ }
90
+ })
91
+
83
92
 
84
93
  watch(()=>addressState.billingIsShipping, (newVal,oldVal)=>{
85
94
  if(oldVal && !newVal){
@@ -74,7 +74,7 @@
74
74
  <div class="availability"
75
75
  :class="`availability--${item.shop_availability}`"
76
76
  >
77
- <span class="availability-description">{{$t(item.shop_availability)}}</span>
77
+ <span class="availability-description">{{$t(item.shop_availability.toString())}}</span>
78
78
  </div>
79
79
  </div>
80
80
 
@@ -135,7 +135,7 @@ function removeArticle(){
135
135
  flex-basis: 70%;
136
136
  font-size: .9em;
137
137
  align-items: center;
138
- justify-content: flex-start;
138
+ justify-content: center;
139
139
  white-space: nowrap;
140
140
  &:before {
141
141
  content: '';
@@ -156,14 +156,17 @@ function removeArticle(){
156
156
  text-overflow: ellipsis;
157
157
  }
158
158
  .availability--onrequest,
159
- .availability--instock {
159
+ .availability--instock,
160
+ .availability--true
161
+ {
160
162
  color: var(--ignt-color-success);
161
163
  &:before {
162
164
  background-color: var(--ignt-color-success);
163
165
  }
164
166
  }
165
167
  .availability--discontinued,
166
- .availability--outofstock {
168
+ .availability--outofstock,
169
+ .availability--false {
167
170
  color: var(--ignt-color-danger);
168
171
  &:before {
169
172
  background-color: var(--ignt-color-danger);
@@ -310,7 +313,7 @@ function removeArticle(){
310
313
  .viur-shop-cart-leaf-availability {
311
314
  grid-column: 4 / span 1;
312
315
  align-self: center;
313
- text-align: right;
316
+ text-align: center;
314
317
  }
315
318
 
316
319
  .viur-shop-cart-leaf-label,
@@ -88,11 +88,15 @@ export function useCart() {
88
88
  if(item.discount){
89
89
  shopStore.state.discounts[item.discount.dest.key] = item.discount
90
90
  }
91
- await fetchCartItems(item['key'])
91
+ await fetchCartItems(item['key'], parentKey=true)
92
92
  }
93
93
  }
94
+ if (parentKey){
95
+ shopStore.state.cartList=shopStore.state.cartList.concat(currentLeafs)
96
+ }else{
97
+ shopStore.state.cartList=currentLeafs
98
+ }
94
99
 
95
- shopStore.state.cartList=shopStore.state.cartList.concat(currentLeafs)
96
100
  return resp
97
101
  })
98
102
  }
package/src/shop.js CHANGED
@@ -4,6 +4,7 @@ import {ShopCart, ShopUserDataGuest, ShopShippingMethod, ShopPaymentProvider, Sh
4
4
  import { defineStore } from "pinia";
5
5
  import { useUrlSearchParams,useTimeoutFn } from '@vueuse/core'
6
6
  import AddressFormLayout from './components/AddressFormLayout.vue';
7
+ import ShopOrderStepperAction from "./ShopOrderStepperAction.vue";
7
8
 
8
9
  import { Request } from "@viur/vue-utils";
9
10
 
@@ -123,7 +124,8 @@ export const useViurShopStore = defineStore("viurshopStore", () => {
123
124
  //checkout
124
125
  paymentProviderData:null,
125
126
  UserDataLayout: shallowRef(AddressFormLayout),
126
- discounts:{}
127
+ discounts:{},
128
+ stepperActionComponent:shallowRef(ShopOrderStepperAction)
127
129
  })
128
130
 
129
131
  function addTab({name, component, displayname, iconname, iconlibrary,active})