Przeglądaj źródła

feat(core): I18n for descriptions and labels of ConfigurableOperations

BREAKING CHANGE:
ConfigurableOperations descriptions must now be specified as an array of LocalizedString rather than just a plain string. This allows the descriptions to be adapted to other locales.
Michael Bromley 6 lat temu
rodzic
commit
a135e15e1a
37 zmienionych plików z 262 dodań i 174 usunięć
  1. 2 7
      packages/common/src/generated-shop-types.ts
  2. 2 7
      packages/common/src/generated-types.ts
  3. 2 8
      packages/common/src/shared-types.ts
  4. 0 2
      packages/core/e2e/__snapshots__/collection.e2e-spec.ts.snap
  5. 0 5
      packages/core/e2e/__snapshots__/promotion.e2e-spec.ts.snap
  6. 3 4
      packages/core/e2e/collection.e2e-spec.ts
  7. 0 2
      packages/core/e2e/graphql/fragments.ts
  8. 21 12
      packages/core/e2e/graphql/generated-e2e-admin-types.ts
  9. 2 7
      packages/core/e2e/graphql/generated-e2e-shop-types.ts
  10. 4 3
      packages/core/e2e/order.e2e-spec.ts
  11. 3 2
      packages/core/e2e/promotion.e2e-spec.ts
  12. 4 3
      packages/core/e2e/shop-order.e2e-spec.ts
  13. 54 43
      packages/core/e2e/stock-control.e2e-spec.ts
  14. 1 1
      packages/core/src/api/resolvers/admin/collection.resolver.ts
  15. 2 2
      packages/core/src/api/resolvers/admin/promotion.resolver.ts
  16. 4 4
      packages/core/src/api/resolvers/admin/shipping-method.resolver.ts
  17. 2 1
      packages/core/src/api/schema/common/common-types.graphql
  18. 64 13
      packages/core/src/common/configurable-operation.ts
  19. 4 5
      packages/core/src/config/collection/collection-filter.ts
  20. 14 3
      packages/core/src/config/collection/default-collection-filters.ts
  21. 3 1
      packages/core/src/config/payment-method/example-payment-method-config.ts
  22. 3 2
      packages/core/src/config/payment-method/payment-method-handler.ts
  23. 8 4
      packages/core/src/config/promotion/default-promotion-actions.ts
  24. 8 4
      packages/core/src/config/promotion/default-promotion-conditions.ts
  25. 3 2
      packages/core/src/config/promotion/promotion-action.ts
  26. 3 2
      packages/core/src/config/promotion/promotion-condition.ts
  27. 3 1
      packages/core/src/config/shipping-method/default-shipping-calculator.ts
  28. 3 1
      packages/core/src/config/shipping-method/default-shipping-eligibility-checker.ts
  29. 8 2
      packages/core/src/config/shipping-method/shipping-calculator.ts
  30. 7 3
      packages/core/src/config/shipping-method/shipping-eligibility-checker.ts
  31. 12 6
      packages/core/src/service/helpers/order-calculator/order-calculator.spec.ts
  32. 0 1
      packages/core/src/service/helpers/shipping-configuration/shipping-configuration.ts
  33. 2 2
      packages/core/src/service/services/collection.service.ts
  34. 4 5
      packages/core/src/service/services/promotion.service.ts
  35. 7 4
      packages/core/src/service/services/shipping-method.service.ts
  36. 0 0
      schema-admin.json
  37. 0 0
      schema-shop.json

+ 2 - 7
packages/common/src/generated-shop-types.ts

@@ -217,6 +217,8 @@ export type ConfigArgDefinition = {
     __typename?: 'ConfigArgDefinition';
     name: Scalars['String'];
     type: Scalars['String'];
+    label?: Maybe<Scalars['String']>;
+    description?: Maybe<Scalars['String']>;
     config?: Maybe<Scalars['JSON']>;
 };
 
@@ -230,7 +232,6 @@ export type ConfigurableOperation = {
     __typename?: 'ConfigurableOperation';
     code: Scalars['String'];
     args: Array<ConfigArg>;
-    description: Scalars['String'];
 };
 
 export type ConfigurableOperationDefinition = {
@@ -1816,12 +1817,6 @@ export type PromotionList = PaginatedList & {
     totalItems: Scalars['Int'];
 };
 
-export type PromotionOperations = {
-    __typename?: 'PromotionOperations';
-    conditions: Array<ConfigurableOperationDefinition>;
-    actions: Array<ConfigurableOperationDefinition>;
-};
-
 export type Query = {
     __typename?: 'Query';
     activeChannel: Channel;

+ 2 - 7
packages/common/src/generated-types.ts

@@ -293,6 +293,8 @@ export type ConfigArgDefinition = {
   __typename?: 'ConfigArgDefinition',
   name: Scalars['String'],
   type: Scalars['String'],
+  label?: Maybe<Scalars['String']>,
+  description?: Maybe<Scalars['String']>,
   config?: Maybe<Scalars['JSON']>,
 };
 
@@ -306,7 +308,6 @@ export type ConfigurableOperation = {
   __typename?: 'ConfigurableOperation',
   code: Scalars['String'],
   args: Array<ConfigArg>,
-  description: Scalars['String'],
 };
 
 export type ConfigurableOperationDefinition = {
@@ -2584,12 +2585,6 @@ export type PromotionListOptions = {
   filter?: Maybe<PromotionFilterParameter>,
 };
 
-export type PromotionOperations = {
-  __typename?: 'PromotionOperations',
-  conditions: Array<ConfigurableOperationDefinition>,
-  actions: Array<ConfigurableOperationDefinition>,
-};
-
 export type PromotionSortParameter = {
   id?: Maybe<SortOrder>,
   createdAt?: Maybe<SortOrder>,

+ 2 - 8
packages/common/src/shared-types.ts

@@ -55,14 +55,8 @@ export type CustomFieldType = 'string' | 'localeString' | 'int' | 'float' | 'boo
  * 1. How the argument form field is rendered in the admin-ui
  * 2. The JavaScript type into which the value is coerced before being passed to the business logic.
  */
-export type ConfigArgType =
-    | 'string'
-    | 'int'
-    | 'float'
-    | 'boolean'
-    | 'datetime'
-    | 'facetValueIds'
-    | 'stringOperator';
+export type ConfigArgType = 'string' | 'int' | 'float' | 'boolean' | 'datetime' | 'facetValueIds';
+
 export type ConfigArgSubset<T extends ConfigArgType> = T;
 
 export type CustomFieldsObject = { [key: string]: any };

+ 0 - 2
packages/core/e2e/__snapshots__/collection.e2e-spec.ts.snap

@@ -48,7 +48,6 @@ Object {
         },
       ],
       "code": "facet-value-filter",
-      "description": "Filter by FacetValues",
     },
   ],
   "id": "T_3",
@@ -109,7 +108,6 @@ Object {
         },
       ],
       "code": "facet-value-filter",
-      "description": "Filter by FacetValues",
     },
   ],
   "id": "T_5",

+ 0 - 5
packages/core/e2e/__snapshots__/promotion.e2e-spec.ts.snap

@@ -55,7 +55,6 @@ Object {
         },
       ],
       "code": "promo_action",
-      "description": "description for promo_action",
     },
   ],
   "conditions": Array [
@@ -68,7 +67,6 @@ Object {
         },
       ],
       "code": "promo_condition",
-      "description": "description for promo_condition",
     },
   ],
   "enabled": true,
@@ -88,7 +86,6 @@ Object {
         },
       ],
       "code": "promo_action",
-      "description": "description for promo_action",
     },
   ],
   "conditions": Array [
@@ -101,7 +98,6 @@ Object {
         },
       ],
       "code": "promo_condition",
-      "description": "description for promo_condition",
     },
     Object {
       "args": Array [
@@ -112,7 +108,6 @@ Object {
         },
       ],
       "code": "promo_condition2",
-      "description": "description for promo_condition2",
     },
   ],
   "enabled": true,

+ 3 - 4
packages/core/e2e/collection.e2e-spec.ts

@@ -4,7 +4,6 @@ import gql from 'graphql-tag';
 import path from 'path';
 
 import { pick } from '../../common/lib/pick';
-import { StringOperator } from '../src/common/configurable-operation';
 import {
     facetValueCollectionFilter,
     variantNameCollectionFilter,
@@ -414,7 +413,7 @@ describe('Collection resolver', () => {
                                 {
                                     name: 'operator',
                                     value: 'contains',
-                                    type: 'stringOperator',
+                                    type: 'string',
                                 },
                                 {
                                     name: 'term',
@@ -662,7 +661,7 @@ describe('Collection resolver', () => {
 
         describe('variantName filter', () => {
             async function createVariantNameFilteredCollection(
-                operator: StringOperator,
+                operator: string,
                 term: string,
             ): Promise<Collection.Fragment> {
                 const { createCollection } = await client.query<
@@ -680,7 +679,7 @@ describe('Collection resolver', () => {
                                     {
                                         name: 'operator',
                                         value: operator,
-                                        type: 'stringOperator',
+                                        type: 'string',
                                     },
                                     {
                                         name: 'term',

+ 0 - 2
packages/core/e2e/graphql/fragments.ts

@@ -149,7 +149,6 @@ export const CONFIGURABLE_FRAGMENT = gql`
             value
         }
         code
-        description
     }
 `;
 
@@ -239,7 +238,6 @@ export const COUNTRY_FRAGMENT = gql`
     }
 `;
 
-
 export const ADDRESS_FRAGMENT = gql`
     fragment Address on Address {
         id

+ 21 - 12
packages/core/e2e/graphql/generated-e2e-admin-types.ts

@@ -293,6 +293,8 @@ export type ConfigArgDefinition = {
     __typename?: 'ConfigArgDefinition';
     name: Scalars['String'];
     type: Scalars['String'];
+    label?: Maybe<Scalars['String']>;
+    description?: Maybe<Scalars['String']>;
     config?: Maybe<Scalars['JSON']>;
 };
 
@@ -306,7 +308,6 @@ export type ConfigurableOperation = {
     __typename?: 'ConfigurableOperation';
     code: Scalars['String'];
     args: Array<ConfigArg>;
-    description: Scalars['String'];
 };
 
 export type ConfigurableOperationDefinition = {
@@ -2518,12 +2519,6 @@ export type PromotionListOptions = {
     filter?: Maybe<PromotionFilterParameter>;
 };
 
-export type PromotionOperations = {
-    __typename?: 'PromotionOperations';
-    conditions: Array<ConfigurableOperationDefinition>;
-    actions: Array<ConfigurableOperationDefinition>;
-};
-
 export type PromotionSortParameter = {
     id?: Maybe<SortOrder>;
     createdAt?: Maybe<SortOrder>;
@@ -3825,7 +3820,7 @@ export type RoleFragment = { __typename?: 'Role' } & Pick<
 
 export type ConfigurableOperationFragment = { __typename?: 'ConfigurableOperation' } & Pick<
     ConfigurableOperation,
-    'code' | 'description'
+    'code'
 > & { args: Array<{ __typename?: 'ConfigArg' } & Pick<ConfigArg, 'name' | 'type' | 'value'>> };
 
 export type CollectionFragment = { __typename?: 'Collection' } & Pick<
@@ -4601,14 +4596,23 @@ export type UpdatePromotionMutation = { __typename?: 'Mutation' } & {
     updatePromotion: { __typename?: 'Promotion' } & PromotionFragment;
 };
 
+export type ConfigurableOperationDefFragment = { __typename?: 'ConfigurableOperationDefinition' } & Pick<
+    ConfigurableOperationDefinition,
+    'code' | 'description'
+> & {
+        args: Array<
+            { __typename?: 'ConfigArgDefinition' } & Pick<ConfigArgDefinition, 'name' | 'type' | 'config'>
+        >;
+    };
+
 export type GetAdjustmentOperationsQueryVariables = {};
 
 export type GetAdjustmentOperationsQuery = { __typename?: 'Query' } & {
     promotionActions: Array<
-        { __typename?: 'ConfigurableOperationDefinition' } & ConfigurableOperationFragment
+        { __typename?: 'ConfigurableOperationDefinition' } & ConfigurableOperationDefFragment
     >;
     promotionConditions: Array<
-        { __typename?: 'ConfigurableOperationDefinition' } & ConfigurableOperationFragment
+        { __typename?: 'ConfigurableOperationDefinition' } & ConfigurableOperationDefFragment
     >;
 };
 
@@ -5716,11 +5720,16 @@ export namespace UpdatePromotion {
     export type UpdatePromotion = PromotionFragment;
 }
 
+export namespace ConfigurableOperationDef {
+    export type Fragment = ConfigurableOperationDefFragment;
+    export type Args = NonNullable<ConfigurableOperationDefFragment['args'][0]>;
+}
+
 export namespace GetAdjustmentOperations {
     export type Variables = GetAdjustmentOperationsQueryVariables;
     export type Query = GetAdjustmentOperationsQuery;
-    export type PromotionActions = ConfigurableOperationFragment;
-    export type PromotionConditions = ConfigurableOperationFragment;
+    export type PromotionActions = ConfigurableOperationDefFragment;
+    export type PromotionConditions = ConfigurableOperationDefFragment;
 }
 
 export namespace GetRoles {

+ 2 - 7
packages/core/e2e/graphql/generated-e2e-shop-types.ts

@@ -217,6 +217,8 @@ export type ConfigArgDefinition = {
     __typename?: 'ConfigArgDefinition';
     name: Scalars['String'];
     type: Scalars['String'];
+    label?: Maybe<Scalars['String']>;
+    description?: Maybe<Scalars['String']>;
     config?: Maybe<Scalars['JSON']>;
 };
 
@@ -230,7 +232,6 @@ export type ConfigurableOperation = {
     __typename?: 'ConfigurableOperation';
     code: Scalars['String'];
     args: Array<ConfigArg>;
-    description: Scalars['String'];
 };
 
 export type ConfigurableOperationDefinition = {
@@ -1816,12 +1817,6 @@ export type PromotionList = PaginatedList & {
     totalItems: Scalars['Int'];
 };
 
-export type PromotionOperations = {
-    __typename?: 'PromotionOperations';
-    conditions: Array<ConfigurableOperationDefinition>;
-    actions: Array<ConfigurableOperationDefinition>;
-};
-
 export type Query = {
     __typename?: 'Query';
     activeChannel: Channel;

+ 4 - 3
packages/core/e2e/order.e2e-spec.ts

@@ -1,4 +1,5 @@
 /* tslint:disable:no-non-null-assertion */
+import { LanguageCode } from '@vendure/common/lib/generated-shop-types';
 import gql from 'graphql-tag';
 import path from 'path';
 
@@ -1145,7 +1146,7 @@ describe('Orders resolver', () => {
  */
 const twoStagePaymentMethod = new PaymentMethodHandler({
     code: 'authorize-only-payment-method',
-    description: 'Test Payment Method',
+    description: [{ languageCode: LanguageCode.en, value: 'Test Payment Method' }],
     args: {},
     createPayment: (order, args, metadata) => {
         return {
@@ -1170,7 +1171,7 @@ const twoStagePaymentMethod = new PaymentMethodHandler({
  */
 const singleStageRefundablePaymentMethod = new PaymentMethodHandler({
     code: 'single-stage-refundable-payment-method',
-    description: 'Test Payment Method',
+    description: [{ languageCode: LanguageCode.en, value: 'Test Payment Method' }],
     args: {},
     createPayment: (order, args, metadata) => {
         return {
@@ -1197,7 +1198,7 @@ const singleStageRefundablePaymentMethod = new PaymentMethodHandler({
  */
 const failsToSettlePaymentMethod = new PaymentMethodHandler({
     code: 'fails-to-settle-payment-method',
-    description: 'Test Payment Method',
+    description: [{ languageCode: LanguageCode.en, value: 'Test Payment Method' }],
     args: {},
     createPayment: (order, args, metadata) => {
         return {

+ 3 - 2
packages/core/e2e/promotion.e2e-spec.ts

@@ -2,6 +2,7 @@ import { pick } from '@vendure/common/lib/pick';
 import gql from 'graphql-tag';
 import path from 'path';
 
+import { LanguageCode } from '../../common/lib/generated-types';
 import { PromotionAction, PromotionOrderAction } from '../src/config/promotion/promotion-action';
 import { PromotionCondition } from '../src/config/promotion/promotion-condition';
 
@@ -191,7 +192,7 @@ describe('Promotion resolver', () => {
 function generateTestCondition(code: string): PromotionCondition<any> {
     return new PromotionCondition({
         code,
-        description: `description for ${code}`,
+        description: [{ languageCode: LanguageCode.en, value: `description for ${code}` }],
         args: { arg: { type: 'int' } },
         check: (order, args) => true,
     });
@@ -200,7 +201,7 @@ function generateTestCondition(code: string): PromotionCondition<any> {
 function generateTestAction(code: string): PromotionAction<any> {
     return new PromotionOrderAction({
         code,
-        description: `description for ${code}`,
+        description: [{ languageCode: LanguageCode.en, value: `description for ${code}` }],
         args: { facetValueIds: { type: 'facetValueIds' } },
         execute: (order, args) => {
             return 42;

+ 4 - 3
packages/core/e2e/shop-order.e2e-spec.ts

@@ -9,6 +9,7 @@ import {
     GetCountryList,
     GetCustomer,
     GetCustomerList,
+    LanguageCode,
     UpdateCountry,
 } from './graphql/generated-e2e-admin-types';
 import {
@@ -868,7 +869,7 @@ describe('Shop orders', () => {
 
 const testPaymentMethod = new PaymentMethodHandler({
     code: 'test-payment-method',
-    description: 'Test Payment Method',
+    description: [{ languageCode: LanguageCode.en, value: 'Test Payment Method' }],
     args: {},
     createPayment: (order, args, metadata) => {
         return {
@@ -885,7 +886,7 @@ const testPaymentMethod = new PaymentMethodHandler({
 
 const testFailingPaymentMethod = new PaymentMethodHandler({
     code: 'test-failing-payment-method',
-    description: 'Test Failing Payment Method',
+    description: [{ languageCode: LanguageCode.en, value: 'Test Failing Payment Method' }],
     args: {},
     createPayment: (order, args, metadata) => {
         return {
@@ -901,7 +902,7 @@ const testFailingPaymentMethod = new PaymentMethodHandler({
 
 const testErrorPaymentMethod = new PaymentMethodHandler({
     code: 'test-error-payment-method',
-    description: 'Test Error Payment Method',
+    description: [{ languageCode: LanguageCode.en, value: 'Test Error Payment Method' }],
     args: {},
     createPayment: (order, args, metadata) => {
         return {

+ 54 - 43
packages/core/e2e/stock-control.e2e-spec.ts

@@ -10,14 +10,26 @@ import { VARIANT_WITH_STOCK_FRAGMENT } from './graphql/fragments';
 import {
     CreateAddressInput,
     GetStockMovement,
+    LanguageCode,
     StockMovementType,
     UpdateProductVariantInput,
     UpdateStock,
     VariantWithStockFragment,
 } from './graphql/generated-e2e-admin-types';
-import { AddItemToOrder, AddPaymentToOrder, PaymentInput, SetShippingAddress, TransitionToState } from './graphql/generated-e2e-shop-types';
+import {
+    AddItemToOrder,
+    AddPaymentToOrder,
+    PaymentInput,
+    SetShippingAddress,
+    TransitionToState,
+} from './graphql/generated-e2e-shop-types';
 import { GET_STOCK_MOVEMENT } from './graphql/shared-definitions';
-import { ADD_ITEM_TO_ORDER, ADD_PAYMENT, SET_SHIPPING_ADDRESS, TRANSITION_TO_STATE } from './graphql/shop-definitions';
+import {
+    ADD_ITEM_TO_ORDER,
+    ADD_PAYMENT,
+    SET_SHIPPING_ADDRESS,
+    TRANSITION_TO_STATE,
+} from './graphql/shop-definitions';
 import { TestAdminClient, TestShopClient } from './test-client';
 import { TestServer } from './test-server';
 import { assertThrowsWithMessage } from './utils/assert-throws-with-message';
@@ -64,61 +76,57 @@ describe('Stock control', () => {
         });
 
         it('updating ProductVariant with same stockOnHand does not create a StockMovement', async () => {
-            const { updateProductVariants } = await adminClient.query<UpdateStock.Mutation, UpdateStock.Variables>(
-                UPDATE_STOCK_ON_HAND,
-                {
-                    input: [
-                        {
-                            id: variants[0].id,
-                            stockOnHand: variants[0].stockOnHand,
-                        },
-                    ] as UpdateProductVariantInput[],
-                },
-            );
+            const { updateProductVariants } = await adminClient.query<
+                UpdateStock.Mutation,
+                UpdateStock.Variables
+            >(UPDATE_STOCK_ON_HAND, {
+                input: [
+                    {
+                        id: variants[0].id,
+                        stockOnHand: variants[0].stockOnHand,
+                    },
+                ] as UpdateProductVariantInput[],
+            });
 
             expect(updateProductVariants[0]!.stockMovements.items).toEqual([]);
             expect(updateProductVariants[0]!.stockMovements.totalItems).toEqual(0);
         });
 
         it('increasing stockOnHand creates a StockMovement with correct quantity', async () => {
-            const { updateProductVariants } = await adminClient.query<UpdateStock.Mutation, UpdateStock.Variables>(
-                UPDATE_STOCK_ON_HAND,
-                {
-                    input: [
-                        {
-                            id: variants[0].id,
-                            stockOnHand: variants[0].stockOnHand + 5,
-                        },
-                    ] as UpdateProductVariantInput[],
-                },
-            );
+            const { updateProductVariants } = await adminClient.query<
+                UpdateStock.Mutation,
+                UpdateStock.Variables
+            >(UPDATE_STOCK_ON_HAND, {
+                input: [
+                    {
+                        id: variants[0].id,
+                        stockOnHand: variants[0].stockOnHand + 5,
+                    },
+                ] as UpdateProductVariantInput[],
+            });
 
             expect(updateProductVariants[0]!.stockOnHand).toBe(5);
             expect(updateProductVariants[0]!.stockMovements.totalItems).toEqual(1);
-            expect(updateProductVariants[0]!.stockMovements.items[0].type).toBe(
-                StockMovementType.ADJUSTMENT,
-            );
+            expect(updateProductVariants[0]!.stockMovements.items[0].type).toBe(StockMovementType.ADJUSTMENT);
             expect(updateProductVariants[0]!.stockMovements.items[0].quantity).toBe(5);
         });
 
         it('decreasing stockOnHand creates a StockMovement with correct quantity', async () => {
-            const { updateProductVariants } = await adminClient.query<UpdateStock.Mutation, UpdateStock.Variables>(
-                UPDATE_STOCK_ON_HAND,
-                {
-                    input: [
-                        {
-                            id: variants[0].id,
-                            stockOnHand: variants[0].stockOnHand + 5 - 2,
-                        },
-                    ] as UpdateProductVariantInput[],
-                },
-            );
+            const { updateProductVariants } = await adminClient.query<
+                UpdateStock.Mutation,
+                UpdateStock.Variables
+            >(UPDATE_STOCK_ON_HAND, {
+                input: [
+                    {
+                        id: variants[0].id,
+                        stockOnHand: variants[0].stockOnHand + 5 - 2,
+                    },
+                ] as UpdateProductVariantInput[],
+            });
 
             expect(updateProductVariants[0]!.stockOnHand).toBe(3);
             expect(updateProductVariants[0]!.stockMovements.totalItems).toEqual(2);
-            expect(updateProductVariants[0]!.stockMovements.items[1].type).toBe(
-                StockMovementType.ADJUSTMENT,
-            );
+            expect(updateProductVariants[0]!.stockMovements.items[1].type).toBe(StockMovementType.ADJUSTMENT);
             expect(updateProductVariants[0]!.stockMovements.items[1].quantity).toBe(-2);
         });
 
@@ -189,7 +197,10 @@ describe('Stock control', () => {
         });
 
         it('creates a Sale when order completed', async () => {
-            const { addPaymentToOrder } = await shopClient.query<AddPaymentToOrder.Mutation, AddPaymentToOrder.Variables>(ADD_PAYMENT, {
+            const { addPaymentToOrder } = await shopClient.query<
+                AddPaymentToOrder.Mutation,
+                AddPaymentToOrder.Variables
+            >(ADD_PAYMENT, {
                 input: {
                     method: testPaymentMethod.code,
                     metadata: {},
@@ -227,7 +238,7 @@ describe('Stock control', () => {
 
 const testPaymentMethod = new PaymentMethodHandler({
     code: 'test-payment-method',
-    description: 'Test Payment Method',
+    description: [{ languageCode: LanguageCode.en, value: 'Test Payment Method' }],
     args: {},
     createPayment: (order, args, metadata) => {
         return {

+ 1 - 1
packages/core/src/api/resolvers/admin/collection.resolver.ts

@@ -35,7 +35,7 @@ export class CollectionResolver {
         @Ctx() ctx: RequestContext,
         @Args() args: QueryCollectionsArgs,
     ): Promise<ConfigurableOperationDefinition[]> {
-        return this.collectionService.getAvailableFilters();
+        return this.collectionService.getAvailableFilters(ctx);
     }
 
     @Query()

+ 2 - 2
packages/core/src/api/resolvers/admin/promotion.resolver.ts

@@ -42,13 +42,13 @@ export class PromotionResolver {
     @Query()
     @Allow(Permission.ReadSettings)
     promotionConditions(@Ctx() ctx: RequestContext) {
-        return this.promotionService.getPromotionConditions();
+        return this.promotionService.getPromotionConditions(ctx);
     }
 
     @Query()
     @Allow(Permission.ReadSettings)
     promotionActions(@Ctx() ctx: RequestContext) {
-        return this.promotionService.getPromotionActions();
+        return this.promotionService.getPromotionActions(ctx);
     }
 
     @Mutation()

+ 4 - 4
packages/core/src/api/resolvers/admin/shipping-method.resolver.ts

@@ -38,14 +38,14 @@ export class ShippingMethodResolver {
 
     @Query()
     @Allow(Permission.ReadSettings)
-    shippingEligibilityCheckers(@Args() args: QueryShippingMethodArgs): ConfigurableOperationDefinition[] {
-        return this.shippingMethodService.getShippingEligibilityCheckers();
+    shippingEligibilityCheckers(@Ctx() ctx: RequestContext): ConfigurableOperationDefinition[] {
+        return this.shippingMethodService.getShippingEligibilityCheckers(ctx);
     }
 
     @Query()
     @Allow(Permission.ReadSettings)
-    shippingCalculators(@Args() args: QueryShippingMethodArgs): ConfigurableOperationDefinition[] {
-        return this.shippingMethodService.getShippingCalculators();
+    shippingCalculators(@Ctx() ctx: RequestContext): ConfigurableOperationDefinition[] {
+        return this.shippingMethodService.getShippingCalculators(ctx);
     }
 
     @Mutation()

+ 2 - 1
packages/core/src/api/schema/common/common-types.graphql

@@ -29,13 +29,14 @@ type ConfigArg {
 type ConfigArgDefinition {
     name: String!
     type: String!
+    label: String
+    description: String
     config: JSON
 }
 
 type ConfigurableOperation {
     code: String!
     args: [ConfigArg!]!
-    description: String!
 }
 
 type ConfigurableOperationDefinition {

+ 64 - 13
packages/core/src/common/configurable-operation.ts

@@ -1,13 +1,27 @@
 // prettier-ignore
-import { ConfigArg, ConfigurableOperationDefinition, LocalizedString, Maybe, StringFieldOption } from '@vendure/common/lib/generated-types';
+import {
+    ConfigArg,
+    ConfigArgDefinition,
+    ConfigurableOperationDefinition,
+    LanguageCode,
+    LocalizedString,
+    Maybe,
+    StringFieldOption,
+} from '@vendure/common/lib/generated-types';
 import { ConfigArgType } from '@vendure/common/lib/shared-types';
+import { simpleDeepClone } from '@vendure/common/lib/simple-deep-clone';
 
+import { RequestContext } from '../api/common/request-context';
+
+import { DEFAULT_LANGUAGE_CODE } from './constants';
 import { InternalServerError } from './error/errors';
 
+export type LocalizedStringArray = Array<Omit<LocalizedString, '__typename'>>;
+
 export interface ConfigArgCommonDef<T extends ConfigArgType> {
     type: T;
-    label?: Omit<LocalizedString, '__typename'>;
-    description?: Maybe<Array<Omit<LocalizedString, '__typename'>>>;
+    label?: LocalizedStringArray;
+    description?: LocalizedStringArray;
 }
 
 export type WithArgConfig<T> = {
@@ -31,9 +45,6 @@ export type ConfigArgs<T extends ConfigArgType> = {
     [name: string]: ConfigArgDef<T>;
 };
 
-// TODO: replace with string options
-export type StringOperator = 'startsWith' | 'endsWith' | 'contains' | 'doesNotContain';
-
 // prettier-ignore
 /**
  * Represents the ConfigArgs once they have been coerced into JavaScript values for use
@@ -48,8 +59,6 @@ export type ConfigArgValues<T extends ConfigArgs<any>> = {
                 ? boolean
                 : T[K] extends ConfigArgDef<'facetValueIds'>
                     ? string[]
-                    : T[K] extends ConfigArgDef<'stringOperator'>
-                        ? StringOperator
                         : string
 };
 
@@ -60,21 +69,64 @@ export type ConfigArgValues<T extends ConfigArgs<any>> = {
 export interface ConfigurableOperationDef {
     code: string;
     args: ConfigArgs<any>;
-    description: string;
+    description: LocalizedStringArray;
 }
 
 /**
  * Convert a ConfigurableOperationDef into a ConfigurableOperation object, typically
  * so that it can be sent via the API.
  */
-export function configurableDefToOperation(def: ConfigurableOperationDef): ConfigurableOperationDefinition {
+export function configurableDefToOperation(
+    ctx: RequestContext,
+    def: ConfigurableOperationDef,
+): ConfigurableOperationDefinition {
     return {
         code: def.code,
-        description: def.description,
-        args: Object.entries(def.args).map(([name, arg]) => ({ name, type: arg.type, config: arg.config })),
+        description: localizeString(def.description, ctx.languageCode),
+        args: Object.entries(def.args).map(
+            ([name, arg]) =>
+                ({
+                    name,
+                    type: arg.type,
+                    config: localizeConfig(arg, ctx.languageCode),
+                    label: arg.label && localizeString(arg.label, ctx.languageCode),
+                    description: arg.description && localizeString(arg.description, ctx.languageCode),
+                } as Required<ConfigArgDefinition>),
+        ),
     };
 }
 
+function localizeConfig(
+    arg: StringArgConfig | IntArgConfig | WithArgConfig<undefined>,
+    languageCode: LanguageCode,
+): any {
+    const { config } = arg;
+    if (!config) {
+        return config;
+    }
+    const clone = simpleDeepClone(config);
+    const options: Maybe<StringFieldOption[]> = (clone as any).options;
+    if (options) {
+        for (const option of options) {
+            if (option.label) {
+                (option as any).label = localizeString(option.label, languageCode);
+            }
+        }
+    }
+    return clone;
+}
+
+function localizeString(stringArray: LocalizedStringArray, languageCode: LanguageCode): string {
+    let match = stringArray.find(x => x.languageCode === languageCode);
+    if (!match) {
+        match = stringArray.find(x => x.languageCode === DEFAULT_LANGUAGE_CODE);
+    }
+    if (!match) {
+        match = stringArray[0];
+    }
+    return match.value;
+}
+
 /**
  * Coverts an array of ConfigArgs into a hash object:
  *
@@ -97,7 +149,6 @@ export function argsArrayToHash<T extends ConfigArgs<any>>(args: ConfigArg[]): C
 function coerceValueToType<T extends ConfigArgs<any>>(arg: ConfigArg): ConfigArgValues<T>[keyof T] {
     switch (arg.type as ConfigArgType) {
         case 'string':
-        case 'stringOperator':
             return arg.value as any;
         case 'int':
             return Number.parseInt(arg.value || '', 10) as any;

+ 4 - 5
packages/core/src/config/collection/collection-filter.ts

@@ -7,12 +7,11 @@ import {
     ConfigArgs,
     ConfigArgValues,
     ConfigurableOperationDef,
+    LocalizedStringArray,
 } from '../../common/configurable-operation';
 import { ProductVariant } from '../../entity/product-variant/product-variant.entity';
 
-export type CollectionFilterArgType = ConfigArgSubset<
-    'facetValueIds' | 'string' | 'stringOperator' | 'boolean'
->;
+export type CollectionFilterArgType = ConfigArgSubset<'facetValueIds' | 'string' | 'boolean'>;
 export type CollectionFilterArgs = ConfigArgs<CollectionFilterArgType>;
 
 export type ApplyCollectionFilterFn<T extends CollectionFilterArgs> = (
@@ -23,14 +22,14 @@ export type ApplyCollectionFilterFn<T extends CollectionFilterArgs> = (
 export interface CollectionFilterConfig<T extends CollectionFilterArgs> {
     args: T;
     code: string;
-    description: string;
+    description: LocalizedStringArray;
     apply: ApplyCollectionFilterFn<T>;
 }
 
 export class CollectionFilter<T extends CollectionFilterArgs = {}> implements ConfigurableOperationDef {
     readonly code: string;
     readonly args: CollectionFilterArgs;
-    readonly description: string;
+    readonly description: LocalizedStringArray;
     private readonly applyFn: ApplyCollectionFilterFn<T>;
 
     constructor(config: CollectionFilterConfig<T>) {

+ 14 - 3
packages/core/src/config/collection/default-collection-filters.ts

@@ -1,3 +1,4 @@
+import { LanguageCode } from '@vendure/common/lib/generated-types';
 import { Brackets } from 'typeorm';
 
 import { UserInputError } from '../../common/error/errors';
@@ -13,7 +14,7 @@ export const facetValueCollectionFilter = new CollectionFilter({
         containsAny: { type: 'boolean' },
     },
     code: 'facet-value-filter',
-    description: 'Filter by FacetValues',
+    description: [{ languageCode: LanguageCode.en, value: 'Filter by FacetValues' }],
     apply: (qb, args) => {
         if (args.facetValueIds.length) {
             qb.leftJoin('productVariant.product', 'product')
@@ -39,11 +40,21 @@ export const facetValueCollectionFilter = new CollectionFilter({
 
 export const variantNameCollectionFilter = new CollectionFilter({
     args: {
-        operator: { type: 'stringOperator' },
+        operator: {
+            type: 'string',
+            config: {
+                options: [
+                    { value: 'startsWith' },
+                    { value: 'endsWith' },
+                    { value: 'contains' },
+                    { value: 'doesNotContain' },
+                ],
+            },
+        },
         term: { type: 'string' },
     },
     code: 'variant-name-filter',
-    description: 'Filter by ProductVariant name',
+    description: [{ languageCode: LanguageCode.en, value: 'Filter by ProductVariant name' }],
     apply: (qb, args) => {
         qb.leftJoin('productVariant.translations', 'translation');
         switch (args.operator) {

+ 3 - 1
packages/core/src/config/payment-method/example-payment-method-config.ts

@@ -1,3 +1,5 @@
+import { LanguageCode } from '@vendure/common/lib/generated-types';
+
 import { CreatePaymentResult, PaymentMethodHandler } from './payment-method-handler';
 
 /**
@@ -24,7 +26,7 @@ const gripeSDK = {
  */
 export const examplePaymentHandler = new PaymentMethodHandler({
     code: 'example-payment-provider',
-    description: 'Example Payment Provider',
+    description: [{ languageCode: LanguageCode.en, value: 'Example Payment Provider' }],
     args: {
         automaticCapture: { type: 'boolean' },
         apiKey: { type: 'string' },

+ 3 - 2
packages/core/src/config/payment-method/payment-method-handler.ts

@@ -6,6 +6,7 @@ import {
     ConfigArgs,
     ConfigArgValues,
     ConfigurableOperationDef,
+    LocalizedStringArray,
 } from '../../common/configurable-operation';
 import { StateMachineConfig } from '../../common/finite-state-machine';
 import { Order } from '../../entity/order/order.entity';
@@ -136,7 +137,7 @@ export interface PaymentMethodConfigOptions<T extends PaymentMethodArgs = Paymen
      * @description
      * A human-readable description for the payment method.
      */
-    description: string;
+    description: LocalizedStringArray;
     /**
      * @description
      * This function provides the logic for creating a payment. For example,
@@ -230,7 +231,7 @@ export class PaymentMethodHandler<T extends PaymentMethodArgs = PaymentMethodArg
     /** @internal */
     readonly code: string;
     /** @internal */
-    readonly description: string;
+    readonly description: LocalizedStringArray;
     /** @internal */
     readonly args: T;
     private readonly createPaymentFn: CreatePaymentFn<T>;

+ 8 - 4
packages/core/src/config/promotion/default-promotion-actions.ts

@@ -1,3 +1,5 @@
+import { LanguageCode } from '@vendure/common/lib/generated-types';
+
 import { PromotionItemAction, PromotionOrderAction } from './promotion-action';
 
 export const orderPercentageDiscount = new PromotionOrderAction({
@@ -13,7 +15,7 @@ export const orderPercentageDiscount = new PromotionOrderAction({
     execute(order, args) {
         return -order.subTotal * (args.discount / 100);
     },
-    description: 'Discount order by { discount }%',
+    description: [{ languageCode: LanguageCode.en, value: 'Discount order by { discount }%' }],
 });
 
 export const itemPercentageDiscount = new PromotionItemAction({
@@ -29,7 +31,7 @@ export const itemPercentageDiscount = new PromotionItemAction({
     execute(orderItem, orderLine, args) {
         return -orderLine.unitPrice * (args.discount / 100);
     },
-    description: 'Discount every item by { discount }%',
+    description: [{ languageCode: LanguageCode.en, value: 'Discount every item by { discount }%' }],
 });
 
 export const buy1Get1Free = new PromotionItemAction({
@@ -44,7 +46,7 @@ export const buy1Get1Free = new PromotionItemAction({
         }
         return 0;
     },
-    description: 'Buy 1 get 1 free',
+    description: [{ languageCode: LanguageCode.en, value: 'Buy 1 get 1 free' }],
 });
 
 export const discountOnItemWithFacets = new PromotionItemAction({
@@ -66,7 +68,9 @@ export const discountOnItemWithFacets = new PromotionItemAction({
         }
         return 0;
     },
-    description: 'Discount products with these facets by { discount }%',
+    description: [
+        { languageCode: LanguageCode.en, value: 'Discount products with these facets by { discount }%' },
+    ],
 });
 
 export const defaultPromotionActions = [

+ 8 - 4
packages/core/src/config/promotion/default-promotion-conditions.ts

@@ -1,9 +1,11 @@
+import { LanguageCode } from '@vendure/common/lib/generated-types';
+
 import { Order } from '../../entity/order/order.entity';
 
 import { PromotionCondition } from './promotion-condition';
 
 export const minimumOrderAmount = new PromotionCondition({
-    description: 'If order total is greater than { amount }',
+    description: [{ languageCode: LanguageCode.en, value: 'If order total is greater than { amount }' }],
     code: 'minimum_order_amount',
     args: {
         amount: { type: 'int', config: { inputType: 'money' } },
@@ -21,7 +23,7 @@ export const minimumOrderAmount = new PromotionCondition({
 
 export const dateRange = new PromotionCondition({
     code: 'date_range',
-    description: 'If Order placed between { start } and { end }',
+    description: [{ languageCode: LanguageCode.en, value: 'If Order placed between { start } and { end }' }],
     args: {
         start: { type: 'datetime' },
         end: { type: 'datetime' },
@@ -34,7 +36,7 @@ export const dateRange = new PromotionCondition({
 
 export const atLeastNOfProduct = new PromotionCondition({
     code: 'at_least_n_of_product',
-    description: 'Buy at least { minimum } of any product',
+    description: [{ languageCode: LanguageCode.en, value: 'Buy at least { minimum } of any product' }],
     args: { minimum: { type: 'int' } },
     check(order: Order, args) {
         return order.lines.reduce(
@@ -48,7 +50,9 @@ export const atLeastNOfProduct = new PromotionCondition({
 
 export const atLeastNWithFacets = new PromotionCondition({
     code: 'at_least_n_with_facets',
-    description: 'Buy at least { minimum } products with the given facets',
+    description: [
+        { languageCode: LanguageCode.en, value: 'Buy at least { minimum } products with the given facets' },
+    ],
     args: {
         minimum: { type: 'int' },
         facets: { type: 'facetValueIds' },

+ 3 - 2
packages/core/src/config/promotion/promotion-action.ts

@@ -6,6 +6,7 @@ import {
     ConfigArgs,
     ConfigArgValues,
     ConfigurableOperationDef,
+    LocalizedStringArray,
 } from '../../common/configurable-operation';
 import { OrderItem } from '../../entity/order-item/order-item.entity';
 import { OrderLine } from '../../entity/order-line/order-line.entity';
@@ -31,7 +32,7 @@ export type ExecutePromotionOrderActionFn<T extends PromotionActionArgs> = (
 export interface PromotionActionConfig<T extends PromotionActionArgs> {
     args: T;
     code: string;
-    description: string;
+    description: LocalizedStringArray;
     priorityValue?: number;
 }
 export interface PromotionItemActionConfig<T extends PromotionActionArgs> extends PromotionActionConfig<T> {
@@ -51,7 +52,7 @@ export abstract class PromotionAction<T extends PromotionActionArgs = {}>
     implements ConfigurableOperationDef {
     readonly code: string;
     readonly args: PromotionActionArgs;
-    readonly description: string;
+    readonly description: LocalizedStringArray;
     readonly priorityValue: number;
 
     protected constructor(config: PromotionActionConfig<T>) {

+ 3 - 2
packages/core/src/config/promotion/promotion-condition.ts

@@ -6,6 +6,7 @@ import {
     ConfigArgs,
     ConfigArgValues,
     ConfigurableOperationDef,
+    LocalizedStringArray,
 } from '../../common/configurable-operation';
 import { OrderLine } from '../../entity';
 import { Order } from '../../entity/order/order.entity';
@@ -54,7 +55,7 @@ export type CheckPromotionConditionFn<T extends PromotionConditionArgs> = (
  */
 export class PromotionCondition<T extends PromotionConditionArgs = {}> implements ConfigurableOperationDef {
     readonly code: string;
-    readonly description: string;
+    readonly description: LocalizedStringArray;
     readonly args: PromotionConditionArgs;
     readonly priorityValue: number;
     private readonly checkFn: CheckPromotionConditionFn<T>;
@@ -63,7 +64,7 @@ export class PromotionCondition<T extends PromotionConditionArgs = {}> implement
         args: T;
         check: CheckPromotionConditionFn<T>;
         code: string;
-        description: string;
+        description: LocalizedStringArray;
         priorityValue?: number;
     }) {
         this.code = config.code;

+ 3 - 1
packages/core/src/config/shipping-method/default-shipping-calculator.ts

@@ -1,8 +1,10 @@
+import { LanguageCode } from '@vendure/common/lib/generated-types';
+
 import { ShippingCalculator } from './shipping-calculator';
 
 export const defaultShippingCalculator = new ShippingCalculator({
     code: 'default-shipping-calculator',
-    description: 'Default Flat-Rate Shipping Calculator',
+    description: [{ languageCode: LanguageCode.en, value: 'Default Flat-Rate Shipping Calculator' }],
     args: {
         rate: { type: 'int', config: { inputType: 'money' } },
         taxRate: { type: 'int', config: { inputType: 'percentage' } },

+ 3 - 1
packages/core/src/config/shipping-method/default-shipping-eligibility-checker.ts

@@ -1,8 +1,10 @@
+import { LanguageCode } from '@vendure/common/lib/generated-types';
+
 import { ShippingEligibilityChecker } from './shipping-eligibility-checker';
 
 export const defaultShippingEligibilityChecker = new ShippingEligibilityChecker({
     code: 'default-shipping-eligibility-checker',
-    description: 'Default Shipping Eligibility Checker',
+    description: [{ languageCode: LanguageCode.en, value: 'Default Shipping Eligibility Checker' }],
     args: {
         orderMinimum: { type: 'int', config: { inputType: 'money' } },
     },

+ 8 - 2
packages/core/src/config/shipping-method/shipping-calculator.ts

@@ -6,6 +6,7 @@ import {
     ConfigArgs,
     ConfigArgValues,
     ConfigurableOperationDef,
+    LocalizedStringArray,
 } from '../../common/configurable-operation';
 import { Order } from '../../entity/order/order.entity';
 
@@ -53,12 +54,17 @@ export class ShippingCalculator<T extends ShippingCalculatorArgs = {}> implement
     /** @internal */
     readonly code: string;
     /** @internal */
-    readonly description: string;
+    readonly description: LocalizedStringArray;
     /** @internal */
     readonly args: ShippingCalculatorArgs;
     private readonly calculateFn: CalculateShippingFn<T>;
 
-    constructor(config: { args: T; calculate: CalculateShippingFn<T>; code: string; description: string }) {
+    constructor(config: {
+        args: T;
+        calculate: CalculateShippingFn<T>;
+        code: string;
+        description: LocalizedStringArray;
+    }) {
         this.code = config.code;
         this.description = config.description;
         this.args = config.args;

+ 7 - 3
packages/core/src/config/shipping-method/shipping-eligibility-checker.ts

@@ -1,7 +1,11 @@
 import { ConfigArg } from '@vendure/common/lib/generated-types';
 import { ConfigArgSubset } from '@vendure/common/lib/shared-types';
 
-import { ConfigArgs, ConfigurableOperationDef } from '../../common/configurable-operation';
+import {
+    ConfigArgs,
+    ConfigurableOperationDef,
+    LocalizedStringArray,
+} from '../../common/configurable-operation';
 import { argsArrayToHash, ConfigArgValues } from '../../common/configurable-operation';
 import { Order } from '../../entity/order/order.entity';
 
@@ -46,7 +50,7 @@ export class ShippingEligibilityChecker<T extends ShippingEligibilityCheckerArgs
     /** @internal */
     readonly code: string;
     /** @internal */
-    readonly description: string;
+    readonly description: LocalizedStringArray;
     /** @internal */
     readonly args: ShippingEligibilityCheckerArgs;
     private readonly checkFn: CheckShippingEligibilityCheckerFn<T>;
@@ -55,7 +59,7 @@ export class ShippingEligibilityChecker<T extends ShippingEligibilityCheckerArgs
         args: T;
         check: CheckShippingEligibilityCheckerFn<T>;
         code: string;
-        description: string;
+        description: LocalizedStringArray;
     }) {
         this.code = config.code;
         this.description = config.description;

+ 12 - 6
packages/core/src/service/helpers/order-calculator/order-calculator.spec.ts

@@ -1,4 +1,5 @@
 import { Test } from '@nestjs/testing';
+import { LanguageCode } from '@vendure/common/lib/generated-types';
 import { Omit } from '@vendure/common/lib/omit';
 import { Connection } from 'typeorm';
 
@@ -130,7 +131,7 @@ describe('OrderCalculator', () => {
         const alwaysTrueCondition = new PromotionCondition({
             args: {},
             code: 'always_true_condition',
-            description: '',
+            description: [{ languageCode: LanguageCode.en, value: '' }],
             check() {
                 return true;
             },
@@ -139,7 +140,7 @@ describe('OrderCalculator', () => {
         const orderTotalCondition = new PromotionCondition({
             args: { minimum: { type: 'int' } },
             code: 'order_total_condition',
-            description: '',
+            description: [{ languageCode: LanguageCode.en, value: '' }],
             check(order, args) {
                 return args.minimum <= order.total;
             },
@@ -147,7 +148,7 @@ describe('OrderCalculator', () => {
 
         const fixedPriceItemAction = new PromotionItemAction({
             code: 'fixed_price_item_action',
-            description: '',
+            description: [{ languageCode: LanguageCode.en, value: '' }],
             args: {},
             execute(item) {
                 return -item.unitPrice + 42;
@@ -156,7 +157,7 @@ describe('OrderCalculator', () => {
 
         const fixedPriceOrderAction = new PromotionOrderAction({
             code: 'fixed_price_item_action',
-            description: '',
+            description: [{ languageCode: LanguageCode.en, value: '' }],
             args: {},
             execute(order) {
                 return -order.total + 42;
@@ -223,7 +224,12 @@ describe('OrderCalculator', () => {
             const orderQuantityCondition = new PromotionCondition({
                 args: { minimum: { type: 'int' } },
                 code: 'order_quantity_condition',
-                description: 'Passes if any order line has at least the minimum quantity',
+                description: [
+                    {
+                        languageCode: LanguageCode.en,
+                        value: 'Passes if any order line has at least the minimum quantity',
+                    },
+                ],
                 check(_order, args) {
                     for (const line of _order.lines) {
                         if (args.minimum <= line.quantity) {
@@ -240,7 +246,7 @@ describe('OrderCalculator', () => {
                 execute(_order, args) {
                     return -_order.subTotal * (args.discount / 100);
                 },
-                description: 'Discount order by { discount }%',
+                description: [{ languageCode: LanguageCode.en, value: 'Discount order by { discount }%' }],
             });
 
             const promotion1 = new Promotion({

+ 0 - 1
packages/core/src/service/helpers/shipping-configuration/shipping-configuration.ts

@@ -41,7 +41,6 @@ export class ShippingConfiguration {
     ): ConfigurableOperation {
         const output: ConfigurableOperation = {
             code: input.code,
-            description: checkerOrCalculator.description,
             args: input.arguments,
         };
         return output;

+ 2 - 2
packages/core/src/service/services/collection.service.ts

@@ -111,8 +111,8 @@ export class CollectionService implements OnModuleInit {
         return translateDeep(collection, ctx.languageCode, ['parent']);
     }
 
-    getAvailableFilters(): ConfigurableOperationDefinition[] {
-        return this.availableFilters.map(configurableDefToOperation);
+    getAvailableFilters(ctx: RequestContext): ConfigurableOperationDefinition[] {
+        return this.availableFilters.map(x => configurableDefToOperation(ctx, x));
     }
 
     async getParent(ctx: RequestContext, collectionId: ID): Promise<Collection | undefined> {

+ 4 - 5
packages/core/src/service/services/promotion.service.ts

@@ -63,12 +63,12 @@ export class PromotionService {
         return this.connection.manager.findOne(Promotion, adjustmentSourceId, { where: { deletedAt: null } });
     }
 
-    getPromotionConditions(): ConfigurableOperationDefinition[] {
-        return this.availableConditions.map(configurableDefToOperation);
+    getPromotionConditions(ctx: RequestContext): ConfigurableOperationDefinition[] {
+        return this.availableConditions.map(x => configurableDefToOperation(ctx, x));
     }
 
-    getPromotionActions(): ConfigurableOperationDefinition[] {
-        return this.availableActions.map(configurableDefToOperation);
+    getPromotionActions(ctx: RequestContext): ConfigurableOperationDefinition[] {
+        return this.availableActions.map(x => configurableDefToOperation(ctx, x));
     }
 
     /**
@@ -130,7 +130,6 @@ export class PromotionService {
         const match = this.getAdjustmentOperationByCode(type, input.code);
         const output: ConfigurableOperation = {
             code: input.code,
-            description: match.description,
             args: input.arguments,
         };
         return output;

+ 7 - 4
packages/core/src/service/services/shipping-method.service.ts

@@ -9,6 +9,7 @@ import { omit } from '@vendure/common/lib/omit';
 import { ID, PaginatedList } from '@vendure/common/lib/shared-types';
 import { Connection } from 'typeorm';
 
+import { RequestContext } from '../../api/common/request-context';
 import { configurableDefToOperation } from '../../common/configurable-operation';
 import { EntityNotFoundError } from '../../common/error/errors';
 import { ListQueryOptions } from '../../common/types/common-types';
@@ -86,12 +87,14 @@ export class ShippingMethodService {
         return assertFound(this.findOne(shippingMethod.id));
     }
 
-    getShippingEligibilityCheckers(): ConfigurableOperationDefinition[] {
-        return this.shippingConfiguration.shippingEligibilityCheckers.map(configurableDefToOperation);
+    getShippingEligibilityCheckers(ctx: RequestContext): ConfigurableOperationDefinition[] {
+        return this.shippingConfiguration.shippingEligibilityCheckers.map(x =>
+            configurableDefToOperation(ctx, x),
+        );
     }
 
-    getShippingCalculators(): ConfigurableOperationDefinition[] {
-        return this.shippingConfiguration.shippingCalculators.map(configurableDefToOperation);
+    getShippingCalculators(ctx: RequestContext): ConfigurableOperationDefinition[] {
+        return this.shippingConfiguration.shippingCalculators.map(x => configurableDefToOperation(ctx, x));
     }
 
     getActiveShippingMethods(channel: Channel): ShippingMethod[] {

Plik diff jest za duży
+ 0 - 0
schema-admin.json


Plik diff jest za duży
+ 0 - 0
schema-shop.json


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików