@viur/shop-components 0.1.3 → 0.1.4
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/.github/workflows/npm-publish.yml +3 -3
- package/package.json +1 -1
- package/src/composables/cart.js +3 -3
- package/src/main.js +11 -5
- package/src/translations/de.js +1 -1
- package/src/translations/fr.js +3 -3
- package/src/utils.js +7 -4
|
@@ -14,9 +14,9 @@ jobs:
|
|
|
14
14
|
steps:
|
|
15
15
|
- name: Checkout
|
|
16
16
|
uses: actions/checkout@v4
|
|
17
|
-
- uses: actions/setup-node@
|
|
17
|
+
- uses: actions/setup-node@v4
|
|
18
18
|
with:
|
|
19
|
-
node-version:
|
|
19
|
+
node-version: 22
|
|
20
20
|
registry-url: https://registry.npmjs.org/
|
|
21
21
|
- run: npm ci
|
|
22
22
|
- name: Publish npm package
|
|
@@ -35,7 +35,7 @@ jobs:
|
|
|
35
35
|
run: |
|
|
36
36
|
echo "${{ contains(github.ref_name, 'dev') }}"
|
|
37
37
|
- name: Release
|
|
38
|
-
uses: softprops/action-gh-release@
|
|
38
|
+
uses: softprops/action-gh-release@v2
|
|
39
39
|
# if: "!startsWith(github.ref_name, 'v-test-')"
|
|
40
40
|
with:
|
|
41
41
|
generate_release_notes: true
|
package/package.json
CHANGED
package/src/composables/cart.js
CHANGED
|
@@ -84,7 +84,7 @@ export function useCart() {
|
|
|
84
84
|
shipping_address_key,
|
|
85
85
|
shipping_key,
|
|
86
86
|
discount_key,
|
|
87
|
-
|
|
87
|
+
commission
|
|
88
88
|
} = {}){
|
|
89
89
|
|
|
90
90
|
let data= {
|
|
@@ -97,8 +97,8 @@ export function useCart() {
|
|
|
97
97
|
cart_key:cart_key ? cart_key : shopStore.state.cartRoot['key'],
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
if (
|
|
101
|
-
data.
|
|
100
|
+
if (commission) {
|
|
101
|
+
data.commission = commission
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
return Request.post(`${shopStore.state.shopApiUrl}/cart_update`, {
|
package/src/main.js
CHANGED
|
@@ -15,20 +15,26 @@ const ViurShopComponents = {
|
|
|
15
15
|
let defaultLocale = options?.defaultLocale?options.defaultLocale:'de'
|
|
16
16
|
let locale = options?.locale?options.locale:['de']
|
|
17
17
|
let fallback = options?.fallback?options.fallback:'en'
|
|
18
|
+
|
|
19
|
+
let additionals = options?.additionals?options.additionals:{}
|
|
20
|
+
|
|
18
21
|
app.use(createPinia());
|
|
19
22
|
|
|
20
23
|
let messages = {}
|
|
21
24
|
// fetch translations from server
|
|
22
|
-
let data = await getTranslations(locale)
|
|
25
|
+
let data = await getTranslations(locale,options?.pattern)
|
|
23
26
|
for(const loc of locale){
|
|
27
|
+
let locAdditionals = additionals?.[loc]?additionals[loc]:{}
|
|
28
|
+
|
|
29
|
+
|
|
24
30
|
if (loc === 'de'){
|
|
25
|
-
messages[loc] = { ...de_translations, ...de, ...data[loc]}
|
|
31
|
+
messages[loc] = { ...de_translations, ...de, ...locAdditionals, ...data[loc]}
|
|
26
32
|
}else if (loc === 'fr'){
|
|
27
|
-
messages[loc] = { ...fr, ...data[loc]}
|
|
33
|
+
messages[loc] = { ...fr, ...locAdditionals, ...data[loc]}
|
|
28
34
|
}else if (loc === 'en'){
|
|
29
|
-
messages[loc] = {...en_translations, ...en, ...data[loc]}
|
|
35
|
+
messages[loc] = {...en_translations, ...en, ...locAdditionals, ...data[loc]}
|
|
30
36
|
}else{
|
|
31
|
-
messages[loc] = {...data[loc]}
|
|
37
|
+
messages[loc] = {...locAdditionals, ...data[loc]}
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
|
package/src/translations/de.js
CHANGED
|
@@ -24,7 +24,7 @@ export default {
|
|
|
24
24
|
"pay":"Bezahlen",
|
|
25
25
|
"add_discount":"Hinzufügen",
|
|
26
26
|
"add_discount_placeholder":"Dein Rabattcode",
|
|
27
|
-
"use_shipping_as_billing_address": "
|
|
27
|
+
"use_shipping_as_billing_address": "Lieferung zur Rechnungsadresse",
|
|
28
28
|
"no_valid_shipping_found":"Keine passenden Versandarten gefunden.",
|
|
29
29
|
"error_message":"Eine Fehler ist aufgetreten.",
|
|
30
30
|
"free_shipping":"Versandkostenfrei",
|
package/src/translations/fr.js
CHANGED
|
@@ -33,10 +33,10 @@ export default {
|
|
|
33
33
|
"summary_subtotal":"Sous-total",
|
|
34
34
|
"summary_shipping_total":"Emballage et envoi",
|
|
35
35
|
"summary_delivery_time":"",
|
|
36
|
-
"summary_discount":"",
|
|
37
|
-
"summary_checkout":"",
|
|
36
|
+
"summary_discount":"Vous économisez sur votre achat",
|
|
37
|
+
"summary_checkout":"Acheter cet article",
|
|
38
38
|
"summary_total":"Montant total",
|
|
39
|
-
"summary_vat":"TVA incluse",
|
|
39
|
+
"summary_vat":"TVA incluse ({vat_percentage})",
|
|
40
40
|
"discount_not_found": "Ce code promo n’existe pas.",
|
|
41
41
|
"discount_not_active": "Ce code promo n’est pas actif.",
|
|
42
42
|
"discount_not_available": "Ce code promo n’est pas valable pour ce pays.",
|
package/src/utils.js
CHANGED
|
@@ -20,13 +20,16 @@ export function struct2dict(structure) {
|
|
|
20
20
|
return result;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export async function getTranslations(languages=["de"]){
|
|
23
|
+
export async function getTranslations(languages=["de"],pattern=null){
|
|
24
24
|
// fetch translations from server
|
|
25
25
|
let retVal = languages.reduce((acc,item)=>{acc[item]={}; return acc;},{})
|
|
26
26
|
try {
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
let dataObj = {languages:languages}
|
|
28
|
+
if(pattern){
|
|
29
|
+
dataObj['pattern'] = pattern
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let translations = await Request.get("/json/_translation/get_public",{dataObj:dataObj})
|
|
30
33
|
const data = await translations.json()
|
|
31
34
|
for (let country in data) {
|
|
32
35
|
data[country] = Object.fromEntries(
|