@leadmetrics-ai/website-sdk 1.0.3 → 1.0.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/index.cjs.js +2 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +303 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +27 -37
- package/rollup.config.mjs +35 -0
- package/src/blog/index.ts +56 -0
- package/{dist/src/blog/types.d.ts → src/blog/types.ts} +58 -54
- package/src/cart/index.ts +40 -0
- package/src/cart/types.ts +45 -0
- package/src/client/index.ts +13 -0
- package/src/form/index.ts +11 -0
- package/src/form/types.ts +28 -0
- package/{dist/src/index.d.ts → src/index.ts} +21 -18
- package/src/models.ts +18 -0
- package/src/products/index.ts +101 -0
- package/{dist/src/products/types.d.ts → src/products/types.ts} +62 -60
- package/src/utils/index.ts +2 -0
- package/src/utils/notification.ts +12 -0
- package/src/utils/persistence.ts +75 -0
- package/tsconfig.json +11 -0
- package/dist/bundle.js +0 -1
- package/dist/src/blog/index.d.ts +0 -12
- package/dist/src/cart/index.d.ts +0 -8
- package/dist/src/cart/types.d.ts +0 -42
- package/dist/src/client/index.d.ts +0 -2
- package/dist/src/form/index.d.ts +0 -4
- package/dist/src/form/types.d.ts +0 -19
- package/dist/src/models.d.ts +0 -11
- package/dist/src/products/index.d.ts +0 -13
- package/dist/src/utils/index.d.ts +0 -1
- package/dist/src/utils/notification.d.ts +0 -4
- package/dist/src/utils/persistence.d.ts +0 -28
- package/dist/webpack.config.d.ts +0 -15
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Utils=exports.notificationService=exports.FormTypes=exports.formService=exports.ProductTypes=exports.productService=exports.CartTypes=exports.cartService=exports.PostTypes=exports.blogService=void 0;const e=require("tslib"),r=require("./blog");Object.defineProperty(exports,"blogService",{enumerable:!0,get:function(){return r.blogService}});const t=e.__importStar(require("./blog/types"));exports.PostTypes=t;const o=require("./cart");Object.defineProperty(exports,"cartService",{enumerable:!0,get:function(){return o.cartService}});const i=e.__importStar(require("./cart/types"));exports.CartTypes=i;const s=require("./products");Object.defineProperty(exports,"productService",{enumerable:!0,get:function(){return s.productService}});const c=e.__importStar(require("./products/types"));exports.ProductTypes=c;const p=require("./form");Object.defineProperty(exports,"formService",{enumerable:!0,get:function(){return p.formService}});const n=e.__importStar(require("./form/types"));exports.FormTypes=n;const u=e.__importStar(require("./utils"));exports.Utils=u;const a=require("./utils/notification");Object.defineProperty(exports,"notificationService",{enumerable:!0,get:function(){return a.notificationService}});
|
|
2
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/index.ts"],"sourcesContent":["\r\nimport { blogService } from \"./blog\";\r\nimport * as PostTypes from \"./blog/types\";\r\nimport { cartService } from \"./cart\";\r\nimport * as CartTypes from \"./cart/types\";\r\nimport { productService } from \"./products\";\r\nimport * as ProductTypes from \"./products/types\";\r\nimport { formService } from \"./form\";\r\nimport * as FormTypes from \"./form/types\";\r\nimport * as Utils from \"./utils\";\r\nimport { notificationService } from \"./utils/notification\";\r\n\r\nexport interface PostEventModel {\r\n title: string;\r\n start: Date;\r\n end: Date;\r\n resource: any;\r\n}\r\n\r\n/** cart library */\r\nexport { blogService, PostTypes, cartService, CartTypes, productService, ProductTypes, formService, FormTypes, notificationService, Utils };\r\n"],"names":["blog_1","require","Object","defineProperty","exports","enumerable","get","PostTypes","tslib_1","__importStar","cart_1","CartTypes","products_1","ProductTypes","form_1","FormTypes","Utils","notification_1"],"mappings":"4SACqCA,EAAAC,QAAA,UAmB5BC,OAAAC,eAAAC,QAAA,cAAA,CAAAC,YAAA,EAAAC,IAAA,WAAA,OAnBAN,aAmBW,IAlBpB,MAA0CO,EAAAC,EAAAC,aAAAR,QAAA,iBAkBpBG,QAASG,UAAAA,EAjB/B,MAAqCG,EAAAT,QAAA,UAiBJC,OAAAC,eAAAC,QAAA,cAAA,CAAAC,YAAA,EAAAC,IAAA,WAAA,OAjBxBI,aAiBmC,IAhB5C,MAA0CC,EAAAH,EAAAC,aAAAR,QAAA,iBAgBIG,QAASO,UAAAA,EAfvD,MAA4CC,EAAAX,QAAA,cAeaC,OAAAC,eAAAC,QAAA,iBAAA,CAAAC,YAAA,EAAAC,IAAA,WAAA,OAfhDM,gBAe8D,IAdvE,MAAiDC,EAAAL,EAAAC,aAAAR,QAAA,qBAcwBG,QAAYS,aAAAA,EAbrF,MAAqCC,EAAAb,QAAA,UAakDC,OAAAC,eAAAC,QAAA,cAAA,CAAAC,YAAA,EAAAC,IAAA,WAAA,OAb9EQ,aAayF,IAZlG,MAA0CC,EAAAP,EAAAC,aAAAR,QAAA,iBAY0DG,QAASW,UAAAA,EAX7G,MAAiCC,EAAAR,EAAAC,aAAAR,QAAA,YAWmGG,QAAKY,MAAAA,EAVzI,MAA2DC,EAAAhB,QAAA,wBAUoDC,OAAAC,eAAAC,QAAA,sBAAA,CAAAC,YAAA,EAAAC,IAAA,WAAA,OAVtGW,qBAUyH"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
|
|
3
|
+
declare class PostMetric {
|
|
4
|
+
channel: string;
|
|
5
|
+
key: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
declare class PostMetricResult {
|
|
9
|
+
metrics: PostMetric[];
|
|
10
|
+
}
|
|
11
|
+
declare class ChannelPostStatusInfo {
|
|
12
|
+
id: string;
|
|
13
|
+
channelId: string;
|
|
14
|
+
title: string;
|
|
15
|
+
type: string;
|
|
16
|
+
postId: string;
|
|
17
|
+
status: boolean;
|
|
18
|
+
publishedOn: Date;
|
|
19
|
+
metrics: PostMetric[];
|
|
20
|
+
}
|
|
21
|
+
declare class MediaInfoModel {
|
|
22
|
+
slug: string;
|
|
23
|
+
type: string;
|
|
24
|
+
name: string;
|
|
25
|
+
}
|
|
26
|
+
interface PostModel {
|
|
27
|
+
slug: string;
|
|
28
|
+
status: string;
|
|
29
|
+
category: string;
|
|
30
|
+
featuredImage: string;
|
|
31
|
+
title: string;
|
|
32
|
+
previewContent: string;
|
|
33
|
+
content: string;
|
|
34
|
+
impressions: number;
|
|
35
|
+
channelPosts: ChannelPostStatusInfo[];
|
|
36
|
+
media: MediaInfoModel[];
|
|
37
|
+
views: number;
|
|
38
|
+
likes: number;
|
|
39
|
+
publishedOn: Date;
|
|
40
|
+
tags: string[];
|
|
41
|
+
updatedOn: Date;
|
|
42
|
+
updatedByUserId: string;
|
|
43
|
+
createdByUser?: any;
|
|
44
|
+
createdByUserId: string;
|
|
45
|
+
metrics: PostMetric[];
|
|
46
|
+
id: string;
|
|
47
|
+
refId: string;
|
|
48
|
+
readTime: number;
|
|
49
|
+
createdOn: Date;
|
|
50
|
+
isFeatured: boolean;
|
|
51
|
+
image: string;
|
|
52
|
+
author: {
|
|
53
|
+
name: string;
|
|
54
|
+
id: string;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type types$3_ChannelPostStatusInfo = ChannelPostStatusInfo;
|
|
59
|
+
declare const types$3_ChannelPostStatusInfo: typeof ChannelPostStatusInfo;
|
|
60
|
+
type types$3_MediaInfoModel = MediaInfoModel;
|
|
61
|
+
declare const types$3_MediaInfoModel: typeof MediaInfoModel;
|
|
62
|
+
type types$3_PostMetric = PostMetric;
|
|
63
|
+
declare const types$3_PostMetric: typeof PostMetric;
|
|
64
|
+
type types$3_PostMetricResult = PostMetricResult;
|
|
65
|
+
declare const types$3_PostMetricResult: typeof PostMetricResult;
|
|
66
|
+
type types$3_PostModel = PostModel;
|
|
67
|
+
declare namespace types$3 {
|
|
68
|
+
export { types$3_ChannelPostStatusInfo as ChannelPostStatusInfo, types$3_MediaInfoModel as MediaInfoModel, types$3_PostMetric as PostMetric, types$3_PostMetricResult as PostMetricResult, type types$3_PostModel as PostModel };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare class PagingInfo {
|
|
72
|
+
currentPage: number;
|
|
73
|
+
itemsPerPage: number;
|
|
74
|
+
hasNextPage: boolean;
|
|
75
|
+
totalItems: number;
|
|
76
|
+
constructor(currentPage: number, itemsPerPage: number, hasNextPage: boolean);
|
|
77
|
+
}
|
|
78
|
+
declare class SearchResult<T> {
|
|
79
|
+
items: Array<T>;
|
|
80
|
+
pagingInfo: PagingInfo;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare const blogService: {
|
|
84
|
+
getBlogCategories: () => Promise<string[]>;
|
|
85
|
+
getFeaturedPost: () => Promise<PostModel>;
|
|
86
|
+
getBlogPosts: (count: number) => Promise<SearchResult<PostModel>>;
|
|
87
|
+
getBlogPostsForPage: (count: number, page: number) => Promise<SearchResult<PostModel>>;
|
|
88
|
+
getBlogPostsForCategory: (count: number, category: string) => Promise<SearchResult<PostModel>>;
|
|
89
|
+
getBlogPost: (slug: string | string[] | undefined) => Promise<PostModel>;
|
|
90
|
+
getSimilarPosts: (id: string, count: number) => Promise<PostModel[]>;
|
|
91
|
+
getAllPosts: () => Promise<PostModel[]>;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
interface Cart {
|
|
95
|
+
lineItems: LineItem[];
|
|
96
|
+
total: number;
|
|
97
|
+
currency: string;
|
|
98
|
+
currencySymbol: string;
|
|
99
|
+
updatedOn: string | null;
|
|
100
|
+
updatedByUserId: string | null;
|
|
101
|
+
deletedOn: string | null;
|
|
102
|
+
deletedByUserId: string | null;
|
|
103
|
+
createdByUser: string | null;
|
|
104
|
+
createdByUserId: string | null;
|
|
105
|
+
tenantId: string | null;
|
|
106
|
+
id: string;
|
|
107
|
+
refId: string;
|
|
108
|
+
createdOn: string;
|
|
109
|
+
shippingAddress?: ShippingAddress;
|
|
110
|
+
}
|
|
111
|
+
interface LineItem {
|
|
112
|
+
id: string;
|
|
113
|
+
productId: string;
|
|
114
|
+
productSlug: string;
|
|
115
|
+
productName: string;
|
|
116
|
+
price: number;
|
|
117
|
+
quantity: number;
|
|
118
|
+
productImage: string;
|
|
119
|
+
currency: string;
|
|
120
|
+
currencySymbol: string;
|
|
121
|
+
}
|
|
122
|
+
interface CartBody {
|
|
123
|
+
productId?: string;
|
|
124
|
+
quantity?: number;
|
|
125
|
+
id?: string;
|
|
126
|
+
}
|
|
127
|
+
interface ShippingAddress {
|
|
128
|
+
name?: string;
|
|
129
|
+
email?: string;
|
|
130
|
+
mobile?: string;
|
|
131
|
+
address1?: string;
|
|
132
|
+
city?: string;
|
|
133
|
+
postalCode?: string;
|
|
134
|
+
country?: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
type types$2_Cart = Cart;
|
|
138
|
+
type types$2_CartBody = CartBody;
|
|
139
|
+
type types$2_LineItem = LineItem;
|
|
140
|
+
type types$2_ShippingAddress = ShippingAddress;
|
|
141
|
+
declare namespace types$2 {
|
|
142
|
+
export type { types$2_Cart as Cart, types$2_CartBody as CartBody, types$2_LineItem as LineItem, types$2_ShippingAddress as ShippingAddress };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
declare const cartService: {
|
|
146
|
+
getCart: (id: string) => Promise<Cart>;
|
|
147
|
+
createCart: (body: CartBody) => Promise<Cart>;
|
|
148
|
+
updateCart: (id: string, body: CartBody) => Promise<Cart>;
|
|
149
|
+
deleteCart: (id: string, body?: CartBody) => Promise<Cart>;
|
|
150
|
+
setShippingAddress: (id: string, body?: ShippingAddress) => Promise<Cart>;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
interface ProductVariantModel {
|
|
154
|
+
isActive: boolean;
|
|
155
|
+
isFeatured: boolean;
|
|
156
|
+
slug: string;
|
|
157
|
+
images: string[];
|
|
158
|
+
featuredImage: string;
|
|
159
|
+
title: string;
|
|
160
|
+
previewContent: string;
|
|
161
|
+
content: string;
|
|
162
|
+
price: number;
|
|
163
|
+
weight: number;
|
|
164
|
+
impressions: number;
|
|
165
|
+
views: number;
|
|
166
|
+
likes: number;
|
|
167
|
+
tags: string[];
|
|
168
|
+
id: string;
|
|
169
|
+
}
|
|
170
|
+
interface ProductModel {
|
|
171
|
+
isActive: boolean;
|
|
172
|
+
isFeatured: boolean;
|
|
173
|
+
slug: string;
|
|
174
|
+
type: string;
|
|
175
|
+
category: string;
|
|
176
|
+
images: string[];
|
|
177
|
+
featuredImage: string;
|
|
178
|
+
title: string;
|
|
179
|
+
previewContent: string;
|
|
180
|
+
content: string;
|
|
181
|
+
price: number;
|
|
182
|
+
weight: number;
|
|
183
|
+
impressions: number;
|
|
184
|
+
views: number;
|
|
185
|
+
likes: number;
|
|
186
|
+
publishedOn: Date;
|
|
187
|
+
tags: string[];
|
|
188
|
+
variants: ProductVariantModel[];
|
|
189
|
+
updatedOn: Date;
|
|
190
|
+
updatedByUserId: string;
|
|
191
|
+
createdByUser?: any;
|
|
192
|
+
createdByUserId: string;
|
|
193
|
+
id: string;
|
|
194
|
+
refId: string;
|
|
195
|
+
createdOn: Date;
|
|
196
|
+
}
|
|
197
|
+
interface ProductCategoryModel {
|
|
198
|
+
isActive: boolean;
|
|
199
|
+
slug: string;
|
|
200
|
+
featuredImage: string;
|
|
201
|
+
name: string;
|
|
202
|
+
description: string;
|
|
203
|
+
products: number;
|
|
204
|
+
publishedOn: Date;
|
|
205
|
+
updatedOn: Date;
|
|
206
|
+
updatedByUserId: string;
|
|
207
|
+
createdByUser?: any;
|
|
208
|
+
createdByUserId: string;
|
|
209
|
+
id: string;
|
|
210
|
+
refId: string;
|
|
211
|
+
createdOn: Date;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
type types$1_ProductCategoryModel = ProductCategoryModel;
|
|
215
|
+
type types$1_ProductModel = ProductModel;
|
|
216
|
+
type types$1_ProductVariantModel = ProductVariantModel;
|
|
217
|
+
declare namespace types$1 {
|
|
218
|
+
export type { types$1_ProductCategoryModel as ProductCategoryModel, types$1_ProductModel as ProductModel, types$1_ProductVariantModel as ProductVariantModel };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
declare const productService: {
|
|
222
|
+
getAllProductCategories: () => Promise<ProductCategoryModel[]>;
|
|
223
|
+
getProductCategory: (slug: string | string[] | undefined) => Promise<ProductCategoryModel>;
|
|
224
|
+
getProducts: (count: number) => Promise<SearchResult<ProductModel>>;
|
|
225
|
+
getProductsForPage: (count: number, page: number) => Promise<SearchResult<ProductModel>>;
|
|
226
|
+
searchProducts: (q: string, category: string, count: number, page: number, sort: string) => Promise<SearchResult<ProductModel>>;
|
|
227
|
+
searchProductsByCategorySlug: (categorySlug: string, count: number, page: number, sort: string) => Promise<SearchResult<ProductModel>>;
|
|
228
|
+
getAllProducts: () => Promise<ProductModel[]>;
|
|
229
|
+
getProduct: (slug: string | string[] | undefined) => Promise<ProductModel>;
|
|
230
|
+
getSimilarProducts: (id: string, count: number) => Promise<ProductModel[]>;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
declare class ContactUsModel {
|
|
234
|
+
name: string;
|
|
235
|
+
email: string;
|
|
236
|
+
mobile: string;
|
|
237
|
+
whatsapp: string;
|
|
238
|
+
message: string;
|
|
239
|
+
}
|
|
240
|
+
declare const ContactUsSchema: yup.ObjectSchema<{
|
|
241
|
+
name: string;
|
|
242
|
+
email: string;
|
|
243
|
+
mobile: string;
|
|
244
|
+
message: string;
|
|
245
|
+
}, yup.AnyObject, {
|
|
246
|
+
name: undefined;
|
|
247
|
+
email: undefined;
|
|
248
|
+
mobile: undefined;
|
|
249
|
+
message: undefined;
|
|
250
|
+
}, "">;
|
|
251
|
+
|
|
252
|
+
type types_ContactUsModel = ContactUsModel;
|
|
253
|
+
declare const types_ContactUsModel: typeof ContactUsModel;
|
|
254
|
+
declare const types_ContactUsSchema: typeof ContactUsSchema;
|
|
255
|
+
declare namespace types {
|
|
256
|
+
export { types_ContactUsModel as ContactUsModel, types_ContactUsSchema as ContactUsSchema };
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
declare const formService: {
|
|
260
|
+
post: (formId: string, formData: ContactUsModel) => Promise<any>;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Persistence layer with expiration based on localStorage.
|
|
265
|
+
*/
|
|
266
|
+
declare class NamespacedLocalStorage {
|
|
267
|
+
localStorage: any;
|
|
268
|
+
key: string;
|
|
269
|
+
constructor(localStorage: any, key: string);
|
|
270
|
+
_makeKey(key: string): string;
|
|
271
|
+
getItem(name: any): any;
|
|
272
|
+
setItem(name: any, value: any): any;
|
|
273
|
+
removeItem(name: any): any;
|
|
274
|
+
}
|
|
275
|
+
declare class BrowserPersistence {
|
|
276
|
+
static KEY: string;
|
|
277
|
+
storage: NamespacedLocalStorage;
|
|
278
|
+
constructor(localStorage?: Storage);
|
|
279
|
+
getRawItem(name: string): any;
|
|
280
|
+
getItem(name: string): any;
|
|
281
|
+
setItem(name: string, value: any, ttl?: any): void;
|
|
282
|
+
removeItem(name: any): void;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
type index_BrowserPersistence = BrowserPersistence;
|
|
286
|
+
declare const index_BrowserPersistence: typeof BrowserPersistence;
|
|
287
|
+
declare namespace index {
|
|
288
|
+
export { index_BrowserPersistence as BrowserPersistence };
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
declare const notificationService: {
|
|
292
|
+
success: (message: string) => void;
|
|
293
|
+
error: (message: string) => void;
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
interface PostEventModel {
|
|
297
|
+
title: string;
|
|
298
|
+
start: Date;
|
|
299
|
+
end: Date;
|
|
300
|
+
resource: any;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export { types$2 as CartTypes, types as FormTypes, type PostEventModel, types$3 as PostTypes, types$1 as ProductTypes, index as Utils, blogService, cartService, formService, notificationService, productService };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.Utils=exports.notificationService=exports.FormTypes=exports.formService=exports.ProductTypes=exports.productService=exports.CartTypes=exports.cartService=exports.PostTypes=exports.blogService=void 0;const e=require("tslib"),r=require("./blog");Object.defineProperty(exports,"blogService",{enumerable:!0,get:function(){return r.blogService}});const t=e.__importStar(require("./blog/types"));exports.PostTypes=t;const o=require("./cart");Object.defineProperty(exports,"cartService",{enumerable:!0,get:function(){return o.cartService}});const i=e.__importStar(require("./cart/types"));exports.CartTypes=i;const s=require("./products");Object.defineProperty(exports,"productService",{enumerable:!0,get:function(){return s.productService}});const c=e.__importStar(require("./products/types"));exports.ProductTypes=c;const p=require("./form");Object.defineProperty(exports,"formService",{enumerable:!0,get:function(){return p.formService}});const n=e.__importStar(require("./form/types"));exports.FormTypes=n;const u=e.__importStar(require("./utils"));exports.Utils=u;const a=require("./utils/notification");Object.defineProperty(exports,"notificationService",{enumerable:!0,get:function(){return a.notificationService}});
|
|
2
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["\r\nimport { blogService } from \"./blog\";\r\nimport * as PostTypes from \"./blog/types\";\r\nimport { cartService } from \"./cart\";\r\nimport * as CartTypes from \"./cart/types\";\r\nimport { productService } from \"./products\";\r\nimport * as ProductTypes from \"./products/types\";\r\nimport { formService } from \"./form\";\r\nimport * as FormTypes from \"./form/types\";\r\nimport * as Utils from \"./utils\";\r\nimport { notificationService } from \"./utils/notification\";\r\n\r\nexport interface PostEventModel {\r\n title: string;\r\n start: Date;\r\n end: Date;\r\n resource: any;\r\n}\r\n\r\n/** cart library */\r\nexport { blogService, PostTypes, cartService, CartTypes, productService, ProductTypes, formService, FormTypes, notificationService, Utils };\r\n"],"names":["blog_1","require","Object","defineProperty","exports","enumerable","get","PostTypes","tslib_1","__importStar","cart_1","CartTypes","products_1","ProductTypes","form_1","FormTypes","Utils","notification_1"],"mappings":"+RACqCA,EAAAC,QAAA,UAmB5BC,OAAAC,eAAAC,QAAA,cAAA,CAAAC,YAAA,EAAAC,IAAA,WAAA,OAnBAN,aAmBW,IAlBpB,MAA0CO,EAAAC,EAAAC,aAAAR,QAAA,iBAkBpBG,QAASG,UAAAA,EAjB/B,MAAqCG,EAAAT,QAAA,UAiBJC,OAAAC,eAAAC,QAAA,cAAA,CAAAC,YAAA,EAAAC,IAAA,WAAA,OAjBxBI,aAiBmC,IAhB5C,MAA0CC,EAAAH,EAAAC,aAAAR,QAAA,iBAgBIG,QAASO,UAAAA,EAfvD,MAA4CC,EAAAX,QAAA,cAeaC,OAAAC,eAAAC,QAAA,iBAAA,CAAAC,YAAA,EAAAC,IAAA,WAAA,OAfhDM,gBAe8D,IAdvE,MAAiDC,EAAAL,EAAAC,aAAAR,QAAA,qBAcwBG,QAAYS,aAAAA,EAbrF,MAAqCC,EAAAb,QAAA,UAakDC,OAAAC,eAAAC,QAAA,cAAA,CAAAC,YAAA,EAAAC,IAAA,WAAA,OAb9EQ,aAayF,IAZlG,MAA0CC,EAAAP,EAAAC,aAAAR,QAAA,iBAY0DG,QAASW,UAAAA,EAX7G,MAAiCC,EAAAR,EAAAC,aAAAR,QAAA,YAWmGG,QAAKY,MAAAA,EAVzI,MAA2DC,EAAAhB,QAAA,wBAUoDC,OAAAC,eAAAC,QAAA,sBAAA,CAAAC,YAAA,EAAAC,IAAA,WAAA,OAVtGW,qBAUyH"}
|
package/package.json
CHANGED
|
@@ -1,37 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@leadmetrics-ai/website-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "SDK for
|
|
5
|
-
"main": "
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"typescript": "^5.5.4",
|
|
29
|
-
"webpack": "^5.93.0",
|
|
30
|
-
"webpack-cli": "^5.1.4"
|
|
31
|
-
},
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"axios": "^1.6.2",
|
|
34
|
-
"react-toastify": "^9.1.3",
|
|
35
|
-
"yup": "^1.3.3"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@leadmetrics-ai/website-sdk",
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"description": "Leadmetrics SDK for building Websites",
|
|
5
|
+
"main": "dist/bundle.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "rollup --config",
|
|
9
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "Leadmetrics",
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"axios": "^1.7.7",
|
|
16
|
+
"yup": "^1.4.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
20
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
21
|
+
"@types/node": "^22.5.4",
|
|
22
|
+
"rollup": "^4.21.2",
|
|
23
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
24
|
+
"tslib": "^2.7.0",
|
|
25
|
+
"typescript": "^5.5.4"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineConfig } from 'rollup';
|
|
2
|
+
import typescript from '@rollup/plugin-typescript';
|
|
3
|
+
import dts from 'rollup-plugin-dts';
|
|
4
|
+
import terser from '@rollup/plugin-terser';
|
|
5
|
+
|
|
6
|
+
export default defineConfig([
|
|
7
|
+
{
|
|
8
|
+
input: 'src/index.ts',
|
|
9
|
+
output: [
|
|
10
|
+
{
|
|
11
|
+
file: 'dist/index.cjs.js',
|
|
12
|
+
format: 'cjs',
|
|
13
|
+
sourcemap: true,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
file: 'dist/index.esm.js',
|
|
17
|
+
format: 'esm',
|
|
18
|
+
sourcemap: true,
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
plugins: [
|
|
22
|
+
typescript(),
|
|
23
|
+
terser() // Optional, for minifying the output
|
|
24
|
+
],
|
|
25
|
+
external: [], // Add external dependencies here
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
input: 'src/index.ts',
|
|
29
|
+
output: {
|
|
30
|
+
file: 'dist/index.d.ts',
|
|
31
|
+
format: 'es',
|
|
32
|
+
},
|
|
33
|
+
plugins: [dts()],
|
|
34
|
+
}
|
|
35
|
+
]);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import client from "../client";
|
|
2
|
+
import { PostModel } from "./types";
|
|
3
|
+
import { SearchResult } from "../models";
|
|
4
|
+
|
|
5
|
+
const getBlogCategories = async () => {
|
|
6
|
+
return await client.get<string[]>("posts/categories").then((res) => res.data);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const getFeaturedPost = async () => {
|
|
10
|
+
return await client.get<PostModel>("posts/featured").then((res) => res.data);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const getBlogPosts = async (count: number) => {
|
|
14
|
+
return await client
|
|
15
|
+
.get<SearchResult<PostModel>>("posts?size=" + count)
|
|
16
|
+
.then((res) => res.data);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const getBlogPostsForPage = async (count: number, page: number) => {
|
|
20
|
+
return await client
|
|
21
|
+
.get<SearchResult<PostModel>>("posts?size=" + count + "&page=" + page)
|
|
22
|
+
.then((res) => res.data);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const getBlogPostsForCategory = async (count: number, category: string) => {
|
|
26
|
+
return await client
|
|
27
|
+
.get<SearchResult<PostModel>>(
|
|
28
|
+
"posts?size=" + count + "&category=" + category
|
|
29
|
+
)
|
|
30
|
+
.then((res) => res.data);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const getBlogPost = async (slug: string | string[] | undefined) => {
|
|
34
|
+
return await client.get<PostModel>("posts/" + slug).then((res) => res.data);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const getSimilarPosts = async (id: string, count: number) => {
|
|
38
|
+
return await client
|
|
39
|
+
.get<PostModel[]>("posts/" + id + "/similar?count=" + count)
|
|
40
|
+
.then((res) => res.data);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const getAllPosts = async () => {
|
|
44
|
+
return await client.get<PostModel[]>("posts/all").then((res) => res.data);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const blogService = {
|
|
48
|
+
getBlogCategories,
|
|
49
|
+
getFeaturedPost,
|
|
50
|
+
getBlogPosts,
|
|
51
|
+
getBlogPostsForPage,
|
|
52
|
+
getBlogPostsForCategory,
|
|
53
|
+
getBlogPost,
|
|
54
|
+
getSimilarPosts,
|
|
55
|
+
getAllPosts,
|
|
56
|
+
};
|
|
@@ -1,54 +1,58 @@
|
|
|
1
|
-
export
|
|
2
|
-
channel
|
|
3
|
-
key
|
|
4
|
-
value
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
export class PostMetric {
|
|
2
|
+
channel!: string;
|
|
3
|
+
key!: string;
|
|
4
|
+
value!: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export class PostMetricResult {
|
|
8
|
+
metrics!: PostMetric[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class ChannelPostStatusInfo {
|
|
12
|
+
id!: string;
|
|
13
|
+
channelId!: string;
|
|
14
|
+
title!: string;
|
|
15
|
+
type!: string;
|
|
16
|
+
postId!: string;
|
|
17
|
+
status!: boolean;
|
|
18
|
+
publishedOn!: Date;
|
|
19
|
+
metrics!: PostMetric[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class MediaInfoModel {
|
|
23
|
+
slug!: string;
|
|
24
|
+
type!: string;
|
|
25
|
+
name!: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PostModel {
|
|
29
|
+
slug: string;
|
|
30
|
+
status: string;
|
|
31
|
+
category: string;
|
|
32
|
+
featuredImage: string;
|
|
33
|
+
title: string;
|
|
34
|
+
previewContent: string;
|
|
35
|
+
content: string;
|
|
36
|
+
impressions: number;
|
|
37
|
+
channelPosts: ChannelPostStatusInfo[];
|
|
38
|
+
media: MediaInfoModel[];
|
|
39
|
+
views: number;
|
|
40
|
+
likes: number;
|
|
41
|
+
publishedOn: Date;
|
|
42
|
+
tags: string[];
|
|
43
|
+
updatedOn: Date;
|
|
44
|
+
updatedByUserId: string;
|
|
45
|
+
createdByUser?: any;
|
|
46
|
+
createdByUserId: string;
|
|
47
|
+
metrics: PostMetric[];
|
|
48
|
+
id: string;
|
|
49
|
+
refId: string;
|
|
50
|
+
readTime: number;
|
|
51
|
+
createdOn: Date;
|
|
52
|
+
isFeatured: boolean;
|
|
53
|
+
image: string;
|
|
54
|
+
author: {
|
|
55
|
+
name: string;
|
|
56
|
+
id: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import client from "../client";
|
|
2
|
+
import { Cart, CartBody, ShippingAddress } from "./types";
|
|
3
|
+
|
|
4
|
+
const getCart = async (id: string) => {
|
|
5
|
+
return await client
|
|
6
|
+
.get<Cart>(`carts/${id}`)
|
|
7
|
+
.then((res) => res.data);
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const createCart = async (body: CartBody) => {
|
|
11
|
+
return await client
|
|
12
|
+
.post<Cart>(`carts`, body)
|
|
13
|
+
.then((res) => res.data);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const updateCart = async (id: string, body: CartBody) => {
|
|
17
|
+
return await client
|
|
18
|
+
.put<Cart>(`carts/${id}/line-items`, body)
|
|
19
|
+
.then((res) => res.data);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const deleteCart = async (id: string, body: CartBody = {}) => {
|
|
23
|
+
return await client
|
|
24
|
+
.delete<Cart>(`carts/${id}`, { data: body })
|
|
25
|
+
.then((res) => res.data);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const setShippingAddress = async (id: string, body: ShippingAddress = {}) => {
|
|
29
|
+
return await client
|
|
30
|
+
.put<Cart>(`carts/${id}/shipping-address`, body)
|
|
31
|
+
.then((res) => res.data);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const cartService = {
|
|
35
|
+
getCart,
|
|
36
|
+
createCart,
|
|
37
|
+
updateCart,
|
|
38
|
+
deleteCart,
|
|
39
|
+
setShippingAddress
|
|
40
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface Cart {
|
|
2
|
+
lineItems: LineItem[]
|
|
3
|
+
total: number
|
|
4
|
+
currency: string
|
|
5
|
+
currencySymbol: string
|
|
6
|
+
updatedOn: string | null
|
|
7
|
+
updatedByUserId: string | null
|
|
8
|
+
deletedOn: string | null
|
|
9
|
+
deletedByUserId: string | null
|
|
10
|
+
createdByUser: string | null
|
|
11
|
+
createdByUserId: string | null
|
|
12
|
+
tenantId: string | null
|
|
13
|
+
id: string
|
|
14
|
+
refId: string
|
|
15
|
+
createdOn: string
|
|
16
|
+
shippingAddress?: ShippingAddress
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface LineItem {
|
|
20
|
+
id: string
|
|
21
|
+
productId: string
|
|
22
|
+
productSlug: string
|
|
23
|
+
productName: string
|
|
24
|
+
price: number
|
|
25
|
+
quantity: number
|
|
26
|
+
productImage: string
|
|
27
|
+
currency: string
|
|
28
|
+
currencySymbol: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface CartBody {
|
|
32
|
+
productId?: string
|
|
33
|
+
quantity?: number
|
|
34
|
+
id?: string
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ShippingAddress {
|
|
38
|
+
name?: string
|
|
39
|
+
email?: string
|
|
40
|
+
mobile?: string
|
|
41
|
+
address1?: string
|
|
42
|
+
city?: string
|
|
43
|
+
postalCode?: string
|
|
44
|
+
country?: string
|
|
45
|
+
}
|