@fyul/embed-sdk 1.2.2 โ†’ 2.0.1

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 (38) hide show
  1. package/README.md +2 -193
  2. package/dist/cjs/modules/catalog/catalogModule.d.ts +4 -3
  3. package/dist/cjs/modules/catalog/catalogModule.js +8 -9
  4. package/dist/cjs/modules/catalog/catalogService.d.ts +5 -3
  5. package/dist/cjs/modules/catalog/catalogService.js +16 -4
  6. package/dist/cjs/modules/catalog/events.d.ts +2 -0
  7. package/dist/cjs/modules/catalog/events.js +1 -0
  8. package/dist/cjs/modules/catalog/types/data.types.d.ts +2 -0
  9. package/dist/cjs/modules/catalog/types/event/actionEvent.types.d.ts +3 -2
  10. package/dist/cjs/modules/catalog/types/event/actionEventPayload.types.d.ts +6 -2
  11. package/dist/cjs/modules/eventTypes.d.ts +1 -1
  12. package/dist/cjs/modules/events.d.ts +2 -0
  13. package/dist/cjs/modules/mockup-generation/types/data.types.d.ts +0 -21
  14. package/dist/cjs/modules/mockup-generation/types/event/actionEventPayload.types.d.ts +12 -7
  15. package/dist/cjs/modules/product-publish/types/event/actionEventPayload.types.d.ts +4 -2
  16. package/dist/cjs/types/event/action/actionEvent.types.d.ts +2 -2
  17. package/dist/cjs/types/module/module.types.d.ts +4 -3
  18. package/dist/cjs/version.d.ts +1 -1
  19. package/dist/cjs/version.js +1 -1
  20. package/dist/esm/modules/catalog/catalogModule.d.ts +4 -3
  21. package/dist/esm/modules/catalog/catalogModule.js +8 -9
  22. package/dist/esm/modules/catalog/catalogService.d.ts +5 -3
  23. package/dist/esm/modules/catalog/catalogService.js +16 -4
  24. package/dist/esm/modules/catalog/events.d.ts +2 -0
  25. package/dist/esm/modules/catalog/events.js +1 -0
  26. package/dist/esm/modules/catalog/types/data.types.d.ts +2 -0
  27. package/dist/esm/modules/catalog/types/event/actionEvent.types.d.ts +3 -2
  28. package/dist/esm/modules/catalog/types/event/actionEventPayload.types.d.ts +6 -2
  29. package/dist/esm/modules/eventTypes.d.ts +1 -1
  30. package/dist/esm/modules/events.d.ts +2 -0
  31. package/dist/esm/modules/mockup-generation/types/data.types.d.ts +0 -21
  32. package/dist/esm/modules/mockup-generation/types/event/actionEventPayload.types.d.ts +12 -7
  33. package/dist/esm/modules/product-publish/types/event/actionEventPayload.types.d.ts +4 -2
  34. package/dist/esm/types/event/action/actionEvent.types.d.ts +2 -2
  35. package/dist/esm/types/module/module.types.d.ts +4 -3
  36. package/dist/esm/version.d.ts +1 -1
  37. package/dist/esm/version.js +1 -1
  38. package/package.json +1 -1
package/README.md CHANGED
@@ -1,198 +1,7 @@
1
- # @fyulorg/embed-sdk
2
-
3
- A TypeScript SDK for integrating with Printful services via iframe-based cross-origin communication. The SDK provides a modular architecture for catalog browsing, mockup generation, and other Printful services through secure iframe messaging.
4
-
5
- ## Features
6
-
7
- - ๐ŸŽฏ **Modular Architecture**: Separate modules for different services (Catalog, Mockup Generation, SDK core)
8
- - ๐Ÿ”’ **Secure Communication**: iframe-based cross-origin messaging with correlation ID tracking
9
- - ๐Ÿ“ฆ **Dual Package Support**: Both ESM and CommonJS builds included
10
- - ๐Ÿงช **Fully Tested**: Comprehensive Jest test suite with 130+ tests and ~90% coverage
11
- - ๐ŸŽจ **TypeScript First**: Complete type safety with extensive type definitions
12
- - ๐Ÿ”ง **Development Ready**: ESLint, Prettier, and modern tooling configured
1
+ # @fyul/embed-sdk
13
2
 
14
3
  ## Installation
15
4
 
16
5
  ```bash
17
- npm install @fyulorg/embed-sdk
18
- ```
19
-
20
- ## Quick Start
21
-
22
- ```typescript
23
- import { Embed } from '@fyulorg/embed-sdk';
24
-
25
- // Create SDK instance with your authentication nonce
26
- const embedSdk = new Embed('your-nonce-here', {
27
- targetOrigin: 'https://your-domain.com',
28
- modules: [
29
- { name: 'catalog', data: { apiKey: 'your-api-key' } },
30
- { name: 'mockupGeneration', data: { timeout: 30000 } }
31
- ]
32
- });
33
-
34
- // Initialize connection
35
- await embedSdk.init();
36
-
37
- // Use catalog service
38
- const products = await embedSdk.catalog.getProducts(123);
39
- console.log('Products:', products);
40
-
41
- // Use mockup service
42
- const imageFile = new File(['...'], 'design.png', { type: 'image/png' });
43
- const mockups = await embedSdk.mockup.getMockups(imageFile, [1, 2, 3]);
44
- console.log('Generated mockups:', mockups);
45
-
46
- // Clean up when done
47
- embedSdk.destroy();
48
- ```
49
-
50
- ## API Reference
51
-
52
- ### `new Embed(nonce, config?)`
53
-
54
- Creates a new SDK instance.
55
-
56
- **Parameters:**
57
- - `nonce` (string): Authentication token from your backend
58
- - `config` (optional): Configuration object
59
- - `targetOrigin` (string): Target origin for iframe messages
60
- - `modules` (array): Module configurations to initialize
61
-
62
- ### Core Methods
63
-
64
- #### `embed.init(): Promise<void>`
65
- Initializes the SDK, creates iframe, and establishes communication channel.
66
-
67
- #### `embed.destroy(): void`
68
- Cleans up resources, removes iframe, and clears all pending messages.
69
-
70
- ### Services
71
-
72
- #### Catalog Service (`embed.catalog`)
73
- ```typescript
74
- // Get products by category
75
- const products = await embed.catalog.getProducts(categoryId);
76
-
77
- // Get all categories
78
- const categories = await embed.catalog.getCategories();
79
- ```
80
-
81
- #### Mockup Service (`embed.mockup`)
82
- ```typescript
83
- // Generate mockups from design file
84
- const mockups = await embed.mockup.getMockups(
85
- designFile, // Blob | File
86
- productIds // number[] (optional)
87
- );
88
- ```
89
-
90
- ## Module System
91
-
92
- The SDK uses a modular architecture where different services are loaded as separate modules:
93
-
94
- - **SDK Module**: Core functionality and initialization
95
- - **Catalog Module**: Product and category browsing
96
- - **Mockup Generation Module**: Design-to-mockup conversion
97
-
98
- Each module can be configured independently and loaded on-demand.
99
-
100
- ## Event System
101
-
102
- The SDK implements a comprehensive event system for iframe communication:
103
-
104
- - **Action Events**: Commands sent to the iframe (e.g., initialize, load module)
105
- - **Result Events**: Successful responses from iframe operations
106
- - **Notification Events**: Status updates and error notifications
107
-
108
- All events include correlation IDs for request/response tracking.
109
-
110
- ## TypeScript Support
111
-
112
- Full TypeScript support with extensive type definitions:
113
-
114
- ```typescript
115
- import {
116
- Embed,
117
- CatalogModule,
118
- MockupGenerationModule,
119
- NotificationEvent,
120
- ResultEvent,
121
- handleResponse
122
- } from '@fyulorg/embed-sdk';
123
-
124
- // All types are fully typed
125
- const embed = new Embed('nonce');
126
- const result: CatalogModule.GetProductsResult = await embed.catalog.getProducts(1);
127
- ```
128
-
129
- ## Development
130
-
131
- ### Setup
132
-
133
- ```bash
134
- # Install dependencies
135
- npm install
136
-
137
- # Run tests
138
- npm test
139
- npm run test:watch
140
- npm run test:coverage
141
-
142
- # Build
143
- npm run build
144
-
145
- # Lint and format
146
- npm run lint
147
- npm run prettier
148
- npm run lint:fix
149
- npm run prettier:fix
6
+ npm install @fyul/embed-sdk
150
7
  ```
151
-
152
- ### Project Structure
153
-
154
- ```
155
- src/
156
- โ”œโ”€โ”€ index.ts # Main SDK export
157
- โ”œโ”€โ”€ services/ # Core services
158
- โ”‚ โ”œโ”€โ”€ embedCommunicator.ts
159
- โ”‚ โ”œโ”€โ”€ iFrameManager.ts
160
- โ”‚ โ”œโ”€โ”€ messagebroker.ts
161
- โ”‚ โ””โ”€โ”€ moduleLoaderService.ts
162
- โ”œโ”€โ”€ modules/ # Feature modules
163
- โ”‚ โ”œโ”€โ”€ catalog/
164
- โ”‚ โ”œโ”€โ”€ mockup-generation/
165
- โ”‚ โ””โ”€โ”€ sdk/
166
- โ”œโ”€โ”€ types/ # Shared type definitions
167
- โ”‚ โ”œโ”€โ”€ event/
168
- โ”‚ โ””โ”€โ”€ module/
169
- โ””โ”€โ”€ helpers/ # Utility functions
170
-
171
- tests/ # Test files (mirrors src structure)
172
- โ”œโ”€โ”€ services/
173
- โ”œโ”€โ”€ modules/
174
- โ””โ”€โ”€ helpers/
175
- ```
176
-
177
- ### Import Aliases
178
-
179
- The project uses `~` aliases for clean imports:
180
-
181
- ```typescript
182
- import { EmbedCommunicator } from '~/services/embedCommunicator';
183
- import { CatalogModule } from '~/modules/catalog/catalogModule';
184
- import { Event } from '~/types/event/event.types';
185
- ```
186
-
187
- ## Building
188
-
189
- The project builds to both ESM and CommonJS formats:
190
-
191
- - **ESM**: `dist/esm/` - Modern ES modules
192
- - **CJS**: `dist/cjs/` - Compatible CommonJS modules
193
-
194
- The build process uses TypeScript compilation followed by `tsc-alias` for path resolution.
195
-
196
- ## License
197
-
198
- ISC
@@ -1,9 +1,10 @@
1
1
  import { ICatalogModule } from '../../types/module/module.types';
2
2
  import { BaseModule } from '../../modules/baseModule';
3
- import { GetCatalogCategoriesResultPayload, GetCatalogProductsResultPayload, GetSingleCatalogProductResultPayload } from './types';
3
+ import { GetCatalogCategoriesResultPayload, GetCatalogProductsByIdsPayload, GetCatalogProductsPayload, GetCatalogProductsResultPayload, GetSingleCatalogProductPayload, GetSingleCatalogProductResultPayload } from './types';
4
4
  import { WithHandledResponses } from '../../helpers/typeHelper.types';
5
5
  export declare class CatalogModule extends BaseModule implements WithHandledResponses<ICatalogModule> {
6
- getProducts(categoryId: number, page?: number): Promise<import("../..").HandledResponse<GetCatalogProductsResultPayload, Error>>;
7
- getProduct(productId: number): Promise<import("../..").HandledResponse<GetSingleCatalogProductResultPayload, Error>>;
6
+ getProducts(data: GetCatalogProductsPayload): Promise<import("../..").HandledResponse<GetCatalogProductsResultPayload, Error>>;
7
+ getProductsByIds(data: GetCatalogProductsByIdsPayload): Promise<import("../..").HandledResponse<GetCatalogProductsResultPayload, Error>>;
8
+ getProduct(data: GetSingleCatalogProductPayload): Promise<import("../..").HandledResponse<GetSingleCatalogProductResultPayload, Error>>;
8
9
  getCategories(): Promise<import("../..").HandledResponse<GetCatalogCategoriesResultPayload, Error>>;
9
10
  }
@@ -5,17 +5,16 @@ const baseModule_1 = require("../../modules/baseModule");
5
5
  const types_1 = require("./types");
6
6
  const responseHandler_1 = require("../../helpers/responseHandler");
7
7
  class CatalogModule extends baseModule_1.BaseModule {
8
- async getProducts(categoryId, page = 1) {
9
- const response = await this.sendRequest(types_1.EVENTS_ACTION.GET_CATALOG_PRODUCTS, {
10
- categoryId,
11
- page,
12
- }).catch((e) => e);
8
+ async getProducts(data) {
9
+ const response = await this.sendRequest(types_1.EVENTS_ACTION.GET_CATALOG_PRODUCTS, data).catch((e) => e);
13
10
  return (0, responseHandler_1.handleResponse)(response, 'Failed to get catalog products');
14
11
  }
15
- async getProduct(productId) {
16
- const response = await this.sendRequest(types_1.EVENTS_ACTION.GET_SINGLE_CATALOG_PRODUCT, {
17
- productId,
18
- }).catch((e) => e);
12
+ async getProductsByIds(data) {
13
+ const response = await this.sendRequest(types_1.EVENTS_ACTION.GET_CATALOG_PRODUCTS_BY_IDS, data).catch((e) => e);
14
+ return (0, responseHandler_1.handleResponse)(response, 'Failed to get catalog products');
15
+ }
16
+ async getProduct(data) {
17
+ const response = await this.sendRequest(types_1.EVENTS_ACTION.GET_SINGLE_CATALOG_PRODUCT, data).catch((e) => e);
19
18
  return (0, responseHandler_1.handleResponse)(response, 'Failed to get catalog products');
20
19
  }
21
20
  async getCategories() {
@@ -1,7 +1,9 @@
1
1
  import { BaseModuleService } from '../../modules/baseModuleService';
2
+ import { GetCatalogProductsByIdsPayload, GetCatalogProductsPayload, GetSingleCatalogProductPayload } from '../../modules/catalog/types';
2
3
  export declare class CatalogService extends BaseModuleService {
3
4
  private getCatalogModule;
4
- getCategories(): Promise<import("../..").HandledResponse<import("./types").GetCatalogCategoriesResultPayload, Error>>;
5
- getProducts(categoryId: number, page?: number): Promise<import("../..").HandledResponse<import("./types").GetCatalogProductsResultPayload, Error>>;
6
- getProduct(productId: number): Promise<import("../..").HandledResponse<import("./types").GetSingleCatalogProductResultPayload, Error>>;
5
+ getCategories(): Promise<import("../..").HandledResponse<import("../../modules/catalog/types").GetCatalogCategoriesResultPayload, Error>>;
6
+ getProducts(data: GetCatalogProductsPayload): Promise<import("../..").HandledResponse<import("../../modules/catalog/types").GetCatalogProductsResultPayload, Error>>;
7
+ getProductsByIds(data: GetCatalogProductsByIdsPayload): Promise<import("../..").HandledResponse<import("../../modules/catalog/types").GetCatalogProductsResultPayload, Error> | null>;
8
+ getProduct(data: GetSingleCatalogProductPayload): Promise<import("../..").HandledResponse<import("../../modules/catalog/types").GetSingleCatalogProductResultPayload, Error>>;
7
9
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CatalogService = void 0;
4
4
  const baseModuleService_1 = require("../../modules/baseModuleService");
5
5
  const modules_1 = require("../../modules/modules");
6
+ const messageLogger_1 = require("../../helpers/messageLogger");
6
7
  class CatalogService extends baseModuleService_1.BaseModuleService {
7
8
  async getCatalogModule() {
8
9
  return this.ensureModuleLoaded(modules_1.MODULE_NAMES.CATALOG);
@@ -11,13 +12,24 @@ class CatalogService extends baseModuleService_1.BaseModuleService {
11
12
  const module = await this.getCatalogModule();
12
13
  return module.getCategories();
13
14
  }
14
- async getProducts(categoryId, page = 1) {
15
+ async getProducts(data) {
15
16
  const module = await this.getCatalogModule();
16
- return module.getProducts(categoryId, page);
17
+ return module.getProducts(data);
17
18
  }
18
- async getProduct(productId) {
19
+ async getProductsByIds(data) {
20
+ if (!data.productIds.length) {
21
+ (0, messageLogger_1.logEmbedMessage)({
22
+ logType: messageLogger_1.LOG_TYPES.ERROR,
23
+ message: 'Empty productIds argument!',
24
+ });
25
+ return null;
26
+ }
19
27
  const module = await this.getCatalogModule();
20
- return module.getProduct(productId);
28
+ return module.getProductsByIds(data);
29
+ }
30
+ async getProduct(data) {
31
+ const module = await this.getCatalogModule();
32
+ return module.getProduct(data);
21
33
  }
22
34
  }
23
35
  exports.CatalogService = CatalogService;
@@ -1,5 +1,6 @@
1
1
  export declare const EVENTS_ACTION: {
2
2
  readonly GET_CATALOG_PRODUCTS: "actionGetCatalogProducts";
3
+ readonly GET_CATALOG_PRODUCTS_BY_IDS: "actionGetCatalogProductsByIds";
3
4
  readonly GET_SINGLE_CATALOG_PRODUCT: "actionGetSingleCatalogProduct";
4
5
  readonly GET_CATALOG_CATEGORIES: "actionGetCatalogCategories";
5
6
  };
@@ -21,6 +22,7 @@ export declare const EVENTS: {
21
22
  readonly GET_SINGLE_CATALOG_PRODUCT_FAILURE: "actionGetSingleCatalogProductFailure";
22
23
  readonly GET_CATALOG_CATEGORIES_FAILURE: "actionGetCatalogCategoriesFailure";
23
24
  readonly GET_CATALOG_PRODUCTS: "actionGetCatalogProducts";
25
+ readonly GET_CATALOG_PRODUCTS_BY_IDS: "actionGetCatalogProductsByIds";
24
26
  readonly GET_SINGLE_CATALOG_PRODUCT: "actionGetSingleCatalogProduct";
25
27
  readonly GET_CATALOG_CATEGORIES: "actionGetCatalogCategories";
26
28
  };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EVENTS = exports.EVENTS_RESULT = exports.EVENTS_NOTIFICATION = exports.EVENTS_ACTION = void 0;
4
4
  exports.EVENTS_ACTION = {
5
5
  GET_CATALOG_PRODUCTS: 'actionGetCatalogProducts',
6
+ GET_CATALOG_PRODUCTS_BY_IDS: 'actionGetCatalogProductsByIds',
6
7
  GET_SINGLE_CATALOG_PRODUCT: 'actionGetSingleCatalogProduct',
7
8
  GET_CATALOG_CATEGORIES: 'actionGetCatalogCategories',
8
9
  };
@@ -3,6 +3,7 @@ export interface CatalogProduct {
3
3
  productId: number;
4
4
  title: string;
5
5
  price?: number;
6
+ priceWithTax?: number;
6
7
  currency?: string;
7
8
  urlImage?: string;
8
9
  colorsSizes: {
@@ -82,6 +83,7 @@ export interface ProductVariant {
82
83
  }
83
84
  export interface VariantPriceData {
84
85
  price: number;
86
+ priceWithTax: number;
85
87
  currency: string;
86
88
  currencySymbol: string;
87
89
  }
@@ -1,7 +1,8 @@
1
1
  import { EVENTS_ACTION } from '../../../../modules/catalog/events';
2
- import type { GetCatalogCategoriesPayload, GetCatalogProductsPayload, GetSingleCatalogProductPayload } from '../../../../modules/catalog/types';
2
+ import type { GetCatalogCategoriesPayload, GetCatalogProductsByIdsPayload, GetCatalogProductsPayload, GetSingleCatalogProductPayload } from '../../../../modules/catalog/types';
3
3
  import { BaseActionEvent } from '../../../../types/event/action/actionEvent.types';
4
4
  export type GetCatalogProductsAction = BaseActionEvent<typeof EVENTS_ACTION.GET_CATALOG_PRODUCTS, GetCatalogProductsPayload>;
5
+ export type GetCatalogProductsByIdsAction = BaseActionEvent<typeof EVENTS_ACTION.GET_CATALOG_PRODUCTS_BY_IDS, GetCatalogProductsByIdsPayload>;
5
6
  export type GetSingleCatalogProductAction = BaseActionEvent<typeof EVENTS_ACTION.GET_SINGLE_CATALOG_PRODUCT, GetSingleCatalogProductPayload>;
6
7
  export type GetCatalogCategoriesAction = BaseActionEvent<typeof EVENTS_ACTION.GET_CATALOG_CATEGORIES, GetCatalogCategoriesPayload>;
7
- export type ActionEvent = GetCatalogCategoriesAction | GetCatalogProductsAction | GetSingleCatalogProductAction;
8
+ export type ActionEvent = GetCatalogCategoriesAction | GetCatalogProductsByIdsAction | GetCatalogProductsAction | GetSingleCatalogProductAction;
@@ -1,6 +1,10 @@
1
1
  export interface GetCatalogProductsPayload {
2
2
  categoryId: number;
3
- page: number;
3
+ page?: number;
4
+ }
5
+ export interface GetCatalogProductsByIdsPayload {
6
+ productIds: number[];
7
+ page?: number;
4
8
  }
5
9
  export interface GetSingleCatalogProductPayload {
6
10
  productId: number;
@@ -8,4 +12,4 @@ export interface GetSingleCatalogProductPayload {
8
12
  export interface GetCatalogCategoriesPayload {
9
13
  level: number;
10
14
  }
11
- export type ActionEventPayload = GetCatalogCategoriesPayload | GetCatalogProductsPayload | GetSingleCatalogProductPayload;
15
+ export type ActionEventPayload = GetCatalogProductsByIdsPayload | GetCatalogCategoriesPayload | GetCatalogProductsPayload | GetSingleCatalogProductPayload;
@@ -4,6 +4,6 @@ export declare const EVENT_TYPES: {
4
4
  readonly NOTIFICATION: "notification";
5
5
  readonly RESULT: "result";
6
6
  };
7
- export declare function isAction(event: AnyEvent): event is import("./sdk/types").InitializeSdkAction | import("./sdk/types").LoadModuleAction | import("./mockup-generation/types").GetMockupsAction | import("./product-publish/types").GetProductPublishAction | import("./catalog/types").GetCatalogCategoriesAction | import("./catalog/types").GetCatalogProductsAction | import("./catalog/types").GetSingleCatalogProductAction;
7
+ export declare function isAction(event: AnyEvent): event is import("./sdk/types").InitializeSdkAction | import("./sdk/types").LoadModuleAction | import("./mockup-generation/types").GetMockupsAction | import("./product-publish/types").GetProductPublishAction | import("./catalog/types").GetCatalogCategoriesAction | import("./catalog/types").GetCatalogProductsByIdsAction | import("./catalog/types").GetCatalogProductsAction | import("./catalog/types").GetSingleCatalogProductAction;
8
8
  export declare function isNotification(event: AnyEvent): event is import("..").NotificationEvent;
9
9
  export declare function isResult(event: AnyEvent): event is import("./catalog/types").GetCatalogProductsResult | import("./catalog/types").GetSingleCatalogProductResult | import("./catalog/types").GetCatalogCategoriesResult | import("./product-publish/types").GetProductPublishResult | import("./mockup-generation/types").GetMockupsResultEvent;
@@ -2,6 +2,7 @@ export declare const ALL_ACTION_EVENTS: {
2
2
  readonly PRODUCT_PUBLISH: "actionProductPublish";
3
3
  readonly GET_MOCKUPS: "actionGetMockups";
4
4
  readonly GET_CATALOG_PRODUCTS: "actionGetCatalogProducts";
5
+ readonly GET_CATALOG_PRODUCTS_BY_IDS: "actionGetCatalogProductsByIds";
5
6
  readonly GET_SINGLE_CATALOG_PRODUCT: "actionGetSingleCatalogProduct";
6
7
  readonly GET_CATALOG_CATEGORIES: "actionGetCatalogCategories";
7
8
  readonly INITIALIZE_SDK: "actionInitializeSdk";
@@ -37,6 +38,7 @@ export declare const ALL_EVENTS: {
37
38
  readonly PRODUCT_PUBLISH: "actionProductPublish";
38
39
  readonly GET_MOCKUPS: "actionGetMockups";
39
40
  readonly GET_CATALOG_PRODUCTS: "actionGetCatalogProducts";
41
+ readonly GET_CATALOG_PRODUCTS_BY_IDS: "actionGetCatalogProductsByIds";
40
42
  readonly GET_SINGLE_CATALOG_PRODUCT: "actionGetSingleCatalogProduct";
41
43
  readonly GET_CATALOG_CATEGORIES: "actionGetCatalogCategories";
42
44
  readonly INITIALIZE_SDK: "actionInitializeSdk";
@@ -1,29 +1,8 @@
1
- export interface ProductMockupEntry {
2
- productId: number;
3
- isSizeBased: boolean;
4
- productMockups: unknown[];
5
- mockupPlacements: unknown[];
6
- placementTemplates: unknown[];
7
- }
8
1
  export interface MockupGenerationData {
9
- imgUrl: string | null;
10
- id: number;
11
- styleName: string;
12
- styleNameTranslation: string;
13
2
  color: string | null | undefined;
14
3
  size: string | null;
15
- placement: string;
16
- mockupVariantId: number;
17
- isBlankMockup: boolean;
18
4
  baseImageUrl: string | null;
19
5
  bgColor: string;
20
- isTransparent: boolean;
21
- canMockupHaveDynamicBackground: boolean;
22
- isLoading: boolean;
23
- failed: boolean;
24
- error: string | Error | null;
25
- isCleared: boolean;
26
- processId: string;
27
6
  blob: Blob | null;
28
7
  }
29
8
  export interface MockupDataWithProductData extends MockupGenerationData {
@@ -1,11 +1,16 @@
1
- export interface InitializeMockupDataPayload {
2
- productIds: number[];
3
- }
4
1
  export interface GetMockupsPayload {
5
- file: Blob | null;
6
- mockupData: {
2
+ /** File from which to generate mockups */
3
+ file: Blob;
4
+ /** List of all products and their variants to fetch mockups for */
5
+ products: {
7
6
  productId: number;
8
- variantIds: number[];
7
+ variantIds?: number[];
9
8
  }[];
9
+ /** Optional mapping of productId โ†’ selected variantId.
10
+ * If not provided, the first variant from each product will be used. */
11
+ selectedVariants?: Record<string, number>;
12
+ /** If set to true, request will finish faster, and allow you
13
+ * to show preview image on which mockup will be generated on */
14
+ shouldReturnBlankMockups?: true;
10
15
  }
11
- export type ActionEventPayload = GetMockupsPayload | InitializeMockupDataPayload;
16
+ export type ActionEventPayload = GetMockupsPayload;
@@ -1,7 +1,9 @@
1
1
  export interface GetProductPublishPayload {
2
- blob: Blob | null;
3
- publishData: {
2
+ file: Blob;
3
+ /** List of all products and their variants to generate templates for */
4
+ products: {
4
5
  productId: number;
6
+ /** Should not be empty, otherwise will fail to publish */
5
7
  variantIds: number[];
6
8
  }[];
7
9
  }
@@ -1,4 +1,4 @@
1
- import { ActionEvent as SdkActionEvent, LoadModuleAction } from '../../../modules/sdk/types/event/actionEvent.types';
1
+ import { ActionEvent as SdkActionEvent } from '../../../modules/sdk/types/event/actionEvent.types';
2
2
  import { ActionEvent as CatalogActionEvent } from '../../../modules/catalog/types/event/actionEvent.types';
3
3
  import { ActionEvent as MockupGenerationActionEvent } from '../../../modules/mockup-generation/types/event/actionEvent.types';
4
4
  import { ActionEvent as ProductPublishActionEvent } from '../../../modules/product-publish/types/event/actionEvent.types';
@@ -8,4 +8,4 @@ import { EVENT_TYPES } from '../../../modules/eventTypes';
8
8
  import { ActionEventPayload } from './actionEventPayload.types';
9
9
  export type ActionEventName = (typeof ALL_ACTION_EVENTS)[keyof typeof ALL_ACTION_EVENTS];
10
10
  export type BaseActionEvent<TName extends ActionEventName, TPayload extends ActionEventPayload> = Event<TName, typeof EVENT_TYPES.ACTION, TPayload>;
11
- export type ActionEvent = LoadModuleAction | MockupGenerationActionEvent | CatalogActionEvent | ProductPublishActionEvent | SdkActionEvent;
11
+ export type ActionEvent = MockupGenerationActionEvent | CatalogActionEvent | ProductPublishActionEvent | SdkActionEvent;
@@ -1,7 +1,7 @@
1
1
  import type { MODULE_NAMES } from '../../modules/modules';
2
2
  import { GetMockupsPayload, GetMockupsResultPayload } from '../../modules/mockup-generation/types';
3
3
  import { SdkModuleConfigData } from '../../modules/sdk/types';
4
- import { GetCatalogCategoriesResultPayload, GetCatalogProductsResultPayload, GetSingleCatalogProductResultPayload } from '../../modules/catalog/types';
4
+ import { GetCatalogCategoriesResultPayload, GetCatalogProductsByIdsPayload, GetCatalogProductsPayload, GetCatalogProductsResultPayload, GetSingleCatalogProductPayload, GetSingleCatalogProductResultPayload } from '../../modules/catalog/types';
5
5
  import { NotificationEventPayload } from '../../types/event/notification/notificationEventPayload.types';
6
6
  import { GetProductPublishPayload, ProductPublishData } from '../../modules/product-publish/types';
7
7
  /** This file ensures that Iframe and SDK has the same source of truth for return values */
@@ -10,8 +10,9 @@ export interface ISdkModule {
10
10
  setup(config?: SdkModuleConfigData): Promise<NotificationEventPayload> | Promise<void>;
11
11
  }
12
12
  export interface ICatalogModule {
13
- getProducts(categoryId: number): GetCatalogProductsResultPayload;
14
- getProduct(productId: number): GetSingleCatalogProductResultPayload;
13
+ getProducts(data: GetCatalogProductsPayload): GetCatalogProductsResultPayload;
14
+ getProductsByIds(data: GetCatalogProductsByIdsPayload): GetCatalogProductsResultPayload;
15
+ getProduct(data: GetSingleCatalogProductPayload): GetSingleCatalogProductResultPayload;
15
16
  getCategories(): GetCatalogCategoriesResultPayload;
16
17
  }
17
18
  export interface IMockupGenerationModule {
@@ -1 +1 @@
1
- export declare const VERSION: "1.2.2";
1
+ export declare const VERSION: "2.0.1";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // AUTO-GENERATED
5
- exports.VERSION = '1.2.2';
5
+ exports.VERSION = '2.0.1';
@@ -1,9 +1,10 @@
1
1
  import { ICatalogModule } from '../../types/module/module.types';
2
2
  import { BaseModule } from '../../modules/baseModule';
3
- import { GetCatalogCategoriesResultPayload, GetCatalogProductsResultPayload, GetSingleCatalogProductResultPayload } from './types';
3
+ import { GetCatalogCategoriesResultPayload, GetCatalogProductsByIdsPayload, GetCatalogProductsPayload, GetCatalogProductsResultPayload, GetSingleCatalogProductPayload, GetSingleCatalogProductResultPayload } from './types';
4
4
  import { WithHandledResponses } from '../../helpers/typeHelper.types';
5
5
  export declare class CatalogModule extends BaseModule implements WithHandledResponses<ICatalogModule> {
6
- getProducts(categoryId: number, page?: number): Promise<import("../..").HandledResponse<GetCatalogProductsResultPayload, Error>>;
7
- getProduct(productId: number): Promise<import("../..").HandledResponse<GetSingleCatalogProductResultPayload, Error>>;
6
+ getProducts(data: GetCatalogProductsPayload): Promise<import("../..").HandledResponse<GetCatalogProductsResultPayload, Error>>;
7
+ getProductsByIds(data: GetCatalogProductsByIdsPayload): Promise<import("../..").HandledResponse<GetCatalogProductsResultPayload, Error>>;
8
+ getProduct(data: GetSingleCatalogProductPayload): Promise<import("../..").HandledResponse<GetSingleCatalogProductResultPayload, Error>>;
8
9
  getCategories(): Promise<import("../..").HandledResponse<GetCatalogCategoriesResultPayload, Error>>;
9
10
  }
@@ -2,17 +2,16 @@ import { BaseModule } from '../../modules/baseModule';
2
2
  import { EVENTS_ACTION, } from './types';
3
3
  import { handleResponse } from '../../helpers/responseHandler';
4
4
  export class CatalogModule extends BaseModule {
5
- async getProducts(categoryId, page = 1) {
6
- const response = await this.sendRequest(EVENTS_ACTION.GET_CATALOG_PRODUCTS, {
7
- categoryId,
8
- page,
9
- }).catch((e) => e);
5
+ async getProducts(data) {
6
+ const response = await this.sendRequest(EVENTS_ACTION.GET_CATALOG_PRODUCTS, data).catch((e) => e);
10
7
  return handleResponse(response, 'Failed to get catalog products');
11
8
  }
12
- async getProduct(productId) {
13
- const response = await this.sendRequest(EVENTS_ACTION.GET_SINGLE_CATALOG_PRODUCT, {
14
- productId,
15
- }).catch((e) => e);
9
+ async getProductsByIds(data) {
10
+ const response = await this.sendRequest(EVENTS_ACTION.GET_CATALOG_PRODUCTS_BY_IDS, data).catch((e) => e);
11
+ return handleResponse(response, 'Failed to get catalog products');
12
+ }
13
+ async getProduct(data) {
14
+ const response = await this.sendRequest(EVENTS_ACTION.GET_SINGLE_CATALOG_PRODUCT, data).catch((e) => e);
16
15
  return handleResponse(response, 'Failed to get catalog products');
17
16
  }
18
17
  async getCategories() {
@@ -1,7 +1,9 @@
1
1
  import { BaseModuleService } from '../../modules/baseModuleService';
2
+ import { GetCatalogProductsByIdsPayload, GetCatalogProductsPayload, GetSingleCatalogProductPayload } from '../../modules/catalog/types';
2
3
  export declare class CatalogService extends BaseModuleService {
3
4
  private getCatalogModule;
4
- getCategories(): Promise<import("../..").HandledResponse<import("./types").GetCatalogCategoriesResultPayload, Error>>;
5
- getProducts(categoryId: number, page?: number): Promise<import("../..").HandledResponse<import("./types").GetCatalogProductsResultPayload, Error>>;
6
- getProduct(productId: number): Promise<import("../..").HandledResponse<import("./types").GetSingleCatalogProductResultPayload, Error>>;
5
+ getCategories(): Promise<import("../..").HandledResponse<import("../../modules/catalog/types").GetCatalogCategoriesResultPayload, Error>>;
6
+ getProducts(data: GetCatalogProductsPayload): Promise<import("../..").HandledResponse<import("../../modules/catalog/types").GetCatalogProductsResultPayload, Error>>;
7
+ getProductsByIds(data: GetCatalogProductsByIdsPayload): Promise<import("../..").HandledResponse<import("../../modules/catalog/types").GetCatalogProductsResultPayload, Error> | null>;
8
+ getProduct(data: GetSingleCatalogProductPayload): Promise<import("../..").HandledResponse<import("../../modules/catalog/types").GetSingleCatalogProductResultPayload, Error>>;
7
9
  }
@@ -1,5 +1,6 @@
1
1
  import { BaseModuleService } from '../../modules/baseModuleService';
2
2
  import { MODULE_NAMES } from '../../modules/modules';
3
+ import { LOG_TYPES, logEmbedMessage } from '../../helpers/messageLogger';
3
4
  export class CatalogService extends BaseModuleService {
4
5
  async getCatalogModule() {
5
6
  return this.ensureModuleLoaded(MODULE_NAMES.CATALOG);
@@ -8,12 +9,23 @@ export class CatalogService extends BaseModuleService {
8
9
  const module = await this.getCatalogModule();
9
10
  return module.getCategories();
10
11
  }
11
- async getProducts(categoryId, page = 1) {
12
+ async getProducts(data) {
12
13
  const module = await this.getCatalogModule();
13
- return module.getProducts(categoryId, page);
14
+ return module.getProducts(data);
14
15
  }
15
- async getProduct(productId) {
16
+ async getProductsByIds(data) {
17
+ if (!data.productIds.length) {
18
+ logEmbedMessage({
19
+ logType: LOG_TYPES.ERROR,
20
+ message: 'Empty productIds argument!',
21
+ });
22
+ return null;
23
+ }
16
24
  const module = await this.getCatalogModule();
17
- return module.getProduct(productId);
25
+ return module.getProductsByIds(data);
26
+ }
27
+ async getProduct(data) {
28
+ const module = await this.getCatalogModule();
29
+ return module.getProduct(data);
18
30
  }
19
31
  }
@@ -1,5 +1,6 @@
1
1
  export declare const EVENTS_ACTION: {
2
2
  readonly GET_CATALOG_PRODUCTS: "actionGetCatalogProducts";
3
+ readonly GET_CATALOG_PRODUCTS_BY_IDS: "actionGetCatalogProductsByIds";
3
4
  readonly GET_SINGLE_CATALOG_PRODUCT: "actionGetSingleCatalogProduct";
4
5
  readonly GET_CATALOG_CATEGORIES: "actionGetCatalogCategories";
5
6
  };
@@ -21,6 +22,7 @@ export declare const EVENTS: {
21
22
  readonly GET_SINGLE_CATALOG_PRODUCT_FAILURE: "actionGetSingleCatalogProductFailure";
22
23
  readonly GET_CATALOG_CATEGORIES_FAILURE: "actionGetCatalogCategoriesFailure";
23
24
  readonly GET_CATALOG_PRODUCTS: "actionGetCatalogProducts";
25
+ readonly GET_CATALOG_PRODUCTS_BY_IDS: "actionGetCatalogProductsByIds";
24
26
  readonly GET_SINGLE_CATALOG_PRODUCT: "actionGetSingleCatalogProduct";
25
27
  readonly GET_CATALOG_CATEGORIES: "actionGetCatalogCategories";
26
28
  };
@@ -1,5 +1,6 @@
1
1
  export const EVENTS_ACTION = {
2
2
  GET_CATALOG_PRODUCTS: 'actionGetCatalogProducts',
3
+ GET_CATALOG_PRODUCTS_BY_IDS: 'actionGetCatalogProductsByIds',
3
4
  GET_SINGLE_CATALOG_PRODUCT: 'actionGetSingleCatalogProduct',
4
5
  GET_CATALOG_CATEGORIES: 'actionGetCatalogCategories',
5
6
  };
@@ -3,6 +3,7 @@ export interface CatalogProduct {
3
3
  productId: number;
4
4
  title: string;
5
5
  price?: number;
6
+ priceWithTax?: number;
6
7
  currency?: string;
7
8
  urlImage?: string;
8
9
  colorsSizes: {
@@ -82,6 +83,7 @@ export interface ProductVariant {
82
83
  }
83
84
  export interface VariantPriceData {
84
85
  price: number;
86
+ priceWithTax: number;
85
87
  currency: string;
86
88
  currencySymbol: string;
87
89
  }
@@ -1,7 +1,8 @@
1
1
  import { EVENTS_ACTION } from '../../../../modules/catalog/events';
2
- import type { GetCatalogCategoriesPayload, GetCatalogProductsPayload, GetSingleCatalogProductPayload } from '../../../../modules/catalog/types';
2
+ import type { GetCatalogCategoriesPayload, GetCatalogProductsByIdsPayload, GetCatalogProductsPayload, GetSingleCatalogProductPayload } from '../../../../modules/catalog/types';
3
3
  import { BaseActionEvent } from '../../../../types/event/action/actionEvent.types';
4
4
  export type GetCatalogProductsAction = BaseActionEvent<typeof EVENTS_ACTION.GET_CATALOG_PRODUCTS, GetCatalogProductsPayload>;
5
+ export type GetCatalogProductsByIdsAction = BaseActionEvent<typeof EVENTS_ACTION.GET_CATALOG_PRODUCTS_BY_IDS, GetCatalogProductsByIdsPayload>;
5
6
  export type GetSingleCatalogProductAction = BaseActionEvent<typeof EVENTS_ACTION.GET_SINGLE_CATALOG_PRODUCT, GetSingleCatalogProductPayload>;
6
7
  export type GetCatalogCategoriesAction = BaseActionEvent<typeof EVENTS_ACTION.GET_CATALOG_CATEGORIES, GetCatalogCategoriesPayload>;
7
- export type ActionEvent = GetCatalogCategoriesAction | GetCatalogProductsAction | GetSingleCatalogProductAction;
8
+ export type ActionEvent = GetCatalogCategoriesAction | GetCatalogProductsByIdsAction | GetCatalogProductsAction | GetSingleCatalogProductAction;
@@ -1,6 +1,10 @@
1
1
  export interface GetCatalogProductsPayload {
2
2
  categoryId: number;
3
- page: number;
3
+ page?: number;
4
+ }
5
+ export interface GetCatalogProductsByIdsPayload {
6
+ productIds: number[];
7
+ page?: number;
4
8
  }
5
9
  export interface GetSingleCatalogProductPayload {
6
10
  productId: number;
@@ -8,4 +12,4 @@ export interface GetSingleCatalogProductPayload {
8
12
  export interface GetCatalogCategoriesPayload {
9
13
  level: number;
10
14
  }
11
- export type ActionEventPayload = GetCatalogCategoriesPayload | GetCatalogProductsPayload | GetSingleCatalogProductPayload;
15
+ export type ActionEventPayload = GetCatalogProductsByIdsPayload | GetCatalogCategoriesPayload | GetCatalogProductsPayload | GetSingleCatalogProductPayload;
@@ -4,6 +4,6 @@ export declare const EVENT_TYPES: {
4
4
  readonly NOTIFICATION: "notification";
5
5
  readonly RESULT: "result";
6
6
  };
7
- export declare function isAction(event: AnyEvent): event is import("./sdk/types").InitializeSdkAction | import("./sdk/types").LoadModuleAction | import("./mockup-generation/types").GetMockupsAction | import("./product-publish/types").GetProductPublishAction | import("./catalog/types").GetCatalogCategoriesAction | import("./catalog/types").GetCatalogProductsAction | import("./catalog/types").GetSingleCatalogProductAction;
7
+ export declare function isAction(event: AnyEvent): event is import("./sdk/types").InitializeSdkAction | import("./sdk/types").LoadModuleAction | import("./mockup-generation/types").GetMockupsAction | import("./product-publish/types").GetProductPublishAction | import("./catalog/types").GetCatalogCategoriesAction | import("./catalog/types").GetCatalogProductsByIdsAction | import("./catalog/types").GetCatalogProductsAction | import("./catalog/types").GetSingleCatalogProductAction;
8
8
  export declare function isNotification(event: AnyEvent): event is import("..").NotificationEvent;
9
9
  export declare function isResult(event: AnyEvent): event is import("./catalog/types").GetCatalogProductsResult | import("./catalog/types").GetSingleCatalogProductResult | import("./catalog/types").GetCatalogCategoriesResult | import("./product-publish/types").GetProductPublishResult | import("./mockup-generation/types").GetMockupsResultEvent;
@@ -2,6 +2,7 @@ export declare const ALL_ACTION_EVENTS: {
2
2
  readonly PRODUCT_PUBLISH: "actionProductPublish";
3
3
  readonly GET_MOCKUPS: "actionGetMockups";
4
4
  readonly GET_CATALOG_PRODUCTS: "actionGetCatalogProducts";
5
+ readonly GET_CATALOG_PRODUCTS_BY_IDS: "actionGetCatalogProductsByIds";
5
6
  readonly GET_SINGLE_CATALOG_PRODUCT: "actionGetSingleCatalogProduct";
6
7
  readonly GET_CATALOG_CATEGORIES: "actionGetCatalogCategories";
7
8
  readonly INITIALIZE_SDK: "actionInitializeSdk";
@@ -37,6 +38,7 @@ export declare const ALL_EVENTS: {
37
38
  readonly PRODUCT_PUBLISH: "actionProductPublish";
38
39
  readonly GET_MOCKUPS: "actionGetMockups";
39
40
  readonly GET_CATALOG_PRODUCTS: "actionGetCatalogProducts";
41
+ readonly GET_CATALOG_PRODUCTS_BY_IDS: "actionGetCatalogProductsByIds";
40
42
  readonly GET_SINGLE_CATALOG_PRODUCT: "actionGetSingleCatalogProduct";
41
43
  readonly GET_CATALOG_CATEGORIES: "actionGetCatalogCategories";
42
44
  readonly INITIALIZE_SDK: "actionInitializeSdk";
@@ -1,29 +1,8 @@
1
- export interface ProductMockupEntry {
2
- productId: number;
3
- isSizeBased: boolean;
4
- productMockups: unknown[];
5
- mockupPlacements: unknown[];
6
- placementTemplates: unknown[];
7
- }
8
1
  export interface MockupGenerationData {
9
- imgUrl: string | null;
10
- id: number;
11
- styleName: string;
12
- styleNameTranslation: string;
13
2
  color: string | null | undefined;
14
3
  size: string | null;
15
- placement: string;
16
- mockupVariantId: number;
17
- isBlankMockup: boolean;
18
4
  baseImageUrl: string | null;
19
5
  bgColor: string;
20
- isTransparent: boolean;
21
- canMockupHaveDynamicBackground: boolean;
22
- isLoading: boolean;
23
- failed: boolean;
24
- error: string | Error | null;
25
- isCleared: boolean;
26
- processId: string;
27
6
  blob: Blob | null;
28
7
  }
29
8
  export interface MockupDataWithProductData extends MockupGenerationData {
@@ -1,11 +1,16 @@
1
- export interface InitializeMockupDataPayload {
2
- productIds: number[];
3
- }
4
1
  export interface GetMockupsPayload {
5
- file: Blob | null;
6
- mockupData: {
2
+ /** File from which to generate mockups */
3
+ file: Blob;
4
+ /** List of all products and their variants to fetch mockups for */
5
+ products: {
7
6
  productId: number;
8
- variantIds: number[];
7
+ variantIds?: number[];
9
8
  }[];
9
+ /** Optional mapping of productId โ†’ selected variantId.
10
+ * If not provided, the first variant from each product will be used. */
11
+ selectedVariants?: Record<string, number>;
12
+ /** If set to true, request will finish faster, and allow you
13
+ * to show preview image on which mockup will be generated on */
14
+ shouldReturnBlankMockups?: true;
10
15
  }
11
- export type ActionEventPayload = GetMockupsPayload | InitializeMockupDataPayload;
16
+ export type ActionEventPayload = GetMockupsPayload;
@@ -1,7 +1,9 @@
1
1
  export interface GetProductPublishPayload {
2
- blob: Blob | null;
3
- publishData: {
2
+ file: Blob;
3
+ /** List of all products and their variants to generate templates for */
4
+ products: {
4
5
  productId: number;
6
+ /** Should not be empty, otherwise will fail to publish */
5
7
  variantIds: number[];
6
8
  }[];
7
9
  }
@@ -1,4 +1,4 @@
1
- import { ActionEvent as SdkActionEvent, LoadModuleAction } from '../../../modules/sdk/types/event/actionEvent.types';
1
+ import { ActionEvent as SdkActionEvent } from '../../../modules/sdk/types/event/actionEvent.types';
2
2
  import { ActionEvent as CatalogActionEvent } from '../../../modules/catalog/types/event/actionEvent.types';
3
3
  import { ActionEvent as MockupGenerationActionEvent } from '../../../modules/mockup-generation/types/event/actionEvent.types';
4
4
  import { ActionEvent as ProductPublishActionEvent } from '../../../modules/product-publish/types/event/actionEvent.types';
@@ -8,4 +8,4 @@ import { EVENT_TYPES } from '../../../modules/eventTypes';
8
8
  import { ActionEventPayload } from './actionEventPayload.types';
9
9
  export type ActionEventName = (typeof ALL_ACTION_EVENTS)[keyof typeof ALL_ACTION_EVENTS];
10
10
  export type BaseActionEvent<TName extends ActionEventName, TPayload extends ActionEventPayload> = Event<TName, typeof EVENT_TYPES.ACTION, TPayload>;
11
- export type ActionEvent = LoadModuleAction | MockupGenerationActionEvent | CatalogActionEvent | ProductPublishActionEvent | SdkActionEvent;
11
+ export type ActionEvent = MockupGenerationActionEvent | CatalogActionEvent | ProductPublishActionEvent | SdkActionEvent;
@@ -1,7 +1,7 @@
1
1
  import type { MODULE_NAMES } from '../../modules/modules';
2
2
  import { GetMockupsPayload, GetMockupsResultPayload } from '../../modules/mockup-generation/types';
3
3
  import { SdkModuleConfigData } from '../../modules/sdk/types';
4
- import { GetCatalogCategoriesResultPayload, GetCatalogProductsResultPayload, GetSingleCatalogProductResultPayload } from '../../modules/catalog/types';
4
+ import { GetCatalogCategoriesResultPayload, GetCatalogProductsByIdsPayload, GetCatalogProductsPayload, GetCatalogProductsResultPayload, GetSingleCatalogProductPayload, GetSingleCatalogProductResultPayload } from '../../modules/catalog/types';
5
5
  import { NotificationEventPayload } from '../../types/event/notification/notificationEventPayload.types';
6
6
  import { GetProductPublishPayload, ProductPublishData } from '../../modules/product-publish/types';
7
7
  /** This file ensures that Iframe and SDK has the same source of truth for return values */
@@ -10,8 +10,9 @@ export interface ISdkModule {
10
10
  setup(config?: SdkModuleConfigData): Promise<NotificationEventPayload> | Promise<void>;
11
11
  }
12
12
  export interface ICatalogModule {
13
- getProducts(categoryId: number): GetCatalogProductsResultPayload;
14
- getProduct(productId: number): GetSingleCatalogProductResultPayload;
13
+ getProducts(data: GetCatalogProductsPayload): GetCatalogProductsResultPayload;
14
+ getProductsByIds(data: GetCatalogProductsByIdsPayload): GetCatalogProductsResultPayload;
15
+ getProduct(data: GetSingleCatalogProductPayload): GetSingleCatalogProductResultPayload;
15
16
  getCategories(): GetCatalogCategoriesResultPayload;
16
17
  }
17
18
  export interface IMockupGenerationModule {
@@ -1 +1 @@
1
- export declare const VERSION: "1.2.2";
1
+ export declare const VERSION: "2.0.1";
@@ -1,2 +1,2 @@
1
1
  // AUTO-GENERATED
2
- export const VERSION = '1.2.2';
2
+ export const VERSION = '2.0.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fyul/embed-sdk",
3
- "version": "1.2.2",
3
+ "version": "2.0.1",
4
4
  "description": "",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",