From 636ad92dd5551fe692cf5dbfd31d22e465f370db Mon Sep 17 00:00:00 2001 From: Christoph Hinssen Date: Tue, 5 Oct 2021 14:02:27 +0200 Subject: [PATCH] GH-13939 Extract textfield OCC endpoints by model augmentation --- .../textfield/occ/index.ts | 2 ++ ...-configurator-textfield-endpoints.model.ts | 29 +++++++++++++++++++ .../src/occ/occ-models/occ-endpoints.model.ts | 21 +------------- 3 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 feature-libs/product-configurator/textfield/occ/occ-configurator-textfield-endpoints.model.ts diff --git a/feature-libs/product-configurator/textfield/occ/index.ts b/feature-libs/product-configurator/textfield/occ/index.ts index 8765af7b119..1617f3b715c 100644 --- a/feature-libs/product-configurator/textfield/occ/index.ts +++ b/feature-libs/product-configurator/textfield/occ/index.ts @@ -1,3 +1,5 @@ +// Imported for side effects (module augmentation) +import './occ-configurator-textfield-endpoints.model'; export * from './converters/index'; export * from './occ-configurator-textfield.adapter'; export * from './textfield-configurator-occ.module'; diff --git a/feature-libs/product-configurator/textfield/occ/occ-configurator-textfield-endpoints.model.ts b/feature-libs/product-configurator/textfield/occ/occ-configurator-textfield-endpoints.model.ts new file mode 100644 index 00000000000..fcd80298026 --- /dev/null +++ b/feature-libs/product-configurator/textfield/occ/occ-configurator-textfield-endpoints.model.ts @@ -0,0 +1,29 @@ +import { OccEndpoint } from '@spartacus/core'; +declare module '@spartacus/core' { + interface OccEndpoints { + /** + * Endpoint for create configuration for the textfield configurator + * + * @member {string} + */ + createTextfieldConfiguration?: string; + /** + * Endpoint for add textfield configuration to cart + * + * @member {string} + */ + addTextfieldConfigurationToCart?: string; + /** + * Endpoint for reading textfield configuration attached to the cart entry + */ + readTextfieldConfigurationForCartEntry?: string; + /** + * Endpoint for reading textfield configuration attached to the order entry + */ + readTextfieldConfigurationForOrderEntry?: string | OccEndpoint; + /** + * Endpoint for updating textfield configuration attached to the cart entry + */ + updateTextfieldConfigurationForCartEntry?: string; + } +} diff --git a/projects/core/src/occ/occ-models/occ-endpoints.model.ts b/projects/core/src/occ/occ-models/occ-endpoints.model.ts index b1d64c525ee..bbb81087c34 100644 --- a/projects/core/src/occ/occ-models/occ-endpoints.model.ts +++ b/projects/core/src/occ/occ-models/occ-endpoints.model.ts @@ -218,26 +218,7 @@ export interface OccEndpoints { * @member {string} */ createVariantConfiguration?: string; - /** - * Endpoint for create configuration for the textfield configurator - * - * @member {string} - */ - createTextfieldConfiguration?: string; - /** - * Endpoint for add textfield configuration to cart - * - * @member {string} - */ - addTextfieldConfigurationToCart?: string; - /** - * Endpoint for reading textfield configuration attached to the cart entry - */ - readTextfieldConfigurationForCartEntry?: string; - /** - * Endpoint for updating textfield configuration attached to the cart entry - */ - updateTextfieldConfigurationForCartEntry?: string; + /** * Endpoint to read configuration *