@daffodil/cart 0.66.1 → 0.67.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/in-memory/injection-tokens/extra-attributes-hook.token.d.ts +1 -1
- package/driver/magento/injection-tokens/transforms/cart/token.d.ts +1 -2
- package/driver/magento/injection-tokens/transforms/cart-item/token.d.ts +1 -2
- package/driver/magento/interfaces/cart-item-transform.type.d.ts +1 -1
- package/driver/magento/interfaces/cart-transform.type.d.ts +1 -1
- package/{esm2020 → esm2022}/driver/in-memory/backend/cart/cart.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/in-memory/backend/cart-address/cart-address.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/in-memory/backend/cart-billing-address/cart-billing-address.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/in-memory/backend/cart-coupon/cart-coupon.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/in-memory/backend/cart-items/cart-items.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/in-memory/backend/cart-order/cart-order.service.mjs +4 -4
- package/{esm2020 → esm2022}/driver/in-memory/backend/cart-payment/cart-payment.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/in-memory/backend/cart-payment-methods/cart-payment-methods.service.mjs +4 -4
- package/esm2022/driver/in-memory/backend/cart-root.service.mjs +129 -0
- package/{esm2020 → esm2022}/driver/in-memory/backend/cart-shipping-address/cart-shipping-address.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/in-memory/backend/cart-shipping-information/cart-shipping-information.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/in-memory/backend/cart-shipping-methods/cart-shipping-methods.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart/cart.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-address/cart-address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-billing-address/cart-billing-address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-coupon/cart-coupon.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-driver.module.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-item/cart-item.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-order/cart-order.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-payment/cart-payment.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-payment-methods/cart-payment-methods.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-shipping-address/cart-shipping-address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-shipping-information/cart-shipping-information.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/in-memory/drivers/cart-shipping-methods/cart-shipping-methods.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/cart-address.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/cart-billing-address.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/cart-coupon.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/cart-driver.module.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/cart-item.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/cart-order.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/cart-payment-methods.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/cart-payment.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/cart-shipping-address.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/cart-shipping-information.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/cart-shipping-methods.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/cart.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-address-input.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-address.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-coupon.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-item/bundle-cart-item.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-item/cart-item.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-item/configurable-cart-item.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-payment-method.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/testing/factories/cart-shipping-method.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/testing/factories/cart.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/testing/factories/shipping-address.factory.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/transforms/inputs/billing-address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/transforms/inputs/cart-address.service.mjs +4 -4
- package/{esm2020 → esm2022}/driver/magento/transforms/inputs/cart-item-update.service.mjs +4 -4
- package/{esm2020 → esm2022}/driver/magento/transforms/inputs/payment-method.service.mjs +4 -4
- package/{esm2020 → esm2022}/driver/magento/transforms/inputs/shipping-address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/transforms/inputs/shipping-method.service.mjs +4 -4
- package/{esm2020 → esm2022}/driver/magento/transforms/outputs/billing-address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-address.service.mjs +4 -4
- package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-coupon-response.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-payment.service.mjs +4 -4
- package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-shipping-information.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-shipping-rate.service.mjs +4 -4
- package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/magento/transforms/outputs/shipping-address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/services/resolve.service.mjs +6 -6
- package/{esm2020 → esm2022}/driver/testing/drivers/cart/cart.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/cart-address/cart-address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/cart-billing-address/cart-billing-address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/cart-coupon/cart-coupon.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/cart-driver.module.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/cart-item/cart-item.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/cart-order/cart-order.service.mjs +4 -4
- package/{esm2020 → esm2022}/driver/testing/drivers/cart-payment/cart-payment.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/cart-payment-methods/cart-payment-methods.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/cart-shipping-address/cart-shipping-address.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/cart-shipping-information/cart-shipping-information.service.mjs +5 -5
- package/{esm2020 → esm2022}/driver/testing/drivers/cart-shipping-methods/cart-shipping-methods.service.mjs +5 -5
- package/{esm2020 → esm2022}/routing/cart-routing.module.mjs +15 -15
- package/esm2022/routing/guards/billing-address/billing-address.guard.mjs +40 -0
- package/esm2022/routing/guards/cart-items/cart-items.guard.mjs +41 -0
- package/{esm2020 → esm2022}/routing/guards/in-stock-items/in-stock-items.guard.mjs +6 -6
- package/{esm2020 → esm2022}/routing/guards/order-result/order-result.guard.mjs +7 -7
- package/esm2022/routing/guards/payment-method/payment-method.guard.mjs +40 -0
- package/{esm2020 → esm2022}/routing/guards/resolve-cart/resolve-cart.guard.mjs +6 -6
- package/{esm2020 → esm2022}/routing/guards/resolved-cart/resolved-cart.guard.mjs +6 -6
- package/{esm2020 → esm2022}/routing/guards/shipping-address/shipping-address.guard.mjs +7 -7
- package/esm2022/routing/guards/shipping-method/shipping-method.guard.mjs +40 -0
- package/{esm2020 → esm2022}/routing/resolvers/cart-resolver.service.mjs +7 -7
- package/esm2022/routing/resolvers/empty-cart-resolver.service.mjs +41 -0
- package/esm2022/state/cart-state.module.mjs +84 -0
- package/{esm2020 → esm2022}/state/effects/cart-address.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart-billing-address.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart-coupon.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart-item.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart-order.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart-payment-methods.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart-payment-processor.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart-payment.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart-resolver.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart-shipping-address.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart-shipping-information.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart-shipping-methods.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/effects/cart.effects.mjs +6 -6
- package/{esm2020 → esm2022}/state/facades/cart/cart.facade.mjs +6 -6
- package/esm2022/state/reducers/cart-item-entities/set-state.meta-reducer.mjs +56 -0
- package/{esm2020 → esm2022}/state/testing/cart-testing.module.mjs +7 -7
- package/{esm2020 → esm2022}/state/testing/factories/stateful-cart-item.factory.mjs +5 -5
- package/{esm2020 → esm2022}/state/testing/factories/stateful-composite-cart-item.factory.mjs +5 -5
- package/{esm2020 → esm2022}/state/testing/factories/stateful-configurable-cart-item.factory.mjs +5 -5
- package/{esm2020 → esm2022}/state/testing/mock-cart-facade.mjs +4 -4
- package/{esm2020 → esm2022}/storage/cart-storage.service.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/cart-address.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/cart-coupon.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/cart-item/cart-item.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/cart-item/composite-cart-item.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/cart-item/configurable-cart-item.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/cart-payment.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/cart-shipping-information.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/cart-shipping-rate.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/cart-total.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/cart.factory.mjs +5 -5
- package/{fesm2020 → fesm2022}/daffodil-cart-driver-in-memory.mjs +119 -119
- package/{fesm2020 → fesm2022}/daffodil-cart-driver-in-memory.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-cart-driver-magento-testing.mjs +40 -40
- package/{fesm2020 → fesm2022}/daffodil-cart-driver-magento-testing.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-cart-driver-magento.mjs +110 -110
- package/{fesm2020 → fesm2022}/daffodil-cart-driver-magento.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/daffodil-cart-driver-testing.mjs +47 -47
- package/{fesm2020 → fesm2022}/daffodil-cart-driver-testing.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-cart-driver.mjs +5 -5
- package/{fesm2020 → fesm2022}/daffodil-cart-driver.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-cart-routing.mjs +69 -69
- package/fesm2022/daffodil-cart-routing.mjs.map +1 -0
- package/{fesm2015 → fesm2022}/daffodil-cart-state-testing.mjs +21 -21
- package/{fesm2020 → fesm2022}/daffodil-cart-state-testing.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-cart-state.mjs +118 -108
- package/{fesm2020 → fesm2022}/daffodil-cart-state.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/daffodil-cart-testing.mjs +77 -77
- package/{fesm2020 → fesm2022}/daffodil-cart-testing.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-cart.mjs +4 -4
- package/{fesm2020 → fesm2022}/daffodil-cart.mjs.map +1 -1
- package/package.json +1 -1
- package/routing/guards/billing-address/billing-address.guard.d.ts +2 -2
- package/routing/guards/cart-items/cart-items.guard.d.ts +2 -2
- package/routing/guards/in-stock-items/in-stock-items.guard.d.ts +2 -2
- package/routing/guards/order-result/order-result.guard.d.ts +2 -2
- package/routing/guards/payment-method/payment-method.guard.d.ts +2 -2
- package/routing/guards/resolve-cart/resolve-cart.guard.d.ts +2 -2
- package/routing/guards/resolved-cart/resolved-cart.guard.d.ts +2 -2
- package/routing/guards/shipping-address/shipping-address.guard.d.ts +2 -2
- package/routing/guards/shipping-method/shipping-method.guard.d.ts +2 -2
- package/routing/resolvers/cart-resolver.service.d.ts +2 -2
- package/routing/resolvers/empty-cart-resolver.service.d.ts +2 -2
- package/state/actions/cart-address.actions.d.ts +1 -1
- package/state/actions/cart-billing-address.actions.d.ts +1 -1
- package/state/actions/cart-coupon.actions.d.ts +1 -1
- package/state/actions/cart-item.actions.d.ts +1 -1
- package/state/actions/cart-order.actions.d.ts +1 -1
- package/state/actions/cart-payment-methods.actions.d.ts +1 -1
- package/state/actions/cart-payment.actions.d.ts +1 -1
- package/state/actions/cart-shipping-address.actions.d.ts +1 -1
- package/state/actions/cart-shipping-information.actions.d.ts +1 -1
- package/state/actions/cart-shipping-methods.actions.d.ts +1 -1
- package/state/actions/cart.actions.d.ts +1 -1
- package/state/cart-retrieval/type.d.ts +1 -1
- package/state/reducers/action-types.type.d.ts +1 -1
- package/state/reducers/cart-item-entities/set-state.meta-reducer.d.ts +1 -1
- package/state/reducers/errors/cart-errors.type.d.ts +1 -1
- package/state/reducers/loading/cart-loading.type.d.ts +1 -1
- package/state/reducers/token/meta.token.d.ts +1 -1
- package/esm2020/driver/in-memory/backend/cart-root.service.mjs +0 -129
- package/esm2020/routing/guards/billing-address/billing-address.guard.mjs +0 -40
- package/esm2020/routing/guards/cart-items/cart-items.guard.mjs +0 -41
- package/esm2020/routing/guards/payment-method/payment-method.guard.mjs +0 -40
- package/esm2020/routing/guards/shipping-method/shipping-method.guard.mjs +0 -40
- package/esm2020/routing/resolvers/empty-cart-resolver.service.mjs +0 -41
- package/esm2020/state/cart-state.module.mjs +0 -84
- package/esm2020/state/reducers/cart-item-entities/set-state.meta-reducer.mjs +0 -46
- package/fesm2015/daffodil-cart-driver-in-memory.mjs +0 -1190
- package/fesm2015/daffodil-cart-driver-in-memory.mjs.map +0 -1
- package/fesm2015/daffodil-cart-driver-magento-testing.mjs +0 -332
- package/fesm2015/daffodil-cart-driver-magento-testing.mjs.map +0 -1
- package/fesm2015/daffodil-cart-driver-magento.mjs +0 -2306
- package/fesm2015/daffodil-cart-driver-magento.mjs.map +0 -1
- package/fesm2015/daffodil-cart-driver-testing.mjs.map +0 -1
- package/fesm2015/daffodil-cart-driver.mjs +0 -266
- package/fesm2015/daffodil-cart-driver.mjs.map +0 -1
- package/fesm2015/daffodil-cart-routing.mjs +0 -526
- package/fesm2015/daffodil-cart-routing.mjs.map +0 -1
- package/fesm2015/daffodil-cart-state-testing.mjs.map +0 -1
- package/fesm2015/daffodil-cart-state.mjs +0 -2777
- package/fesm2015/daffodil-cart-state.mjs.map +0 -1
- package/fesm2015/daffodil-cart-testing.mjs.map +0 -1
- package/fesm2015/daffodil-cart.mjs +0 -167
- package/fesm2015/daffodil-cart.mjs.map +0 -1
- package/fesm2020/daffodil-cart-driver-testing.mjs +0 -369
- package/fesm2020/daffodil-cart-routing.mjs.map +0 -1
- package/fesm2020/daffodil-cart-state-testing.mjs +0 -218
- package/fesm2020/daffodil-cart-testing.mjs +0 -365
- /package/{esm2020 → esm2022}/daffodil-cart.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/daffodil-cart-driver.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/cart-not-found.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/codes.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/expired-payment-token.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/invalid-api-response.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/invalid-country.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/invalid-coupon-code.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/invalid-email.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/invalid-region.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/item-exceeds-max-qty.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/map.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/product-not-found.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/product-out-of-stock.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/errors/unauthorized-for-cart.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/backend/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/daffodil-cart-driver-in-memory.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/drivers/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/helpers/compute-cart-item-prices.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/helpers/compute-cart-totals.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/injection-tokens/extra-attributes-hook.token.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/injection-tokens/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/in-memory/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/injection-tokens/free-payment-method.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/injection-tokens/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/cart-address-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/cart-billing-address-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/cart-coupon-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/cart-item-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/cart-order-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/cart-payment-methods-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/cart-payment-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/cart-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/cart-shipping-address-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/cart-shipping-information-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/cart-shipping-methods-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/interfaces/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/daffodil-cart-driver-magento.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/errors/codes.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/errors/map.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/errors/transform.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/injection-tokens/cart-mutation-queue.token.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/injection-tokens/fragments/cart.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/injection-tokens/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/injection-tokens/transforms/cart/token.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/injection-tokens/transforms/cart-item/token.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/interfaces/cart-item-transform.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/interfaces/cart-transform.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/interfaces/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/billing-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/cart-address-base.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/cart-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/cart-item-update.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/cart-item.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/payment-method.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/shipping-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/requests/shipping-method.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/cart-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/cart-coupon.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/cart-item.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/cart-payment-method.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/cart-shipping-method.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/cart.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/shipping-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/user-error.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/models/responses/user-error.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/add-item/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/add-item/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/add-item/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/add-item/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/apply-coupon/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/apply-coupon/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/apply-coupon/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/apply-coupon/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/create-cart/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/create-cart/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/create-cart/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/create-cart/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/available-payment-method.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/available-shipping-method.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/cart-address.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/cart-coupon.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/cart-item.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/cart.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/prices.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/selected-payment-method.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/selected-shipping-method.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/fragments/user-error.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-billing-address/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-billing-address/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-billing-address/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-billing-address/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-cart/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-cart/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-cart/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-cart/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-payment-method/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-payment-method/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-payment-method/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-payment-method/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-shipping-method/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-shipping-method/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-shipping-method/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-selected-shipping-method/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-shipping-address/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-shipping-address/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-shipping-address/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/get-shipping-address/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-coupons/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-coupons/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-coupons/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-coupons/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-items/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-items/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-items/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-items/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-payment-methods/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-payment-methods/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-payment-methods/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-payment-methods/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-shipping-methods/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-shipping-methods/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-shipping-methods/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/list-shipping-methods/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/merge-carts/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/merge-carts/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/merge-carts/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/merge-carts/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/place-order/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/place-order/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/place-order/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/place-order/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/remove-all-coupons/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/remove-all-coupons/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/remove-all-coupons/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/remove-all-coupons/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/remove-item/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/remove-item/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/remove-item/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/remove-item/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing-and-email/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing-and-email/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing-and-email/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-payment-method-with-billing-and-email/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-shipping-method/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-shipping-method/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-shipping-method/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/set-selected-shipping-method/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-address/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-address/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-address/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-address/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-address-with-email/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-address-with-email/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-address-with-email/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-address-with-email/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address-with-email/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address-with-email/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address-with-email/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-billing-address-with-email/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-item/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-item/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-item/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-item/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address-with-email/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address-with-email/query.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address-with-email/response.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/queries/update-shipping-address-with-email/variables.type.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/testing/daffodil-cart-driver-magento-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/testing/factories/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/testing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/inputs/cart-item-input-transformers.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-coupon.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-item/bundle-cart-item-transformer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-item/cart-item-transformer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-item/configurable-cart-item-transformer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-item/simple-cart-item-transformer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/outputs/cart-totals-transformer.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/magento/transforms/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/operators/handle-cart-not-found.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/operators/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/services/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/daffodil-cart-driver-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/drivers/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/driver/testing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/codes.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/map.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/resolution/cart-not-found-or-created-resolution.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/resolution/cart-resolution.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/resolution/cart-server-side-resolution.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/resolution/cart-storage-resolution.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/resolution/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/injection-tokens/payment-method-map.mjs +0 -0
- /package/{esm2020 → esm2022}/injection-tokens/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/models/cart-address.mjs +0 -0
- /package/{esm2020 → esm2022}/models/cart-coupon.mjs +0 -0
- /package/{esm2020 → esm2022}/models/cart-item-input.mjs +0 -0
- /package/{esm2020 → esm2022}/models/cart-item.mjs +0 -0
- /package/{esm2020 → esm2022}/models/cart-order-result.mjs +0 -0
- /package/{esm2020 → esm2022}/models/cart-payment.mjs +0 -0
- /package/{esm2020 → esm2022}/models/cart-shipping-info.mjs +0 -0
- /package/{esm2020 → esm2022}/models/cart-shipping-rate.mjs +0 -0
- /package/{esm2020 → esm2022}/models/cart-total.mjs +0 -0
- /package/{esm2020 → esm2022}/models/cart.mjs +0 -0
- /package/{esm2020 → esm2022}/models/composite-cart-item.mjs +0 -0
- /package/{esm2020 → esm2022}/models/configurable-cart-item.mjs +0 -0
- /package/{esm2020 → esm2022}/models/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/config/config.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/config/resolution/config.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/daffodil-cart-routing.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/guards/billing-address/billing-address-guard-redirect.token.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/guards/cart-items/cart-items-guard-redirect.token.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/guards/in-stock-items/in-stock-items-guard-redirect.token.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/guards/order-result/order-result-guard-redirect.token.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/guards/payment-method/payment-method-guard-redirect.token.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/guards/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/guards/resolve-cart/redirect.token.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/guards/shipping-address/shipping-address-guard-redirect.token.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/guards/shipping-method/shipping-method-guard-redirect.token.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/resolvers/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/resolvers/tokens/cart-resolver-redirect.token.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/resolvers/tokens/empty-cart-resolver-redirect.token.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart-address.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart-billing-address.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart-coupon.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart-item.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart-order.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart-payment-methods.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart-payment.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart-retrieval.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart-shipping-address.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart-shipping-information.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart-shipping-methods.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/cart.actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/cart-retrieval/get-response.mjs +0 -0
- /package/{esm2020 → esm2022}/state/cart-retrieval/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/cart-retrieval/token.mjs +0 -0
- /package/{esm2020 → esm2022}/state/cart-retrieval/type.mjs +0 -0
- /package/{esm2020 → esm2022}/state/daffodil-cart-state.mjs +0 -0
- /package/{esm2020 → esm2022}/state/facades/cart/cart-facade.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/state/index.mjs +0 -0
- /package/{esm2020 → esm2022}/state/injection-tokens/cart-item-state-debounce-time.mjs +0 -0
- /package/{esm2020 → esm2022}/state/injection-tokens/error-matcher.token.mjs +0 -0
- /package/{esm2020 → esm2022}/state/injection-tokens/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/models/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/models/stateful-cart-item.mjs +0 -0
- /package/{esm2020 → esm2022}/state/models/stateful-cart.mjs +0 -0
- /package/{esm2020 → esm2022}/state/models/stateful-composite-cart-item.mjs +0 -0
- /package/{esm2020 → esm2022}/state/models/stateful-configurable-cart-item.mjs +0 -0
- /package/{esm2020 → esm2022}/state/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/action-types.type.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart/cart.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart/retrieval-actions.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-billing-address/cart-billing-address.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-coupon/cart-coupon.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-initial-state.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-item/cart-item.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-item-entities/cart-item-entities-reducer-adapter.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-item-entities/cart-item-entities.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-item-entities/retrieval-actions.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-operation-type.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-order/cart-order-initial-state.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-order/cart-order-state.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-order/cart-order.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-payment/cart-payment.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-payment/payment.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-payment-methods/cart-payment-methods.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-reducers-state.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-reducers.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-resolve/cart-resolve-state.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-resolve/cart-resolve.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-shipping-address/cart-shipping-address.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-shipping-information/cart-shipping-information.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-shipping-methods/cart-shipping-methods.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-state.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart-store-feature-key.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/cart.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/errors/cart-errors.type.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/errors/error-state-helpers.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/loading/cart-loading.type.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/token/config.token.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/token/extra.token.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/token/meta.token.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/token/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/token/reducers.token.mjs +0 -0
- /package/{esm2020 → esm2022}/state/selectors/cart/cart.selector.mjs +0 -0
- /package/{esm2020 → esm2022}/state/selectors/cart-feature.selector.mjs +0 -0
- /package/{esm2020 → esm2022}/state/selectors/cart-item-entities/cart-item-entities.selectors.mjs +0 -0
- /package/{esm2020 → esm2022}/state/selectors/cart-order/cart-order.selector.mjs +0 -0
- /package/{esm2020 → esm2022}/state/selectors/cart.selector.mjs +0 -0
- /package/{esm2020 → esm2022}/state/selectors/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/testing/daffodil-cart-state-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/state/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/state/testing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/daffodil-cart-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/factories/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/public_api.mjs +0 -0
|
@@ -1,2306 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Injectable, Inject, inject, NgModule } from '@angular/core';
|
|
3
|
-
import { DaffCartItemInputType, DaffCartTotalTypeEnum } from '@daffodil/cart';
|
|
4
|
-
import { MagentoProductStockStatusEnum } from '@daffodil/product/driver/magento';
|
|
5
|
-
import { daffAdd } from '@daffodil/core';
|
|
6
|
-
import * as i1 from 'apollo-angular';
|
|
7
|
-
import { gql, Apollo } from 'apollo-angular';
|
|
8
|
-
import { magentoMoneyFragment, daffMagentoTransformGraphQlError, daffTransformMagentoError } from '@daffodil/driver/magento';
|
|
9
|
-
import * as i5 from '@daffodil/core/graphql';
|
|
10
|
-
import { daffBuildFragmentNameSpread, daffBuildFragmentDefinition, DaffQueuedApollo } from '@daffodil/core/graphql';
|
|
11
|
-
import { DaffCartNotFoundError, DaffUnauthorizedForCartError, DaffCartDriverErrorCodes, DaffProductOutOfStockError, DaffCartInvalidAPIResponseError, DaffCartDriverErrorMap, DaffInvalidCouponCodeError, DaffCartItemDriver, DaffCartDriver, DaffCartAddressDriver, DaffCartBillingAddressDriver, DaffCartShippingAddressDriver, DaffCartShippingMethodsDriver, DaffCartShippingInformationDriver, DaffCartPaymentDriver, DaffCartPaymentMethodsDriver, DaffCartOrderDriver, DaffCartCouponDriver, daffCartDriverProvideFreePaymentMethod } from '@daffodil/cart/driver';
|
|
12
|
-
import { DaffBadInputError } from '@daffodil/driver';
|
|
13
|
-
import { DaffProductNotFoundError } from '@daffodil/product/driver';
|
|
14
|
-
import { of, throwError, forkJoin } from 'rxjs';
|
|
15
|
-
import { map, switchMap, catchError } from 'rxjs/operators';
|
|
16
|
-
import { CommonModule } from '@angular/common';
|
|
17
|
-
|
|
18
|
-
function daffMagentoCouponTransform(coupon) {
|
|
19
|
-
return {
|
|
20
|
-
id: coupon.code,
|
|
21
|
-
code: coupon.code,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Transforms the magento MagentoCartItem from the magento cart query into a DaffCartItem.
|
|
27
|
-
*
|
|
28
|
-
* @param response the response from a magento cart query.
|
|
29
|
-
*/
|
|
30
|
-
function transformMagentoSimpleCartItem(cartItem) {
|
|
31
|
-
var _a;
|
|
32
|
-
return {
|
|
33
|
-
// base
|
|
34
|
-
type: DaffCartItemInputType.Simple,
|
|
35
|
-
item_id: cartItem.id,
|
|
36
|
-
id: cartItem.id,
|
|
37
|
-
url: `/${cartItem.product.url_key}${cartItem.product.url_suffix}`,
|
|
38
|
-
sku: cartItem.product.sku,
|
|
39
|
-
name: cartItem.product.name,
|
|
40
|
-
qty: cartItem.quantity,
|
|
41
|
-
price: cartItem.prices.price.value,
|
|
42
|
-
row_total: cartItem.prices.row_total.value,
|
|
43
|
-
product_id: String(cartItem.product.id),
|
|
44
|
-
image: {
|
|
45
|
-
id: cartItem.product.thumbnail.label,
|
|
46
|
-
url: cartItem.product.thumbnail.url,
|
|
47
|
-
label: cartItem.product.thumbnail.label,
|
|
48
|
-
},
|
|
49
|
-
in_stock: cartItem.product.stock_status === MagentoProductStockStatusEnum.InStock,
|
|
50
|
-
discounts: ((_a = cartItem.prices.discounts) === null || _a === void 0 ? void 0 : _a.map(discount => {
|
|
51
|
-
var _a;
|
|
52
|
-
return ({
|
|
53
|
-
amount: (_a = discount.amount) === null || _a === void 0 ? void 0 : _a.value,
|
|
54
|
-
label: discount.label,
|
|
55
|
-
});
|
|
56
|
-
})) || [],
|
|
57
|
-
// TODO: implement
|
|
58
|
-
parent_item_id: null,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function transformBundleCartItemOption(option) {
|
|
63
|
-
return {
|
|
64
|
-
option_id: String(option.values[0].id),
|
|
65
|
-
id: String(option.values[0].id),
|
|
66
|
-
option_label: option.label,
|
|
67
|
-
value_label: option.values[0].label,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Transforms a MagentoBundleCartItem into a DaffCartItem.
|
|
72
|
-
*
|
|
73
|
-
* @param response the response from a magento cart query.
|
|
74
|
-
*/
|
|
75
|
-
function transformMagentoBundleCartItem(bundleCartItem) {
|
|
76
|
-
return Object.assign(Object.assign({}, transformMagentoSimpleCartItem(bundleCartItem)), { type: DaffCartItemInputType.Composite, options: bundleCartItem.bundle_options.map(transformBundleCartItemOption) });
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function transformConfigurableCartItemAttribute(option) {
|
|
80
|
-
return {
|
|
81
|
-
attribute_label: option.option_label,
|
|
82
|
-
value_label: option.value_label,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Transforms a MagentoConfigurableCartItem into a DaffCartItem.
|
|
87
|
-
*
|
|
88
|
-
* @param response the response from a magento cart query.
|
|
89
|
-
*/
|
|
90
|
-
function transformMagentoConfigurableCartItem(configurableCartItem) {
|
|
91
|
-
return Object.assign(Object.assign({}, transformMagentoSimpleCartItem(configurableCartItem)), { type: DaffCartItemInputType.Configurable, attributes: configurableCartItem.configurable_options.map(transformConfigurableCartItemAttribute) });
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
var MagentoCartItemTypeEnum;
|
|
95
|
-
(function (MagentoCartItemTypeEnum) {
|
|
96
|
-
MagentoCartItemTypeEnum["Simple"] = "SimpleCartItem";
|
|
97
|
-
MagentoCartItemTypeEnum["Bundle"] = "BundleCartItem";
|
|
98
|
-
MagentoCartItemTypeEnum["Configurable"] = "ConfigurableCartItem";
|
|
99
|
-
})(MagentoCartItemTypeEnum || (MagentoCartItemTypeEnum = {}));
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The standard transform for a magento cart item.
|
|
103
|
-
*/
|
|
104
|
-
const daffTransformMagentoCartItem = (cartItem) => {
|
|
105
|
-
switch (cartItem.__typename) {
|
|
106
|
-
case MagentoCartItemTypeEnum.Bundle:
|
|
107
|
-
return transformMagentoBundleCartItem(cartItem);
|
|
108
|
-
case MagentoCartItemTypeEnum.Configurable:
|
|
109
|
-
return transformMagentoConfigurableCartItem(cartItem);
|
|
110
|
-
case MagentoCartItemTypeEnum.Simple:
|
|
111
|
-
default:
|
|
112
|
-
return transformMagentoSimpleCartItem(cartItem);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Transforms the MagentoCartItem into a DaffCartItem using the provided transforms.
|
|
117
|
-
*/
|
|
118
|
-
const transformMagentoCartItem = (daffCartItem, cartItem, transforms = []) => transforms.reduce((item, transform) => transform(item, cartItem), daffCartItem);
|
|
119
|
-
|
|
120
|
-
function validateSelectedShippingAddress(cart) {
|
|
121
|
-
var _a, _b, _c;
|
|
122
|
-
return !!((_c = (_b = (_a = cart.shipping_addresses) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.selected_shipping_method) === null || _c === void 0 ? void 0 : _c.amount);
|
|
123
|
-
}
|
|
124
|
-
function transformCartTotals(cart) {
|
|
125
|
-
const totalTax = cart.prices.applied_taxes ? cart.prices.applied_taxes.reduce((acc, tax) => (daffAdd(acc, tax.amount.value)), 0) : 0;
|
|
126
|
-
return {
|
|
127
|
-
totals: {
|
|
128
|
-
[DaffCartTotalTypeEnum.grandTotal]: {
|
|
129
|
-
name: DaffCartTotalTypeEnum.grandTotal,
|
|
130
|
-
label: 'Grand Total',
|
|
131
|
-
value: cart.prices.grand_total.value,
|
|
132
|
-
order: 0,
|
|
133
|
-
},
|
|
134
|
-
[DaffCartTotalTypeEnum.subtotalExcludingTax]: {
|
|
135
|
-
name: DaffCartTotalTypeEnum.subtotalExcludingTax,
|
|
136
|
-
label: 'Subtotal Excluding Tax',
|
|
137
|
-
value: cart.prices.subtotal_excluding_tax.value,
|
|
138
|
-
order: 1,
|
|
139
|
-
},
|
|
140
|
-
[DaffCartTotalTypeEnum.subtotalIncludingTax]: {
|
|
141
|
-
name: DaffCartTotalTypeEnum.subtotalIncludingTax,
|
|
142
|
-
label: 'Subtotal Including Tax',
|
|
143
|
-
value: cart.prices.subtotal_including_tax.value,
|
|
144
|
-
order: 2,
|
|
145
|
-
},
|
|
146
|
-
[DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax]: {
|
|
147
|
-
name: DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax,
|
|
148
|
-
label: 'Subtotal with Discount Excluding Tax',
|
|
149
|
-
value: cart.prices.subtotal_with_discount_excluding_tax.value,
|
|
150
|
-
order: 3,
|
|
151
|
-
},
|
|
152
|
-
[DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax]: {
|
|
153
|
-
name: DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax,
|
|
154
|
-
label: 'Subtotal with Discount Including Tax',
|
|
155
|
-
value: cart.prices.subtotal_with_discount_excluding_tax.value ?
|
|
156
|
-
daffAdd(cart.prices.subtotal_with_discount_excluding_tax.value, totalTax) :
|
|
157
|
-
cart.prices.subtotal_with_discount_excluding_tax.value,
|
|
158
|
-
order: 4,
|
|
159
|
-
},
|
|
160
|
-
[DaffCartTotalTypeEnum.tax]: {
|
|
161
|
-
name: DaffCartTotalTypeEnum.tax,
|
|
162
|
-
label: 'Tax',
|
|
163
|
-
value: totalTax,
|
|
164
|
-
order: 5,
|
|
165
|
-
},
|
|
166
|
-
[DaffCartTotalTypeEnum.discount]: {
|
|
167
|
-
name: DaffCartTotalTypeEnum.discount,
|
|
168
|
-
label: 'Discounts',
|
|
169
|
-
value: cart.prices.discounts ? daffAdd(...cart.prices.discounts.map((discount) => discount.amount.value)) : 0,
|
|
170
|
-
order: 6,
|
|
171
|
-
},
|
|
172
|
-
[DaffCartTotalTypeEnum.shipping]: {
|
|
173
|
-
name: DaffCartTotalTypeEnum.shipping,
|
|
174
|
-
label: 'Shipping',
|
|
175
|
-
value: validateSelectedShippingAddress(cart) ? cart.shipping_addresses[0].selected_shipping_method.amount.value : null,
|
|
176
|
-
order: 7,
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* An multi-provider injection token for providing extra GraphQL fragments that will be spread into cart queries.
|
|
184
|
-
* This can be used to retrieve additional data that is not covered by the standard Daffodil interfaces.
|
|
185
|
-
* The data will appear in DaffCart#extra_attributes.
|
|
186
|
-
*
|
|
187
|
-
* Fragment structure is platform-specific and this feature should be used with care.
|
|
188
|
-
*
|
|
189
|
-
* This can increase query complexity above the Magento default of 300.
|
|
190
|
-
* Daffodil only guarantees that stock queries don't exceed the limit of 300.
|
|
191
|
-
* Apps using this token should therefore increase the query complexity limit
|
|
192
|
-
* to accommodate the extra complexity contributed by the provided fragments.
|
|
193
|
-
*/
|
|
194
|
-
const DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS = new InjectionToken('DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS', { factory: () => [] });
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* A multi-provider injection token for providing cart item transform logic in the Magento driver.
|
|
198
|
-
* It is run after the standard transforms and passed both the current transformed Daffodil cart item and the Magento cart item.
|
|
199
|
-
*/
|
|
200
|
-
const DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS = new InjectionToken('DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS', { factory: () => [] });
|
|
201
|
-
/**
|
|
202
|
-
* Provides cart item transforms for the Magento cart driver.
|
|
203
|
-
*
|
|
204
|
-
* See {@link DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS}.
|
|
205
|
-
*
|
|
206
|
-
* ```ts
|
|
207
|
-
* providers: [
|
|
208
|
-
* ...daffProvideCartMagentoCartItemTransforms(
|
|
209
|
-
* myCartItemTransform
|
|
210
|
-
* )
|
|
211
|
-
* ]
|
|
212
|
-
* ```
|
|
213
|
-
*/
|
|
214
|
-
function daffProvideCartMagentoCartItemTransforms(...transforms) {
|
|
215
|
-
return transforms.map(transform => ({
|
|
216
|
-
provide: DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS,
|
|
217
|
-
useValue: transform,
|
|
218
|
-
multi: true,
|
|
219
|
-
}));
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* A multi-provider injection token for providing cart transform logic in the Magento driver.
|
|
224
|
-
* It is run after the standard transforms and passed both the current transformed Daffodil cart and the Magento cart.
|
|
225
|
-
*/
|
|
226
|
-
const DAFF_CART_MAGENTO_CART_TRANSFORMS = new InjectionToken('DAFF_CART_MAGENTO_CART_TRANSFORMS', { factory: () => [] });
|
|
227
|
-
/**
|
|
228
|
-
* Provides cart transforms for the Magento cart driver.
|
|
229
|
-
*
|
|
230
|
-
* See {@link DAFF_CART_MAGENTO_CART_TRANSFORMS}.
|
|
231
|
-
*
|
|
232
|
-
* ```ts
|
|
233
|
-
* providers: [
|
|
234
|
-
* ...daffProvideCartMagentoCartTransforms(
|
|
235
|
-
* myCartTransform
|
|
236
|
-
* )
|
|
237
|
-
* ]
|
|
238
|
-
* ```
|
|
239
|
-
*/
|
|
240
|
-
function daffProvideCartMagentoCartTransforms(...transforms) {
|
|
241
|
-
return transforms.map(transform => ({
|
|
242
|
-
provide: DAFF_CART_MAGENTO_CART_TRANSFORMS,
|
|
243
|
-
useValue: transform,
|
|
244
|
-
multi: true,
|
|
245
|
-
}));
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* Transforms magento addresses into an object usable by daffodil.
|
|
250
|
-
*/
|
|
251
|
-
class DaffMagentoCartAddressTransformer {
|
|
252
|
-
/**
|
|
253
|
-
* Transforms the magento MagentoCart from the magento cart query into a DaffCartAddress.
|
|
254
|
-
*
|
|
255
|
-
* @param address the address from a magento cart query.
|
|
256
|
-
*/
|
|
257
|
-
transform(address) {
|
|
258
|
-
return address ? {
|
|
259
|
-
// address
|
|
260
|
-
street: address.street[0],
|
|
261
|
-
street2: address.street[1],
|
|
262
|
-
city: address.city,
|
|
263
|
-
region: String(address.region.region_id),
|
|
264
|
-
region_code: address.region.code,
|
|
265
|
-
country: address.country.label,
|
|
266
|
-
country_id: address.country.code,
|
|
267
|
-
postcode: address.postcode,
|
|
268
|
-
// personal address
|
|
269
|
-
firstname: address.firstname,
|
|
270
|
-
lastname: address.lastname,
|
|
271
|
-
telephone: address.telephone,
|
|
272
|
-
email: address.email,
|
|
273
|
-
id: address.customer_address_id ? String(address.customer_address_id) : null,
|
|
274
|
-
// TODO: implement
|
|
275
|
-
suffix: null,
|
|
276
|
-
middlename: null,
|
|
277
|
-
prefix: null,
|
|
278
|
-
address_type: null,
|
|
279
|
-
} : null;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
/** @nocollapse */ DaffMagentoCartAddressTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartAddressTransformer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
283
|
-
/** @nocollapse */ DaffMagentoCartAddressTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartAddressTransformer, providedIn: 'root' });
|
|
284
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartAddressTransformer, decorators: [{
|
|
285
|
-
type: Injectable,
|
|
286
|
-
args: [{
|
|
287
|
-
providedIn: 'root',
|
|
288
|
-
}]
|
|
289
|
-
}] });
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Transforms magento addresses into an object usable by daffodil.
|
|
293
|
-
*/
|
|
294
|
-
class DaffMagentoShippingAddressTransformer {
|
|
295
|
-
constructor(addressTransformer) {
|
|
296
|
-
this.addressTransformer = addressTransformer;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Transforms the magento MagentoCart from the magento cart query into a DaffCartAddress.
|
|
300
|
-
*
|
|
301
|
-
* @param address the address from a magento cart query.
|
|
302
|
-
*/
|
|
303
|
-
transform(address) {
|
|
304
|
-
return address ? Object.assign(Object.assign({}, this.addressTransformer.transform(address)), { address_type: 'shipping' }) : null;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
/** @nocollapse */ DaffMagentoShippingAddressTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoShippingAddressTransformer, deps: [{ token: DaffMagentoCartAddressTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
308
|
-
/** @nocollapse */ DaffMagentoShippingAddressTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoShippingAddressTransformer, providedIn: 'root' });
|
|
309
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoShippingAddressTransformer, decorators: [{
|
|
310
|
-
type: Injectable,
|
|
311
|
-
args: [{
|
|
312
|
-
providedIn: 'root',
|
|
313
|
-
}]
|
|
314
|
-
}], ctorParameters: function () { return [{ type: DaffMagentoCartAddressTransformer }]; } });
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Transforms magento addresses into an object usable by daffodil.
|
|
318
|
-
*/
|
|
319
|
-
class DaffMagentoBillingAddressTransformer {
|
|
320
|
-
constructor(addressTransformer) {
|
|
321
|
-
this.addressTransformer = addressTransformer;
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Transforms the magento MagentoCart from the magento cart query into a DaffCartAddress.
|
|
325
|
-
*
|
|
326
|
-
* @param address the address from a magento cart query.
|
|
327
|
-
*/
|
|
328
|
-
transform(address) {
|
|
329
|
-
return address ? Object.assign(Object.assign({}, this.addressTransformer.transform(address)), { address_type: 'billing' }) : null;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
/** @nocollapse */ DaffMagentoBillingAddressTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoBillingAddressTransformer, deps: [{ token: DaffMagentoCartAddressTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
333
|
-
/** @nocollapse */ DaffMagentoBillingAddressTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoBillingAddressTransformer, providedIn: 'root' });
|
|
334
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoBillingAddressTransformer, decorators: [{
|
|
335
|
-
type: Injectable,
|
|
336
|
-
args: [{
|
|
337
|
-
providedIn: 'root',
|
|
338
|
-
}]
|
|
339
|
-
}], ctorParameters: function () { return [{ type: DaffMagentoCartAddressTransformer }]; } });
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Transforms magento carts into an object usable by daffodil.
|
|
343
|
-
*/
|
|
344
|
-
class DaffMagentoCartPaymentTransformer {
|
|
345
|
-
/**
|
|
346
|
-
* Transforms the magento CartPayment from the magento cart query into a DaffCartPaymentMethod.
|
|
347
|
-
*
|
|
348
|
-
* @param response the response from a magento cart query.
|
|
349
|
-
*/
|
|
350
|
-
transform(responsePayment) {
|
|
351
|
-
return responsePayment ? {
|
|
352
|
-
method: responsePayment.code,
|
|
353
|
-
} : null;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
/** @nocollapse */ DaffMagentoCartPaymentTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartPaymentTransformer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
357
|
-
/** @nocollapse */ DaffMagentoCartPaymentTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartPaymentTransformer, providedIn: 'root' });
|
|
358
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartPaymentTransformer, decorators: [{
|
|
359
|
-
type: Injectable,
|
|
360
|
-
args: [{
|
|
361
|
-
providedIn: 'root',
|
|
362
|
-
}]
|
|
363
|
-
}] });
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Transforms magento cart shipping methods into an object usable by daffodil.
|
|
367
|
-
*/
|
|
368
|
-
class DaffMagentoCartShippingRateTransformer {
|
|
369
|
-
/**
|
|
370
|
-
* Transforms the magento shipping method from the magento cart query into a DaffCartShippingRate.
|
|
371
|
-
*
|
|
372
|
-
* @param shippingMethod the shippingMethod from a magento cart query.
|
|
373
|
-
*/
|
|
374
|
-
transform(shippingMethod) {
|
|
375
|
-
return shippingMethod ? {
|
|
376
|
-
carrier: shippingMethod.carrier_code,
|
|
377
|
-
carrier_title: shippingMethod.carrier_title,
|
|
378
|
-
price: shippingMethod.amount.value,
|
|
379
|
-
method_code: shippingMethod.method_code,
|
|
380
|
-
method_title: shippingMethod.method_title,
|
|
381
|
-
// TODO: implement
|
|
382
|
-
id: null,
|
|
383
|
-
method_description: null,
|
|
384
|
-
} : null;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
/** @nocollapse */ DaffMagentoCartShippingRateTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingRateTransformer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
388
|
-
/** @nocollapse */ DaffMagentoCartShippingRateTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingRateTransformer, providedIn: 'root' });
|
|
389
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingRateTransformer, decorators: [{
|
|
390
|
-
type: Injectable,
|
|
391
|
-
args: [{
|
|
392
|
-
providedIn: 'root',
|
|
393
|
-
}]
|
|
394
|
-
}] });
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Transforms magento cart shipping methods into an object usable by daffodil.
|
|
398
|
-
*/
|
|
399
|
-
class DaffMagentoCartShippingInformationTransformer {
|
|
400
|
-
constructor(shippingRateTransformer) {
|
|
401
|
-
this.shippingRateTransformer = shippingRateTransformer;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Transforms the magento shipping method from the magento cart query into a DaffCartShippingInformation.
|
|
405
|
-
*
|
|
406
|
-
* @param shippingMethod the shippingMethod from a magento cart query.
|
|
407
|
-
*/
|
|
408
|
-
transform(shippingMethod) {
|
|
409
|
-
return shippingMethod ? Object.assign(Object.assign({}, this.shippingRateTransformer.transform(shippingMethod)), {
|
|
410
|
-
// TODO: implement
|
|
411
|
-
address_id: null }) : null;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
/** @nocollapse */ DaffMagentoCartShippingInformationTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingInformationTransformer, deps: [{ token: DaffMagentoCartShippingRateTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
415
|
-
/** @nocollapse */ DaffMagentoCartShippingInformationTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingInformationTransformer, providedIn: 'root' });
|
|
416
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingInformationTransformer, decorators: [{
|
|
417
|
-
type: Injectable,
|
|
418
|
-
args: [{
|
|
419
|
-
providedIn: 'root',
|
|
420
|
-
}]
|
|
421
|
-
}], ctorParameters: function () { return [{ type: DaffMagentoCartShippingRateTransformer }]; } });
|
|
422
|
-
|
|
423
|
-
/**
|
|
424
|
-
* Transforms magento carts into an object usable by daffodil.
|
|
425
|
-
*/
|
|
426
|
-
class DaffMagentoCartTransformer {
|
|
427
|
-
constructor(shippingAddressTransformer, billingAddressTransformer, paymentTransformer, shippingInformationTransformer, shippingRateTransformer, cartItemTransforms, cartTransforms) {
|
|
428
|
-
this.shippingAddressTransformer = shippingAddressTransformer;
|
|
429
|
-
this.billingAddressTransformer = billingAddressTransformer;
|
|
430
|
-
this.paymentTransformer = paymentTransformer;
|
|
431
|
-
this.shippingInformationTransformer = shippingInformationTransformer;
|
|
432
|
-
this.shippingRateTransformer = shippingRateTransformer;
|
|
433
|
-
this.cartItemTransforms = cartItemTransforms;
|
|
434
|
-
this.cartTransforms = cartTransforms;
|
|
435
|
-
}
|
|
436
|
-
transformShippingAddress(cart) {
|
|
437
|
-
return {
|
|
438
|
-
shipping_address: cart.shipping_addresses[0]
|
|
439
|
-
? this.shippingAddressTransformer.transform(Object.assign(Object.assign({}, cart.shipping_addresses[0]), { email: cart.email }))
|
|
440
|
-
: null,
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
transformBillingAddress(cart) {
|
|
444
|
-
return {
|
|
445
|
-
billing_address: cart.billing_address
|
|
446
|
-
? this.billingAddressTransformer.transform(Object.assign(Object.assign({}, cart.billing_address), { email: cart.email }))
|
|
447
|
-
: null,
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
transformCartItems(cart) {
|
|
451
|
-
return {
|
|
452
|
-
// TODO: extract into own transforms
|
|
453
|
-
items: cart.items.filter(item => !!item).map(item => transformMagentoCartItem(daffTransformMagentoCartItem(item), item, this.cartItemTransforms)),
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
transformTotals(cart) {
|
|
457
|
-
return {
|
|
458
|
-
grand_total: cart.prices.grand_total.value,
|
|
459
|
-
subtotal: cart.prices.subtotal_excluding_tax.value,
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
transformCoupons(cart) {
|
|
463
|
-
return {
|
|
464
|
-
coupons: cart.applied_coupons
|
|
465
|
-
? cart.applied_coupons.map(daffMagentoCouponTransform)
|
|
466
|
-
: [],
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
transformPayment(cart) {
|
|
470
|
-
return {
|
|
471
|
-
payment: this.paymentTransformer.transform(cart.selected_payment_method),
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
transformShippingInformation(cart) {
|
|
475
|
-
return {
|
|
476
|
-
shipping_information: cart.shipping_addresses[0]
|
|
477
|
-
? this.shippingInformationTransformer.transform(cart.shipping_addresses[0].selected_shipping_method)
|
|
478
|
-
: null,
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
transformShippingMethods(cart) {
|
|
482
|
-
return {
|
|
483
|
-
available_shipping_methods: cart.shipping_addresses[0] && cart.shipping_addresses[0].available_shipping_methods
|
|
484
|
-
? cart.shipping_addresses[0].available_shipping_methods.map(method => this.shippingRateTransformer.transform(method))
|
|
485
|
-
: [],
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
transformPaymentMethods(cart) {
|
|
489
|
-
return {
|
|
490
|
-
available_payment_methods: cart.available_payment_methods.map(method => this.paymentTransformer.transform(method)),
|
|
491
|
-
};
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Transforms the magento MagentoCart from the magento cart query into a DaffCart.
|
|
495
|
-
*
|
|
496
|
-
* @param cart the cart from a magento cart query.
|
|
497
|
-
*/
|
|
498
|
-
transform(cart) {
|
|
499
|
-
return cart ? this.cartTransforms.reduce((daffCart, transform) => transform(daffCart, cart), Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ extra_attributes: cart }, this.transformCartItems(cart)), this.transformBillingAddress(cart)), this.transformShippingAddress(cart)), this.transformCoupons(cart)), this.transformPayment(cart)), this.transformTotals(cart)), transformCartTotals(cart)), this.transformShippingInformation(cart)), this.transformShippingMethods(cart)), this.transformPaymentMethods(cart)), { id: cart.id })) : null;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
/** @nocollapse */ DaffMagentoCartTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartTransformer, deps: [{ token: DaffMagentoShippingAddressTransformer }, { token: DaffMagentoBillingAddressTransformer }, { token: DaffMagentoCartPaymentTransformer }, { token: DaffMagentoCartShippingInformationTransformer }, { token: DaffMagentoCartShippingRateTransformer }, { token: DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS }, { token: DAFF_CART_MAGENTO_CART_TRANSFORMS }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
503
|
-
/** @nocollapse */ DaffMagentoCartTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartTransformer, providedIn: 'root' });
|
|
504
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartTransformer, decorators: [{
|
|
505
|
-
type: Injectable,
|
|
506
|
-
args: [{
|
|
507
|
-
providedIn: 'root',
|
|
508
|
-
}]
|
|
509
|
-
}], ctorParameters: function () {
|
|
510
|
-
return [{ type: DaffMagentoShippingAddressTransformer }, { type: DaffMagentoBillingAddressTransformer }, { type: DaffMagentoCartPaymentTransformer }, { type: DaffMagentoCartShippingInformationTransformer }, { type: DaffMagentoCartShippingRateTransformer }, { type: undefined, decorators: [{
|
|
511
|
-
type: Inject,
|
|
512
|
-
args: [DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS]
|
|
513
|
-
}] }, { type: undefined, decorators: [{
|
|
514
|
-
type: Inject,
|
|
515
|
-
args: [DAFF_CART_MAGENTO_CART_TRANSFORMS]
|
|
516
|
-
}] }];
|
|
517
|
-
} });
|
|
518
|
-
|
|
519
|
-
class DaffMagentoCartAddressInputTransformer {
|
|
520
|
-
transform(cartAddress) {
|
|
521
|
-
const street = [cartAddress.street];
|
|
522
|
-
if (cartAddress.street2) {
|
|
523
|
-
street.push(cartAddress.street2);
|
|
524
|
-
}
|
|
525
|
-
return {
|
|
526
|
-
city: cartAddress.city,
|
|
527
|
-
country_code: cartAddress.country,
|
|
528
|
-
firstname: cartAddress.firstname,
|
|
529
|
-
lastname: cartAddress.lastname,
|
|
530
|
-
postcode: cartAddress.postcode,
|
|
531
|
-
region_id: Number(cartAddress.region),
|
|
532
|
-
save_in_address_book: false,
|
|
533
|
-
street,
|
|
534
|
-
telephone: cartAddress.telephone,
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
/** @nocollapse */ DaffMagentoCartAddressInputTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartAddressInputTransformer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
539
|
-
/** @nocollapse */ DaffMagentoCartAddressInputTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartAddressInputTransformer, providedIn: 'root' });
|
|
540
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartAddressInputTransformer, decorators: [{
|
|
541
|
-
type: Injectable,
|
|
542
|
-
args: [{
|
|
543
|
-
providedIn: 'root',
|
|
544
|
-
}]
|
|
545
|
-
}] });
|
|
546
|
-
|
|
547
|
-
class DaffMagentoShippingAddressInputTransformer {
|
|
548
|
-
constructor(cartAddressTransformer) {
|
|
549
|
-
this.cartAddressTransformer = cartAddressTransformer;
|
|
550
|
-
}
|
|
551
|
-
transform(cartAddress) {
|
|
552
|
-
return cartAddress.id
|
|
553
|
-
? {
|
|
554
|
-
address: null,
|
|
555
|
-
customer_address_id: Number(cartAddress.id),
|
|
556
|
-
}
|
|
557
|
-
: {
|
|
558
|
-
address: this.cartAddressTransformer.transform(cartAddress),
|
|
559
|
-
customer_address_id: null,
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
/** @nocollapse */ DaffMagentoShippingAddressInputTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoShippingAddressInputTransformer, deps: [{ token: DaffMagentoCartAddressInputTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
564
|
-
/** @nocollapse */ DaffMagentoShippingAddressInputTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoShippingAddressInputTransformer, providedIn: 'root' });
|
|
565
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoShippingAddressInputTransformer, decorators: [{
|
|
566
|
-
type: Injectable,
|
|
567
|
-
args: [{
|
|
568
|
-
providedIn: 'root',
|
|
569
|
-
}]
|
|
570
|
-
}], ctorParameters: function () { return [{ type: DaffMagentoCartAddressInputTransformer }]; } });
|
|
571
|
-
|
|
572
|
-
class DaffMagentoBillingAddressInputTransformer {
|
|
573
|
-
constructor(cartAddressTransformer) {
|
|
574
|
-
this.cartAddressTransformer = cartAddressTransformer;
|
|
575
|
-
}
|
|
576
|
-
transform(cartAddress) {
|
|
577
|
-
return cartAddress.id
|
|
578
|
-
? {
|
|
579
|
-
address: null,
|
|
580
|
-
customer_address_id: Number(cartAddress.id),
|
|
581
|
-
}
|
|
582
|
-
: {
|
|
583
|
-
address: this.cartAddressTransformer.transform(cartAddress),
|
|
584
|
-
customer_address_id: null,
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
/** @nocollapse */ DaffMagentoBillingAddressInputTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoBillingAddressInputTransformer, deps: [{ token: DaffMagentoCartAddressInputTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
589
|
-
/** @nocollapse */ DaffMagentoBillingAddressInputTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoBillingAddressInputTransformer, providedIn: 'root' });
|
|
590
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoBillingAddressInputTransformer, decorators: [{
|
|
591
|
-
type: Injectable,
|
|
592
|
-
args: [{
|
|
593
|
-
providedIn: 'root',
|
|
594
|
-
}]
|
|
595
|
-
}], ctorParameters: function () { return [{ type: DaffMagentoCartAddressInputTransformer }]; } });
|
|
596
|
-
|
|
597
|
-
class DaffMagentoCartItemUpdateInputTransformer {
|
|
598
|
-
transform(item) {
|
|
599
|
-
return {
|
|
600
|
-
quantity: item.qty,
|
|
601
|
-
cart_item_id: Number(item.id),
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
/** @nocollapse */ DaffMagentoCartItemUpdateInputTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartItemUpdateInputTransformer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
606
|
-
/** @nocollapse */ DaffMagentoCartItemUpdateInputTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartItemUpdateInputTransformer, providedIn: 'root' });
|
|
607
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartItemUpdateInputTransformer, decorators: [{
|
|
608
|
-
type: Injectable,
|
|
609
|
-
args: [{
|
|
610
|
-
providedIn: 'root',
|
|
611
|
-
}]
|
|
612
|
-
}] });
|
|
613
|
-
|
|
614
|
-
class DaffMagentoPaymentMethodInputTransformer {
|
|
615
|
-
transform(payment) {
|
|
616
|
-
return Object.assign({}, payment.payment_info);
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
/** @nocollapse */ DaffMagentoPaymentMethodInputTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoPaymentMethodInputTransformer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
620
|
-
/** @nocollapse */ DaffMagentoPaymentMethodInputTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoPaymentMethodInputTransformer, providedIn: 'root' });
|
|
621
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoPaymentMethodInputTransformer, decorators: [{
|
|
622
|
-
type: Injectable,
|
|
623
|
-
args: [{
|
|
624
|
-
providedIn: 'root',
|
|
625
|
-
}]
|
|
626
|
-
}] });
|
|
627
|
-
|
|
628
|
-
class DaffMagentoShippingMethodInputTransformer {
|
|
629
|
-
transform(method) {
|
|
630
|
-
return {
|
|
631
|
-
carrier_code: method.carrier,
|
|
632
|
-
method_code: method.method_code,
|
|
633
|
-
};
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
/** @nocollapse */ DaffMagentoShippingMethodInputTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoShippingMethodInputTransformer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
637
|
-
/** @nocollapse */ DaffMagentoShippingMethodInputTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoShippingMethodInputTransformer, providedIn: 'root' });
|
|
638
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoShippingMethodInputTransformer, decorators: [{
|
|
639
|
-
type: Injectable,
|
|
640
|
-
args: [{
|
|
641
|
-
providedIn: 'root',
|
|
642
|
-
}]
|
|
643
|
-
}] });
|
|
644
|
-
|
|
645
|
-
var MagentoCartUserInputErrorType;
|
|
646
|
-
(function (MagentoCartUserInputErrorType) {
|
|
647
|
-
MagentoCartUserInputErrorType["PRODUCT_NOT_FOUND"] = "PRODUCT_NOT_FOUND";
|
|
648
|
-
MagentoCartUserInputErrorType["NOT_SALABLE"] = "NOT_SALABLE";
|
|
649
|
-
MagentoCartUserInputErrorType["INSUFFICIENT_STOCK"] = "INSUFFICIENT_STOCK";
|
|
650
|
-
MagentoCartUserInputErrorType["UNDEFINED"] = "UNDEFINED";
|
|
651
|
-
})(MagentoCartUserInputErrorType || (MagentoCartUserInputErrorType = {}));
|
|
652
|
-
|
|
653
|
-
const cartCouponFragment = gql `
|
|
654
|
-
fragment cartCoupon on AppliedCoupon {
|
|
655
|
-
code
|
|
656
|
-
}
|
|
657
|
-
`;
|
|
658
|
-
|
|
659
|
-
const cartAddressFragment = gql `
|
|
660
|
-
fragment cartAddress on CartAddressInterface {
|
|
661
|
-
customer_address_id
|
|
662
|
-
city
|
|
663
|
-
country {
|
|
664
|
-
code
|
|
665
|
-
label
|
|
666
|
-
}
|
|
667
|
-
firstname
|
|
668
|
-
lastname
|
|
669
|
-
postcode
|
|
670
|
-
region {
|
|
671
|
-
code
|
|
672
|
-
region_id
|
|
673
|
-
}
|
|
674
|
-
street
|
|
675
|
-
telephone
|
|
676
|
-
company
|
|
677
|
-
}
|
|
678
|
-
`;
|
|
679
|
-
|
|
680
|
-
const cartItemProductFragment = gql `
|
|
681
|
-
fragment cartItemProduct on ProductInterface {
|
|
682
|
-
id
|
|
683
|
-
name
|
|
684
|
-
sku
|
|
685
|
-
url_key
|
|
686
|
-
url_suffix
|
|
687
|
-
thumbnail {
|
|
688
|
-
label
|
|
689
|
-
url
|
|
690
|
-
}
|
|
691
|
-
stock_status
|
|
692
|
-
}
|
|
693
|
-
`;
|
|
694
|
-
const cartItemFragment = gql `
|
|
695
|
-
fragment cartItem on CartItemInterface {
|
|
696
|
-
__typename
|
|
697
|
-
id
|
|
698
|
-
product {
|
|
699
|
-
...cartItemProduct
|
|
700
|
-
}
|
|
701
|
-
quantity
|
|
702
|
-
prices {
|
|
703
|
-
price {
|
|
704
|
-
...moneyFragment
|
|
705
|
-
}
|
|
706
|
-
row_total {
|
|
707
|
-
...moneyFragment
|
|
708
|
-
}
|
|
709
|
-
discounts {
|
|
710
|
-
amount {
|
|
711
|
-
...moneyFragment
|
|
712
|
-
}
|
|
713
|
-
label
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
...on ConfigurableCartItem {
|
|
717
|
-
configurable_options {
|
|
718
|
-
option_label
|
|
719
|
-
value_label
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
...on BundleCartItem {
|
|
723
|
-
bundle_options {
|
|
724
|
-
id
|
|
725
|
-
label
|
|
726
|
-
type
|
|
727
|
-
values {
|
|
728
|
-
id
|
|
729
|
-
label
|
|
730
|
-
price
|
|
731
|
-
quantity
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
${cartItemProductFragment}
|
|
737
|
-
${magentoMoneyFragment}
|
|
738
|
-
`;
|
|
739
|
-
|
|
740
|
-
const availablePaymentMethodFragment = gql `
|
|
741
|
-
fragment availablePaymentMethod on AvailablePaymentMethod {
|
|
742
|
-
code
|
|
743
|
-
title
|
|
744
|
-
}
|
|
745
|
-
`;
|
|
746
|
-
|
|
747
|
-
const selectedPaymentMethodFragment = gql `
|
|
748
|
-
fragment selectedPaymentMethod on SelectedPaymentMethod {
|
|
749
|
-
code
|
|
750
|
-
title
|
|
751
|
-
purchase_order_number
|
|
752
|
-
}
|
|
753
|
-
`;
|
|
754
|
-
|
|
755
|
-
const availableShippingMethodFragment = gql `
|
|
756
|
-
fragment availableShippingMethod on AvailableShippingMethod {
|
|
757
|
-
carrier_code
|
|
758
|
-
method_code
|
|
759
|
-
carrier_title
|
|
760
|
-
method_title
|
|
761
|
-
amount {
|
|
762
|
-
...moneyFragment
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
${magentoMoneyFragment}
|
|
766
|
-
`;
|
|
767
|
-
|
|
768
|
-
const selectedShippingMethodFragment = gql `
|
|
769
|
-
fragment selectedShippingMethod on SelectedShippingMethod {
|
|
770
|
-
carrier_code
|
|
771
|
-
method_code
|
|
772
|
-
carrier_title
|
|
773
|
-
method_title
|
|
774
|
-
amount {
|
|
775
|
-
...moneyFragment
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
${magentoMoneyFragment}
|
|
779
|
-
`;
|
|
780
|
-
|
|
781
|
-
const pricesFragment = gql `
|
|
782
|
-
fragment prices on CartPrices {
|
|
783
|
-
grand_total {
|
|
784
|
-
...moneyFragment
|
|
785
|
-
}
|
|
786
|
-
subtotal_excluding_tax {
|
|
787
|
-
...moneyFragment
|
|
788
|
-
}
|
|
789
|
-
subtotal_including_tax {
|
|
790
|
-
...moneyFragment
|
|
791
|
-
}
|
|
792
|
-
subtotal_with_discount_excluding_tax {
|
|
793
|
-
...moneyFragment
|
|
794
|
-
}
|
|
795
|
-
applied_taxes {
|
|
796
|
-
amount {
|
|
797
|
-
...moneyFragment
|
|
798
|
-
}
|
|
799
|
-
label
|
|
800
|
-
}
|
|
801
|
-
discounts {
|
|
802
|
-
amount {
|
|
803
|
-
...moneyFragment
|
|
804
|
-
}
|
|
805
|
-
label
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
${magentoMoneyFragment}
|
|
809
|
-
`;
|
|
810
|
-
|
|
811
|
-
const cartFragment = gql `
|
|
812
|
-
fragment cart on Cart {
|
|
813
|
-
id
|
|
814
|
-
email
|
|
815
|
-
billing_address {
|
|
816
|
-
...cartAddress
|
|
817
|
-
}
|
|
818
|
-
shipping_addresses {
|
|
819
|
-
...cartAddress
|
|
820
|
-
... on ShippingCartAddress {
|
|
821
|
-
selected_shipping_method {
|
|
822
|
-
...selectedShippingMethod
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
available_shipping_methods {
|
|
826
|
-
amount {
|
|
827
|
-
currency
|
|
828
|
-
value
|
|
829
|
-
}
|
|
830
|
-
carrier_code
|
|
831
|
-
method_code
|
|
832
|
-
carrier_title
|
|
833
|
-
method_title
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
items {
|
|
837
|
-
...cartItem
|
|
838
|
-
}
|
|
839
|
-
available_payment_methods {
|
|
840
|
-
...availablePaymentMethod
|
|
841
|
-
}
|
|
842
|
-
selected_payment_method {
|
|
843
|
-
...selectedPaymentMethod
|
|
844
|
-
}
|
|
845
|
-
applied_coupons {
|
|
846
|
-
...cartCoupon
|
|
847
|
-
}
|
|
848
|
-
prices {
|
|
849
|
-
...prices
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
${cartAddressFragment}
|
|
853
|
-
${availablePaymentMethodFragment}
|
|
854
|
-
${selectedPaymentMethodFragment}
|
|
855
|
-
${selectedShippingMethodFragment}
|
|
856
|
-
${cartItemFragment}
|
|
857
|
-
${pricesFragment}
|
|
858
|
-
${cartCouponFragment}
|
|
859
|
-
`;
|
|
860
|
-
|
|
861
|
-
const magentoCartUserError = gql `
|
|
862
|
-
fragment cartUserError on CartUserInputError {
|
|
863
|
-
code
|
|
864
|
-
message
|
|
865
|
-
}
|
|
866
|
-
`;
|
|
867
|
-
|
|
868
|
-
const addCartItem = (extraCartFragments = []) => gql `
|
|
869
|
-
mutation MagentoAddCartItem($cartId: String!, $input: CartItemInput!) {
|
|
870
|
-
addProductsToCart(
|
|
871
|
-
cartId: $cartId,
|
|
872
|
-
cartItems: [$input]
|
|
873
|
-
) {
|
|
874
|
-
cart {
|
|
875
|
-
...cart
|
|
876
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
877
|
-
}
|
|
878
|
-
user_errors {
|
|
879
|
-
...cartUserError
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
${cartFragment}
|
|
884
|
-
${magentoCartUserError}
|
|
885
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
886
|
-
`;
|
|
887
|
-
|
|
888
|
-
const applyCoupon = (extraCartFragments = []) => gql `
|
|
889
|
-
mutation MagentoApplyCoupon($cartId: String!, $couponCode: String!) {
|
|
890
|
-
applyCouponToCart(
|
|
891
|
-
input: {
|
|
892
|
-
cart_id: $cartId,
|
|
893
|
-
coupon_code: $couponCode
|
|
894
|
-
}
|
|
895
|
-
) {
|
|
896
|
-
cart {
|
|
897
|
-
...cart
|
|
898
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
${cartFragment}
|
|
903
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
904
|
-
`;
|
|
905
|
-
|
|
906
|
-
const createCart = gql `
|
|
907
|
-
mutation MagentoCreateCart {
|
|
908
|
-
createEmptyCart
|
|
909
|
-
}
|
|
910
|
-
`;
|
|
911
|
-
|
|
912
|
-
const getBillingAddress = (extraCartFragments = []) => gql `
|
|
913
|
-
query MagentoGetBillingAddress($cartId: String!) {
|
|
914
|
-
cart(cart_id: $cartId) {
|
|
915
|
-
billing_address {
|
|
916
|
-
...cartAddress
|
|
917
|
-
}
|
|
918
|
-
email
|
|
919
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
${cartAddressFragment}
|
|
923
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
924
|
-
`;
|
|
925
|
-
|
|
926
|
-
const getCart = (extraCartFragments = []) => gql `
|
|
927
|
-
query MagentoGetCart($cartId: String!) {
|
|
928
|
-
cart(cart_id: $cartId) {
|
|
929
|
-
...cart
|
|
930
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
${cartFragment}
|
|
934
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
935
|
-
`;
|
|
936
|
-
|
|
937
|
-
const getSelectedPaymentMethod = (extraCartFragments = []) => gql `
|
|
938
|
-
query MagentoGetSelectedPaymentMethod($cartId: String!) {
|
|
939
|
-
cart(cart_id: $cartId) {
|
|
940
|
-
selected_payment_method {
|
|
941
|
-
...selectedPaymentMethod
|
|
942
|
-
}
|
|
943
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
${selectedPaymentMethodFragment}
|
|
947
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
948
|
-
`;
|
|
949
|
-
|
|
950
|
-
const getSelectedShippingMethod = (extraCartFragments = []) => gql `
|
|
951
|
-
query MagentoGetSelectedShippingMethod($cartId: String!) {
|
|
952
|
-
cart(cart_id: $cartId) {
|
|
953
|
-
shipping_addresses {
|
|
954
|
-
selected_shipping_method {
|
|
955
|
-
...selectedShippingMethod
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
${selectedShippingMethodFragment}
|
|
962
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
963
|
-
`;
|
|
964
|
-
|
|
965
|
-
const getShippingAddress = (extraCartFragments = []) => gql `
|
|
966
|
-
query MagentoGetShippingAddress($cartId: String!) {
|
|
967
|
-
cart(cart_id: $cartId) {
|
|
968
|
-
shipping_addresses {
|
|
969
|
-
...cartAddress
|
|
970
|
-
}
|
|
971
|
-
email
|
|
972
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
${cartAddressFragment}
|
|
976
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
977
|
-
`;
|
|
978
|
-
|
|
979
|
-
const listCartCoupons = (extraCartFragments = []) => gql `
|
|
980
|
-
query MagentoListCartCoupons($cartId: String!) {
|
|
981
|
-
cart(cart_id: $cartId) {
|
|
982
|
-
applied_coupons {
|
|
983
|
-
...cartCoupon
|
|
984
|
-
}
|
|
985
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
${cartCouponFragment}
|
|
989
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
990
|
-
`;
|
|
991
|
-
|
|
992
|
-
const listCartItems = (extraCartFragments = []) => gql `
|
|
993
|
-
query MagentoListCartItems($cartId: String!) {
|
|
994
|
-
cart(cart_id: $cartId) {
|
|
995
|
-
items {
|
|
996
|
-
...cartItem
|
|
997
|
-
}
|
|
998
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
${cartItemFragment}
|
|
1002
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1003
|
-
`;
|
|
1004
|
-
|
|
1005
|
-
const listPaymentMethods = (extraCartFragments = []) => gql `
|
|
1006
|
-
query MagentoListPaymentMethods($cartId: String!) {
|
|
1007
|
-
cart(cart_id: $cartId) {
|
|
1008
|
-
available_payment_methods {
|
|
1009
|
-
...availablePaymentMethod
|
|
1010
|
-
}
|
|
1011
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
${availablePaymentMethodFragment}
|
|
1015
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1016
|
-
`;
|
|
1017
|
-
|
|
1018
|
-
const listShippingMethods = (extraCartFragments = []) => gql `
|
|
1019
|
-
query MagentoListShippingMethods($cartId: String!) {
|
|
1020
|
-
cart(cart_id: $cartId) {
|
|
1021
|
-
id
|
|
1022
|
-
shipping_addresses {
|
|
1023
|
-
available_shipping_methods {
|
|
1024
|
-
...availableShippingMethod
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
${availableShippingMethodFragment}
|
|
1031
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1032
|
-
`;
|
|
1033
|
-
|
|
1034
|
-
const magentoMergeCartsMutation = (extraCartFragments = []) => gql `
|
|
1035
|
-
mutation MagentoMergeCarts($source: String!, $destination: String) {
|
|
1036
|
-
mergeCarts(
|
|
1037
|
-
source_cart_id: $source,
|
|
1038
|
-
destination_cart_id: $destination
|
|
1039
|
-
) {
|
|
1040
|
-
...cart
|
|
1041
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
${cartFragment}
|
|
1045
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1046
|
-
`;
|
|
1047
|
-
|
|
1048
|
-
const placeOrder = gql `
|
|
1049
|
-
mutation MagentoPlaceOrder($cartId: String!) {
|
|
1050
|
-
placeOrder(
|
|
1051
|
-
input: {
|
|
1052
|
-
cart_id: $cartId
|
|
1053
|
-
}
|
|
1054
|
-
) {
|
|
1055
|
-
order {
|
|
1056
|
-
order_number
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
`;
|
|
1061
|
-
|
|
1062
|
-
const removeAllCoupons = (extraCartFragments = []) => gql `
|
|
1063
|
-
mutation MagentoRemoveAllCoupons($cartId: String!) {
|
|
1064
|
-
removeCouponFromCart(
|
|
1065
|
-
input: {
|
|
1066
|
-
cart_id: $cartId
|
|
1067
|
-
}
|
|
1068
|
-
) {
|
|
1069
|
-
cart {
|
|
1070
|
-
...cart
|
|
1071
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
${cartFragment}
|
|
1076
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1077
|
-
`;
|
|
1078
|
-
|
|
1079
|
-
const removeCartItem = (extraCartFragments = []) => gql `
|
|
1080
|
-
mutation MagentoRemoveCartItem($cartId: String!, $itemId: Int!) {
|
|
1081
|
-
removeItemFromCart(input: {
|
|
1082
|
-
cart_id: $cartId,
|
|
1083
|
-
cart_item_id: $itemId
|
|
1084
|
-
}) {
|
|
1085
|
-
cart {
|
|
1086
|
-
...cart
|
|
1087
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
${cartFragment}
|
|
1092
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1093
|
-
`;
|
|
1094
|
-
|
|
1095
|
-
const setSelectedPaymentMethodWithBillingAndEmail = (extraCartFragments = []) => gql `
|
|
1096
|
-
mutation MagentoSetSelectedPaymentMethodWithBillingAndEmail(
|
|
1097
|
-
$cartId: String!,
|
|
1098
|
-
$payment: PaymentMethodInput!,
|
|
1099
|
-
$address: BillingAddressInput!,
|
|
1100
|
-
$email: String!
|
|
1101
|
-
) {
|
|
1102
|
-
setBillingAddressOnCart(input: {
|
|
1103
|
-
cart_id: $cartId
|
|
1104
|
-
billing_address: $address
|
|
1105
|
-
}) {
|
|
1106
|
-
cart {
|
|
1107
|
-
id
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
setPaymentMethodOnCart(input: {
|
|
1111
|
-
cart_id: $cartId
|
|
1112
|
-
payment_method: $payment
|
|
1113
|
-
}) {
|
|
1114
|
-
cart {
|
|
1115
|
-
id
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
setGuestEmailOnCart(input: {
|
|
1119
|
-
cart_id: $cartId,
|
|
1120
|
-
email: $email
|
|
1121
|
-
}) {
|
|
1122
|
-
cart {
|
|
1123
|
-
...cart
|
|
1124
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
${cartFragment}
|
|
1129
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1130
|
-
`;
|
|
1131
|
-
|
|
1132
|
-
const setSelectedPaymentMethodWithBilling = (extraCartFragments = []) => gql `
|
|
1133
|
-
mutation MagentoSetSelectedPaymentMethodWithBilling(
|
|
1134
|
-
$cartId: String!,
|
|
1135
|
-
$payment: PaymentMethodInput!,
|
|
1136
|
-
$address: BillingAddressInput!
|
|
1137
|
-
) {
|
|
1138
|
-
setBillingAddressOnCart(input: {
|
|
1139
|
-
cart_id: $cartId
|
|
1140
|
-
billing_address: $address
|
|
1141
|
-
}) {
|
|
1142
|
-
cart {
|
|
1143
|
-
id
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
setPaymentMethodOnCart(input: {
|
|
1147
|
-
cart_id: $cartId
|
|
1148
|
-
payment_method: $payment
|
|
1149
|
-
}) {
|
|
1150
|
-
cart {
|
|
1151
|
-
...cart
|
|
1152
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
${cartFragment}
|
|
1157
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1158
|
-
`;
|
|
1159
|
-
|
|
1160
|
-
const setSelectedPaymentMethod = (extraCartFragments = []) => gql `
|
|
1161
|
-
mutation MagentoSetSelectedPaymentMethod($cartId: String!, $payment: PaymentMethodInput!) {
|
|
1162
|
-
setPaymentMethodOnCart(input: {
|
|
1163
|
-
cart_id: $cartId
|
|
1164
|
-
payment_method: $payment
|
|
1165
|
-
}) {
|
|
1166
|
-
cart {
|
|
1167
|
-
...cart
|
|
1168
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1169
|
-
}
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
${cartFragment}
|
|
1173
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1174
|
-
`;
|
|
1175
|
-
|
|
1176
|
-
const setSelectedShippingMethod = (extraCartFragments = []) => gql `
|
|
1177
|
-
mutation MagentoSetSelectedShippingMethod($cartId: String!, $method: ShippingMethodInput!) {
|
|
1178
|
-
setShippingMethodsOnCart(input: {
|
|
1179
|
-
cart_id: $cartId
|
|
1180
|
-
shipping_methods: [$method]
|
|
1181
|
-
}) {
|
|
1182
|
-
cart {
|
|
1183
|
-
...cart
|
|
1184
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
${cartFragment}
|
|
1189
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1190
|
-
`;
|
|
1191
|
-
|
|
1192
|
-
/**
|
|
1193
|
-
* Update the shipping and billing address of the cart.
|
|
1194
|
-
* At the time of writing, Magento 2 processes compound queries in the order they are defined.
|
|
1195
|
-
* We rely on this fact and only use the return of the last query.
|
|
1196
|
-
* This helps us keep query complexity down and save some server CPU cycles.
|
|
1197
|
-
* Driver behavior is not guaranteed if Magento no longer processes compound queries in the order they are defined.
|
|
1198
|
-
*/
|
|
1199
|
-
const updateAddressWithEmail = (extraCartFragments = []) => gql `
|
|
1200
|
-
mutation MagentoUpdateAddressWithEmail($cartId: String!, $email: String!, $address: CartAddressInput, $addressId: Int) {
|
|
1201
|
-
setBillingAddressOnCart(input: {
|
|
1202
|
-
cart_id: $cartId
|
|
1203
|
-
billing_address: {
|
|
1204
|
-
address: $address,
|
|
1205
|
-
customer_address_id: $addressId
|
|
1206
|
-
}
|
|
1207
|
-
}) {
|
|
1208
|
-
cart {
|
|
1209
|
-
id
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
setShippingAddressesOnCart(input: {
|
|
1213
|
-
cart_id: $cartId
|
|
1214
|
-
shipping_addresses: [{
|
|
1215
|
-
address: $address,
|
|
1216
|
-
customer_address_id: $addressId
|
|
1217
|
-
}]
|
|
1218
|
-
}) {
|
|
1219
|
-
cart {
|
|
1220
|
-
id
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
setGuestEmailOnCart(input: {
|
|
1224
|
-
cart_id: $cartId,
|
|
1225
|
-
email: $email
|
|
1226
|
-
}) {
|
|
1227
|
-
cart {
|
|
1228
|
-
...cart
|
|
1229
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
}
|
|
1233
|
-
${cartFragment}
|
|
1234
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1235
|
-
`;
|
|
1236
|
-
|
|
1237
|
-
/**
|
|
1238
|
-
* Update the shipping and billing address of the cart.
|
|
1239
|
-
* At the time of writing, Magento 2 processes compound queries in the order they are defined.
|
|
1240
|
-
* We rely on this fact and only use the return of the last query.
|
|
1241
|
-
* This helps us keep query complexity down and save some server CPU cycles.
|
|
1242
|
-
* Driver behavior is not guaranteed if Magento no longer processes compound queries in the order they are defined.
|
|
1243
|
-
*/
|
|
1244
|
-
const updateAddress = (extraCartFragments = []) => gql `
|
|
1245
|
-
mutation MagentoUpdateAddress($cartId: String!, $address: CartAddressInput, $addressId: Int) {
|
|
1246
|
-
setBillingAddressOnCart(input: {
|
|
1247
|
-
cart_id: $cartId
|
|
1248
|
-
billing_address: {
|
|
1249
|
-
address: $address,
|
|
1250
|
-
customer_address_id: $addressId
|
|
1251
|
-
}
|
|
1252
|
-
}) {
|
|
1253
|
-
cart {
|
|
1254
|
-
id
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
setShippingAddressesOnCart(input: {
|
|
1258
|
-
cart_id: $cartId
|
|
1259
|
-
shipping_addresses: [{
|
|
1260
|
-
address: $address,
|
|
1261
|
-
customer_address_id: $addressId
|
|
1262
|
-
}]
|
|
1263
|
-
}) {
|
|
1264
|
-
cart {
|
|
1265
|
-
...cart
|
|
1266
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
${cartFragment}
|
|
1271
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1272
|
-
`;
|
|
1273
|
-
|
|
1274
|
-
const updateBillingAddressWithEmail = (extraCartFragments = []) => gql `
|
|
1275
|
-
mutation MagentoUpdateBillingAddressWithEmail(
|
|
1276
|
-
$cartId: String!,
|
|
1277
|
-
$address: BillingAddressInput!,
|
|
1278
|
-
$email: String!
|
|
1279
|
-
) {
|
|
1280
|
-
setBillingAddressOnCart(input: {
|
|
1281
|
-
cart_id: $cartId
|
|
1282
|
-
billing_address: $address
|
|
1283
|
-
}) {
|
|
1284
|
-
cart {
|
|
1285
|
-
...cart
|
|
1286
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
setGuestEmailOnCart(input: {
|
|
1290
|
-
cart_id: $cartId,
|
|
1291
|
-
email: $email
|
|
1292
|
-
}) {
|
|
1293
|
-
cart {
|
|
1294
|
-
email
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
${cartFragment}
|
|
1299
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1300
|
-
`;
|
|
1301
|
-
|
|
1302
|
-
const updateBillingAddress = (extraCartFragments = []) => gql `
|
|
1303
|
-
mutation MagentoUpdateBillingAddress(
|
|
1304
|
-
$cartId: String!,
|
|
1305
|
-
$address: BillingAddressInput!
|
|
1306
|
-
) {
|
|
1307
|
-
setBillingAddressOnCart(input: {
|
|
1308
|
-
cart_id: $cartId
|
|
1309
|
-
billing_address: $address
|
|
1310
|
-
}) {
|
|
1311
|
-
cart {
|
|
1312
|
-
...cart
|
|
1313
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
${cartFragment}
|
|
1318
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1319
|
-
`;
|
|
1320
|
-
|
|
1321
|
-
const updateCartItem = (extraCartFragments = []) => gql `
|
|
1322
|
-
mutation MagentoUpdateCartItem($cartId: String!, $input: CartItemUpdateInput!) {
|
|
1323
|
-
updateCartItems(input: {
|
|
1324
|
-
cart_id: $cartId
|
|
1325
|
-
cart_items: [$input]
|
|
1326
|
-
}) {
|
|
1327
|
-
cart {
|
|
1328
|
-
...cart
|
|
1329
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
${cartFragment}
|
|
1334
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1335
|
-
`;
|
|
1336
|
-
|
|
1337
|
-
const updateShippingAddressWithEmail = (extraCartFragments = []) => gql `
|
|
1338
|
-
mutation MagentoUpdateShippingAddressWithEmail(
|
|
1339
|
-
$cartId: String!,
|
|
1340
|
-
$address: ShippingAddressInput!,
|
|
1341
|
-
$email: String!
|
|
1342
|
-
) {
|
|
1343
|
-
setShippingAddressesOnCart(input: {
|
|
1344
|
-
cart_id: $cartId
|
|
1345
|
-
shipping_addresses: [$address]
|
|
1346
|
-
}) {
|
|
1347
|
-
cart {
|
|
1348
|
-
...cart
|
|
1349
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
setGuestEmailOnCart(input: {
|
|
1353
|
-
cart_id: $cartId,
|
|
1354
|
-
email: $email
|
|
1355
|
-
}) {
|
|
1356
|
-
cart {
|
|
1357
|
-
email
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
}
|
|
1361
|
-
${cartFragment}
|
|
1362
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1363
|
-
`;
|
|
1364
|
-
|
|
1365
|
-
const updateShippingAddress = (extraCartFragments = []) => gql `
|
|
1366
|
-
mutation MagentoUpdateShippingAddress(
|
|
1367
|
-
$cartId: String!,
|
|
1368
|
-
$address: ShippingAddressInput!
|
|
1369
|
-
) {
|
|
1370
|
-
setShippingAddressesOnCart(input: {
|
|
1371
|
-
cart_id: $cartId
|
|
1372
|
-
shipping_addresses: [$address]
|
|
1373
|
-
}) {
|
|
1374
|
-
cart {
|
|
1375
|
-
...cart
|
|
1376
|
-
${daffBuildFragmentNameSpread(...extraCartFragments)}
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
${cartFragment}
|
|
1381
|
-
${daffBuildFragmentDefinition(...extraCartFragments)}
|
|
1382
|
-
`;
|
|
1383
|
-
|
|
1384
|
-
// TODO: move to @daffodil/driver/magento
|
|
1385
|
-
var MagentoCartGraphQlErrorCode;
|
|
1386
|
-
(function (MagentoCartGraphQlErrorCode) {
|
|
1387
|
-
MagentoCartGraphQlErrorCode["CART_NOT_FOUND"] = "graphql-no-such-entity";
|
|
1388
|
-
MagentoCartGraphQlErrorCode["BAD_INPUT"] = "graphql-input";
|
|
1389
|
-
MagentoCartGraphQlErrorCode["AUTHORIZATION"] = "graphql-authorization";
|
|
1390
|
-
})(MagentoCartGraphQlErrorCode || (MagentoCartGraphQlErrorCode = {}));
|
|
1391
|
-
|
|
1392
|
-
const DaffCartMagentoErrorMap = {
|
|
1393
|
-
[MagentoCartGraphQlErrorCode.CART_NOT_FOUND]: DaffCartNotFoundError,
|
|
1394
|
-
[MagentoCartGraphQlErrorCode.BAD_INPUT]: DaffBadInputError,
|
|
1395
|
-
[MagentoCartGraphQlErrorCode.AUTHORIZATION]: DaffUnauthorizedForCartError,
|
|
1396
|
-
};
|
|
1397
|
-
const DaffCartMagentoErrorMessageRegexMap = {
|
|
1398
|
-
[DaffCartDriverErrorCodes.INVALID_COUPON_CODE]: /The coupon code isn\'t valid/,
|
|
1399
|
-
[DaffCartDriverErrorCodes.PRODUCT_OUT_OF_STOCK]: /(The requested qty is not available)|(This product is out of stock)|(Some of the products are out of stock)|(There are no source items with the in stock status)/,
|
|
1400
|
-
[DaffCartDriverErrorCodes.ITEM_EXCEEDS_MAX_QTY]: /The requested qty exceeds the maximum qty allowed in shopping cart/,
|
|
1401
|
-
[DaffCartDriverErrorCodes.INVALID_EMAIL]: /Invalid email format/,
|
|
1402
|
-
};
|
|
1403
|
-
const DaffCartMagentoUserErrorMap = {
|
|
1404
|
-
[MagentoCartUserInputErrorType.PRODUCT_NOT_FOUND]: DaffProductNotFoundError,
|
|
1405
|
-
[MagentoCartUserInputErrorType.INSUFFICIENT_STOCK]: DaffProductOutOfStockError,
|
|
1406
|
-
[MagentoCartUserInputErrorType.NOT_SALABLE]: DaffProductOutOfStockError,
|
|
1407
|
-
[MagentoCartUserInputErrorType.UNDEFINED]: DaffCartInvalidAPIResponseError,
|
|
1408
|
-
};
|
|
1409
|
-
|
|
1410
|
-
/**
|
|
1411
|
-
* Transforms a single GraphQL error.
|
|
1412
|
-
* Optionally accepts a request payload which can be used in certain cases
|
|
1413
|
-
* to add supplemental info to the error.
|
|
1414
|
-
*/
|
|
1415
|
-
function transformMagentoCartGraphQlError(error, requestPayload) {
|
|
1416
|
-
// TODO: readdress this when we move to eslint
|
|
1417
|
-
// eslint-disable-next-line
|
|
1418
|
-
for (const code in DaffCartMagentoErrorMessageRegexMap) {
|
|
1419
|
-
const matchIndex = error.message.search(DaffCartMagentoErrorMessageRegexMap[code]);
|
|
1420
|
-
if (matchIndex > -1 && DaffCartDriverErrorMap[code]) {
|
|
1421
|
-
const errObj = new DaffCartDriverErrorMap[code](error.message);
|
|
1422
|
-
if (errObj instanceof DaffInvalidCouponCodeError) {
|
|
1423
|
-
errObj.coupon = requestPayload === null || requestPayload === void 0 ? void 0 : requestPayload.code;
|
|
1424
|
-
}
|
|
1425
|
-
return errObj;
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
return daffMagentoTransformGraphQlError(error, DaffCartMagentoErrorMap);
|
|
1429
|
-
}
|
|
1430
|
-
;
|
|
1431
|
-
/**
|
|
1432
|
-
* Transforms only the first GraphQL error with the cart magento error transformer,
|
|
1433
|
-
* otherwise falls back to a standard Magento error transform.
|
|
1434
|
-
*/
|
|
1435
|
-
function transformCartMagentoError(error, requestPayload) {
|
|
1436
|
-
var _a;
|
|
1437
|
-
if ((_a = error.graphQLErrors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1438
|
-
return transformMagentoCartGraphQlError(error.graphQLErrors[0], requestPayload);
|
|
1439
|
-
}
|
|
1440
|
-
else {
|
|
1441
|
-
return daffTransformMagentoError(error, DaffCartMagentoErrorMap);
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
function magentoCartTransformUserError(error) {
|
|
1445
|
-
return new (DaffCartMagentoUserErrorMap[error.code] || DaffCartInvalidAPIResponseError)(error.message);
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
const DAFF_MAGENTO_CART_MUTATION_QUEUE = new InjectionToken('DAFF_MAGENTO_CART_MUTATION_QUEUE', {
|
|
1449
|
-
providedIn: 'root',
|
|
1450
|
-
factory: () => new DaffQueuedApollo(inject(Apollo)),
|
|
1451
|
-
});
|
|
1452
|
-
|
|
1453
|
-
const DAFF_MAGENTO_GET_RECOVERABLE_ERRORS = [
|
|
1454
|
-
DaffProductOutOfStockError,
|
|
1455
|
-
];
|
|
1456
|
-
/**
|
|
1457
|
-
* A service for making Magento GraphQL queries for carts.
|
|
1458
|
-
*
|
|
1459
|
-
* @inheritdoc
|
|
1460
|
-
*/
|
|
1461
|
-
class DaffMagentoCartService {
|
|
1462
|
-
constructor(apollo, mutationQueue, cartTransformer, cartItemDriver, extraCartFragments) {
|
|
1463
|
-
this.apollo = apollo;
|
|
1464
|
-
this.mutationQueue = mutationQueue;
|
|
1465
|
-
this.cartTransformer = cartTransformer;
|
|
1466
|
-
this.cartItemDriver = cartItemDriver;
|
|
1467
|
-
this.extraCartFragments = extraCartFragments;
|
|
1468
|
-
}
|
|
1469
|
-
get(cartId) {
|
|
1470
|
-
return this.apollo.query({
|
|
1471
|
-
fetchPolicy: 'network-only',
|
|
1472
|
-
query: getCart(this.extraCartFragments),
|
|
1473
|
-
variables: { cartId },
|
|
1474
|
-
errorPolicy: 'all',
|
|
1475
|
-
}).pipe(map(({ data, errors }) => ({
|
|
1476
|
-
response: data ? this.cartTransformer.transform(data.cart) : undefined,
|
|
1477
|
-
errors: (errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
1478
|
-
const error = transformMagentoCartGraphQlError(e);
|
|
1479
|
-
if (DAFF_MAGENTO_GET_RECOVERABLE_ERRORS.find(klass => error instanceof klass)) {
|
|
1480
|
-
error.recoverable = true;
|
|
1481
|
-
}
|
|
1482
|
-
return error;
|
|
1483
|
-
})) || [],
|
|
1484
|
-
})), switchMap((resp) => resp.errors.reduce((acc, err) => acc && err.recoverable, true)
|
|
1485
|
-
? of(resp)
|
|
1486
|
-
: throwError(() => resp.errors.filter((err) => !err.recoverable)[0])));
|
|
1487
|
-
}
|
|
1488
|
-
create() {
|
|
1489
|
-
return this.mutationQueue.mutate({ mutation: createCart }).pipe(map(result => ({ id: result.data.createEmptyCart })), catchError(err => throwError(() => transformCartMagentoError(err))));
|
|
1490
|
-
}
|
|
1491
|
-
addToCart(productId, qty) {
|
|
1492
|
-
throw new Error('Method is deprecated. Use DaffCartItemServiceInterface#add instead.');
|
|
1493
|
-
}
|
|
1494
|
-
clear(cartId) {
|
|
1495
|
-
return this.cartItemDriver.list(cartId).pipe(switchMap(items => forkJoin(...items.map(item => this.cartItemDriver.delete(cartId, item.id)))), switchMap(() => this.get(cartId)), map(({ response }) => response));
|
|
1496
|
-
}
|
|
1497
|
-
merge(guestCart, customerCart) {
|
|
1498
|
-
return this.mutationQueue.mutate({
|
|
1499
|
-
mutation: magentoMergeCartsMutation(this.extraCartFragments),
|
|
1500
|
-
variables: {
|
|
1501
|
-
source: guestCart,
|
|
1502
|
-
destination: customerCart,
|
|
1503
|
-
},
|
|
1504
|
-
errorPolicy: 'all',
|
|
1505
|
-
fetchPolicy: 'network-only',
|
|
1506
|
-
}).pipe(map(({ data, errors }) => ({
|
|
1507
|
-
response: data ? this.cartTransformer.transform(data.mergeCarts) : undefined,
|
|
1508
|
-
errors: (errors === null || errors === void 0 ? void 0 : errors.map(e => {
|
|
1509
|
-
const error = transformMagentoCartGraphQlError(e);
|
|
1510
|
-
if (DAFF_MAGENTO_GET_RECOVERABLE_ERRORS.filter(klass => error instanceof klass).length > 0) {
|
|
1511
|
-
error.recoverable = true;
|
|
1512
|
-
}
|
|
1513
|
-
return error;
|
|
1514
|
-
})) || [],
|
|
1515
|
-
})), switchMap((resp) => resp.errors.reduce((acc, err) => acc && err.recoverable, true)
|
|
1516
|
-
? of(resp)
|
|
1517
|
-
: throwError(() => resp.errors.filter((err) => !err.recoverable)[0])));
|
|
1518
|
-
}
|
|
1519
|
-
;
|
|
1520
|
-
}
|
|
1521
|
-
/** @nocollapse */ DaffMagentoCartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartService, deps: [{ token: i1.Apollo }, { token: DAFF_MAGENTO_CART_MUTATION_QUEUE }, { token: DaffMagentoCartTransformer }, { token: DaffCartItemDriver }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1522
|
-
/** @nocollapse */ DaffMagentoCartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartService, providedIn: 'root' });
|
|
1523
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartService, decorators: [{
|
|
1524
|
-
type: Injectable,
|
|
1525
|
-
args: [{
|
|
1526
|
-
providedIn: 'root',
|
|
1527
|
-
}]
|
|
1528
|
-
}], ctorParameters: function () {
|
|
1529
|
-
return [{ type: i1.Apollo }, { type: i5.DaffQueuedApollo, decorators: [{
|
|
1530
|
-
type: Inject,
|
|
1531
|
-
args: [DAFF_MAGENTO_CART_MUTATION_QUEUE]
|
|
1532
|
-
}] }, { type: DaffMagentoCartTransformer }, { type: undefined, decorators: [{
|
|
1533
|
-
type: Inject,
|
|
1534
|
-
args: [DaffCartItemDriver]
|
|
1535
|
-
}] }, { type: undefined, decorators: [{
|
|
1536
|
-
type: Inject,
|
|
1537
|
-
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
1538
|
-
}] }];
|
|
1539
|
-
} });
|
|
1540
|
-
|
|
1541
|
-
function transformSimpleCartItem(item) {
|
|
1542
|
-
return {
|
|
1543
|
-
quantity: item.qty,
|
|
1544
|
-
sku: item.productId,
|
|
1545
|
-
};
|
|
1546
|
-
}
|
|
1547
|
-
function transformCompositeCartItem(item) {
|
|
1548
|
-
var _a;
|
|
1549
|
-
return Object.assign(Object.assign({}, transformSimpleCartItem(item)), { selected_options: ((_a = item.options) === null || _a === void 0 ? void 0 : _a.map(option => option.value)) || [] });
|
|
1550
|
-
}
|
|
1551
|
-
function transformConfigurableCartItem(item) {
|
|
1552
|
-
return {
|
|
1553
|
-
parent_sku: item.productId,
|
|
1554
|
-
quantity: item.qty,
|
|
1555
|
-
sku: item.variantId,
|
|
1556
|
-
};
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
/**
|
|
1560
|
-
* A service for making Magento GraphQL queries for carts.
|
|
1561
|
-
*
|
|
1562
|
-
* @inheritdoc
|
|
1563
|
-
*/
|
|
1564
|
-
class DaffMagentoCartItemService {
|
|
1565
|
-
constructor(apollo, mutationQueue, extraCartFragments, cartItemTransforms, cartTransformer, cartItemUpdateInputTransformer) {
|
|
1566
|
-
this.apollo = apollo;
|
|
1567
|
-
this.mutationQueue = mutationQueue;
|
|
1568
|
-
this.extraCartFragments = extraCartFragments;
|
|
1569
|
-
this.cartItemTransforms = cartItemTransforms;
|
|
1570
|
-
this.cartTransformer = cartTransformer;
|
|
1571
|
-
this.cartItemUpdateInputTransformer = cartItemUpdateInputTransformer;
|
|
1572
|
-
}
|
|
1573
|
-
list(cartId) {
|
|
1574
|
-
return this.apollo.query({
|
|
1575
|
-
query: listCartItems(this.extraCartFragments),
|
|
1576
|
-
variables: { cartId },
|
|
1577
|
-
fetchPolicy: 'network-only',
|
|
1578
|
-
}).pipe(map(result => result.data.cart.items.filter(item => !!item)), map(items => items.map(item => transformMagentoCartItem(daffTransformMagentoCartItem(item), item, this.cartItemTransforms))), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1579
|
-
}
|
|
1580
|
-
get(cartId, itemId) {
|
|
1581
|
-
return this.list(cartId).pipe(map(items => items.find(item => item.id === itemId)));
|
|
1582
|
-
}
|
|
1583
|
-
add(cartId, cartItemInput) {
|
|
1584
|
-
switch (cartItemInput.type) {
|
|
1585
|
-
case (DaffCartItemInputType.Composite):
|
|
1586
|
-
return this.addBundledProduct(cartId, cartItemInput);
|
|
1587
|
-
case (DaffCartItemInputType.Configurable):
|
|
1588
|
-
return this.addConfigurableProduct(cartId, cartItemInput);
|
|
1589
|
-
default:
|
|
1590
|
-
return this.addSimpleProduct(cartId, cartItemInput);
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
update(cartId, itemId, changes) {
|
|
1594
|
-
return this.mutationQueue.mutate({
|
|
1595
|
-
mutation: updateCartItem(this.extraCartFragments),
|
|
1596
|
-
variables: {
|
|
1597
|
-
cartId,
|
|
1598
|
-
input: this.cartItemUpdateInputTransformer.transform(Object.assign(Object.assign({}, changes), { id: itemId })),
|
|
1599
|
-
},
|
|
1600
|
-
fetchPolicy: 'network-only',
|
|
1601
|
-
}).pipe(map(result => this.cartTransformer.transform(result.data.updateCartItems.cart)), catchError(err => throwError(() => transformCartMagentoError(err))));
|
|
1602
|
-
}
|
|
1603
|
-
delete(cartId, itemId) {
|
|
1604
|
-
return this.mutationQueue.mutate({
|
|
1605
|
-
mutation: removeCartItem(this.extraCartFragments),
|
|
1606
|
-
variables: {
|
|
1607
|
-
cartId,
|
|
1608
|
-
itemId,
|
|
1609
|
-
},
|
|
1610
|
-
fetchPolicy: 'network-only',
|
|
1611
|
-
}).pipe(map(result => this.cartTransformer.transform(result.data.removeItemFromCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1612
|
-
}
|
|
1613
|
-
addBundledProduct(cartId, cartItemInput) {
|
|
1614
|
-
return this.addCartItemRequest(cartId, transformCompositeCartItem(cartItemInput));
|
|
1615
|
-
}
|
|
1616
|
-
addConfigurableProduct(cartId, cartItemInput) {
|
|
1617
|
-
return this.addCartItemRequest(cartId, transformConfigurableCartItem(cartItemInput));
|
|
1618
|
-
}
|
|
1619
|
-
addSimpleProduct(cartId, cartItemInput) {
|
|
1620
|
-
return this.addCartItemRequest(cartId, transformSimpleCartItem(cartItemInput));
|
|
1621
|
-
}
|
|
1622
|
-
addCartItemRequest(cartId, input) {
|
|
1623
|
-
return this.mutationQueue.mutate({
|
|
1624
|
-
mutation: addCartItem(this.extraCartFragments),
|
|
1625
|
-
variables: {
|
|
1626
|
-
cartId,
|
|
1627
|
-
input,
|
|
1628
|
-
},
|
|
1629
|
-
fetchPolicy: 'network-only',
|
|
1630
|
-
}).pipe(switchMap((result) => result.data.addProductsToCart.user_errors.length > 0
|
|
1631
|
-
? throwError(() => magentoCartTransformUserError(result.data.addProductsToCart.user_errors[0]))
|
|
1632
|
-
: of(this.cartTransformer.transform(result.data.addProductsToCart.cart))), catchError(err => throwError(() => transformCartMagentoError(err))));
|
|
1633
|
-
}
|
|
1634
|
-
}
|
|
1635
|
-
/** @nocollapse */ DaffMagentoCartItemService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartItemService, deps: [{ token: i1.Apollo }, { token: DAFF_MAGENTO_CART_MUTATION_QUEUE }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }, { token: DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS }, { token: DaffMagentoCartTransformer }, { token: DaffMagentoCartItemUpdateInputTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1636
|
-
/** @nocollapse */ DaffMagentoCartItemService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartItemService, providedIn: 'root' });
|
|
1637
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartItemService, decorators: [{
|
|
1638
|
-
type: Injectable,
|
|
1639
|
-
args: [{
|
|
1640
|
-
providedIn: 'root',
|
|
1641
|
-
}]
|
|
1642
|
-
}], ctorParameters: function () {
|
|
1643
|
-
return [{ type: i1.Apollo }, { type: i5.DaffQueuedApollo, decorators: [{
|
|
1644
|
-
type: Inject,
|
|
1645
|
-
args: [DAFF_MAGENTO_CART_MUTATION_QUEUE]
|
|
1646
|
-
}] }, { type: undefined, decorators: [{
|
|
1647
|
-
type: Inject,
|
|
1648
|
-
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
1649
|
-
}] }, { type: undefined, decorators: [{
|
|
1650
|
-
type: Inject,
|
|
1651
|
-
args: [DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS]
|
|
1652
|
-
}] }, { type: DaffMagentoCartTransformer }, { type: DaffMagentoCartItemUpdateInputTransformer }];
|
|
1653
|
-
} });
|
|
1654
|
-
|
|
1655
|
-
/**
|
|
1656
|
-
* A service for making Magento GraphQL queries for carts.
|
|
1657
|
-
*
|
|
1658
|
-
* @inheritdoc
|
|
1659
|
-
*/
|
|
1660
|
-
class DaffMagentoCartPaymentService {
|
|
1661
|
-
constructor(apollo, mutationQueue, cartTransformer, paymentTransformer, paymentInputTransformer, cartAddressInputTransformer, extraCartFragments) {
|
|
1662
|
-
this.apollo = apollo;
|
|
1663
|
-
this.mutationQueue = mutationQueue;
|
|
1664
|
-
this.cartTransformer = cartTransformer;
|
|
1665
|
-
this.paymentTransformer = paymentTransformer;
|
|
1666
|
-
this.paymentInputTransformer = paymentInputTransformer;
|
|
1667
|
-
this.cartAddressInputTransformer = cartAddressInputTransformer;
|
|
1668
|
-
this.extraCartFragments = extraCartFragments;
|
|
1669
|
-
}
|
|
1670
|
-
get(cartId) {
|
|
1671
|
-
return this.apollo.query({
|
|
1672
|
-
query: getSelectedPaymentMethod(this.extraCartFragments),
|
|
1673
|
-
variables: { cartId },
|
|
1674
|
-
fetchPolicy: 'network-only',
|
|
1675
|
-
}).pipe(map(result => this.paymentTransformer.transform(result.data.cart.selected_payment_method)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1676
|
-
}
|
|
1677
|
-
update(cartId, payment, billingAddress) {
|
|
1678
|
-
return billingAddress
|
|
1679
|
-
? this.updateWithBilling(cartId, payment, billingAddress)
|
|
1680
|
-
: this.mutationQueue.mutate({
|
|
1681
|
-
mutation: setSelectedPaymentMethod(this.extraCartFragments),
|
|
1682
|
-
variables: {
|
|
1683
|
-
cartId,
|
|
1684
|
-
payment: this.paymentInputTransformer.transform(payment),
|
|
1685
|
-
},
|
|
1686
|
-
fetchPolicy: 'network-only',
|
|
1687
|
-
}).pipe(map(result => this.cartTransformer.transform(result.data.setPaymentMethodOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1688
|
-
}
|
|
1689
|
-
updateWithBilling(cartId, payment, address) {
|
|
1690
|
-
return address.email
|
|
1691
|
-
? this.updateWithBillingAddressAndEmail(cartId, payment, address)
|
|
1692
|
-
: this.updateWithBillingAddress(cartId, payment, address);
|
|
1693
|
-
}
|
|
1694
|
-
remove(cartId) {
|
|
1695
|
-
return this.mutationQueue.mutate({
|
|
1696
|
-
mutation: setSelectedPaymentMethod(this.extraCartFragments),
|
|
1697
|
-
variables: {
|
|
1698
|
-
cartId,
|
|
1699
|
-
payment: { code: '' },
|
|
1700
|
-
},
|
|
1701
|
-
fetchPolicy: 'network-only',
|
|
1702
|
-
}).pipe(map(() => undefined), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1703
|
-
}
|
|
1704
|
-
updateWithBillingAddress(cartId, payment, address) {
|
|
1705
|
-
return this.mutationQueue.mutate({
|
|
1706
|
-
mutation: setSelectedPaymentMethodWithBilling(this.extraCartFragments),
|
|
1707
|
-
variables: {
|
|
1708
|
-
cartId,
|
|
1709
|
-
payment: this.paymentInputTransformer.transform(payment),
|
|
1710
|
-
address: this.cartAddressInputTransformer.transform(address),
|
|
1711
|
-
},
|
|
1712
|
-
fetchPolicy: 'network-only',
|
|
1713
|
-
}).pipe(map(resp => this.cartTransformer.transform(resp.data.setPaymentMethodOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1714
|
-
}
|
|
1715
|
-
updateWithBillingAddressAndEmail(cartId, payment, address) {
|
|
1716
|
-
return this.mutationQueue.mutate({
|
|
1717
|
-
mutation: setSelectedPaymentMethodWithBillingAndEmail(this.extraCartFragments),
|
|
1718
|
-
variables: {
|
|
1719
|
-
cartId,
|
|
1720
|
-
email: address.email,
|
|
1721
|
-
payment: this.paymentInputTransformer.transform(payment),
|
|
1722
|
-
address: this.cartAddressInputTransformer.transform(address),
|
|
1723
|
-
},
|
|
1724
|
-
fetchPolicy: 'network-only',
|
|
1725
|
-
}).pipe(map(resp => this.cartTransformer.transform(resp.data.setGuestEmailOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1726
|
-
}
|
|
1727
|
-
}
|
|
1728
|
-
/** @nocollapse */ DaffMagentoCartPaymentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartPaymentService, deps: [{ token: i1.Apollo }, { token: DAFF_MAGENTO_CART_MUTATION_QUEUE }, { token: DaffMagentoCartTransformer }, { token: DaffMagentoCartPaymentTransformer }, { token: DaffMagentoPaymentMethodInputTransformer }, { token: DaffMagentoBillingAddressInputTransformer }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1729
|
-
/** @nocollapse */ DaffMagentoCartPaymentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartPaymentService, providedIn: 'root' });
|
|
1730
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartPaymentService, decorators: [{
|
|
1731
|
-
type: Injectable,
|
|
1732
|
-
args: [{
|
|
1733
|
-
providedIn: 'root',
|
|
1734
|
-
}]
|
|
1735
|
-
}], ctorParameters: function () {
|
|
1736
|
-
return [{ type: i1.Apollo }, { type: i5.DaffQueuedApollo, decorators: [{
|
|
1737
|
-
type: Inject,
|
|
1738
|
-
args: [DAFF_MAGENTO_CART_MUTATION_QUEUE]
|
|
1739
|
-
}] }, { type: DaffMagentoCartTransformer }, { type: DaffMagentoCartPaymentTransformer }, { type: DaffMagentoPaymentMethodInputTransformer }, { type: DaffMagentoBillingAddressInputTransformer }, { type: undefined, decorators: [{
|
|
1740
|
-
type: Inject,
|
|
1741
|
-
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
1742
|
-
}] }];
|
|
1743
|
-
} });
|
|
1744
|
-
|
|
1745
|
-
/**
|
|
1746
|
-
* A service for making Magento GraphQL queries for carts.
|
|
1747
|
-
*
|
|
1748
|
-
* @inheritdoc
|
|
1749
|
-
*/
|
|
1750
|
-
class DaffMagentoCartPaymentMethodsService {
|
|
1751
|
-
constructor(apollo, extraCartFragments, paymentTransformer) {
|
|
1752
|
-
this.apollo = apollo;
|
|
1753
|
-
this.extraCartFragments = extraCartFragments;
|
|
1754
|
-
this.paymentTransformer = paymentTransformer;
|
|
1755
|
-
}
|
|
1756
|
-
list(cartId) {
|
|
1757
|
-
return this.apollo.query({
|
|
1758
|
-
query: listPaymentMethods(this.extraCartFragments),
|
|
1759
|
-
variables: { cartId },
|
|
1760
|
-
fetchPolicy: 'network-only',
|
|
1761
|
-
}).pipe(map(result => result.data.cart.available_payment_methods.map(item => this.paymentTransformer.transform(item))), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
/** @nocollapse */ DaffMagentoCartPaymentMethodsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartPaymentMethodsService, deps: [{ token: i1.Apollo }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }, { token: DaffMagentoCartPaymentTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1765
|
-
/** @nocollapse */ DaffMagentoCartPaymentMethodsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartPaymentMethodsService, providedIn: 'root' });
|
|
1766
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartPaymentMethodsService, decorators: [{
|
|
1767
|
-
type: Injectable,
|
|
1768
|
-
args: [{
|
|
1769
|
-
providedIn: 'root',
|
|
1770
|
-
}]
|
|
1771
|
-
}], ctorParameters: function () {
|
|
1772
|
-
return [{ type: i1.Apollo }, { type: undefined, decorators: [{
|
|
1773
|
-
type: Inject,
|
|
1774
|
-
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
1775
|
-
}] }, { type: DaffMagentoCartPaymentTransformer }];
|
|
1776
|
-
} });
|
|
1777
|
-
|
|
1778
|
-
/**
|
|
1779
|
-
* A service for making Magento GraphQL queries for carts.
|
|
1780
|
-
*
|
|
1781
|
-
* @inheritdoc
|
|
1782
|
-
*/
|
|
1783
|
-
class DaffMagentoCartAddressService {
|
|
1784
|
-
constructor(mutationQueue, extraCartFragments, cartTransformer, cartAddressInputTransformer) {
|
|
1785
|
-
this.mutationQueue = mutationQueue;
|
|
1786
|
-
this.extraCartFragments = extraCartFragments;
|
|
1787
|
-
this.cartTransformer = cartTransformer;
|
|
1788
|
-
this.cartAddressInputTransformer = cartAddressInputTransformer;
|
|
1789
|
-
}
|
|
1790
|
-
update(cartId, address) {
|
|
1791
|
-
return address.email ? this.updateAddressWithEmail(cartId, address) : this.updateAddress(cartId, address);
|
|
1792
|
-
}
|
|
1793
|
-
getAddressInput(address) {
|
|
1794
|
-
return address.id
|
|
1795
|
-
? {
|
|
1796
|
-
addressId: Number(address.id),
|
|
1797
|
-
}
|
|
1798
|
-
: {
|
|
1799
|
-
address: this.cartAddressInputTransformer.transform(address),
|
|
1800
|
-
};
|
|
1801
|
-
}
|
|
1802
|
-
updateAddress(cartId, address) {
|
|
1803
|
-
return this.mutationQueue.mutate({
|
|
1804
|
-
mutation: updateAddress(this.extraCartFragments),
|
|
1805
|
-
variables: Object.assign(Object.assign({}, this.getAddressInput(address)), { cartId }),
|
|
1806
|
-
fetchPolicy: 'network-only',
|
|
1807
|
-
}).pipe(map(resp => this.cartTransformer.transform(resp.data.setShippingAddressesOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1808
|
-
}
|
|
1809
|
-
updateAddressWithEmail(cartId, address) {
|
|
1810
|
-
return this.mutationQueue.mutate({
|
|
1811
|
-
mutation: updateAddressWithEmail(this.extraCartFragments),
|
|
1812
|
-
variables: Object.assign(Object.assign({}, this.getAddressInput(address)), { cartId, email: address.email }),
|
|
1813
|
-
fetchPolicy: 'network-only',
|
|
1814
|
-
}).pipe(map(resp => this.cartTransformer.transform(resp.data.setGuestEmailOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
/** @nocollapse */ DaffMagentoCartAddressService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartAddressService, deps: [{ token: DAFF_MAGENTO_CART_MUTATION_QUEUE }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }, { token: DaffMagentoCartTransformer }, { token: DaffMagentoCartAddressInputTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1818
|
-
/** @nocollapse */ DaffMagentoCartAddressService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartAddressService, providedIn: 'root' });
|
|
1819
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartAddressService, decorators: [{
|
|
1820
|
-
type: Injectable,
|
|
1821
|
-
args: [{
|
|
1822
|
-
providedIn: 'root',
|
|
1823
|
-
}]
|
|
1824
|
-
}], ctorParameters: function () {
|
|
1825
|
-
return [{ type: i5.DaffQueuedApollo, decorators: [{
|
|
1826
|
-
type: Inject,
|
|
1827
|
-
args: [DAFF_MAGENTO_CART_MUTATION_QUEUE]
|
|
1828
|
-
}] }, { type: undefined, decorators: [{
|
|
1829
|
-
type: Inject,
|
|
1830
|
-
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
1831
|
-
}] }, { type: DaffMagentoCartTransformer }, { type: DaffMagentoCartAddressInputTransformer }];
|
|
1832
|
-
} });
|
|
1833
|
-
|
|
1834
|
-
/**
|
|
1835
|
-
* A service for making Magento GraphQL queries for carts.
|
|
1836
|
-
*
|
|
1837
|
-
* @inheritdoc
|
|
1838
|
-
*/
|
|
1839
|
-
class DaffMagentoCartBillingAddressService {
|
|
1840
|
-
constructor(apollo, mutationQueue, extraCartFragments, cartTransformer, billingAddressTransformer, billingAddressInputTransformer) {
|
|
1841
|
-
this.apollo = apollo;
|
|
1842
|
-
this.mutationQueue = mutationQueue;
|
|
1843
|
-
this.extraCartFragments = extraCartFragments;
|
|
1844
|
-
this.cartTransformer = cartTransformer;
|
|
1845
|
-
this.billingAddressTransformer = billingAddressTransformer;
|
|
1846
|
-
this.billingAddressInputTransformer = billingAddressInputTransformer;
|
|
1847
|
-
}
|
|
1848
|
-
get(cartId) {
|
|
1849
|
-
return this.apollo.query({
|
|
1850
|
-
query: getBillingAddress(this.extraCartFragments),
|
|
1851
|
-
variables: { cartId },
|
|
1852
|
-
fetchPolicy: 'network-only',
|
|
1853
|
-
}).pipe(map(result => result.data.cart.billing_address
|
|
1854
|
-
? this.billingAddressTransformer.transform(Object.assign(Object.assign({}, result.data.cart.billing_address), { email: result.data.cart.email }))
|
|
1855
|
-
: null), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1856
|
-
}
|
|
1857
|
-
update(cartId, address) {
|
|
1858
|
-
return address.email ? this.updateAddressWithEmail(cartId, address) : this.updateAddress(cartId, address);
|
|
1859
|
-
}
|
|
1860
|
-
updateAddress(cartId, address) {
|
|
1861
|
-
return this.mutationQueue.mutate({
|
|
1862
|
-
mutation: updateBillingAddress(this.extraCartFragments),
|
|
1863
|
-
variables: {
|
|
1864
|
-
cartId,
|
|
1865
|
-
address: this.billingAddressInputTransformer.transform(address),
|
|
1866
|
-
},
|
|
1867
|
-
fetchPolicy: 'network-only',
|
|
1868
|
-
}).pipe(map(resp => this.cartTransformer.transform(resp.data.setBillingAddressOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1869
|
-
}
|
|
1870
|
-
updateAddressWithEmail(cartId, address) {
|
|
1871
|
-
return this.mutationQueue.mutate({
|
|
1872
|
-
mutation: updateBillingAddressWithEmail(this.extraCartFragments),
|
|
1873
|
-
variables: {
|
|
1874
|
-
cartId,
|
|
1875
|
-
email: address.email,
|
|
1876
|
-
address: this.billingAddressInputTransformer.transform(address),
|
|
1877
|
-
},
|
|
1878
|
-
fetchPolicy: 'network-only',
|
|
1879
|
-
}).pipe(map(resp => this.cartTransformer.transform(Object.assign(Object.assign({}, resp.data.setBillingAddressOnCart.cart), { email: resp.data.setGuestEmailOnCart.cart.email }))), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
|
-
/** @nocollapse */ DaffMagentoCartBillingAddressService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartBillingAddressService, deps: [{ token: i1.Apollo }, { token: DAFF_MAGENTO_CART_MUTATION_QUEUE }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }, { token: DaffMagentoCartTransformer }, { token: DaffMagentoBillingAddressTransformer }, { token: DaffMagentoBillingAddressInputTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1883
|
-
/** @nocollapse */ DaffMagentoCartBillingAddressService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartBillingAddressService, providedIn: 'root' });
|
|
1884
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartBillingAddressService, decorators: [{
|
|
1885
|
-
type: Injectable,
|
|
1886
|
-
args: [{
|
|
1887
|
-
providedIn: 'root',
|
|
1888
|
-
}]
|
|
1889
|
-
}], ctorParameters: function () {
|
|
1890
|
-
return [{ type: i1.Apollo }, { type: i5.DaffQueuedApollo, decorators: [{
|
|
1891
|
-
type: Inject,
|
|
1892
|
-
args: [DAFF_MAGENTO_CART_MUTATION_QUEUE]
|
|
1893
|
-
}] }, { type: undefined, decorators: [{
|
|
1894
|
-
type: Inject,
|
|
1895
|
-
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
1896
|
-
}] }, { type: DaffMagentoCartTransformer }, { type: DaffMagentoBillingAddressTransformer }, { type: DaffMagentoBillingAddressInputTransformer }];
|
|
1897
|
-
} });
|
|
1898
|
-
|
|
1899
|
-
/**
|
|
1900
|
-
* A service for making Magento GraphQL queries for a cart's shipping address.
|
|
1901
|
-
*
|
|
1902
|
-
* @inheritdoc
|
|
1903
|
-
*/
|
|
1904
|
-
class DaffMagentoCartShippingAddressService {
|
|
1905
|
-
constructor(apollo, mutationQueue, extraCartFragments, cartTransformer, shippingAddressTransformer, shippingAddressInputTransformer) {
|
|
1906
|
-
this.apollo = apollo;
|
|
1907
|
-
this.mutationQueue = mutationQueue;
|
|
1908
|
-
this.extraCartFragments = extraCartFragments;
|
|
1909
|
-
this.cartTransformer = cartTransformer;
|
|
1910
|
-
this.shippingAddressTransformer = shippingAddressTransformer;
|
|
1911
|
-
this.shippingAddressInputTransformer = shippingAddressInputTransformer;
|
|
1912
|
-
}
|
|
1913
|
-
get(cartId) {
|
|
1914
|
-
return this.apollo.query({
|
|
1915
|
-
query: getShippingAddress(this.extraCartFragments),
|
|
1916
|
-
variables: { cartId },
|
|
1917
|
-
fetchPolicy: 'network-only',
|
|
1918
|
-
}).pipe(map(result => result.data.cart.shipping_addresses[0]
|
|
1919
|
-
? this.shippingAddressTransformer.transform(Object.assign(Object.assign({}, result.data.cart.shipping_addresses[0]), { email: result.data.cart.email }))
|
|
1920
|
-
: null), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1921
|
-
}
|
|
1922
|
-
update(cartId, address) {
|
|
1923
|
-
return address.email ? this.updateAddressWithEmail(cartId, address) : this.updateAddress(cartId, address);
|
|
1924
|
-
}
|
|
1925
|
-
updateAddress(cartId, address) {
|
|
1926
|
-
return this.mutationQueue.mutate({
|
|
1927
|
-
mutation: updateShippingAddress(this.extraCartFragments),
|
|
1928
|
-
variables: {
|
|
1929
|
-
cartId,
|
|
1930
|
-
address: this.shippingAddressInputTransformer.transform(address),
|
|
1931
|
-
},
|
|
1932
|
-
fetchPolicy: 'network-only',
|
|
1933
|
-
}).pipe(map(resp => this.cartTransformer.transform(resp.data.setShippingAddressesOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1934
|
-
}
|
|
1935
|
-
updateAddressWithEmail(cartId, address) {
|
|
1936
|
-
return this.mutationQueue.mutate({
|
|
1937
|
-
mutation: updateShippingAddressWithEmail(this.extraCartFragments),
|
|
1938
|
-
variables: {
|
|
1939
|
-
cartId,
|
|
1940
|
-
email: address.email,
|
|
1941
|
-
address: this.shippingAddressInputTransformer.transform(address),
|
|
1942
|
-
},
|
|
1943
|
-
fetchPolicy: 'network-only',
|
|
1944
|
-
}).pipe(map(resp => this.cartTransformer.transform(Object.assign(Object.assign({}, resp.data.setShippingAddressesOnCart.cart), { email: resp.data.setGuestEmailOnCart.cart.email }))), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
/** @nocollapse */ DaffMagentoCartShippingAddressService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingAddressService, deps: [{ token: i1.Apollo }, { token: DAFF_MAGENTO_CART_MUTATION_QUEUE }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }, { token: DaffMagentoCartTransformer }, { token: DaffMagentoShippingAddressTransformer }, { token: DaffMagentoShippingAddressInputTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1948
|
-
/** @nocollapse */ DaffMagentoCartShippingAddressService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingAddressService, providedIn: 'root' });
|
|
1949
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingAddressService, decorators: [{
|
|
1950
|
-
type: Injectable,
|
|
1951
|
-
args: [{
|
|
1952
|
-
providedIn: 'root',
|
|
1953
|
-
}]
|
|
1954
|
-
}], ctorParameters: function () {
|
|
1955
|
-
return [{ type: i1.Apollo }, { type: i5.DaffQueuedApollo, decorators: [{
|
|
1956
|
-
type: Inject,
|
|
1957
|
-
args: [DAFF_MAGENTO_CART_MUTATION_QUEUE]
|
|
1958
|
-
}] }, { type: undefined, decorators: [{
|
|
1959
|
-
type: Inject,
|
|
1960
|
-
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
1961
|
-
}] }, { type: DaffMagentoCartTransformer }, { type: DaffMagentoShippingAddressTransformer }, { type: DaffMagentoShippingAddressInputTransformer }];
|
|
1962
|
-
} });
|
|
1963
|
-
|
|
1964
|
-
/**
|
|
1965
|
-
* A service for making Magento GraphQL queries for carts' shipping methods.
|
|
1966
|
-
*
|
|
1967
|
-
* @inheritdoc
|
|
1968
|
-
*/
|
|
1969
|
-
class DaffMagentoCartShippingMethodsService {
|
|
1970
|
-
constructor(apollo, extraCartFragments, shippingRateTransformer) {
|
|
1971
|
-
this.apollo = apollo;
|
|
1972
|
-
this.extraCartFragments = extraCartFragments;
|
|
1973
|
-
this.shippingRateTransformer = shippingRateTransformer;
|
|
1974
|
-
}
|
|
1975
|
-
list(cartId) {
|
|
1976
|
-
return this.apollo.query({
|
|
1977
|
-
query: listShippingMethods(this.extraCartFragments),
|
|
1978
|
-
variables: { cartId },
|
|
1979
|
-
fetchPolicy: 'network-only',
|
|
1980
|
-
}).pipe(map(result => result.data.cart.shipping_addresses[0].available_shipping_methods.map(item => this.shippingRateTransformer.transform(item))), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
/** @nocollapse */ DaffMagentoCartShippingMethodsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingMethodsService, deps: [{ token: i1.Apollo }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }, { token: DaffMagentoCartShippingRateTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1984
|
-
/** @nocollapse */ DaffMagentoCartShippingMethodsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingMethodsService, providedIn: 'root' });
|
|
1985
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingMethodsService, decorators: [{
|
|
1986
|
-
type: Injectable,
|
|
1987
|
-
args: [{
|
|
1988
|
-
providedIn: 'root',
|
|
1989
|
-
}]
|
|
1990
|
-
}], ctorParameters: function () {
|
|
1991
|
-
return [{ type: i1.Apollo }, { type: undefined, decorators: [{
|
|
1992
|
-
type: Inject,
|
|
1993
|
-
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
1994
|
-
}] }, { type: DaffMagentoCartShippingRateTransformer }];
|
|
1995
|
-
} });
|
|
1996
|
-
|
|
1997
|
-
/**
|
|
1998
|
-
* A service for making Magento GraphQL queries for carts.
|
|
1999
|
-
*
|
|
2000
|
-
* @inheritdoc
|
|
2001
|
-
*/
|
|
2002
|
-
class DaffMagentoCartShippingInformationService {
|
|
2003
|
-
constructor(apollo, mutationQueue, extraCartFragments, cartTransformer, shippingRateTransformer, shippingMethodInputTransformer) {
|
|
2004
|
-
this.apollo = apollo;
|
|
2005
|
-
this.mutationQueue = mutationQueue;
|
|
2006
|
-
this.extraCartFragments = extraCartFragments;
|
|
2007
|
-
this.cartTransformer = cartTransformer;
|
|
2008
|
-
this.shippingRateTransformer = shippingRateTransformer;
|
|
2009
|
-
this.shippingMethodInputTransformer = shippingMethodInputTransformer;
|
|
2010
|
-
}
|
|
2011
|
-
get(cartId) {
|
|
2012
|
-
return this.apollo.query({
|
|
2013
|
-
query: getSelectedShippingMethod(this.extraCartFragments),
|
|
2014
|
-
variables: { cartId },
|
|
2015
|
-
fetchPolicy: 'network-only',
|
|
2016
|
-
}).pipe(map(result => result.data.cart.shipping_addresses[0]
|
|
2017
|
-
? this.shippingRateTransformer.transform(result.data.cart.shipping_addresses[0].selected_shipping_method)
|
|
2018
|
-
: null), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
2019
|
-
}
|
|
2020
|
-
update(cartId, shippingInfo) {
|
|
2021
|
-
return this.mutationQueue.mutate({
|
|
2022
|
-
mutation: setSelectedShippingMethod(this.extraCartFragments),
|
|
2023
|
-
variables: {
|
|
2024
|
-
cartId,
|
|
2025
|
-
method: this.shippingMethodInputTransformer.transform(shippingInfo),
|
|
2026
|
-
},
|
|
2027
|
-
fetchPolicy: 'network-only',
|
|
2028
|
-
}).pipe(switchMap(result =>
|
|
2029
|
-
// because Magento only returns the selected shipping method for the mutation
|
|
2030
|
-
// we have to manually refetch the available shipping methods
|
|
2031
|
-
// with fetchPolicy: 'network-only' in order to skip the cache
|
|
2032
|
-
this.apollo.query({
|
|
2033
|
-
query: listShippingMethods(this.extraCartFragments),
|
|
2034
|
-
variables: { cartId },
|
|
2035
|
-
fetchPolicy: 'network-only',
|
|
2036
|
-
}).pipe(map(shippingMethods => (Object.assign(Object.assign({}, this.cartTransformer.transform(result.data.setShippingMethodsOnCart.cart)), { available_shipping_methods: shippingMethods.data.cart.shipping_addresses[0].available_shipping_methods.map(item => this.shippingRateTransformer.transform(item)) }))))), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
2037
|
-
}
|
|
2038
|
-
delete(cartId, id) {
|
|
2039
|
-
return this.mutationQueue.mutate({
|
|
2040
|
-
mutation: setSelectedShippingMethod(this.extraCartFragments),
|
|
2041
|
-
variables: {
|
|
2042
|
-
cartId,
|
|
2043
|
-
method: {
|
|
2044
|
-
carrier_code: '',
|
|
2045
|
-
method_code: '',
|
|
2046
|
-
},
|
|
2047
|
-
},
|
|
2048
|
-
}).pipe(map(result => this.cartTransformer.transform(result.data.setShippingMethodsOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
2049
|
-
}
|
|
2050
|
-
}
|
|
2051
|
-
/** @nocollapse */ DaffMagentoCartShippingInformationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingInformationService, deps: [{ token: i1.Apollo }, { token: DAFF_MAGENTO_CART_MUTATION_QUEUE }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }, { token: DaffMagentoCartTransformer }, { token: DaffMagentoCartShippingRateTransformer }, { token: DaffMagentoShippingMethodInputTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2052
|
-
/** @nocollapse */ DaffMagentoCartShippingInformationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingInformationService, providedIn: 'root' });
|
|
2053
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartShippingInformationService, decorators: [{
|
|
2054
|
-
type: Injectable,
|
|
2055
|
-
args: [{
|
|
2056
|
-
providedIn: 'root',
|
|
2057
|
-
}]
|
|
2058
|
-
}], ctorParameters: function () {
|
|
2059
|
-
return [{ type: i1.Apollo }, { type: i5.DaffQueuedApollo, decorators: [{
|
|
2060
|
-
type: Inject,
|
|
2061
|
-
args: [DAFF_MAGENTO_CART_MUTATION_QUEUE]
|
|
2062
|
-
}] }, { type: undefined, decorators: [{
|
|
2063
|
-
type: Inject,
|
|
2064
|
-
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
2065
|
-
}] }, { type: DaffMagentoCartTransformer }, { type: DaffMagentoCartShippingRateTransformer }, { type: DaffMagentoShippingMethodInputTransformer }];
|
|
2066
|
-
} });
|
|
2067
|
-
|
|
2068
|
-
/**
|
|
2069
|
-
* A service for making Magento GraphQL queries for carts.
|
|
2070
|
-
*
|
|
2071
|
-
* @inheritdoc
|
|
2072
|
-
*/
|
|
2073
|
-
class DaffMagentoCartCouponService {
|
|
2074
|
-
constructor(mutationQueue, extraCartFragments, cartTransformer) {
|
|
2075
|
-
this.mutationQueue = mutationQueue;
|
|
2076
|
-
this.extraCartFragments = extraCartFragments;
|
|
2077
|
-
this.cartTransformer = cartTransformer;
|
|
2078
|
-
}
|
|
2079
|
-
apply(cartId, coupon) {
|
|
2080
|
-
return this.mutationQueue.mutate({
|
|
2081
|
-
mutation: applyCoupon(this.extraCartFragments),
|
|
2082
|
-
variables: {
|
|
2083
|
-
cartId,
|
|
2084
|
-
couponCode: coupon.code,
|
|
2085
|
-
},
|
|
2086
|
-
fetchPolicy: 'network-only',
|
|
2087
|
-
}).pipe(map(result => this.cartTransformer.transform(result.data.applyCouponToCart.cart)), catchError(err => throwError(() => transformCartMagentoError(err, coupon))));
|
|
2088
|
-
}
|
|
2089
|
-
list(cartId) {
|
|
2090
|
-
return this.mutationQueue.mutate({
|
|
2091
|
-
mutation: listCartCoupons(this.extraCartFragments),
|
|
2092
|
-
variables: {
|
|
2093
|
-
cartId,
|
|
2094
|
-
},
|
|
2095
|
-
fetchPolicy: 'network-only',
|
|
2096
|
-
}).pipe(map(result => result.data.cart.applied_coupons.map(daffMagentoCouponTransform)), catchError(err => throwError(() => transformCartMagentoError(err))));
|
|
2097
|
-
}
|
|
2098
|
-
remove(cartId, coupon) {
|
|
2099
|
-
return this.removeAll(cartId);
|
|
2100
|
-
}
|
|
2101
|
-
removeAll(cartId) {
|
|
2102
|
-
return this.mutationQueue.mutate({
|
|
2103
|
-
mutation: removeAllCoupons(this.extraCartFragments),
|
|
2104
|
-
variables: {
|
|
2105
|
-
cartId,
|
|
2106
|
-
},
|
|
2107
|
-
fetchPolicy: 'network-only',
|
|
2108
|
-
}).pipe(map(result => this.cartTransformer.transform(result.data.removeCouponFromCart.cart)), catchError(err => throwError(() => transformCartMagentoError(err))));
|
|
2109
|
-
}
|
|
2110
|
-
}
|
|
2111
|
-
/** @nocollapse */ DaffMagentoCartCouponService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartCouponService, deps: [{ token: DAFF_MAGENTO_CART_MUTATION_QUEUE }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }, { token: DaffMagentoCartTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2112
|
-
/** @nocollapse */ DaffMagentoCartCouponService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartCouponService, providedIn: 'root' });
|
|
2113
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartCouponService, decorators: [{
|
|
2114
|
-
type: Injectable,
|
|
2115
|
-
args: [{
|
|
2116
|
-
providedIn: 'root',
|
|
2117
|
-
}]
|
|
2118
|
-
}], ctorParameters: function () {
|
|
2119
|
-
return [{ type: i5.DaffQueuedApollo, decorators: [{
|
|
2120
|
-
type: Inject,
|
|
2121
|
-
args: [DAFF_MAGENTO_CART_MUTATION_QUEUE]
|
|
2122
|
-
}] }, { type: undefined, decorators: [{
|
|
2123
|
-
type: Inject,
|
|
2124
|
-
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
2125
|
-
}] }, { type: DaffMagentoCartTransformer }];
|
|
2126
|
-
} });
|
|
2127
|
-
|
|
2128
|
-
/**
|
|
2129
|
-
* A service for making Magento GraphQL queries for carts.
|
|
2130
|
-
*
|
|
2131
|
-
* @inheritdoc
|
|
2132
|
-
*/
|
|
2133
|
-
class DaffMagentoCartOrderService {
|
|
2134
|
-
constructor(mutationQueue) {
|
|
2135
|
-
this.mutationQueue = mutationQueue;
|
|
2136
|
-
}
|
|
2137
|
-
placeOrder(cartId, payment) {
|
|
2138
|
-
return this.mutationQueue.mutate({
|
|
2139
|
-
mutation: placeOrder,
|
|
2140
|
-
variables: {
|
|
2141
|
-
cartId,
|
|
2142
|
-
},
|
|
2143
|
-
fetchPolicy: 'network-only',
|
|
2144
|
-
}).pipe(map(result => ({
|
|
2145
|
-
id: result.data.placeOrder.order.order_number,
|
|
2146
|
-
orderId: result.data.placeOrder.order.order_number,
|
|
2147
|
-
cartId,
|
|
2148
|
-
})), catchError(err => throwError(() => transformCartMagentoError(err))));
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
/** @nocollapse */ DaffMagentoCartOrderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartOrderService, deps: [{ token: DAFF_MAGENTO_CART_MUTATION_QUEUE }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2152
|
-
/** @nocollapse */ DaffMagentoCartOrderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartOrderService, providedIn: 'root' });
|
|
2153
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartOrderService, decorators: [{
|
|
2154
|
-
type: Injectable,
|
|
2155
|
-
args: [{
|
|
2156
|
-
providedIn: 'root',
|
|
2157
|
-
}]
|
|
2158
|
-
}], ctorParameters: function () {
|
|
2159
|
-
return [{ type: i5.DaffQueuedApollo, decorators: [{
|
|
2160
|
-
type: Inject,
|
|
2161
|
-
args: [DAFF_MAGENTO_CART_MUTATION_QUEUE]
|
|
2162
|
-
}] }];
|
|
2163
|
-
} });
|
|
2164
|
-
|
|
2165
|
-
/**
|
|
2166
|
-
* Transforms magento carts into an object usable by daffodil.
|
|
2167
|
-
*/
|
|
2168
|
-
class DaffMagentoCartCouponResponseTransformer {
|
|
2169
|
-
constructor(cartItemTransforms) {
|
|
2170
|
-
this.cartItemTransforms = cartItemTransforms;
|
|
2171
|
-
}
|
|
2172
|
-
transformCartItems(cart) {
|
|
2173
|
-
return {
|
|
2174
|
-
// TODO: extract into own transforms
|
|
2175
|
-
items: cart.items.filter(item => !!item).map(item => transformMagentoCartItem(daffTransformMagentoCartItem(item), item, this.cartItemTransforms)),
|
|
2176
|
-
};
|
|
2177
|
-
}
|
|
2178
|
-
transformTotals(cart) {
|
|
2179
|
-
return {
|
|
2180
|
-
grand_total: cart.prices.grand_total.value,
|
|
2181
|
-
subtotal: cart.prices.subtotal_excluding_tax.value,
|
|
2182
|
-
};
|
|
2183
|
-
}
|
|
2184
|
-
transformCoupons(cart) {
|
|
2185
|
-
return {
|
|
2186
|
-
coupons: cart.applied_coupons
|
|
2187
|
-
? cart.applied_coupons.map(daffMagentoCouponTransform)
|
|
2188
|
-
: [],
|
|
2189
|
-
};
|
|
2190
|
-
}
|
|
2191
|
-
/**
|
|
2192
|
-
* Transforms the MagentoCart from the cart coupon operations into a DaffCart partial.
|
|
2193
|
-
*
|
|
2194
|
-
* @param cart the cart from a magento cart query.
|
|
2195
|
-
*/
|
|
2196
|
-
transform(cart) {
|
|
2197
|
-
return cart ? Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.transformCartItems(cart)), this.transformCoupons(cart)), this.transformTotals(cart)), transformCartTotals(cart)), { id: cart.id }) : null;
|
|
2198
|
-
}
|
|
2199
|
-
}
|
|
2200
|
-
/** @nocollapse */ DaffMagentoCartCouponResponseTransformer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartCouponResponseTransformer, deps: [{ token: DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2201
|
-
/** @nocollapse */ DaffMagentoCartCouponResponseTransformer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartCouponResponseTransformer, providedIn: 'root' });
|
|
2202
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffMagentoCartCouponResponseTransformer, decorators: [{
|
|
2203
|
-
type: Injectable,
|
|
2204
|
-
args: [{
|
|
2205
|
-
providedIn: 'root',
|
|
2206
|
-
}]
|
|
2207
|
-
}], ctorParameters: function () {
|
|
2208
|
-
return [{ type: undefined, decorators: [{
|
|
2209
|
-
type: Inject,
|
|
2210
|
-
args: [DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS]
|
|
2211
|
-
}] }];
|
|
2212
|
-
} });
|
|
2213
|
-
|
|
2214
|
-
class DaffCartMagentoDriverModule {
|
|
2215
|
-
static forRoot() {
|
|
2216
|
-
return {
|
|
2217
|
-
ngModule: DaffCartMagentoDriverModule,
|
|
2218
|
-
providers: [
|
|
2219
|
-
{
|
|
2220
|
-
provide: DaffCartDriver,
|
|
2221
|
-
useExisting: DaffMagentoCartService,
|
|
2222
|
-
},
|
|
2223
|
-
{
|
|
2224
|
-
provide: DaffCartItemDriver,
|
|
2225
|
-
useExisting: DaffMagentoCartItemService,
|
|
2226
|
-
},
|
|
2227
|
-
{
|
|
2228
|
-
provide: DaffCartAddressDriver,
|
|
2229
|
-
useExisting: DaffMagentoCartAddressService,
|
|
2230
|
-
},
|
|
2231
|
-
{
|
|
2232
|
-
provide: DaffCartBillingAddressDriver,
|
|
2233
|
-
useExisting: DaffMagentoCartBillingAddressService,
|
|
2234
|
-
},
|
|
2235
|
-
{
|
|
2236
|
-
provide: DaffCartShippingAddressDriver,
|
|
2237
|
-
useExisting: DaffMagentoCartShippingAddressService,
|
|
2238
|
-
},
|
|
2239
|
-
{
|
|
2240
|
-
provide: DaffCartShippingMethodsDriver,
|
|
2241
|
-
useExisting: DaffMagentoCartShippingMethodsService,
|
|
2242
|
-
},
|
|
2243
|
-
{
|
|
2244
|
-
provide: DaffCartShippingInformationDriver,
|
|
2245
|
-
useExisting: DaffMagentoCartShippingInformationService,
|
|
2246
|
-
},
|
|
2247
|
-
{
|
|
2248
|
-
provide: DaffCartPaymentDriver,
|
|
2249
|
-
useExisting: DaffMagentoCartPaymentService,
|
|
2250
|
-
},
|
|
2251
|
-
{
|
|
2252
|
-
provide: DaffCartPaymentMethodsDriver,
|
|
2253
|
-
useExisting: DaffMagentoCartPaymentMethodsService,
|
|
2254
|
-
},
|
|
2255
|
-
{
|
|
2256
|
-
provide: DaffCartOrderDriver,
|
|
2257
|
-
useExisting: DaffMagentoCartOrderService,
|
|
2258
|
-
},
|
|
2259
|
-
{
|
|
2260
|
-
provide: DaffCartCouponDriver,
|
|
2261
|
-
useExisting: DaffMagentoCartCouponService,
|
|
2262
|
-
},
|
|
2263
|
-
// output transformers
|
|
2264
|
-
DaffMagentoBillingAddressTransformer,
|
|
2265
|
-
DaffMagentoCartAddressTransformer,
|
|
2266
|
-
DaffMagentoCartPaymentTransformer,
|
|
2267
|
-
DaffMagentoCartShippingInformationTransformer,
|
|
2268
|
-
DaffMagentoCartShippingRateTransformer,
|
|
2269
|
-
DaffMagentoCartTransformer,
|
|
2270
|
-
DaffMagentoShippingAddressTransformer,
|
|
2271
|
-
DaffMagentoCartCouponResponseTransformer,
|
|
2272
|
-
// input transformers
|
|
2273
|
-
DaffMagentoCartAddressInputTransformer,
|
|
2274
|
-
DaffMagentoShippingAddressInputTransformer,
|
|
2275
|
-
DaffMagentoBillingAddressInputTransformer,
|
|
2276
|
-
DaffMagentoCartItemUpdateInputTransformer,
|
|
2277
|
-
DaffMagentoPaymentMethodInputTransformer,
|
|
2278
|
-
DaffMagentoShippingMethodInputTransformer,
|
|
2279
|
-
daffCartDriverProvideFreePaymentMethod({
|
|
2280
|
-
method: 'free',
|
|
2281
|
-
payment_info: {
|
|
2282
|
-
code: 'free',
|
|
2283
|
-
},
|
|
2284
|
-
}),
|
|
2285
|
-
],
|
|
2286
|
-
};
|
|
2287
|
-
}
|
|
2288
|
-
}
|
|
2289
|
-
/** @nocollapse */ DaffCartMagentoDriverModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartMagentoDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2290
|
-
/** @nocollapse */ DaffCartMagentoDriverModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: DaffCartMagentoDriverModule, imports: [CommonModule] });
|
|
2291
|
-
/** @nocollapse */ DaffCartMagentoDriverModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartMagentoDriverModule, imports: [CommonModule] });
|
|
2292
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffCartMagentoDriverModule, decorators: [{
|
|
2293
|
-
type: NgModule,
|
|
2294
|
-
args: [{
|
|
2295
|
-
imports: [
|
|
2296
|
-
CommonModule,
|
|
2297
|
-
],
|
|
2298
|
-
}]
|
|
2299
|
-
}] });
|
|
2300
|
-
|
|
2301
|
-
/**
|
|
2302
|
-
* Generated bundle index. Do not edit.
|
|
2303
|
-
*/
|
|
2304
|
-
|
|
2305
|
-
export { DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS, DAFF_CART_MAGENTO_CART_TRANSFORMS, DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS, DAFF_MAGENTO_GET_RECOVERABLE_ERRORS, DaffCartMagentoDriverModule, DaffMagentoBillingAddressInputTransformer, DaffMagentoBillingAddressTransformer, DaffMagentoCartAddressInputTransformer, DaffMagentoCartAddressService, DaffMagentoCartAddressTransformer, DaffMagentoCartBillingAddressService, DaffMagentoCartItemService, DaffMagentoCartItemUpdateInputTransformer, DaffMagentoCartPaymentMethodsService, DaffMagentoCartPaymentService, DaffMagentoCartPaymentTransformer, DaffMagentoCartService, DaffMagentoCartShippingAddressService, DaffMagentoCartShippingInformationService, DaffMagentoCartShippingInformationTransformer, DaffMagentoCartShippingMethodsService, DaffMagentoCartShippingRateTransformer, DaffMagentoCartTransformer, DaffMagentoPaymentMethodInputTransformer, DaffMagentoShippingAddressInputTransformer, DaffMagentoShippingAddressTransformer, DaffMagentoShippingMethodInputTransformer, MagentoCartItemTypeEnum, MagentoCartUserInputErrorType, addCartItem, applyCoupon, availablePaymentMethodFragment, availableShippingMethodFragment, cartAddressFragment, cartCouponFragment, cartFragment, cartItemFragment, createCart, daffProvideCartMagentoCartItemTransforms, daffProvideCartMagentoCartTransforms, getBillingAddress, getCart, getSelectedPaymentMethod, getSelectedShippingMethod, getShippingAddress, listCartCoupons, listCartItems, listPaymentMethods, listShippingMethods, magentoCartUserError, magentoMergeCartsMutation, placeOrder, pricesFragment, removeAllCoupons, removeCartItem, selectedPaymentMethodFragment, selectedShippingMethodFragment, setSelectedPaymentMethod, setSelectedPaymentMethodWithBilling, setSelectedPaymentMethodWithBillingAndEmail, setSelectedShippingMethod, transformMagentoCartGraphQlError, updateAddress, updateAddressWithEmail, updateBillingAddress, updateBillingAddressWithEmail, updateCartItem, updateShippingAddress, updateShippingAddressWithEmail };
|
|
2306
|
-
//# sourceMappingURL=daffodil-cart-driver-magento.mjs.map
|