@daffodil/order 0.39.11 → 0.40.1
Sign up to get free protection for your applications and to get access to all the features.
- package/daffodil-order.d.ts +1 -0
- package/driver/daffodil-order-driver.d.ts +1 -0
- package/driver/in-memory/backend/order.service.d.ts +3 -0
- package/driver/in-memory/daffodil-order-driver-in-memory.d.ts +1 -0
- package/driver/in-memory/drivers/order-driver.module.d.ts +5 -0
- package/driver/in-memory/drivers/order.service.d.ts +3 -0
- package/driver/in-memory/package.json +5 -6
- package/driver/magento/2.4.0/README.md +5 -0
- package/driver/magento/2.4.0/daffodil-order-driver-magento-2.4.0.d.ts +1 -0
- package/driver/magento/2.4.0/errors/transform.d.ts +1 -1
- package/driver/magento/2.4.0/order-driver.module.d.ts +5 -0
- package/driver/magento/2.4.0/order.service.d.ts +4 -1
- package/driver/magento/2.4.0/package.json +5 -6
- package/driver/magento/2.4.0/queries/fragments/order-address.d.ts +1 -1
- package/driver/magento/2.4.0/queries/fragments/order-invoice.d.ts +1 -1
- package/driver/magento/2.4.0/queries/fragments/order-item.d.ts +1 -1
- package/driver/magento/2.4.0/queries/fragments/order-payment.d.ts +1 -1
- package/driver/magento/2.4.0/queries/fragments/order-shipment-item.d.ts +1 -1
- package/driver/magento/2.4.0/queries/fragments/order-shipment-tracking.d.ts +1 -1
- package/driver/magento/2.4.0/queries/fragments/order-shipment.d.ts +1 -1
- package/driver/magento/2.4.0/queries/fragments/order.d.ts +1 -1
- package/driver/magento/2.4.0/queries/get-guest-orders.d.ts +1 -1
- package/driver/magento/2.4.1/README.md +5 -0
- package/driver/magento/2.4.1/daffodil-order-driver-magento-2.4.1.d.ts +1 -0
- package/driver/magento/2.4.1/errors/transform.d.ts +1 -1
- package/driver/magento/2.4.1/models/responses/order-address.d.ts +1 -1
- package/driver/magento/2.4.1/order-driver.module.d.ts +5 -0
- package/driver/magento/2.4.1/order.service.d.ts +4 -1
- package/driver/magento/2.4.1/package.json +5 -6
- package/driver/magento/2.4.1/queries/fragments/order-address.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order-credit-item.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order-credit-total.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order-credit.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order-invoice-item.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order-invoice-total.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order-invoice.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order-item.d.ts +2 -2
- package/driver/magento/2.4.1/queries/fragments/order-payment.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order-shipment-item.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order-shipment-tracking.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order-shipment.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order-total.d.ts +1 -1
- package/driver/magento/2.4.1/queries/fragments/order.d.ts +1 -1
- package/driver/magento/2.4.1/queries/get-guest-orders.d.ts +1 -1
- package/driver/package.json +5 -6
- package/driver/testing/daffodil-order-driver-testing.d.ts +1 -0
- package/driver/testing/drivers/order-driver.module.d.ts +5 -0
- package/driver/testing/drivers/order.service.d.ts +3 -0
- package/driver/testing/package.json +5 -6
- package/{esm2015/daffodil-order.js → esm2020/daffodil-order.mjs} +0 -0
- package/{esm2015/driver/daffodil-order-driver.js → esm2020/driver/daffodil-order-driver.mjs} +0 -0
- package/{esm2015/driver/errors/invalid-api-response.js → esm2020/driver/errors/invalid-api-response.mjs} +0 -0
- package/{esm2015/driver/errors/order-not-found.js → esm2020/driver/errors/order-not-found.mjs} +0 -0
- package/{esm2015/driver/errors/public_api.js → esm2020/driver/errors/public_api.mjs} +0 -0
- package/esm2020/driver/in-memory/backend/order.service.mjs +57 -0
- package/{esm2015/driver/in-memory/daffodil-order-driver-in-memory.js → esm2020/driver/in-memory/daffodil-order-driver-in-memory.mjs} +0 -0
- package/esm2020/driver/in-memory/drivers/order-driver.module.mjs +32 -0
- package/esm2020/driver/in-memory/drivers/order.service.mjs +28 -0
- package/{esm2015/driver/in-memory/drivers/public_api.js → esm2020/driver/in-memory/drivers/public_api.mjs} +0 -0
- package/{esm2015/driver/in-memory/index.js → esm2020/driver/in-memory/index.mjs} +0 -0
- package/{esm2015/driver/in-memory/public_api.js → esm2020/driver/in-memory/public_api.mjs} +0 -0
- package/{esm2015/driver/index.js → esm2020/driver/index.mjs} +0 -0
- package/{esm2015/driver/interfaces/order-service.interface.js → esm2020/driver/interfaces/order-service.interface.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/daffodil-order-driver-magento-2.4.0.js → esm2020/driver/magento/2.4.0/daffodil-order-driver-magento-2.4.0.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/errors/codes.js → esm2020/driver/magento/2.4.0/errors/codes.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/errors/map.js → esm2020/driver/magento/2.4.0/errors/map.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/errors/transform.js → esm2020/driver/magento/2.4.0/errors/transform.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/index.js → esm2020/driver/magento/2.4.0/index.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/injection-tokens/fragments/order.js → esm2020/driver/magento/2.4.0/injection-tokens/fragments/order.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/injection-tokens/public_api.js → esm2020/driver/magento/2.4.0/injection-tokens/public_api.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/models/responses/order-address.js → esm2020/driver/magento/2.4.0/models/responses/order-address.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/models/responses/order-invoice.js → esm2020/driver/magento/2.4.0/models/responses/order-invoice.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/models/responses/order-item.js → esm2020/driver/magento/2.4.0/models/responses/order-item.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/models/responses/order-payment.js → esm2020/driver/magento/2.4.0/models/responses/order-payment.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/models/responses/order-shipment-item.js → esm2020/driver/magento/2.4.0/models/responses/order-shipment-item.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/models/responses/order-shipment-tracking.js → esm2020/driver/magento/2.4.0/models/responses/order-shipment-tracking.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/models/responses/order-shipment.js → esm2020/driver/magento/2.4.0/models/responses/order-shipment.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/models/responses/order.js → esm2020/driver/magento/2.4.0/models/responses/order.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/models/responses/public_api.js → esm2020/driver/magento/2.4.0/models/responses/public_api.mjs} +0 -0
- package/esm2020/driver/magento/2.4.0/order-driver.module.mjs +32 -0
- package/esm2020/driver/magento/2.4.0/order.service.mjs +54 -0
- package/{esm2015/driver/magento/2.4.0/public_api.js → esm2020/driver/magento/2.4.0/public_api.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/queries/fragments/order-address.js → esm2020/driver/magento/2.4.0/queries/fragments/order-address.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.0/queries/fragments/order-invoice.js → esm2020/driver/magento/2.4.0/queries/fragments/order-invoice.mjs} +2 -2
- package/esm2020/driver/magento/2.4.0/queries/fragments/order-item.mjs +27 -0
- package/{esm2015/driver/magento/2.4.0/queries/fragments/order-payment.js → esm2020/driver/magento/2.4.0/queries/fragments/order-payment.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.0/queries/fragments/order-shipment-item.js → esm2020/driver/magento/2.4.0/queries/fragments/order-shipment-item.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.0/queries/fragments/order-shipment-tracking.js → esm2020/driver/magento/2.4.0/queries/fragments/order-shipment-tracking.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.0/queries/fragments/order-shipment.js → esm2020/driver/magento/2.4.0/queries/fragments/order-shipment.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.0/queries/fragments/order.js → esm2020/driver/magento/2.4.0/queries/fragments/order.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.0/queries/fragments/public_api.js → esm2020/driver/magento/2.4.0/queries/fragments/public_api.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/queries/get-guest-orders.js → esm2020/driver/magento/2.4.0/queries/get-guest-orders.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.0/queries/public_api.js → esm2020/driver/magento/2.4.0/queries/public_api.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/queries/responses/get-guest-orders.js → esm2020/driver/magento/2.4.0/queries/responses/get-guest-orders.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/queries/responses/public_api.js → esm2020/driver/magento/2.4.0/queries/responses/public_api.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.0/transforms/responses/order.js → esm2020/driver/magento/2.4.0/transforms/responses/order.mjs} +0 -0
- package/esm2020/driver/magento/2.4.0/validators/get-orders.mjs +17 -0
- package/{esm2015/driver/magento/2.4.0/validators/public_api.js → esm2020/driver/magento/2.4.0/validators/public_api.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/daffodil-order-driver-magento-2.4.1.js → esm2020/driver/magento/2.4.1/daffodil-order-driver-magento-2.4.1.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/errors/codes.js → esm2020/driver/magento/2.4.1/errors/codes.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/errors/map.js → esm2020/driver/magento/2.4.1/errors/map.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/errors/transform.js → esm2020/driver/magento/2.4.1/errors/transform.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/index.js → esm2020/driver/magento/2.4.1/index.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/injection-tokens/fragments/order.js → esm2020/driver/magento/2.4.1/injection-tokens/fragments/order.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/injection-tokens/public_api.js → esm2020/driver/magento/2.4.1/injection-tokens/public_api.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/discount.js → esm2020/driver/magento/2.4.1/models/responses/discount.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/order-address.js → esm2020/driver/magento/2.4.1/models/responses/order-address.mjs} +1 -1
- package/{esm2015/driver/magento/2.4.1/models/responses/order-credit-item.js → esm2020/driver/magento/2.4.1/models/responses/order-credit-item.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/order-credit.js → esm2020/driver/magento/2.4.1/models/responses/order-credit.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/order-invoice-item.js → esm2020/driver/magento/2.4.1/models/responses/order-invoice-item.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/order-invoice.js → esm2020/driver/magento/2.4.1/models/responses/order-invoice.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/order-item.js → esm2020/driver/magento/2.4.1/models/responses/order-item.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/order-payment.js → esm2020/driver/magento/2.4.1/models/responses/order-payment.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/order-shipment-item.js → esm2020/driver/magento/2.4.1/models/responses/order-shipment-item.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/order-shipment-tracking.js → esm2020/driver/magento/2.4.1/models/responses/order-shipment-tracking.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/order-shipment.js → esm2020/driver/magento/2.4.1/models/responses/order-shipment.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/order-total.js → esm2020/driver/magento/2.4.1/models/responses/order-total.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/order.js → esm2020/driver/magento/2.4.1/models/responses/order.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/models/responses/public_api.js → esm2020/driver/magento/2.4.1/models/responses/public_api.mjs} +0 -0
- package/esm2020/driver/magento/2.4.1/order-driver.module.mjs +32 -0
- package/esm2020/driver/magento/2.4.1/order.service.mjs +54 -0
- package/{esm2015/driver/magento/2.4.1/public_api.js → esm2020/driver/magento/2.4.1/public_api.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-address.js → esm2020/driver/magento/2.4.1/queries/fragments/order-address.mjs} +3 -3
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-credit-item.js → esm2020/driver/magento/2.4.1/queries/fragments/order-credit-item.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-credit-total.js → esm2020/driver/magento/2.4.1/queries/fragments/order-credit-total.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-credit.js → esm2020/driver/magento/2.4.1/queries/fragments/order-credit.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-invoice-item.js → esm2020/driver/magento/2.4.1/queries/fragments/order-invoice-item.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-invoice-total.js → esm2020/driver/magento/2.4.1/queries/fragments/order-invoice-total.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-invoice.js → esm2020/driver/magento/2.4.1/queries/fragments/order-invoice.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-item.js → esm2020/driver/magento/2.4.1/queries/fragments/order-item.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-payment.js → esm2020/driver/magento/2.4.1/queries/fragments/order-payment.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-shipment-item.js → esm2020/driver/magento/2.4.1/queries/fragments/order-shipment-item.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-shipment-tracking.js → esm2020/driver/magento/2.4.1/queries/fragments/order-shipment-tracking.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-shipment.js → esm2020/driver/magento/2.4.1/queries/fragments/order-shipment.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order-total.js → esm2020/driver/magento/2.4.1/queries/fragments/order-total.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/order.js → esm2020/driver/magento/2.4.1/queries/fragments/order.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/fragments/public_api.js → esm2020/driver/magento/2.4.1/queries/fragments/public_api.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/queries/get-guest-orders.js → esm2020/driver/magento/2.4.1/queries/get-guest-orders.mjs} +2 -2
- package/{esm2015/driver/magento/2.4.1/queries/public_api.js → esm2020/driver/magento/2.4.1/queries/public_api.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/queries/responses/get-guest-orders.js → esm2020/driver/magento/2.4.1/queries/responses/get-guest-orders.mjs} +0 -0
- package/{esm2015/driver/magento/2.4.1/queries/responses/public_api.js → esm2020/driver/magento/2.4.1/queries/responses/public_api.mjs} +0 -0
- package/esm2020/driver/magento/2.4.1/transforms/responses/order.mjs +234 -0
- package/esm2020/driver/magento/2.4.1/validators/get-orders.mjs +17 -0
- package/{esm2015/driver/magento/2.4.1/validators/public_api.js → esm2020/driver/magento/2.4.1/validators/public_api.mjs} +0 -0
- package/{esm2015/driver/testing/daffodil-order-driver-testing.js → esm2020/driver/testing/daffodil-order-driver-testing.mjs} +0 -0
- package/esm2020/driver/testing/drivers/order-driver.module.mjs +32 -0
- package/esm2020/driver/testing/drivers/order.service.mjs +28 -0
- package/{esm2015/driver/testing/drivers/public_api.js → esm2020/driver/testing/drivers/public_api.mjs} +0 -0
- package/{esm2015/driver/testing/index.js → esm2020/driver/testing/index.mjs} +0 -0
- package/{esm2015/driver/testing/public_api.js → esm2020/driver/testing/public_api.mjs} +0 -0
- package/{esm2015/index.js → esm2020/index.mjs} +0 -0
- package/{esm2015/injection-tokens/error-matcher.token.js → esm2020/injection-tokens/error-matcher.token.mjs} +0 -0
- package/{esm2015/injection-tokens/public_api.js → esm2020/injection-tokens/public_api.mjs} +0 -0
- package/{esm2015/models/composite-order-item.js → esm2020/models/composite-order-item.mjs} +0 -0
- package/{esm2015/models/configurable-order-item.js → esm2020/models/configurable-order-item.mjs} +0 -0
- package/{esm2015/models/order-address.js → esm2020/models/order-address.mjs} +0 -0
- package/{esm2015/models/order-coupon.js → esm2020/models/order-coupon.mjs} +0 -0
- package/{esm2015/models/order-credit.js → esm2020/models/order-credit.mjs} +0 -0
- package/{esm2015/models/order-invoice.js → esm2020/models/order-invoice.mjs} +0 -0
- package/{esm2015/models/order-item.js → esm2020/models/order-item.mjs} +0 -0
- package/{esm2015/models/order-payment.js → esm2020/models/order-payment.mjs} +0 -0
- package/{esm2015/models/order-shipment-item.js → esm2020/models/order-shipment-item.mjs} +0 -0
- package/{esm2015/models/order-shipment-tracking.js → esm2020/models/order-shipment-tracking.mjs} +0 -0
- package/{esm2015/models/order-shipment.js → esm2020/models/order-shipment.mjs} +0 -0
- package/{esm2015/models/order-shipping-method.js → esm2020/models/order-shipping-method.mjs} +0 -0
- package/{esm2015/models/order-total.js → esm2020/models/order-total.mjs} +0 -0
- package/{esm2015/models/order.js → esm2020/models/order.mjs} +0 -0
- package/{esm2015/models/public_api.js → esm2020/models/public_api.mjs} +0 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
- package/{esm2015/routing/daffodil-order-routing.js → esm2020/routing/daffodil-order-routing.mjs} +0 -0
- package/{esm2015/routing/guards/placed-order/placed-order-guard-redirect.token.js → esm2020/routing/guards/placed-order/placed-order-guard-redirect.token.mjs} +0 -0
- package/esm2020/routing/guards/placed-order/placed-order.guard.mjs +38 -0
- package/{esm2015/routing/guards/public_api.js → esm2020/routing/guards/public_api.mjs} +0 -0
- package/{esm2015/routing/index.js → esm2020/routing/index.mjs} +0 -0
- package/esm2020/routing/order-routing.module.mjs +19 -0
- package/{esm2015/routing/public_api.js → esm2020/routing/public_api.mjs} +0 -0
- package/{esm2015/state/actions/order.actions.js → esm2020/state/actions/order.actions.mjs} +0 -0
- package/esm2020/state/daffodil-order-state.mjs +5 -0
- package/esm2020/state/effects/order.effects.mjs +36 -0
- package/{esm2015/state/facades/order/order-facade.interface.js → esm2020/state/facades/order/order-facade.interface.mjs} +0 -0
- package/{esm2015/state/facades/order/order.facade.js → esm2020/state/facades/order/order.facade.mjs} +9 -11
- package/{esm2015/state/facades/public_api.js → esm2020/state/facades/public_api.mjs} +0 -0
- package/{esm2015/state/index.js → esm2020/state/index.mjs} +0 -0
- package/esm2020/state/order-state.module.mjs +33 -0
- package/{esm2015/state/public_api.js → esm2020/state/public_api.mjs} +0 -0
- package/{esm2015/state/reducers/order/order-initial-state.js → esm2020/state/reducers/order/order-initial-state.mjs} +0 -0
- package/{esm2015/state/reducers/order/order-reducer.interface.js → esm2020/state/reducers/order/order-reducer.interface.mjs} +0 -0
- package/esm2020/state/reducers/order/order.reducer.mjs +32 -0
- package/{esm2015/state/reducers/order/public_api.js → esm2020/state/reducers/order/public_api.mjs} +0 -0
- package/{esm2015/state/reducers/order-entities/order-entities-adapter.js → esm2020/state/reducers/order-entities/order-entities-adapter.mjs} +5 -7
- package/{esm2015/state/reducers/order-entities/order-entities-initial-state.js → esm2020/state/reducers/order-entities/order-entities-initial-state.mjs} +0 -0
- package/{esm2015/state/reducers/order-entities/order-entities-state.interface.js → esm2020/state/reducers/order-entities/order-entities-state.interface.mjs} +0 -0
- package/{esm2015/state/reducers/order-entities/order-entities.reducer.js → esm2020/state/reducers/order-entities/order-entities.reducer.mjs} +0 -0
- package/{esm2015/state/reducers/order-entities/public_api.js → esm2020/state/reducers/order-entities/public_api.mjs} +0 -0
- package/{esm2015/state/reducers/order-reducers.interface.js → esm2020/state/reducers/order-reducers.interface.mjs} +0 -0
- package/{esm2015/state/reducers/order-reducers.js → esm2020/state/reducers/order-reducers.mjs} +0 -0
- package/{esm2015/state/reducers/order-store-feature-key.js → esm2020/state/reducers/order-store-feature-key.mjs} +0 -0
- package/{esm2015/state/reducers/public_api.js → esm2020/state/reducers/public_api.mjs} +0 -0
- package/esm2020/state/selectors/order-all.selector.mjs +12 -0
- package/esm2020/state/selectors/order-entities.selector.mjs +76 -0
- package/esm2020/state/selectors/order-feature.selector.mjs +9 -0
- package/esm2020/state/selectors/order.selector.mjs +18 -0
- package/{esm2015/state/selectors/public_api.js → esm2020/state/selectors/public_api.mjs} +0 -0
- package/{esm2015/state/testing/daffodil-order-state-testing.js → esm2020/state/testing/daffodil-order-state-testing.mjs} +0 -0
- package/{esm2015/state/testing/index.js → esm2020/state/testing/index.mjs} +0 -0
- package/esm2020/state/testing/mock-order-facade.mjs +81 -0
- package/esm2020/state/testing/order-testing.module.mjs +20 -0
- package/{esm2015/state/testing/public_api.js → esm2020/state/testing/public_api.mjs} +0 -0
- package/{esm2015/testing/daffodil-order-testing.js → esm2020/testing/daffodil-order-testing.mjs} +0 -0
- package/esm2020/testing/factories/composite-order-item.factory.mjs +36 -0
- package/esm2020/testing/factories/configurable-order-item.factory.mjs +35 -0
- package/esm2020/testing/factories/order-address.factory.mjs +25 -0
- package/esm2020/testing/factories/order-coupon.factory.mjs +24 -0
- package/esm2020/testing/factories/order-invoice.factory.mjs +28 -0
- package/{esm2015/testing/factories/order-item.factory.js → esm2020/testing/factories/order-item.factory.mjs} +9 -9
- package/{esm2015/testing/factories/order-payment.factory.js → esm2020/testing/factories/order-payment.factory.mjs} +9 -9
- package/esm2020/testing/factories/order-shipment-item.factory.mjs +25 -0
- package/esm2020/testing/factories/order-shipment-tracking.factory.mjs +28 -0
- package/esm2020/testing/factories/order-shipment.factory.mjs +30 -0
- package/{esm2015/testing/factories/order-shipping-rate.factory.js → esm2020/testing/factories/order-shipping-rate.factory.mjs} +9 -9
- package/esm2020/testing/factories/order-total.factory.mjs +28 -0
- package/{esm2015/testing/factories/order.factory.js → esm2020/testing/factories/order.factory.mjs} +9 -9
- package/{esm2015/testing/factories/public_api.js → esm2020/testing/factories/public_api.mjs} +0 -0
- package/{esm2015/testing/helpers/order-helper.js → esm2020/testing/helpers/order-helper.mjs} +0 -0
- package/{esm2015/testing/helpers/public_api.js → esm2020/testing/helpers/public_api.mjs} +0 -0
- package/{esm2015/testing/index.js → esm2020/testing/index.mjs} +0 -0
- package/{esm2015/testing/public_api.js → esm2020/testing/public_api.mjs} +0 -0
- package/fesm2015/daffodil-order-driver-in-memory.mjs +117 -0
- package/fesm2015/daffodil-order-driver-in-memory.mjs.map +1 -0
- package/fesm2015/{daffodil-order-driver-magento-2.4.0.js → daffodil-order-driver-magento-2.4.0.mjs} +31 -21
- package/fesm2015/daffodil-order-driver-magento-2.4.0.mjs.map +1 -0
- package/fesm2015/{daffodil-order-driver-magento-2.4.1.js → daffodil-order-driver-magento-2.4.1.mjs} +33 -23
- package/fesm2015/daffodil-order-driver-magento-2.4.1.mjs.map +1 -0
- package/fesm2015/daffodil-order-driver-testing.mjs +63 -0
- package/fesm2015/daffodil-order-driver-testing.mjs.map +1 -0
- package/fesm2015/{daffodil-order-driver.js → daffodil-order-driver.mjs} +1 -1
- package/fesm2015/daffodil-order-driver.mjs.map +1 -0
- package/fesm2015/daffodil-order-routing.mjs +62 -0
- package/fesm2015/daffodil-order-routing.mjs.map +1 -0
- package/fesm2015/{daffodil-order-state-testing.js → daffodil-order-state-testing.mjs} +22 -13
- package/fesm2015/daffodil-order-state-testing.mjs.map +1 -0
- package/fesm2015/{daffodil-order-state.js → daffodil-order-state.mjs} +64 -73
- package/fesm2015/daffodil-order-state.mjs.map +1 -0
- package/fesm2015/daffodil-order-testing.mjs +387 -0
- package/fesm2015/daffodil-order-testing.mjs.map +1 -0
- package/fesm2015/{daffodil-order.js → daffodil-order.mjs} +1 -1
- package/fesm2015/daffodil-order.mjs.map +1 -0
- package/fesm2020/daffodil-order-driver-in-memory.mjs +117 -0
- package/fesm2020/daffodil-order-driver-in-memory.mjs.map +1 -0
- package/fesm2020/daffodil-order-driver-magento-2.4.0.mjs +459 -0
- package/fesm2020/daffodil-order-driver-magento-2.4.0.mjs.map +1 -0
- package/fesm2020/daffodil-order-driver-magento-2.4.1.mjs +646 -0
- package/fesm2020/daffodil-order-driver-magento-2.4.1.mjs.map +1 -0
- package/fesm2020/daffodil-order-driver-testing.mjs +63 -0
- package/fesm2020/daffodil-order-driver-testing.mjs.map +1 -0
- package/fesm2020/daffodil-order-driver.mjs +27 -0
- package/fesm2020/daffodil-order-driver.mjs.map +1 -0
- package/fesm2020/daffodil-order-routing.mjs +60 -0
- package/fesm2020/daffodil-order-routing.mjs.map +1 -0
- package/fesm2020/daffodil-order-state-testing.mjs +105 -0
- package/fesm2020/daffodil-order-state-testing.mjs.map +1 -0
- package/fesm2020/daffodil-order-state.mjs +400 -0
- package/fesm2020/daffodil-order-state.mjs.map +1 -0
- package/fesm2020/daffodil-order-testing.mjs +387 -0
- package/fesm2020/daffodil-order-testing.mjs.map +1 -0
- package/fesm2020/daffodil-order.mjs +31 -0
- package/fesm2020/daffodil-order.mjs.map +1 -0
- package/package.json +98 -14
- package/routing/daffodil-order-routing.d.ts +1 -0
- package/routing/guards/placed-order/placed-order.guard.d.ts +3 -0
- package/routing/order-routing.module.d.ts +4 -0
- package/routing/package.json +5 -6
- package/state/daffodil-order-state.d.ts +1 -1
- package/state/effects/order.effects.d.ts +5 -2
- package/state/facades/order/order.facade.d.ts +3 -0
- package/state/order-state.module.d.ts +7 -0
- package/state/package.json +5 -6
- package/state/testing/daffodil-order-state-testing.d.ts +1 -0
- package/state/testing/mock-order-facade.d.ts +3 -0
- package/state/testing/order-testing.module.d.ts +4 -0
- package/state/testing/package.json +5 -6
- package/testing/daffodil-order-testing.d.ts +1 -0
- package/testing/factories/composite-order-item.factory.d.ts +3 -0
- package/testing/factories/configurable-order-item.factory.d.ts +3 -0
- package/testing/factories/order-address.factory.d.ts +3 -0
- package/testing/factories/order-coupon.factory.d.ts +3 -0
- package/testing/factories/order-invoice.factory.d.ts +3 -0
- package/testing/factories/order-item.factory.d.ts +3 -0
- package/testing/factories/order-payment.factory.d.ts +3 -0
- package/testing/factories/order-shipment-item.factory.d.ts +3 -0
- package/testing/factories/order-shipment-tracking.factory.d.ts +3 -0
- package/testing/factories/order-shipment.factory.d.ts +3 -0
- package/testing/factories/order-shipping-rate.factory.d.ts +3 -0
- package/testing/factories/order-total.factory.d.ts +3 -0
- package/testing/factories/order.factory.d.ts +3 -0
- package/testing/package.json +5 -6
- package/bundles/daffodil-order-driver-in-memory.umd.js +0 -125
- package/bundles/daffodil-order-driver-in-memory.umd.js.map +0 -1
- package/bundles/daffodil-order-driver-in-memory.umd.min.js +0 -2
- package/bundles/daffodil-order-driver-in-memory.umd.min.js.map +0 -1
- package/bundles/daffodil-order-driver-magento-2.4.0.umd.js +0 -657
- package/bundles/daffodil-order-driver-magento-2.4.0.umd.js.map +0 -1
- package/bundles/daffodil-order-driver-magento-2.4.0.umd.min.js +0 -16
- package/bundles/daffodil-order-driver-magento-2.4.0.umd.min.js.map +0 -1
- package/bundles/daffodil-order-driver-magento-2.4.1.umd.js +0 -737
- package/bundles/daffodil-order-driver-magento-2.4.1.umd.js.map +0 -1
- package/bundles/daffodil-order-driver-magento-2.4.1.umd.min.js +0 -2
- package/bundles/daffodil-order-driver-magento-2.4.1.umd.min.js.map +0 -1
- package/bundles/daffodil-order-driver-testing.umd.js +0 -67
- package/bundles/daffodil-order-driver-testing.umd.js.map +0 -1
- package/bundles/daffodil-order-driver-testing.umd.min.js +0 -2
- package/bundles/daffodil-order-driver-testing.umd.min.js.map +0 -1
- package/bundles/daffodil-order-driver.umd.js +0 -360
- package/bundles/daffodil-order-driver.umd.js.map +0 -1
- package/bundles/daffodil-order-driver.umd.min.js +0 -16
- package/bundles/daffodil-order-driver.umd.min.js.map +0 -1
- package/bundles/daffodil-order-routing.umd.js +0 -66
- package/bundles/daffodil-order-routing.umd.js.map +0 -1
- package/bundles/daffodil-order-routing.umd.min.js +0 -2
- package/bundles/daffodil-order-routing.umd.min.js.map +0 -1
- package/bundles/daffodil-order-state-testing.umd.js +0 -107
- package/bundles/daffodil-order-state-testing.umd.js.map +0 -1
- package/bundles/daffodil-order-state-testing.umd.min.js +0 -2
- package/bundles/daffodil-order-state-testing.umd.min.js.map +0 -1
- package/bundles/daffodil-order-state.umd.js +0 -748
- package/bundles/daffodil-order-state.umd.js.map +0 -1
- package/bundles/daffodil-order-state.umd.min.js +0 -16
- package/bundles/daffodil-order-state.umd.min.js.map +0 -1
- package/bundles/daffodil-order-testing.umd.js +0 -766
- package/bundles/daffodil-order-testing.umd.js.map +0 -1
- package/bundles/daffodil-order-testing.umd.min.js +0 -16
- package/bundles/daffodil-order-testing.umd.min.js.map +0 -1
- package/bundles/daffodil-order.umd.js +0 -36
- package/bundles/daffodil-order.umd.js.map +0 -1
- package/bundles/daffodil-order.umd.min.js +0 -2
- package/bundles/daffodil-order.umd.min.js.map +0 -1
- package/daffodil-order.metadata.json +0 -1
- package/driver/daffodil-order-driver.metadata.json +0 -1
- package/driver/in-memory/daffodil-order-driver-in-memory.metadata.json +0 -1
- package/driver/magento/2.4.0/daffodil-order-driver-magento-2.4.0.metadata.json +0 -1
- package/driver/magento/2.4.1/daffodil-order-driver-magento-2.4.1.metadata.json +0 -1
- package/driver/testing/daffodil-order-driver-testing.metadata.json +0 -1
- package/esm2015/driver/in-memory/backend/order.service.js +0 -59
- package/esm2015/driver/in-memory/drivers/order-driver.module.js +0 -25
- package/esm2015/driver/in-memory/drivers/order.service.js +0 -30
- package/esm2015/driver/magento/2.4.0/order-driver.module.js +0 -25
- package/esm2015/driver/magento/2.4.0/order.service.js +0 -55
- package/esm2015/driver/magento/2.4.0/queries/fragments/order-item.js +0 -27
- package/esm2015/driver/magento/2.4.0/validators/get-orders.js +0 -18
- package/esm2015/driver/magento/2.4.1/order-driver.module.js +0 -25
- package/esm2015/driver/magento/2.4.1/order.service.js +0 -55
- package/esm2015/driver/magento/2.4.1/transforms/responses/order.js +0 -207
- package/esm2015/driver/magento/2.4.1/validators/get-orders.js +0 -18
- package/esm2015/driver/testing/drivers/order-driver.module.js +0 -25
- package/esm2015/driver/testing/drivers/order.service.js +0 -30
- package/esm2015/routing/guards/placed-order/placed-order.guard.js +0 -40
- package/esm2015/routing/order-routing.module.js +0 -12
- package/esm2015/state/daffodil-order-state.js +0 -6
- package/esm2015/state/effects/order.effects.js +0 -49
- package/esm2015/state/order-state.module.js +0 -20
- package/esm2015/state/reducers/order/order.reducer.js +0 -21
- package/esm2015/state/selectors/order-all.selector.js +0 -10
- package/esm2015/state/selectors/order-entities.selector.js +0 -79
- package/esm2015/state/selectors/order-feature.selector.js +0 -11
- package/esm2015/state/selectors/order.selector.js +0 -21
- package/esm2015/state/testing/mock-order-facade.js +0 -79
- package/esm2015/state/testing/order-testing.module.js +0 -13
- package/esm2015/testing/factories/composite-order-item.factory.js +0 -36
- package/esm2015/testing/factories/configurable-order-item.factory.js +0 -35
- package/esm2015/testing/factories/order-address.factory.js +0 -25
- package/esm2015/testing/factories/order-coupon.factory.js +0 -24
- package/esm2015/testing/factories/order-invoice.factory.js +0 -28
- package/esm2015/testing/factories/order-shipment-item.factory.js +0 -25
- package/esm2015/testing/factories/order-shipment-tracking.factory.js +0 -28
- package/esm2015/testing/factories/order-shipment.factory.js +0 -30
- package/esm2015/testing/factories/order-total.factory.js +0 -28
- package/fesm2015/daffodil-order-driver-in-memory.js +0 -114
- package/fesm2015/daffodil-order-driver-in-memory.js.map +0 -1
- package/fesm2015/daffodil-order-driver-magento-2.4.0.js.map +0 -1
- package/fesm2015/daffodil-order-driver-magento-2.4.1.js.map +0 -1
- package/fesm2015/daffodil-order-driver-testing.js +0 -58
- package/fesm2015/daffodil-order-driver-testing.js.map +0 -1
- package/fesm2015/daffodil-order-driver.js.map +0 -1
- package/fesm2015/daffodil-order-routing.js +0 -54
- package/fesm2015/daffodil-order-routing.js.map +0 -1
- package/fesm2015/daffodil-order-state-testing.js.map +0 -1
- package/fesm2015/daffodil-order-state.js.map +0 -1
- package/fesm2015/daffodil-order-testing.js +0 -386
- package/fesm2015/daffodil-order-testing.js.map +0 -1
- package/fesm2015/daffodil-order.js.map +0 -1
- package/routing/daffodil-order-routing.metadata.json +0 -1
- package/state/daffodil-order-state.metadata.json +0 -1
- package/state/testing/daffodil-order-state-testing.metadata.json +0 -1
- package/testing/daffodil-order-testing.metadata.json +0 -1
@@ -0,0 +1,646 @@
|
|
1
|
+
import { daffAdd, daffSubtract } from '@daffodil/core';
|
2
|
+
import { DaffOrderTotalTypeEnum, DaffOrderItemType } from '@daffodil/order';
|
3
|
+
import * as i1 from '@damienwebdev/apollo-angular';
|
4
|
+
import { gql } from '@damienwebdev/apollo-angular';
|
5
|
+
import { daffBuildFragmentNameSpread, daffBuildFragmentDefinition } from '@daffodil/core/graphql';
|
6
|
+
import * as i0 from '@angular/core';
|
7
|
+
import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
|
8
|
+
import { throwError } from 'rxjs';
|
9
|
+
import { map, catchError } from 'rxjs/operators';
|
10
|
+
import { DaffOrderInvalidAPIResponseError, DaffOrderNotFoundError, DaffOrderDriver } from '@daffodil/order/driver';
|
11
|
+
import { daffTransformMagentoError } from '@daffodil/driver/magento';
|
12
|
+
import { DaffCartNotFoundError } from '@daffodil/cart/driver';
|
13
|
+
import { CommonModule } from '@angular/common';
|
14
|
+
|
15
|
+
var MagentoOrderItemType;
|
16
|
+
(function (MagentoOrderItemType) {
|
17
|
+
MagentoOrderItemType["Simple"] = "simple";
|
18
|
+
MagentoOrderItemType["Configurable"] = "configurable";
|
19
|
+
MagentoOrderItemType["Bundle"] = "bundle";
|
20
|
+
})(MagentoOrderItemType || (MagentoOrderItemType = {}));
|
21
|
+
;
|
22
|
+
;
|
23
|
+
;
|
24
|
+
;
|
25
|
+
;
|
26
|
+
|
27
|
+
function transformTotals(totals) {
|
28
|
+
return [
|
29
|
+
{
|
30
|
+
label: 'Grand Total',
|
31
|
+
type: DaffOrderTotalTypeEnum.GrandTotal,
|
32
|
+
value: totals.grand_total.value,
|
33
|
+
sort_order: 1,
|
34
|
+
},
|
35
|
+
{
|
36
|
+
label: 'Subtotal',
|
37
|
+
type: DaffOrderTotalTypeEnum.Subtotal,
|
38
|
+
value: totals.subtotal.value,
|
39
|
+
sort_order: 0,
|
40
|
+
},
|
41
|
+
{
|
42
|
+
label: 'Shipping',
|
43
|
+
type: DaffOrderTotalTypeEnum.Shipping,
|
44
|
+
value: totals.total_shipping.value,
|
45
|
+
sort_order: 2,
|
46
|
+
},
|
47
|
+
{
|
48
|
+
label: 'Tax',
|
49
|
+
type: DaffOrderTotalTypeEnum.Tax,
|
50
|
+
value: totals.total_tax.value,
|
51
|
+
sort_order: 3,
|
52
|
+
},
|
53
|
+
{
|
54
|
+
label: 'Discount',
|
55
|
+
type: DaffOrderTotalTypeEnum.Discount,
|
56
|
+
value: totals.discounts.reduce((acc, discount) => daffAdd(acc, discount.amount.value), 0),
|
57
|
+
sort_order: 4,
|
58
|
+
},
|
59
|
+
];
|
60
|
+
}
|
61
|
+
function transformCouponDiscount(discount) {
|
62
|
+
return {
|
63
|
+
code: discount.label,
|
64
|
+
};
|
65
|
+
}
|
66
|
+
function transformConfigurableOption(option) {
|
67
|
+
return {
|
68
|
+
attribute_label: option.label,
|
69
|
+
value_label: option.value,
|
70
|
+
};
|
71
|
+
}
|
72
|
+
function transformBundleOption(option) {
|
73
|
+
return {
|
74
|
+
option_label: option.label,
|
75
|
+
value_label: option.values && option.values[0] && option.values[0].product_name,
|
76
|
+
};
|
77
|
+
}
|
78
|
+
function transformAdditionalItemFields(item) {
|
79
|
+
switch (item.product_type) {
|
80
|
+
case MagentoOrderItemType.Bundle:
|
81
|
+
return {
|
82
|
+
type: DaffOrderItemType.Composite,
|
83
|
+
options: item.bundle_options.map(transformBundleOption),
|
84
|
+
};
|
85
|
+
case MagentoOrderItemType.Configurable:
|
86
|
+
return {
|
87
|
+
type: DaffOrderItemType.Configurable,
|
88
|
+
attributes: item.selected_options.map(transformConfigurableOption),
|
89
|
+
};
|
90
|
+
case MagentoOrderItemType.Simple:
|
91
|
+
return {
|
92
|
+
type: DaffOrderItemType.Simple,
|
93
|
+
};
|
94
|
+
default:
|
95
|
+
return {};
|
96
|
+
}
|
97
|
+
}
|
98
|
+
function transformItem(item, order, qty) {
|
99
|
+
const discount = item.discounts.reduce((acc, d) => daffAdd(acc, d.amount.value), 0);
|
100
|
+
const rowTotal = qty * item.product_sale_price.value;
|
101
|
+
const rowTotalWithDiscount = qty * daffSubtract(item.product_sale_price.value, discount);
|
102
|
+
return {
|
103
|
+
type: DaffOrderItemType.Simple,
|
104
|
+
id: null,
|
105
|
+
item_id: null,
|
106
|
+
qty_ordered: item.quantity_ordered,
|
107
|
+
qty_canceled: item.quantity_canceled,
|
108
|
+
qty_fulfilled: item.quantity_shipped,
|
109
|
+
qty,
|
110
|
+
image: {
|
111
|
+
url: item.product_url_key,
|
112
|
+
id: null,
|
113
|
+
label: null,
|
114
|
+
},
|
115
|
+
order_id: order.id,
|
116
|
+
created_at: null,
|
117
|
+
updated_at: null,
|
118
|
+
product_id: null,
|
119
|
+
parent_item_id: null,
|
120
|
+
sku: item.product_sku,
|
121
|
+
name: item.product_name,
|
122
|
+
weight: null,
|
123
|
+
price: item.product_sale_price.value,
|
124
|
+
discount_percent: Math.floor(discount / item.product_sale_price.value * 100),
|
125
|
+
discount_amount: discount,
|
126
|
+
tax_percent: null,
|
127
|
+
tax_amount: null,
|
128
|
+
row_total: rowTotal,
|
129
|
+
row_total_with_discount: rowTotalWithDiscount,
|
130
|
+
row_weight: null,
|
131
|
+
tax_before_discount: null,
|
132
|
+
...transformAdditionalItemFields(item),
|
133
|
+
};
|
134
|
+
}
|
135
|
+
function transformAddress(address, order) {
|
136
|
+
return {
|
137
|
+
order_id: order.id,
|
138
|
+
prefix: address.prefix,
|
139
|
+
suffix: address.suffix,
|
140
|
+
firstname: address.firstname,
|
141
|
+
middlename: address.middlename,
|
142
|
+
lastname: address.lastname,
|
143
|
+
telephone: address.telephone,
|
144
|
+
email: null,
|
145
|
+
street: address.street[0],
|
146
|
+
street2: address.street[1],
|
147
|
+
city: address.city,
|
148
|
+
region: address.region_code,
|
149
|
+
country: address.country_code,
|
150
|
+
postcode: address.postcode,
|
151
|
+
};
|
152
|
+
}
|
153
|
+
function transformShipmentItem(shipmentItem, order) {
|
154
|
+
return {
|
155
|
+
item: transformItem(shipmentItem.order_item, order, shipmentItem.quantity_shipped),
|
156
|
+
qty: shipmentItem.quantity_shipped,
|
157
|
+
};
|
158
|
+
}
|
159
|
+
function transformShipmentTracking(tracking) {
|
160
|
+
return {
|
161
|
+
tracking_number: tracking.number,
|
162
|
+
tracking_url: null,
|
163
|
+
carrier: tracking.carrier,
|
164
|
+
title: tracking.title,
|
165
|
+
carrier_logo: null,
|
166
|
+
};
|
167
|
+
}
|
168
|
+
function transformShipment(shipment, order) {
|
169
|
+
return {
|
170
|
+
carrier: order.carrier,
|
171
|
+
carrier_title: null,
|
172
|
+
code: null,
|
173
|
+
method: order.shipping_method,
|
174
|
+
method_description: null,
|
175
|
+
tracking: shipment.tracking.map(transformShipmentTracking),
|
176
|
+
items: shipment.items.map(item => transformShipmentItem(item, order)),
|
177
|
+
};
|
178
|
+
}
|
179
|
+
function transformPayment(payment, order) {
|
180
|
+
const findAdditionalData = key => {
|
181
|
+
const index = payment.additional_data.findIndex(({ name }) => name === key);
|
182
|
+
return index > -1 ? payment.additional_data[index].value : null;
|
183
|
+
};
|
184
|
+
return {
|
185
|
+
id: null,
|
186
|
+
payment_id: null,
|
187
|
+
order_id: order.id,
|
188
|
+
created_at: null,
|
189
|
+
updated_at: null,
|
190
|
+
method: payment.type,
|
191
|
+
cc_type: findAdditionalData('cc_type'),
|
192
|
+
cc_last4: findAdditionalData('cc_last4'),
|
193
|
+
cc_owner: findAdditionalData('cc_owner'),
|
194
|
+
cc_exp_month: findAdditionalData('cc_exp_month'),
|
195
|
+
cc_exp_year: findAdditionalData('cc_exp_year'),
|
196
|
+
};
|
197
|
+
}
|
198
|
+
function transformInvoiceItem(invoiceItem, order) {
|
199
|
+
return {
|
200
|
+
item: transformItem(invoiceItem.order_item, order, invoiceItem.quantity_invoiced),
|
201
|
+
qty: invoiceItem.quantity_invoiced,
|
202
|
+
};
|
203
|
+
}
|
204
|
+
function transformInvoice(invoice, order, payment) {
|
205
|
+
return {
|
206
|
+
totals: transformTotals(invoice.total),
|
207
|
+
billing_address: transformAddress(order.billing_address, order),
|
208
|
+
shipping_address: transformAddress(order.shipping_address, order),
|
209
|
+
payment: transformPayment(payment, order),
|
210
|
+
items: invoice.items.map(item => transformInvoiceItem(item, order)),
|
211
|
+
shipping_method: null,
|
212
|
+
};
|
213
|
+
}
|
214
|
+
function transformCreditItem(creditItem, order) {
|
215
|
+
return {
|
216
|
+
item: transformItem(creditItem.order_item, order, creditItem.quantity_refunded),
|
217
|
+
qty: creditItem.quantity_refunded,
|
218
|
+
};
|
219
|
+
}
|
220
|
+
function transformCredit(credit, order) {
|
221
|
+
return {
|
222
|
+
totals: transformTotals(credit.total),
|
223
|
+
billing_address: transformAddress(order.billing_address, order),
|
224
|
+
shipping_address: transformAddress(order.shipping_address, order),
|
225
|
+
payment: transformPayment(order.payment_methods[0], order),
|
226
|
+
items: credit.items.map(item => transformCreditItem(item, order)),
|
227
|
+
shipping_method: null,
|
228
|
+
};
|
229
|
+
}
|
230
|
+
/**
|
231
|
+
* Transforms the MagentoOrder from the magento order query into a DaffOrder.
|
232
|
+
*/
|
233
|
+
function daffMagentoTransformOrder(order) {
|
234
|
+
return {
|
235
|
+
extra_attributes: order,
|
236
|
+
id: order.number,
|
237
|
+
customer_id: null,
|
238
|
+
updated_at: null,
|
239
|
+
created_at: order.order_date,
|
240
|
+
status: order.status,
|
241
|
+
totals: transformTotals(order.total),
|
242
|
+
applied_codes: order.total.discounts.map(transformCouponDiscount),
|
243
|
+
items: order.items.map(item => transformItem(item, order, item.quantity_ordered)),
|
244
|
+
billing_addresses: [
|
245
|
+
transformAddress(order.billing_address, order),
|
246
|
+
],
|
247
|
+
shipping_addresses: [
|
248
|
+
transformAddress(order.shipping_address, order),
|
249
|
+
],
|
250
|
+
shipments: order.shipments.map(shipment => transformShipment(shipment, order)),
|
251
|
+
payment: transformPayment(order.payment_methods[0], order),
|
252
|
+
// TODO: find out if the index is the correct payment for invoice
|
253
|
+
invoices: order.invoices.map((invoice, index) => transformInvoice(invoice, order, order.payment_methods[index])),
|
254
|
+
credits: order.credit_memos.map(credit => transformCredit(credit, order)),
|
255
|
+
};
|
256
|
+
}
|
257
|
+
|
258
|
+
;
|
259
|
+
;
|
260
|
+
|
261
|
+
;
|
262
|
+
;
|
263
|
+
|
264
|
+
const orderAddressFragment = gql `
|
265
|
+
fragment orderAddress on OrderAddress {
|
266
|
+
city
|
267
|
+
company
|
268
|
+
country_code
|
269
|
+
fax
|
270
|
+
firstname
|
271
|
+
middlename
|
272
|
+
lastname
|
273
|
+
postcode
|
274
|
+
prefix
|
275
|
+
region
|
276
|
+
region_code
|
277
|
+
street
|
278
|
+
suffix
|
279
|
+
telephone
|
280
|
+
}
|
281
|
+
`;
|
282
|
+
|
283
|
+
const orderBundleItemSelectedOptionFragment = gql `
|
284
|
+
fragment orderBundleItemSelectedOption on ItemSelectedBundleOption {
|
285
|
+
label
|
286
|
+
values {
|
287
|
+
product_name
|
288
|
+
}
|
289
|
+
}
|
290
|
+
`;
|
291
|
+
const orderItemFragment = gql `
|
292
|
+
fragment orderItem on OrderItemInterface {
|
293
|
+
quantity_ordered
|
294
|
+
quantity_canceled
|
295
|
+
quantity_shipped
|
296
|
+
quantity_invoiced
|
297
|
+
product_url_key
|
298
|
+
product_sku
|
299
|
+
product_name
|
300
|
+
product_type
|
301
|
+
product_sale_price {
|
302
|
+
value
|
303
|
+
}
|
304
|
+
discounts {
|
305
|
+
amount {
|
306
|
+
value
|
307
|
+
}
|
308
|
+
}
|
309
|
+
selected_options {
|
310
|
+
label
|
311
|
+
value
|
312
|
+
}
|
313
|
+
... on BundleOrderItem {
|
314
|
+
bundle_options {
|
315
|
+
...orderBundleItemSelectedOption
|
316
|
+
}
|
317
|
+
}
|
318
|
+
}
|
319
|
+
${orderBundleItemSelectedOptionFragment}
|
320
|
+
`;
|
321
|
+
|
322
|
+
const orderCreditItemFragment = gql `
|
323
|
+
fragment orderCreditItem on CreditMemoItemInterface {
|
324
|
+
quantity_refunded
|
325
|
+
order_item {
|
326
|
+
...orderItem
|
327
|
+
}
|
328
|
+
}
|
329
|
+
${orderItemFragment}
|
330
|
+
`;
|
331
|
+
|
332
|
+
const orderCreditTotalFragment = gql `
|
333
|
+
fragment orderCreditTotal on CreditMemoTotal {
|
334
|
+
discounts {
|
335
|
+
amount {
|
336
|
+
value
|
337
|
+
}
|
338
|
+
label
|
339
|
+
}
|
340
|
+
grand_total {
|
341
|
+
value
|
342
|
+
}
|
343
|
+
subtotal {
|
344
|
+
value
|
345
|
+
}
|
346
|
+
total_tax {
|
347
|
+
value
|
348
|
+
}
|
349
|
+
total_shipping {
|
350
|
+
value
|
351
|
+
}
|
352
|
+
}
|
353
|
+
`;
|
354
|
+
|
355
|
+
const orderCreditFragment = gql `
|
356
|
+
fragment orderCredit on CreditMemo {
|
357
|
+
items {
|
358
|
+
...orderCreditItem
|
359
|
+
}
|
360
|
+
total {
|
361
|
+
...orderCreditTotal
|
362
|
+
}
|
363
|
+
}
|
364
|
+
${orderCreditItemFragment}
|
365
|
+
${orderCreditTotalFragment}
|
366
|
+
`;
|
367
|
+
|
368
|
+
const orderInvoiceItemFragment = gql `
|
369
|
+
fragment orderInvoiceItem on InvoiceItemInterface {
|
370
|
+
quantity_invoiced
|
371
|
+
order_item {
|
372
|
+
...orderItem
|
373
|
+
}
|
374
|
+
}
|
375
|
+
${orderItemFragment}
|
376
|
+
`;
|
377
|
+
|
378
|
+
const orderInvoiceTotalFragment = gql `
|
379
|
+
fragment orderInvoiceTotal on InvoiceTotal {
|
380
|
+
discounts {
|
381
|
+
amount {
|
382
|
+
value
|
383
|
+
}
|
384
|
+
label
|
385
|
+
}
|
386
|
+
grand_total {
|
387
|
+
value
|
388
|
+
}
|
389
|
+
subtotal {
|
390
|
+
value
|
391
|
+
}
|
392
|
+
total_tax {
|
393
|
+
value
|
394
|
+
}
|
395
|
+
total_shipping {
|
396
|
+
value
|
397
|
+
}
|
398
|
+
}
|
399
|
+
`;
|
400
|
+
|
401
|
+
const orderInvoiceFragment = gql `
|
402
|
+
fragment orderInvoice on Invoice {
|
403
|
+
items {
|
404
|
+
...orderInvoiceItem
|
405
|
+
}
|
406
|
+
total {
|
407
|
+
...orderInvoiceTotal
|
408
|
+
}
|
409
|
+
}
|
410
|
+
${orderInvoiceItemFragment}
|
411
|
+
${orderInvoiceTotalFragment}
|
412
|
+
`;
|
413
|
+
|
414
|
+
const orderPaymentFragment = gql `
|
415
|
+
fragment orderPayment on OrderPaymentMethod {
|
416
|
+
name
|
417
|
+
type
|
418
|
+
additional_data {
|
419
|
+
name
|
420
|
+
value
|
421
|
+
}
|
422
|
+
}
|
423
|
+
`;
|
424
|
+
|
425
|
+
const orderShipmentItemFragment = gql `
|
426
|
+
fragment orderShipmentItem on ShipmentItemInterface {
|
427
|
+
quantity_shipped
|
428
|
+
order_item {
|
429
|
+
...orderItem
|
430
|
+
}
|
431
|
+
}
|
432
|
+
${orderItemFragment}
|
433
|
+
`;
|
434
|
+
|
435
|
+
const orderShipmentTrackingFragment = gql `
|
436
|
+
fragment orderShipmentTracking on ShipmentTracking {
|
437
|
+
number
|
438
|
+
carrier
|
439
|
+
title
|
440
|
+
}
|
441
|
+
`;
|
442
|
+
|
443
|
+
const orderShipmentFragment = gql `
|
444
|
+
fragment orderShipment on OrderShipment {
|
445
|
+
tracking {
|
446
|
+
...orderShipmentTracking
|
447
|
+
}
|
448
|
+
items {
|
449
|
+
...orderShipmentItem
|
450
|
+
}
|
451
|
+
}
|
452
|
+
${orderShipmentItemFragment}
|
453
|
+
${orderShipmentTrackingFragment}
|
454
|
+
`;
|
455
|
+
|
456
|
+
const orderTotalFragment = gql `
|
457
|
+
fragment orderTotal on OrderTotal {
|
458
|
+
discounts {
|
459
|
+
amount {
|
460
|
+
value
|
461
|
+
}
|
462
|
+
label
|
463
|
+
}
|
464
|
+
grand_total {
|
465
|
+
value
|
466
|
+
}
|
467
|
+
subtotal {
|
468
|
+
value
|
469
|
+
}
|
470
|
+
total_tax {
|
471
|
+
value
|
472
|
+
}
|
473
|
+
total_shipping {
|
474
|
+
value
|
475
|
+
}
|
476
|
+
}
|
477
|
+
`;
|
478
|
+
|
479
|
+
const orderFragment = gql `
|
480
|
+
fragment order on GraycoreGuestOrder {
|
481
|
+
id
|
482
|
+
order_date
|
483
|
+
status
|
484
|
+
carrier
|
485
|
+
number
|
486
|
+
shipping_method
|
487
|
+
items {
|
488
|
+
...orderItem
|
489
|
+
}
|
490
|
+
billing_address {
|
491
|
+
...orderAddress
|
492
|
+
}
|
493
|
+
shipping_address {
|
494
|
+
...orderAddress
|
495
|
+
}
|
496
|
+
shipments {
|
497
|
+
...orderShipment
|
498
|
+
}
|
499
|
+
payment_methods {
|
500
|
+
...orderPayment
|
501
|
+
}
|
502
|
+
invoices {
|
503
|
+
...orderInvoice
|
504
|
+
}
|
505
|
+
credit_memos {
|
506
|
+
...orderCredit
|
507
|
+
}
|
508
|
+
total {
|
509
|
+
...orderTotal
|
510
|
+
}
|
511
|
+
}
|
512
|
+
${orderItemFragment}
|
513
|
+
${orderShipmentFragment}
|
514
|
+
${orderPaymentFragment}
|
515
|
+
${orderInvoiceFragment}
|
516
|
+
${orderCreditFragment}
|
517
|
+
${orderAddressFragment}
|
518
|
+
${orderTotalFragment}
|
519
|
+
`;
|
520
|
+
|
521
|
+
const getGuestOrders = (extraOrderFragments = []) => gql `
|
522
|
+
query MagentoGetGuestOrders($cartId: String!) {
|
523
|
+
graycoreGuestOrders(cartId: $cartId) {
|
524
|
+
items {
|
525
|
+
...order
|
526
|
+
${daffBuildFragmentNameSpread(...extraOrderFragments)}
|
527
|
+
}
|
528
|
+
}
|
529
|
+
}
|
530
|
+
${orderFragment}
|
531
|
+
${daffBuildFragmentDefinition(...extraOrderFragments)}
|
532
|
+
`;
|
533
|
+
|
534
|
+
/**
|
535
|
+
* An multi-provider injection token for providing extra GraphQL fragments that will be spread into order queries.
|
536
|
+
* This can be used to retrieve additional data that is not covered by the standard Daffodil interfaces.
|
537
|
+
* The data will appear in DaffOrder#extra_attributes.
|
538
|
+
*
|
539
|
+
* Fragment structure is platform-specific and this feature should be used with care.
|
540
|
+
*/
|
541
|
+
const DaffMagentoExtraOrderFragments = new InjectionToken('DaffMagentoExtraOrderFragments', { factory: () => [] });
|
542
|
+
|
543
|
+
var MagentoOrderGraphQlErrorCode;
|
544
|
+
(function (MagentoOrderGraphQlErrorCode) {
|
545
|
+
MagentoOrderGraphQlErrorCode["CART_NOT_FOUND"] = "graphql-no-such-entity";
|
546
|
+
})(MagentoOrderGraphQlErrorCode || (MagentoOrderGraphQlErrorCode = {}));
|
547
|
+
|
548
|
+
const DaffOrderMagentoErrorMap = {
|
549
|
+
[MagentoOrderGraphQlErrorCode.CART_NOT_FOUND]: DaffCartNotFoundError,
|
550
|
+
};
|
551
|
+
|
552
|
+
function transformMagentoOrderError(error) {
|
553
|
+
return daffTransformMagentoError(error, DaffOrderMagentoErrorMap);
|
554
|
+
}
|
555
|
+
|
556
|
+
const validateGetOrdersResponse = (response) => {
|
557
|
+
if (response.data?.graycoreGuestOrders?.items) {
|
558
|
+
if (response.data.graycoreGuestOrders.items.reduce((acc, order) => acc && !!(order.billing_address
|
559
|
+
&& order.shipping_address
|
560
|
+
&& order.payment_methods), true)) {
|
561
|
+
return response;
|
562
|
+
}
|
563
|
+
else {
|
564
|
+
throw new DaffOrderInvalidAPIResponseError('One of the orders does not contain required fields.');
|
565
|
+
}
|
566
|
+
}
|
567
|
+
else {
|
568
|
+
throw new DaffOrderInvalidAPIResponseError('Get orders response does not contain a valid list of orders.');
|
569
|
+
}
|
570
|
+
};
|
571
|
+
|
572
|
+
/**
|
573
|
+
* A service for making Magento GraphQL queries for orders.
|
574
|
+
*
|
575
|
+
* @inheritdoc
|
576
|
+
*/
|
577
|
+
class DaffOrderMagentoService {
|
578
|
+
constructor(apollo, extraOrderFragments) {
|
579
|
+
this.apollo = apollo;
|
580
|
+
this.extraOrderFragments = extraOrderFragments;
|
581
|
+
}
|
582
|
+
list(cartId) {
|
583
|
+
return this.apollo.query({
|
584
|
+
query: getGuestOrders(this.extraOrderFragments),
|
585
|
+
variables: {
|
586
|
+
cartId,
|
587
|
+
},
|
588
|
+
}).pipe(map(validateGetOrdersResponse), map(result => result.data.graycoreGuestOrders.items.map(daffMagentoTransformOrder)), catchError(err => throwError(transformMagentoOrderError(err))));
|
589
|
+
}
|
590
|
+
get(orderId, cartId) {
|
591
|
+
return this.list(cartId).pipe(map(orders => {
|
592
|
+
for (const order of orders) {
|
593
|
+
if (order.id === orderId) {
|
594
|
+
return order;
|
595
|
+
}
|
596
|
+
}
|
597
|
+
// order not found
|
598
|
+
throw new DaffOrderNotFoundError(`Could not find an order with ID ${orderId}`);
|
599
|
+
}));
|
600
|
+
}
|
601
|
+
}
|
602
|
+
/** @nocollapse */ /** @nocollapse */ DaffOrderMagentoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoService, deps: [{ token: i1.Apollo }, { token: DaffMagentoExtraOrderFragments }], target: i0.ɵɵFactoryTarget.Injectable });
|
603
|
+
/** @nocollapse */ /** @nocollapse */ DaffOrderMagentoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoService, providedIn: 'root' });
|
604
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoService, decorators: [{
|
605
|
+
type: Injectable,
|
606
|
+
args: [{
|
607
|
+
providedIn: 'root',
|
608
|
+
}]
|
609
|
+
}], ctorParameters: function () { return [{ type: i1.Apollo }, { type: undefined, decorators: [{
|
610
|
+
type: Inject,
|
611
|
+
args: [DaffMagentoExtraOrderFragments]
|
612
|
+
}] }]; } });
|
613
|
+
|
614
|
+
class DaffOrderMagentoDriverModule {
|
615
|
+
static forRoot() {
|
616
|
+
return {
|
617
|
+
ngModule: DaffOrderMagentoDriverModule,
|
618
|
+
providers: [
|
619
|
+
{
|
620
|
+
provide: DaffOrderDriver,
|
621
|
+
useExisting: DaffOrderMagentoService,
|
622
|
+
},
|
623
|
+
],
|
624
|
+
};
|
625
|
+
}
|
626
|
+
}
|
627
|
+
/** @nocollapse */ /** @nocollapse */ DaffOrderMagentoDriverModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
628
|
+
/** @nocollapse */ /** @nocollapse */ DaffOrderMagentoDriverModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoDriverModule, imports: [CommonModule] });
|
629
|
+
/** @nocollapse */ /** @nocollapse */ DaffOrderMagentoDriverModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoDriverModule, imports: [[
|
630
|
+
CommonModule,
|
631
|
+
]] });
|
632
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoDriverModule, decorators: [{
|
633
|
+
type: NgModule,
|
634
|
+
args: [{
|
635
|
+
imports: [
|
636
|
+
CommonModule,
|
637
|
+
],
|
638
|
+
}]
|
639
|
+
}] });
|
640
|
+
|
641
|
+
/**
|
642
|
+
* Generated bundle index. Do not edit.
|
643
|
+
*/
|
644
|
+
|
645
|
+
export { DaffMagentoExtraOrderFragments, DaffOrderMagentoDriverModule, DaffOrderMagentoService, MagentoOrderItemType, daffMagentoTransformOrder, getGuestOrders, orderAddressFragment, orderFragment, orderInvoiceFragment, orderItemFragment, orderPaymentFragment, orderShipmentFragment, orderShipmentItemFragment, orderShipmentTrackingFragment };
|
646
|
+
//# sourceMappingURL=daffodil-order-driver-magento-2.4.1.mjs.map
|