@daffodil/product-composite 0.84.0 → 0.86.0
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/driver/magento/fragments/bundled-product.d.ts +2 -1
- package/driver/magento/injection-tokens/fragments/item.token.d.ts +2 -0
- package/driver/magento/injection-tokens/fragments/option.token.d.ts +2 -0
- package/driver/magento/injection-tokens/public_api.d.ts +4 -0
- package/driver/magento/injection-tokens/transforms/item/extra.token.d.ts +21 -0
- package/driver/magento/injection-tokens/transforms/item/token.d.ts +2 -0
- package/driver/magento/injection-tokens/transforms/option/extra.token.d.ts +21 -0
- package/driver/magento/injection-tokens/transforms/option/token.d.ts +2 -0
- package/driver/magento/interfaces/item-extra-transform.type.d.ts +3 -0
- package/driver/magento/interfaces/item-transform.type.d.ts +3 -0
- package/driver/magento/interfaces/option-extra-transform.type.d.ts +3 -0
- package/driver/magento/interfaces/option-transform.type.d.ts +3 -0
- package/driver/magento/interfaces/public_api.d.ts +4 -0
- package/driver/magento/public_api.d.ts +2 -0
- package/driver/magento/transforms/item-transformer.service.d.ts +11 -0
- package/driver/magento/transforms/option.d.ts +3 -0
- package/driver/magento/transforms/product-transformer.service.d.ts +17 -0
- package/driver/magento/transforms/public_api.d.ts +3 -1
- package/fesm2022/daffodil-product-composite-driver-in-memory.mjs +4 -4
- package/fesm2022/daffodil-product-composite-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-product-composite-driver-magento-testing.mjs +18 -18
- package/fesm2022/daffodil-product-composite-driver-magento-testing.mjs.map +1 -1
- package/fesm2022/daffodil-product-composite-driver-magento.mjs +224 -35
- package/fesm2022/daffodil-product-composite-driver-magento.mjs.map +1 -1
- package/fesm2022/daffodil-product-composite-driver-testing.mjs +4 -4
- package/fesm2022/daffodil-product-composite-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-product-composite-routing.mjs +11 -11
- package/fesm2022/daffodil-product-composite-routing.mjs.map +1 -1
- package/fesm2022/daffodil-product-composite-state-testing.mjs +7 -7
- package/fesm2022/daffodil-product-composite-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-product-composite-state.mjs +7 -7
- package/fesm2022/daffodil-product-composite-state.mjs.map +1 -1
- package/fesm2022/daffodil-product-composite-testing.mjs +11 -11
- package/fesm2022/daffodil-product-composite-testing.mjs.map +1 -1
- package/package.json +1 -1
- package/driver/magento/transforms/bundled-product-transformers.d.ts +0 -9
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-product-composite-driver-magento.mjs","sources":["../../../libs/product-composite/driver/magento/src/fragments/bundled-product.ts","../../../libs/product-composite/driver/magento/src/transforms/bundled-product-transformers.ts","../../../libs/product-composite/driver/magento/src/composite-product-driver.module.ts","../../../libs/product-composite/driver/magento/src/models/bundled-product.ts","../../../libs/product-composite/driver/magento/src/daffodil-product-composite-driver-magento.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\n\nexport const magentoBundledProductFragment = gql`\nfragment magentoBundledProduct on BundleProduct {\n\titems {\n\t\toption_id\n\t\trequired\n\t\ttitle\n\t\ttype\n\t\toptions {\n\t\t\tuid\n\t\t\tis_default\n\t\t\tlabel\n\t\t\tquantity\n position\n\t\t\tproduct {\n\t\t\t\tstock_status\n\t\t\t\tprice_range {\n\t\t\t\t\tmaximum_price {\n\t\t\t\t\t\tregular_price {\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\tcurrency\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdiscount {\n\t\t\t\t\t\t\tamount_off\n\t\t\t\t\t\t\tpercent_off\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n`;\n","import {\n DaffProductDiscount,\n DaffProductTypeEnum,\n DaffProduct,\n} from '@daffodil/product';\nimport { MagentoProductStockStatusEnum } from '@daffodil/product/driver/magento';\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItemOption,\n DaffCompositeProductItem,\n DaffCompositeProductItemInputEnum,\n} from '@daffodil/product-composite';\n\nimport {\n MagentoBundledProduct,\n MagentoBundledProductItem,\n MagentoBundledProductItemOption,\n MagentoBundledProductItemOptionProduct,\n} from '../models/bundled-product';\n\n/**\n * Transforms the magento MagentoProduct from the magento product query into a DaffProduct.\n *\n * @param response the response from a magento product query.\n */\nexport function transformMagentoBundledProduct(\n daffProduct: DaffProduct,\n { items }: MagentoBundledProduct,\n): DaffCompositeProduct {\n return {\n ...daffProduct,\n ...items.length > 0 ? {\n price: 0,\n discount: {\n amount: 0,\n percent: 0,\n },\n } : {},\n type: DaffProductTypeEnum.Composite,\n items: items.map(transformMagentoBundledProductItem),\n };\n}\n\nfunction transformMagentoBundledProductItem(item: MagentoBundledProductItem): DaffCompositeProductItem {\n return {\n id: item.option_id.toString(),\n required: item.required,\n title: item.title,\n input_type: <DaffCompositeProductItemInputEnum>item.type,\n options: Array.from(item.options).sort((a, b) => a.position - b.position).map(transformMagentoBundledProductItemOption),\n };\n}\n\nfunction transformMagentoBundledProductItemOption(option: MagentoBundledProductItemOption): DaffCompositeProductItemOption {\n return {\n id: option.uid.toString(),\n type: DaffProductTypeEnum.Simple,\n url: null,\n name: option.label,\n price: getPrice(option.product),\n images: [],\n thumbnail: null,\n discount: getDiscount(option.product),\n quantity: option.quantity,\n is_default: option.is_default,\n in_stock: option.product.stock_status === MagentoProductStockStatusEnum.InStock,\n };\n}\n\n/**\n * A function for null checking an object.\n */\nfunction getPrice(product: MagentoBundledProductItemOptionProduct): number {\n return product.price_range?.maximum_price?.regular_price?.value || null;\n}\n\nfunction getDiscount(product: MagentoBundledProductItemOptionProduct): DaffProductDiscount {\n return product.price_range?.maximum_price?.discount\n ? {\n amount: product.price_range.maximum_price.discount.amount_off,\n percent: product.price_range.maximum_price.discount.percent_off,\n } : { amount: null, percent: null };\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n provideDaffProductMagentoExtraProductTransforms,\n MagentoProductTypeEnum,\n provideDaffProductMagentoExtraProductFragments,\n provideDaffProductMagentoExtraProductPreviewTransforms,\n} from '@daffodil/product/driver/magento';\n\nimport { magentoBundledProductFragment } from './fragments/bundled-product';\nimport { MagentoBundledProduct } from './public_api';\nimport { transformMagentoBundledProduct } from './transforms/bundled-product-transformers';\n\n/**\n * A module that provides the product fragment for composite products along with a composite product transformer.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCompositeProductMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffCompositeProductMagentoDriverModule> {\n return {\n ngModule: DaffCompositeProductMagentoDriverModule,\n providers: [\n ...provideDaffProductMagentoExtraProductFragments(magentoBundledProductFragment),\n ...provideDaffProductMagentoExtraProductTransforms<MagentoBundledProduct>(\n (daffProduct, magentoProduct) =>\n magentoProduct.__typename === MagentoProductTypeEnum.BundledProduct\n ? transformMagentoBundledProduct(daffProduct, magentoProduct)\n : daffProduct,\n ),\n // stub out composite fields for a preview\n ...provideDaffProductMagentoExtraProductPreviewTransforms<MagentoBundledProduct>(\n (daffProduct, magentoProduct) =>\n magentoProduct.__typename === MagentoProductTypeEnum.BundledProduct\n ? {\n ...daffProduct,\n items: [],\n price: 0,\n discount: {\n amount: 0,\n percent: 0,\n },\n }\n : daffProduct,\n ),\n ],\n };\n }\n}\n","import {\n MagentoProduct,\n MagentoProductStockStatusEnum,\n} from '@daffodil/product/driver/magento';\n\nexport enum MagentoPriceTypeEnum {\n fixed = 'FIXED',\n percent = 'PERCENT',\n dynamic = 'DYNAMIC'\n}\n\nexport interface MagentoBundledProduct extends MagentoProduct {\n items: MagentoBundledProductItem[];\n}\n\nexport interface MagentoBundledProductItem {\n required: boolean;\n title: string;\n type: string;\n options: MagentoBundledProductItemOption[];\n option_id?: number;\n}\n\nexport interface MagentoBundledProductItemOption {\n uid: string;\n label: string;\n quantity: number;\n is_default: boolean;\n position: number;\n product: MagentoBundledProductItemOptionProduct;\n}\n\nexport interface MagentoBundledProductItemOptionProduct {\n stock_status?: MagentoProductStockStatusEnum;\n price_range: {\n maximum_price: {\n regular_price: {\n value: number;\n currency: any;\n };\n discount: {\n amount_off: number;\n percent_off: number;\n };\n };\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAEO,MAAM,6BAA6B,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACkBhD;;;;AAIG;SACa,8BAA8B,CAC5C,WAAwB,EACxB,EAAE,KAAK,EAAyB,EAAA;IAEhC,OAAO;AACL,QAAA,GAAG,WAAW;AACd,QAAA,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG;AACpB,YAAA,KAAK,EAAE,CAAC;AACR,YAAA,QAAQ,EAAE;AACR,gBAAA,MAAM,EAAE,CAAC;AACT,gBAAA,OAAO,EAAE,CAAC;AACX,aAAA;SACF,GAAG,EAAE;QACN,IAAI,EAAE,mBAAmB,CAAC,SAAS;AACnC,QAAA,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,kCAAkC,CAAC;KACrD;AACH;AAEA,SAAS,kCAAkC,CAAC,IAA+B,EAAA;IACzE,OAAO;AACL,QAAA,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;QAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,UAAU,EAAqC,IAAI,CAAC,IAAI;AACxD,QAAA,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,wCAAwC,CAAC;KACxH;AACH;AAEA,SAAS,wCAAwC,CAAC,MAAuC,EAAA;IACvF,OAAO;AACL,QAAA,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,Q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,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,GAI/B,EAAA,CAAA,CAAA;;ACTD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"daffodil-product-composite-driver-magento.mjs","sources":["../../../libs/product-composite/driver/magento/src/fragments/bundled-product.ts","../../../libs/product-composite/driver/magento/src/injection-tokens/fragments/item.token.ts","../../../libs/product-composite/driver/magento/src/injection-tokens/fragments/option.token.ts","../../../libs/product-composite/driver/magento/src/injection-tokens/transforms/item/extra.token.ts","../../../libs/product-composite/driver/magento/src/injection-tokens/transforms/option/extra.token.ts","../../../libs/product-composite/driver/magento/src/injection-tokens/transforms/item/token.ts","../../../libs/product-composite/driver/magento/src/transforms/product-transformer.service.ts","../../../libs/product-composite/driver/magento/src/injection-tokens/transforms/option/token.ts","../../../libs/product-composite/driver/magento/src/transforms/item-transformer.service.ts","../../../libs/product-composite/driver/magento/src/transforms/option.ts","../../../libs/product-composite/driver/magento/src/composite-product-driver.module.ts","../../../libs/product-composite/driver/magento/src/models/bundled-product.ts","../../../libs/product-composite/driver/magento/src/daffodil-product-composite-driver-magento.ts"],"sourcesContent":["import { gql } from 'apollo-angular';\nimport { DocumentNode } from 'graphql';\n\nimport {\n daffBuildFragmentDefinition,\n daffBuildFragmentNameSpread,\n} from '@daffodil/core/graphql';\n\nexport const magentoBundledProductFragment = (extraItemFragments: Array<DocumentNode> = [], extraOptionFragments: Array<DocumentNode> = []) => gql`\nfragment magentoBundledProduct on BundleProduct {\n\titems {\n\t\t${daffBuildFragmentNameSpread(...extraItemFragments)}\n\n\t\toption_id\n\t\trequired\n\t\ttitle\n\t\ttype\n\t\toptions {\n\t\t\t${daffBuildFragmentNameSpread(...extraOptionFragments)}\n\n\t\t\tuid\n\t\t\tis_default\n\t\t\tlabel\n\t\t\tquantity\n position\n\t\t\tproduct {\n\t\t\t\tstock_status\n\t\t\t\tprice_range {\n\t\t\t\t\tmaximum_price {\n\t\t\t\t\t\tregular_price {\n\t\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\tcurrency\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdiscount {\n\t\t\t\t\t\t\tamount_off\n\t\t\t\t\t\t\tpercent_off\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n${daffBuildFragmentDefinition(...extraItemFragments, ...extraOptionFragments)}\n`;\n","import { DocumentNode } from 'graphql';\n\nimport { createMultiInjectionToken } from '@daffodil/core';\n\nexport const {\n /**\n * A multi-provider injection token for providing extra GraphQL fragments that will be spread into product queries.\n * This can be used to retrieve additional data that is not covered by the standard Daffodil interfaces.\n *\n * Fragment structure is platform-specific and this feature should be used with care.\n *\n * This can increase query complexity above the Magento default of 300.\n * Daffodil only guarantees that stock queries don't exceed the limit of 300.\n * Apps using this token should therefore increase the query complexity limit\n * to accommodate the extra complexity contributed by the provided fragments.\n */\n token: DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_ITEM_FRAGMENTS,\n\n /**\n * Provides extra GraphQL fragments for the Magento product driver.\n *\n * See {@link DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_ITEM_FRAGMENTS}.\n *\n * @example\n * ```ts\n * providers: [\n * ...provideDaffProductCompositeMagentoExtraItemFragments(\n * myExtraProductFragment\n * )\n * ]\n * ```\n */\n provider: provideDaffProductCompositeMagentoExtraItemFragments,\n} = createMultiInjectionToken<DocumentNode>('DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_ITEM_FRAGMENTS');\n","import { DocumentNode } from 'graphql';\n\nimport { createMultiInjectionToken } from '@daffodil/core';\n\nexport const {\n /**\n * A multi-provider injection token for providing extra GraphQL fragments that will be spread into product queries.\n * This can be used to retrieve additional data that is not covered by the standard Daffodil interfaces.\n *\n * Fragment structure is platform-specific and this feature should be used with care.\n *\n * This can increase query complexity above the Magento default of 300.\n * Daffodil only guarantees that stock queries don't exceed the limit of 300.\n * Apps using this token should therefore increase the query complexity limit\n * to accommodate the extra complexity contributed by the provided fragments.\n */\n token: DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_OPTION_FRAGMENTS,\n\n /**\n * Provides extra GraphQL fragments for the Magento product driver.\n *\n * See {@link DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_OPTION_FRAGMENTS}.\n *\n * @example\n * ```ts\n * providers: [\n * ...provideDaffProductCompositeMagentoExtraOptionFragments(\n * myExtraProductFragment\n * )\n * ]\n * ```\n */\n provider: provideDaffProductCompositeMagentoExtraOptionFragments,\n} = createMultiInjectionToken<DocumentNode>('DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_OPTION_FRAGMENTS');\n","import { Provider } from '@angular/core';\n\nimport { createMultiInjectionToken } from '@daffodil/core';\nimport { DaffCompositeProductItem } from '@daffodil/product-composite';\n\nimport { MagentoBundleProductItemExtraTransform } from '../../../interfaces/item-extra-transform.type';\nimport { MagentoBundledProductItem } from '../../../models/public_api';\n\nconst {\n /**\n * A multi-provider injection token for providing extra transform logic in the Product Magento driver.\n * It is run after the standard transforms for each product preview and passed both the current transformed Daffodil product and the Magento product.\n *\n * See {@link MagentoBundledProductItem} for more info.\n */\n token: DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_ITEM_TRANSFORMS,\n provider,\n} = createMultiInjectionToken<MagentoBundleProductItemExtraTransform>('DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_ITEM_TRANSFORMS');\n\n/**\n * Provides extra product preview transforms for the Magento product driver.\n *\n * See {@link DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_ITEM_TRANSFORMS}.\n *\n * @example\n * ```ts\n * providers: [\n * ...provideDaffProductCompositeMagentoExtraItemTransforms(\n * myExtraProductTransform\n * )\n * ]\n * ```\n */\nexport function provideDaffProductCompositeMagentoExtraItemTransforms<T extends MagentoBundledProductItem = MagentoBundledProductItem, V extends DaffCompositeProductItem = DaffCompositeProductItem>(...transforms: MagentoBundleProductItemExtraTransform<T, V>[]): Provider[] {\n return provider<MagentoBundleProductItemExtraTransform<T, V>>(...transforms);\n}\n\nexport { DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_ITEM_TRANSFORMS };\n","import { Provider } from '@angular/core';\n\nimport { createMultiInjectionToken } from '@daffodil/core';\nimport { DaffCompositeProductItemOption } from '@daffodil/product-composite';\n\nimport { MagentoBundleProductOptionExtraTransform } from '../../../interfaces/option-extra-transform.type';\nimport { MagentoBundledProductItemOption } from '../../../models/public_api';\n\nconst {\n /**\n * A multi-provider injection token for providing extra transform logic in the Product Magento driver.\n * It is run after the standard transforms for each product preview and passed both the current transformed Daffodil product and the Magento product.\n *\n * See {@link MagentoBundledProductItemOption} for more info.\n */\n token: DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_OPTION_TRANSFORMS,\n provider,\n} = createMultiInjectionToken<MagentoBundleProductOptionExtraTransform>('DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_OPTION_TRANSFORMS');\n\n/**\n * Provides extra product preview transforms for the Magento product driver.\n *\n * See {@link DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_OPTION_TRANSFORMS}.\n *\n * @example\n * ```ts\n * providers: [\n * ...provideDaffProductCompositeMagentoExtraOptionTransforms(\n * myExtraProductTransform\n * )\n * ]\n * ```\n */\nexport function provideDaffProductCompositeMagentoExtraOptionTransforms<T extends MagentoBundledProductItemOption = MagentoBundledProductItemOption, V extends DaffCompositeProductItemOption = DaffCompositeProductItemOption>(...transforms: MagentoBundleProductOptionExtraTransform<T, V>[]): Provider[] {\n return provider<MagentoBundleProductOptionExtraTransform<T, V>>(...transforms);\n}\n\nexport { DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_OPTION_TRANSFORMS };\n","import { inject } from '@angular/core';\n\nimport { createSingleInjectionToken } from '@daffodil/core';\n\nimport { DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_ITEM_TRANSFORMS } from './extra.token';\nimport { MagentoBundleProductItemTransform } from '../../../interfaces/public_api';\nimport { MagentoBundledProductItem } from '../../../models/public_api';\nimport { MagentoBundledProductItemTransformer } from '../../../transforms/public_api';\n\nexport const {\n /**\n * An internal token to combine the Magento preview transform with the injected transforms.\n */\n token: DAFF_PRODUCT_COMPOSITE_MAGENTO_ITEM_TRANSFORM,\n /**\n * Provider function for {@link DAFF_PRODUCT_COMPOSITE_MAGENTO_ITEM_TRANSFORM}.\n */\n provider: provideDaffProductMagentoProductTransform,\n} = createSingleInjectionToken<MagentoBundleProductItemTransform>(\n 'DAFF_PRODUCT_COMPOSITE_MAGENTO_ITEM_TRANSFORM',\n {\n factory: () => {\n const transforms = inject(DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_ITEM_TRANSFORMS);\n const transformer = inject(MagentoBundledProductItemTransformer);\n return (magentoProduct: MagentoBundledProductItem) =>\n transforms.reduce(\n (daffProduct, transform) => transform(daffProduct, magentoProduct),\n transformer.transform(magentoProduct),\n );\n },\n },\n);\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\n\nimport {\n DaffProductTypeEnum,\n DaffProduct,\n} from '@daffodil/product';\nimport { DaffCompositeProduct } from '@daffodil/product-composite';\n\nimport { DAFF_PRODUCT_COMPOSITE_MAGENTO_ITEM_TRANSFORM } from '../injection-tokens/transforms/item/token';\nimport { MagentoBundleProductItemTransform } from '../interfaces/public_api';\nimport { MagentoBundledProduct } from '../models/bundled-product';\n\n@Injectable()\nexport class MagentoBundledProductTransformer {\n constructor(\n @Inject(DAFF_PRODUCT_COMPOSITE_MAGENTO_ITEM_TRANSFORM) private itemTransform: MagentoBundleProductItemTransform,\n ) {}\n\n /**\n * Transforms the magento MagentoProduct from the magento product query into a DaffProduct.\n *\n * @param response the response from a magento product query.\n */\n transform(\n daffProduct: DaffProduct,\n { items }: MagentoBundledProduct,\n ): DaffCompositeProduct {\n return {\n ...daffProduct,\n ...items.length > 0 ? {\n price: 0,\n discount: {\n amount: 0,\n percent: 0,\n },\n } : {},\n type: DaffProductTypeEnum.Composite,\n items: items.map(this.itemTransform),\n };\n }\n}\n","import { inject } from '@angular/core';\n\nimport { createSingleInjectionToken } from '@daffodil/core';\n\nimport { DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_OPTION_TRANSFORMS } from './extra.token';\nimport { MagentoBundleProductOptionTransform } from '../../../interfaces/public_api';\nimport { MagentoBundledProductItemOption } from '../../../models/public_api';\nimport { transformMagentoBundledProductItemOption } from '../../../transforms/public_api';\n\nexport const {\n /**\n * An internal token to combine the Magento preview transform with the injected transforms.\n */\n token: DAFF_PRODUCT_COMPOSITE_MAGENTO_OPTION_TRANSFORM,\n /**\n * Provider function for {@link DAFF_PRODUCT_COMPOSITE_MAGENTO_OPTION_TRANSFORM}.\n */\n provider: provideDaffProductMagentoProductTransform,\n} = createSingleInjectionToken<MagentoBundleProductOptionTransform>(\n 'DAFF_PRODUCT_COMPOSITE_MAGENTO_OPTION_TRANSFORM',\n {\n factory: () => {\n const transforms = inject(DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_OPTION_TRANSFORMS);\n return (magentoProduct: MagentoBundledProductItemOption) =>\n transforms.reduce(\n (daffProduct, transform) => transform(daffProduct, magentoProduct),\n transformMagentoBundledProductItemOption(magentoProduct),\n );\n },\n },\n);\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\n\nimport {\n DaffCompositeProductItem,\n DaffCompositeProductItemInputEnum,\n} from '@daffodil/product-composite';\n\nimport { DAFF_PRODUCT_COMPOSITE_MAGENTO_OPTION_TRANSFORM } from '../injection-tokens/transforms/option/token';\nimport { MagentoBundleProductOptionTransform } from '../interfaces/public_api';\nimport { MagentoBundledProductItem } from '../models/bundled-product';\n\n@Injectable()\nexport class MagentoBundledProductItemTransformer {\n constructor(\n @Inject(DAFF_PRODUCT_COMPOSITE_MAGENTO_OPTION_TRANSFORM) private optionTransform: MagentoBundleProductOptionTransform,\n ) {}\n\n transform(item: MagentoBundledProductItem): DaffCompositeProductItem {\n return {\n id: item.option_id.toString(),\n required: item.required,\n title: item.title,\n input_type: <DaffCompositeProductItemInputEnum>item.type,\n options: Array.from(item.options).sort((a, b) => a.position - b.position).map(this.optionTransform),\n };\n }\n}\n","\nimport {\n DaffProductDiscount,\n DaffProductTypeEnum,\n} from '@daffodil/product';\nimport { MagentoProductStockStatusEnum } from '@daffodil/product/driver/magento';\nimport { DaffCompositeProductItemOption } from '@daffodil/product-composite';\n\nimport {\n MagentoBundledProductItemOption,\n MagentoBundledProductItemOptionProduct,\n} from '../models/bundled-product';\n\nexport function transformMagentoBundledProductItemOption(option: MagentoBundledProductItemOption): DaffCompositeProductItemOption {\n return {\n id: option.uid.toString(),\n type: DaffProductTypeEnum.Simple,\n url: null,\n name: option.label,\n price: getPrice(option.product),\n images: [],\n thumbnail: null,\n discount: getDiscount(option.product),\n quantity: option.quantity,\n is_default: option.is_default,\n in_stock: option.product.stock_status === MagentoProductStockStatusEnum.InStock,\n };\n}\n\n/**\n * A function for null checking an object.\n */\nfunction getPrice(product: MagentoBundledProductItemOptionProduct): number {\n return product.price_range?.maximum_price?.regular_price?.value || null;\n}\n\nfunction getDiscount(product: MagentoBundledProductItemOptionProduct): DaffProductDiscount {\n return product.price_range?.maximum_price?.discount\n ? {\n amount: product.price_range.maximum_price.discount.amount_off,\n percent: product.price_range.maximum_price.discount.percent_off,\n } : { amount: null, percent: null };\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n inject,\n} from '@angular/core';\n\nimport {\n MagentoProductTypeEnum,\n provideDaffProductMagentoExtraProductPreviewTransforms,\n DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_TRANSFORMS,\n DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_FRAGMENTS,\n} from '@daffodil/product/driver/magento';\n\nimport { magentoBundledProductFragment } from './fragments/bundled-product';\nimport {\n DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_ITEM_FRAGMENTS,\n DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_OPTION_FRAGMENTS,\n} from './injection-tokens/public_api';\nimport { MagentoBundledProduct } from './models/public_api';\nimport {\n MagentoBundledProductItemTransformer,\n MagentoBundledProductTransformer,\n} from './transforms/public_api';\n\n/**\n * A module that provides the product fragment for composite products along with a composite product transformer.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCompositeProductMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffCompositeProductMagentoDriverModule> {\n return {\n ngModule: DaffCompositeProductMagentoDriverModule,\n providers: [\n MagentoBundledProductTransformer,\n MagentoBundledProductItemTransformer,\n {\n provide: DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_FRAGMENTS,\n useFactory: () => magentoBundledProductFragment(\n inject(DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_ITEM_FRAGMENTS),\n inject(DAFF_PRODUCT_COMPOSITE_MAGENTO_EXTRA_OPTION_FRAGMENTS),\n ),\n multi: true,\n },\n {\n provide: DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_TRANSFORMS,\n useFactory: () => {\n const transformer = inject(MagentoBundledProductTransformer);\n return (daffProduct, magentoProduct) =>\n magentoProduct.__typename === MagentoProductTypeEnum.BundledProduct\n ? transformer.transform(daffProduct, magentoProduct)\n : daffProduct;\n },\n multi: true,\n },\n // stub out composite fields for a preview\n ...provideDaffProductMagentoExtraProductPreviewTransforms<MagentoBundledProduct>(\n (daffProduct, magentoProduct) =>\n magentoProduct.__typename === MagentoProductTypeEnum.BundledProduct\n ? {\n ...daffProduct,\n items: [],\n price: 0,\n discount: {\n amount: 0,\n percent: 0,\n },\n }\n : daffProduct,\n ),\n ],\n };\n }\n}\n","import {\n MagentoProduct,\n MagentoProductStockStatusEnum,\n} from '@daffodil/product/driver/magento';\n\nexport enum MagentoPriceTypeEnum {\n fixed = 'FIXED',\n percent = 'PERCENT',\n dynamic = 'DYNAMIC'\n}\n\nexport interface MagentoBundledProduct extends MagentoProduct {\n items: MagentoBundledProductItem[];\n}\n\nexport interface MagentoBundledProductItem {\n required: boolean;\n title: string;\n type: string;\n options: MagentoBundledProductItemOption[];\n option_id?: number;\n}\n\nexport interface MagentoBundledProductItemOption {\n uid: string;\n label: string;\n quantity: number;\n is_default: boolean;\n position: number;\n product: MagentoBundledProductItemOptionProduct;\n}\n\nexport interface MagentoBundledProductItemOptionProduct {\n stock_status?: MagentoProductStockStatusEnum;\n price_range: {\n maximum_price: {\n regular_price: {\n value: number;\n currency: any;\n };\n discount: {\n amount_off: number;\n percent_off: number;\n };\n };\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["provider","provideDaffProductMagentoProductTransform"],"mappings":";;;;;;;;;AAQO,MAAM,6BAA6B,GAAG,CAAC,kBAA0C,GAAA,EAAE,EAAE,oBAAA,GAA4C,EAAE,KAAK,GAAG,CAAA;;;IAG9I,2BAA2B,CAAC,GAAG,kBAAkB,CAAC;;;;;;;KAOjD,2BAA2B,CAAC,GAAG,oBAAoB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AAyBvD,EAAA,2BAA2B,CAAC,GAAG,kBAAkB,EAAE,GAAG,oBAAoB,CAAC;;;ACvChE,MAAA;AACX;;;;;;;;;;AAUG;AACH,KAAK,EAAE,mDAAmD;AAE1D;;;;;;;;;;;;;AAaG;AACH,QAAQ,EAAE,oDAAoD,GAC/D,GAAG,yBAAyB,CAAe,qDAAqD;;AC7BpF,MAAA;AACX;;;;;;;;;;AAUG;AACH,KAAK,EAAE,qDAAqD;AAE5D;;;;;;;;;;;;;AAaG;AACH,QAAQ,EAAE,sDAAsD,GACjE,GAAG,yBAAyB,CAAe,uDAAuD;;ACzB7F,MAAA;AACJ;;;;;AAKG;AACH,KAAK,EAAE,oDAAoD,YAC3DA,UAAQ,GACT,GAAG,yBAAyB,CAAyC,sDAAsD;AAE5H;;;;;;;;;;;;;AAaG;AACa,SAAA,qDAAqD,CAAiI,GAAG,UAA0D,EAAA;AACjQ,IAAA,OAAOA,UAAQ,CAA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AC;AACT,4BAAA,OAAO,EAAE,CAAC;AACX,yBAAA;AACF;sBACC,WAAW,CAClB;AACF,aAAA;SACF;;kIA1CQ,uCAAuC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAvC,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uCAAuC,YAHhD,YAAY,CAAA,EAAA,CAAA,CAAA;AAGH,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uCAAuC,YAHhD,YAAY,CAAA,EAAA,CAAA,CAAA;;4FAGH,uCAAuC,EAAA,UAAA,EAAA,CAAA;kBALnD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA;;;IC3BW;AAAZ,CAAA,UAAY,oBAAoB,EAAA;AAC9B,IAAA,oBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACf,IAAA,oBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,oBAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACrB,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,GAI/B,EAAA,CAAA,CAAA;;ACTD;;AAEG;;;;"}
|
@@ -16,11 +16,11 @@ class DaffCompositeProductTestingDriverModule {
|
|
16
16
|
],
|
17
17
|
};
|
18
18
|
}
|
19
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
20
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
21
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
19
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductTestingDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
20
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductTestingDriverModule, imports: [CommonModule] }); }
|
21
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductTestingDriverModule, imports: [CommonModule] }); }
|
22
22
|
}
|
23
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductTestingDriverModule, decorators: [{
|
24
24
|
type: NgModule,
|
25
25
|
args: [{
|
26
26
|
imports: [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-product-composite-driver-testing.mjs","sources":["../../../libs/product-composite/driver/testing/src/testing.module.ts","../../../libs/product-composite/driver/testing/src/daffodil-product-composite-driver-testing.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffProductExtraFactoryTypes } from '@daffodil/product/testing';\nimport { DaffCompositeProductFactory } from '@daffodil/product-composite/testing';\n\n/**\n * Module for providing the composite product factory to the product kind factory.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCompositeProductTestingDriverModule {\n static forRoot(): ModuleWithProviders<DaffCompositeProductTestingDriverModule> {\n return {\n ngModule: DaffCompositeProductTestingDriverModule,\n providers: [\n provideDaffProductExtraFactoryTypes(DaffCompositeProductFactory),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AASA;;AAEG;MAMU,uCAAuC,CAAA;AAClD,IAAA,OAAO,OAAO,GAAA;QACZ,OAAO;AACL,YAAA,QAAQ,EAAE,uCAAuC;AACjD,YAAA,SAAS,EAAE;gBACT,mCAAmC,CAAC,2BAA2B,CAAC;AACjE,aAAA;SACF;;
|
1
|
+
{"version":3,"file":"daffodil-product-composite-driver-testing.mjs","sources":["../../../libs/product-composite/driver/testing/src/testing.module.ts","../../../libs/product-composite/driver/testing/src/daffodil-product-composite-driver-testing.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { provideDaffProductExtraFactoryTypes } from '@daffodil/product/testing';\nimport { DaffCompositeProductFactory } from '@daffodil/product-composite/testing';\n\n/**\n * Module for providing the composite product factory to the product kind factory.\n */\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCompositeProductTestingDriverModule {\n static forRoot(): ModuleWithProviders<DaffCompositeProductTestingDriverModule> {\n return {\n ngModule: DaffCompositeProductTestingDriverModule,\n providers: [\n provideDaffProductExtraFactoryTypes(DaffCompositeProductFactory),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AASA;;AAEG;MAMU,uCAAuC,CAAA;AAClD,IAAA,OAAO,OAAO,GAAA;QACZ,OAAO;AACL,YAAA,QAAQ,EAAE,uCAAuC;AACjD,YAAA,SAAS,EAAE;gBACT,mCAAmC,CAAC,2BAA2B,CAAC;AACjE,aAAA;SACF;;kIAPQ,uCAAuC,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAvC,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uCAAuC,YAHhD,YAAY,CAAA,EAAA,CAAA,CAAA;AAGH,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uCAAuC,YAHhD,YAAY,CAAA,EAAA,CAAA,CAAA;;4FAGH,uCAAuC,EAAA,UAAA,EAAA,CAAA;kBALnD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;AACb,qBAAA;AACF,iBAAA;;;AChBD;;AAEG;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { InjectionToken, inject,
|
2
|
+
import { InjectionToken, inject, Inject, Injectable, NgModule } from '@angular/core';
|
3
3
|
import { DaffBase64ServiceToken, createConfigInjectionToken } from '@daffodil/core';
|
4
4
|
import * as i1 from '@ngrx/effects';
|
5
5
|
import { createEffect, ofType, EffectsModule } from '@ngrx/effects';
|
@@ -40,10 +40,10 @@ class DaffProductCompositeQueryParamService {
|
|
40
40
|
get() {
|
41
41
|
return (new URL(this.document.location.toString())).searchParams.get(this.config.compositeSelectionQueryParam);
|
42
42
|
}
|
43
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
44
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
43
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductCompositeQueryParamService, deps: [{ token: DOCUMENT }, { token: DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
44
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductCompositeQueryParamService }); }
|
45
45
|
}
|
46
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductCompositeQueryParamService, decorators: [{
|
47
47
|
type: Injectable
|
48
48
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
49
49
|
type: Inject,
|
@@ -98,10 +98,10 @@ class DaffProductCompositePageEffects {
|
|
98
98
|
return of(...applyActions);
|
99
99
|
})));
|
100
100
|
}
|
101
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
102
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
101
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductCompositePageEffects, deps: [{ token: i1.Actions }, { token: DaffProductCompositeQueryParamService }, { token: DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
102
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductCompositePageEffects }); }
|
103
103
|
}
|
104
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
104
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductCompositePageEffects, decorators: [{
|
105
105
|
type: Injectable
|
106
106
|
}], ctorParameters: () => [{ type: i1.Actions }, { type: DaffProductCompositeQueryParamService }, { type: undefined, decorators: [{
|
107
107
|
type: Inject,
|
@@ -117,13 +117,13 @@ class DaffProductCompositeRoutingModule {
|
|
117
117
|
],
|
118
118
|
};
|
119
119
|
}
|
120
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
121
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
122
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
120
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductCompositeRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
121
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.11", ngImport: i0, type: DaffProductCompositeRoutingModule, imports: [i1.EffectsFeatureModule] }); }
|
122
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductCompositeRoutingModule, providers: [
|
123
123
|
DaffProductCompositeQueryParamService,
|
124
124
|
], imports: [EffectsModule.forFeature([DaffProductCompositePageEffects])] }); }
|
125
125
|
}
|
126
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffProductCompositeRoutingModule, decorators: [{
|
127
127
|
type: NgModule,
|
128
128
|
args: [{
|
129
129
|
imports: [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-product-composite-routing.mjs","sources":["../../../libs/product-composite/routing/src/config/default.ts","../../../libs/product-composite/routing/src/config/token.ts","../../../libs/product-composite/routing/src/services/query-param.service.ts","../../../libs/product-composite/routing/src/effects/product-page.effects.ts","../../../libs/product-composite/routing/src/module.ts","../../../libs/product-composite/routing/src/daffodil-product-composite-routing.ts"],"sourcesContent":["import {\n InjectionToken,\n inject,\n} from '@angular/core';\n\nimport {\n DaffBase64Service,\n DaffBase64ServiceToken,\n} from '@daffodil/core';\n\nimport { DaffProductCompositeRoutingConfig } from './interface';\n\n/**\n * The default configuration for the {@link DaffProductCompositeRoutingConfig}.\n */\nexport const daffProductCompositeRoutingConfigDefaultFactory = (base64: DaffBase64Service): DaffProductCompositeRoutingConfig => ({\n compositeSelectionQueryParam: 'composite_selection',\n compositeSelectionQueryParamDecode: (queryParam: string) => JSON.parse(base64.decode(queryParam)),\n});\n\nexport const DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG_DEFAULT = new InjectionToken<DaffProductCompositeRoutingConfig>(\n 'DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG_DEFAULT',\n { factory: () => daffProductCompositeRoutingConfigDefaultFactory(inject(DaffBase64ServiceToken)) },\n);\n","import { createConfigInjectionToken } from '@daffodil/core';\n\nimport { DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG_DEFAULT } from './default';\nimport { DaffProductCompositeRoutingConfig } from './interface';\n\nexport const {\n /**\n * The token used to provide @daffodil/product-composite/routing config data.\n */\n token: DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,\n /**\n * Provides the {@link DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG} token.\n */\n provider: provideDaffProductCompositeRoutingConfig,\n} = createConfigInjectionToken<DaffProductCompositeRoutingConfig>(DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG_DEFAULT, 'DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG');\n","import { DOCUMENT } from '@angular/common';\nimport {\n Inject,\n Injectable,\n} from '@angular/core';\n\nimport {\n DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,\n DaffProductCompositeRoutingConfig,\n} from '../config/public_api';\n\n@Injectable()\nexport class DaffProductCompositeQueryParamService {\n\n constructor(\n @Inject(DOCUMENT) private document: any,\n @Inject(DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG) private config: DaffProductCompositeRoutingConfig) {\n }\n\n /**\n * Get the value of the configured composite selection query param.\n */\n public get(): string {\n return (\n new URL((<any>this.document).location.toString())\n ).searchParams.get(this.config.compositeSelectionQueryParam);\n }\n}\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n Actions,\n createEffect,\n ofType,\n} from '@ngrx/effects';\nimport {\n EMPTY,\n Observable,\n of,\n} from 'rxjs';\nimport { switchMap } from 'rxjs/operators';\n\nimport { DaffProductTypeEnum } from '@daffodil/product';\nimport {\n DaffProductPageActionTypes,\n DaffProductPageLoadSuccess,\n} from '@daffodil/product/state';\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n DaffProductCompositeSelectionPayload,\n} from '@daffodil/product-composite';\nimport { DaffCompositeProductApplyOption } from '@daffodil/product-composite/state';\n\nimport {\n DaffProductCompositeRoutingConfig,\n DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,\n} from '../config/public_api';\nimport { DaffProductCompositeQueryParamService } from '../services/query-param.service';\n\n/**\n * Builds the apply actions from the list of selected options.\n */\nfunction buildApplyActions<T extends DaffCompositeProduct = DaffCompositeProduct>(product: DaffCompositeProduct, itemId: DaffCompositeProductItem['id'], selectedOptions: DaffCompositeProductItemOption['id'][]): DaffCompositeProductApplyOption<T>[] {\n const selectionItem = product.items.find(({ id }) => id === itemId);\n\n return selectionItem\n ? selectedOptions.map(selectionOptionId => {\n // use the quantity of the referenced option\n const qty = selectionItem?.options.find(({ id }) => id === selectionOptionId)?.quantity;\n\n return new DaffCompositeProductApplyOption(product.id, itemId, selectionOptionId, qty);\n })\n : [];\n}\n\n/**\n * Handles composite product specific actions for the product page.\n */\n@Injectable()\nexport class DaffProductCompositePageEffects<T extends DaffCompositeProduct = DaffCompositeProduct> {\n constructor(\n private actions$: Actions,\n private paramGetter: DaffProductCompositeQueryParamService,\n @Inject(DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG) private config: DaffProductCompositeRoutingConfig,\n ) {}\n\n /**\n * Applies composite item options based on the value of the configured query param.\n */\n preselectCompositeOptions$: Observable<typeof EMPTY | DaffCompositeProductApplyOption<T>> = createEffect(() => this.actions$.pipe(\n ofType(DaffProductPageActionTypes.ProductPageLoadSuccessAction),\n switchMap((action: DaffProductPageLoadSuccess<T>) => {\n const queryParam = this.paramGetter.get();\n\n // get the product corresponding to the current product page\n const product: DaffCompositeProduct = action.payload.products.filter(({ id }) => id === action.payload.id)[0];\n\n // if we don't have a query param set or if the product isn't composite,\n // we have nothing to do\n if (!queryParam || product?.type !== DaffProductTypeEnum.Composite) {\n return EMPTY;\n }\n\n let selection: DaffProductCompositeSelectionPayload;\n\n try {\n selection = this.config.compositeSelectionQueryParamDecode(queryParam, product);\n } catch (error) {\n return EMPTY;\n }\n\n const applyActions = Object.keys(selection).reduce<DaffCompositeProductApplyOption<T>[]>(\n (actions, itemId) => actions.concat(buildApplyActions(product, itemId, selection[itemId])),\n [],\n );\n\n // dispatch each of the apply actions into the action stream\n return of(...applyActions);\n }),\n ));\n}\n","import {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\n\nimport {\n DaffProductCompositeRoutingConfig,\n provideDaffProductCompositeRoutingConfig,\n} from './config/public_api';\nimport { DaffProductCompositePageEffects } from './effects/public_api';\nimport { DaffProductCompositeQueryParamService } from './services/query-param.service';\n\n@NgModule({\n imports: [\n EffectsModule.forFeature([DaffProductCompositePageEffects]),\n ],\n providers: [\n DaffProductCompositeQueryParamService,\n ],\n})\nexport class DaffProductCompositeRoutingModule {\n static withConfig(config?: DaffProductCompositeRoutingConfig): ModuleWithProviders<DaffProductCompositeRoutingModule> {\n return {\n ngModule: DaffProductCompositeRoutingModule,\n providers: [\n provideDaff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jC,iCAAiC,EAAA,OAAA,EAAA,CAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,CAAA,CAAA;AAAjC,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iCAAiC,EAJjC,SAAA,EAAA;YACT,qCAAqC;AACtC,SAAA,EAAA,OAAA,EAAA,CAJC,aAAa,CAAC,UAAU,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAA,EAAA,CAAA,CAAA;;2FAMlD,iCAAiC,EAAA,UAAA,EAAA,CAAA;kBAR7C,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;AACP,wBAAA,aAAa,CAAC,UAAU,CAAC,CAAC,+BAA+B,CAAC,CAAC;AAC5D,qBAAA;AACD,oBAAA,SAAS,EAAE;wBACT,qCAAqC;AACtC,qBAAA;AACF,iBAAA;;;ACpBD;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"daffodil-product-composite-routing.mjs","sources":["../../../libs/product-composite/routing/src/config/default.ts","../../../libs/product-composite/routing/src/config/token.ts","../../../libs/product-composite/routing/src/services/query-param.service.ts","../../../libs/product-composite/routing/src/effects/product-page.effects.ts","../../../libs/product-composite/routing/src/module.ts","../../../libs/product-composite/routing/src/daffodil-product-composite-routing.ts"],"sourcesContent":["import {\n InjectionToken,\n inject,\n} from '@angular/core';\n\nimport {\n DaffBase64Service,\n DaffBase64ServiceToken,\n} from '@daffodil/core';\n\nimport { DaffProductCompositeRoutingConfig } from './interface';\n\n/**\n * The default configuration for the {@link DaffProductCompositeRoutingConfig}.\n */\nexport const daffProductCompositeRoutingConfigDefaultFactory = (base64: DaffBase64Service): DaffProductCompositeRoutingConfig => ({\n compositeSelectionQueryParam: 'composite_selection',\n compositeSelectionQueryParamDecode: (queryParam: string) => JSON.parse(base64.decode(queryParam)),\n});\n\nexport const DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG_DEFAULT = new InjectionToken<DaffProductCompositeRoutingConfig>(\n 'DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG_DEFAULT',\n { factory: () => daffProductCompositeRoutingConfigDefaultFactory(inject(DaffBase64ServiceToken)) },\n);\n","import { createConfigInjectionToken } from '@daffodil/core';\n\nimport { DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG_DEFAULT } from './default';\nimport { DaffProductCompositeRoutingConfig } from './interface';\n\nexport const {\n /**\n * The token used to provide @daffodil/product-composite/routing config data.\n */\n token: DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,\n /**\n * Provides the {@link DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG} token.\n */\n provider: provideDaffProductCompositeRoutingConfig,\n} = createConfigInjectionToken<DaffProductCompositeRoutingConfig>(DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG_DEFAULT, 'DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG');\n","import { DOCUMENT } from '@angular/common';\nimport {\n Inject,\n Injectable,\n} from '@angular/core';\n\nimport {\n DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,\n DaffProductCompositeRoutingConfig,\n} from '../config/public_api';\n\n@Injectable()\nexport class DaffProductCompositeQueryParamService {\n\n constructor(\n @Inject(DOCUMENT) private document: any,\n @Inject(DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG) private config: DaffProductCompositeRoutingConfig) {\n }\n\n /**\n * Get the value of the configured composite selection query param.\n */\n public get(): string {\n return (\n new URL((<any>this.document).location.toString())\n ).searchParams.get(this.config.compositeSelectionQueryParam);\n }\n}\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport {\n Actions,\n createEffect,\n ofType,\n} from '@ngrx/effects';\nimport {\n EMPTY,\n Observable,\n of,\n} from 'rxjs';\nimport { switchMap } from 'rxjs/operators';\n\nimport { DaffProductTypeEnum } from '@daffodil/product';\nimport {\n DaffProductPageActionTypes,\n DaffProductPageLoadSuccess,\n} from '@daffodil/product/state';\nimport {\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeProductItemOption,\n DaffProductCompositeSelectionPayload,\n} from '@daffodil/product-composite';\nimport { DaffCompositeProductApplyOption } from '@daffodil/product-composite/state';\n\nimport {\n DaffProductCompositeRoutingConfig,\n DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG,\n} from '../config/public_api';\nimport { DaffProductCompositeQueryParamService } from '../services/query-param.service';\n\n/**\n * Builds the apply actions from the list of selected options.\n */\nfunction buildApplyActions<T extends DaffCompositeProduct = DaffCompositeProduct>(product: DaffCompositeProduct, itemId: DaffCompositeProductItem['id'], selectedOptions: DaffCompositeProductItemOption['id'][]): DaffCompositeProductApplyOption<T>[] {\n const selectionItem = product.items.find(({ id }) => id === itemId);\n\n return selectionItem\n ? selectedOptions.map(selectionOptionId => {\n // use the quantity of the referenced option\n const qty = selectionItem?.options.find(({ id }) => id === selectionOptionId)?.quantity;\n\n return new DaffCompositeProductApplyOption(product.id, itemId, selectionOptionId, qty);\n })\n : [];\n}\n\n/**\n * Handles composite product specific actions for the product page.\n */\n@Injectable()\nexport class DaffProductCompositePageEffects<T extends DaffCompositeProduct = DaffCompositeProduct> {\n constructor(\n private actions$: Actions,\n private paramGetter: DaffProductCompositeQueryParamService,\n @Inject(DAFF_PRODUCT_COMPOSITE_ROUTING_CONFIG) private config: DaffProductCompositeRoutingConfig,\n ) {}\n\n /**\n * Applies composite item options based on the value of the configured query param.\n */\n preselectCompositeOptions$: Observable<typeof EMPTY | DaffCompositeProductApplyOption<T>> = createEffect(() => this.actions$.pipe(\n ofType(DaffProductPageActionTypes.ProductPageLoadSuccessAction),\n switchMap((action: DaffProductPageLoadSuccess<T>) => {\n const queryParam = this.paramGetter.get();\n\n // get the product corresponding to the current product page\n const product: DaffCompositeProduct = action.payload.products.filter(({ id }) => id === action.payload.id)[0];\n\n // if we don't have a query param set or if the product isn't composite,\n // we have nothing to do\n if (!queryParam || product?.type !== DaffProductTypeEnum.Composite) {\n return EMPTY;\n }\n\n let selection: DaffProductCompositeSelectionPayload;\n\n try {\n selection = this.config.compositeSelectionQueryParamDecode(queryParam, product);\n } catch (error) {\n return EMPTY;\n }\n\n const applyActions = Object.keys(selection).reduce<DaffCompositeProductApplyOption<T>[]>(\n (actions, itemId) => actions.concat(buildApplyActions(product, itemId, selection[itemId])),\n [],\n );\n\n // dispatch each of the apply actions into the action stream\n return of(...applyActions);\n }),\n ));\n}\n","import {\n ModuleWithProviders,\n NgModule,\n} from '@angular/core';\nimport { EffectsModule } from '@ngrx/effects';\n\nimport {\n DaffProductCompositeRoutingConfig,\n provideDaffProductCompositeRoutingConfig,\n} from './config/public_api';\nimport { DaffProductCompositePageEffects } from './effects/public_api';\nimport { DaffProductCompositeQueryParamService } from './services/query-param.service';\n\n@NgModule({\n imports: [\n EffectsModule.forFeature([DaffProductCompositePageEffects]),\n ],\n providers: [\n DaffProductCompositeQueryParamService,\n ],\n})\nexport class DaffProductCompositeRoutingModule {\n static withConfig(config?: DaffProductCompositeRoutingConfig): ModuleWithProviders<DaffProductCompositeRoutingModule> {\n return {\n ngModule: DaffProductCompositeRoutingModule,\n providers: [\n provideDaffProductCompositeRoutingConfig(config),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AAYA;;AAEG;MACU,+CAA+C,GAAG,CAAC,MAAyB,MAAyC;AAChI,IAAA,4BAA4B,EAAE,qBAAqB;AACnD,IAAA,kCAAkC,EAAE,CAAC,UAAkB,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAClG,CAAA;AAEY,MAAA,6CAA6C,GAAG,IAAI,cAAc,CAC7E,+CAA+C,EAC/C,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,EA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AAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;AACP,wBAAA,aAAa,CAAC,UAAU,CAAC,CAAC,+BAA+B,CAAC,CAAC;AAC5D,qBAAA;AACD,oBAAA,SAAS,EAAE;wBACT,qCAAqC;AACtC,qBAAA;AACF,iBAAA;;;ACpBD;;AAEG;;;;"}
|
@@ -38,22 +38,22 @@ class MockDaffCompositeProductFacade {
|
|
38
38
|
return false;
|
39
39
|
}
|
40
40
|
;
|
41
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
42
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
41
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: MockDaffCompositeProductFacade, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
42
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: MockDaffCompositeProductFacade, providedIn: 'root' }); }
|
43
43
|
}
|
44
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: MockDaffCompositeProductFacade, decorators: [{
|
45
45
|
type: Injectable,
|
46
46
|
args: [{ providedIn: 'root' }]
|
47
47
|
}] });
|
48
48
|
|
49
49
|
class DaffCompositeProductStateTestingModule {
|
50
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
51
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
52
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
50
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductStateTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
51
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductStateTestingModule }); }
|
52
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductStateTestingModule, providers: [
|
53
53
|
{ provide: DaffCompositeProductFacade, useExisting: MockDaffCompositeProductFacade },
|
54
54
|
] }); }
|
55
55
|
}
|
56
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductStateTestingModule, decorators: [{
|
57
57
|
type: NgModule,
|
58
58
|
args: [{
|
59
59
|
providers: [
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"daffodil-product-composite-state-testing.mjs","sources":["../../../libs/product-composite/state/testing/src/mock-composite-product-facade.ts","../../../libs/product-composite/state/testing/src/product-testing.module.ts","../../../libs/product-composite/state/testing/src/daffodil-product-composite-state-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Dictionary } from '@ngrx/entity';\nimport { BehaviorSubject } from 'rxjs';\n\nimport { DaffPriceRange } from '@daffodil/product';\nimport {\n DaffCompositeProductItemOption,\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeConfigurationItem,\n} from '@daffodil/product-composite';\nimport { DaffCompositeProductFacadeInterface } from '@daffodil/product-composite/state';\n\n/**\n * @inheritdoc\n */\n@Injectable({ providedIn: 'root' })\nexport class MockDaffCompositeProductFacade implements DaffCompositeProductFacadeInterface {\n getRequiredItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): BehaviorSubject<DaffPriceRange> {\n return new BehaviorSubject(null);\n }\n getOptionalItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): BehaviorSubject<DaffPriceRange> {\n return new BehaviorSubject(null);\n }\n getPricesAsCurrentlyConfigured(id: DaffCompositeProduct['id']): BehaviorSubject<DaffPriceRange> {\n return new BehaviorSubject(null);\n }\n getAppliedOptions(id: DaffCompositeProduct['id']): BehaviorSubject<Dictionary<DaffCompositeProductItemOption>> {\n return new BehaviorSubject({});\n }\n getDiscountAmount(id: DaffCompositeProduct['id']): BehaviorSubject<number> {\n return new BehaviorSubject(null);\n }\n getDiscountPercent(id: DaffCompositeProduct['id']): BehaviorSubject<number> {\n return new BehaviorSubject(null);\n }\n isItemRequired(id: DaffCompositeProduct['id'], item_id: DaffCompositeProductItem['id']): BehaviorSubject<boolean> {\n return new BehaviorSubject(false);\n }\n dispatch(action) {};\n hasDiscount(priceRange: DaffPriceRange): boolean {\n return false;\n };\n hasPriceRange(priceRange: DaffPriceRange): boolean {\n return false;\n };\n}\n","import { NgModule } from '@angular/core';\n\nimport { DaffCompositeProductFacade } from '@daffodil/product-composite/state';\n\nimport { MockDaffCompositeProductFacade } from './mock-composite-product-facade';\n\n@NgModule({\n providers: [\n { provide: DaffCompositeProductFacade, useExisting: MockDaffCompositeProductFacade },\n ],\n})\nexport class DaffCompositeProductStateTestingModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAaA;;AAEG;MAEU,8BAA8B,CAAA;IACzC,qCAAqC,CAAC,EAA8B,EAAE,aAA0D,EAAA;AAC9H,QAAA,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC;;IAElC,qCAAqC,CAAC,EAA8B,EAAE,aAA0D,EAAA;AAC9H,QAAA,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC;;AAElC,IAAA,8BAA8B,CAAC,EAA8B,EAAA;AAC3D,QAAA,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC;;AAElC,IAAA,iBAAiB,CAAC,EAA8B,EAAA;AAC9C,QAAA,OAAO,IAAI,eAAe,CAAC,EAAE,CAAC;;AAEhC,IAAA,iBAAiB,CAAC,EAA8B,EAAA;AAC9C,QAAA,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC;;AAElC,IAAA,kBAAkB,CAAC,EAA8B,EAAA;AAC/C,QAAA,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC;;IAElC,cAAc,CAAC,EAA8B,EAAE,OAAuC,EAAA;AACpF,QAAA,OAAO,IAAI,eAAe,CAAC,KAAK,CAAC;;IAEnC,QAAQ,CAAC,MAAM,EAAA;;AACf,IAAA,WAAW,CAAC,UAA0B,EAAA;AACpC,QAAA,OAAO,KAAK;;;AAEd,IAAA,aAAa,CAAC,UAA0B,EAAA;AACtC,QAAA,OAAO,KAAK;;;
|
1
|
+
{"version":3,"file":"daffodil-product-composite-state-testing.mjs","sources":["../../../libs/product-composite/state/testing/src/mock-composite-product-facade.ts","../../../libs/product-composite/state/testing/src/product-testing.module.ts","../../../libs/product-composite/state/testing/src/daffodil-product-composite-state-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Dictionary } from '@ngrx/entity';\nimport { BehaviorSubject } from 'rxjs';\n\nimport { DaffPriceRange } from '@daffodil/product';\nimport {\n DaffCompositeProductItemOption,\n DaffCompositeProduct,\n DaffCompositeProductItem,\n DaffCompositeConfigurationItem,\n} from '@daffodil/product-composite';\nimport { DaffCompositeProductFacadeInterface } from '@daffodil/product-composite/state';\n\n/**\n * @inheritdoc\n */\n@Injectable({ providedIn: 'root' })\nexport class MockDaffCompositeProductFacade implements DaffCompositeProductFacadeInterface {\n getRequiredItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): BehaviorSubject<DaffPriceRange> {\n return new BehaviorSubject(null);\n }\n getOptionalItemPricesForConfiguration(id: DaffCompositeProduct['id'], configuration?: Dictionary<DaffCompositeConfigurationItem>): BehaviorSubject<DaffPriceRange> {\n return new BehaviorSubject(null);\n }\n getPricesAsCurrentlyConfigured(id: DaffCompositeProduct['id']): BehaviorSubject<DaffPriceRange> {\n return new BehaviorSubject(null);\n }\n getAppliedOptions(id: DaffCompositeProduct['id']): BehaviorSubject<Dictionary<DaffCompositeProductItemOption>> {\n return new BehaviorSubject({});\n }\n getDiscountAmount(id: DaffCompositeProduct['id']): BehaviorSubject<number> {\n return new BehaviorSubject(null);\n }\n getDiscountPercent(id: DaffCompositeProduct['id']): BehaviorSubject<number> {\n return new BehaviorSubject(null);\n }\n isItemRequired(id: DaffCompositeProduct['id'], item_id: DaffCompositeProductItem['id']): BehaviorSubject<boolean> {\n return new BehaviorSubject(false);\n }\n dispatch(action) {};\n hasDiscount(priceRange: DaffPriceRange): boolean {\n return false;\n };\n hasPriceRange(priceRange: DaffPriceRange): boolean {\n return false;\n };\n}\n","import { NgModule } from '@angular/core';\n\nimport { DaffCompositeProductFacade } from '@daffodil/product-composite/state';\n\nimport { MockDaffCompositeProductFacade } from './mock-composite-product-facade';\n\n@NgModule({\n providers: [\n { provide: DaffCompositeProductFacade, useExisting: MockDaffCompositeProductFacade },\n ],\n})\nexport class DaffCompositeProductStateTestingModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAaA;;AAEG;MAEU,8BAA8B,CAAA;IACzC,qCAAqC,CAAC,EAA8B,EAAE,aAA0D,EAAA;AAC9H,QAAA,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC;;IAElC,qCAAqC,CAAC,EAA8B,EAAE,aAA0D,EAAA;AAC9H,QAAA,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC;;AAElC,IAAA,8BAA8B,CAAC,EAA8B,EAAA;AAC3D,QAAA,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC;;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EAAA,IAAA,EAAA,sCAAsC,EAJtC,SAAA,EAAA;AACT,YAAA,EAAE,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAE,8BAA8B,EAAE;AACrF,SAAA,EAAA,CAAA,CAAA;;4FAEU,sCAAsC,EAAA,UAAA,EAAA,CAAA;kBALlD,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE;AACT,wBAAA,EAAE,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAE,8BAA8B,EAAE;AACrF,qBAAA;AACF,iBAAA;;;ACVD;;AAEG;;;;"}
|
@@ -405,10 +405,10 @@ class DaffCompositeProductFacade {
|
|
405
405
|
dispatch(action) {
|
406
406
|
this.store.dispatch(action);
|
407
407
|
}
|
408
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
409
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.
|
408
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductFacade, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
409
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductFacade, providedIn: 'root' }); }
|
410
410
|
}
|
411
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
411
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductFacade, decorators: [{
|
412
412
|
type: Injectable,
|
413
413
|
args: [{
|
414
414
|
providedIn: 'root',
|
@@ -522,13 +522,13 @@ provider: provideDaffProductCompositeReducers, } = createSingleInjectionToken('D
|
|
522
522
|
* A module that provides the default reducers and effects for composite product redux state.
|
523
523
|
*/
|
524
524
|
class DaffCompositeProductStateModule {
|
525
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.
|
526
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.
|
527
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.
|
525
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
526
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductStateModule, imports: [i1.StoreFeatureModule] }); }
|
527
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductStateModule, providers: [
|
528
528
|
...daffProductProvideMetaReducers(daffProductCompositeEnsureItemsMetaReducer),
|
529
529
|
], imports: [StoreModule.forFeature(DAFF_COMPOSITE_PRODUCT_STORE_FEATURE_KEY, DAFF_PRODUCT_COMPOSITE_REDUCERS)] }); }
|
530
530
|
}
|
531
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.
|
531
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.11", ngImport: i0, type: DaffCompositeProductStateModule, decorators: [{
|
532
532
|
type: NgModule,
|
533
533
|
args: [{
|
534
534
|
imports: [
|