@cobrastyle/adapter-magento2 1.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.
package/dist/logger.js ADDED
@@ -0,0 +1,258 @@
1
+ /**
2
+ * Magento2 Adapter Logger
3
+ *
4
+ * A clear, colorful logger for tracking GraphQL requests and responses.
5
+ * Enable/disable via MAGENTO_DEBUG environment variable.
6
+ */
7
+ // ANSI color codes for terminal output
8
+ const colors = {
9
+ reset: '\x1b[0m',
10
+ bright: '\x1b[1m',
11
+ dim: '\x1b[2m',
12
+ // Foreground
13
+ cyan: '\x1b[36m',
14
+ green: '\x1b[32m',
15
+ yellow: '\x1b[33m',
16
+ red: '\x1b[31m',
17
+ magenta: '\x1b[35m',
18
+ blue: '\x1b[34m',
19
+ gray: '\x1b[90m',
20
+ white: '\x1b[37m',
21
+ // Background
22
+ bgBlue: '\x1b[44m',
23
+ bgGreen: '\x1b[42m',
24
+ bgYellow: '\x1b[43m',
25
+ bgRed: '\x1b[41m',
26
+ bgMagenta: '\x1b[45m',
27
+ };
28
+ const defaultOptions = {
29
+ showVariables: true,
30
+ showFullQuery: false,
31
+ showResponseData: true,
32
+ showFullResponse: true,
33
+ maxDataLength: 500,
34
+ };
35
+ // Check if logging is enabled
36
+ const isEnabled = () => {
37
+ return process.env.MAGENTO_DEBUG === 'true' || process.env.MAGENTO_DEBUG === '1';
38
+ };
39
+ // Extract operation name from GraphQL query
40
+ const extractOperationName = (query) => {
41
+ const match = query.match(/(?:query|mutation)\s+(\w+)/);
42
+ return match?.[1] ?? 'Anonymous';
43
+ };
44
+ // Format timestamp
45
+ const timestamp = () => {
46
+ const now = new Date();
47
+ return `${colors.gray}${now.toLocaleTimeString('en-US', {
48
+ hour12: false,
49
+ hour: '2-digit',
50
+ minute: '2-digit',
51
+ second: '2-digit',
52
+ fractionalSecondDigits: 3
53
+ })}${colors.reset}`;
54
+ };
55
+ // Truncate long strings
56
+ const truncate = (str, maxLength) => {
57
+ if (str.length <= maxLength)
58
+ return str;
59
+ return str.substring(0, maxLength) + '...';
60
+ };
61
+ // Format JSON with indentation
62
+ const formatJson = (obj, maxLength) => {
63
+ const json = JSON.stringify(obj, null, 2);
64
+ return maxLength ? truncate(json, maxLength) : json;
65
+ };
66
+ // Box drawing characters for pretty output
67
+ const box = {
68
+ topLeft: '┌',
69
+ topRight: '┐',
70
+ bottomLeft: '└',
71
+ bottomRight: '┘',
72
+ horizontal: '─',
73
+ vertical: '│',
74
+ teeRight: '├',
75
+ teeLeft: '┤',
76
+ };
77
+ // Draw a horizontal line
78
+ const line = (width = 60) => {
79
+ return box.horizontal.repeat(width);
80
+ };
81
+ // Main logger class
82
+ class MagentoLogger {
83
+ requestCount = 0;
84
+ options;
85
+ constructor(options = {}) {
86
+ this.options = { ...defaultOptions, ...options };
87
+ }
88
+ log(level, ...args) {
89
+ if (!isEnabled())
90
+ return;
91
+ const prefix = this.getPrefix(level);
92
+ console.log(prefix, ...args);
93
+ }
94
+ getPrefix(level) {
95
+ const ts = timestamp();
96
+ switch (level) {
97
+ case 'request':
98
+ return `${ts} ${colors.bgBlue}${colors.white} REQ ${colors.reset}`;
99
+ case 'response':
100
+ return `${ts} ${colors.bgGreen}${colors.white} RES ${colors.reset}`;
101
+ case 'error':
102
+ return `${ts} ${colors.bgRed}${colors.white} ERR ${colors.reset}`;
103
+ case 'warn':
104
+ return `${ts} ${colors.bgYellow}${colors.white} WRN ${colors.reset}`;
105
+ case 'info':
106
+ return `${ts} ${colors.bgMagenta}${colors.white} INF ${colors.reset}`;
107
+ }
108
+ }
109
+ /**
110
+ * Log an outgoing GraphQL request
111
+ */
112
+ request(query, variables, meta) {
113
+ if (!isEnabled())
114
+ return;
115
+ this.requestCount++;
116
+ const operationName = extractOperationName(query);
117
+ console.log('');
118
+ console.log(`${colors.cyan}${box.topLeft}${line(58)}${box.topRight}${colors.reset}`);
119
+ this.log('request', `${colors.bright}${colors.cyan}#${this.requestCount} ${operationName}${colors.reset}`);
120
+ if (meta?.storeCode) {
121
+ console.log(`${colors.cyan}${box.vertical}${colors.reset} ${colors.gray}Store:${colors.reset} ${meta.storeCode}`);
122
+ }
123
+ if (meta?.hasAuth) {
124
+ console.log(`${colors.cyan}${box.vertical}${colors.reset} ${colors.gray}Auth:${colors.reset} ${colors.green}✓ Authenticated${colors.reset}`);
125
+ }
126
+ if (this.options.showVariables && variables && Object.keys(variables).length > 0) {
127
+ console.log(`${colors.cyan}${box.vertical}${colors.reset} ${colors.gray}Variables:${colors.reset}`);
128
+ const varLines = formatJson(variables, 300).split('\n');
129
+ varLines.forEach(line => {
130
+ console.log(`${colors.cyan}${box.vertical}${colors.reset} ${colors.yellow}${line}${colors.reset}`);
131
+ });
132
+ }
133
+ if (this.options.showFullQuery) {
134
+ console.log(`${colors.cyan}${box.vertical}${colors.reset} ${colors.gray}Query:${colors.reset}`);
135
+ const queryLines = query.trim().split('\n').slice(0, 10);
136
+ queryLines.forEach(line => {
137
+ console.log(`${colors.cyan}${box.vertical}${colors.reset} ${colors.dim}${line}${colors.reset}`);
138
+ });
139
+ if (query.trim().split('\n').length > 10) {
140
+ console.log(`${colors.cyan}${box.vertical}${colors.reset} ${colors.dim}... (${query.trim().split('\n').length - 10} more lines)${colors.reset}`);
141
+ }
142
+ }
143
+ }
144
+ /**
145
+ * Log a successful response
146
+ */
147
+ response(operationName, data, duration) {
148
+ if (!isEnabled())
149
+ return;
150
+ this.log('response', `${colors.bright}${colors.green}${operationName}${colors.reset} ${colors.gray}(${duration}ms)${colors.reset}`);
151
+ if (this.options.showResponseData && data) {
152
+ const preview = this.getDataPreview(data);
153
+ if (preview) {
154
+ console.log(`${colors.cyan}${box.vertical}${colors.reset} ${colors.gray}Summary:${colors.reset} ${preview}`);
155
+ }
156
+ // Show full response data for inspection
157
+ if (this.options.showFullResponse) {
158
+ console.log(`${colors.cyan}${box.vertical}${colors.reset} ${colors.gray}Response Data:${colors.reset}`);
159
+ console.log(`${colors.cyan}${box.vertical}${colors.reset}`);
160
+ // Use console.dir for deep inspection with colors
161
+ console.dir(data, { depth: null, colors: true });
162
+ console.log(`${colors.cyan}${box.vertical}${colors.reset}`);
163
+ }
164
+ }
165
+ console.log(`${colors.cyan}${box.bottomLeft}${line(58)}${box.bottomRight}${colors.reset}`);
166
+ console.log('');
167
+ }
168
+ /**
169
+ * Log an error response
170
+ */
171
+ error(operationName, error, duration) {
172
+ if (!isEnabled())
173
+ return;
174
+ const durationStr = duration ? ` ${colors.gray}(${duration}ms)${colors.reset}` : '';
175
+ this.log('error', `${colors.bright}${colors.red}${operationName}${colors.reset}${durationStr}`);
176
+ if (error instanceof Error) {
177
+ console.log(`${colors.cyan}${box.vertical}${colors.reset} ${colors.red}${error.message}${colors.reset}`);
178
+ }
179
+ else {
180
+ console.log(`${colors.cyan}${box.vertical}${colors.reset} ${colors.red}${String(error)}${colors.reset}`);
181
+ }
182
+ console.log(`${colors.red}${box.bottomLeft}${line(58)}${box.bottomRight}${colors.reset}`);
183
+ console.log('');
184
+ }
185
+ /**
186
+ * Generate a preview of response data
187
+ */
188
+ getDataPreview(data) {
189
+ if (!data || typeof data !== 'object')
190
+ return '';
191
+ const obj = data;
192
+ const keys = Object.keys(obj);
193
+ const previews = [];
194
+ for (const key of keys) {
195
+ const value = obj[key];
196
+ if (Array.isArray(value)) {
197
+ previews.push(`${colors.blue}${key}${colors.reset}: ${colors.magenta}[${value.length} items]${colors.reset}`);
198
+ }
199
+ else if (value && typeof value === 'object') {
200
+ const subKeys = Object.keys(value);
201
+ if ('items' in value) {
202
+ const items = value.items;
203
+ if (Array.isArray(items)) {
204
+ previews.push(`${colors.blue}${key}.items${colors.reset}: ${colors.magenta}[${items.length} items]${colors.reset}`);
205
+ }
206
+ }
207
+ else {
208
+ previews.push(`${colors.blue}${key}${colors.reset}: ${colors.dim}{${subKeys.slice(0, 3).join(', ')}${subKeys.length > 3 ? '...' : ''}}${colors.reset}`);
209
+ }
210
+ }
211
+ else if (value !== null && value !== undefined) {
212
+ const strVal = String(value);
213
+ previews.push(`${colors.blue}${key}${colors.reset}: ${colors.green}${truncate(strVal, 30)}${colors.reset}`);
214
+ }
215
+ }
216
+ return previews.join(', ');
217
+ }
218
+ /**
219
+ * Log general info
220
+ */
221
+ info(message, data) {
222
+ if (!isEnabled())
223
+ return;
224
+ this.log('info', message);
225
+ if (data) {
226
+ console.log(` ${colors.dim}${formatJson(data, 200)}${colors.reset}`);
227
+ }
228
+ }
229
+ /**
230
+ * Log a warning
231
+ */
232
+ warn(message, data) {
233
+ if (!isEnabled())
234
+ return;
235
+ this.log('warn', `${colors.yellow}${message}${colors.reset}`);
236
+ if (data) {
237
+ console.log(` ${colors.dim}${formatJson(data, 200)}${colors.reset}`);
238
+ }
239
+ }
240
+ /**
241
+ * Get request statistics
242
+ */
243
+ getStats() {
244
+ return {
245
+ totalRequests: this.requestCount,
246
+ };
247
+ }
248
+ /**
249
+ * Reset statistics
250
+ */
251
+ resetStats() {
252
+ this.requestCount = 0;
253
+ }
254
+ }
255
+ // Export singleton instance
256
+ export const logger = new MagentoLogger();
257
+ // Export class for custom instances
258
+ export { MagentoLogger };
@@ -0,0 +1,357 @@
1
+ /**
2
+ * Raw Magento GraphQL response shapes (the fields our queries request and our
3
+ * mappers read). These are intentionally partial — only what we consume — so a
4
+ * backend schema change to a field we use surfaces as a build error instead of
5
+ * a silent `undefined` at runtime.
6
+ *
7
+ * Note: Magento exposes numeric ids as `Int` (e.g. product/category `id`, order
8
+ * `id`), so id-ish fields are typed `string | number`; mappers coerce to string
9
+ * where the shared types require it.
10
+ */
11
+ export interface MagentoMoney {
12
+ value: number;
13
+ currency: string;
14
+ }
15
+ /** A `user_errors` entry returned by Magento cart/wishlist mutations. */
16
+ export interface MagentoUserError {
17
+ code?: string;
18
+ message: string;
19
+ }
20
+ export type MagentoPrice = MagentoMoney;
21
+ export interface MagentoProductPrice {
22
+ regular_price: MagentoPrice;
23
+ final_price: MagentoPrice;
24
+ discount?: {
25
+ amount_off: number;
26
+ percent_off: number;
27
+ };
28
+ }
29
+ export interface MagentoTierPrice {
30
+ quantity: number;
31
+ final_price: MagentoPrice;
32
+ discount?: {
33
+ amount_off: number;
34
+ percent_off: number;
35
+ };
36
+ }
37
+ export interface MagentoAttributeItemV2 {
38
+ code: string;
39
+ __typename?: string;
40
+ value?: string | null;
41
+ selected_options?: Array<{
42
+ label: string;
43
+ value: string;
44
+ }> | null;
45
+ }
46
+ export interface MagentoCustomAttributesV2 {
47
+ items?: MagentoAttributeItemV2[] | null;
48
+ errors?: Array<{
49
+ message: string;
50
+ }> | null;
51
+ }
52
+ export interface MagentoProduct {
53
+ __typename?: string;
54
+ id?: string;
55
+ uid?: string;
56
+ sku: string;
57
+ name: string;
58
+ url_key: string;
59
+ description?: {
60
+ html: string;
61
+ };
62
+ short_description?: {
63
+ html: string;
64
+ };
65
+ meta_title?: string;
66
+ meta_description?: string;
67
+ stock_status: string;
68
+ price_range: {
69
+ minimum_price: MagentoProductPrice;
70
+ };
71
+ price_tiers?: MagentoTierPrice[] | null;
72
+ media_gallery?: Array<{
73
+ url: string;
74
+ label?: string;
75
+ position?: number;
76
+ }>;
77
+ thumbnail?: {
78
+ url: string;
79
+ label?: string;
80
+ };
81
+ categories?: Array<{
82
+ id: string;
83
+ name: string;
84
+ url_key: string;
85
+ }>;
86
+ custom_attributesV2?: MagentoCustomAttributesV2;
87
+ configurable_options?: Array<{
88
+ id: string;
89
+ attribute_code: string;
90
+ label: string;
91
+ values: Array<{
92
+ uid: string;
93
+ label: string;
94
+ swatch_data?: {
95
+ __typename?: string;
96
+ value: string;
97
+ };
98
+ }>;
99
+ }>;
100
+ variants?: Array<{
101
+ product: {
102
+ id: string;
103
+ sku: string;
104
+ name: string;
105
+ stock_status: string;
106
+ price_range: {
107
+ minimum_price: MagentoProductPrice;
108
+ };
109
+ };
110
+ attributes: Array<{
111
+ code: string;
112
+ label: string;
113
+ value_index: number;
114
+ }>;
115
+ }>;
116
+ items?: Array<{
117
+ qty: number;
118
+ position: number;
119
+ product: MagentoProduct | null;
120
+ }>;
121
+ }
122
+ export interface MagentoPageInfo {
123
+ current_page: number;
124
+ page_size: number;
125
+ total_pages: number;
126
+ }
127
+ export interface MagentoAggregation {
128
+ attribute_code: string;
129
+ label: string;
130
+ options?: Array<{
131
+ value: string;
132
+ label: string;
133
+ count: number;
134
+ }> | null;
135
+ }
136
+ export interface MagentoSortFields {
137
+ options?: Array<{
138
+ value: string;
139
+ label: string;
140
+ }> | null;
141
+ }
142
+ export interface MagentoCartItem {
143
+ uid: string;
144
+ quantity: number;
145
+ product: {
146
+ id: string;
147
+ sku: string;
148
+ name: string;
149
+ url_key?: string;
150
+ thumbnail?: {
151
+ url: string;
152
+ label?: string;
153
+ } | null;
154
+ };
155
+ prices: {
156
+ price: MagentoMoney;
157
+ row_total: {
158
+ value: number;
159
+ };
160
+ row_total_including_tax?: {
161
+ value: number;
162
+ } | null;
163
+ };
164
+ configurable_options?: Array<{
165
+ option_label: string;
166
+ value_label: string;
167
+ }> | null;
168
+ }
169
+ export interface MagentoCartPrices {
170
+ subtotal_excluding_tax?: MagentoMoney | null;
171
+ subtotal_including_tax?: MagentoMoney | null;
172
+ grand_total?: MagentoMoney | null;
173
+ discounts?: Array<{
174
+ amount: MagentoMoney;
175
+ label: string;
176
+ }> | null;
177
+ applied_taxes?: Array<{
178
+ amount: MagentoMoney;
179
+ label: string;
180
+ }> | null;
181
+ }
182
+ export interface MagentoShippingMethod {
183
+ carrier_code: string;
184
+ carrier_title: string;
185
+ method_code: string;
186
+ method_title: string;
187
+ amount?: MagentoMoney | null;
188
+ }
189
+ export interface MagentoPaymentMethod {
190
+ code: string;
191
+ title: string;
192
+ }
193
+ export interface MagentoShippingAddress {
194
+ firstname: string;
195
+ lastname: string;
196
+ street: string[];
197
+ city: string;
198
+ region?: {
199
+ label?: string;
200
+ code?: string;
201
+ } | null;
202
+ postcode: string;
203
+ country?: {
204
+ label?: string;
205
+ code?: string;
206
+ } | null;
207
+ country_code?: string;
208
+ telephone?: string;
209
+ company?: string;
210
+ selected_shipping_method?: MagentoShippingMethod | null;
211
+ available_shipping_methods?: MagentoShippingMethod[] | null;
212
+ }
213
+ export interface MagentoCart {
214
+ id: string;
215
+ email?: string | null;
216
+ items?: Array<MagentoCartItem | null> | null;
217
+ prices?: MagentoCartPrices | null;
218
+ applied_coupons?: Array<{
219
+ code: string;
220
+ }> | null;
221
+ shipping_addresses?: MagentoShippingAddress[] | null;
222
+ billing_address?: MagentoShippingAddress | null;
223
+ selected_payment_method?: {
224
+ code: string;
225
+ title: string;
226
+ } | null;
227
+ available_payment_methods?: MagentoPaymentMethod[] | null;
228
+ }
229
+ export interface MagentoCountry {
230
+ two_letter_abbreviation?: string | null;
231
+ full_name_locale?: string | null;
232
+ available_regions?: Array<{
233
+ id: number;
234
+ code: string;
235
+ name: string;
236
+ }> | null;
237
+ }
238
+ export interface MagentoCategoryBreadcrumb {
239
+ category_level?: number;
240
+ category_url_key?: string;
241
+ category_uid?: string;
242
+ category_id?: string | number;
243
+ category_name?: string;
244
+ }
245
+ export interface MagentoCategory {
246
+ id?: string | number;
247
+ uid?: string;
248
+ name: string;
249
+ url_key: string;
250
+ url_path?: string;
251
+ description?: string;
252
+ image?: string;
253
+ product_count?: number;
254
+ include_in_menu?: boolean | number;
255
+ position?: number;
256
+ children?: MagentoCategory[] | null;
257
+ breadcrumbs?: MagentoCategoryBreadcrumb[] | null;
258
+ meta_title?: string;
259
+ meta_description?: string;
260
+ }
261
+ export interface MagentoCmsPage {
262
+ identifier: string;
263
+ title: string;
264
+ content: string;
265
+ content_heading?: string;
266
+ url_key?: string;
267
+ meta_title?: string;
268
+ meta_description?: string;
269
+ }
270
+ export interface MagentoCmsBlock {
271
+ identifier: string;
272
+ title?: string;
273
+ content?: string;
274
+ }
275
+ export interface MagentoRoute {
276
+ __typename?: string;
277
+ type?: string;
278
+ id?: string | number;
279
+ identifier?: string;
280
+ uid?: string;
281
+ sku?: string;
282
+ url_key?: string;
283
+ }
284
+ export interface MagentoCustomerAddress {
285
+ id?: string | number;
286
+ firstname: string;
287
+ lastname: string;
288
+ street: string[];
289
+ city: string;
290
+ region?: {
291
+ region?: string;
292
+ region_code?: string;
293
+ region_id?: number;
294
+ } | null;
295
+ postcode: string;
296
+ country_code?: string;
297
+ telephone?: string;
298
+ company?: string;
299
+ default_shipping?: boolean;
300
+ default_billing?: boolean;
301
+ }
302
+ export interface MagentoCustomer {
303
+ id?: string | number;
304
+ email: string;
305
+ firstname: string;
306
+ lastname: string;
307
+ date_of_birth?: string;
308
+ gender?: number;
309
+ created_at?: string;
310
+ addresses?: MagentoCustomerAddress[] | null;
311
+ }
312
+ export interface MagentoCustomerOrderItem {
313
+ id?: string | number;
314
+ product_name: string;
315
+ product_sku: string;
316
+ quantity_ordered: number;
317
+ product_sale_price?: MagentoMoney | null;
318
+ }
319
+ export interface MagentoCustomerOrder {
320
+ id?: string | number;
321
+ number: string;
322
+ order_date: string;
323
+ status: string;
324
+ total?: {
325
+ grand_total?: MagentoMoney | null;
326
+ subtotal_excl_tax?: MagentoMoney | null;
327
+ total_shipping?: MagentoMoney | null;
328
+ total_tax?: MagentoMoney | null;
329
+ discounts?: Array<{
330
+ amount?: MagentoMoney | null;
331
+ label?: string;
332
+ } | null> | null;
333
+ } | null;
334
+ items?: Array<MagentoCustomerOrderItem | null> | null;
335
+ shipping_address?: {
336
+ firstname?: string;
337
+ lastname?: string;
338
+ street?: string[];
339
+ city?: string;
340
+ region?: string;
341
+ postcode?: string;
342
+ country_code?: string;
343
+ telephone?: string;
344
+ } | null;
345
+ }
346
+ export interface MagentoWishlistItem {
347
+ id: string | number;
348
+ added_at?: string;
349
+ product: MagentoProduct;
350
+ }
351
+ export interface MagentoWishlist {
352
+ id: string | number;
353
+ items_v2?: {
354
+ items?: Array<MagentoWishlistItem | null> | null;
355
+ } | null;
356
+ items_count?: number;
357
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Raw Magento GraphQL response shapes (the fields our queries request and our
3
+ * mappers read). These are intentionally partial — only what we consume — so a
4
+ * backend schema change to a field we use surfaces as a build error instead of
5
+ * a silent `undefined` at runtime.
6
+ *
7
+ * Note: Magento exposes numeric ids as `Int` (e.g. product/category `id`, order
8
+ * `id`), so id-ish fields are typed `string | number`; mappers coerce to string
9
+ * where the shared types require it.
10
+ */
11
+ export {};
@@ -0,0 +1,50 @@
1
+ import type { AnyProduct, GroupedProductItem, ProductListItem, Price, ProductImage, StockStatus, ConfigurableOption, ProductVariant, CategoryReference, Cart, CartItem, CartTotals, ShippingAddress, ShippingMethod, PaymentMethod, Category, Country, NavigationItem, UrlResolverResult, CmsPage, CmsBlock, Customer, CustomerAddress } from '@cobrastyle/shared-types';
2
+ import type { MagentoProductPrice, MagentoTierPrice, MagentoCustomAttributesV2, MagentoProduct, MagentoCart, MagentoCartItem, MagentoCartPrices, MagentoShippingAddress, MagentoShippingMethod, MagentoPaymentMethod, MagentoCountry, MagentoCategory, MagentoCmsPage, MagentoCmsBlock, MagentoRoute, MagentoCustomer, MagentoCustomerAddress, MagentoCustomerOrder, MagentoCustomerOrderItem, MagentoWishlist, MagentoWishlistItem } from './magento-types';
3
+ export declare const mapPrice: (priceData: MagentoProductPrice, tiers?: MagentoTierPrice[] | null) => Price;
4
+ export declare const mapImages: (mediaGallery: Array<{
5
+ url: string;
6
+ label?: string;
7
+ position?: number;
8
+ }> | undefined) => ProductImage[];
9
+ export declare const mapStock: (stockStatus: string) => StockStatus;
10
+ export declare const mapCategories: (categories: Array<{
11
+ id: string;
12
+ name: string;
13
+ url_key: string;
14
+ breadcrumbs?: Array<{
15
+ category_url_key: string;
16
+ category_level?: number;
17
+ }> | null;
18
+ }> | undefined, categorySuffix?: string) => CategoryReference[];
19
+ export declare const mapConfigurableOptions: (options: MagentoProduct["configurable_options"]) => ConfigurableOption[];
20
+ export declare const mapVariants: (variants: MagentoProduct["variants"]) => ProductVariant[];
21
+ export declare const mapCustomAttributes: (custom: MagentoCustomAttributesV2 | undefined, labelMap?: ReadonlyMap<string, string>) => Array<{
22
+ code: string;
23
+ label: string;
24
+ value: string;
25
+ }>;
26
+ export declare const mapGroupedItems: (items: NonNullable<MagentoProduct["items"]>, productSuffix?: string) => GroupedProductItem[];
27
+ export declare const mapProduct: (product: MagentoProduct, productSuffix?: string, categorySuffix?: string, attributeLabels?: ReadonlyMap<string, string>) => AnyProduct;
28
+ export declare const mapProductListItem: (product: MagentoProduct, productSuffix?: string) => ProductListItem;
29
+ export declare const mapCart: (magentoCart: MagentoCart, productSuffix?: string) => Cart;
30
+ export declare const mapCartItems: (items: Array<MagentoCartItem | null>, productSuffix?: string) => CartItem[];
31
+ export declare const mapCartTotals: (prices: MagentoCartPrices) => CartTotals;
32
+ export declare const mapShippingAddress: (addr: MagentoShippingAddress) => ShippingAddress;
33
+ export declare const mapShippingMethod: (method: MagentoShippingMethod) => ShippingMethod;
34
+ export declare const mapPaymentMethod: (method: MagentoPaymentMethod) => PaymentMethod;
35
+ export declare const mapCountry: (country: MagentoCountry) => Country;
36
+ export declare const mapCountries: (countries: MagentoCountry[]) => Country[];
37
+ export declare const mapCategory: (cat: MagentoCategory, suffix?: string, ancestorSegments?: string[]) => Category;
38
+ export declare const isIncludedInMenu: (cat: {
39
+ include_in_menu?: boolean | number;
40
+ }) => boolean;
41
+ export declare const mapNavigationItem: (cat: MagentoCategory, level?: number, parentSegments?: string[], suffix?: string) => NavigationItem;
42
+ export declare const mapCmsPage: (page: MagentoCmsPage) => CmsPage;
43
+ export declare const mapCmsBlock: (block: MagentoCmsBlock) => CmsBlock;
44
+ export declare const mapUrlResolver: (route: MagentoRoute | null | undefined) => UrlResolverResult;
45
+ export declare const mapCustomer: (customer: MagentoCustomer) => Customer;
46
+ export declare const mapCustomerAddress: (addr: MagentoCustomerAddress) => CustomerAddress;
47
+ export declare const mapCustomerOrder: (order: MagentoCustomerOrder) => import("@cobrastyle/shared-types").CustomerOrder;
48
+ export declare const mapCustomerOrderItem: (item: MagentoCustomerOrderItem) => import("@cobrastyle/shared-types").CustomerOrderItem;
49
+ export declare const mapWishlistItem: (item: MagentoWishlistItem) => import("@cobrastyle/shared-types").WishlistItem;
50
+ export declare const mapWishlist: (wishlist: MagentoWishlist) => import("@cobrastyle/shared-types").Wishlist;