droplinked-editor-configs 1.8.3 → 1.8.4

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.
@@ -34,7 +34,7 @@ export interface IUser {
34
34
  status: string;
35
35
  stripeCustomerID: string;
36
36
  walletType?: WALLET_TYPES;
37
- _id: string;
37
+ id: string;
38
38
  }
39
39
  export interface IUserData {
40
40
  [key: string]: {
@@ -1,12 +1,12 @@
1
1
  import { IUser } from 'lib/models/user';
2
- import { ICartStore, IShop } from './interfaces';
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]: ICartStore;
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
- isLoggedIn: boolean;
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.3",
4
+ "version": "1.8.4",
5
5
  "type": "module",
6
6
  "main": "dist/droplinked-editor.umd.js",
7
7
  "module": "dist/droplinked-editor.es.js",
@@ -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, onProfileClick, cartItemCount, data, handleNavigate, isLoggedIn } = props
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
  },
@@ -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>
@@ -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 {