@laioutr/app-shopware 0.15.1 → 0.15.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/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laioutr/app-shopware",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "configKey": "@laioutr/app-shopware",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
package/dist/module.mjs CHANGED
@@ -4,7 +4,7 @@ import { CHECKOUT_ENDPOINT_PATH, ADOPT_SESSION_ENDPOINT_PATH } from '../dist/run
4
4
  import { registerLaioutrApp } from '@laioutr-core/kit';
5
5
 
6
6
  const name = "@laioutr/app-shopware";
7
- const version = "0.15.1";
7
+ const version = "0.15.3";
8
8
 
9
9
  const module$1 = defineNuxtModule({
10
10
  meta: {
@@ -7,7 +7,7 @@ export default defineShopwareQuery({
7
7
  implements: MenuByAliasQuery,
8
8
  run: async ({ input, context, passthrough }) => {
9
9
  const { alias } = input;
10
- const criteria = await context.resolveCriteria("menu", { includes: {}, associations: { seoUrls: {} } });
10
+ const criteria = await context.resolveCriteria("menu", { includes: {}, associations: {} });
11
11
  const response = await context.storefrontClient.invoke("readNavigation post /navigation/{activeId}/{rootId}", {
12
12
  pathParams: {
13
13
  activeId: alias,
@@ -3,16 +3,17 @@ import { createFallbackSlug, getEntitySeoSlug } from "./mappers/slugMapper.js";
3
3
  import { mapMedia } from "./mediaMapper.js";
4
4
  export const mapCartCost = (cart, currency) => {
5
5
  const money = (value) => Money.fromDecimal(value, currency);
6
+ const zero = money(0);
6
7
  const lineItems = cart.lineItems ?? [];
7
8
  const deliveries = cart.deliveries ?? [];
8
9
  const price = cart.price;
9
- const subtotalValue = price?.positionPrice ?? lineItems.reduce((sum, li) => sum + (li.price?.totalPrice ?? 0), 0);
10
- const totalValue = price?.totalPrice ?? subtotalValue;
11
- const shippingValue = deliveries.reduce((sum, d) => sum + (d.shippingCosts?.totalPrice ?? 0), 0);
12
- const itemTaxValue = (price?.calculatedTaxes ?? []).reduce((sum, t) => sum + (t.tax ?? 0), 0);
13
- const shippingTaxValue = deliveries.reduce(
14
- (sum, d) => sum + (d.shippingCosts?.calculatedTaxes ?? []).reduce((s, t) => s + (t.tax ?? 0), 0),
15
- 0
10
+ const subtotal = price?.positionPrice === void 0 ? lineItems.reduce((sum, li) => sum.add(money(li.price?.totalPrice ?? 0)), zero) : money(price.positionPrice);
11
+ const total = price?.totalPrice === void 0 ? subtotal : money(price.totalPrice);
12
+ const shipping = deliveries.reduce((sum, d) => sum.add(money(d.shippingCosts?.totalPrice ?? 0)), zero);
13
+ const itemTax = (price?.calculatedTaxes ?? []).reduce((sum, t) => sum.add(money(t.tax ?? 0)), zero);
14
+ const shippingTax = deliveries.reduce(
15
+ (sum, d) => (d.shippingCosts?.calculatedTaxes ?? []).reduce((s, t) => s.add(money(t.tax ?? 0)), sum),
16
+ zero
16
17
  );
17
18
  const taxIncluded = price?.taxStatus === "gross";
18
19
  const taxes = (price?.calculatedTaxes ?? []).map((t) => ({
@@ -20,12 +21,12 @@ export const mapCartCost = (cart, currency) => {
20
21
  amount: money(t.tax ?? 0)
21
22
  }));
22
23
  return {
23
- subtotal: money(subtotalValue),
24
+ subtotal,
24
25
  subtotalIsEstimated: false,
25
- total: money(totalValue),
26
+ total,
26
27
  totalIsEstimated: false,
27
- ...deliveries.length > 0 ? { shipping: { total: money(shippingValue), isEstimated: false } } : {},
28
- tax: { total: money(itemTaxValue + shippingTaxValue), isEstimated: false, isIncluded: taxIncluded },
28
+ ...deliveries.length > 0 ? { shipping: { total: shipping, isEstimated: false } } : {},
29
+ tax: { total: itemTax.add(shippingTax), isEstimated: false, isIncluded: taxIncluded },
29
30
  ...taxes.length > 0 ? { taxes } : {}
30
31
  };
31
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laioutr/app-shopware",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "description": "Laioutr integration with Shopware 6",
5
5
  "repository": "github:laioutr/app-shopware",
6
6
  "license": "MIT",