droplinked-editor-configs 1.8.3 → 1.8.5
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/apis/blogs/interfaces.d.ts +0 -38
- package/dist/apis/blogs/services.d.ts +1 -6
- package/dist/apis/product/interface.d.ts +12 -100
- package/dist/apis/product/services.d.ts +1 -6
- package/dist/apis/shop/interface.d.ts +0 -3
- package/dist/apis/shop/service.d.ts +1 -2
- package/dist/components/header/Header.d.ts +2 -3
- package/dist/components/header/HeaderIcons.d.ts +3 -2
- package/dist/components/header/Sidebar.d.ts +3 -3
- package/dist/droplinked-editor.es.js +8746 -8748
- package/dist/droplinked-editor.umd.js +70 -70
- package/dist/lib/models/user.d.ts +1 -1
- package/dist/lib/stores/app/appStore.d.ts +2 -2
- package/dist/lib/stores/app/interfaces.d.ts +138 -2
- package/dist/types/renderersProps.d.ts +2 -2
- package/package.json +2 -2
- package/src/PageHeader.tsx +3 -4
- package/src/apis/blogs/interfaces.ts +0 -39
- package/src/apis/blogs/services.ts +2 -5
- package/src/apis/product/interface.ts +14 -291
- package/src/apis/product/services.ts +2 -33
- package/src/apis/shop/interface.ts +0 -4
- package/src/apis/shop/service.ts +3 -7
- package/src/components/header/Header.tsx +4 -6
- package/src/components/header/HeaderIcons.tsx +13 -5
- package/src/components/header/Sidebar.tsx +20 -8
- package/src/components/productGrid/components/ProductGrid/GridViewProductCard.tsx +2 -2
- package/src/components/productGrid/components/ProductGrid/ListViewProductCard.tsx +4 -4
- package/src/components/productGrid/components/ProductGrid/ProductGrid.tsx +2 -2
- package/src/components/productGrid/components/ProductGrid/Slider/ProductImageSlider.tsx +4 -4
- package/src/configured-components/layout/headerConfig.tsx +2 -2
- package/src/lib/models/user.ts +1 -1
- package/src/lib/stores/app/appStore.ts +2 -2
- package/src/lib/stores/app/interfaces.ts +149 -2
- package/src/types/renderersProps.ts +2 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/lib/models/product.d.ts +0 -97
- package/src/lib/models/product.ts +0 -104
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { IUser } from 'lib/models/user';
|
|
2
|
-
import {
|
|
2
|
+
import { ICart, IShop } from './interfaces';
|
|
3
3
|
|
|
4
4
|
interface IupdateState {
|
|
5
5
|
state: string;
|
|
6
6
|
value: any;
|
|
7
7
|
}
|
|
8
8
|
interface Icart {
|
|
9
|
-
[propname: string]:
|
|
9
|
+
[propname: string]: ICart;
|
|
10
10
|
}
|
|
11
11
|
export interface IAppStore {
|
|
12
12
|
states: {
|
|
@@ -1,5 +1,123 @@
|
|
|
1
1
|
import { ImsTypeEnum, IPaymentMethods, IShopDesign, IShopDesignPrev, IShopMedia, ITemplateOptions } from 'lib/models/shop';
|
|
2
2
|
|
|
3
|
+
export interface ICartItem {
|
|
4
|
+
productId: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
skuId: string;
|
|
7
|
+
sku: {
|
|
8
|
+
variantKey: string;
|
|
9
|
+
attributes: {
|
|
10
|
+
key: string;
|
|
11
|
+
value: string;
|
|
12
|
+
caption: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
quantity: number;
|
|
16
|
+
thumbnail: string;
|
|
17
|
+
m2m: {
|
|
18
|
+
position: string;
|
|
19
|
+
artworkUrl: string;
|
|
20
|
+
};
|
|
21
|
+
cost: number;
|
|
22
|
+
price: number;
|
|
23
|
+
totalPriceBeforeDiscount: number;
|
|
24
|
+
totalPrice: number;
|
|
25
|
+
unitPrice: number;
|
|
26
|
+
title: string;
|
|
27
|
+
description: string;
|
|
28
|
+
productType: string;
|
|
29
|
+
ruleset: {
|
|
30
|
+
type: string;
|
|
31
|
+
discountPercentage: number;
|
|
32
|
+
};
|
|
33
|
+
collectionName: string;
|
|
34
|
+
affiliateInfo: {
|
|
35
|
+
isAffiliateProduct: boolean;
|
|
36
|
+
originalShopId: string;
|
|
37
|
+
commissionPercentage: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface IShippingRate {
|
|
41
|
+
rateId: string;
|
|
42
|
+
price: number;
|
|
43
|
+
deliveryTime: string;
|
|
44
|
+
selected: boolean;
|
|
45
|
+
name?: string;
|
|
46
|
+
carrier?: string;
|
|
47
|
+
estimatedDays?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface IAvailableShipping {
|
|
50
|
+
type: "THIRD_PARTY" | "CUSTOM" | "POD";
|
|
51
|
+
shipmentId: string;
|
|
52
|
+
rates: IShippingRate[];
|
|
53
|
+
productIds: string[];
|
|
54
|
+
}
|
|
55
|
+
export interface IGiftCard {
|
|
56
|
+
type: "PERCENTAGE" | "AMOUNT";
|
|
57
|
+
value: number;
|
|
58
|
+
code: string;
|
|
59
|
+
}
|
|
60
|
+
export interface IFinancialDetails {
|
|
61
|
+
tax: {
|
|
62
|
+
total: number;
|
|
63
|
+
droplinked: number;
|
|
64
|
+
producer: number;
|
|
65
|
+
};
|
|
66
|
+
discounts: {
|
|
67
|
+
ruleset: number;
|
|
68
|
+
giftCard: number;
|
|
69
|
+
};
|
|
70
|
+
shipping: {
|
|
71
|
+
total: number;
|
|
72
|
+
dropLinkedShare: number;
|
|
73
|
+
merchantShare: number;
|
|
74
|
+
};
|
|
75
|
+
amounts: {
|
|
76
|
+
productTotal: number;
|
|
77
|
+
discountTotal: number;
|
|
78
|
+
taxTotal: number;
|
|
79
|
+
shippingTotal: number;
|
|
80
|
+
totalBeforeDiscount: number;
|
|
81
|
+
finalTotalBeforeTax: number;
|
|
82
|
+
totalAmount: number;
|
|
83
|
+
productTotalAfterDiscount: number;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface IAddress {
|
|
87
|
+
addressLine1?: string;
|
|
88
|
+
addressLine2?: string;
|
|
89
|
+
city?: string;
|
|
90
|
+
country?: string;
|
|
91
|
+
state?: string;
|
|
92
|
+
zip?: string;
|
|
93
|
+
firstName?: string;
|
|
94
|
+
lastName?: string;
|
|
95
|
+
phone?: string;
|
|
96
|
+
}
|
|
97
|
+
export interface ICart {
|
|
98
|
+
id: string;
|
|
99
|
+
shopId: string;
|
|
100
|
+
customerId: string;
|
|
101
|
+
email: string;
|
|
102
|
+
items: ICartItem[];
|
|
103
|
+
shippingAddressId: string;
|
|
104
|
+
availableShipping: IAvailableShipping[];
|
|
105
|
+
giftcard: IGiftCard;
|
|
106
|
+
financialDetails: IFinancialDetails;
|
|
107
|
+
status: "ACTIVE" | "EXPIRED";
|
|
108
|
+
additional: {
|
|
109
|
+
note: string;
|
|
110
|
+
};
|
|
111
|
+
shippingAddress: IAddress;
|
|
112
|
+
expiredAt: string;
|
|
113
|
+
createdAt: string;
|
|
114
|
+
updatedAt: string;
|
|
115
|
+
_id: string;
|
|
116
|
+
}
|
|
117
|
+
export interface ISelectedShipping {
|
|
118
|
+
shipmentId: string;
|
|
119
|
+
rateId: string;
|
|
120
|
+
}
|
|
3
121
|
export interface ICartStoreItem {
|
|
4
122
|
_id: string;
|
|
5
123
|
skuID: string;
|
|
@@ -63,6 +181,20 @@ export interface Ishippings {
|
|
|
63
181
|
type: string;
|
|
64
182
|
data: IShippingData[];
|
|
65
183
|
}
|
|
184
|
+
export interface ISelectedShippingRate {
|
|
185
|
+
type: string;
|
|
186
|
+
shipmentId: string;
|
|
187
|
+
rate: IRate;
|
|
188
|
+
productIds: string[];
|
|
189
|
+
}
|
|
190
|
+
export interface IRate {
|
|
191
|
+
rateId: string;
|
|
192
|
+
carrier: string;
|
|
193
|
+
service: string;
|
|
194
|
+
price: number;
|
|
195
|
+
estimatedDays: number;
|
|
196
|
+
name: string;
|
|
197
|
+
}
|
|
66
198
|
export interface ICartStore {
|
|
67
199
|
_id: string;
|
|
68
200
|
status: string;
|
|
@@ -75,6 +207,7 @@ export interface ICartStore {
|
|
|
75
207
|
address?: any;
|
|
76
208
|
canApplyGiftCard: boolean;
|
|
77
209
|
totalCart: TotalCart;
|
|
210
|
+
selectedShipmentRates: ISelectedShippingRate;
|
|
78
211
|
}
|
|
79
212
|
export interface TotalCart {
|
|
80
213
|
subtotal: number;
|
|
@@ -134,9 +267,11 @@ export interface IShop {
|
|
|
134
267
|
linkedinURL: string | null;
|
|
135
268
|
facebookURL: string | null;
|
|
136
269
|
paymentMethods: IPaymentMethods[];
|
|
270
|
+
pre_purchase_data_fetch?: {
|
|
271
|
+
active: boolean;
|
|
272
|
+
title: string;
|
|
273
|
+
};
|
|
137
274
|
productsTags: string | null;
|
|
138
|
-
textColor: string;
|
|
139
|
-
shopifyDomain: string | null;
|
|
140
275
|
twitterURL: string | null;
|
|
141
276
|
webURL: string | null;
|
|
142
277
|
telegramURL: string | null;
|
|
@@ -151,6 +286,7 @@ export interface IShop {
|
|
|
151
286
|
design: IShopDesignPrev;
|
|
152
287
|
shopDesign: IShopDesign;
|
|
153
288
|
template_options: ITemplateOptions;
|
|
289
|
+
shopTemplate: string;
|
|
154
290
|
loginMethods: IWallet[];
|
|
155
291
|
tokenBasedPricing: ITokenBasedPricing;
|
|
156
292
|
launchDate: string | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Data } from 'droplinked-editor-core';
|
|
2
|
+
import { ElementType } from 'react';
|
|
2
3
|
|
|
3
4
|
export interface innerContentProps {
|
|
4
5
|
data: Data;
|
|
@@ -6,11 +7,10 @@ export interface innerContentProps {
|
|
|
6
7
|
}
|
|
7
8
|
export interface PageHeaderProps {
|
|
8
9
|
onCartClick: () => void;
|
|
9
|
-
onProfileClick: () => void;
|
|
10
10
|
cartItemCount: number;
|
|
11
11
|
data: Data;
|
|
12
12
|
handleNavigate: (route: string) => void;
|
|
13
|
-
|
|
13
|
+
profileDropdownWrapper: ElementType;
|
|
14
14
|
}
|
|
15
15
|
export interface PageFooterProps {
|
|
16
16
|
data: Data;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "droplinked-editor-configs",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/droplinked-editor.umd.js",
|
|
7
7
|
"module": "dist/droplinked-editor.es.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"classnames": "^2.5.1",
|
|
35
35
|
"clsx": "^2.1.1",
|
|
36
36
|
"cmdk": "^1.1.1",
|
|
37
|
-
"droplinked-editor-core": "^1.1.
|
|
37
|
+
"droplinked-editor-core": "^1.1.8",
|
|
38
38
|
"framer-motion": "^8.5.0",
|
|
39
39
|
"keen-slider": "^6.8.6",
|
|
40
40
|
"lucide-react": "^0.525.0",
|
package/src/PageHeader.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { useShopContext } from './ShopProvider';
|
|
|
6
6
|
import { NavigationProvider } from 'NavigationContext';
|
|
7
7
|
|
|
8
8
|
function PageHeader(props: PageHeaderProps) {
|
|
9
|
-
const { onCartClick,
|
|
9
|
+
const { onCartClick, cartItemCount, data, handleNavigate } = props
|
|
10
10
|
const { loading } = useShopContext();
|
|
11
11
|
|
|
12
12
|
const config: Config = {
|
|
@@ -17,10 +17,9 @@ function PageHeader(props: PageHeaderProps) {
|
|
|
17
17
|
return layoutComponents.headerComponent.render({
|
|
18
18
|
...componentProps,
|
|
19
19
|
onCartClick,
|
|
20
|
-
onProfileClick,
|
|
21
|
-
isLoggedIn,
|
|
22
20
|
cartItemCount,
|
|
23
|
-
isRendering: true
|
|
21
|
+
isRendering: true,
|
|
22
|
+
ProfileDropdownWrapper: props.profileDropdownWrapper
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
},
|
|
@@ -10,45 +10,6 @@ export interface BlogPost {
|
|
|
10
10
|
slug: string;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export interface IBlogContent {
|
|
14
|
-
_id: string;
|
|
15
|
-
shopID: string;
|
|
16
|
-
author: string;
|
|
17
|
-
content: string;
|
|
18
|
-
title: string;
|
|
19
|
-
writer: string;
|
|
20
|
-
isVisible: boolean;
|
|
21
|
-
category: string[];
|
|
22
|
-
tags: string[];
|
|
23
|
-
commentsCount: number;
|
|
24
|
-
image: string;
|
|
25
|
-
likes: number;
|
|
26
|
-
readTime: number;
|
|
27
|
-
version: number;
|
|
28
|
-
isFeatured: boolean;
|
|
29
|
-
seoData: {
|
|
30
|
-
metaDescription: string;
|
|
31
|
-
keywords: string[];
|
|
32
|
-
slug: string;
|
|
33
|
-
canonicalUrl: string;
|
|
34
|
-
ogTitle: string;
|
|
35
|
-
ogDescription: string;
|
|
36
|
-
ogImage: string;
|
|
37
|
-
structuredData: string;
|
|
38
|
-
_id: string;
|
|
39
|
-
},
|
|
40
|
-
mediaData: {
|
|
41
|
-
url: string;
|
|
42
|
-
title: string;
|
|
43
|
-
positionIndex: number;
|
|
44
|
-
_id: string;
|
|
45
|
-
}[],
|
|
46
|
-
publishedDate: string;
|
|
47
|
-
createdAt: string;
|
|
48
|
-
updatedAt: Date;
|
|
49
|
-
__v: number;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
13
|
export interface Blog {
|
|
53
14
|
featured: BlogPost[];
|
|
54
15
|
recent: BlogPost[];
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import axiosInstance from "apis/axiosConfig"
|
|
2
|
-
import { Blog
|
|
2
|
+
import { Blog } from "./interfaces"
|
|
3
3
|
|
|
4
4
|
export const getShopBlogsService = (shopName: string) =>
|
|
5
|
-
axiosInstance.get<{ data: Blog }>(`blogs/public/shops/${shopName}`).then(res => res.data)
|
|
6
|
-
|
|
7
|
-
export const getBlogByIdService = ({ slug }: { slug: string }) =>
|
|
8
|
-
axiosInstance.get<{ data: IBlogContent }>(`blogs/public/${slug}`).then(res => res.data)
|
|
5
|
+
axiosInstance.get<{ data: Blog }>(`blogs/public/shops/${shopName}`).then(res => res.data)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IRuleSetID, IMedia as Media } from "lib/models/product";
|
|
2
1
|
import { ProductQuery } from "lib/stores/productQueryStore/productQueryStore";
|
|
3
2
|
|
|
4
3
|
export interface IGetProductsRequest extends ProductQuery {
|
|
@@ -8,296 +7,20 @@ export interface IGetProductsRequest extends ProductQuery {
|
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
export interface IHomePageProduct {
|
|
11
|
-
|
|
10
|
+
id: string;
|
|
12
11
|
title: string;
|
|
13
12
|
slug: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
type: string;
|
|
14
|
+
status: string;
|
|
15
|
+
images: {
|
|
16
|
+
original: string;
|
|
17
|
+
thumbnail: string;
|
|
18
|
+
alt: string;
|
|
19
|
+
}[];
|
|
20
|
+
isPurchasable: boolean;
|
|
21
|
+
lowestPrice: number;
|
|
22
|
+
collectionName: string;
|
|
18
23
|
discountRuleset: boolean;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
shopname: string;
|
|
23
|
-
productID: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface IGetProductBySlugService {
|
|
27
|
-
shopname: string;
|
|
28
|
-
slug: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface IGetProductByLinkId {
|
|
32
|
-
linkId: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Interface for media objects in the product's media array
|
|
36
|
-
interface IMedia {
|
|
37
|
-
isMain: boolean; // Indicates whether this media is the main image
|
|
38
|
-
thumbnail: string; // URL of the thumbnail image
|
|
39
|
-
url: string; // URL of the main image
|
|
40
|
-
_id: string; // Unique identifier for the media object
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Interface for the product collection object
|
|
44
|
-
interface IProductCollection {
|
|
45
|
-
title: string; // Title of the product collection
|
|
46
|
-
ruleSetID?: IRuleSetID
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Interface for the optional ruleset object (not required)
|
|
50
|
-
interface IRuleSet {
|
|
51
|
-
gated?: boolean; // Optional gated flag
|
|
52
|
-
redeemedNFTs?: any; // Optional redeemed NFTs field
|
|
53
|
-
rules?: any; // Optional rules field
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Interface for option objects inside each SKU
|
|
57
|
-
export interface IOption {
|
|
58
|
-
variantName: string; // Name of the variant (e.g., color, size)
|
|
59
|
-
value: string; // Value of the variant (e.g., red, large)
|
|
60
|
-
caption: string; // Caption for the option (additional description)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Interface for SKU objects in the skuIDs array
|
|
64
|
-
export interface ISku {
|
|
65
|
-
_id: string; // Unique identifier for the SKU
|
|
66
|
-
price: number; // Price of the SKU
|
|
67
|
-
quantity: number; // Quantity available for the SKU
|
|
68
|
-
image?: string; // Optional image URL for the SKU
|
|
69
|
-
weight: number; // Weight of the SKU
|
|
70
|
-
|
|
71
|
-
dimensions: { // Dimensions of the SKU
|
|
72
|
-
height: number;
|
|
73
|
-
length: number;
|
|
74
|
-
width: number;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
options?: IOption[]; // Optional options array (for NON-DIGITAL products)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Main interface for the product object
|
|
81
|
-
export interface IProduct {
|
|
82
|
-
// Ensured this is exported
|
|
83
|
-
description: string; // Mandatory description of the product
|
|
84
|
-
media: IMedia[]; // Mandatory media array containing images and videos
|
|
85
|
-
productCollectionID: IProductCollection; // Object containing the product collection details
|
|
86
|
-
ruleSet?: IRuleSet; // Optional ruleSet object (could be undefined)
|
|
87
|
-
slug: string | null; // Mandatory slug (URL-friendly identifier for the product)
|
|
88
|
-
title: string; // Mandatory title of the product
|
|
89
|
-
_id: string | null; // Mandatory unique identifier for the product
|
|
90
|
-
ownerID: string | null; // Mandatory unique identifier for the owner of the product
|
|
91
|
-
product_type: "NORMAL" | "PRINT_ON_DEMAND" | "DIGITAL"; // Type of the product (one of three types)
|
|
92
|
-
skuIDs: ISku[]; // Mandatory SKU array, must contain at least one SKU
|
|
93
|
-
launchDate?: string;
|
|
94
|
-
purchaseAvailable: boolean;
|
|
95
|
-
pod_blank_product_id: string;
|
|
96
|
-
// Optional nftData object containing blockchain-related information
|
|
97
|
-
nftData?: INftData;
|
|
98
|
-
m2m_positions: IM2MPosition[];
|
|
99
|
-
m2m_services: IM2MService[];
|
|
100
|
-
shippingType: string;
|
|
101
|
-
}
|
|
102
|
-
export interface IM2MPosition {
|
|
103
|
-
placement: string
|
|
104
|
-
variantIDs: number[]
|
|
105
|
-
url: string
|
|
106
|
-
}
|
|
107
|
-
export interface IM2MService {
|
|
108
|
-
_id: string;
|
|
109
|
-
name: string;
|
|
110
|
-
chain: string;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface INftData {
|
|
114
|
-
deployHash: string;
|
|
115
|
-
transactionUrl: string;
|
|
116
|
-
networkName: string;
|
|
117
|
-
}
|
|
118
|
-
export interface IShippingAvailbilityData {
|
|
119
|
-
statusCode: number;
|
|
120
|
-
message: string | null;
|
|
121
|
-
data: string[];
|
|
122
|
-
}
|
|
123
|
-
// Function to convert raw product data into the IProduct model
|
|
124
|
-
export const convertProductDataToModel = (data: any): IProduct => {
|
|
125
|
-
try {
|
|
126
|
-
// Default SKU in case the SKU data is missing or incomplete
|
|
127
|
-
const defaultSku: ISku = {
|
|
128
|
-
price: 0,
|
|
129
|
-
quantity: 0,
|
|
130
|
-
_id: "unknown_sku_id",
|
|
131
|
-
weight: 0,
|
|
132
|
-
dimensions: {
|
|
133
|
-
height: 0,
|
|
134
|
-
length: 0,
|
|
135
|
-
width: 0,
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
// Default option for SKUs in NON-DIGITAL products
|
|
141
|
-
const defaultOption: IOption = {
|
|
142
|
-
variantName: "default_variant",
|
|
143
|
-
value: "default_value",
|
|
144
|
-
caption: " ",
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// Default media object in case media array is missing or incomplete
|
|
148
|
-
const defaultMedia: IMedia = {
|
|
149
|
-
isMain: false,
|
|
150
|
-
thumbnail: "default_thumbnail.jpg",
|
|
151
|
-
url: "default_url.jpg",
|
|
152
|
-
_id: "default_media_id",
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
// Construct the product object, falling back to default values when necessary
|
|
156
|
-
const product: IProduct = {
|
|
157
|
-
description: data?.description || "No description available",
|
|
158
|
-
media:
|
|
159
|
-
Array.isArray(data?.media) && data?.media.length > 0
|
|
160
|
-
? data.media.map((mediaItem: any) => ({
|
|
161
|
-
isMain:
|
|
162
|
-
mediaItem?.isMain === "true" || mediaItem?.isMain === true,
|
|
163
|
-
thumbnail: mediaItem?.thumbnail || "",
|
|
164
|
-
url: mediaItem?.url || "",
|
|
165
|
-
_id: mediaItem?._id || "",
|
|
166
|
-
}))
|
|
167
|
-
: [defaultMedia],
|
|
168
|
-
|
|
169
|
-
productCollectionID: {
|
|
170
|
-
title: data?.productCollectionID?.title || "",
|
|
171
|
-
ruleSetID: {
|
|
172
|
-
collectionID: data?.productCollectionID?.ruleSetID?.collectionID || "",
|
|
173
|
-
createdAt: data?.productCollectionID?.ruleSetID?.createdAt || "",
|
|
174
|
-
type: data?.productCollectionID?.ruleSetID?.type || "",
|
|
175
|
-
ownerID: data?.productCollectionID?.ruleSetID?.ownerID || "",
|
|
176
|
-
_id: data?.productCollectionID?.ruleSetID?._id || "",
|
|
177
|
-
blockchainType: data?.productCollectionID?.ruleSetID?.blockchainType || "",
|
|
178
|
-
description: data?.productCollectionID?.ruleSetID?.description || "",
|
|
179
|
-
discountPercentage: data?.productCollectionID?.ruleSetID?.discountPercentage || "",
|
|
180
|
-
minimumNftRequired: data?.productCollectionID?.ruleSetID?.minimumNftRequired || "",
|
|
181
|
-
network: data?.productCollectionID?.ruleSetID?.network || "",
|
|
182
|
-
nftContractAddresses: data?.productCollectionID?.ruleSetID?.nftContractAddresses || "",
|
|
183
|
-
nftPurchaseLink: data?.productCollectionID?.ruleSetID?.nftPurchaseLink || "",
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
purchaseAvailable: data.purchaseAvailable,
|
|
187
|
-
slug: data?.slug || null,
|
|
188
|
-
title: data?.title || "",
|
|
189
|
-
_id: data?._id || null,
|
|
190
|
-
ownerID: data?.ownerID || null,
|
|
191
|
-
product_type: data?.product_type || "NORMAL",
|
|
192
|
-
launchDate: data?.launchDate,
|
|
193
|
-
pod_blank_product_id: data.pod_blank_product_id,
|
|
194
|
-
shippingType: data.shippingType,
|
|
195
|
-
skuIDs:
|
|
196
|
-
Array.isArray(data?.skuIDs) && data?.skuIDs.length > 0
|
|
197
|
-
? data.skuIDs.map((sku: any) => ({
|
|
198
|
-
price: typeof sku?.price === "number" ? sku.price : 0,
|
|
199
|
-
quantity: typeof sku?.quantity === "number" ? sku.quantity : 0,
|
|
200
|
-
_id: sku?._id || "unknown_sku_id",
|
|
201
|
-
options:
|
|
202
|
-
data?.product_type !== "DIGITAL" &&
|
|
203
|
-
Array.isArray(sku?.options) &&
|
|
204
|
-
sku.options.length > 0
|
|
205
|
-
? sku.options.map((option: any) => ({
|
|
206
|
-
variantName: option?.variantName || "default_variant",
|
|
207
|
-
value: option?.value || "default_value",
|
|
208
|
-
caption: option?.caption || " ",
|
|
209
|
-
}))
|
|
210
|
-
: undefined,
|
|
211
|
-
image: sku.image,
|
|
212
|
-
weight: sku.weight,
|
|
213
|
-
dimensions: {
|
|
214
|
-
height: sku.dimensions.height,
|
|
215
|
-
length: sku.dimensions.length,
|
|
216
|
-
width: sku.dimensions.width,
|
|
217
|
-
},
|
|
218
|
-
}))
|
|
219
|
-
: [defaultSku],
|
|
220
|
-
|
|
221
|
-
// Adding nftData
|
|
222
|
-
nftData: data?.nftData
|
|
223
|
-
? {
|
|
224
|
-
deployHash: data.nftData.deployHash,
|
|
225
|
-
transactionUrl: data.nftData.transactionUrl,
|
|
226
|
-
networkName: data.nftData.networkName,
|
|
227
|
-
}
|
|
228
|
-
: undefined,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
m2m_positions:
|
|
232
|
-
Array.isArray(data?.m2m_positions) && data?.m2m_positions.length > 0
|
|
233
|
-
? data.m2m_positions.map((position: any) => ({
|
|
234
|
-
placement: position.placement || "",
|
|
235
|
-
variantIDs: position.variant_ids || "",
|
|
236
|
-
url: position.url || ""
|
|
237
|
-
}))
|
|
238
|
-
: [],
|
|
239
|
-
|
|
240
|
-
m2m_services:
|
|
241
|
-
Array.isArray(data?.m2m_services) && data?.m2m_services.length > 0
|
|
242
|
-
? data.m2m_services.map((service: any) => ({
|
|
243
|
-
_id: service?._id || "",
|
|
244
|
-
name: service?.name || "Unnamed Service",
|
|
245
|
-
chain: service?.chain || "Unknown Chain",
|
|
246
|
-
}))
|
|
247
|
-
: [],
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
return product;
|
|
251
|
-
} catch (error) {
|
|
252
|
-
console.error("Error converting product data:", error);
|
|
253
|
-
|
|
254
|
-
// If an error occurs, return a product object with default values
|
|
255
|
-
return {
|
|
256
|
-
description: "No description available",
|
|
257
|
-
purchaseAvailable: data?.purchaseAvailable,
|
|
258
|
-
media: [
|
|
259
|
-
{
|
|
260
|
-
isMain: false,
|
|
261
|
-
thumbnail: "default_thumbnail.jpg",
|
|
262
|
-
url: "default_url.jpg",
|
|
263
|
-
_id: "default_media_id",
|
|
264
|
-
},
|
|
265
|
-
],
|
|
266
|
-
productCollectionID: { title: "Default Collection" },
|
|
267
|
-
slug: null,
|
|
268
|
-
title: "",
|
|
269
|
-
_id: null,
|
|
270
|
-
ownerID: null,
|
|
271
|
-
product_type: "NORMAL",
|
|
272
|
-
pod_blank_product_id: "",
|
|
273
|
-
skuIDs: [
|
|
274
|
-
{
|
|
275
|
-
price: 0,
|
|
276
|
-
quantity: 0,
|
|
277
|
-
_id: "unknown_sku_id",
|
|
278
|
-
weight: 0,
|
|
279
|
-
dimensions: {
|
|
280
|
-
height: 0,
|
|
281
|
-
length: 0,
|
|
282
|
-
width: 0,
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
],
|
|
286
|
-
nftData: undefined,
|
|
287
|
-
m2m_positions: [],
|
|
288
|
-
m2m_services: [],
|
|
289
|
-
shippingType: ""
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
export interface ISemanticSearchParams {
|
|
295
|
-
query: string;
|
|
296
|
-
limit?: number;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
export interface NftImagesData {
|
|
300
|
-
nfts: string[];
|
|
301
|
-
domains: string[];
|
|
302
|
-
}
|
|
303
|
-
|
|
24
|
+
gatedRuleset: boolean;
|
|
25
|
+
nftRecording: any;
|
|
26
|
+
}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import axiosInstance from "apis/axiosConfig";
|
|
2
2
|
import { createQueryString } from "lib/utils/app/createQueryString";
|
|
3
3
|
import {
|
|
4
|
-
convertProductDataToModel,
|
|
5
|
-
IGetProductByLinkId,
|
|
6
|
-
IGetProductBySlugService,
|
|
7
|
-
IgetProductPublicService,
|
|
8
4
|
IGetProductsRequest,
|
|
9
|
-
IProduct,
|
|
10
|
-
ISemanticSearchParams,
|
|
11
|
-
IShippingAvailbilityData
|
|
12
5
|
} from "./interface";
|
|
13
6
|
|
|
14
7
|
export const getProductsService = (params: IGetProductsRequest) => {
|
|
@@ -19,30 +12,6 @@ export const getProductsService = (params: IGetProductsRequest) => {
|
|
|
19
12
|
}).toString()
|
|
20
13
|
|
|
21
14
|
return axiosInstance
|
|
22
|
-
.get(
|
|
15
|
+
.get(`/product-v2/public/shop/${params.shopName}?${queryString}`)
|
|
23
16
|
.then((res) => res.data)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const getProductPublicService = ({ productID, shopname }: IgetProductPublicService) => {
|
|
27
|
-
return axiosInstance.get<{ data: IProduct }>(`product/public/${productID}?shopname=${shopname}`).then((res) => convertProductDataToModel(res.data.data));
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const getProductBySlugService = ({ slug, shopname }: IGetProductBySlugService) => axiosInstance.get(`product/public/${slug}?shopname=${shopname}`);
|
|
31
|
-
|
|
32
|
-
export const getProductByLinkId = ({ linkId }: IGetProductByLinkId) => axiosInstance.get(`/product/link/${linkId}`);
|
|
33
|
-
|
|
34
|
-
export const getShippingAvailability = async (productId: string): Promise<IShippingAvailbilityData> => {
|
|
35
|
-
try {
|
|
36
|
-
const response = await axiosInstance.post<IShippingAvailbilityData>("/product/printful-available-shipping", {
|
|
37
|
-
product_id: productId,
|
|
38
|
-
});
|
|
39
|
-
return response.data;
|
|
40
|
-
} catch (error) {
|
|
41
|
-
console.error("Error fetching shipping availability:", error);
|
|
42
|
-
throw new Error("Failed to fetch shipping availability");
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const semanticSearchService = ({ query, limit = 10 }: ISemanticSearchParams) => {
|
|
47
|
-
return axiosInstance.get(`/product/search/semantic${query && query !== "" ? `?query=${query}` : ""}&limit=${limit}`);
|
|
48
|
-
};
|
|
17
|
+
}
|