@daffodil/product 0.94.1-rc.0 → 0.95.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 (46) hide show
  1. package/fesm2022/daffodil-product-driver-in-memory.mjs +200 -227
  2. package/fesm2022/daffodil-product-driver-in-memory.mjs.map +1 -1
  3. package/fesm2022/daffodil-product-driver-magento-2.4.7-testing.mjs +444 -0
  4. package/fesm2022/daffodil-product-driver-magento-2.4.7-testing.mjs.map +1 -0
  5. package/fesm2022/daffodil-product-driver-magento-2.4.7.mjs +704 -0
  6. package/fesm2022/daffodil-product-driver-magento-2.4.7.mjs.map +1 -0
  7. package/fesm2022/daffodil-product-driver-magento-auto-testing.mjs +7 -0
  8. package/fesm2022/daffodil-product-driver-magento-auto-testing.mjs.map +1 -0
  9. package/fesm2022/daffodil-product-driver-magento-auto.mjs +7 -0
  10. package/fesm2022/daffodil-product-driver-magento-auto.mjs.map +1 -0
  11. package/fesm2022/daffodil-product-driver-shopify.mjs +99 -127
  12. package/fesm2022/daffodil-product-driver-shopify.mjs.map +1 -1
  13. package/fesm2022/daffodil-product-driver-testing.mjs +117 -87
  14. package/fesm2022/daffodil-product-driver-testing.mjs.map +1 -1
  15. package/fesm2022/daffodil-product-driver.mjs +22 -45
  16. package/fesm2022/daffodil-product-driver.mjs.map +1 -1
  17. package/fesm2022/daffodil-product-routing.mjs +347 -285
  18. package/fesm2022/daffodil-product-routing.mjs.map +1 -1
  19. package/fesm2022/daffodil-product-state-testing.mjs +189 -106
  20. package/fesm2022/daffodil-product-state-testing.mjs.map +1 -1
  21. package/fesm2022/daffodil-product-state.mjs +566 -659
  22. package/fesm2022/daffodil-product-state.mjs.map +1 -1
  23. package/fesm2022/daffodil-product-testing.mjs +316 -276
  24. package/fesm2022/daffodil-product-testing.mjs.map +1 -1
  25. package/fesm2022/daffodil-product.mjs +8 -29
  26. package/fesm2022/daffodil-product.mjs.map +1 -1
  27. package/package.json +1 -1
  28. package/types/daffodil-product-driver-in-memory.d.ts +65 -75
  29. package/types/daffodil-product-driver-magento-2.4.7-testing.d.ts +105 -0
  30. package/types/daffodil-product-driver-magento-2.4.7.d.ts +337 -0
  31. package/types/daffodil-product-driver-magento-auto-testing.d.ts +1 -0
  32. package/types/daffodil-product-driver-magento-auto.d.ts +1 -0
  33. package/types/daffodil-product-driver-shopify.d.ts +31 -43
  34. package/types/daffodil-product-driver-testing.d.ts +28 -26
  35. package/types/daffodil-product-driver.d.ts +50 -61
  36. package/types/daffodil-product-routing.d.ts +101 -110
  37. package/types/daffodil-product-state-testing.d.ts +45 -43
  38. package/types/daffodil-product-state.d.ts +347 -375
  39. package/types/daffodil-product-testing.d.ts +82 -89
  40. package/types/daffodil-product.d.ts +93 -102
  41. package/fesm2022/daffodil-product-driver-magento-testing.mjs +0 -275
  42. package/fesm2022/daffodil-product-driver-magento-testing.mjs.map +0 -1
  43. package/fesm2022/daffodil-product-driver-magento.mjs +0 -855
  44. package/fesm2022/daffodil-product-driver-magento.mjs.map +0 -1
  45. package/types/daffodil-product-driver-magento-testing.d.ts +0 -114
  46. package/types/daffodil-product-driver-magento.d.ts +0 -396
@@ -0,0 +1,337 @@
1
+ import { Apollo } from "apollo-angular";
2
+ import { DocumentNode } from "graphql";
3
+ import { Observable } from "rxjs";
4
+ import { DaffProduct } from "@daffodil/product";
5
+ import { DaffProductDriverResponse, DaffProductServiceInterface } from "@daffodil/product/driver";
6
+ import * as i0 from "@angular/core";
7
+ import { ModuleWithProviders, Provider } from "@angular/core";
8
+ import * as i1 from "@angular/common";
9
+ import { GraphQlApolloValidator } from "@daffodil/core/graphql";
10
+ import { DaffCollectionMetadata, DaffFilter, DaffFilterRequest, DaffSortDirectionEnum } from "@daffodil/core";
11
+ import { MagentoSearchResultPageInfo } from "@daffodil/driver/magento/2.4.7";
12
+ export declare const MAGENTO_PRODUCT_CONFIG_TOKEN: import("@angular/core").InjectionToken<DaffProductMagentoDriverConfig>, provideMagentoProductConfig: <R extends DaffProductMagentoDriverConfig = DaffProductMagentoDriverConfig>(config: Partial<R> | import("@angular/core").InjectionToken<Partial<R>>) => import("@angular/core").FactoryProvider;
13
+ /**
14
+ * An interface for providing @daffodil/product/driver/magento with necessary config values.
15
+ */
16
+ export interface DaffProductMagentoDriverConfig {
17
+ /**
18
+ * The fully-qualified base URL for media assets, such as product images.
19
+ * e.g. https://api.daff.io/media/
20
+ */
21
+ baseMediaUrl: string;
22
+ }
23
+ export declare enum MagentoProductStockStatusEnum {
24
+ InStock = "IN_STOCK",
25
+ OutOfStock = "OUT_OF_STOCK"
26
+ }
27
+ /**
28
+ * A stripped down version of the Magento product.
29
+ * The product preview is intended for loading lists of products
30
+ * that do not need the full amount of information that would be
31
+ * necessary for a product page, for example.
32
+ */
33
+ export interface MagentoProductPreview {
34
+ __typename: string;
35
+ uid: string;
36
+ name: string;
37
+ sku: string;
38
+ url_key: string;
39
+ url_suffix: string;
40
+ image: {
41
+ url: string;
42
+ label: string;
43
+ };
44
+ price_range: {
45
+ maximum_price: {
46
+ regular_price: {
47
+ value: number;
48
+ currency: any;
49
+ };
50
+ discount: {
51
+ amount_off: number;
52
+ percent_off: number;
53
+ };
54
+ };
55
+ };
56
+ stock_status?: MagentoProductStockStatusEnum;
57
+ }
58
+ export declare enum MagentoProductTypeEnum {
59
+ BundledProduct = "BundleProduct",
60
+ ConfigurableProduct = "ConfigurableProduct",
61
+ SimpleProduct = "SimpleProduct"
62
+ }
63
+ /**
64
+ * An object for defining what the product service requests and retrieves from a magento backend.
65
+ */
66
+ export interface MagentoProduct extends MagentoProductPreview {
67
+ meta_title?: string;
68
+ meta_description?: string;
69
+ canonical_url?: string;
70
+ media_gallery_entries?: {
71
+ label: string;
72
+ file: string;
73
+ position: number;
74
+ disabled: boolean;
75
+ uid: string;
76
+ }[];
77
+ short_description?: {
78
+ html: string;
79
+ };
80
+ description?: {
81
+ html: string;
82
+ };
83
+ }
84
+ export type DaffMagentoProductResponseExtraTransform<T extends MagentoProduct = MagentoProduct, V extends DaffProductDriverResponse = DaffProductDriverResponse> = (daffProductResponse: DaffProductDriverResponse, magentoProduct: T, mediaUrl: string) => V;
85
+ export type DaffMagentoProductResponseTransform<T extends MagentoProduct = MagentoProduct, V extends DaffProductDriverResponse = DaffProductDriverResponse> = (magentoProduct: T, mediaUrl: string) => V;
86
+ export type DaffMagentoProductExtraTransform<T extends MagentoProduct = MagentoProduct, V extends DaffProduct = DaffProduct> = (daffProduct: DaffProduct, magentoProduct: T, mediaUrl: string) => V;
87
+ export type DaffMagentoProductTransform<T extends MagentoProduct = MagentoProduct, V extends DaffProduct = DaffProduct> = (magentoProduct: T, mediaUrl: string) => V;
88
+ /**
89
+ * Transforms the magento MagentoProduct from the magento product query into a DaffProduct.
90
+ *
91
+ * @param product a magento product
92
+ */
93
+ export declare class DaffMagentoSimpleProductTransformers {
94
+ private productPreviewTransform;
95
+ constructor(productPreviewTransform: DaffMagentoProductTransform);
96
+ transformMagentoSimpleProduct(product: MagentoProduct, mediaUrl: string): DaffProduct;
97
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffMagentoSimpleProductTransformers, never>;
98
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
99
+ }
100
+ /**
101
+ * Transforms the magento MagentoProduct from the magento product query into a DaffProduct.
102
+ *
103
+ * @param product a magento product
104
+ */
105
+ export declare class DaffMagentoProductsTransformer {
106
+ private magentoSimpleProductTransformers;
107
+ constructor(magentoSimpleProductTransformers: DaffMagentoSimpleProductTransformers);
108
+ transformMagentoProduct(product: MagentoProduct, mediaUrl: string): DaffProduct;
109
+ /**
110
+ * Transforms many magento MagentoProducts from the magento product query into DaffProducts.
111
+ */
112
+ transformManyMagentoProducts(products: MagentoProduct[], mediaUrl: string): DaffProduct[];
113
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffMagentoProductsTransformer, never>;
114
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
115
+ }
116
+ /**
117
+ * A service for making magento apollo queries for products of type, {@link DaffProduct}.
118
+ *
119
+ * @inheritdoc
120
+ */
121
+ export declare class DaffMagentoProductService implements DaffProductServiceInterface {
122
+ private apollo;
123
+ private config;
124
+ private responseTransform;
125
+ private extraPageFragments;
126
+ private extraFragments;
127
+ private extraPreviewFragments;
128
+ private magentoProductsTransformer;
129
+ constructor(apollo: Apollo, config: DaffProductMagentoDriverConfig, responseTransform: DaffMagentoProductResponseTransform, extraPageFragments: DocumentNode[], extraFragments: DocumentNode[], extraPreviewFragments: DocumentNode[], magentoProductsTransformer: DaffMagentoProductsTransformer);
130
+ get(productId: DaffProduct['id']): Observable<DaffProductDriverResponse>;
131
+ getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse>;
132
+ getAll(): Observable<DaffProduct[]>;
133
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffMagentoProductService, never>;
134
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
135
+ }
136
+ /**
137
+ * A module that provides the {@link DaffProductDriver} and {@link DaffProductMagentoDriverConfig} as the {@link DaffMagentoProductService} and
138
+ * {@link MAGENTO_PRODUCT_CONFIG_DEFAULT} respectively
139
+ *
140
+ * @deprecated in favor of {@link provideDaffProductMagentoDriver} Deprecated in version 0.95.0. Will be removed in version 0.98.0.
141
+ */
142
+ export declare class DaffProductMagentoDriverModule {
143
+ static forRoot(config?: DaffProductMagentoDriverConfig): ModuleWithProviders<DaffProductMagentoDriverModule>;
144
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductMagentoDriverModule, never>;
145
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffProductMagentoDriverModule, never, [typeof i1.CommonModule], never>;
146
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffProductMagentoDriverModule>;
147
+ }
148
+ export declare const provideDaffProductMagentoDriver: (config?: DaffProductMagentoDriverConfig) => Provider[];
149
+ export declare const DAFF_MAGENTO_GET_A_PRODUCT_QUERY_NAME = "MagentoGetAProduct";
150
+ export declare const getProduct: (extraProductFragments?: DocumentNode[]) => import("apollo-angular").TypedDocumentNode<unknown, unknown>;
151
+ export declare enum MagentoProductFilterActionEnum {
152
+ Equal = "eq",
153
+ To = "to",
154
+ From = "from",
155
+ In = "in",
156
+ Match = "match"
157
+ }
158
+ export interface MagentoProductFilters {
159
+ [x: string]: MagentoFilterAction;
160
+ }
161
+ export type MagentoFilterAction = { [key in MagentoProductFilterActionEnum]?: string | string[]; };
162
+ export interface MagentoSimpleProduct extends MagentoProduct {
163
+ uid: string;
164
+ name: string;
165
+ sku: string;
166
+ }
167
+ export interface MagentoGetProductResponse {
168
+ __typename?: string;
169
+ products: {
170
+ __typename?: string;
171
+ items: MagentoProduct[];
172
+ };
173
+ }
174
+ export declare enum MagentoProductFilterType {
175
+ Equal = "FilterEqualTypeInput",
176
+ Match = "FilterMatchTypeInput",
177
+ Range = "FilterRangeTypeInput"
178
+ }
179
+ /**
180
+ * Filterable options for products.
181
+ */
182
+ export interface MagentoAggregation {
183
+ __typename?: string;
184
+ attribute_code: string;
185
+ type?: MagentoProductFilterType;
186
+ count?: number;
187
+ label?: string;
188
+ options?: MagentoAggregationOption[];
189
+ }
190
+ export interface MagentoAggregationOption {
191
+ value: string;
192
+ count?: number;
193
+ label?: string;
194
+ }
195
+ export interface MagentoProductFilterTypeField {
196
+ name: string;
197
+ type: {
198
+ name: MagentoProductFilterType;
199
+ };
200
+ }
201
+ export interface MagentoProductGetFilterTypesResponse {
202
+ __type: {
203
+ inputFields: MagentoProductFilterTypeField[];
204
+ };
205
+ }
206
+ export interface MagentoProductSortFields {
207
+ __typename?: 'SortFields';
208
+ default: string;
209
+ options: MagentoSortOption[];
210
+ }
211
+ export interface MagentoSortOption {
212
+ label: string;
213
+ value: string;
214
+ }
215
+ export declare enum MagentoSortDirectionEnum {
216
+ Ascending = "ASC",
217
+ Decending = "DESC"
218
+ }
219
+ export interface MagentoSortFieldAction {
220
+ [x: string]: MagentoSortDirectionEnum;
221
+ }
222
+ export interface MagentoProductGetByUrlReponse {
223
+ __typename?: string;
224
+ route: MagentoProduct;
225
+ }
226
+ export interface MagentoProductGetByUrlVariables {
227
+ url: string;
228
+ }
229
+ export declare const DAFF_MAGENTO_GET_A_PRODUCT_BY_URL_QUERY_NAME = "MagentoGetAProductByUrl";
230
+ export declare const getProductByUrl: (extraProductFragments?: DocumentNode[]) => import("apollo-angular").TypedDocumentNode<MagentoProductGetByUrlReponse, MagentoProductGetByUrlVariables>;
231
+ interface Shape$1 {
232
+ data: {
233
+ route: {
234
+ sku: true;
235
+ };
236
+ };
237
+ }
238
+ type ValidatorFn$1 = GraphQlApolloValidator<MagentoProductGetByUrlReponse, Shape$1>;
239
+ export declare const magentoProductGetByUrlValidator: ValidatorFn$1;
240
+ export declare const DAFF_MAGENTO_GET_ALL_PRODUCTS_QUERY_NAME = "MagentoGetAllProducts";
241
+ export declare const getAllProducts: (extraProductFragments?: DocumentNode[]) => import("apollo-angular").TypedDocumentNode<unknown, unknown>;
242
+ export declare const DAFF_MAGENTO_GET_FILTER_TYPES_QUERY_NAME = "MagentoGetProductFilterFieldTypes";
243
+ export declare const MagentoProductGetFilterTypes: import("apollo-angular").TypedDocumentNode<unknown, unknown>;
244
+ export declare const magentoProductFragment: import("apollo-angular").TypedDocumentNode<unknown, unknown>;
245
+ export declare const magentoProductPreviewFragment: import("apollo-angular").TypedDocumentNode<unknown, unknown>;
246
+ export declare const magentoProductPageFragment: import("apollo-angular").TypedDocumentNode<unknown, unknown>;
247
+ export declare const magentoProductAggregationsFragment: import("apollo-angular").TypedDocumentNode<unknown, unknown>;
248
+ export declare const magentoProductSortFieldsFragment: import("apollo-angular").TypedDocumentNode<unknown, unknown>;
249
+ interface Shape {
250
+ data: {
251
+ products: {
252
+ items: true;
253
+ };
254
+ };
255
+ }
256
+ type ValidatorFn = GraphQlApolloValidator<MagentoGetProductResponse, Shape>;
257
+ export declare const magentoProductGetAllValidator: ValidatorFn;
258
+ export declare class MagentoProductAppliedFiltersTransformService {
259
+ transform(daffFilters: DaffFilterRequest[]): MagentoProductFilters;
260
+ /**
261
+ * Returns an In action for Equal type and a Match action for Match type.
262
+ */
263
+ private getFilterAction;
264
+ /**
265
+ * Returns an array for Equal type and a string for Match type.
266
+ */
267
+ private getFilterValue;
268
+ private getRangeFromValue;
269
+ private getRangeToValue;
270
+ static ɵfac: i0.ɵɵFactoryDeclaration<MagentoProductAppliedFiltersTransformService, never>;
271
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
272
+ }
273
+ /**
274
+ * Transforms the MagentoProduct from the magento product query into a DaffProductDriverResponse.
275
+ *
276
+ * @param product a magento product
277
+ *
278
+ */
279
+ export declare class DaffMagentoProductResponseTransformers {
280
+ private transformMagentoProduct;
281
+ constructor(transformMagentoProduct: DaffMagentoProductTransform);
282
+ transformMagentoProductResponse(product: MagentoProduct, mediaUrl: string): DaffProductDriverResponse;
283
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffMagentoProductResponseTransformers, never>;
284
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
285
+ }
286
+ export declare const magentoProductTransformAggregate: (aggregate: MagentoAggregation) => DaffFilter;
287
+ export declare const magentoProductGetMatchedAttributeType: (aggregate: MagentoAggregation, inputFields: MagentoProductFilterTypeField[]) => MagentoProductFilterType;
288
+ export declare function magentoProductAddMetadataTypesToAggregates(inputFields: MagentoProductFilterTypeField[], aggregations: MagentoAggregation[]): MagentoAggregation[];
289
+ export declare const magentoAppliedSortOptionTransform: (appliedOption: string, appliedDirection: DaffSortDirectionEnum) => MagentoSortFieldAction;
290
+ /**
291
+ * Builds a product collection metadata object.
292
+ */
293
+ export declare const magentoProductCollectionMetadataTransform: (aggregates: MagentoAggregation[], pageInfo: MagentoSearchResultPageInfo, sortFields: MagentoProductSortFields, products: MagentoProduct[], count: number, appliedSortOption?: string, appliedSortDirection?: DaffSortDirectionEnum) => DaffCollectionMetadata;
294
+ /**
295
+ * The default configuration for the {@link DaffProductMagentoDriverConfig}.
296
+ */
297
+ export declare const MAGENTO_PRODUCT_CONFIG_DEFAULT: DaffProductMagentoDriverConfig;
298
+ export declare const DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_RESPONSE_TRANSFORMS: import("@angular/core").InjectionToken<DaffMagentoProductResponseExtraTransform[]>, provideDaffProductMagentoExtraProductResponseTransforms: <R extends DaffMagentoProductResponseExtraTransform = DaffMagentoProductResponseExtraTransform>(...values: R[]) => Array<import("@angular/core").ValueProvider>;
299
+ declare const DAFF_PRODUCT_MAGENTO_PRODUCT_RESPONSE_TRANSFORM: import("@angular/core").InjectionToken<DaffMagentoProductResponseTransform>, provideDaffProductMagentoProductResponseTransform: <R extends DaffMagentoProductResponseTransform = DaffMagentoProductResponseTransform>(value: R) => import("@angular/core").ValueProvider;
300
+ export declare const DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PAGE_FRAGMENTS: import("@angular/core").InjectionToken<DocumentNode[]>, provideDaffProductMagentoExtraProductPageFragments: <R extends DocumentNode = DocumentNode>(...values: R[]) => Array<import("@angular/core").ValueProvider>;
301
+ export declare const DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PREVIEW_FRAGMENTS: import("@angular/core").InjectionToken<DocumentNode[]>, provideDaffProductMagentoExtraProductPreviewFragments: <R extends DocumentNode = DocumentNode>(...values: R[]) => Array<import("@angular/core").ValueProvider>;
302
+ declare const DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PREVIEW_TRANSFORMS: import("@angular/core").InjectionToken<DaffMagentoProductExtraTransform[]>, provider$1: <R extends DaffMagentoProductExtraTransform = DaffMagentoProductExtraTransform>(...values: R[]) => Array<import("@angular/core").ValueProvider>;
303
+ /**
304
+ * Provides extra product preview transforms for the Magento product driver.
305
+ *
306
+ * See {@link DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PREVIEW_TRANSFORMS}.
307
+ *
308
+ * @example
309
+ * ```ts
310
+ * providers: [
311
+ * ...provideDaffProductMagentoExtraProductPreviewTransforms(
312
+ * myExtraProductTransform
313
+ * )
314
+ * ]
315
+ * ```
316
+ */
317
+ export declare function provideDaffProductMagentoExtraProductPreviewTransforms<T extends MagentoProduct = MagentoProduct, V extends DaffProduct = DaffProduct>(...transforms: DaffMagentoProductExtraTransform<T, V>[]): Provider[];
318
+ declare const DAFF_PRODUCT_MAGENTO_PRODUCT_PREVIEW_TRANSFORM: import("@angular/core").InjectionToken<DaffMagentoProductTransform>, provideDaffProductMagentoProductPreviewTransform: <R extends DaffMagentoProductTransform = DaffMagentoProductTransform>(value: R) => import("@angular/core").ValueProvider;
319
+ export declare const DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_FRAGMENTS: import("@angular/core").InjectionToken<DocumentNode[]>, provideDaffProductMagentoExtraProductFragments: <R extends DocumentNode = DocumentNode>(...values: R[]) => Array<import("@angular/core").ValueProvider>;
320
+ declare const DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_TRANSFORMS: import("@angular/core").InjectionToken<DaffMagentoProductExtraTransform[]>, provider: <R extends DaffMagentoProductExtraTransform = DaffMagentoProductExtraTransform>(...values: R[]) => Array<import("@angular/core").ValueProvider>;
321
+ /**
322
+ * Provides extra product preview transforms for the Magento product driver.
323
+ *
324
+ * See {@link DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_TRANSFORMS}.
325
+ *
326
+ * @example
327
+ * ```ts
328
+ * providers: [
329
+ * ...provideDaffProductMagentoExtraProductTransforms(
330
+ * myExtraProductTransform
331
+ * )
332
+ * ]
333
+ * ```
334
+ */
335
+ export declare function provideDaffProductMagentoExtraProductTransforms<T extends MagentoProduct = MagentoProduct, V extends DaffProduct = DaffProduct>(...transforms: DaffMagentoProductExtraTransform<T, V>[]): Provider[];
336
+ declare const DAFF_PRODUCT_MAGENTO_PRODUCT_TRANSFORM: import("@angular/core").InjectionToken<DaffMagentoProductTransform>, provideDaffProductMagentoProductTransform: <R extends DaffMagentoProductTransform = DaffMagentoProductTransform>(value: R) => import("@angular/core").ValueProvider;
337
+ export { DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_PREVIEW_TRANSFORMS, DAFF_PRODUCT_MAGENTO_EXTRA_PRODUCT_TRANSFORMS, DAFF_PRODUCT_MAGENTO_PRODUCT_PREVIEW_TRANSFORM, DAFF_PRODUCT_MAGENTO_PRODUCT_RESPONSE_TRANSFORM, DAFF_PRODUCT_MAGENTO_PRODUCT_TRANSFORM };
@@ -0,0 +1 @@
1
+ export {}
@@ -1,75 +1,63 @@
1
- import * as apollo_angular from 'apollo-angular';
2
- import { Apollo } from 'apollo-angular';
3
- import { Observable } from 'rxjs';
4
- import { DaffProduct } from '@daffodil/product';
5
- import { DaffProductServiceInterface, DaffProductDriverResponse } from '@daffodil/product/driver';
6
- import * as i0 from '@angular/core';
7
- import { Provider } from '@angular/core';
8
- import { ShopifyProductGraph, ShopifyProductNode } from '@daffodil/driver/shopify';
9
-
1
+ import { Apollo } from "apollo-angular";
2
+ import { Observable } from "rxjs";
3
+ import { DaffProduct } from "@daffodil/product";
4
+ import { DaffProductDriverResponse, DaffProductServiceInterface } from "@daffodil/product/driver";
5
+ import * as i0 from "@angular/core";
6
+ import { Provider } from "@angular/core";
7
+ import { ShopifyProductGraph, ShopifyProductNode } from "@daffodil/driver/shopify";
10
8
  /**
11
9
  * A service for getting DaffProducts {@link DaffProduct} from apollo shopify product requests.
12
10
  *
13
11
  * @inheritdoc
14
12
  */
15
- declare class DaffShopifyProductService implements DaffProductServiceInterface {
16
- private apollo;
17
- defaultLength: number;
18
- constructor(apollo: Apollo);
19
- getAll(): Observable<DaffProduct[]>;
20
- get(productId: DaffProduct['id']): Observable<DaffProductDriverResponse>;
21
- getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse>;
22
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffShopifyProductService, never>;
23
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffShopifyProductService>;
13
+ export declare class DaffShopifyProductService implements DaffProductServiceInterface {
14
+ private apollo;
15
+ defaultLength: number;
16
+ constructor(apollo: Apollo);
17
+ getAll(): Observable<DaffProduct[]>;
18
+ get(productId: DaffProduct['id']): Observable<DaffProductDriverResponse>;
19
+ getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse>;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffShopifyProductService, never>;
21
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
24
22
  }
25
-
26
23
  /**
27
24
  * Provides the Shopify product driver.
28
25
  *
29
26
  * @returns Array of Angular providers for the Shopify product driver
30
27
  */
31
- declare const provideDaffProductShopifyDriver: () => Provider[];
32
-
33
- interface ShopifyProductAllResponse {
34
- products?: ShopifyProductGraph;
28
+ export declare const provideDaffProductShopifyDriver: () => Provider[];
29
+ export interface ShopifyProductAllResponse {
30
+ products?: ShopifyProductGraph;
35
31
  }
36
- interface ShopifyProductSingleResponse {
37
- product: ShopifyProductNode;
32
+ export interface ShopifyProductSingleResponse {
33
+ product: ShopifyProductNode;
38
34
  }
39
-
40
- interface ShopifyProductAllVariables {
41
- length: number;
35
+ export interface ShopifyProductAllVariables {
36
+ length: number;
42
37
  }
43
- interface ShopifyProductIDVariables {
44
- id: string;
38
+ export interface ShopifyProductIDVariables {
39
+ id: string;
45
40
  }
46
- interface ShopifyProductUrlVariables {
47
- handle: string;
41
+ export interface ShopifyProductUrlVariables {
42
+ handle: string;
48
43
  }
49
-
50
44
  /**
51
45
  * GraphQL query object for getting all products.
52
46
  */
53
- declare const getAllProducts: apollo_angular.TypedDocumentNode<ShopifyProductAllResponse, ShopifyProductAllVariables>;
54
-
47
+ export declare const getAllProducts: import("apollo-angular").TypedDocumentNode<ShopifyProductAllResponse, ShopifyProductAllVariables>;
55
48
  /**
56
49
  * GraphQL query object for getting a product by URL.
57
50
  *
58
51
  * The DaffLocatable url is transformed into a Shopify product handle for querying.
59
52
  */
60
- declare const getProductByUrl: apollo_angular.TypedDocumentNode<ShopifyProductSingleResponse, ShopifyProductUrlVariables>;
61
-
53
+ export declare const getProductByUrl: import("apollo-angular").TypedDocumentNode<ShopifyProductSingleResponse, ShopifyProductUrlVariables>;
62
54
  /**
63
55
  * GraphQL query object for getting a single product by ID.
64
56
  */
65
- declare const getProduct: apollo_angular.TypedDocumentNode<ShopifyProductSingleResponse, ShopifyProductIDVariables>;
66
-
57
+ export declare const getProduct: import("apollo-angular").TypedDocumentNode<ShopifyProductSingleResponse, ShopifyProductIDVariables>;
67
58
  /**
68
59
  * Transforms a ProductNode into a DaffProduct
69
60
  *
70
61
  * @param node
71
62
  */
72
- declare const daffShopifyProductTransformer: (node: ShopifyProductNode) => DaffProduct;
73
-
74
- export { DaffShopifyProductService, daffShopifyProductTransformer, getAllProducts, getProduct, getProductByUrl, provideDaffProductShopifyDriver };
75
- export type { ShopifyProductAllResponse, ShopifyProductAllVariables, ShopifyProductIDVariables, ShopifyProductSingleResponse, ShopifyProductUrlVariables };
63
+ export declare const daffShopifyProductTransformer: (node: ShopifyProductNode) => DaffProduct;
@@ -1,12 +1,10 @@
1
- import { Observable } from 'rxjs';
2
- import { DaffProduct } from '@daffodil/product';
3
- import { DaffProductServiceInterface, DaffProductDriverResponse } from '@daffodil/product/driver';
4
- import * as i2 from '@daffodil/product/testing';
5
- import { DaffProductExtensionFactory, DaffProductImageFactory } from '@daffodil/product/testing';
6
- import * as i0 from '@angular/core';
7
- import { ModuleWithProviders } from '@angular/core';
8
- import * as i1 from '@angular/common';
9
-
1
+ import { Observable } from "rxjs";
2
+ import { DaffProduct } from "@daffodil/product";
3
+ import { DaffProductDriverResponse, DaffProductServiceInterface } from "@daffodil/product/driver";
4
+ import { DaffProductExtensionFactory, DaffProductImageFactory } from "@daffodil/product/testing";
5
+ import * as i0 from "@angular/core";
6
+ import { EnvironmentProviders, ModuleWithProviders } from "@angular/core";
7
+ import * as i1 from "@angular/common";
10
8
  /**
11
9
  * The product testing driver to mock the backend product service.
12
10
  *
@@ -14,25 +12,29 @@ import * as i1 from '@angular/common';
14
12
  * @param productFactory - A DaffProductFactory instance
15
13
  * @param productImageFactory - A DaffProductImageFactory instance
16
14
  */
17
- declare class DaffTestingProductService implements DaffProductServiceInterface {
18
- private productFactory;
19
- private productImageFactory;
20
- constructor(productFactory: DaffProductExtensionFactory, productImageFactory: DaffProductImageFactory);
21
- getAll(): Observable<DaffProduct[]>;
22
- get(productId: DaffProduct['id']): Observable<DaffProductDriverResponse>;
23
- getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse>;
24
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffTestingProductService, never>;
25
- static ɵprov: i0.ɵɵInjectableDeclaration<DaffTestingProductService>;
15
+ export declare class DaffTestingProductService implements DaffProductServiceInterface {
16
+ private productFactory;
17
+ private productImageFactory;
18
+ constructor(productFactory: DaffProductExtensionFactory, productImageFactory: DaffProductImageFactory);
19
+ getAll(): Observable<DaffProduct[]>;
20
+ get(productId: DaffProduct['id']): Observable<DaffProductDriverResponse>;
21
+ getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse>;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffTestingProductService, never>;
23
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
26
24
  }
27
-
28
25
  /**
29
26
  * Module for providing the {@link DaffProductTestingService} driver as the {@link DaffProductDriver}.
27
+ *
28
+ * @deprecated in favor of {@link provideDaffProductTestingDriver} Deprecated in version 0.95.0. Will be removed in version 0.98.0.
30
29
  */
31
- declare class DaffProductTestingDriverModule {
32
- static forRoot(): ModuleWithProviders<DaffProductTestingDriverModule>;
33
- static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductTestingDriverModule, never>;
34
- static ɵmod: i0.ɵɵNgModuleDeclaration<DaffProductTestingDriverModule, never, [typeof i1.CommonModule, typeof i2.DaffProductTestingModule], never>;
35
- static ɵinj: i0.ɵɵInjectorDeclaration<DaffProductTestingDriverModule>;
30
+ export declare class DaffProductTestingDriverModule {
31
+ static forRoot(): ModuleWithProviders<DaffProductTestingDriverModule>;
32
+ static ɵfac: i0.ɵɵFactoryDeclaration<DaffProductTestingDriverModule, never>;
33
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DaffProductTestingDriverModule, never, [typeof i1.CommonModule], never>;
34
+ static ɵinj: i0.ɵɵInjectorDeclaration<DaffProductTestingDriverModule>;
36
35
  }
37
-
38
- export { DaffProductTestingDriverModule, DaffTestingProductService };
36
+ /**
37
+ * Provides the {@link DaffTestingProductService} driver as the {@link DaffProductDriver}.
38
+ * Includes {@link provideDaffProductTesting}.
39
+ */
40
+ export declare const provideDaffProductTestingDriver: () => EnvironmentProviders;
@@ -1,78 +1,67 @@
1
- import * as _angular_core from '@angular/core';
2
- import { Observable } from 'rxjs';
3
- import { DaffProduct } from '@daffodil/product';
4
- import { DaffInheritableError, DaffError } from '@daffodil/core';
5
-
1
+ import { Observable } from "rxjs";
2
+ import { DaffProduct } from "@daffodil/product";
3
+ import { DaffError, DaffInheritableError } from "@daffodil/core";
6
4
  /**
7
5
  * The driver response model that contains all products returned by the platform.
8
6
  */
9
- interface DaffProductDriverResponse<T extends DaffProduct = DaffProduct> {
10
- /**
11
- * The ID of the "main" product.
12
- * That is, the ID that was passed into the driver call.
13
- */
14
- id: T['id'];
15
- /**
16
- * The list of products.
17
- * Contains the main product referenced by `id` and
18
- * possibly additional products that were nested inside the main product.
19
- * Does not guarantee uniqueness; duplicates may appear.
20
- */
21
- products: T[];
7
+ export interface DaffProductDriverResponse<T extends DaffProduct = DaffProduct> {
8
+ /**
9
+ * The ID of the "main" product.
10
+ * That is, the ID that was passed into the driver call.
11
+ */
12
+ id: T['id'];
13
+ /**
14
+ * The list of products.
15
+ * Contains the main product referenced by `id` and
16
+ * possibly additional products that were nested inside the main product.
17
+ * Does not guarantee uniqueness; duplicates may appear.
18
+ */
19
+ products: T[];
22
20
  }
23
-
24
- declare const DaffProductDriver: _angular_core.InjectionToken<DaffProductServiceInterface<DaffProduct>>;
25
- declare const provideDaffProductDriver: <R extends DaffProductServiceInterface<DaffProduct> = DaffProductServiceInterface<DaffProduct>>(klass: _angular_core.Type<R>) => _angular_core.ExistingProvider;
21
+ export declare const DaffProductDriver: import("@angular/core").InjectionToken<DaffProductServiceInterface<DaffProduct>>, provideDaffProductDriver: <R extends DaffProductServiceInterface<DaffProduct> = DaffProductServiceInterface<DaffProduct>>(klass: import("@angular/core").Type<R>) => import("@angular/core").ExistingProvider;
26
22
  /**
27
23
  * An interface for any Product service drivers.
28
24
  */
29
- interface DaffProductServiceInterface<T extends DaffProduct = DaffProduct> {
30
- /**
31
- * Get all products.
32
- */
33
- getAll(): Observable<T[]>;
34
- /**
35
- * Get a product by Id.
36
- *
37
- * @param productId - A string of the product ID.
38
- */
39
- get(productId: T['id']): Observable<DaffProductDriverResponse<T>>;
40
- /**
41
- * Get a product by URL.
42
- *
43
- * @param url - A string of the product URL.
44
- *
45
- * See {@link DaffLocatable} for more information on the requirements for the url argument of {@link DaffProduct}.
46
- */
47
- getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse<T>>;
25
+ export interface DaffProductServiceInterface<T extends DaffProduct = DaffProduct> {
26
+ /**
27
+ * Get all products.
28
+ */
29
+ getAll(): Observable<T[]>;
30
+ /**
31
+ * Get a product by Id.
32
+ *
33
+ * @param productId - A string of the product ID.
34
+ */
35
+ get(productId: T['id']): Observable<DaffProductDriverResponse<T>>;
36
+ /**
37
+ * Get a product by URL.
38
+ *
39
+ * @param url - A string of the product URL.
40
+ *
41
+ * See {@link DaffLocatable} for more information on the requirements for the url argument of {@link DaffProduct}.
42
+ */
43
+ getByUrl(url: DaffProduct['url']): Observable<DaffProductDriverResponse<T>>;
48
44
  }
49
-
50
- declare enum DaffProductDriverErrorCodes {
51
- PRODUCT_NOT_FOUND = "DAFF_PRODUCT_NOT_FOUND",
52
- INVALID_API_RESPONSE = "DAFF_PRODUCT_INVALID_API_RESPONSE"
45
+ export declare enum DaffProductDriverErrorCodes {
46
+ PRODUCT_NOT_FOUND = "DAFF_PRODUCT_NOT_FOUND",
47
+ INVALID_API_RESPONSE = "DAFF_PRODUCT_INVALID_API_RESPONSE"
53
48
  }
54
-
55
- declare class DaffProductInvalidAPIResponseError extends DaffInheritableError implements DaffError {
56
- message: string;
57
- readonly code: string;
58
- constructor(message: string);
49
+ export declare class DaffProductInvalidAPIResponseError extends DaffInheritableError implements DaffError {
50
+ message: string;
51
+ readonly code: string;
52
+ constructor(message: string);
59
53
  }
60
-
61
54
  /**
62
55
  * An error thrown when the requested product cannot be found.
63
56
  */
64
- declare class DaffProductNotFoundError extends DaffInheritableError implements DaffError {
65
- readonly code: string;
66
- constructor(message?: string);
57
+ export declare class DaffProductNotFoundError extends DaffInheritableError implements DaffError {
58
+ readonly code: string;
59
+ constructor(message?: string);
67
60
  }
68
-
69
61
  /**
70
62
  * A mapping from error codes to error class constructors.
71
63
  */
72
- declare const DaffProductDriverErrorMap: {
73
- DAFF_PRODUCT_NOT_FOUND: typeof DaffProductNotFoundError;
74
- DAFF_PRODUCT_INVALID_API_RESPONSE: typeof DaffProductInvalidAPIResponseError;
75
- };
76
-
77
- export { DaffProductDriver, DaffProductDriverErrorCodes, DaffProductDriverErrorMap, DaffProductInvalidAPIResponseError, DaffProductNotFoundError, provideDaffProductDriver };
78
- export type { DaffProductDriverResponse, DaffProductServiceInterface };
64
+ export declare const DaffProductDriverErrorMap: {
65
+ DAFF_PRODUCT_NOT_FOUND: typeof DaffProductNotFoundError;
66
+ DAFF_PRODUCT_INVALID_API_RESPONSE: typeof DaffProductInvalidAPIResponseError;
67
+ };