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.
Files changed (38) hide show
  1. package/dist/apis/blogs/interfaces.d.ts +0 -38
  2. package/dist/apis/blogs/services.d.ts +1 -6
  3. package/dist/apis/product/interface.d.ts +12 -100
  4. package/dist/apis/product/services.d.ts +1 -6
  5. package/dist/apis/shop/interface.d.ts +0 -3
  6. package/dist/apis/shop/service.d.ts +1 -2
  7. package/dist/components/header/Header.d.ts +2 -3
  8. package/dist/components/header/HeaderIcons.d.ts +3 -2
  9. package/dist/components/header/Sidebar.d.ts +3 -3
  10. package/dist/droplinked-editor.es.js +8746 -8748
  11. package/dist/droplinked-editor.umd.js +70 -70
  12. package/dist/lib/models/user.d.ts +1 -1
  13. package/dist/lib/stores/app/appStore.d.ts +2 -2
  14. package/dist/lib/stores/app/interfaces.d.ts +138 -2
  15. package/dist/types/renderersProps.d.ts +2 -2
  16. package/package.json +2 -2
  17. package/src/PageHeader.tsx +3 -4
  18. package/src/apis/blogs/interfaces.ts +0 -39
  19. package/src/apis/blogs/services.ts +2 -5
  20. package/src/apis/product/interface.ts +14 -291
  21. package/src/apis/product/services.ts +2 -33
  22. package/src/apis/shop/interface.ts +0 -4
  23. package/src/apis/shop/service.ts +3 -7
  24. package/src/components/header/Header.tsx +4 -6
  25. package/src/components/header/HeaderIcons.tsx +13 -5
  26. package/src/components/header/Sidebar.tsx +20 -8
  27. package/src/components/productGrid/components/ProductGrid/GridViewProductCard.tsx +2 -2
  28. package/src/components/productGrid/components/ProductGrid/ListViewProductCard.tsx +4 -4
  29. package/src/components/productGrid/components/ProductGrid/ProductGrid.tsx +2 -2
  30. package/src/components/productGrid/components/ProductGrid/Slider/ProductImageSlider.tsx +4 -4
  31. package/src/configured-components/layout/headerConfig.tsx +2 -2
  32. package/src/lib/models/user.ts +1 -1
  33. package/src/lib/stores/app/appStore.ts +2 -2
  34. package/src/lib/stores/app/interfaces.ts +149 -2
  35. package/src/types/renderersProps.ts +2 -2
  36. package/tsconfig.tsbuildinfo +1 -1
  37. package/dist/lib/models/product.d.ts +0 -97
  38. package/src/lib/models/product.ts +0 -104
@@ -1,13 +1,9 @@
1
1
  import axiosInstance from "apis/axiosConfig"
2
- import { IgetShopService, IshopDomainService, ProductFiltersResponse } from "./interface"
3
-
4
- export const shopDomainService = ({ domain }: IshopDomainService) => {
5
- return axiosInstance.get(`shop/domain/${domain}`)
6
- }
2
+ import { IgetShopService, ProductFiltersResponse } from "./interface"
7
3
 
8
4
  export const getShopService = ({ shopName }: IgetShopService) => {
9
- return axiosInstance.get(`shop/public/${shopName}`)
5
+ return axiosInstance.get(`/shops/v2/public/name/${shopName}`)
10
6
  }
11
7
 
12
8
  export const getAvailableProductFilters = (shopName: string) =>
13
- axiosInstance.get<{ data: ProductFiltersResponse }>(`product/available/filters/${shopName}`).then(res => res.data)
9
+ axiosInstance.get<{ data: ProductFiltersResponse }>(`/product-v2/available/filters/${shopName}`).then(res => res.data)
@@ -11,13 +11,12 @@ import { useAppStore } from 'AppStoreProvider'
11
11
  interface Props {
12
12
  linkManagement?: { link: { label: string, url: string } }[]
13
13
  onCartClick?: () => void
14
- onProfileClick?: () => void
14
+ ProfileDropdownWrapper?: React.ElementType
15
15
  cartItemCount?: number
16
- isLoggedIn?: boolean
17
16
  isRendering?: boolean
18
17
  }
19
18
 
20
- const Header = ({ linkManagement, onCartClick, onProfileClick, cartItemCount, isRendering, isLoggedIn }: Props) => {
19
+ const Header = ({ linkManagement, onCartClick, ProfileDropdownWrapper, cartItemCount, isRendering }: Props) => {
21
20
  const { states: { shop }, methods: { updateState } } = useAppStore()
22
21
  const { shopDesign: { backgroundBody, iconHeaderColor } } = useThemeInfo()
23
22
  const isRestrictedModalOpen = shop.isAgeRestricted && shop.isRestricted === undefined
@@ -69,8 +68,7 @@ const Header = ({ linkManagement, onCartClick, onProfileClick, cartItemCount, is
69
68
  <Sidebar
70
69
  iconColor={iconColor}
71
70
  linkManagement={linkManagement}
72
- onProfileClick={onProfileClick}
73
- isLoggedIn={isLoggedIn}
71
+ ProfileDropdownWrapper={ProfileDropdownWrapper}
74
72
  />
75
73
  <Box maxWidth="150px">
76
74
  <AppLogo height="31px" objectFit="contain" />
@@ -82,7 +80,7 @@ const Header = ({ linkManagement, onCartClick, onProfileClick, cartItemCount, is
82
80
  <HeaderIcons
83
81
  iconColor={iconColor}
84
82
  onCartClick={onCartClick}
85
- onProfileClick={onProfileClick}
83
+ ProfileDropdownWrapper={ProfileDropdownWrapper}
86
84
  cartItemCount={cartItemCount}
87
85
  />
88
86
  </AppContainer>
@@ -9,11 +9,11 @@ import HeaderCartIcon from './HeaderCartIcon'
9
9
  interface Props {
10
10
  iconColor: string
11
11
  onCartClick?: () => void
12
- onProfileClick?: () => void
13
12
  cartItemCount?: number
13
+ ProfileDropdownWrapper?: React.ElementType
14
14
  }
15
15
 
16
- function HeaderIcons({ iconColor, onCartClick, onProfileClick, cartItemCount }: Props) {
16
+ function HeaderIcons({ iconColor, onCartClick, ProfileDropdownWrapper, cartItemCount }: Props) {
17
17
  const { shopDesign: { backgroundBody } } = useThemeInfo()
18
18
 
19
19
  const renderIcon = (iconComponent: React.ReactElement, customStyles?: IconProps) => {
@@ -39,9 +39,17 @@ function HeaderIcons({ iconColor, onCartClick, onProfileClick, cartItemCount }:
39
39
  icon={renderIcon(<CartMd />, { onClick: onCartClick })}
40
40
  cartItemCount={cartItemCount}
41
41
  />
42
- <Box display={{ base: "none", md: "block" }}>
43
- {renderIcon(<UserMd />, { onClick: onProfileClick })}
44
- </Box>
42
+ {ProfileDropdownWrapper ? (
43
+ <ProfileDropdownWrapper>
44
+ <Box display={{ base: "none", md: "block" }}>
45
+ {renderIcon(<UserMd />)}
46
+ </Box>
47
+ </ProfileDropdownWrapper>
48
+ ) : (
49
+ <Box display={{ base: "none", md: "block" }}>
50
+ {renderIcon(<UserMd />)}
51
+ </Box>
52
+ )}
45
53
  </HStack>
46
54
  )
47
55
  }
@@ -7,16 +7,18 @@ import { drawerAnatomy as parts } from '@chakra-ui/anatomy';
7
7
  import { createMultiStyleConfigHelpers } from '@chakra-ui/styled-system';
8
8
  import HeaderLinks from './HeaderLinks';
9
9
  import { Button } from 'components/ui/button';
10
+ import { useAppStore } from 'AppStoreProvider';
10
11
 
11
12
  interface Props {
12
13
  iconColor: string
13
14
  linkManagement?: { link: { label: string, url: string } }[]
14
- onProfileClick?: () => void
15
- isLoggedIn?: boolean
15
+ ProfileDropdownWrapper?: React.ElementType
16
16
  }
17
17
 
18
- function Sidebar({ iconColor, linkManagement, onProfileClick, isLoggedIn }: Props) {
18
+ function Sidebar({ iconColor, linkManagement, ProfileDropdownWrapper }: Props) {
19
19
  const { isOpen, onOpen, onClose } = useDisclosure()
20
+ const { states: { user, shop: { name } } } = useAppStore()
21
+ const { id } = user?.[name]?.user || {}
20
22
  const { shopDesign: { backgroundBody } } = useThemeInfo()
21
23
  const [isLargerThan768] = useMediaQuery('(min-width: 768px)')
22
24
  const { defineMultiStyleConfig } = createMultiStyleConfigHelpers(parts.keys)
@@ -41,11 +43,21 @@ function Sidebar({ iconColor, linkManagement, onProfileClick, isLoggedIn }: Prop
41
43
  <VStack width={"100%"} height={"80%"} justifyContent={"space-between"} alignItems={"start"} overflow="auto">
42
44
  <HeaderLinks type='vertical' onClose={() => onClose()} linkManagement={linkManagement} />
43
45
  <VStack gap={"16px"} width={"100%"}>
44
- <Button variant='outline' onClick={onProfileClick}>
45
- <AppTypography>
46
- {isLoggedIn ? "Account" : "Sign In"}
47
- </AppTypography>
48
- </Button>
46
+ {ProfileDropdownWrapper ? (
47
+ <ProfileDropdownWrapper>
48
+ <Button variant='outline'>
49
+ <AppTypography>
50
+ {id ? "Account" : "Sign In"}
51
+ </AppTypography>
52
+ </Button>
53
+ </ProfileDropdownWrapper>
54
+ ) : (
55
+ <Button variant='outline'>
56
+ <AppTypography>
57
+ {id ? "Account" : "Sign In"}
58
+ </AppTypography>
59
+ </Button>
60
+ )}
49
61
  </VStack>
50
62
  </VStack>
51
63
  </DrawerBody>
@@ -12,7 +12,7 @@ interface Props {
12
12
  }
13
13
 
14
14
  export default function GridViewProductCard({ product, isEditing }: Props) {
15
- const { title, lowestSkuPrice, _id, slug } = product
15
+ const { title, lowestPrice, id, slug } = product
16
16
  const [isHovered, setIsHovered] = useState(false)
17
17
 
18
18
  return (
@@ -23,7 +23,7 @@ export default function GridViewProductCard({ product, isEditing }: Props) {
23
23
  >
24
24
  <ProductImageSlider product={product} isHovered={isHovered} isEditing={isEditing} />
25
25
  <ProductTitle title={title} slug={slug} className="mt-3" />
26
- <ProductPrice price={lowestSkuPrice} slug={slug} className="mt-2" />
26
+ <ProductPrice price={lowestPrice} slug={slug} className="mt-2" />
27
27
  </div>
28
28
  )
29
29
  }
@@ -7,18 +7,18 @@ import useThemeInfo from "hooks/useThemeInfo"
7
7
  import { useCustomNavigate } from "hooks/useCustomNavigate"
8
8
 
9
9
  export default function ListViewProductCard({ product }: { product: IHomePageProduct }) {
10
- const { media, title, lowestSkuPrice, discountRuleset, gatedRuleset, slug, _id } = product
10
+ const { images, title, lowestPrice, discountRuleset, gatedRuleset, slug, id } = product
11
11
  const { isDarkTheme } = useThemeInfo()
12
12
  const iconClass = isDarkTheme ? "[&_path]:stroke-white" : ""
13
13
  const { navigate } = useCustomNavigate()
14
- const imageURL = (media.find(m => m.isMain === "true") ?? media[0]).thumbnail
14
+ const imageURL = (images.find(img => img.original) ?? images[0])?.thumbnail || images[0]?.original
15
15
 
16
16
  return (
17
- <div className="cursor-pointer" onClick={() => navigate(`product/${slug ?? _id}`)}>
17
+ <div className="cursor-pointer" onClick={() => navigate(`product/${slug ?? id}`)}>
18
18
  <ProductCardBase
19
19
  image={<img src={imageURL} alt={title} className="w-[70px] h-[70px] object-cover rounded-lg shrink-0" />}
20
20
  title={<ProductTitle title={title} slug={slug} />}
21
- price={<ProductPrice price={lowestSkuPrice} slug={slug} />}
21
+ price={<ProductPrice price={lowestPrice} slug={slug} />}
22
22
  icons={
23
23
  <>
24
24
  {discountRuleset && <PLPIcons.Discount className={iconClass} />}
@@ -39,8 +39,8 @@ function ProductGrid({ limit, isEditing }: { limit?: number; isEditing?: boolean
39
39
  <ProductGridLayout>
40
40
  {products.map(product => (
41
41
  isMobile && viewMode === 'list'
42
- ? <ListViewProductCard key={product._id} product={product} />
43
- : <GridViewProductCard key={product._id} product={product} isEditing={isEditing} />
42
+ ? <ListViewProductCard key={product.id} product={product} />
43
+ : <GridViewProductCard key={product.id} product={product} isEditing={isEditing} />
44
44
  ))}
45
45
 
46
46
  {isFetchingNextPage && renderSkeletons()}
@@ -15,10 +15,10 @@ interface Props {
15
15
  }
16
16
 
17
17
  export default function ProductImageSlider({ product, isHovered, isEditing }: Props) {
18
- const { media, title, slug } = product
18
+ const { images, title, slug } = product
19
19
  const { navigate } = useCustomNavigate()
20
20
  const [currentIndex, setCurrentIndex] = useState(0)
21
- const sliderImages = media.sort((_, b) => (b.isMain === "true" ? 1 : -1)).slice(0, 3)
21
+ const sliderImages = images.slice(0, 3)
22
22
 
23
23
  const [sliderRef, instanceRef] = useKeenSlider<HTMLDivElement>({
24
24
  loop: true,
@@ -53,7 +53,7 @@ export default function ProductImageSlider({ product, isHovered, isEditing }: Pr
53
53
  <div className="relative overflow-hidden rounded-lg aspect-square cursor-pointer">
54
54
  <img
55
55
  src={sliderImages[0]?.thumbnail}
56
- alt={title}
56
+ alt={sliderImages[0]?.alt || title}
57
57
  onClick={handleImageClick}
58
58
  className="w-full h-full object-cover transition-transform duration-500 ease-in-out group-hover:scale-[1.04]"
59
59
  />
@@ -69,7 +69,7 @@ export default function ProductImageSlider({ product, isHovered, isEditing }: Pr
69
69
  <div key={index} className="keen-slider__slide w-full h-full aspect-square flex items-center justify-center">
70
70
  <img
71
71
  src={image.thumbnail}
72
- alt={`${title}-${index}`}
72
+ alt={image.alt || `${title}-${index}`}
73
73
  className="w-full h-full object-cover transition-transform duration-500 ease-in-out group-hover:scale-[1.04]"
74
74
  />
75
75
  </div>
@@ -52,13 +52,13 @@ export const headerConfig: Config["components"][string] = {
52
52
  }
53
53
  ]
54
54
  },
55
- render: ({ linkManagement, onCartClick, onProfileClick, isLoggedIn, cartItemCount, isRendering }) => {
55
+ render: ({ linkManagement, onCartClick, ProfileDropdownWrapper, cartItemCount, isRendering }) => {
56
56
  return (
57
57
  <StylesWrapper>
58
58
  <Header
59
59
  linkManagement={linkManagement}
60
60
  onCartClick={onCartClick}
61
- onProfileClick={onProfileClick}
61
+ ProfileDropdownWrapper={ProfileDropdownWrapper}
62
62
  cartItemCount={cartItemCount}
63
63
  isRendering={isRendering}
64
64
  />
@@ -55,7 +55,7 @@ export interface IUser {
55
55
  status: string;
56
56
  stripeCustomerID: string;
57
57
  walletType?: WALLET_TYPES;
58
- _id: string;
58
+ id: string;
59
59
  }
60
60
 
61
61
  /*
@@ -2,7 +2,7 @@ import { IUser } from 'lib/models/user'
2
2
  import { appDevelopment } from 'lib/utils/app/variables'
3
3
  import { create } from 'zustand'
4
4
  import { devtools, persist } from 'zustand/middleware'
5
- import { ICartStore, IShop } from './interfaces'
5
+ import { ICart, IShop } from './interfaces'
6
6
  import { shopStates } from './shopModel'
7
7
 
8
8
  interface IupdateState {
@@ -10,7 +10,7 @@ interface IupdateState {
10
10
  value: any
11
11
  }
12
12
  interface Icart {
13
- [propname: string]: ICartStore
13
+ [propname: string]: ICart
14
14
  }
15
15
 
16
16
  export interface IAppStore {
@@ -1,5 +1,132 @@
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
+
41
+ export interface IShippingRate {
42
+ rateId: string;
43
+ price: number;
44
+ deliveryTime: string;
45
+ selected: boolean;
46
+ name?: string;
47
+ carrier?: string;
48
+ estimatedDays?: number;
49
+ }
50
+
51
+ export interface IAvailableShipping {
52
+ type: "THIRD_PARTY" | "CUSTOM" | "POD";
53
+ shipmentId: string;
54
+ rates: IShippingRate[];
55
+ productIds: string[];
56
+ }
57
+
58
+ export interface IGiftCard {
59
+ type: "PERCENTAGE" | "AMOUNT";
60
+ value: number;
61
+ code: string;
62
+ }
63
+
64
+ export interface IFinancialDetails {
65
+ tax: {
66
+ total: number;
67
+ droplinked: number;
68
+ producer: number;
69
+ };
70
+ discounts: {
71
+ ruleset: number;
72
+ giftCard: number;
73
+ };
74
+ shipping: {
75
+ total: number;
76
+ dropLinkedShare: number;
77
+ merchantShare: number;
78
+ };
79
+ amounts: {
80
+ productTotal: number;
81
+ discountTotal: number;
82
+ taxTotal: number;
83
+ shippingTotal: number;
84
+ totalBeforeDiscount: number;
85
+ finalTotalBeforeTax: number;
86
+ totalAmount: number;
87
+ productTotalAfterDiscount: number;
88
+ };
89
+ }
90
+
91
+ export interface IAddress {
92
+ addressLine1?: string;
93
+ addressLine2?: string;
94
+ city?: string;
95
+ country?: string;
96
+ state?: string;
97
+ zip?: string;
98
+ firstName?: string;
99
+ lastName?: string;
100
+ phone?: string;
101
+ }
102
+
103
+ export interface ICart {
104
+ id: string;
105
+ shopId: string;
106
+ customerId: string;
107
+ email: string;
108
+ items: ICartItem[];
109
+ shippingAddressId: string;
110
+ availableShipping: IAvailableShipping[];
111
+ giftcard: IGiftCard;
112
+ financialDetails: IFinancialDetails;
113
+ status: "ACTIVE" | "EXPIRED";
114
+ additional: {
115
+ note: string;
116
+ };
117
+ shippingAddress: IAddress;
118
+ expiredAt: string;
119
+ createdAt: string;
120
+ updatedAt: string;
121
+ _id: string;
122
+ }
123
+
124
+ export interface ISelectedShipping {
125
+ shipmentId: string;
126
+ rateId: string;
127
+ }
128
+
129
+ // Legacy interfaces - keeping for backward compatibility
3
130
  export interface ICartStoreItem {
4
131
  _id: string
5
132
  skuID: string
@@ -66,6 +193,22 @@ export interface Ishippings {
66
193
  data: IShippingData[]
67
194
  }
68
195
 
196
+ export interface ISelectedShippingRate {
197
+ type: string;
198
+ shipmentId: string;
199
+ rate: IRate;
200
+ productIds: string[];
201
+ }
202
+
203
+ export interface IRate {
204
+ rateId: string;
205
+ carrier: string;
206
+ service: string;
207
+ price: number;
208
+ estimatedDays: number;
209
+ name: string
210
+ }
211
+
69
212
  export interface ICartStore {
70
213
  _id: string
71
214
  status: string
@@ -78,6 +221,7 @@ export interface ICartStore {
78
221
  address?: any
79
222
  canApplyGiftCard: boolean
80
223
  totalCart: TotalCart
224
+ selectedShipmentRates: ISelectedShippingRate;
81
225
  }
82
226
 
83
227
  export interface TotalCart {
@@ -140,9 +284,11 @@ export interface IShop {
140
284
  linkedinURL: string | null;
141
285
  facebookURL: string | null;
142
286
  paymentMethods: IPaymentMethods[];
287
+ pre_purchase_data_fetch?: {
288
+ active: boolean;
289
+ title: string;
290
+ };
143
291
  productsTags: string | null;
144
- textColor: string;
145
- shopifyDomain: string | null;
146
292
  twitterURL: string | null;
147
293
  webURL: string | null;
148
294
  telegramURL: string | null;
@@ -157,6 +303,7 @@ export interface IShop {
157
303
  design: IShopDesignPrev;
158
304
  shopDesign: IShopDesign;
159
305
  template_options: ITemplateOptions;
306
+ shopTemplate: string;
160
307
  loginMethods: IWallet[]
161
308
  tokenBasedPricing: ITokenBasedPricing;
162
309
  launchDate: string | null;
@@ -1,4 +1,5 @@
1
1
  import { Data } from "droplinked-editor-core";
2
+ import { ElementType, ReactNode } from "react";
2
3
 
3
4
  export interface innerContentProps {
4
5
  data: Data;
@@ -7,11 +8,10 @@ export interface innerContentProps {
7
8
 
8
9
  export interface PageHeaderProps {
9
10
  onCartClick: () => void
10
- onProfileClick: () => void
11
11
  cartItemCount: number
12
12
  data: Data
13
13
  handleNavigate: (route: string) => void
14
- isLoggedIn: boolean
14
+ profileDropdownWrapper: ElementType
15
15
  }
16
16
 
17
17
  export interface PageFooterProps {