@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,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