Skip to content

Commit a95a6b8

Browse files
authored
refactor(theme): @vue-storefront types dependency refactoring (#758)
- remove types dependency on package @vue-storefront/magento-api
1 parent cc7d50e commit a95a6b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+222
-51636
lines changed

packages/theme/composables/types.d.ts

Lines changed: 65 additions & 51506 deletions
Large diffs are not rendered by default.

packages/theme/composables/useAddresses/useAddresses.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Ref } from '@nuxtjs/composition-api';
22
import { ComposableFunctionArgs } from '@vue-storefront/core';
33
// eslint-disable-next-line import/no-extraneous-dependencies
4-
import { CustomerAddress } from '@vue-storefront/magento-api';
4+
import { CustomerAddress } from '~/modules/GraphQL/types';
55

66
export type UseAddressesErrors = {
77
load: Error;

packages/theme/composables/useBilling/commands/saveBillingAddressCommand.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Logger } from '@vue-storefront/core';
2-
import { Maybe, SetBillingAddressOnCartInput } from '~/composables/types';
3-
import { BillingCartAddress } from '~/modules/GraphQL/types';
2+
import { BillingCartAddress, Maybe, SetBillingAddressOnCartInput } from '~/modules/GraphQL/types';
43

54
export const saveBillingAddressCommand = {
65
execute: async (context, cartId, billingDetails): Promise<Maybe<BillingCartAddress>> => {

packages/theme/composables/useBilling/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { ref, useContext } from '@nuxtjs/composition-api';
22
import { Logger } from '@vue-storefront/core';
3-
import { Maybe } from '~/composables/types';
4-
import { BillingCartAddress } from '~/modules/GraphQL/types';
3+
import { BillingCartAddress, Maybe } from '~/modules/GraphQL/types';
54
import { saveBillingAddressCommand } from '~/composables/useBilling/commands/saveBillingAddressCommand';
65
import { useShippingProvider, useCart } from '~/composables';
76

packages/theme/composables/useCart/commands/addItemCommand.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { Context, Logger } from '@vue-storefront/core';
2+
import { AddProductsToCartInput } from '~/composables/useCart/useCart';
23
import {
34
AddConfigurableProductsToCartInput,
45
AddDownloadableProductsToCartInput,
5-
AddProductsToCartInput,
66
AddVirtualProductsToCartInput,
77
Cart,
8-
} from '@vue-storefront/magento-api';
8+
} from '~/modules/GraphQL/types';
99

10-
// TODO this whole file must be refactored
1110
export const addItemCommand = {
1211
execute: async (
1312
context: Context,

packages/theme/composables/useCart/commands/applyCouponCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Context, Logger } from '@vue-storefront/core';
2-
import { Cart } from '@vue-storefront/magento-api';
2+
import { Cart } from '~/modules/GraphQL/types';
33

44
export const applyCouponCommand = {
55
execute: async (context: Context, {

packages/theme/composables/useCart/commands/loadCartCommand.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { ComposableFunctionArgs, Context, Logger } from '@vue-storefront/core';
2-
import { Cart } from '@vue-storefront/magento-api';
2+
import { Cart } from '~/modules/GraphQL/types';
33

4-
// TODO refactoring point
54
export const loadCartCommand = {
65
execute: async (context: Context, params: ComposableFunctionArgs<{
76
realCart?: boolean;

packages/theme/composables/useCart/commands/loadTotalQtyCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Context, Logger } from '@vue-storefront/core';
22

33
export const loadTotalQtyCommand = {
4-
execute: async ( context: Context ) => {
4+
execute: async (context: Context) => {
55
Logger.debug('[Magento]: Load cart total qty');
66

77
const apiState = context.$magento.config.state;

packages/theme/composables/useCart/commands/removeCouponCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Context, Logger } from '@vue-storefront/core';
2-
import { Cart } from '@vue-storefront/magento-api';
2+
import { Cart } from '~/modules/GraphQL/types';
33

44
export const removeCouponCommand = {
55
execute: async (context: Context, { currentCart, customQuery = { removeCouponFromCart: 'removeCouponFromCart' } }) => {

packages/theme/composables/useCart/commands/removeItemCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Context, Logger } from '@vue-storefront/core';
2-
import { Cart, RemoveItemFromCartInput } from '@vue-storefront/magento-api';
2+
import { Cart, RemoveItemFromCartInput } from '~/modules/GraphQL/types';
33

44
// TODO refactoring point
55
export const removeItemCommand = {

0 commit comments

Comments
 (0)