@daffodil/product 0.88.1 → 0.89.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 (230) hide show
  1. package/driver/in-memory/index.d.ts +99 -1
  2. package/driver/index.d.ts +78 -1
  3. package/driver/magento/index.d.ts +378 -1
  4. package/driver/magento/testing/index.d.ts +114 -1
  5. package/driver/shopify/index.d.ts +89 -1
  6. package/driver/testing/index.d.ts +38 -1
  7. package/fesm2022/daffodil-product-driver-in-memory.mjs +10 -10
  8. package/fesm2022/daffodil-product-driver-in-memory.mjs.map +1 -1
  9. package/fesm2022/daffodil-product-driver-magento-testing.mjs +24 -24
  10. package/fesm2022/daffodil-product-driver-magento-testing.mjs.map +1 -1
  11. package/fesm2022/daffodil-product-driver-magento.mjs +19 -19
  12. package/fesm2022/daffodil-product-driver-magento.mjs.map +1 -1
  13. package/fesm2022/daffodil-product-driver-shopify.mjs +27 -15
  14. package/fesm2022/daffodil-product-driver-shopify.mjs.map +1 -1
  15. package/fesm2022/daffodil-product-driver-testing.mjs +7 -7
  16. package/fesm2022/daffodil-product-driver-testing.mjs.map +1 -1
  17. package/fesm2022/daffodil-product-driver.mjs.map +1 -1
  18. package/fesm2022/daffodil-product-routing.mjs +16 -16
  19. package/fesm2022/daffodil-product-routing.mjs.map +1 -1
  20. package/fesm2022/daffodil-product-state-testing.mjs +13 -13
  21. package/fesm2022/daffodil-product-state-testing.mjs.map +1 -1
  22. package/fesm2022/daffodil-product-state.mjs +22 -22
  23. package/fesm2022/daffodil-product-state.mjs.map +1 -1
  24. package/fesm2022/daffodil-product-testing.mjs +19 -19
  25. package/fesm2022/daffodil-product-testing.mjs.map +1 -1
  26. package/fesm2022/daffodil-product.mjs.map +1 -1
  27. package/index.d.ts +141 -1
  28. package/package.json +1 -1
  29. package/routing/index.d.ts +168 -1
  30. package/state/index.d.ts +574 -1
  31. package/state/testing/index.d.ts +56 -1
  32. package/testing/index.d.ts +133 -1
  33. package/driver/errors/codes.enum.d.ts +0 -4
  34. package/driver/errors/invalid-api-response.d.ts +0 -6
  35. package/driver/errors/map.d.ts +0 -9
  36. package/driver/errors/product-not-found.d.ts +0 -8
  37. package/driver/errors/public_api.d.ts +0 -4
  38. package/driver/in-memory/backend/product.service.d.ts +0 -48
  39. package/driver/in-memory/collection-name.const.d.ts +0 -1
  40. package/driver/in-memory/driver/product-driver.module.d.ts +0 -13
  41. package/driver/in-memory/driver/product.service.d.ts +0 -24
  42. package/driver/in-memory/driver/provider.d.ts +0 -5
  43. package/driver/in-memory/injection-tokens/public_api.d.ts +0 -2
  44. package/driver/in-memory/injection-tokens/transforms/product-response/response-extra.token.d.ts +0 -2
  45. package/driver/in-memory/injection-tokens/transforms/product-response/response.token.d.ts +0 -2
  46. package/driver/in-memory/interfaces/product-response-extra-transform.type.d.ts +0 -3
  47. package/driver/in-memory/interfaces/product-response-transform.type.d.ts +0 -3
  48. package/driver/in-memory/interfaces/public_api.d.ts +0 -2
  49. package/driver/in-memory/public_api.d.ts +0 -6
  50. package/driver/interfaces/product-service.interface.d.ts +0 -27
  51. package/driver/magento/config/default.d.ts +0 -5
  52. package/driver/magento/config/public_api.d.ts +0 -1
  53. package/driver/magento/injection-tokens/fragments/product-page.token.d.ts +0 -2
  54. package/driver/magento/injection-tokens/fragments/product-preview.token.d.ts +0 -2
  55. package/driver/magento/injection-tokens/fragments/product.token.d.ts +0 -2
  56. package/driver/magento/injection-tokens/public_api.d.ts +0 -9
  57. package/driver/magento/injection-tokens/transforms/product/extra.token.d.ts +0 -20
  58. package/driver/magento/injection-tokens/transforms/product/token.d.ts +0 -2
  59. package/driver/magento/injection-tokens/transforms/product-preview/preview-extra.token.d.ts +0 -20
  60. package/driver/magento/injection-tokens/transforms/product-preview/preview.token.d.ts +0 -2
  61. package/driver/magento/injection-tokens/transforms/product-response/response-extra.token.d.ts +0 -2
  62. package/driver/magento/injection-tokens/transforms/product-response/response.token.d.ts +0 -2
  63. package/driver/magento/interfaces/config.interface.d.ts +0 -11
  64. package/driver/magento/interfaces/product-preview-extra-transform.type.d.ts +0 -3
  65. package/driver/magento/interfaces/product-preview-transform.type.d.ts +0 -3
  66. package/driver/magento/interfaces/product-response-extra-transform.type.d.ts +0 -3
  67. package/driver/magento/interfaces/product-response-transform.type.d.ts +0 -3
  68. package/driver/magento/interfaces/public_api.d.ts +0 -5
  69. package/driver/magento/models/aggregation.d.ts +0 -17
  70. package/driver/magento/models/filter-type-field.interface.d.ts +0 -7
  71. package/driver/magento/models/filter-type.enum.d.ts +0 -5
  72. package/driver/magento/models/filters.d.ts +0 -13
  73. package/driver/magento/models/get-filter-types-response.interface.d.ts +0 -6
  74. package/driver/magento/models/get-product-response.interface.d.ts +0 -8
  75. package/driver/magento/models/magento-product.d.ts +0 -27
  76. package/driver/magento/models/product-preview.interface.d.ts +0 -35
  77. package/driver/magento/models/public_api.d.ts +0 -11
  78. package/driver/magento/models/simple-product.d.ts +0 -6
  79. package/driver/magento/models/sort-fields.d.ts +0 -9
  80. package/driver/magento/models/sort.d.ts +0 -7
  81. package/driver/magento/product-driver.module.d.ts +0 -14
  82. package/driver/magento/product.service.d.ts +0 -28
  83. package/driver/magento/provider.d.ts +0 -3
  84. package/driver/magento/public_api.d.ts +0 -9
  85. package/driver/magento/queries/fragments/product-aggregations.d.ts +0 -1
  86. package/driver/magento/queries/fragments/product-page.d.ts +0 -1
  87. package/driver/magento/queries/fragments/product-preview.d.ts +0 -1
  88. package/driver/magento/queries/fragments/product.d.ts +0 -1
  89. package/driver/magento/queries/fragments/public_api.d.ts +0 -5
  90. package/driver/magento/queries/fragments/sort-fields.d.ts +0 -1
  91. package/driver/magento/queries/get-all-products.d.ts +0 -3
  92. package/driver/magento/queries/get-filter-types.d.ts +0 -2
  93. package/driver/magento/queries/get-product-by-url/public_api.d.ts +0 -4
  94. package/driver/magento/queries/get-product-by-url/query.d.ts +0 -5
  95. package/driver/magento/queries/get-product-by-url/response.type.d.ts +0 -5
  96. package/driver/magento/queries/get-product-by-url/validator.d.ts +0 -3
  97. package/driver/magento/queries/get-product-by-url/variables.type.d.ts +0 -3
  98. package/driver/magento/queries/get-product.d.ts +0 -3
  99. package/driver/magento/queries/public_api.d.ts +0 -5
  100. package/driver/magento/testing/factories/aggregation/aggregation.factory.d.ts +0 -12
  101. package/driver/magento/testing/factories/aggregation/public_api.d.ts +0 -3
  102. package/driver/magento/testing/factories/aggregation/type/price.factory.d.ts +0 -8
  103. package/driver/magento/testing/factories/aggregation/type/select.factory.d.ts +0 -8
  104. package/driver/magento/testing/factories/core/product-preview.factory.d.ts +0 -42
  105. package/driver/magento/testing/factories/core/product.factory.d.ts +0 -28
  106. package/driver/magento/testing/factories/filter-type-field.factory.d.ts +0 -8
  107. package/driver/magento/testing/factories/public_api.d.ts +0 -7
  108. package/driver/magento/testing/factories/simple/simple.factory.d.ts +0 -15
  109. package/driver/magento/testing/factories/sort-fields.factory.d.ts +0 -8
  110. package/driver/magento/testing/public_api.d.ts +0 -1
  111. package/driver/magento/transforms/aggregate/add-metadata-types-to-aggregates.d.ts +0 -2
  112. package/driver/magento/transforms/aggregate/get-matched-attribute-type.d.ts +0 -2
  113. package/driver/magento/transforms/aggregate/public_api.d.ts +0 -3
  114. package/driver/magento/transforms/aggregate/transform.d.ts +0 -3
  115. package/driver/magento/transforms/aggregate/type/equal.d.ts +0 -3
  116. package/driver/magento/transforms/aggregate/type/range.d.ts +0 -8
  117. package/driver/magento/transforms/applied-filter-transformer.service.d.ts +0 -18
  118. package/driver/magento/transforms/applied-sort-option.d.ts +0 -3
  119. package/driver/magento/transforms/collection-metadata.d.ts +0 -8
  120. package/driver/magento/transforms/product-preview.d.ts +0 -12
  121. package/driver/magento/transforms/product-response.d.ts +0 -17
  122. package/driver/magento/transforms/product-transformers.d.ts +0 -20
  123. package/driver/magento/transforms/public_api.d.ts +0 -7
  124. package/driver/magento/transforms/simple-product-transformers.d.ts +0 -16
  125. package/driver/magento/transforms/sort-options/sort-default-option-first.d.ts +0 -2
  126. package/driver/models/public_api.d.ts +0 -1
  127. package/driver/models/response.interface.d.ts +0 -18
  128. package/driver/public_api.d.ts +0 -3
  129. package/driver/shopify/product-driver.module.d.ts +0 -12
  130. package/driver/shopify/product.service.d.ts +0 -20
  131. package/driver/shopify/public_api.d.ts +0 -4
  132. package/driver/shopify/queries/gql/get-all-products.d.ts +0 -6
  133. package/driver/shopify/queries/gql/get-product-by-url.d.ts +0 -8
  134. package/driver/shopify/queries/gql/get-product.d.ts +0 -6
  135. package/driver/shopify/queries/gql/public_api.d.ts +0 -3
  136. package/driver/shopify/queries/public_api.d.ts +0 -3
  137. package/driver/shopify/queries/response.types.d.ts +0 -6
  138. package/driver/shopify/queries/variables.types.d.ts +0 -9
  139. package/driver/shopify/transforms/public_api.d.ts +0 -1
  140. package/driver/shopify/transforms/shopify-daff-product-transform.d.ts +0 -9
  141. package/driver/testing/drivers/product-driver.module.d.ts +0 -13
  142. package/driver/testing/drivers/product.service.d.ts +0 -22
  143. package/driver/testing/public_api.d.ts +0 -2
  144. package/helpers/has-discount.d.ts +0 -7
  145. package/helpers/has-price-range.d.ts +0 -7
  146. package/helpers/public_api.d.ts +0 -2
  147. package/models/collection.interface.d.ts +0 -8
  148. package/models/prices.d.ts +0 -31
  149. package/models/product-image.d.ts +0 -10
  150. package/models/product.d.ts +0 -76
  151. package/models/public_api.d.ts +0 -4
  152. package/public_api.d.ts +0 -2
  153. package/routing/config/default.d.ts +0 -9
  154. package/routing/config/interface.d.ts +0 -18
  155. package/routing/config/public_api.d.ts +0 -3
  156. package/routing/config/token.d.ts +0 -2
  157. package/routing/constants/collection-request-fields.d.ts +0 -5
  158. package/routing/constants/public_api.d.ts +0 -1
  159. package/routing/discrete-filter-params/public_api.d.ts +0 -1
  160. package/routing/discrete-filter-params/token.d.ts +0 -10
  161. package/routing/effects/collection.effects.d.ts +0 -20
  162. package/routing/effects/public_api.d.ts +0 -1
  163. package/routing/models/collection-request-query-param-transforms.interface.d.ts +0 -22
  164. package/routing/models/collection-request-query-params.interface.d.ts +0 -8
  165. package/routing/models/public_api.d.ts +0 -2
  166. package/routing/module.d.ts +0 -9
  167. package/routing/public_api.d.ts +0 -8
  168. package/routing/resolvers/product-page-id/product-page-id.resolver.d.ts +0 -18
  169. package/routing/resolvers/product-page-url/product-page-url.resolver.d.ts +0 -22
  170. package/routing/resolvers/public_api.d.ts +0 -2
  171. package/routing/services/get-query-params-from-request.service.d.ts +0 -17
  172. package/routing/services/get-request-from-route.service.d.ts +0 -18
  173. package/routing/services/public_api.d.ts +0 -2
  174. package/state/actions/product-grid.actions.d.ts +0 -47
  175. package/state/actions/product-page.actions.d.ts +0 -67
  176. package/state/actions/product.actions.d.ts +0 -43
  177. package/state/actions/public_api.d.ts +0 -3
  178. package/state/effects/product-grid.effects.d.ts +0 -27
  179. package/state/effects/product-page.effects.d.ts +0 -28
  180. package/state/effects/product.effects.d.ts +0 -27
  181. package/state/effects/public_api.d.ts +0 -2
  182. package/state/facades/product/product-facade.interface.d.ts +0 -51
  183. package/state/facades/product/product.facade.d.ts +0 -26
  184. package/state/facades/product-grid/product-grid-facade.interface.d.ts +0 -14
  185. package/state/facades/product-grid/product-grid.facade.d.ts +0 -20
  186. package/state/facades/product-page/facade.d.ts +0 -27
  187. package/state/facades/product-page/facade.interface.d.ts +0 -13
  188. package/state/facades/public_api.d.ts +0 -6
  189. package/state/injection-tokens/error-matcher.token.d.ts +0 -2
  190. package/state/injection-tokens/public_api.d.ts +0 -1
  191. package/state/product-state.module.d.ts +0 -11
  192. package/state/public_api.d.ts +0 -7
  193. package/state/reducers/injection-tokens/config.token.d.ts +0 -3
  194. package/state/reducers/injection-tokens/extra.token.d.ts +0 -3
  195. package/state/reducers/injection-tokens/meta.token.d.ts +0 -3
  196. package/state/reducers/injection-tokens/public_api.d.ts +0 -2
  197. package/state/reducers/injection-tokens/reducers.token.d.ts +0 -3
  198. package/state/reducers/product/product-reducer-state.interface.d.ts +0 -15
  199. package/state/reducers/product/product.reducer.d.ts +0 -15
  200. package/state/reducers/product-entities/product-entities-reducer-adapter.d.ts +0 -6
  201. package/state/reducers/product-entities/product-entities.reducer.d.ts +0 -11
  202. package/state/reducers/product-grid/product-grid-reducer-state.interface.d.ts +0 -19
  203. package/state/reducers/product-grid/product-grid.reducer.d.ts +0 -15
  204. package/state/reducers/product-reducers-state.interface.d.ts +0 -16
  205. package/state/reducers/product-reducers.d.ts +0 -6
  206. package/state/reducers/product-store-feature-key.d.ts +0 -1
  207. package/state/reducers/public_api.d.ts +0 -10
  208. package/state/selectors/all-selectors.selectors.d.ts +0 -15
  209. package/state/selectors/product/product.selectors.d.ts +0 -27
  210. package/state/selectors/product-entities/product-entities.selectors.d.ts +0 -75
  211. package/state/selectors/product-feature.selector.d.ts +0 -13
  212. package/state/selectors/product-grid/product-grid.selectors.d.ts +0 -22
  213. package/state/selectors/public_api.d.ts +0 -5
  214. package/state/testing/mock-product-facade.d.ts +0 -19
  215. package/state/testing/mock-product-grid-facade.d.ts +0 -14
  216. package/state/testing/mock-product-page-facade.d.ts +0 -20
  217. package/state/testing/product-testing.module.d.ts +0 -6
  218. package/state/testing/public_api.d.ts +0 -4
  219. package/testing/factories/collection.factory.d.ts +0 -18
  220. package/testing/factories/default-product.factory.d.ts +0 -39
  221. package/testing/factories/extension.factory.d.ts +0 -21
  222. package/testing/factories/kind.factory.d.ts +0 -20
  223. package/testing/factories/product-image.factory.d.ts +0 -19
  224. package/testing/factories/public_api.d.ts +0 -6
  225. package/testing/helpers.d.ts +0 -7
  226. package/testing/injection-tokens/factories/extra.token.d.ts +0 -3
  227. package/testing/injection-tokens/factories/type.token.d.ts +0 -3
  228. package/testing/injection-tokens/public_api.d.ts +0 -2
  229. package/testing/public_api.d.ts +0 -4
  230. package/testing/testing.module.d.ts +0 -9
package/index.d.ts CHANGED
@@ -1 +1,141 @@
1
- export * from './public_api';
1
+ import { DaffLocatable, DaffIdentifiable, DaffCanonicallyLocatable, DaffCollection } from '@daffodil/core';
2
+
3
+ /**
4
+ * Interface for an image on a DaffProduct.
5
+ */
6
+ interface DaffProductImage extends DaffLocatable, DaffIdentifiable {
7
+ /**
8
+ * A label describing the image.
9
+ */
10
+ label: string;
11
+ }
12
+
13
+ /**
14
+ * The possible product types.
15
+ */
16
+ declare enum DaffProductTypeEnum {
17
+ Simple = "simple",
18
+ Composite = "composite",
19
+ Configurable = "configurable"
20
+ }
21
+ /**
22
+ * An interface for a product usable by the @daffodil/product library.
23
+ */
24
+ interface DaffProduct extends DaffLocatable, DaffIdentifiable, Partial<DaffCanonicallyLocatable> {
25
+ /**
26
+ * The type of product.
27
+ */
28
+ type: DaffProductTypeEnum;
29
+ /**
30
+ * The product name.
31
+ */
32
+ name: string;
33
+ /**
34
+ * An image to concisely visualize the product.
35
+ */
36
+ thumbnail: DaffProductImage;
37
+ /**
38
+ * An array of images for the product.
39
+ */
40
+ images?: DaffProductImage[];
41
+ /**
42
+ * The price of the product.
43
+ */
44
+ price?: number;
45
+ /**
46
+ * The total discounts associated with this product.
47
+ */
48
+ discount?: DaffProductDiscount;
49
+ /**
50
+ * Whether or not the product is in stock.
51
+ */
52
+ in_stock?: boolean;
53
+ /**
54
+ * The product brand.
55
+ */
56
+ brand?: string;
57
+ /**
58
+ * Describes the product.
59
+ */
60
+ description?: string;
61
+ /**
62
+ * A shorter description of the product.
63
+ */
64
+ short_description?: string;
65
+ /**
66
+ * A title for the product to display in the browser tab title.
67
+ */
68
+ meta_title?: string;
69
+ /**
70
+ * A description of the product for usage in search engine results.
71
+ */
72
+ meta_description?: string;
73
+ }
74
+ /**
75
+ * The discount for a product.
76
+ */
77
+ interface DaffProductDiscount {
78
+ /**
79
+ * The discount represented as some amount of currency.
80
+ */
81
+ amount: number;
82
+ /**
83
+ * The discount represented as a percent of the original product price.
84
+ */
85
+ percent: number;
86
+ }
87
+
88
+ /**
89
+ * A model for product prices that holds discounts, discounted price, and original price for the associated product.
90
+ */
91
+ interface DaffProductPrices {
92
+ /**
93
+ * The discounted price of the product.
94
+ */
95
+ discountedPrice: number;
96
+ /**
97
+ * The discount of the product.
98
+ */
99
+ discount: DaffProductDiscount;
100
+ /**
101
+ * The price of the product before discounts.
102
+ */
103
+ originalPrice: number;
104
+ }
105
+ /**
106
+ * A ranged price for products that could have more than one possible price, depending on the configurations.
107
+ */
108
+ interface DaffPriceRange {
109
+ /**
110
+ * The maximum prices of the product. Includes discounts, the maximum discounted price, and the maximum original price.
111
+ */
112
+ maxPrice: DaffProductPrices;
113
+ /**
114
+ * The minimum prices of the product. Includes discounts, the minimum discounted price, and the minimum original price.
115
+ */
116
+ minPrice: DaffProductPrices;
117
+ }
118
+
119
+ /**
120
+ * A product collection.
121
+ *
122
+ * @inheritdoc
123
+ */
124
+ type DaffProductCollection = DaffCollection<DaffProduct>;
125
+
126
+ /**
127
+ * Returns whether a DaffPriceRange has a discount.
128
+ *
129
+ * @param priceRange a DaffPriceRange
130
+ */
131
+ declare const productPriceRangeHasDiscount: (priceRange: DaffPriceRange) => boolean;
132
+
133
+ /**
134
+ * Returns whether the min and max prices of a DaffPriceRange are different.
135
+ *
136
+ * @param priceRange a DaffPriceRange
137
+ */
138
+ declare const productPriceRangeHasPriceRange: (priceRange: DaffPriceRange) => boolean;
139
+
140
+ export { DaffProductTypeEnum, productPriceRangeHasDiscount, productPriceRangeHasPriceRange };
141
+ export type { DaffPriceRange, DaffProduct, DaffProductCollection, DaffProductDiscount, DaffProductImage, DaffProductPrices };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@daffodil/product","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/product"]}}},"version":"0.88.1","description":"Interfaces built for daffodil/state","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"publishConfig":{"directory":"../../dist/product"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^19.0.0","@angular/core":"^19.0.0","@daffodil/core":"0.88.1","@ngrx/effects":"^19.0.0","@ngrx/entity":"^19.0.0","@ngrx/store":"^19.0.0","rxjs":"7.8.1"},"optionalDependencies":{"@apollo/client":"^3.12.6","@daffodil/driver":"0.88.1","angular-in-memory-web-api":"^0.19.0","apollo-angular":"^10.0.3","@faker-js/faker":"^9.8.0"},"module":"fesm2022/daffodil-product.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","default":"./fesm2022/daffodil-product.mjs"},"./driver":{"types":"./driver/index.d.ts","default":"./fesm2022/daffodil-product-driver.mjs"},"./routing":{"types":"./routing/index.d.ts","default":"./fesm2022/daffodil-product-routing.mjs"},"./state":{"types":"./state/index.d.ts","default":"./fesm2022/daffodil-product-state.mjs"},"./testing":{"types":"./testing/index.d.ts","default":"./fesm2022/daffodil-product-testing.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","default":"./fesm2022/daffodil-product-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","default":"./fesm2022/daffodil-product-driver-magento.mjs"},"./driver/shopify":{"types":"./driver/shopify/index.d.ts","default":"./fesm2022/daffodil-product-driver-shopify.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","default":"./fesm2022/daffodil-product-driver-testing.mjs"},"./state/testing":{"types":"./state/testing/index.d.ts","default":"./fesm2022/daffodil-product-state-testing.mjs"},"./driver/magento/testing":{"types":"./driver/magento/testing/index.d.ts","default":"./fesm2022/daffodil-product-driver-magento-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
1
+ {"name":"@daffodil/product","nx":{"targets":{"build":{"outputs":["{workspaceRoot}/dist/product"]}}},"version":"0.89.0","description":"Interfaces built for daffodil/state","repository":{"type":"git","url":"https://github.com/graycoreio/daffodil"},"author":"Graycore LLC","license":"MIT","bugs":{"url":"https://github.com/graycoreio/daffodil/issues"},"publishConfig":{"directory":"../../dist/product"},"homepage":"https://github.com/graycoreio/daffodil","peerDependencies":{"@angular/common":"^20.0.0","@angular/core":"^20.0.0","@daffodil/core":"0.89.0","@ngrx/effects":"^20.0.0","@ngrx/entity":"^20.0.0","@ngrx/store":"^20.0.0","rxjs":"7.8.1"},"optionalDependencies":{"@apollo/client":"^3.12.6","@daffodil/driver":"0.89.0","angular-in-memory-web-api":"^0.20.0","apollo-angular":"^11.0.0","@faker-js/faker":"^9.8.0"},"module":"fesm2022/daffodil-product.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","default":"./fesm2022/daffodil-product.mjs"},"./driver":{"types":"./driver/index.d.ts","default":"./fesm2022/daffodil-product-driver.mjs"},"./routing":{"types":"./routing/index.d.ts","default":"./fesm2022/daffodil-product-routing.mjs"},"./state":{"types":"./state/index.d.ts","default":"./fesm2022/daffodil-product-state.mjs"},"./testing":{"types":"./testing/index.d.ts","default":"./fesm2022/daffodil-product-testing.mjs"},"./driver/in-memory":{"types":"./driver/in-memory/index.d.ts","default":"./fesm2022/daffodil-product-driver-in-memory.mjs"},"./driver/magento":{"types":"./driver/magento/index.d.ts","default":"./fesm2022/daffodil-product-driver-magento.mjs"},"./driver/shopify":{"types":"./driver/shopify/index.d.ts","default":"./fesm2022/daffodil-product-driver-shopify.mjs"},"./driver/testing":{"types":"./driver/testing/index.d.ts","default":"./fesm2022/daffodil-product-driver-testing.mjs"},"./state/testing":{"types":"./state/testing/index.d.ts","default":"./fesm2022/daffodil-product-state-testing.mjs"},"./driver/magento/testing":{"types":"./driver/magento/testing/index.d.ts","default":"./fesm2022/daffodil-product-driver-magento-testing.mjs"}},"sideEffects":false,"dependencies":{"tslib":"^2.3.0"}}
@@ -1 +1,168 @@
1
- export * from './public_api';
1
+ import { ActivatedRouteSnapshot, RouterStateSnapshot, ParamMap, Params, Router, ActivatedRoute } from '@angular/router';
2
+ import { Store, ActionsSubject } from '@ngrx/store';
3
+ import * as rxjs from 'rxjs';
4
+ import { Observable } from 'rxjs';
5
+ import { DaffProductStateRootSlice } from '@daffodil/product/state';
6
+ import * as i0 from '@angular/core';
7
+ import { InjectionToken, ValueProvider, ModuleWithProviders } from '@angular/core';
8
+ import { DaffRoutingUriNormalizer, DaffRoutingQueryParamFilter } from '@daffodil/core/routing';
9
+ import { DaffCollectionRequest, DaffBase64Service } from '@daffodil/core';
10
+ import * as _ngrx_effects from '@ngrx/effects';
11
+ import { Actions } from '@ngrx/effects';
12
+ import { DaffCollectionFacadeInterface } from '@daffodil/core/state';
13
+
14
+ /**
15
+ * Resolves product data for product pages, and will only resolve the url after a product request succeeds or fails. This resolver expects a url
16
+ * of the form `some/url/{id}` where `{id}` is the product id.
17
+ */
18
+ declare class DaffProductPageIdResolver {
19
+ private platformId;
20
+ private store;
21
+ private dispatcher;
22
+ constructor(platformId: string, store: Store<DaffProductStateRootSlice>, dispatcher: ActionsSubject);
23
+ resolve(route: ActivatedRouteSnapshot): Observable<boolean>;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductPageIdResolver, never>;
25
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffProductPageIdResolver>;
26
+ }
27
+
28
+ /**
29
+ * Resolves product data for product pages, and will only resolve the url
30
+ * after a product request succeeds or fails. This resolver will take a full
31
+ * a url of the form `some/url.html(secondary:outlet)?query=param#fragment` and attempt to resolve a product from it.
32
+ * Assumes that the URL to be resolved is the primary outlet.
33
+ */
34
+ declare class DaffProductPageUrlResolver {
35
+ private platformId;
36
+ private store;
37
+ private dispatcher;
38
+ private urlNormalizer;
39
+ constructor(platformId: string, store: Store<DaffProductStateRootSlice>, dispatcher: ActionsSubject, urlNormalizer: DaffRoutingUriNormalizer);
40
+ resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>;
41
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductPageUrlResolver, never>;
42
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffProductPageUrlResolver>;
43
+ }
44
+
45
+ type DaffCollectionRequestValue = DaffCollectionRequest[keyof DaffCollectionRequest];
46
+ /**
47
+ * Transforms for storing and retrieving {@link DaffCollectionRequest} values in a route's query params.
48
+ */
49
+ interface DaffCollectionRequestQueryParamTransform<T extends DaffCollectionRequestValue = DaffCollectionRequestValue> {
50
+ /**
51
+ * A function that is given the value of a query param and
52
+ * returns the value that will be set to the product collection request.
53
+ */
54
+ request?: (queryParam: string) => T;
55
+ /**
56
+ * A function that is given the value of a product collection request field and
57
+ * returns the value that will be set to the query params.
58
+ */
59
+ queryParam?: (requestValue: T) => string;
60
+ }
61
+ /**
62
+ * A collection of optional {@link DaffCollectionRequestQueryParamTransform}s.
63
+ */
64
+ type DaffCollectionRequestQueryParamTransforms = Partial<Record<keyof DaffCollectionRequest, DaffCollectionRequestQueryParamTransform>>;
65
+
66
+ /**
67
+ * An object containing a mapping of a {@link DaffCollectionRequest} field to a query param name.
68
+ * Setting a value for one of these fields will cause a resolver that operates on a product collection
69
+ * to include the value of that specified query param after transforming it according to {@link DaffCollectionRequestQueryParamTransforms}.
70
+ * Omitting a value for a field will disable using a query param for the request value.
71
+ */
72
+ type DaffCollectionRequestQueryParams = Partial<Record<keyof DaffCollectionRequest, string>>;
73
+
74
+ /**
75
+ * An interface for providing `@daffodil/product/routing` with necessary config values.
76
+ */
77
+ interface DaffProductRoutingConfig {
78
+ /**
79
+ * The query params transforms for each product collection request field.
80
+ *
81
+ * See {@link DaffCollectionRequestQueryParamTransforms}.
82
+ */
83
+ transforms?: DaffCollectionRequestQueryParamTransforms;
84
+ /**
85
+ * The mapping of query param fields.
86
+ *
87
+ * See {@link DaffCollectionRequestQueryParams}.
88
+ */
89
+ params?: DaffCollectionRequestQueryParams;
90
+ }
91
+
92
+ declare const DAFF_PRODUCT_ROUTING_QUERY_PARAM_REQUEST_MAP: DaffProductRoutingConfig['params'];
93
+ /**
94
+ * The default configuration for the {@link DaffProductRoutingConfig}.
95
+ */
96
+ declare const daffProductRoutingConfigDefaultFactory: (base64: DaffBase64Service) => DaffProductRoutingConfig;
97
+ declare const DAFF_PRODUCT_ROUTING_CONFIG_DEFAULT: InjectionToken<DaffProductRoutingConfig>;
98
+
99
+ declare const DAFF_PRODUCT_ROUTING_CONFIG: i0.InjectionToken<DaffProductRoutingConfig>;
100
+ declare const provideDaffProductRoutingConfig: <R extends DaffProductRoutingConfig = DaffProductRoutingConfig>(config: Partial<R> | i0.InjectionToken<Partial<R>>) => i0.FactoryProvider;
101
+
102
+ /**
103
+ * Builds a {@link DaffCollectionRequest} from the query params of the passed route.
104
+ * Its behavior can be configured via the {@link DAFF_PRODUCT_COLLECTION_QUERY_PARAMS} and
105
+ * {@link DAFF_PRODUCT_COLLECTION_QUERY_PARAM_TRANSFORMS} injection tokens.
106
+ */
107
+ declare class DaffProductGetCollectionRequestFromRoute {
108
+ private config;
109
+ private discreteFilters;
110
+ constructor(config: DaffProductRoutingConfig, discreteFilters: DaffRoutingQueryParamFilter[]);
111
+ getRequest(queryParamMap: ParamMap): DaffCollectionRequest;
112
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductGetCollectionRequestFromRoute, never>;
113
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffProductGetCollectionRequestFromRoute>;
114
+ }
115
+
116
+ /**
117
+ * Builds a query param map from a {@link DaffCollectionRequest}.
118
+ * Its behavior can be configured via the {@link DAFF_PRODUCT_ROUTING_CONFIG} injection token.
119
+ */
120
+ declare class DaffProductGetQueryParamsFromRequest {
121
+ private config;
122
+ private discreteFilters;
123
+ constructor(config: DaffProductRoutingConfig, discreteFilters: DaffRoutingQueryParamFilter[]);
124
+ getQueryParams(request: DaffCollectionRequest): Params;
125
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductGetQueryParamsFromRequest, never>;
126
+ static ɵprov: i0.ɵɵInjectableDeclaration<DaffProductGetQueryParamsFromRequest>;
127
+ }
128
+
129
+ /**
130
+ * A list of request fields that can be transformed to and from query params.
131
+ */
132
+ declare const DAFF_PRODUCT_COLLECTION_REQUEST_FIELDS: (keyof DaffCollectionRequest)[];
133
+
134
+ /**
135
+ * An abstract class that provides an effect for modifying the browser URL.
136
+ */
137
+ declare abstract class DaffProductRoutingCollectionEffects {
138
+ private actions$;
139
+ private router;
140
+ private actionTypes;
141
+ private facade;
142
+ private getQueryParams;
143
+ private route;
144
+ constructor(actions$: Actions, router: Router, actionTypes: string[], facade: DaffCollectionFacadeInterface, getQueryParams: DaffProductGetQueryParamsFromRequest, route: ActivatedRoute);
145
+ /**
146
+ * Updates the URL according to the product collection request in state.
147
+ */
148
+ update$: rxjs.Observable<never> & _ngrx_effects.CreateEffectMetadata;
149
+ }
150
+
151
+ declare const DAFF_PRODUCT_ROUTING_DISCRETE_FILTER_PARAMS: i0.InjectionToken<DaffRoutingQueryParamFilter[]>;
152
+ /**
153
+ * A multi-provider for {@link DAFF_PRODUCT_ROUTING_DISCRETE_FILTER_PARAMS}.
154
+ *
155
+ * @param queryParam Defaults to `filterName`.
156
+ * @param builder Defaults to {@link daffRoutingQueryParamFilterRequestEqualBuilder}.
157
+ */
158
+ declare function daffProductRoutingProvideDiscreteFilterParam(filterName: DaffRoutingQueryParamFilter['filterName'], queryParam?: DaffRoutingQueryParamFilter['queryParam'], builder?: DaffRoutingQueryParamFilter['builder']): ValueProvider;
159
+
160
+ declare class DaffProductRoutingModule {
161
+ static withConfig(config?: DaffProductRoutingConfig): ModuleWithProviders<DaffProductRoutingModule>;
162
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductRoutingModule, never>;
163
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffProductRoutingModule, never, never, never>;
164
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffProductRoutingModule>;
165
+ }
166
+
167
+ export { DAFF_PRODUCT_COLLECTION_REQUEST_FIELDS, DAFF_PRODUCT_ROUTING_CONFIG, DAFF_PRODUCT_ROUTING_CONFIG_DEFAULT, DAFF_PRODUCT_ROUTING_DISCRETE_FILTER_PARAMS, DAFF_PRODUCT_ROUTING_QUERY_PARAM_REQUEST_MAP, DaffProductGetCollectionRequestFromRoute, DaffProductGetQueryParamsFromRequest, DaffProductPageIdResolver, DaffProductPageUrlResolver, DaffProductRoutingCollectionEffects, DaffProductRoutingModule, daffProductRoutingConfigDefaultFactory, daffProductRoutingProvideDiscreteFilterParam, provideDaffProductRoutingConfig };
168
+ export type { DaffCollectionRequestQueryParamTransform, DaffCollectionRequestQueryParamTransforms, DaffCollectionRequestQueryParams, DaffProductRoutingConfig };