@daffodil/customer-order 0.72.0 → 0.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/driver/magento/{testing → 2-4-5/testing}/factories/order.factory.d.ts +1 -1
  2. package/driver/magento/{testing → 2-4-5/testing}/factories/orders.factory.d.ts +1 -1
  3. package/driver/magento/2-4-6/constants/sort/fields.d.ts +2 -0
  4. package/driver/magento/2-4-6/driver.module.d.ts +9 -0
  5. package/driver/magento/2-4-6/errors/public_api.d.ts +1 -0
  6. package/driver/magento/2-4-6/errors/transform.d.ts +2 -0
  7. package/driver/magento/2-4-6/index.d.ts +1 -0
  8. package/driver/magento/2-4-6/injection-tokens/fragments/order.token.d.ts +28 -0
  9. package/driver/magento/2-4-6/injection-tokens/public_api.d.ts +3 -0
  10. package/driver/magento/2-4-6/injection-tokens/transforms/extra.token.d.ts +25 -0
  11. package/driver/magento/2-4-6/injection-tokens/transforms/token.d.ts +6 -0
  12. package/driver/magento/2-4-6/interfaces/order-extra-transform.type.d.ts +3 -0
  13. package/driver/magento/2-4-6/interfaces/order-transform.type.d.ts +3 -0
  14. package/driver/magento/2-4-6/interfaces/public_api.d.ts +2 -0
  15. package/driver/magento/2-4-6/models/public_api.d.ts +2 -0
  16. package/driver/magento/2-4-6/models/requests/customer-orders-filter-input.type.d.ts +5 -0
  17. package/driver/magento/2-4-6/models/requests/public_api.d.ts +3 -0
  18. package/driver/magento/2-4-6/models/requests/sort.type.d.ts +6 -0
  19. package/driver/magento/2-4-6/models/requests/sortable-field.enum.d.ts +4 -0
  20. package/driver/magento/2-4-6/models/responses/customer-orders.type.d.ts +7 -0
  21. package/driver/magento/2-4-6/models/responses/order.type.d.ts +18 -0
  22. package/driver/magento/2-4-6/models/responses/public_api.d.ts +2 -0
  23. package/driver/magento/2-4-6/order.service.d.ts +29 -0
  24. package/driver/magento/2-4-6/public_api.d.ts +9 -0
  25. package/driver/magento/2-4-6/queries/fragments/customer-order.d.ts +1 -0
  26. package/driver/magento/2-4-6/queries/fragments/public_api.d.ts +1 -0
  27. package/driver/magento/2-4-6/queries/get-customer-order/public_api.d.ts +3 -0
  28. package/driver/magento/2-4-6/queries/get-customer-order/query.d.ts +5 -0
  29. package/driver/magento/2-4-6/queries/get-customer-order/response.type.d.ts +9 -0
  30. package/driver/magento/2-4-6/queries/get-customer-order/variables.type.d.ts +3 -0
  31. package/driver/magento/2-4-6/queries/get-customer-orders/public_api.d.ts +3 -0
  32. package/driver/magento/2-4-6/queries/get-customer-orders/query.d.ts +5 -0
  33. package/driver/magento/2-4-6/queries/get-customer-orders/response.type.d.ts +7 -0
  34. package/driver/magento/2-4-6/queries/get-customer-orders/variables.type.d.ts +6 -0
  35. package/driver/magento/2-4-6/queries/public_api.d.ts +3 -0
  36. package/driver/magento/2-4-6/testing/factories/order.factory.d.ts +35 -0
  37. package/driver/magento/2-4-6/testing/factories/orders.factory.d.ts +21 -0
  38. package/driver/magento/2-4-6/testing/factories/public_api.d.ts +2 -0
  39. package/driver/magento/2-4-6/testing/index.d.ts +1 -0
  40. package/driver/magento/2-4-6/testing/public_api.d.ts +1 -0
  41. package/driver/magento/2-4-6/transforms/public_api.d.ts +1 -0
  42. package/driver/magento/2-4-6/transforms/responses/order-collection.d.ts +12 -0
  43. package/driver/magento/2-4-6/transforms/responses/order.d.ts +39 -0
  44. package/driver/magento/2-4-6/transforms/responses/public_api.d.ts +2 -0
  45. package/driver/magento/2-4-6/validators/get-order.d.ts +3 -0
  46. package/driver/magento/2-4-6/validators/get-orders.d.ts +3 -0
  47. package/driver/magento/2-4-6/validators/public_api.d.ts +1 -0
  48. package/esm2022/driver/magento/2-4-5/daffodil-customer-order-driver-magento-2-4-5.mjs +5 -0
  49. package/esm2022/driver/magento/2-4-5/driver.module.mjs +32 -0
  50. package/esm2022/driver/magento/2-4-5/errors/public_api.mjs +2 -0
  51. package/esm2022/driver/magento/2-4-5/errors/transform.mjs +6 -0
  52. package/esm2022/driver/magento/{testing → 2-4-5}/index.mjs +1 -1
  53. package/esm2022/driver/magento/2-4-5/injection-tokens/fragments/order.token.mjs +34 -0
  54. package/esm2022/driver/magento/2-4-5/injection-tokens/public_api.mjs +4 -0
  55. package/esm2022/driver/magento/2-4-5/injection-tokens/transforms/extra.token.mjs +29 -0
  56. package/esm2022/driver/magento/2-4-5/injection-tokens/transforms/token.mjs +13 -0
  57. package/esm2022/driver/magento/2-4-5/interfaces/order-extra-transform.type.mjs +2 -0
  58. package/esm2022/driver/magento/2-4-5/interfaces/order-transform.type.mjs +2 -0
  59. package/esm2022/driver/magento/2-4-5/interfaces/public_api.mjs +3 -0
  60. package/esm2022/driver/magento/2-4-5/models/public_api.mjs +3 -0
  61. package/esm2022/driver/magento/2-4-5/models/requests/customer-orders-filter-input.type.mjs +2 -0
  62. package/esm2022/driver/magento/2-4-5/models/requests/public_api.mjs +2 -0
  63. package/esm2022/driver/magento/2-4-5/models/responses/customer-orders.type.mjs +2 -0
  64. package/esm2022/driver/magento/2-4-5/models/responses/get-customer-order.type.mjs +2 -0
  65. package/esm2022/driver/magento/2-4-5/models/responses/get-customer-orders.type.mjs +2 -0
  66. package/esm2022/driver/magento/2-4-5/models/responses/order.type.mjs +3 -0
  67. package/esm2022/driver/magento/2-4-5/models/responses/public_api.mjs +2 -0
  68. package/esm2022/driver/magento/2-4-5/order.service.mjs +68 -0
  69. package/esm2022/driver/magento/2-4-5/public_api.mjs +10 -0
  70. package/esm2022/driver/magento/2-4-5/queries/fragments/customer-order.mjs +44 -0
  71. package/esm2022/driver/magento/2-4-5/queries/fragments/public_api.mjs +2 -0
  72. package/esm2022/driver/magento/2-4-5/queries/get-customer-order.mjs +20 -0
  73. package/esm2022/driver/magento/2-4-5/queries/get-customer-orders.mjs +26 -0
  74. package/esm2022/driver/magento/2-4-5/queries/public_api.mjs +4 -0
  75. package/esm2022/driver/magento/{daffodil-customer-order-driver-magento.mjs → 2-4-5/testing/daffodil-customer-order-driver-magento-2-4-5-testing.mjs} +1 -1
  76. package/esm2022/driver/magento/2-4-5/testing/factories/order.factory.mjs +50 -0
  77. package/esm2022/driver/magento/2-4-5/testing/factories/orders.factory.mjs +37 -0
  78. package/esm2022/driver/magento/2-4-5/testing/factories/public_api.mjs +3 -0
  79. package/esm2022/driver/magento/2-4-5/testing/index.mjs +2 -0
  80. package/esm2022/driver/magento/2-4-5/testing/public_api.mjs +2 -0
  81. package/esm2022/driver/magento/2-4-5/transforms/public_api.mjs +2 -0
  82. package/esm2022/driver/magento/2-4-5/transforms/responses/order-collection.mjs +40 -0
  83. package/esm2022/driver/magento/2-4-5/transforms/responses/order.mjs +235 -0
  84. package/esm2022/driver/magento/2-4-5/transforms/responses/public_api.mjs +3 -0
  85. package/esm2022/driver/magento/2-4-5/validators/get-order.mjs +10 -0
  86. package/esm2022/driver/magento/2-4-5/validators/get-orders.mjs +10 -0
  87. package/esm2022/driver/magento/2-4-5/validators/public_api.mjs +2 -0
  88. package/esm2022/driver/magento/2-4-6/constants/sort/fields.mjs +15 -0
  89. package/esm2022/driver/magento/2-4-6/daffodil-customer-order-driver-magento-2-4-6.mjs +5 -0
  90. package/esm2022/driver/magento/2-4-6/driver.module.mjs +32 -0
  91. package/esm2022/driver/magento/2-4-6/errors/public_api.mjs +2 -0
  92. package/esm2022/driver/magento/2-4-6/errors/transform.mjs +6 -0
  93. package/esm2022/driver/magento/2-4-6/index.mjs +2 -0
  94. package/esm2022/driver/magento/2-4-6/injection-tokens/fragments/order.token.mjs +34 -0
  95. package/esm2022/driver/magento/2-4-6/injection-tokens/public_api.mjs +4 -0
  96. package/esm2022/driver/magento/2-4-6/injection-tokens/transforms/extra.token.mjs +29 -0
  97. package/esm2022/driver/magento/2-4-6/injection-tokens/transforms/token.mjs +13 -0
  98. package/esm2022/driver/magento/2-4-6/interfaces/order-extra-transform.type.mjs +2 -0
  99. package/esm2022/driver/magento/2-4-6/interfaces/order-transform.type.mjs +2 -0
  100. package/esm2022/driver/magento/2-4-6/interfaces/public_api.mjs +3 -0
  101. package/esm2022/driver/magento/2-4-6/models/public_api.mjs +3 -0
  102. package/esm2022/driver/magento/2-4-6/models/requests/customer-orders-filter-input.type.mjs +2 -0
  103. package/esm2022/driver/magento/2-4-6/models/requests/public_api.mjs +3 -0
  104. package/esm2022/driver/magento/2-4-6/models/requests/sort.type.mjs +2 -0
  105. package/esm2022/driver/magento/2-4-6/models/requests/sortable-field.enum.mjs +6 -0
  106. package/esm2022/driver/magento/2-4-6/models/responses/customer-orders.type.mjs +2 -0
  107. package/esm2022/driver/magento/2-4-6/models/responses/order.type.mjs +3 -0
  108. package/esm2022/driver/magento/2-4-6/models/responses/public_api.mjs +2 -0
  109. package/esm2022/driver/magento/2-4-6/order.service.mjs +77 -0
  110. package/esm2022/driver/magento/2-4-6/public_api.mjs +10 -0
  111. package/esm2022/driver/magento/2-4-6/queries/fragments/customer-order.mjs +44 -0
  112. package/esm2022/driver/magento/2-4-6/queries/fragments/public_api.mjs +2 -0
  113. package/esm2022/driver/magento/2-4-6/queries/get-customer-order/public_api.mjs +4 -0
  114. package/esm2022/driver/magento/2-4-6/queries/get-customer-order/query.mjs +20 -0
  115. package/esm2022/driver/magento/2-4-6/queries/get-customer-order/response.type.mjs +2 -0
  116. package/esm2022/driver/magento/2-4-6/queries/get-customer-order/variables.type.mjs +2 -0
  117. package/esm2022/driver/magento/2-4-6/queries/get-customer-orders/public_api.mjs +4 -0
  118. package/esm2022/driver/magento/2-4-6/queries/get-customer-orders/query.mjs +30 -0
  119. package/esm2022/driver/magento/2-4-6/queries/get-customer-orders/response.type.mjs +2 -0
  120. package/esm2022/driver/magento/2-4-6/queries/get-customer-orders/variables.type.mjs +2 -0
  121. package/esm2022/driver/magento/2-4-6/queries/public_api.mjs +4 -0
  122. package/esm2022/driver/magento/2-4-6/testing/daffodil-customer-order-driver-magento-2-4-6-testing.mjs +5 -0
  123. package/esm2022/driver/magento/2-4-6/testing/factories/order.factory.mjs +50 -0
  124. package/esm2022/driver/magento/2-4-6/testing/factories/orders.factory.mjs +37 -0
  125. package/esm2022/driver/magento/2-4-6/testing/factories/public_api.mjs +3 -0
  126. package/esm2022/driver/magento/2-4-6/testing/index.mjs +2 -0
  127. package/esm2022/driver/magento/2-4-6/testing/public_api.mjs +2 -0
  128. package/esm2022/driver/magento/2-4-6/transforms/public_api.mjs +2 -0
  129. package/esm2022/driver/magento/2-4-6/transforms/responses/order-collection.mjs +38 -0
  130. package/esm2022/driver/magento/2-4-6/transforms/responses/order.mjs +235 -0
  131. package/esm2022/driver/magento/2-4-6/transforms/responses/public_api.mjs +3 -0
  132. package/esm2022/driver/magento/2-4-6/validators/get-order.mjs +10 -0
  133. package/esm2022/driver/magento/2-4-6/validators/get-orders.mjs +10 -0
  134. package/esm2022/driver/magento/2-4-6/validators/public_api.mjs +2 -0
  135. package/fesm2022/{daffodil-customer-order-driver-magento-testing.mjs → daffodil-customer-order-driver-magento-2-4-5-testing.mjs} +1 -1
  136. package/fesm2022/daffodil-customer-order-driver-magento-2-4-5-testing.mjs.map +1 -0
  137. package/fesm2022/{daffodil-customer-order-driver-magento.mjs → daffodil-customer-order-driver-magento-2-4-5.mjs} +1 -1
  138. package/fesm2022/daffodil-customer-order-driver-magento-2-4-5.mjs.map +1 -0
  139. package/fesm2022/daffodil-customer-order-driver-magento-2-4-6-testing.mjs +86 -0
  140. package/fesm2022/daffodil-customer-order-driver-magento-2-4-6-testing.mjs.map +1 -0
  141. package/fesm2022/daffodil-customer-order-driver-magento-2-4-6.mjs +569 -0
  142. package/fesm2022/daffodil-customer-order-driver-magento-2-4-6.mjs.map +1 -0
  143. package/package.json +1 -1
  144. package/esm2022/driver/magento/driver.module.mjs +0 -32
  145. package/esm2022/driver/magento/errors/public_api.mjs +0 -2
  146. package/esm2022/driver/magento/errors/transform.mjs +0 -6
  147. package/esm2022/driver/magento/index.mjs +0 -2
  148. package/esm2022/driver/magento/injection-tokens/fragments/order.token.mjs +0 -34
  149. package/esm2022/driver/magento/injection-tokens/public_api.mjs +0 -4
  150. package/esm2022/driver/magento/injection-tokens/transforms/extra.token.mjs +0 -29
  151. package/esm2022/driver/magento/injection-tokens/transforms/token.mjs +0 -13
  152. package/esm2022/driver/magento/interfaces/order-extra-transform.type.mjs +0 -2
  153. package/esm2022/driver/magento/interfaces/order-transform.type.mjs +0 -2
  154. package/esm2022/driver/magento/interfaces/public_api.mjs +0 -3
  155. package/esm2022/driver/magento/models/public_api.mjs +0 -3
  156. package/esm2022/driver/magento/models/requests/customer-orders-filter-input.type.mjs +0 -2
  157. package/esm2022/driver/magento/models/requests/public_api.mjs +0 -2
  158. package/esm2022/driver/magento/models/responses/customer-orders.type.mjs +0 -2
  159. package/esm2022/driver/magento/models/responses/get-customer-order.type.mjs +0 -2
  160. package/esm2022/driver/magento/models/responses/get-customer-orders.type.mjs +0 -2
  161. package/esm2022/driver/magento/models/responses/order.type.mjs +0 -3
  162. package/esm2022/driver/magento/models/responses/public_api.mjs +0 -2
  163. package/esm2022/driver/magento/order.service.mjs +0 -68
  164. package/esm2022/driver/magento/public_api.mjs +0 -10
  165. package/esm2022/driver/magento/queries/fragments/customer-order.mjs +0 -44
  166. package/esm2022/driver/magento/queries/fragments/public_api.mjs +0 -2
  167. package/esm2022/driver/magento/queries/get-customer-order.mjs +0 -20
  168. package/esm2022/driver/magento/queries/get-customer-orders.mjs +0 -26
  169. package/esm2022/driver/magento/queries/public_api.mjs +0 -4
  170. package/esm2022/driver/magento/testing/daffodil-customer-order-driver-magento-testing.mjs +0 -5
  171. package/esm2022/driver/magento/testing/factories/order.factory.mjs +0 -50
  172. package/esm2022/driver/magento/testing/factories/orders.factory.mjs +0 -37
  173. package/esm2022/driver/magento/testing/factories/public_api.mjs +0 -3
  174. package/esm2022/driver/magento/testing/public_api.mjs +0 -2
  175. package/esm2022/driver/magento/transforms/public_api.mjs +0 -2
  176. package/esm2022/driver/magento/transforms/responses/order-collection.mjs +0 -40
  177. package/esm2022/driver/magento/transforms/responses/order.mjs +0 -235
  178. package/esm2022/driver/magento/transforms/responses/public_api.mjs +0 -3
  179. package/esm2022/driver/magento/validators/get-order.mjs +0 -10
  180. package/esm2022/driver/magento/validators/get-orders.mjs +0 -10
  181. package/esm2022/driver/magento/validators/public_api.mjs +0 -2
  182. package/fesm2022/daffodil-customer-order-driver-magento-testing.mjs.map +0 -1
  183. package/fesm2022/daffodil-customer-order-driver-magento.mjs.map +0 -1
  184. /package/driver/magento/{driver.module.d.ts → 2-4-5/driver.module.d.ts} +0 -0
  185. /package/driver/magento/{errors → 2-4-5/errors}/public_api.d.ts +0 -0
  186. /package/driver/magento/{errors → 2-4-5/errors}/transform.d.ts +0 -0
  187. /package/driver/magento/{index.d.ts → 2-4-5/index.d.ts} +0 -0
  188. /package/driver/magento/{injection-tokens → 2-4-5/injection-tokens}/fragments/order.token.d.ts +0 -0
  189. /package/driver/magento/{injection-tokens → 2-4-5/injection-tokens}/public_api.d.ts +0 -0
  190. /package/driver/magento/{injection-tokens → 2-4-5/injection-tokens}/transforms/extra.token.d.ts +0 -0
  191. /package/driver/magento/{injection-tokens → 2-4-5/injection-tokens}/transforms/token.d.ts +0 -0
  192. /package/driver/magento/{interfaces → 2-4-5/interfaces}/order-extra-transform.type.d.ts +0 -0
  193. /package/driver/magento/{interfaces → 2-4-5/interfaces}/order-transform.type.d.ts +0 -0
  194. /package/driver/magento/{interfaces → 2-4-5/interfaces}/public_api.d.ts +0 -0
  195. /package/driver/magento/{models → 2-4-5/models}/public_api.d.ts +0 -0
  196. /package/driver/magento/{models → 2-4-5/models}/requests/customer-orders-filter-input.type.d.ts +0 -0
  197. /package/driver/magento/{models → 2-4-5/models}/requests/public_api.d.ts +0 -0
  198. /package/driver/magento/{models → 2-4-5/models}/responses/customer-orders.type.d.ts +0 -0
  199. /package/driver/magento/{models → 2-4-5/models}/responses/get-customer-order.type.d.ts +0 -0
  200. /package/driver/magento/{models → 2-4-5/models}/responses/get-customer-orders.type.d.ts +0 -0
  201. /package/driver/magento/{models → 2-4-5/models}/responses/order.type.d.ts +0 -0
  202. /package/driver/magento/{models → 2-4-5/models}/responses/public_api.d.ts +0 -0
  203. /package/driver/magento/{order.service.d.ts → 2-4-5/order.service.d.ts} +0 -0
  204. /package/driver/magento/{public_api.d.ts → 2-4-5/public_api.d.ts} +0 -0
  205. /package/driver/magento/{queries → 2-4-5/queries}/fragments/customer-order.d.ts +0 -0
  206. /package/driver/magento/{queries → 2-4-5/queries}/fragments/public_api.d.ts +0 -0
  207. /package/driver/magento/{queries → 2-4-5/queries}/get-customer-order.d.ts +0 -0
  208. /package/driver/magento/{queries → 2-4-5/queries}/get-customer-orders.d.ts +0 -0
  209. /package/driver/magento/{queries → 2-4-5/queries}/public_api.d.ts +0 -0
  210. /package/driver/magento/{testing → 2-4-5/testing}/factories/public_api.d.ts +0 -0
  211. /package/driver/magento/{testing → 2-4-5/testing}/index.d.ts +0 -0
  212. /package/driver/magento/{testing → 2-4-5/testing}/public_api.d.ts +0 -0
  213. /package/driver/magento/{transforms → 2-4-5/transforms}/public_api.d.ts +0 -0
  214. /package/driver/magento/{transforms → 2-4-5/transforms}/responses/order-collection.d.ts +0 -0
  215. /package/driver/magento/{transforms → 2-4-5/transforms}/responses/order.d.ts +0 -0
  216. /package/driver/magento/{transforms → 2-4-5/transforms}/responses/public_api.d.ts +0 -0
  217. /package/driver/magento/{validators → 2-4-5/validators}/get-order.d.ts +0 -0
  218. /package/driver/magento/{validators → 2-4-5/validators}/get-orders.d.ts +0 -0
  219. /package/driver/magento/{validators → 2-4-5/validators}/public_api.d.ts +0 -0
@@ -0,0 +1,569 @@
1
+ import { daffAdd, daffSubtract, daffIdentifiableArrayToDict } from '@daffodil/core';
2
+ import { DaffOrderTotalTypeEnum, DaffOrderItemType } from '@daffodil/order';
3
+ import * as i3 from '@daffodil/order/driver/magento/2-4-1';
4
+ import { MagentoOrderItemType, orderItemFragment, orderShipmentFragment, orderPaymentFragment, orderInvoiceFragment, orderCreditFragment, orderAddressFragment, orderTotalFragment } from '@daffodil/order/driver/magento/2-4-1';
5
+ import * as i0 from '@angular/core';
6
+ import { InjectionToken, inject, Injectable, Inject, NgModule } from '@angular/core';
7
+ import { magentoPageInfoTransform, magentoSearchResultPageInfoFragment, daffTransformMagentoError, magentoSortDirectionRequestTransform, MagentoSortEnum } from '@daffodil/driver/magento';
8
+ import * as i1 from 'apollo-angular';
9
+ import { gql } from 'apollo-angular';
10
+ import { daffBuildFragmentNameSpread, daffBuildFragmentDefinition } from '@daffodil/core/graphql';
11
+ import { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer-order/driver';
12
+ import { throwError } from 'rxjs';
13
+ import { map, catchError } from 'rxjs/operators';
14
+ import * as i2 from '@daffodil/auth';
15
+ import { CommonModule } from '@angular/common';
16
+ import { DaffOrderDriver } from '@daffodil/order/driver';
17
+
18
+ function daffMagentoCustomerOrderTransformTotals(totals) {
19
+ return [
20
+ {
21
+ label: 'Subtotal',
22
+ type: DaffOrderTotalTypeEnum.Subtotal,
23
+ value: totals.subtotal.value,
24
+ sort_order: 0,
25
+ },
26
+ {
27
+ label: 'Discount',
28
+ type: DaffOrderTotalTypeEnum.Discount,
29
+ value: totals.discounts.reduce((acc, discount) => daffAdd(acc, discount.amount.value), 0),
30
+ sort_order: 10,
31
+ },
32
+ {
33
+ label: 'Shipping',
34
+ type: DaffOrderTotalTypeEnum.Shipping,
35
+ value: totals.total_shipping.value,
36
+ sort_order: 20,
37
+ },
38
+ {
39
+ label: 'Tax',
40
+ type: DaffOrderTotalTypeEnum.Tax,
41
+ value: totals.total_tax.value,
42
+ sort_order: 30,
43
+ },
44
+ {
45
+ label: 'Grand Total',
46
+ type: DaffOrderTotalTypeEnum.GrandTotal,
47
+ value: totals.grand_total.value,
48
+ sort_order: 40,
49
+ },
50
+ ];
51
+ }
52
+ function daffMagentoCustomerOrderTransformCouponDiscount(discount) {
53
+ return {
54
+ code: discount.label,
55
+ };
56
+ }
57
+ function daffMagentoCustomerOrderTransformConfigurableOption(option) {
58
+ return {
59
+ attribute_label: option.label,
60
+ value_label: option.value,
61
+ };
62
+ }
63
+ function daffMagentoCustomerOrderTransformBundleOption(option) {
64
+ return {
65
+ option_label: option.label,
66
+ value_label: option.values && option.values[0] && option.values[0].product_name,
67
+ };
68
+ }
69
+ function daffMagentoCustomerOrderTransformAdditionalItemFields(item) {
70
+ switch (item.product_type) {
71
+ case MagentoOrderItemType.Bundle:
72
+ return {
73
+ type: DaffOrderItemType.Composite,
74
+ options: item.bundle_options.map(daffMagentoCustomerOrderTransformBundleOption),
75
+ };
76
+ case MagentoOrderItemType.Configurable:
77
+ return {
78
+ type: DaffOrderItemType.Configurable,
79
+ attributes: item.selected_options.map(daffMagentoCustomerOrderTransformConfigurableOption),
80
+ };
81
+ case MagentoOrderItemType.Simple:
82
+ return {
83
+ type: DaffOrderItemType.Simple,
84
+ };
85
+ default:
86
+ return {};
87
+ }
88
+ }
89
+ function daffMagentoCustomerOrderTransformItem(item, order, qty) {
90
+ const discount = item.discounts.reduce((acc, d) => daffAdd(acc, d.amount.value), 0);
91
+ const rowTotal = qty * item.product_sale_price.value;
92
+ const rowTotalWithDiscount = qty * daffSubtract(item.product_sale_price.value, discount);
93
+ return {
94
+ type: DaffOrderItemType.Simple,
95
+ id: null,
96
+ item_id: null,
97
+ qty_ordered: item.quantity_ordered,
98
+ qty_canceled: item.quantity_canceled,
99
+ qty_fulfilled: item.quantity_shipped,
100
+ qty,
101
+ image: {
102
+ url: item.product_url_key,
103
+ id: null,
104
+ label: null,
105
+ },
106
+ order_id: order.id,
107
+ created_at: null,
108
+ updated_at: null,
109
+ product_id: null,
110
+ parent_item_id: null,
111
+ sku: item.product_sku,
112
+ name: item.product_name,
113
+ weight: null,
114
+ price: item.product_sale_price.value,
115
+ discount_percent: Math.floor(discount / item.product_sale_price.value * 100),
116
+ discount_amount: discount,
117
+ tax_percent: null,
118
+ tax_amount: null,
119
+ row_total: rowTotal,
120
+ row_total_with_discount: rowTotalWithDiscount,
121
+ row_weight: null,
122
+ tax_before_discount: null,
123
+ ...daffMagentoCustomerOrderTransformAdditionalItemFields(item),
124
+ };
125
+ }
126
+ function daffMagentoCustomerOrderTransformAddress(address, order) {
127
+ return {
128
+ order_id: order.id,
129
+ prefix: address.prefix,
130
+ suffix: address.suffix,
131
+ firstname: address.firstname,
132
+ middlename: address.middlename,
133
+ lastname: address.lastname,
134
+ telephone: address.telephone,
135
+ street: address.street[0],
136
+ street2: address.street[1],
137
+ city: address.city,
138
+ region: String(address.region_id),
139
+ region_code: address.region_code,
140
+ country: address.country_code,
141
+ postcode: address.postcode,
142
+ };
143
+ }
144
+ function daffMagentoCustomerOrderTransformShipmentItem(shipmentItem, order) {
145
+ return {
146
+ item: daffMagentoCustomerOrderTransformItem(shipmentItem.order_item, order, shipmentItem.quantity_shipped),
147
+ qty: shipmentItem.quantity_shipped,
148
+ };
149
+ }
150
+ function daffMagentoCustomerOrderTransformShipmentTracking(tracking) {
151
+ return {
152
+ tracking_number: tracking.number,
153
+ tracking_url: null,
154
+ carrier: tracking.carrier,
155
+ title: tracking.title,
156
+ carrier_logo: null,
157
+ };
158
+ }
159
+ function daffMagentoCustomerOrderTransformShipment(shipment, order) {
160
+ return {
161
+ carrier: order.carrier,
162
+ carrier_title: null,
163
+ code: null,
164
+ method: order.shipping_method,
165
+ method_description: null,
166
+ tracking: shipment.tracking.map(daffMagentoCustomerOrderTransformShipmentTracking),
167
+ items: shipment.items.map(item => daffMagentoCustomerOrderTransformShipmentItem(item, order)),
168
+ };
169
+ }
170
+ function daffMagentoCustomerOrderTransformPayment(payment, order) {
171
+ const findAdditionalData = key => {
172
+ const index = payment.additional_data.findIndex(({ name }) => name === key);
173
+ return index > -1 ? payment.additional_data[index].value : null;
174
+ };
175
+ return {
176
+ id: null,
177
+ payment_id: null,
178
+ order_id: order.id,
179
+ created_at: null,
180
+ updated_at: null,
181
+ method: payment.type,
182
+ cc_type: findAdditionalData('cc_type'),
183
+ cc_last4: findAdditionalData('cc_last4'),
184
+ cc_owner: findAdditionalData('cc_owner'),
185
+ cc_exp_month: findAdditionalData('cc_exp_month'),
186
+ cc_exp_year: findAdditionalData('cc_exp_year'),
187
+ };
188
+ }
189
+ function daffMagentoCustomerOrderTransformInvoiceItem(invoiceItem, order) {
190
+ return {
191
+ item: daffMagentoCustomerOrderTransformItem(invoiceItem.order_item, order, invoiceItem.quantity_invoiced),
192
+ qty: invoiceItem.quantity_invoiced,
193
+ };
194
+ }
195
+ function daffMagentoCustomerOrderTransformInvoice(invoice, order, payment) {
196
+ return {
197
+ totals: daffMagentoCustomerOrderTransformTotals(invoice.total),
198
+ billing_address: daffMagentoCustomerOrderTransformAddress(order.billing_address, order),
199
+ shipping_address: daffMagentoCustomerOrderTransformAddress(order.shipping_address, order),
200
+ payment: daffMagentoCustomerOrderTransformPayment(payment, order),
201
+ items: invoice.items.map(item => daffMagentoCustomerOrderTransformInvoiceItem(item, order)),
202
+ shipping_method: null,
203
+ };
204
+ }
205
+ function daffMagentoCustomerOrderTransformCreditItem(creditItem, order) {
206
+ return {
207
+ item: daffMagentoCustomerOrderTransformItem(creditItem.order_item, order, creditItem.quantity_refunded),
208
+ qty: creditItem.quantity_refunded,
209
+ };
210
+ }
211
+ function daffMagentoCustomerOrderTransformCredit(credit, order) {
212
+ return {
213
+ totals: daffMagentoCustomerOrderTransformTotals(credit.total),
214
+ billing_address: daffMagentoCustomerOrderTransformAddress(order.billing_address, order),
215
+ shipping_address: daffMagentoCustomerOrderTransformAddress(order.shipping_address, order),
216
+ payment: daffMagentoCustomerOrderTransformPayment(order.payment_methods[0], order),
217
+ items: credit.items.map(item => daffMagentoCustomerOrderTransformCreditItem(item, order)),
218
+ shipping_method: null,
219
+ };
220
+ }
221
+ /**
222
+ * Transforms the MagentoCustomerOrder from the magento order query into a DaffOrder.
223
+ */
224
+ function daffMagentoCustomerOrderTransformOrder(order, email) {
225
+ return {
226
+ extra_attributes: order,
227
+ id: order.number,
228
+ email,
229
+ customer_id: null,
230
+ updated_at: null,
231
+ created_at: order.order_date,
232
+ status: order.status,
233
+ totals: daffMagentoCustomerOrderTransformTotals(order.total),
234
+ applied_codes: order.total.discounts.map(daffMagentoCustomerOrderTransformCouponDiscount),
235
+ items: order.items.map(item => daffMagentoCustomerOrderTransformItem(item, order, item.quantity_ordered)),
236
+ billing_addresses: [
237
+ daffMagentoCustomerOrderTransformAddress(order.billing_address, order),
238
+ ],
239
+ shipping_addresses: [
240
+ daffMagentoCustomerOrderTransformAddress(order.shipping_address, order),
241
+ ],
242
+ shipments: order.shipments.map(shipment => daffMagentoCustomerOrderTransformShipment(shipment, order)),
243
+ payment: daffMagentoCustomerOrderTransformPayment(order.payment_methods[0], order),
244
+ // TODO: find out if the index is the correct payment for invoice
245
+ invoices: order.invoices.map((invoice, index) => daffMagentoCustomerOrderTransformInvoice(invoice, order, order.payment_methods[index])),
246
+ credits: order.credit_memos.map(credit => daffMagentoCustomerOrderTransformCredit(credit, order)),
247
+ };
248
+ }
249
+
250
+ var MagentoCustomerOrderSortableField;
251
+ (function (MagentoCustomerOrderSortableField) {
252
+ MagentoCustomerOrderSortableField["NUMBER"] = "NUMBER";
253
+ MagentoCustomerOrderSortableField["CREATED_AT"] = "CREATED_AT";
254
+ })(MagentoCustomerOrderSortableField || (MagentoCustomerOrderSortableField = {}));
255
+
256
+ const magentoCustomerOrderSortFields = {
257
+ options: [
258
+ {
259
+ label: 'Date',
260
+ value: MagentoCustomerOrderSortableField.CREATED_AT,
261
+ },
262
+ {
263
+ label: 'Number',
264
+ value: MagentoCustomerOrderSortableField.NUMBER,
265
+ },
266
+ ],
267
+ default: MagentoCustomerOrderSortableField.CREATED_AT,
268
+ };
269
+
270
+ /**
271
+ * A multi-provider injection token for providing extra transform logic in the Order Magento driver.
272
+ * It is run after the standard transforms for each customer order preview and passed both the current transformed Daffodil customer order and the Magento customer order.
273
+ *
274
+ * See {@link MagentoCustomerOrder} for more info.
275
+ */
276
+ const DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS = new InjectionToken('DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS', { factory: () => [] });
277
+ /**
278
+ * Provides extra customer order preview transforms for the Magento customer order driver.
279
+ *
280
+ * See {@link DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS}.
281
+ *
282
+ * ```ts
283
+ * providers: [
284
+ * ...daffProvideCustomerOrderMagentoExtraOrderTransforms(
285
+ * myExtraOrderTransform
286
+ * )
287
+ * ]
288
+ * ```
289
+ */
290
+ function daffProvideCustomerOrderMagentoExtraOrderTransforms(...transforms) {
291
+ return transforms.map(transform => ({
292
+ provide: DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS,
293
+ useValue: transform,
294
+ multi: true,
295
+ }));
296
+ }
297
+
298
+ /**
299
+ * An internal token to combine the Magento preview transform with the injected transforms.
300
+ */
301
+ const DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM = new InjectionToken('DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM', {
302
+ factory: () => {
303
+ const transforms = inject(DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS);
304
+ return (magentoOrder, email) => transforms.reduce((daffOrder, transform) => transform(daffOrder, magentoOrder, email), daffMagentoCustomerOrderTransformOrder(magentoOrder, email));
305
+ },
306
+ });
307
+
308
+ class MagentoCustomerOrderCollectionTransformer {
309
+ constructor(orderTransform) {
310
+ this.orderTransform = orderTransform;
311
+ }
312
+ transform(response, request) {
313
+ const orders = response.customer.orders.items.map((order) => this.orderTransform(order, response.customer.email));
314
+ return {
315
+ data: daffIdentifiableArrayToDict(orders),
316
+ metadata: {
317
+ ...magentoPageInfoTransform(response.customer.orders.page_info),
318
+ count: response.customer.orders.total_count,
319
+ filters: {},
320
+ ids: orders.map(order => order.id),
321
+ sortOptions: magentoCustomerOrderSortFields,
322
+ appliedSortDirection: request.appliedSortDirection,
323
+ appliedSortOption: request.appliedSortOption,
324
+ },
325
+ };
326
+ }
327
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: MagentoCustomerOrderCollectionTransformer, deps: [{ token: DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM }], target: i0.ɵɵFactoryTarget.Injectable }); }
328
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: MagentoCustomerOrderCollectionTransformer, providedIn: 'any' }); }
329
+ }
330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: MagentoCustomerOrderCollectionTransformer, decorators: [{
331
+ type: Injectable,
332
+ args: [{
333
+ providedIn: 'any',
334
+ }]
335
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
336
+ type: Inject,
337
+ args: [DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM]
338
+ }] }] });
339
+
340
+ const magentoCustomerOrderFragment = gql `
341
+ fragment magentoCustomerOrder on CustomerOrder {
342
+ id
343
+ order_date
344
+ status
345
+ carrier
346
+ number
347
+ shipping_method
348
+ items {
349
+ ...orderItem
350
+ }
351
+ billing_address {
352
+ ...orderAddress
353
+ }
354
+ shipping_address {
355
+ ...orderAddress
356
+ }
357
+ shipments {
358
+ ...orderShipment
359
+ }
360
+ payment_methods {
361
+ ...orderPayment
362
+ }
363
+ invoices {
364
+ ...orderInvoice
365
+ }
366
+ credit_memos {
367
+ ...orderCredit
368
+ }
369
+ total {
370
+ ...orderTotal
371
+ }
372
+ }
373
+ ${orderItemFragment}
374
+ ${orderShipmentFragment}
375
+ ${orderPaymentFragment}
376
+ ${orderInvoiceFragment}
377
+ ${orderCreditFragment}
378
+ ${orderAddressFragment}
379
+ ${orderTotalFragment}
380
+ `;
381
+
382
+ const MAGENTO_GET_CUSTOMER_ORDERS_QUERY_NAME = 'MagentoGetCustomerOrders';
383
+ const getCustomerOrders = (extraProductFragments = []) => gql `
384
+ query ${MAGENTO_GET_CUSTOMER_ORDERS_QUERY_NAME}(
385
+ $currentPage: Int,
386
+ $pageSize: Int,
387
+ $sort: CustomerOrderSortInput
388
+ ) {
389
+ customer {
390
+ email
391
+ orders(currentPage: $currentPage, pageSize: $pageSize, sort: $sort) {
392
+ items {
393
+ ...magentoCustomerOrder
394
+ ${daffBuildFragmentNameSpread(...extraProductFragments)}
395
+ }
396
+ page_info {
397
+ ...magentoSearchResultPageInfo
398
+ }
399
+ total_count
400
+ }
401
+ }
402
+ }
403
+ ${magentoCustomerOrderFragment}
404
+ ${magentoSearchResultPageInfoFragment}
405
+ ${daffBuildFragmentDefinition(...extraProductFragments)}
406
+ `;
407
+
408
+ const MAGENTO_GET_CUSTOMER_ORDER_QUERY_NAME = 'MagentoGetCustomerOrder';
409
+ const getCustomerOrder = (extraProductFragments = []) => gql `
410
+ query ${MAGENTO_GET_CUSTOMER_ORDER_QUERY_NAME}($id: String!) {
411
+ customer {
412
+ email
413
+ orders(filter: {number: {eq: $id}}) {
414
+ items {
415
+ ...magentoCustomerOrder
416
+ ${daffBuildFragmentNameSpread(...extraProductFragments)}
417
+ }
418
+ }
419
+ }
420
+ }
421
+ ${magentoCustomerOrderFragment}
422
+ ${daffBuildFragmentDefinition(...extraProductFragments)}
423
+ `;
424
+
425
+ function transformMagentoReviewsError(error) {
426
+ return daffTransformMagentoError(error, {}) || new DaffCustomerInvalidAPIResponseError(error.message);
427
+ }
428
+
429
+ const validateGetCustomerOrdersResponse = (response) => {
430
+ if (response.data.customer?.orders.items) {
431
+ return response;
432
+ }
433
+ else {
434
+ throw new DaffCustomerInvalidAPIResponseError('Get customer orders response does not contain customer orders.');
435
+ }
436
+ };
437
+
438
+ /**
439
+ * A multi-provider injection token for providing extra GraphQL fragments that will be spread into order queries.
440
+ * This can be used to retrieve additional data that is not covered by the standard Daffodil interfaces.
441
+ *
442
+ * Fragment structure is platform-specific and this feature should be used with care.
443
+ *
444
+ * This can increase query complexity above the Magento default of 300.
445
+ * Daffodil only guarantees that stock queries don't exceed the limit of 300.
446
+ * Apps using this token should therefore increase the query complexity limit
447
+ * to accommodate the extra complexity contributed by the provided fragments.
448
+ */
449
+ const DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS = new InjectionToken('DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS', { factory: () => [] });
450
+ /**
451
+ * Provides extra GraphQL fragments for the Magento order driver.
452
+ *
453
+ * See {@link DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS}.
454
+ *
455
+ * ```ts
456
+ * providers: [
457
+ * ...daffProvideCustomerOrderMagentoExtraOrderFragments(
458
+ * myExtraOrderFragment
459
+ * )
460
+ * ]
461
+ * ```
462
+ */
463
+ function daffProvideCustomerOrderMagentoExtraOrderFragments(...fragments) {
464
+ return fragments.map(fragment => ({
465
+ provide: DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS,
466
+ useValue: fragment,
467
+ multi: true,
468
+ }));
469
+ }
470
+
471
+ const validateGetCustomerOrderResponse = (response) => {
472
+ if (response.data.customer?.orders.items[0]) {
473
+ return response;
474
+ }
475
+ else {
476
+ throw new DaffCustomerInvalidAPIResponseError('Get customer order response does not contain a customer order.');
477
+ }
478
+ };
479
+
480
+ /**
481
+ * A service for making Magento GraphQL queries for customers.
482
+ *
483
+ * @inheritdoc
484
+ */
485
+ class DaffCustomerOrderMagentoService {
486
+ constructor(apollo, authStorage, guestDriver, extraFragments, transformer, orderTransform) {
487
+ this.apollo = apollo;
488
+ this.authStorage = authStorage;
489
+ this.guestDriver = guestDriver;
490
+ this.extraFragments = extraFragments;
491
+ this.transformer = transformer;
492
+ this.orderTransform = orderTransform;
493
+ }
494
+ list(cartId, request = {}) {
495
+ const variables = {
496
+ currentPage: request.currentPage,
497
+ pageSize: request.pageSize,
498
+ };
499
+ if (request.appliedSortDirection || request.appliedSortOption) {
500
+ variables.sort = {
501
+ sort_direction: request.appliedSortDirection ? magentoSortDirectionRequestTransform(request.appliedSortDirection) : MagentoSortEnum.DESC,
502
+ sort_field: request.appliedSortOption || MagentoCustomerOrderSortableField.CREATED_AT,
503
+ };
504
+ }
505
+ return this.authStorage.getAuthToken()
506
+ ? this.apollo.query({
507
+ query: getCustomerOrders(this.extraFragments),
508
+ variables,
509
+ }).pipe(map(validateGetCustomerOrdersResponse), map(response => this.transformer.transform(response.data, request)), catchError(err => throwError(() => transformMagentoReviewsError(err))))
510
+ : this.guestDriver.list(cartId);
511
+ }
512
+ get(orderId, cartId) {
513
+ return this.authStorage.getAuthToken()
514
+ ? this.apollo.query({
515
+ query: getCustomerOrder(this.extraFragments),
516
+ variables: {
517
+ id: orderId,
518
+ },
519
+ }).pipe(map(validateGetCustomerOrderResponse), map(result => this.orderTransform(result.data.customer.orders.items[0], result.data.customer.email)), catchError(err => throwError(() => transformMagentoReviewsError(err))))
520
+ : this.guestDriver.get(orderId, cartId);
521
+ }
522
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DaffCustomerOrderMagentoService, deps: [{ token: i1.Apollo }, { token: i2.DaffAuthStorageService }, { token: i3.DaffOrderMagentoService }, { token: DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS }, { token: MagentoCustomerOrderCollectionTransformer }, { token: DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM }], target: i0.ɵɵFactoryTarget.Injectable }); }
523
+ /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DaffCustomerOrderMagentoService, providedIn: 'root' }); }
524
+ }
525
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DaffCustomerOrderMagentoService, decorators: [{
526
+ type: Injectable,
527
+ args: [{
528
+ providedIn: 'root',
529
+ }]
530
+ }], ctorParameters: () => [{ type: i1.Apollo }, { type: i2.DaffAuthStorageService }, { type: i3.DaffOrderMagentoService }, { type: undefined, decorators: [{
531
+ type: Inject,
532
+ args: [DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS]
533
+ }] }, { type: MagentoCustomerOrderCollectionTransformer }, { type: undefined, decorators: [{
534
+ type: Inject,
535
+ args: [DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM]
536
+ }] }] });
537
+
538
+ class DaffCustomerOrderMagentoDriverModule {
539
+ static forRoot() {
540
+ return {
541
+ ngModule: DaffCustomerOrderMagentoDriverModule,
542
+ providers: [
543
+ MagentoCustomerOrderCollectionTransformer,
544
+ {
545
+ provide: DaffOrderDriver,
546
+ useExisting: DaffCustomerOrderMagentoService,
547
+ },
548
+ ],
549
+ };
550
+ }
551
+ /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DaffCustomerOrderMagentoDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
552
+ /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.10", ngImport: i0, type: DaffCustomerOrderMagentoDriverModule, imports: [CommonModule] }); }
553
+ /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DaffCustomerOrderMagentoDriverModule, imports: [CommonModule] }); }
554
+ }
555
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DaffCustomerOrderMagentoDriverModule, decorators: [{
556
+ type: NgModule,
557
+ args: [{
558
+ imports: [
559
+ CommonModule,
560
+ ],
561
+ }]
562
+ }] });
563
+
564
+ /**
565
+ * Generated bundle index. Do not edit.
566
+ */
567
+
568
+ export { DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS, DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS, DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM, DaffCustomerOrderMagentoDriverModule, DaffCustomerOrderMagentoService, MAGENTO_GET_CUSTOMER_ORDERS_QUERY_NAME, MAGENTO_GET_CUSTOMER_ORDER_QUERY_NAME, MagentoCustomerOrderCollectionTransformer, MagentoCustomerOrderSortableField, daffMagentoCustomerOrderTransformAdditionalItemFields, daffMagentoCustomerOrderTransformAddress, daffMagentoCustomerOrderTransformBundleOption, daffMagentoCustomerOrderTransformConfigurableOption, daffMagentoCustomerOrderTransformCouponDiscount, daffMagentoCustomerOrderTransformCredit, daffMagentoCustomerOrderTransformCreditItem, daffMagentoCustomerOrderTransformInvoice, daffMagentoCustomerOrderTransformInvoiceItem, daffMagentoCustomerOrderTransformItem, daffMagentoCustomerOrderTransformOrder, daffMagentoCustomerOrderTransformPayment, daffMagentoCustomerOrderTransformShipment, daffMagentoCustomerOrderTransformShipmentItem, daffMagentoCustomerOrderTransformShipmentTracking, daffMagentoCustomerOrderTransformTotals, daffProvideCustomerOrderMagentoExtraOrderFragments, daffProvideCustomerOrderMagentoExtraOrderTransforms, getCustomerOrder, getCustomerOrders, magentoCustomerOrderFragment, transformMagentoReviewsError, validateGetCustomerOrdersResponse };
569
+ //# sourceMappingURL=daffodil-customer-order-driver-magento-2-4-6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"daffodil-customer-order-driver-magento-2-4-6.mjs","sources":["../../../libs/customer-order/driver/magento/2-4-6/src/transforms/responses/order.ts","../../../libs/customer-order/driver/magento/2-4-6/src/models/requests/sortable-field.enum.ts","../../../libs/customer-order/driver/magento/2-4-6/src/constants/sort/fields.ts","../../../libs/customer-order/driver/magento/2-4-6/src/injection-tokens/transforms/extra.token.ts","../../../libs/customer-order/driver/magento/2-4-6/src/injection-tokens/transforms/token.ts","../../../libs/customer-order/driver/magento/2-4-6/src/transforms/responses/order-collection.ts","../../../libs/customer-order/driver/magento/2-4-6/src/queries/fragments/customer-order.ts","../../../libs/customer-order/driver/magento/2-4-6/src/queries/get-customer-orders/query.ts","../../../libs/customer-order/driver/magento/2-4-6/src/queries/get-customer-order/query.ts","../../../libs/customer-order/driver/magento/2-4-6/src/errors/transform.ts","../../../libs/customer-order/driver/magento/2-4-6/src/validators/get-orders.ts","../../../libs/customer-order/driver/magento/2-4-6/src/injection-tokens/fragments/order.token.ts","../../../libs/customer-order/driver/magento/2-4-6/src/validators/get-order.ts","../../../libs/customer-order/driver/magento/2-4-6/src/order.service.ts","../../../libs/customer-order/driver/magento/2-4-6/src/driver.module.ts","../../../libs/customer-order/driver/magento/2-4-6/src/daffodil-customer-order-driver-magento-2-4-6.ts"],"sourcesContent":["import {\n daffAdd,\n daffSubtract,\n} from '@daffodil/core';\nimport { MagentoDiscount } from '@daffodil/driver/magento';\nimport {\n DaffOrder,\n DaffOrderTotal,\n DaffOrderItem,\n DaffOrderAddress,\n DaffOrderShipment,\n DaffOrderShipmentItem,\n DaffOrderShipmentTracking,\n DaffOrderPayment,\n DaffOrderInvoice,\n DaffOrderTotalTypeEnum,\n DaffCompositeOrderItemOption,\n DaffOrderItemType,\n DaffConfigurableOrderItemAttribute,\n DaffOrderCoupon,\n} from '@daffodil/order';\nimport {\n MagentoOrderTotal,\n MagentoOrderItemOption,\n MagentoOrderBundleItemSelectedOption,\n MagentoOrderItem,\n MagentoOrderItemType,\n MagentoOrderBundleItem,\n MagentoOrderAddress,\n MagentoOrderShipmentItem,\n MagentoOrderShipmentTracking,\n MagentoOrderShipment,\n MagentoOrderPayment,\n MagentoOrderInvoiceItem,\n MagentoOrderInvoice,\n MagentoOrderCreditItem,\n MagentoOrderCredit,\n} from '@daffodil/order/driver/magento/2-4-1';\n\nimport { MagentoCustomerOrder } from '../../models/public_api';\n\nexport function daffMagentoCustomerOrderTransformTotals(totals: MagentoOrderTotal): DaffOrderTotal[] {\n return [\n {\n label: 'Subtotal',\n type: DaffOrderTotalTypeEnum.Subtotal,\n value: totals.subtotal.value,\n sort_order: 0,\n },\n {\n label: 'Discount',\n type: DaffOrderTotalTypeEnum.Discount,\n value: totals.discounts.reduce((acc, discount) => daffAdd(acc, discount.amount.value), 0),\n sort_order: 10,\n },\n {\n label: 'Shipping',\n type: DaffOrderTotalTypeEnum.Shipping,\n value: totals.total_shipping.value,\n sort_order: 20,\n },\n {\n label: 'Tax',\n type: DaffOrderTotalTypeEnum.Tax,\n value: totals.total_tax.value,\n sort_order: 30,\n },\n {\n label: 'Grand Total',\n type: DaffOrderTotalTypeEnum.GrandTotal,\n value: totals.grand_total.value,\n sort_order: 40,\n },\n ];\n}\n\nexport function daffMagentoCustomerOrderTransformCouponDiscount(discount: MagentoDiscount): DaffOrderCoupon {\n return {\n code: discount.label,\n };\n}\n\nexport function daffMagentoCustomerOrderTransformConfigurableOption(option: MagentoOrderItemOption): DaffConfigurableOrderItemAttribute {\n return {\n attribute_label: option.label,\n\t value_label: option.value,\n };\n}\n\nexport function daffMagentoCustomerOrderTransformBundleOption(option: MagentoOrderBundleItemSelectedOption): DaffCompositeOrderItemOption {\n return {\n option_label: option.label,\n\t value_label: option.values && option.values[0] && option.values[0].product_name,\n };\n}\n\nexport function daffMagentoCustomerOrderTransformAdditionalItemFields(item: MagentoOrderItem) {\n switch (item.product_type) {\n case MagentoOrderItemType.Bundle:\n return {\n type: DaffOrderItemType.Composite,\n options: (<MagentoOrderBundleItem>item).bundle_options.map(daffMagentoCustomerOrderTransformBundleOption),\n };\n case MagentoOrderItemType.Configurable:\n return {\n type: DaffOrderItemType.Configurable,\n attributes: item.selected_options.map(daffMagentoCustomerOrderTransformConfigurableOption),\n };\n case MagentoOrderItemType.Simple:\n return {\n type: DaffOrderItemType.Simple,\n };\n default:\n return {};\n }\n}\n\nexport function daffMagentoCustomerOrderTransformItem(item: MagentoOrderItem, order: MagentoCustomerOrder, qty: number): DaffOrderItem {\n const discount = item.discounts.reduce((acc, d) => daffAdd(acc, d.amount.value), 0);\n const rowTotal = qty * item.product_sale_price.value;\n const rowTotalWithDiscount = qty * daffSubtract(item.product_sale_price.value, discount);\n\n return {\n type: DaffOrderItemType.Simple,\n id: null,\n item_id: null,\n qty_ordered: item.quantity_ordered,\n qty_canceled: item.quantity_canceled,\n qty_fulfilled: item.quantity_shipped,\n qty,\n image: {\n url: item.product_url_key,\n id: null,\n label: null,\n },\n order_id: order.id,\n created_at: null,\n updated_at: null,\n product_id: null,\n parent_item_id: null,\n sku: item.product_sku,\n name: item.product_name,\n weight: null,\n price: item.product_sale_price.value,\n discount_percent: Math.floor(discount / item.product_sale_price.value * 100),\n discount_amount: discount,\n tax_percent: null,\n tax_amount: null,\n row_total: rowTotal,\n row_total_with_discount: rowTotalWithDiscount,\n row_weight: null,\n tax_before_discount: null,\n ...daffMagentoCustomerOrderTransformAdditionalItemFields(item),\n };\n}\n\nexport function daffMagentoCustomerOrderTransformAddress(address: MagentoOrderAddress, order: MagentoCustomerOrder): DaffOrderAddress {\n return {\n order_id: 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 street: address.street[0],\n street2: address.street[1],\n city: address.city,\n region: String(address.region_id),\n region_code: address.region_code,\n country: address.country_code,\n postcode: address.postcode,\n };\n}\n\nexport function daffMagentoCustomerOrderTransformShipmentItem(shipmentItem: MagentoOrderShipmentItem, order: MagentoCustomerOrder): DaffOrderShipmentItem {\n return {\n item: daffMagentoCustomerOrderTransformItem(shipmentItem.order_item, order, shipmentItem.quantity_shipped),\n qty: shipmentItem.quantity_shipped,\n };\n}\n\nexport function daffMagentoCustomerOrderTransformShipmentTracking(tracking: MagentoOrderShipmentTracking): DaffOrderShipmentTracking {\n return {\n tracking_number: tracking.number,\n tracking_url: null,\n carrier: tracking.carrier,\n title: tracking.title,\n carrier_logo: null,\n };\n}\n\nexport function daffMagentoCustomerOrderTransformShipment(shipment: MagentoOrderShipment, order: MagentoCustomerOrder): DaffOrderShipment {\n return {\n carrier: order.carrier,\n carrier_title: null,\n code: null,\n method: order.shipping_method,\n method_description: null,\n tracking: shipment.tracking.map(daffMagentoCustomerOrderTransformShipmentTracking),\n items: shipment.items.map(item => daffMagentoCustomerOrderTransformShipmentItem(item, order)),\n };\n}\n\nexport function daffMagentoCustomerOrderTransformPayment(payment: MagentoOrderPayment, order: MagentoCustomerOrder): DaffOrderPayment {\n const findAdditionalData = key => {\n const index = payment.additional_data.findIndex(({ name }) => name === key);\n\n return index > -1 ? payment.additional_data[index].value : null;\n };\n return {\n id: null,\n payment_id: null,\n order_id: order.id,\n created_at: null,\n updated_at: null,\n method: payment.type,\n cc_type: findAdditionalData('cc_type'),\n cc_last4: findAdditionalData('cc_last4'),\n cc_owner: findAdditionalData('cc_owner'),\n cc_exp_month: findAdditionalData('cc_exp_month'),\n cc_exp_year: findAdditionalData('cc_exp_year'),\n };\n}\n\nexport function daffMagentoCustomerOrderTransformInvoiceItem(invoiceItem: MagentoOrderInvoiceItem, order: MagentoCustomerOrder): DaffOrderShipmentItem {\n return {\n item: daffMagentoCustomerOrderTransformItem(invoiceItem.order_item, order, invoiceItem.quantity_invoiced),\n qty: invoiceItem.quantity_invoiced,\n };\n}\n\nexport function daffMagentoCustomerOrderTransformInvoice(invoice: MagentoOrderInvoice, order: MagentoCustomerOrder, payment: MagentoOrderPayment): DaffOrderInvoice {\n return {\n totals: daffMagentoCustomerOrderTransformTotals(invoice.total),\n billing_address: daffMagentoCustomerOrderTransformAddress(order.billing_address, order),\n shipping_address: daffMagentoCustomerOrderTransformAddress(order.shipping_address, order),\n payment: daffMagentoCustomerOrderTransformPayment(payment, order),\n items: invoice.items.map(item => daffMagentoCustomerOrderTransformInvoiceItem(item, order)),\n shipping_method: null,\n };\n}\n\nexport function daffMagentoCustomerOrderTransformCreditItem(creditItem: MagentoOrderCreditItem, order: MagentoCustomerOrder): DaffOrderShipmentItem {\n return {\n item: daffMagentoCustomerOrderTransformItem(creditItem.order_item, order, creditItem.quantity_refunded),\n qty: creditItem.quantity_refunded,\n };\n}\n\nexport function daffMagentoCustomerOrderTransformCredit(credit: MagentoOrderCredit, order: MagentoCustomerOrder): DaffOrderInvoice {\n return {\n totals: daffMagentoCustomerOrderTransformTotals(credit.total),\n billing_address: daffMagentoCustomerOrderTransformAddress(order.billing_address, order),\n shipping_address: daffMagentoCustomerOrderTransformAddress(order.shipping_address, order),\n payment: daffMagentoCustomerOrderTransformPayment(order.payment_methods[0], order),\n items: credit.items.map(item => daffMagentoCustomerOrderTransformCreditItem(item, order)),\n shipping_method: null,\n };\n}\n\n/**\n * Transforms the MagentoCustomerOrder from the magento order query into a DaffOrder.\n */\nexport function daffMagentoCustomerOrderTransformOrder(order: MagentoCustomerOrder, email: string): DaffOrder {\n return {\n extra_attributes: order,\n\n id: order.number,\n email,\n customer_id: null,\n updated_at: null,\n created_at: order.order_date,\n status: order.status,\n\n totals: daffMagentoCustomerOrderTransformTotals(order.total),\n applied_codes: order.total.discounts.map(daffMagentoCustomerOrderTransformCouponDiscount),\n items: order.items.map(item => daffMagentoCustomerOrderTransformItem(item, order, item.quantity_ordered)),\n billing_addresses: [\n daffMagentoCustomerOrderTransformAddress(order.billing_address, order),\n ],\n shipping_addresses: [\n daffMagentoCustomerOrderTransformAddress(order.shipping_address, order),\n ],\n shipments: order.shipments.map(shipment => daffMagentoCustomerOrderTransformShipment(shipment, order)),\n payment: daffMagentoCustomerOrderTransformPayment(order.payment_methods[0], order),\n // TODO: find out if the index is the correct payment for invoice\n invoices: order.invoices.map((invoice, index) => daffMagentoCustomerOrderTransformInvoice(invoice, order, order.payment_methods[index])),\n credits: order.credit_memos.map(credit => daffMagentoCustomerOrderTransformCredit(credit, order)),\n };\n}\n","export enum MagentoCustomerOrderSortableField {\n NUMBER = 'NUMBER',\n CREATED_AT = 'CREATED_AT'\n}\n","import { DaffSortOptions } from '@daffodil/core';\n\nimport { MagentoCustomerOrderSortableField } from '../../models/public_api';\n\nexport const magentoCustomerOrderSortFields: DaffSortOptions = {\n options: [\n {\n label: 'Date',\n value: MagentoCustomerOrderSortableField.CREATED_AT,\n },\n {\n label: 'Number',\n value: MagentoCustomerOrderSortableField.NUMBER,\n },\n ],\n default: MagentoCustomerOrderSortableField.CREATED_AT,\n};\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\n\n// workaround https://github.com/graycoreio/daffodil/issues/1667\nimport { DaffOrder } from '@daffodil/order';\n\nimport { DaffMagentoCustomerOrderExtraTransform } from '../../interfaces/public_api';\nimport { MagentoCustomerOrder } from '../../models/public_api';\n\n/**\n * A multi-provider injection token for providing extra transform logic in the Order Magento driver.\n * It is run after the standard transforms for each customer order preview and passed both the current transformed Daffodil customer order and the Magento customer order.\n *\n * See {@link MagentoCustomerOrder} for more info.\n */\nexport const DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS = new InjectionToken<DaffMagentoCustomerOrderExtraTransform[]>(\n 'DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS',\n { factory: () => []},\n);\n\n/**\n * Provides extra customer order preview transforms for the Magento customer order driver.\n *\n * See {@link DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS}.\n *\n * ```ts\n * providers: [\n * ...daffProvideCustomerOrderMagentoExtraOrderTransforms(\n * myExtraOrderTransform\n * )\n * ]\n * ```\n */\nexport function daffProvideCustomerOrderMagentoExtraOrderTransforms<T extends MagentoCustomerOrder = MagentoCustomerOrder, V extends DaffOrder = DaffOrder>(...transforms: DaffMagentoCustomerOrderExtraTransform<T, V>[]): Provider[] {\n return transforms.map(transform => ({\n provide: DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS,\n useValue: transform,\n multi: true,\n }));\n}\n","import {\n InjectionToken,\n inject,\n} from '@angular/core';\n\n// workaround https://github.com/graycoreio/daffodil/issues/1667\nimport { DaffOrder } from '@daffodil/order';\n\nimport { DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS } from './extra.token';\nimport { DaffMagentoCustomerOrderTransform } from '../../interfaces/public_api';\nimport { MagentoCustomerOrder } from '../../models/public_api';\nimport { daffMagentoCustomerOrderTransformOrder } from '../../transforms/responses/order';\n\n/**\n * An internal token to combine the Magento preview transform with the injected transforms.\n */\nexport const DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM = new InjectionToken<DaffMagentoCustomerOrderTransform>(\n 'DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM',\n {\n factory: () => {\n const transforms = inject(DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_TRANSFORMS);\n return (magentoOrder: MagentoCustomerOrder, email: string) =>\n transforms.reduce(\n (daffOrder, transform) => transform(daffOrder, magentoOrder, email),\n daffMagentoCustomerOrderTransformOrder(magentoOrder, email),\n );\n },\n },\n);\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\n\nimport {\n DaffCollectionRequest,\n daffIdentifiableArrayToDict,\n} from '@daffodil/core';\nimport { magentoPageInfoTransform } from '@daffodil/driver/magento';\nimport { DaffOrderCollection } from '@daffodil/order';\n\nimport { magentoCustomerOrderSortFields } from '../../constants/sort/fields';\nimport { DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM } from '../../injection-tokens/transforms/token';\nimport { DaffMagentoCustomerOrderTransform } from '../../interfaces/public_api';\nimport { MagentoGetCustomerOrdersResponse } from '../../queries/public_api';\n\n@Injectable({\n providedIn: 'any',\n})\nexport class MagentoCustomerOrderCollectionTransformer {\n constructor(\n @Inject(DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM) private orderTransform: DaffMagentoCustomerOrderTransform,\n ) {}\n\n transform(response: MagentoGetCustomerOrdersResponse, request: DaffCollectionRequest): DaffOrderCollection {\n const orders = response.customer.orders.items.map((order) => this.orderTransform(order, response.customer.email));\n return {\n data: daffIdentifiableArrayToDict(orders),\n metadata: {\n ...magentoPageInfoTransform(response.customer.orders.page_info),\n count: response.customer.orders.total_count,\n filters: {},\n ids: orders.map(order => order.id),\n sortOptions: magentoCustomerOrderSortFields,\n appliedSortDirection: request.appliedSortDirection,\n appliedSortOption: request.appliedSortOption,\n },\n };\n }\n}\n","import { gql } from 'apollo-angular';\n\nimport {\n orderTotalFragment,\n orderCreditFragment,\n orderAddressFragment,\n orderInvoiceFragment,\n orderItemFragment,\n orderPaymentFragment,\n orderShipmentFragment,\n} from '@daffodil/order/driver/magento/2-4-1';\n\nexport const magentoCustomerOrderFragment = gql`\n fragment magentoCustomerOrder on CustomerOrder {\n id\n order_date\n status\n carrier\n number\n shipping_method\n items {\n ...orderItem\n }\n billing_address {\n ...orderAddress\n }\n shipping_address {\n ...orderAddress\n }\n shipments {\n ...orderShipment\n }\n payment_methods {\n ...orderPayment\n }\n invoices {\n ...orderInvoice\n }\n credit_memos {\n ...orderCredit\n }\n total {\n ...orderTotal\n }\n }\n ${orderItemFragment}\n ${orderShipmentFragment}\n ${orderPaymentFragment}\n ${orderInvoiceFragment}\n ${orderCreditFragment}\n ${orderAddressFragment}\n ${orderTotalFragment}\n`;\n","import { gql } from 'apollo-angular';\nimport { DocumentNode } from 'graphql';\n\nimport {\n daffBuildFragmentNameSpread,\n daffBuildFragmentDefinition,\n} from '@daffodil/core/graphql';\nimport { magentoSearchResultPageInfoFragment } from '@daffodil/driver/magento';\n\nimport { MagentoGetCustomerOrdersResponse } from './response.type';\nimport { MagentoCustomerOrderListQueryVariables } from './variables.type';\nimport { magentoCustomerOrderFragment } from '../fragments/public_api';\n\nexport const MAGENTO_GET_CUSTOMER_ORDERS_QUERY_NAME = 'MagentoGetCustomerOrders';\n\nexport const getCustomerOrders = (extraProductFragments: DocumentNode[] = []) => gql<MagentoGetCustomerOrdersResponse, MagentoCustomerOrderListQueryVariables>`\n query ${MAGENTO_GET_CUSTOMER_ORDERS_QUERY_NAME}(\n $currentPage: Int,\n $pageSize: Int,\n $sort: CustomerOrderSortInput\n ) {\n customer {\n email\n orders(currentPage: $currentPage, pageSize: $pageSize, sort: $sort) {\n items {\n ...magentoCustomerOrder\n ${daffBuildFragmentNameSpread(...extraProductFragments)}\n }\n page_info {\n ...magentoSearchResultPageInfo\n }\n total_count\n }\n }\n }\n ${magentoCustomerOrderFragment}\n ${magentoSearchResultPageInfoFragment}\n ${daffBuildFragmentDefinition(...extraProductFragments)}\n`;\n","import { gql } from 'apollo-angular';\nimport { DocumentNode } from 'graphql';\n\nimport {\n daffBuildFragmentNameSpread,\n daffBuildFragmentDefinition,\n} from '@daffodil/core/graphql';\n\nimport { MagentoGetCustomerOrderResponse } from './response.type';\nimport { MagentoCustomerOrderGetQueryVariables } from './variables.type';\nimport { magentoCustomerOrderFragment } from '../fragments/public_api';\n\nexport const MAGENTO_GET_CUSTOMER_ORDER_QUERY_NAME = 'MagentoGetCustomerOrder';\n\nexport const getCustomerOrder = (extraProductFragments: DocumentNode[] = []) => gql<MagentoGetCustomerOrderResponse, MagentoCustomerOrderGetQueryVariables>`\n query ${MAGENTO_GET_CUSTOMER_ORDER_QUERY_NAME}($id: String!) {\n customer {\n email\n orders(filter: {number: {eq: $id}}) {\n items {\n ...magentoCustomerOrder\n ${daffBuildFragmentNameSpread(...extraProductFragments)}\n }\n }\n }\n }\n ${magentoCustomerOrderFragment}\n ${daffBuildFragmentDefinition(...extraProductFragments)}\n`;\n","import { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer-order/driver';\nimport { daffTransformMagentoError } from '@daffodil/driver/magento';\n\nexport function transformMagentoReviewsError(error: any) {\n return daffTransformMagentoError(error, {}) || new DaffCustomerInvalidAPIResponseError(error.message);\n}\n","import { ApolloQueryResult } from '@apollo/client/core';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer-order/driver';\n\nimport { MagentoGetCustomerOrdersResponse } from '../queries/public_api';\n\nexport const validateGetCustomerOrdersResponse = (response: ApolloQueryResult<MagentoGetCustomerOrdersResponse>) => {\n if (response.data.customer?.orders.items) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Get customer orders response does not contain customer orders.');\n }\n};\n","import {\n InjectionToken,\n Provider,\n} from '@angular/core';\nimport { DocumentNode } from 'graphql';\n\n/**\n * A 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 *\n * Fragment structure is platform-specific and this feature should be used with care.\n *\n * This can increase query complexity above the Magento default of 300.\n * Daffodil only guarantees that stock queries don't exceed the limit of 300.\n * Apps using this token should therefore increase the query complexity limit\n * to accommodate the extra complexity contributed by the provided fragments.\n */\nexport const DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS = new InjectionToken<DocumentNode[]>(\n 'DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS',\n { factory: () => []},\n);\n\n/**\n * Provides extra GraphQL fragments for the Magento order driver.\n *\n * See {@link DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS}.\n *\n * ```ts\n * providers: [\n * ...daffProvideCustomerOrderMagentoExtraOrderFragments(\n * myExtraOrderFragment\n * )\n * ]\n * ```\n */\nexport function daffProvideCustomerOrderMagentoExtraOrderFragments(...fragments: DocumentNode[]): Provider[] {\n return fragments.map(fragment => ({\n provide: DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS,\n useValue: fragment,\n multi: true,\n }));\n}\n","import { ApolloQueryResult } from '@apollo/client/core';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer-order/driver';\n\nimport { MagentoGetCustomerOrderResponse } from '../queries/public_api';\n\nexport const validateGetCustomerOrderResponse = (response: ApolloQueryResult<MagentoGetCustomerOrderResponse>) => {\n if (response.data.customer?.orders.items[0]) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Get customer order response does not contain a customer order.');\n }\n};\n","import {\n Inject,\n Injectable,\n} from '@angular/core';\nimport { Apollo } from '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 { DaffAuthStorageService } from '@daffodil/auth';\nimport { DaffCollectionRequest } from '@daffodil/core';\nimport {\n MagentoSortEnum,\n magentoSortDirectionRequestTransform,\n} from '@daffodil/driver/magento';\nimport {\n DaffOrder,\n DaffOrderCollection,\n} from '@daffodil/order';\nimport { DaffOrderServiceInterface } from '@daffodil/order/driver';\nimport { DaffOrderMagentoService } from '@daffodil/order/driver/magento/2-4-1';\n\nimport { transformMagentoReviewsError } from './errors/transform';\nimport {\n DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS,\n DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM,\n} from './injection-tokens/public_api';\nimport { DaffMagentoCustomerOrderTransform } from './interfaces/public_api';\nimport { MagentoCustomerOrderSortableField } from './models/public_api';\nimport {\n MagentoCustomerOrderListQueryVariables,\n getCustomerOrder,\n getCustomerOrders,\n} from './queries/public_api';\nimport {\n MagentoCustomerOrderCollectionTransformer,\n daffMagentoCustomerOrderTransformOrder,\n} from './transforms/public_api';\nimport { validateGetCustomerOrderResponse } from './validators/get-order';\nimport { validateGetCustomerOrdersResponse } from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for customers.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerOrderMagentoService implements DaffOrderServiceInterface {\n constructor(\n private apollo: Apollo,\n private authStorage: DaffAuthStorageService,\n private guestDriver: DaffOrderMagentoService,\n @Inject(DAFF_CUSTOMER_ORDER_MAGENTO_EXTRA_ORDER_FRAGMENTS) private extraFragments: DocumentNode[],\n private transformer: MagentoCustomerOrderCollectionTransformer,\n @Inject(DAFF_CUSTOMER_ORDER_MAGENTO_ORDER_TRANSFORM) private orderTransform: DaffMagentoCustomerOrderTransform,\n ) {}\n\n list(cartId?: string, request: DaffCollectionRequest = {}): Observable<DaffOrderCollection> {\n const variables: MagentoCustomerOrderListQueryVariables = {\n currentPage: request.currentPage,\n pageSize: request.pageSize,\n };\n if (request.appliedSortDirection || request.appliedSortOption) {\n variables.sort = {\n sort_direction: request.appliedSortDirection ? magentoSortDirectionRequestTransform(request.appliedSortDirection) : MagentoSortEnum.DESC,\n sort_field: (<MagentoCustomerOrderSortableField>request.appliedSortOption) || MagentoCustomerOrderSortableField.CREATED_AT,\n };\n }\n return this.authStorage.getAuthToken()\n ? this.apollo.query({\n query: getCustomerOrders(this.extraFragments),\n variables,\n }).pipe(\n map(validateGetCustomerOrdersResponse),\n map(response => this.transformer.transform(response.data, request)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n )\n : this.guestDriver.list(cartId);\n }\n\n get(orderId: string, cartId?: string): Observable<DaffOrder> {\n return this.authStorage.getAuthToken()\n ? this.apollo.query({\n query: getCustomerOrder(this.extraFragments),\n variables: {\n id: orderId,\n },\n }).pipe(\n map(validateGetCustomerOrderResponse),\n map(result => this.orderTransform(result.data.customer.orders.items[0], result.data.customer.email)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n )\n : this.guestDriver.get(orderId, cartId);\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 { DaffCustomerOrderMagentoService } from './order.service';\nimport { MagentoCustomerOrderCollectionTransformer } from './transforms/public_api';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCustomerOrderMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffCustomerOrderMagentoDriverModule> {\n return {\n ngModule: DaffCustomerOrderMagentoDriverModule,\n providers: [\n MagentoCustomerOrderCollectionTransformer,\n {\n provide: DaffOrderDriver,\n useExisting: DaffCustomerOrderMagentoService,\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i4.MagentoCustomerOrderCollectionTransformer"],"mappings":";;;;;;;;;;;;;;;;;AAyCM,SAAU,uCAAuC,CAAC,MAAyB,EAAA;IAC/E,OAAO;AACL,QAAA;AACE,YAAA,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,sBAAsB,CAAC,QAAQ;AACrC,YAAA,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK;AAC5B,YAAA,UAAU,EAAE,CAAC;AACd,SAAA;AACD,QAAA;AACE,YAAA,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,sBAAsB,CAAC,QAAQ;YACrC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,KAAK,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACzF,YAAA,UAAU,EAAE,EAAE;AACf,SAAA;AACD,QAAA;AACE,YAAA,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,sBAAsB,CAAC,QAAQ;AACrC,YAAA,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC,KAAK;AAClC,YAAA,UAAU,EAAE,EAAE;AACf,SAAA;AACD,QAAA;AACE,YAAA,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,sBAAsB,CAAC,GAAG;AAChC,YAAA,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK;AAC7B,YAAA,UAAU,EAAE,EAAE;AACf,SAAA;AACD,QAAA;AACE,YAAA,KAAK,EAAE,aAAa;YACpB,IAAI,EAAE,sBAAsB,CAAC,UAAU;AACvC,YAAA,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK;AAC/B,YAAA,UAAU,EAAE,EAAE;AACf,SAAA;KACF,CAAC;AACJ,CAAC;AAEK,SAAU,+CAA+C,CAAC,QAAyB,EAAA;IACvF,OAAO;QACL,IAAI,E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