@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.
Files changed (394) hide show
  1. package/daffodil-order.d.ts +1 -0
  2. package/driver/daffodil-order-driver.d.ts +1 -0
  3. package/driver/in-memory/backend/order.service.d.ts +3 -0
  4. package/driver/in-memory/daffodil-order-driver-in-memory.d.ts +1 -0
  5. package/driver/in-memory/drivers/order-driver.module.d.ts +5 -0
  6. package/driver/in-memory/drivers/order.service.d.ts +3 -0
  7. package/driver/in-memory/package.json +5 -6
  8. package/driver/magento/2.4.0/README.md +5 -0
  9. package/driver/magento/2.4.0/daffodil-order-driver-magento-2.4.0.d.ts +1 -0
  10. package/driver/magento/2.4.0/errors/transform.d.ts +1 -1
  11. package/driver/magento/2.4.0/order-driver.module.d.ts +5 -0
  12. package/driver/magento/2.4.0/order.service.d.ts +4 -1
  13. package/driver/magento/2.4.0/package.json +5 -6
  14. package/driver/magento/2.4.0/queries/fragments/order-address.d.ts +1 -1
  15. package/driver/magento/2.4.0/queries/fragments/order-invoice.d.ts +1 -1
  16. package/driver/magento/2.4.0/queries/fragments/order-item.d.ts +1 -1
  17. package/driver/magento/2.4.0/queries/fragments/order-payment.d.ts +1 -1
  18. package/driver/magento/2.4.0/queries/fragments/order-shipment-item.d.ts +1 -1
  19. package/driver/magento/2.4.0/queries/fragments/order-shipment-tracking.d.ts +1 -1
  20. package/driver/magento/2.4.0/queries/fragments/order-shipment.d.ts +1 -1
  21. package/driver/magento/2.4.0/queries/fragments/order.d.ts +1 -1
  22. package/driver/magento/2.4.0/queries/get-guest-orders.d.ts +1 -1
  23. package/driver/magento/2.4.1/README.md +5 -0
  24. package/driver/magento/2.4.1/daffodil-order-driver-magento-2.4.1.d.ts +1 -0
  25. package/driver/magento/2.4.1/errors/transform.d.ts +1 -1
  26. package/driver/magento/2.4.1/models/responses/order-address.d.ts +1 -1
  27. package/driver/magento/2.4.1/order-driver.module.d.ts +5 -0
  28. package/driver/magento/2.4.1/order.service.d.ts +4 -1
  29. package/driver/magento/2.4.1/package.json +5 -6
  30. package/driver/magento/2.4.1/queries/fragments/order-address.d.ts +1 -1
  31. package/driver/magento/2.4.1/queries/fragments/order-credit-item.d.ts +1 -1
  32. package/driver/magento/2.4.1/queries/fragments/order-credit-total.d.ts +1 -1
  33. package/driver/magento/2.4.1/queries/fragments/order-credit.d.ts +1 -1
  34. package/driver/magento/2.4.1/queries/fragments/order-invoice-item.d.ts +1 -1
  35. package/driver/magento/2.4.1/queries/fragments/order-invoice-total.d.ts +1 -1
  36. package/driver/magento/2.4.1/queries/fragments/order-invoice.d.ts +1 -1
  37. package/driver/magento/2.4.1/queries/fragments/order-item.d.ts +2 -2
  38. package/driver/magento/2.4.1/queries/fragments/order-payment.d.ts +1 -1
  39. package/driver/magento/2.4.1/queries/fragments/order-shipment-item.d.ts +1 -1
  40. package/driver/magento/2.4.1/queries/fragments/order-shipment-tracking.d.ts +1 -1
  41. package/driver/magento/2.4.1/queries/fragments/order-shipment.d.ts +1 -1
  42. package/driver/magento/2.4.1/queries/fragments/order-total.d.ts +1 -1
  43. package/driver/magento/2.4.1/queries/fragments/order.d.ts +1 -1
  44. package/driver/magento/2.4.1/queries/get-guest-orders.d.ts +1 -1
  45. package/driver/package.json +5 -6
  46. package/driver/testing/daffodil-order-driver-testing.d.ts +1 -0
  47. package/driver/testing/drivers/order-driver.module.d.ts +5 -0
  48. package/driver/testing/drivers/order.service.d.ts +3 -0
  49. package/driver/testing/package.json +5 -6
  50. package/{esm2015/daffodil-order.js → esm2020/daffodil-order.mjs} +0 -0
  51. package/{esm2015/driver/daffodil-order-driver.js → esm2020/driver/daffodil-order-driver.mjs} +0 -0
  52. package/{esm2015/driver/errors/invalid-api-response.js → esm2020/driver/errors/invalid-api-response.mjs} +0 -0
  53. package/{esm2015/driver/errors/order-not-found.js → esm2020/driver/errors/order-not-found.mjs} +0 -0
  54. package/{esm2015/driver/errors/public_api.js → esm2020/driver/errors/public_api.mjs} +0 -0
  55. package/esm2020/driver/in-memory/backend/order.service.mjs +57 -0
  56. package/{esm2015/driver/in-memory/daffodil-order-driver-in-memory.js → esm2020/driver/in-memory/daffodil-order-driver-in-memory.mjs} +0 -0
  57. package/esm2020/driver/in-memory/drivers/order-driver.module.mjs +32 -0
  58. package/esm2020/driver/in-memory/drivers/order.service.mjs +28 -0
  59. package/{esm2015/driver/in-memory/drivers/public_api.js → esm2020/driver/in-memory/drivers/public_api.mjs} +0 -0
  60. package/{esm2015/driver/in-memory/index.js → esm2020/driver/in-memory/index.mjs} +0 -0
  61. package/{esm2015/driver/in-memory/public_api.js → esm2020/driver/in-memory/public_api.mjs} +0 -0
  62. package/{esm2015/driver/index.js → esm2020/driver/index.mjs} +0 -0
  63. package/{esm2015/driver/interfaces/order-service.interface.js → esm2020/driver/interfaces/order-service.interface.mjs} +0 -0
  64. 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
  65. package/{esm2015/driver/magento/2.4.0/errors/codes.js → esm2020/driver/magento/2.4.0/errors/codes.mjs} +0 -0
  66. package/{esm2015/driver/magento/2.4.0/errors/map.js → esm2020/driver/magento/2.4.0/errors/map.mjs} +0 -0
  67. package/{esm2015/driver/magento/2.4.0/errors/transform.js → esm2020/driver/magento/2.4.0/errors/transform.mjs} +0 -0
  68. package/{esm2015/driver/magento/2.4.0/index.js → esm2020/driver/magento/2.4.0/index.mjs} +0 -0
  69. 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
  70. 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
  71. 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
  72. 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
  73. 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
  74. 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
  75. 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
  76. 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
  77. 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
  78. package/{esm2015/driver/magento/2.4.0/models/responses/order.js → esm2020/driver/magento/2.4.0/models/responses/order.mjs} +0 -0
  79. 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
  80. package/esm2020/driver/magento/2.4.0/order-driver.module.mjs +32 -0
  81. package/esm2020/driver/magento/2.4.0/order.service.mjs +54 -0
  82. package/{esm2015/driver/magento/2.4.0/public_api.js → esm2020/driver/magento/2.4.0/public_api.mjs} +0 -0
  83. 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
  84. 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
  85. package/esm2020/driver/magento/2.4.0/queries/fragments/order-item.mjs +27 -0
  86. 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
  87. 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
  88. 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
  89. 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
  90. package/{esm2015/driver/magento/2.4.0/queries/fragments/order.js → esm2020/driver/magento/2.4.0/queries/fragments/order.mjs} +2 -2
  91. 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
  92. 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
  93. package/{esm2015/driver/magento/2.4.0/queries/public_api.js → esm2020/driver/magento/2.4.0/queries/public_api.mjs} +0 -0
  94. 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
  95. 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
  96. package/{esm2015/driver/magento/2.4.0/transforms/responses/order.js → esm2020/driver/magento/2.4.0/transforms/responses/order.mjs} +0 -0
  97. package/esm2020/driver/magento/2.4.0/validators/get-orders.mjs +17 -0
  98. package/{esm2015/driver/magento/2.4.0/validators/public_api.js → esm2020/driver/magento/2.4.0/validators/public_api.mjs} +0 -0
  99. 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
  100. package/{esm2015/driver/magento/2.4.1/errors/codes.js → esm2020/driver/magento/2.4.1/errors/codes.mjs} +0 -0
  101. package/{esm2015/driver/magento/2.4.1/errors/map.js → esm2020/driver/magento/2.4.1/errors/map.mjs} +0 -0
  102. package/{esm2015/driver/magento/2.4.1/errors/transform.js → esm2020/driver/magento/2.4.1/errors/transform.mjs} +0 -0
  103. package/{esm2015/driver/magento/2.4.1/index.js → esm2020/driver/magento/2.4.1/index.mjs} +0 -0
  104. 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
  105. 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
  106. package/{esm2015/driver/magento/2.4.1/models/responses/discount.js → esm2020/driver/magento/2.4.1/models/responses/discount.mjs} +0 -0
  107. 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
  108. 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
  109. 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
  110. 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
  111. 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
  112. 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
  113. 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
  114. 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
  115. 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
  116. 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
  117. 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
  118. package/{esm2015/driver/magento/2.4.1/models/responses/order.js → esm2020/driver/magento/2.4.1/models/responses/order.mjs} +0 -0
  119. 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
  120. package/esm2020/driver/magento/2.4.1/order-driver.module.mjs +32 -0
  121. package/esm2020/driver/magento/2.4.1/order.service.mjs +54 -0
  122. package/{esm2015/driver/magento/2.4.1/public_api.js → esm2020/driver/magento/2.4.1/public_api.mjs} +0 -0
  123. 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
  124. 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
  125. 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
  126. 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
  127. 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
  128. 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
  129. 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
  130. 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
  131. 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
  132. 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
  133. 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
  134. 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
  135. 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
  136. package/{esm2015/driver/magento/2.4.1/queries/fragments/order.js → esm2020/driver/magento/2.4.1/queries/fragments/order.mjs} +2 -2
  137. 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
  138. 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
  139. package/{esm2015/driver/magento/2.4.1/queries/public_api.js → esm2020/driver/magento/2.4.1/queries/public_api.mjs} +0 -0
  140. 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
  141. 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
  142. package/esm2020/driver/magento/2.4.1/transforms/responses/order.mjs +234 -0
  143. package/esm2020/driver/magento/2.4.1/validators/get-orders.mjs +17 -0
  144. package/{esm2015/driver/magento/2.4.1/validators/public_api.js → esm2020/driver/magento/2.4.1/validators/public_api.mjs} +0 -0
  145. package/{esm2015/driver/testing/daffodil-order-driver-testing.js → esm2020/driver/testing/daffodil-order-driver-testing.mjs} +0 -0
  146. package/esm2020/driver/testing/drivers/order-driver.module.mjs +32 -0
  147. package/esm2020/driver/testing/drivers/order.service.mjs +28 -0
  148. package/{esm2015/driver/testing/drivers/public_api.js → esm2020/driver/testing/drivers/public_api.mjs} +0 -0
  149. package/{esm2015/driver/testing/index.js → esm2020/driver/testing/index.mjs} +0 -0
  150. package/{esm2015/driver/testing/public_api.js → esm2020/driver/testing/public_api.mjs} +0 -0
  151. package/{esm2015/index.js → esm2020/index.mjs} +0 -0
  152. package/{esm2015/injection-tokens/error-matcher.token.js → esm2020/injection-tokens/error-matcher.token.mjs} +0 -0
  153. package/{esm2015/injection-tokens/public_api.js → esm2020/injection-tokens/public_api.mjs} +0 -0
  154. package/{esm2015/models/composite-order-item.js → esm2020/models/composite-order-item.mjs} +0 -0
  155. package/{esm2015/models/configurable-order-item.js → esm2020/models/configurable-order-item.mjs} +0 -0
  156. package/{esm2015/models/order-address.js → esm2020/models/order-address.mjs} +0 -0
  157. package/{esm2015/models/order-coupon.js → esm2020/models/order-coupon.mjs} +0 -0
  158. package/{esm2015/models/order-credit.js → esm2020/models/order-credit.mjs} +0 -0
  159. package/{esm2015/models/order-invoice.js → esm2020/models/order-invoice.mjs} +0 -0
  160. package/{esm2015/models/order-item.js → esm2020/models/order-item.mjs} +0 -0
  161. package/{esm2015/models/order-payment.js → esm2020/models/order-payment.mjs} +0 -0
  162. package/{esm2015/models/order-shipment-item.js → esm2020/models/order-shipment-item.mjs} +0 -0
  163. package/{esm2015/models/order-shipment-tracking.js → esm2020/models/order-shipment-tracking.mjs} +0 -0
  164. package/{esm2015/models/order-shipment.js → esm2020/models/order-shipment.mjs} +0 -0
  165. package/{esm2015/models/order-shipping-method.js → esm2020/models/order-shipping-method.mjs} +0 -0
  166. package/{esm2015/models/order-total.js → esm2020/models/order-total.mjs} +0 -0
  167. package/{esm2015/models/order.js → esm2020/models/order.mjs} +0 -0
  168. package/{esm2015/models/public_api.js → esm2020/models/public_api.mjs} +0 -0
  169. package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
  170. package/{esm2015/routing/daffodil-order-routing.js → esm2020/routing/daffodil-order-routing.mjs} +0 -0
  171. 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
  172. package/esm2020/routing/guards/placed-order/placed-order.guard.mjs +38 -0
  173. package/{esm2015/routing/guards/public_api.js → esm2020/routing/guards/public_api.mjs} +0 -0
  174. package/{esm2015/routing/index.js → esm2020/routing/index.mjs} +0 -0
  175. package/esm2020/routing/order-routing.module.mjs +19 -0
  176. package/{esm2015/routing/public_api.js → esm2020/routing/public_api.mjs} +0 -0
  177. package/{esm2015/state/actions/order.actions.js → esm2020/state/actions/order.actions.mjs} +0 -0
  178. package/esm2020/state/daffodil-order-state.mjs +5 -0
  179. package/esm2020/state/effects/order.effects.mjs +36 -0
  180. package/{esm2015/state/facades/order/order-facade.interface.js → esm2020/state/facades/order/order-facade.interface.mjs} +0 -0
  181. package/{esm2015/state/facades/order/order.facade.js → esm2020/state/facades/order/order.facade.mjs} +9 -11
  182. package/{esm2015/state/facades/public_api.js → esm2020/state/facades/public_api.mjs} +0 -0
  183. package/{esm2015/state/index.js → esm2020/state/index.mjs} +0 -0
  184. package/esm2020/state/order-state.module.mjs +33 -0
  185. package/{esm2015/state/public_api.js → esm2020/state/public_api.mjs} +0 -0
  186. package/{esm2015/state/reducers/order/order-initial-state.js → esm2020/state/reducers/order/order-initial-state.mjs} +0 -0
  187. package/{esm2015/state/reducers/order/order-reducer.interface.js → esm2020/state/reducers/order/order-reducer.interface.mjs} +0 -0
  188. package/esm2020/state/reducers/order/order.reducer.mjs +32 -0
  189. package/{esm2015/state/reducers/order/public_api.js → esm2020/state/reducers/order/public_api.mjs} +0 -0
  190. package/{esm2015/state/reducers/order-entities/order-entities-adapter.js → esm2020/state/reducers/order-entities/order-entities-adapter.mjs} +5 -7
  191. package/{esm2015/state/reducers/order-entities/order-entities-initial-state.js → esm2020/state/reducers/order-entities/order-entities-initial-state.mjs} +0 -0
  192. package/{esm2015/state/reducers/order-entities/order-entities-state.interface.js → esm2020/state/reducers/order-entities/order-entities-state.interface.mjs} +0 -0
  193. package/{esm2015/state/reducers/order-entities/order-entities.reducer.js → esm2020/state/reducers/order-entities/order-entities.reducer.mjs} +0 -0
  194. package/{esm2015/state/reducers/order-entities/public_api.js → esm2020/state/reducers/order-entities/public_api.mjs} +0 -0
  195. package/{esm2015/state/reducers/order-reducers.interface.js → esm2020/state/reducers/order-reducers.interface.mjs} +0 -0
  196. package/{esm2015/state/reducers/order-reducers.js → esm2020/state/reducers/order-reducers.mjs} +0 -0
  197. package/{esm2015/state/reducers/order-store-feature-key.js → esm2020/state/reducers/order-store-feature-key.mjs} +0 -0
  198. package/{esm2015/state/reducers/public_api.js → esm2020/state/reducers/public_api.mjs} +0 -0
  199. package/esm2020/state/selectors/order-all.selector.mjs +12 -0
  200. package/esm2020/state/selectors/order-entities.selector.mjs +76 -0
  201. package/esm2020/state/selectors/order-feature.selector.mjs +9 -0
  202. package/esm2020/state/selectors/order.selector.mjs +18 -0
  203. package/{esm2015/state/selectors/public_api.js → esm2020/state/selectors/public_api.mjs} +0 -0
  204. package/{esm2015/state/testing/daffodil-order-state-testing.js → esm2020/state/testing/daffodil-order-state-testing.mjs} +0 -0
  205. package/{esm2015/state/testing/index.js → esm2020/state/testing/index.mjs} +0 -0
  206. package/esm2020/state/testing/mock-order-facade.mjs +81 -0
  207. package/esm2020/state/testing/order-testing.module.mjs +20 -0
  208. package/{esm2015/state/testing/public_api.js → esm2020/state/testing/public_api.mjs} +0 -0
  209. package/{esm2015/testing/daffodil-order-testing.js → esm2020/testing/daffodil-order-testing.mjs} +0 -0
  210. package/esm2020/testing/factories/composite-order-item.factory.mjs +36 -0
  211. package/esm2020/testing/factories/configurable-order-item.factory.mjs +35 -0
  212. package/esm2020/testing/factories/order-address.factory.mjs +25 -0
  213. package/esm2020/testing/factories/order-coupon.factory.mjs +24 -0
  214. package/esm2020/testing/factories/order-invoice.factory.mjs +28 -0
  215. package/{esm2015/testing/factories/order-item.factory.js → esm2020/testing/factories/order-item.factory.mjs} +9 -9
  216. package/{esm2015/testing/factories/order-payment.factory.js → esm2020/testing/factories/order-payment.factory.mjs} +9 -9
  217. package/esm2020/testing/factories/order-shipment-item.factory.mjs +25 -0
  218. package/esm2020/testing/factories/order-shipment-tracking.factory.mjs +28 -0
  219. package/esm2020/testing/factories/order-shipment.factory.mjs +30 -0
  220. package/{esm2015/testing/factories/order-shipping-rate.factory.js → esm2020/testing/factories/order-shipping-rate.factory.mjs} +9 -9
  221. package/esm2020/testing/factories/order-total.factory.mjs +28 -0
  222. package/{esm2015/testing/factories/order.factory.js → esm2020/testing/factories/order.factory.mjs} +9 -9
  223. package/{esm2015/testing/factories/public_api.js → esm2020/testing/factories/public_api.mjs} +0 -0
  224. package/{esm2015/testing/helpers/order-helper.js → esm2020/testing/helpers/order-helper.mjs} +0 -0
  225. package/{esm2015/testing/helpers/public_api.js → esm2020/testing/helpers/public_api.mjs} +0 -0
  226. package/{esm2015/testing/index.js → esm2020/testing/index.mjs} +0 -0
  227. package/{esm2015/testing/public_api.js → esm2020/testing/public_api.mjs} +0 -0
  228. package/fesm2015/daffodil-order-driver-in-memory.mjs +117 -0
  229. package/fesm2015/daffodil-order-driver-in-memory.mjs.map +1 -0
  230. package/fesm2015/{daffodil-order-driver-magento-2.4.0.js → daffodil-order-driver-magento-2.4.0.mjs} +31 -21
  231. package/fesm2015/daffodil-order-driver-magento-2.4.0.mjs.map +1 -0
  232. package/fesm2015/{daffodil-order-driver-magento-2.4.1.js → daffodil-order-driver-magento-2.4.1.mjs} +33 -23
  233. package/fesm2015/daffodil-order-driver-magento-2.4.1.mjs.map +1 -0
  234. package/fesm2015/daffodil-order-driver-testing.mjs +63 -0
  235. package/fesm2015/daffodil-order-driver-testing.mjs.map +1 -0
  236. package/fesm2015/{daffodil-order-driver.js → daffodil-order-driver.mjs} +1 -1
  237. package/fesm2015/daffodil-order-driver.mjs.map +1 -0
  238. package/fesm2015/daffodil-order-routing.mjs +62 -0
  239. package/fesm2015/daffodil-order-routing.mjs.map +1 -0
  240. package/fesm2015/{daffodil-order-state-testing.js → daffodil-order-state-testing.mjs} +22 -13
  241. package/fesm2015/daffodil-order-state-testing.mjs.map +1 -0
  242. package/fesm2015/{daffodil-order-state.js → daffodil-order-state.mjs} +64 -73
  243. package/fesm2015/daffodil-order-state.mjs.map +1 -0
  244. package/fesm2015/daffodil-order-testing.mjs +387 -0
  245. package/fesm2015/daffodil-order-testing.mjs.map +1 -0
  246. package/fesm2015/{daffodil-order.js → daffodil-order.mjs} +1 -1
  247. package/fesm2015/daffodil-order.mjs.map +1 -0
  248. package/fesm2020/daffodil-order-driver-in-memory.mjs +117 -0
  249. package/fesm2020/daffodil-order-driver-in-memory.mjs.map +1 -0
  250. package/fesm2020/daffodil-order-driver-magento-2.4.0.mjs +459 -0
  251. package/fesm2020/daffodil-order-driver-magento-2.4.0.mjs.map +1 -0
  252. package/fesm2020/daffodil-order-driver-magento-2.4.1.mjs +646 -0
  253. package/fesm2020/daffodil-order-driver-magento-2.4.1.mjs.map +1 -0
  254. package/fesm2020/daffodil-order-driver-testing.mjs +63 -0
  255. package/fesm2020/daffodil-order-driver-testing.mjs.map +1 -0
  256. package/fesm2020/daffodil-order-driver.mjs +27 -0
  257. package/fesm2020/daffodil-order-driver.mjs.map +1 -0
  258. package/fesm2020/daffodil-order-routing.mjs +60 -0
  259. package/fesm2020/daffodil-order-routing.mjs.map +1 -0
  260. package/fesm2020/daffodil-order-state-testing.mjs +105 -0
  261. package/fesm2020/daffodil-order-state-testing.mjs.map +1 -0
  262. package/fesm2020/daffodil-order-state.mjs +400 -0
  263. package/fesm2020/daffodil-order-state.mjs.map +1 -0
  264. package/fesm2020/daffodil-order-testing.mjs +387 -0
  265. package/fesm2020/daffodil-order-testing.mjs.map +1 -0
  266. package/fesm2020/daffodil-order.mjs +31 -0
  267. package/fesm2020/daffodil-order.mjs.map +1 -0
  268. package/package.json +98 -14
  269. package/routing/daffodil-order-routing.d.ts +1 -0
  270. package/routing/guards/placed-order/placed-order.guard.d.ts +3 -0
  271. package/routing/order-routing.module.d.ts +4 -0
  272. package/routing/package.json +5 -6
  273. package/state/daffodil-order-state.d.ts +1 -1
  274. package/state/effects/order.effects.d.ts +5 -2
  275. package/state/facades/order/order.facade.d.ts +3 -0
  276. package/state/order-state.module.d.ts +7 -0
  277. package/state/package.json +5 -6
  278. package/state/testing/daffodil-order-state-testing.d.ts +1 -0
  279. package/state/testing/mock-order-facade.d.ts +3 -0
  280. package/state/testing/order-testing.module.d.ts +4 -0
  281. package/state/testing/package.json +5 -6
  282. package/testing/daffodil-order-testing.d.ts +1 -0
  283. package/testing/factories/composite-order-item.factory.d.ts +3 -0
  284. package/testing/factories/configurable-order-item.factory.d.ts +3 -0
  285. package/testing/factories/order-address.factory.d.ts +3 -0
  286. package/testing/factories/order-coupon.factory.d.ts +3 -0
  287. package/testing/factories/order-invoice.factory.d.ts +3 -0
  288. package/testing/factories/order-item.factory.d.ts +3 -0
  289. package/testing/factories/order-payment.factory.d.ts +3 -0
  290. package/testing/factories/order-shipment-item.factory.d.ts +3 -0
  291. package/testing/factories/order-shipment-tracking.factory.d.ts +3 -0
  292. package/testing/factories/order-shipment.factory.d.ts +3 -0
  293. package/testing/factories/order-shipping-rate.factory.d.ts +3 -0
  294. package/testing/factories/order-total.factory.d.ts +3 -0
  295. package/testing/factories/order.factory.d.ts +3 -0
  296. package/testing/package.json +5 -6
  297. package/bundles/daffodil-order-driver-in-memory.umd.js +0 -125
  298. package/bundles/daffodil-order-driver-in-memory.umd.js.map +0 -1
  299. package/bundles/daffodil-order-driver-in-memory.umd.min.js +0 -2
  300. package/bundles/daffodil-order-driver-in-memory.umd.min.js.map +0 -1
  301. package/bundles/daffodil-order-driver-magento-2.4.0.umd.js +0 -657
  302. package/bundles/daffodil-order-driver-magento-2.4.0.umd.js.map +0 -1
  303. package/bundles/daffodil-order-driver-magento-2.4.0.umd.min.js +0 -16
  304. package/bundles/daffodil-order-driver-magento-2.4.0.umd.min.js.map +0 -1
  305. package/bundles/daffodil-order-driver-magento-2.4.1.umd.js +0 -737
  306. package/bundles/daffodil-order-driver-magento-2.4.1.umd.js.map +0 -1
  307. package/bundles/daffodil-order-driver-magento-2.4.1.umd.min.js +0 -2
  308. package/bundles/daffodil-order-driver-magento-2.4.1.umd.min.js.map +0 -1
  309. package/bundles/daffodil-order-driver-testing.umd.js +0 -67
  310. package/bundles/daffodil-order-driver-testing.umd.js.map +0 -1
  311. package/bundles/daffodil-order-driver-testing.umd.min.js +0 -2
  312. package/bundles/daffodil-order-driver-testing.umd.min.js.map +0 -1
  313. package/bundles/daffodil-order-driver.umd.js +0 -360
  314. package/bundles/daffodil-order-driver.umd.js.map +0 -1
  315. package/bundles/daffodil-order-driver.umd.min.js +0 -16
  316. package/bundles/daffodil-order-driver.umd.min.js.map +0 -1
  317. package/bundles/daffodil-order-routing.umd.js +0 -66
  318. package/bundles/daffodil-order-routing.umd.js.map +0 -1
  319. package/bundles/daffodil-order-routing.umd.min.js +0 -2
  320. package/bundles/daffodil-order-routing.umd.min.js.map +0 -1
  321. package/bundles/daffodil-order-state-testing.umd.js +0 -107
  322. package/bundles/daffodil-order-state-testing.umd.js.map +0 -1
  323. package/bundles/daffodil-order-state-testing.umd.min.js +0 -2
  324. package/bundles/daffodil-order-state-testing.umd.min.js.map +0 -1
  325. package/bundles/daffodil-order-state.umd.js +0 -748
  326. package/bundles/daffodil-order-state.umd.js.map +0 -1
  327. package/bundles/daffodil-order-state.umd.min.js +0 -16
  328. package/bundles/daffodil-order-state.umd.min.js.map +0 -1
  329. package/bundles/daffodil-order-testing.umd.js +0 -766
  330. package/bundles/daffodil-order-testing.umd.js.map +0 -1
  331. package/bundles/daffodil-order-testing.umd.min.js +0 -16
  332. package/bundles/daffodil-order-testing.umd.min.js.map +0 -1
  333. package/bundles/daffodil-order.umd.js +0 -36
  334. package/bundles/daffodil-order.umd.js.map +0 -1
  335. package/bundles/daffodil-order.umd.min.js +0 -2
  336. package/bundles/daffodil-order.umd.min.js.map +0 -1
  337. package/daffodil-order.metadata.json +0 -1
  338. package/driver/daffodil-order-driver.metadata.json +0 -1
  339. package/driver/in-memory/daffodil-order-driver-in-memory.metadata.json +0 -1
  340. package/driver/magento/2.4.0/daffodil-order-driver-magento-2.4.0.metadata.json +0 -1
  341. package/driver/magento/2.4.1/daffodil-order-driver-magento-2.4.1.metadata.json +0 -1
  342. package/driver/testing/daffodil-order-driver-testing.metadata.json +0 -1
  343. package/esm2015/driver/in-memory/backend/order.service.js +0 -59
  344. package/esm2015/driver/in-memory/drivers/order-driver.module.js +0 -25
  345. package/esm2015/driver/in-memory/drivers/order.service.js +0 -30
  346. package/esm2015/driver/magento/2.4.0/order-driver.module.js +0 -25
  347. package/esm2015/driver/magento/2.4.0/order.service.js +0 -55
  348. package/esm2015/driver/magento/2.4.0/queries/fragments/order-item.js +0 -27
  349. package/esm2015/driver/magento/2.4.0/validators/get-orders.js +0 -18
  350. package/esm2015/driver/magento/2.4.1/order-driver.module.js +0 -25
  351. package/esm2015/driver/magento/2.4.1/order.service.js +0 -55
  352. package/esm2015/driver/magento/2.4.1/transforms/responses/order.js +0 -207
  353. package/esm2015/driver/magento/2.4.1/validators/get-orders.js +0 -18
  354. package/esm2015/driver/testing/drivers/order-driver.module.js +0 -25
  355. package/esm2015/driver/testing/drivers/order.service.js +0 -30
  356. package/esm2015/routing/guards/placed-order/placed-order.guard.js +0 -40
  357. package/esm2015/routing/order-routing.module.js +0 -12
  358. package/esm2015/state/daffodil-order-state.js +0 -6
  359. package/esm2015/state/effects/order.effects.js +0 -49
  360. package/esm2015/state/order-state.module.js +0 -20
  361. package/esm2015/state/reducers/order/order.reducer.js +0 -21
  362. package/esm2015/state/selectors/order-all.selector.js +0 -10
  363. package/esm2015/state/selectors/order-entities.selector.js +0 -79
  364. package/esm2015/state/selectors/order-feature.selector.js +0 -11
  365. package/esm2015/state/selectors/order.selector.js +0 -21
  366. package/esm2015/state/testing/mock-order-facade.js +0 -79
  367. package/esm2015/state/testing/order-testing.module.js +0 -13
  368. package/esm2015/testing/factories/composite-order-item.factory.js +0 -36
  369. package/esm2015/testing/factories/configurable-order-item.factory.js +0 -35
  370. package/esm2015/testing/factories/order-address.factory.js +0 -25
  371. package/esm2015/testing/factories/order-coupon.factory.js +0 -24
  372. package/esm2015/testing/factories/order-invoice.factory.js +0 -28
  373. package/esm2015/testing/factories/order-shipment-item.factory.js +0 -25
  374. package/esm2015/testing/factories/order-shipment-tracking.factory.js +0 -28
  375. package/esm2015/testing/factories/order-shipment.factory.js +0 -30
  376. package/esm2015/testing/factories/order-total.factory.js +0 -28
  377. package/fesm2015/daffodil-order-driver-in-memory.js +0 -114
  378. package/fesm2015/daffodil-order-driver-in-memory.js.map +0 -1
  379. package/fesm2015/daffodil-order-driver-magento-2.4.0.js.map +0 -1
  380. package/fesm2015/daffodil-order-driver-magento-2.4.1.js.map +0 -1
  381. package/fesm2015/daffodil-order-driver-testing.js +0 -58
  382. package/fesm2015/daffodil-order-driver-testing.js.map +0 -1
  383. package/fesm2015/daffodil-order-driver.js.map +0 -1
  384. package/fesm2015/daffodil-order-routing.js +0 -54
  385. package/fesm2015/daffodil-order-routing.js.map +0 -1
  386. package/fesm2015/daffodil-order-state-testing.js.map +0 -1
  387. package/fesm2015/daffodil-order-state.js.map +0 -1
  388. package/fesm2015/daffodil-order-testing.js +0 -386
  389. package/fesm2015/daffodil-order-testing.js.map +0 -1
  390. package/fesm2015/daffodil-order.js.map +0 -1
  391. package/routing/daffodil-order-routing.metadata.json +0 -1
  392. package/state/daffodil-order-state.metadata.json +0 -1
  393. package/state/testing/daffodil-order-state-testing.metadata.json +0 -1
  394. package/testing/daffodil-order-testing.metadata.json +0 -1
@@ -0,0 +1,459 @@
1
+ import { DaffOrderTotalTypeEnum, DaffOrderItemType } from '@daffodil/order';
2
+ import * as i1 from '@damienwebdev/apollo-angular';
3
+ import { gql } from '@damienwebdev/apollo-angular';
4
+ import { daffBuildFragmentNameSpread, daffBuildFragmentDefinition } from '@daffodil/core/graphql';
5
+ import * as i0 from '@angular/core';
6
+ import { InjectionToken, Injectable, Inject, NgModule } from '@angular/core';
7
+ import { throwError } from 'rxjs';
8
+ import { map, catchError } from 'rxjs/operators';
9
+ import { DaffOrderInvalidAPIResponseError, DaffOrderNotFoundError, DaffOrderDriver } from '@daffodil/order/driver';
10
+ import { daffTransformMagentoError } from '@daffodil/driver/magento';
11
+ import { DaffCartNotFoundError } from '@daffodil/cart/driver';
12
+ import { CommonModule } from '@angular/common';
13
+
14
+ function transformTotals(totals) {
15
+ return [
16
+ {
17
+ label: 'Grand Total',
18
+ type: DaffOrderTotalTypeEnum.GrandTotal,
19
+ value: totals.grand_total,
20
+ sort_order: 1,
21
+ },
22
+ {
23
+ label: 'Subtotal',
24
+ type: DaffOrderTotalTypeEnum.Subtotal,
25
+ value: totals.subtotal,
26
+ sort_order: 0,
27
+ },
28
+ {
29
+ label: 'Shipping',
30
+ type: DaffOrderTotalTypeEnum.Shipping,
31
+ value: totals.shipping,
32
+ sort_order: 2,
33
+ },
34
+ {
35
+ label: 'Tax',
36
+ type: DaffOrderTotalTypeEnum.Tax,
37
+ value: totals.tax,
38
+ sort_order: 3,
39
+ },
40
+ {
41
+ label: 'Discount',
42
+ type: DaffOrderTotalTypeEnum.Discount,
43
+ value: totals.discount,
44
+ sort_order: 4,
45
+ },
46
+ ];
47
+ }
48
+ function transformItem(item) {
49
+ return {
50
+ id: null,
51
+ item_id: null,
52
+ type: DaffOrderItemType.Simple,
53
+ qty_ordered: item.qty_ordered,
54
+ qty_canceled: item.qty_canceled,
55
+ qty_fulfilled: item.qty_fulfilled,
56
+ qty: item.qty,
57
+ image: {
58
+ url: item.image,
59
+ id: null,
60
+ label: null,
61
+ },
62
+ order_id: item.order_id,
63
+ created_at: item.created_at,
64
+ updated_at: item.updated_at,
65
+ product_id: String(item.product_id),
66
+ parent_item_id: null,
67
+ sku: item.sku,
68
+ name: item.name,
69
+ weight: item.weight,
70
+ price: item.price,
71
+ discount_percent: item.discount_percent,
72
+ discount_amount: item.discount_amount,
73
+ tax_percent: item.tax_percent,
74
+ tax_amount: item.tax_amount,
75
+ row_total: item.row_total,
76
+ row_total_with_discount: item.row_total_with_discount,
77
+ row_weight: item.row_weight,
78
+ tax_before_discount: item.tax_before_discount,
79
+ };
80
+ }
81
+ function transformAddress(address) {
82
+ return {
83
+ order_id: String(address.order_id),
84
+ prefix: address.prefix,
85
+ suffix: address.suffix,
86
+ firstname: address.firstname,
87
+ middlename: address.middlename,
88
+ lastname: address.lastname,
89
+ telephone: address.telephone,
90
+ email: address.email,
91
+ street: address.street[0],
92
+ street2: address.street[1],
93
+ city: address.city,
94
+ region: address.region_id,
95
+ country: address.country_code,
96
+ postcode: address.postcode,
97
+ };
98
+ }
99
+ function transformShipmentItem(shipmentItem) {
100
+ return {
101
+ item: transformItem(shipmentItem.item),
102
+ qty: shipmentItem.qty,
103
+ };
104
+ }
105
+ function transformShipmentTracking(tracking) {
106
+ return {
107
+ tracking_number: tracking.tracking_number,
108
+ tracking_url: null,
109
+ carrier: tracking.carrier,
110
+ title: tracking.title,
111
+ carrier_logo: null,
112
+ };
113
+ }
114
+ function transformShipment(shipment) {
115
+ return {
116
+ carrier: null,
117
+ carrier_title: null,
118
+ code: null,
119
+ method: null,
120
+ method_description: null,
121
+ tracking: shipment.tracking.map(transformShipmentTracking),
122
+ items: shipment.items.map(transformShipmentItem),
123
+ };
124
+ }
125
+ function transformPayment(payment) {
126
+ return {
127
+ id: String(payment.payment_id),
128
+ payment_id: String(payment.payment_id),
129
+ order_id: String(payment.order_id),
130
+ created_at: null,
131
+ updated_at: null,
132
+ method: payment.method,
133
+ cc_type: payment.cc_type,
134
+ cc_last4: payment.cc_last4,
135
+ cc_owner: payment.cc_owner,
136
+ cc_exp_month: payment.cc_exp_month,
137
+ cc_exp_year: payment.cc_exp_year,
138
+ };
139
+ }
140
+ function transformInvoice(invoice) {
141
+ return {
142
+ totals: transformTotals(invoice),
143
+ billing_address: transformAddress(invoice.billing_address),
144
+ shipping_address: transformAddress(invoice.shipping_address),
145
+ payment: transformPayment(invoice.payment),
146
+ items: invoice.items.map(transformShipmentItem),
147
+ shipping_method: null,
148
+ };
149
+ }
150
+ /**
151
+ * Transforms the MagentoGraycoreOrder from the magento order query into a DaffOrder.
152
+ */
153
+ function daffMagentoTransformOrder(order) {
154
+ return {
155
+ extra_attributes: order,
156
+ id: String(order.order_number),
157
+ customer_id: String(order.customer_id),
158
+ created_at: order.created_at,
159
+ updated_at: order.updated_at,
160
+ status: order.status,
161
+ totals: transformTotals(order),
162
+ applied_codes: order.applied_codes.map(code => ({ code })),
163
+ items: order.items.map(transformItem),
164
+ billing_addresses: [
165
+ transformAddress(order.billing_address),
166
+ ],
167
+ shipping_addresses: [
168
+ transformAddress(order.shipping_address),
169
+ ],
170
+ shipments: order.shipments.map(transformShipment),
171
+ payment: transformPayment(order.payment),
172
+ invoices: order.invoices.map(transformInvoice),
173
+ credits: order.credits.map(transformInvoice),
174
+ };
175
+ }
176
+
177
+ const orderAddressFragment = gql `
178
+ fragment orderAddress on GraycoreOrderAddress {
179
+ order_id
180
+ prefix
181
+ suffix
182
+ firstname
183
+ middlename
184
+ lastname
185
+ telephone
186
+ email
187
+ street
188
+ city
189
+ region
190
+ region_id
191
+ country_code
192
+ postcode
193
+ }
194
+ `;
195
+
196
+ const orderPaymentFragment = gql `
197
+ fragment orderPayment on GraycoreOrderPayment {
198
+ payment_id
199
+ order_id
200
+ method
201
+ cc_type
202
+ cc_last4
203
+ cc_owner
204
+ cc_exp_month
205
+ cc_exp_year
206
+ }
207
+ `;
208
+
209
+ const orderItemFragment = gql `
210
+ fragment orderItem on GraycoreOrderItem {
211
+ qty_ordered
212
+ image
213
+ qty_canceled
214
+ qty_fulfilled
215
+ order_id
216
+ created_at
217
+ updated_at
218
+ product_id
219
+ sku
220
+ name
221
+ weight
222
+ qty
223
+ price
224
+ discount_percent
225
+ discount_amount
226
+ tax_percent
227
+ tax_amount
228
+ row_total
229
+ row_total_with_discount
230
+ row_weight
231
+ tax_before_discount
232
+ }
233
+ `;
234
+
235
+ const orderShipmentItemFragment = gql `
236
+ fragment orderShipmentItem on GraycoreOrderShipmentItem {
237
+ qty
238
+ item {
239
+ ...orderItem
240
+ }
241
+ }
242
+ ${orderItemFragment}
243
+ `;
244
+
245
+ const orderInvoiceFragment = gql `
246
+ fragment orderInvoice on GraycoreOrderInvoice {
247
+ items {
248
+ ...orderShipmentItem
249
+ }
250
+ grand_total
251
+ subtotal
252
+ shipping
253
+ discount
254
+ tax
255
+ billing_address {
256
+ ...orderAddress
257
+ }
258
+ shipping_address {
259
+ ...orderAddress
260
+ }
261
+ payment {
262
+ ...orderPayment
263
+ }
264
+ }
265
+ ${orderShipmentItemFragment}
266
+ ${orderAddressFragment}
267
+ ${orderPaymentFragment}
268
+ `;
269
+
270
+ const orderShipmentTrackingFragment = gql `
271
+ fragment orderShipmentTracking on GraycoreOrderShipmentTracking {
272
+ tracking_number
273
+ carrier
274
+ title
275
+ }
276
+ `;
277
+
278
+ const orderShipmentFragment = gql `
279
+ fragment orderShipment on GraycoreOrderShipment {
280
+ tracking {
281
+ ...orderShipmentTracking
282
+ }
283
+ items {
284
+ ...orderShipmentItem
285
+ }
286
+ }
287
+ ${orderShipmentItemFragment}
288
+ ${orderShipmentTrackingFragment}
289
+ `;
290
+
291
+ const orderFragment = gql `
292
+ fragment order on GraycoreOrder {
293
+ id
294
+ order_number
295
+ customer_id
296
+ created_at
297
+ updated_at
298
+ grand_total
299
+ subtotal
300
+ shipping
301
+ discount
302
+ tax
303
+ status
304
+ applied_codes
305
+ items {
306
+ ...orderItem
307
+ }
308
+ billing_address {
309
+ ...orderAddress
310
+ }
311
+ shipping_address {
312
+ ...orderAddress
313
+ }
314
+ shipments {
315
+ ...orderShipment
316
+ }
317
+ payment {
318
+ ...orderPayment
319
+ }
320
+ invoices {
321
+ ...orderInvoice
322
+ }
323
+ credits {
324
+ ...orderInvoice
325
+ }
326
+ }
327
+ ${orderItemFragment}
328
+ ${orderShipmentFragment}
329
+ ${orderPaymentFragment}
330
+ ${orderInvoiceFragment}
331
+ ${orderAddressFragment}
332
+ `;
333
+
334
+ const getGuestOrders = (extraOrderFragments = []) => gql `
335
+ query MagentoGetGuestOrders($cartId: String!) {
336
+ graycoreGuestOrders(cartId: $cartId) {
337
+ orders {
338
+ ...order
339
+ ${daffBuildFragmentNameSpread(...extraOrderFragments)}
340
+ }
341
+ }
342
+ }
343
+ ${orderFragment}
344
+ ${daffBuildFragmentDefinition(...extraOrderFragments)}
345
+ `;
346
+
347
+ /**
348
+ * An multi-provider injection token for providing extra GraphQL fragments that will be spread into order queries.
349
+ * This can be used to retrieve additional data that is not covered by the standard Daffodil interfaces.
350
+ * The data will appear in DaffOrder#extra_attributes.
351
+ *
352
+ * Fragment structure is platform-specific and this feature should be used with care.
353
+ */
354
+ const DaffMagentoExtraOrderFragments = new InjectionToken('DaffMagentoExtraOrderFragments', { factory: () => [] });
355
+
356
+ var MagentoOrderGraphQlErrorCode;
357
+ (function (MagentoOrderGraphQlErrorCode) {
358
+ MagentoOrderGraphQlErrorCode["CART_NOT_FOUND"] = "graphql-no-such-entity";
359
+ })(MagentoOrderGraphQlErrorCode || (MagentoOrderGraphQlErrorCode = {}));
360
+
361
+ const DaffOrderMagentoErrorMap = {
362
+ [MagentoOrderGraphQlErrorCode.CART_NOT_FOUND]: DaffCartNotFoundError,
363
+ };
364
+
365
+ function transformMagentoOrderError(error) {
366
+ return daffTransformMagentoError(error, DaffOrderMagentoErrorMap);
367
+ }
368
+
369
+ const validateGetOrdersResponse = (response) => {
370
+ if (response.data?.graycoreGuestOrders?.orders) {
371
+ if (response.data.graycoreGuestOrders.orders.reduce((acc, order) => acc && !!(order.billing_address
372
+ && order.shipping_address
373
+ && order.payment), true)) {
374
+ return response;
375
+ }
376
+ else {
377
+ throw new DaffOrderInvalidAPIResponseError('One of the orders does not contain required fields.');
378
+ }
379
+ }
380
+ else {
381
+ throw new DaffOrderInvalidAPIResponseError('Get orders response does not contain a valid list of orders.');
382
+ }
383
+ };
384
+
385
+ /**
386
+ * A service for making Magento GraphQL queries for orders.
387
+ *
388
+ * @inheritdoc
389
+ */
390
+ class DaffOrderMagentoService {
391
+ constructor(apollo, extraOrderFragments) {
392
+ this.apollo = apollo;
393
+ this.extraOrderFragments = extraOrderFragments;
394
+ }
395
+ list(cartId) {
396
+ return this.apollo.query({
397
+ query: getGuestOrders(this.extraOrderFragments),
398
+ variables: {
399
+ cartId,
400
+ },
401
+ }).pipe(map(validateGetOrdersResponse), map(result => result.data.graycoreGuestOrders.orders.map(daffMagentoTransformOrder)), catchError(err => throwError(transformMagentoOrderError(err))));
402
+ }
403
+ get(orderId, cartId) {
404
+ return this.list(cartId).pipe(map(orders => {
405
+ for (const order of orders) {
406
+ if (order.id === orderId) {
407
+ return order;
408
+ }
409
+ }
410
+ // order not found
411
+ throw new DaffOrderNotFoundError(`Could not find an order with ID ${orderId}`);
412
+ }));
413
+ }
414
+ }
415
+ /** @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 });
416
+ /** @nocollapse */ /** @nocollapse */ DaffOrderMagentoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoService, providedIn: 'root' });
417
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoService, decorators: [{
418
+ type: Injectable,
419
+ args: [{
420
+ providedIn: 'root',
421
+ }]
422
+ }], ctorParameters: function () { return [{ type: i1.Apollo }, { type: undefined, decorators: [{
423
+ type: Inject,
424
+ args: [DaffMagentoExtraOrderFragments]
425
+ }] }]; } });
426
+
427
+ class DaffOrderMagentoDriverModule {
428
+ static forRoot() {
429
+ return {
430
+ ngModule: DaffOrderMagentoDriverModule,
431
+ providers: [
432
+ {
433
+ provide: DaffOrderDriver,
434
+ useExisting: DaffOrderMagentoService,
435
+ },
436
+ ],
437
+ };
438
+ }
439
+ }
440
+ /** @nocollapse */ /** @nocollapse */ DaffOrderMagentoDriverModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
441
+ /** @nocollapse */ /** @nocollapse */ DaffOrderMagentoDriverModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoDriverModule, imports: [CommonModule] });
442
+ /** @nocollapse */ /** @nocollapse */ DaffOrderMagentoDriverModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoDriverModule, imports: [[
443
+ CommonModule,
444
+ ]] });
445
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffOrderMagentoDriverModule, decorators: [{
446
+ type: NgModule,
447
+ args: [{
448
+ imports: [
449
+ CommonModule,
450
+ ],
451
+ }]
452
+ }] });
453
+
454
+ /**
455
+ * Generated bundle index. Do not edit.
456
+ */
457
+
458
+ export { DaffMagentoExtraOrderFragments, DaffOrderMagentoDriverModule, DaffOrderMagentoService, daffMagentoTransformOrder, getGuestOrders, orderAddressFragment, orderFragment, orderInvoiceFragment, orderItemFragment, orderPaymentFragment, orderShipmentFragment, orderShipmentItemFragment, orderShipmentTrackingFragment };
459
+ //# sourceMappingURL=daffodil-order-driver-magento-2.4.0.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-order-driver-magento-2.4.0.mjs","sources":["../../../libs/order/driver/magento/2.4.0/src/transforms/responses/order.ts","../../../libs/order/driver/magento/2.4.0/src/queries/fragments/order-address.ts","../../../libs/order/driver/magento/2.4.0/src/queries/fragments/order-payment.ts","../../../libs/order/driver/magento/2.4.0/src/queries/fragments/order-item.ts","../../../libs/order/driver/magento/2.4.0/src/queries/fragments/order-shipment-item.ts","../../../libs/order/driver/magento/2.4.0/src/queries/fragments/order-invoice.ts","../../../libs/order/driver/magento/2.4.0/src/queries/fragments/order-shipment-tracking.ts","../../../libs/order/driver/magento/2.4.0/src/queries/fragments/order-shipment.ts","../../../libs/order/driver/magento/2.4.0/src/queries/fragments/order.ts","../../../libs/order/driver/magento/2.4.0/src/queries/get-guest-orders.ts","../../../libs/order/driver/magento/2.4.0/src/injection-tokens/fragments/order.ts","../../../libs/order/driver/magento/2.4.0/src/errors/codes.ts","../../../libs/order/driver/magento/2.4.0/src/errors/map.ts","../../../libs/order/driver/magento/2.4.0/src/errors/transform.ts","../../../libs/order/driver/magento/2.4.0/src/validators/get-orders.ts","../../../libs/order/driver/magento/2.4.0/src/order.service.ts","../../../libs/order/driver/magento/2.4.0/src/order-driver.module.ts","../../../libs/order/driver/magento/2.4.0/src/daffodil-order-driver-magento-2.4.0.ts"],"sourcesContent":["import {\n DaffOrder,\n DaffOrderTotal,\n DaffOrderItem,\n DaffOrderAddress,\n DaffOrderShipment,\n DaffOrderShipmentItem,\n DaffOrderShipmentTracking,\n DaffOrderPayment,\n DaffOrderInvoice,\n DaffOrderTotalTypeEnum,\n DaffOrderItemType,\n} from '@daffodil/order';\n\nimport {\n MagentoGraycoreOrder,\n MagentoGraycoreOrderItem,\n MagentoGraycoreOrderShipment,\n MagentoGraycoreOrderAddress,\n MagentoGraycoreOrderShipmentItem,\n MagentoGraycoreOrderShipmentTracking,\n MagentoGraycoreOrderPayment,\n MagentoGraycoreOrderInvoice,\n} from '../../models/responses/public_api';\n\nfunction transformTotals(totals: {\n grand_total: number;\n subtotal: number;\n shipping: number;\n discount: number;\n tax: number;\n}): DaffOrderTotal[] {\n return [\n {\n label: 'Grand Total',\n type: DaffOrderTotalTypeEnum.GrandTotal,\n value: totals.grand_total,\n sort_order: 1,\n },\n {\n label: 'Subtotal',\n type: DaffOrderTotalTypeEnum.Subtotal,\n value: totals.subtotal,\n sort_order: 0,\n },\n {\n label: 'Shipping',\n type: DaffOrderTotalTypeEnum.Shipping,\n value: totals.shipping,\n sort_order: 2,\n },\n {\n label: 'Tax',\n type: DaffOrderTotalTypeEnum.Tax,\n value: totals.tax,\n sort_order: 3,\n },\n {\n label: 'Discount',\n type: DaffOrderTotalTypeEnum.Discount,\n value: totals.discount,\n sort_order: 4,\n },\n ];\n}\n\nfunction transformItem(item: MagentoGraycoreOrderItem): DaffOrderItem {\n return {\n id: null,\n item_id: null,\n type: DaffOrderItemType.Simple,\n qty_ordered: item.qty_ordered,\n qty_canceled: item.qty_canceled,\n qty_fulfilled: item.qty_fulfilled,\n qty: item.qty,\n image: {\n url: item.image,\n id: null,\n label: null,\n },\n order_id: item.order_id,\n created_at: item.created_at,\n updated_at: item.updated_at,\n product_id: String(item.product_id),\n parent_item_id: null,\n sku: item.sku,\n name: item.name,\n weight: item.weight,\n price: item.price,\n discount_percent: item.discount_percent,\n discount_amount: item.discount_amount,\n tax_percent: item.tax_percent,\n tax_amount: item.tax_amount,\n row_total: item.row_total,\n row_total_with_discount: item.row_total_with_discount,\n row_weight: item.row_weight,\n tax_before_discount: item.tax_before_discount,\n };\n}\n\nfunction transformAddress(address: MagentoGraycoreOrderAddress): DaffOrderAddress {\n return {\n order_id: String(address.order_id),\n prefix: address.prefix,\n suffix: address.suffix,\n firstname: address.firstname,\n middlename: address.middlename,\n lastname: address.lastname,\n telephone: address.telephone,\n email: address.email,\n street: address.street[0],\n street2: address.street[1],\n city: address.city,\n region: address.region_id,\n country: address.country_code,\n postcode: address.postcode,\n };\n}\n\nfunction transformShipmentItem(shipmentItem: MagentoGraycoreOrderShipmentItem): DaffOrderShipmentItem {\n return {\n item: transformItem(shipmentItem.item),\n qty: shipmentItem.qty,\n };\n}\n\nfunction transformShipmentTracking(tracking: MagentoGraycoreOrderShipmentTracking): DaffOrderShipmentTracking {\n return {\n tracking_number: tracking.tracking_number,\n tracking_url: null,\n carrier: tracking.carrier,\n title: tracking.title,\n carrier_logo: null,\n };\n}\n\nfunction transformShipment(shipment: MagentoGraycoreOrderShipment): DaffOrderShipment {\n return {\n carrier: null,\n carrier_title: null,\n code: null,\n method: null,\n method_description: null,\n tracking: shipment.tracking.map(transformShipmentTracking),\n items: shipment.items.map(transformShipmentItem),\n };\n}\n\nfunction transformPayment(payment: MagentoGraycoreOrderPayment): DaffOrderPayment {\n return {\n id: String(payment.payment_id),\n payment_id: String(payment.payment_id),\n order_id: String(payment.order_id),\n created_at: null,\n updated_at: null,\n method: payment.method,\n cc_type: payment.cc_type,\n cc_last4: payment.cc_last4,\n cc_owner: payment.cc_owner,\n cc_exp_month: payment.cc_exp_month,\n cc_exp_year: payment.cc_exp_year,\n };\n}\n\nfunction transformInvoice(invoice: MagentoGraycoreOrderInvoice): DaffOrderInvoice {\n return {\n totals: transformTotals(invoice),\n billing_address: transformAddress(invoice.billing_address),\n shipping_address: transformAddress(invoice.shipping_address),\n payment: transformPayment(invoice.payment),\n items: invoice.items.map(transformShipmentItem),\n shipping_method: null,\n };\n}\n\n/**\n * Transforms the MagentoGraycoreOrder from the magento order query into a DaffOrder.\n */\nexport function daffMagentoTransformOrder(order: MagentoGraycoreOrder): DaffOrder {\n return {\n extra_attributes: order,\n\n id: String(order.order_number),\n customer_id: String(order.customer_id),\n created_at: order.created_at,\n updated_at: order.updated_at,\n status: order.status,\n\n totals: transformTotals(order),\n applied_codes: order.applied_codes.map(code => ({ code })),\n items: order.items.map(transformItem),\n billing_addresses: [\n transformAddress(order.billing_address),\n ],\n shipping_addresses: [\n transformAddress(order.shipping_address),\n ],\n shipments: order.shipments.map(transformShipment),\n payment: transformPayment(order.payment),\n invoices: order.invoices.map(transformInvoice),\n credits: order.credits.map(transformInvoice),\n };\n}\n","import { gql } from '@damienwebdev/apollo-angular';\n\n\nexport const orderAddressFragment = gql`\n fragment orderAddress on GraycoreOrderAddress {\n order_id\n prefix\n suffix\n firstname\n middlename\n lastname\n telephone\n email\n street\n city\n region\n region_id\n country_code\n postcode\n }\n`;\n","import { gql } from '@damienwebdev/apollo-angular';\n\n\nexport const orderPaymentFragment = gql`\n fragment orderPayment on GraycoreOrderPayment {\n payment_id\n order_id\n method\n cc_type\n cc_last4\n cc_owner\n cc_exp_month\n cc_exp_year\n }\n`;\n","import { gql } from '@damienwebdev/apollo-angular';\n\n\nexport const orderItemFragment = gql`\n fragment orderItem on GraycoreOrderItem {\n qty_ordered\n image\n qty_canceled\n qty_fulfilled\n order_id\n created_at\n updated_at\n product_id\n sku\n name\n weight\n qty\n price\n discount_percent\n discount_amount\n tax_percent\n tax_amount\n row_total\n row_total_with_discount\n row_weight\n tax_before_discount\n }\n`;\n","import { gql } from '@damienwebdev/apollo-angular';\n\nimport { orderItemFragment } from './order-item';\n\nexport const orderShipmentItemFragment = gql`\n fragment orderShipmentItem on GraycoreOrderShipmentItem {\n qty\n item {\n ...orderItem\n }\n }\n ${orderItemFragment}\n`;\n","import { gql } from '@damienwebdev/apollo-angular';\n\nimport { orderAddressFragment } from './order-address';\nimport { orderPaymentFragment } from './order-payment';\nimport { orderShipmentItemFragment } from './order-shipment-item';\n\nexport const orderInvoiceFragment = gql`\n fragment orderInvoice on GraycoreOrderInvoice {\n items {\n ...orderShipmentItem\n }\n grand_total\n subtotal\n shipping\n discount\n tax\n billing_address {\n ...orderAddress\n }\n shipping_address {\n ...orderAddress\n\t\t}\n\t\tpayment {\n\t\t\t...orderPayment\n\t\t}\n }\n ${orderShipmentItemFragment}\n ${orderAddressFragment}\n ${orderPaymentFragment}\n`;\n","import { gql } from '@damienwebdev/apollo-angular';\n\n\nexport const orderShipmentTrackingFragment = gql`\n fragment orderShipmentTracking on GraycoreOrderShipmentTracking {\n tracking_number\n carrier\n title\n }\n`;\n","import { gql } from '@damienwebdev/apollo-angular';\n\nimport { orderShipmentItemFragment } from './order-shipment-item';\nimport { orderShipmentTrackingFragment } from './order-shipment-tracking';\n\nexport const orderShipmentFragment = gql`\n fragment orderShipment on GraycoreOrderShipment {\n tracking {\n ...orderShipmentTracking\n }\n items {\n ...orderShipmentItem\n }\n }\n ${orderShipmentItemFragment}\n ${orderShipmentTrackingFragment}\n`;\n","import { gql } from '@damienwebdev/apollo-angular';\n\nimport { orderAddressFragment } from './order-address';\nimport { orderInvoiceFragment } from './order-invoice';\nimport { orderItemFragment } from './order-item';\nimport { orderPaymentFragment } from './order-payment';\nimport { orderShipmentFragment } from './order-shipment';\n\nexport const orderFragment = gql`\n fragment order on GraycoreOrder {\n id\n order_number\n customer_id\n created_at\n updated_at\n grand_total\n subtotal\n shipping\n discount\n tax\n status\n applied_codes\n items {\n ...orderItem\n }\n billing_address {\n ...orderAddress\n }\n shipping_address {\n ...orderAddress\n }\n shipments {\n ...orderShipment\n }\n payment {\n ...orderPayment\n }\n invoices {\n ...orderInvoice\n }\n credits {\n ...orderInvoice\n }\n }\n ${orderItemFragment}\n ${orderShipmentFragment}\n ${orderPaymentFragment}\n ${orderInvoiceFragment}\n ${orderAddressFragment}\n`;\n","import { gql } from '@damienwebdev/apollo-angular';\nimport { DocumentNode } from 'graphql';\n\nimport {\n daffBuildFragmentNameSpread,\n daffBuildFragmentDefinition,\n} from '@daffodil/core/graphql';\n\nimport { orderFragment } from './fragments/public_api';\n\nexport const getGuestOrders = (extraOrderFragments: DocumentNode[] = []) => gql`\n query MagentoGetGuestOrders($cartId: String!) {\n graycoreGuestOrders(cartId: $cartId) {\n orders {\n ...order\n ${daffBuildFragmentNameSpread(...extraOrderFragments)}\n }\n }\n }\n ${orderFragment}\n ${daffBuildFragmentDefinition(...extraOrderFragments)}\n`;\n","import { InjectionToken } from '@angular/core';\nimport { DocumentNode } from 'graphql';\n\n/**\n * An multi-provider injection token for providing extra GraphQL fragments that will be spread into order queries.\n * This can be used to retrieve additional data that is not covered by the standard Daffodil interfaces.\n * The data will appear in DaffOrder#extra_attributes.\n *\n * Fragment structure is platform-specific and this feature should be used with care.\n */\nexport const DaffMagentoExtraOrderFragments = new InjectionToken<DocumentNode[]>('DaffMagentoExtraOrderFragments', { factory: () => []});\n","export enum MagentoOrderGraphQlErrorCode {\n\tCART_NOT_FOUND = 'graphql-no-such-entity',\n}\n","import { DaffCartNotFoundError } from '@daffodil/cart/driver';\nimport { DaffErrorCodeMap } from '@daffodil/core';\n\nimport { MagentoOrderGraphQlErrorCode } from './codes';\n\nexport const DaffOrderMagentoErrorMap: DaffErrorCodeMap = {\n [MagentoOrderGraphQlErrorCode.CART_NOT_FOUND]: DaffCartNotFoundError,\n};\n","import { daffTransformMagentoError } from '@daffodil/driver/magento';\n\nimport { DaffOrderMagentoErrorMap } from './map';\n\nexport function transformMagentoOrderError(error: any) {\n return daffTransformMagentoError(error, DaffOrderMagentoErrorMap);\n}\n","import { ApolloQueryResult } from '@apollo/client/core';\n\nimport { DaffOrderInvalidAPIResponseError } from '@daffodil/order/driver';\n\nimport { MagentoGetGuestOrdersResponse } from '../queries/public_api';\n\nexport const validateGetOrdersResponse = (response: ApolloQueryResult<MagentoGetGuestOrdersResponse>) => {\n if (response.data?.graycoreGuestOrders?.orders) {\n if (response.data.graycoreGuestOrders.orders.reduce((acc, order) => acc && !!(\n order.billing_address\n && order.shipping_address\n && order.payment\n ), true)) {\n return response;\n } else {\n throw new DaffOrderInvalidAPIResponseError('One of the orders does not contain required fields.');\n }\n } else {\n throw new DaffOrderInvalidAPIResponseError('Get orders response does not contain a valid list of orders.');\n }\n};\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport { Apollo } from '@damienwebdev/apollo-angular';\nimport { DocumentNode } from 'graphql';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffCart } from '@daffodil/cart';\nimport { DaffOrder } from '@daffodil/order';\nimport {\n DaffOrderServiceInterface,\n DaffOrderNotFoundError,\n} from '@daffodil/order/driver';\n\nimport { transformMagentoOrderError } from './errors/transform';\nimport { DaffMagentoExtraOrderFragments } from './injection-tokens/public_api';\nimport {\n getGuestOrders,\n MagentoGetGuestOrdersResponse,\n} from './queries/public_api';\nimport { daffMagentoTransformOrder } from './transforms/responses/order';\nimport { validateGetOrdersResponse } from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for orders.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffOrderMagentoService implements DaffOrderServiceInterface {\n constructor(\n private apollo: Apollo,\n @Inject(DaffMagentoExtraOrderFragments) public extraOrderFragments: DocumentNode[],\n ) {}\n\n list(cartId?: DaffCart['id']): Observable<DaffOrder[]> {\n return this.apollo.query<MagentoGetGuestOrdersResponse>({\n query: getGuestOrders(this.extraOrderFragments),\n variables: {\n cartId,\n },\n }).pipe(\n map(validateGetOrdersResponse),\n map(result => result.data.graycoreGuestOrders.orders.map(daffMagentoTransformOrder)),\n catchError(err => throwError(transformMagentoOrderError(err))),\n );\n }\n\n get(orderId: DaffOrder['id'], cartId?: DaffCart['id']): Observable<DaffOrder> {\n return this.list(cartId).pipe(\n map(orders => {\n for (const order of orders) {\n if (order.id === orderId) {\n return order;\n }\n }\n\n // order not found\n throw new DaffOrderNotFoundError(`Could not find an order with ID ${orderId}`);\n }),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport { DaffOrderDriver } from '@daffodil/order/driver';\n\nimport { DaffOrderMagentoService } from './order.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffOrderMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffOrderMagentoDriverModule> {\n return {\n ngModule: DaffOrderMagentoDriverModule,\n providers: [\n {\n provide: DaffOrderDriver,\n useExisting: DaffOrderMagentoService,\n },\n ],\n };\n }\n}\n","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