@longvansoftware/storefront-js-client 3.0.7 → 3.0.9

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 (36) hide show
  1. package/README.md +221 -221
  2. package/dist/src/graphql/auth/mutations.js +191 -191
  3. package/dist/src/graphql/auth/queries.js +59 -59
  4. package/dist/src/graphql/campaign/mutations.js +26 -26
  5. package/dist/src/graphql/campaign/queries.js +375 -375
  6. package/dist/src/graphql/cashbook/queries.js +93 -93
  7. package/dist/src/graphql/cloud/mutations.js +103 -103
  8. package/dist/src/graphql/cloud/queries.js +112 -112
  9. package/dist/src/graphql/computing/mutations.js +96 -96
  10. package/dist/src/graphql/computing/queries.js +41 -41
  11. package/dist/src/graphql/crm/mutations.js +813 -813
  12. package/dist/src/graphql/crm/queries.js +661 -661
  13. package/dist/src/graphql/payment/mutations.js +146 -146
  14. package/dist/src/graphql/payment/queries.js +116 -116
  15. package/dist/src/graphql/paymentV2/mutations.js +47 -47
  16. package/dist/src/graphql/paymentV2/queries.js +176 -176
  17. package/dist/src/graphql/product/mutations.js +94 -94
  18. package/dist/src/graphql/product/queries.js +472 -472
  19. package/dist/src/graphql/service/mutations.js +304 -304
  20. package/dist/src/graphql/service/queries.js +131 -131
  21. package/dist/src/graphql/store/mutations.js +24 -24
  22. package/dist/src/graphql/store/queries.js +24 -24
  23. package/dist/src/graphql/user/mutations.js +142 -142
  24. package/dist/src/graphql/user/queries.js +298 -298
  25. package/dist/src/lib/auth/index.d.ts +1 -1
  26. package/dist/src/lib/auth/index.js +1 -1
  27. package/dist/src/lib/serviceSDK.js +12 -12
  28. package/package.json +44 -43
  29. package/dist/src/graphql/fragments/product.d.ts +0 -38
  30. package/dist/src/graphql/fragments/product.js +0 -196
  31. package/dist/src/lib/shareZalo/index.d.ts +0 -5
  32. package/dist/src/lib/shareZalo/index.js +0 -32
  33. package/dist/src/types/common.d.ts +0 -264
  34. package/dist/src/types/common.js +0 -35
  35. package/dist/src/utils/errorHandler.d.ts +0 -64
  36. package/dist/src/utils/errorHandler.js +0 -197
package/package.json CHANGED
@@ -1,43 +1,44 @@
1
- {
2
- "name": "@longvansoftware/storefront-js-client",
3
- "version": "3.0.7",
4
- "main": "dist/src/index.js",
5
- "types": "dist/src/index.d.ts",
6
- "files": [
7
- "dist/**/*.d.ts",
8
- "dist/**/*.js"
9
- ],
10
- "directories": {
11
- "test": "jest"
12
- },
13
- "scripts": {
14
- "test": "jest",
15
- "build": "tsc",
16
- "publish": "npm run build && npm publish"
17
- },
18
- "keywords": [],
19
- "author": "",
20
- "license": "ISC",
21
- "dependencies": {
22
- "@apollo/client": "3.9.11",
23
- "apollo-boost": "^0.4.9",
24
- "axios": "^1.6.8",
25
- "cross-fetch": "^4.0.0",
26
- "crypto-js": "^4.2.0",
27
- "graphql": "^15.8.0",
28
- "graphql-request": "^6.1.0",
29
- "graphql-tag": "^2.12.6",
30
- "react": "^18.2.0",
31
- "ts-node": "^10.9.2"
32
- },
33
- "devDependencies": {
34
- "@types/axios": "^0.14.0",
35
- "@types/crypto-js": "^4.2.2",
36
- "@types/jest": "^29.5.12",
37
- "@types/node": "^20.12.7",
38
- "jest": "^29.7.0",
39
- "ts-jest": "^29.1.2",
40
- "typescript": "^5.4.5"
41
- },
42
- "description": ""
43
- }
1
+ {
2
+ "name": "@longvansoftware/storefront-js-client",
3
+ "version": "3.0.9",
4
+ "main": "dist/src/index.js",
5
+ "types": "dist/src/index.d.ts",
6
+ "files": [
7
+ "dist/**/*.d.ts",
8
+ "dist/**/*.js"
9
+ ],
10
+ "directories": {
11
+ "test": "jest"
12
+ },
13
+ "scripts": {
14
+ "test": "jest",
15
+ "build": "tsc",
16
+ "publish": "npm run build && npm publish"
17
+ },
18
+ "keywords": [],
19
+ "author": "",
20
+ "license": "ISC",
21
+ "dependencies": {
22
+ "@apollo/client": "3.9.11",
23
+ "apollo-boost": "^0.4.9",
24
+ "axios": "^1.6.8",
25
+ "cross-fetch": "^4.0.0",
26
+ "crypto-js": "^4.2.0",
27
+ "graphql": "^15.8.0",
28
+ "graphql-request": "^6.1.0",
29
+ "graphql-tag": "^2.12.6",
30
+ "react": "^18.2.0",
31
+ "ts-node": "^10.9.2"
32
+ },
33
+ "devDependencies": {
34
+ "@types/axios": "^0.14.0",
35
+ "@types/crypto-js": "^4.2.2",
36
+ "@types/jest": "^29.5.12",
37
+ "@types/node": "^20.12.7",
38
+ "jest": "^29.7.0",
39
+ "ts-jest": "^29.1.2",
40
+ "typescript": "^5.4.5"
41
+ },
42
+ "description": "",
43
+ "packageManager": "yarn@4.7.0+sha512.5a0afa1d4c1d844b3447ee3319633797bcd6385d9a44be07993ae52ff4facabccafb4af5dcd1c2f9a94ac113e5e9ff56f6130431905884414229e284e37bb7c9"
44
+ }
@@ -1,38 +0,0 @@
1
- /**
2
- * Common product fields fragment
3
- * Used across multiple product queries to reduce duplication
4
- */
5
- export declare const PRODUCT_CORE_FIELDS: import("graphql").DocumentNode;
6
- /**
7
- * Product attributes fragment
8
- */
9
- export declare const PRODUCT_ATTRIBUTES: import("graphql").DocumentNode;
10
- /**
11
- * Product variants fragment
12
- */
13
- export declare const PRODUCT_VARIANTS: import("graphql").DocumentNode;
14
- /**
15
- * Product feature types fragment
16
- */
17
- export declare const PRODUCT_FEATURE_TYPES: import("graphql").DocumentNode;
18
- /**
19
- * Product categories fragment
20
- */
21
- export declare const PRODUCT_CATEGORIES: import("graphql").DocumentNode;
22
- /**
23
- * Product unit fragment
24
- */
25
- export declare const PRODUCT_UNIT: import("graphql").DocumentNode;
26
- /**
27
- * Complete product details fragment
28
- * Combines all product fragments for detailed queries
29
- */
30
- export declare const PRODUCT_FULL_DETAILS: import("graphql").DocumentNode;
31
- /**
32
- * Simple product fields for list views
33
- */
34
- export declare const PRODUCT_SIMPLE_FIELDS: import("graphql").DocumentNode;
35
- /**
36
- * Extended product fields for getProducts query
37
- */
38
- export declare const PRODUCT_EXTENDED_FIELDS: import("graphql").DocumentNode;
@@ -1,196 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PRODUCT_EXTENDED_FIELDS = exports.PRODUCT_SIMPLE_FIELDS = exports.PRODUCT_FULL_DETAILS = exports.PRODUCT_UNIT = exports.PRODUCT_CATEGORIES = exports.PRODUCT_FEATURE_TYPES = exports.PRODUCT_VARIANTS = exports.PRODUCT_ATTRIBUTES = exports.PRODUCT_CORE_FIELDS = void 0;
4
- const graphql_tag_1 = require("graphql-tag");
5
- /**
6
- * Common product fields fragment
7
- * Used across multiple product queries to reduce duplication
8
- */
9
- exports.PRODUCT_CORE_FIELDS = (0, graphql_tag_1.gql) `
10
- fragment ProductCoreFields on Product {
11
- id
12
- title
13
- description
14
- sku
15
- shortDescription
16
- weight
17
- width
18
- depth
19
- height
20
- vat
21
- qualify
22
- parentId
23
- handle
24
- price
25
- options
26
- optionsRelationship
27
- compareAtPrice
28
- featuredImage
29
- images
30
- }
31
- `;
32
- /**
33
- * Product attributes fragment
34
- */
35
- exports.PRODUCT_ATTRIBUTES = (0, graphql_tag_1.gql) `
36
- fragment ProductAttributes on Product {
37
- productAttributes {
38
- attributeName
39
- attributeValue
40
- }
41
- }
42
- `;
43
- /**
44
- * Product variants fragment
45
- */
46
- exports.PRODUCT_VARIANTS = (0, graphql_tag_1.gql) `
47
- fragment ProductVariants on Product {
48
- variants {
49
- id
50
- handle
51
- title
52
- price
53
- compareAtPrice
54
- options
55
- optionsIds
56
- featuredImage
57
- sku
58
- }
59
- }
60
- `;
61
- /**
62
- * Product feature types fragment
63
- */
64
- exports.PRODUCT_FEATURE_TYPES = (0, graphql_tag_1.gql) `
65
- fragment ProductFeatureTypes on Product {
66
- featureTypes {
67
- id
68
- name
69
- values
70
- valuesFull {
71
- id
72
- name
73
- }
74
- }
75
- }
76
- `;
77
- /**
78
- * Product categories fragment
79
- */
80
- exports.PRODUCT_CATEGORIES = (0, graphql_tag_1.gql) `
81
- fragment ProductCategories on Product {
82
- categories {
83
- id
84
- title
85
- handle
86
- }
87
- }
88
- `;
89
- /**
90
- * Product unit fragment
91
- */
92
- exports.PRODUCT_UNIT = (0, graphql_tag_1.gql) `
93
- fragment ProductUnit on Product {
94
- unitDTO {
95
- id
96
- name
97
- }
98
- }
99
- `;
100
- /**
101
- * Complete product details fragment
102
- * Combines all product fragments for detailed queries
103
- */
104
- exports.PRODUCT_FULL_DETAILS = (0, graphql_tag_1.gql) `
105
- fragment ProductFullDetails on Product {
106
- ...ProductCoreFields
107
- ...ProductAttributes
108
- ...ProductVariants
109
- ...ProductFeatureTypes
110
- ...ProductCategories
111
- ...ProductUnit
112
- }
113
- ${exports.PRODUCT_CORE_FIELDS}
114
- ${exports.PRODUCT_ATTRIBUTES}
115
- ${exports.PRODUCT_VARIANTS}
116
- ${exports.PRODUCT_FEATURE_TYPES}
117
- ${exports.PRODUCT_CATEGORIES}
118
- ${exports.PRODUCT_UNIT}
119
- `;
120
- /**
121
- * Simple product fields for list views
122
- */
123
- exports.PRODUCT_SIMPLE_FIELDS = (0, graphql_tag_1.gql) `
124
- fragment ProductSimpleFields on Product {
125
- id
126
- title
127
- sku
128
- shortDescription
129
- description
130
- subType
131
- vat
132
- qualify
133
- parentId
134
- handle
135
- price
136
- compareAtPrice
137
- priceType
138
- priceTypeName
139
- featuredImage
140
- optionsRelationship
141
- images
142
- }
143
- `;
144
- /**
145
- * Extended product fields for getProducts query
146
- */
147
- exports.PRODUCT_EXTENDED_FIELDS = (0, graphql_tag_1.gql) `
148
- fragment ProductExtendedFields on Product {
149
- id
150
- title
151
- subType
152
- description
153
- sku
154
- shortDescription
155
- weight
156
- width
157
- depth
158
- height
159
- vat
160
- qualify
161
- parentId
162
- handle
163
- price
164
- priceType
165
- salePolicy
166
- priceTypeName
167
- priceVaries
168
- available
169
- tags
170
- options
171
- optionsRelationship
172
- compareAtPrice
173
- featuredImage
174
- images
175
- categories {
176
- id
177
- title
178
- image
179
- icon
180
- parentId
181
- level
182
- handle
183
- description
184
- }
185
- groups {
186
- id
187
- name
188
- policy
189
- image
190
- }
191
- unitDTO {
192
- id
193
- name
194
- }
195
- }
196
- `;
@@ -1,5 +0,0 @@
1
- import { Service } from "../serviceSDK";
2
- export declare class ShareZaloService extends Service {
3
- constructor(endpoint: string, orgId: string, storeId: string);
4
- shareOrder(dataRequet: any): Promise<any>;
5
- }
@@ -1,32 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ShareZaloService = void 0;
13
- const serviceSDK_1 = require("../serviceSDK");
14
- class ShareZaloService extends serviceSDK_1.Service {
15
- constructor(endpoint, orgId, storeId) {
16
- super(endpoint, orgId, storeId);
17
- }
18
- shareOrder(dataRequet) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- const endpoint = ``;
21
- const method = "POST";
22
- try {
23
- const response = yield this.restApiCallWithNoHeader(endpoint, method, dataRequet);
24
- return response;
25
- }
26
- catch (error) {
27
- throw error;
28
- }
29
- });
30
- }
31
- }
32
- exports.ShareZaloService = ShareZaloService;
@@ -1,264 +0,0 @@
1
- /**
2
- * Common types used across the SDK
3
- */
4
- /**
5
- * Environment configuration
6
- */
7
- export type Environment = 'dev' | 'live';
8
- /**
9
- * HTTP methods supported by REST API calls
10
- */
11
- export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
12
- /**
13
- * Pagination parameters
14
- */
15
- export interface PaginationParams {
16
- currentPage?: number;
17
- maxResult?: number;
18
- pageSize?: number;
19
- }
20
- /**
21
- * Pagination response
22
- */
23
- export interface PaginationResponse<T> {
24
- total: number;
25
- currentPage: number;
26
- maxResult: number;
27
- totalPage: number;
28
- data: T[];
29
- }
30
- /**
31
- * Search parameters
32
- */
33
- export interface SearchParams extends PaginationParams {
34
- keyword?: string;
35
- sortBy?: string;
36
- sortOrder?: 'ASC' | 'DESC';
37
- }
38
- /**
39
- * API Response wrapper
40
- */
41
- export interface ApiResponse<T = any> {
42
- success: boolean;
43
- data?: T;
44
- message?: string;
45
- errors?: string[];
46
- }
47
- /**
48
- * Service configuration
49
- */
50
- export interface ServiceConfig {
51
- endpoint: string;
52
- orgId: string;
53
- storeId: string;
54
- token?: string;
55
- }
56
- /**
57
- * GraphQL variables base interface
58
- */
59
- export interface GraphQLVariables {
60
- partnerId?: string;
61
- storeChannel?: string;
62
- [key: string]: any;
63
- }
64
- /**
65
- * REST API headers
66
- */
67
- export interface RestApiHeaders {
68
- 'Content-Type'?: string;
69
- 'Authorization'?: string;
70
- 'PartnerId'?: string;
71
- 'Partner-Id'?: string;
72
- 'X-Ecomos-Access-Token'?: string;
73
- [key: string]: string | undefined;
74
- }
75
- /**
76
- * File upload configuration
77
- */
78
- export interface FileUploadConfig {
79
- maxSize?: number;
80
- allowedTypes?: string[];
81
- multiple?: boolean;
82
- }
83
- /**
84
- * Cache configuration
85
- */
86
- export interface CacheConfig {
87
- ttl?: number;
88
- maxSize?: number;
89
- enabled?: boolean;
90
- }
91
- /**
92
- * Retry configuration
93
- */
94
- export interface RetryConfig {
95
- maxRetries?: number;
96
- baseDelay?: number;
97
- maxDelay?: number;
98
- exponentialBackoff?: boolean;
99
- }
100
- /**
101
- * SDK Configuration
102
- */
103
- export interface SDKConfig {
104
- orgId: string;
105
- storeId: string;
106
- environment: Environment;
107
- cache?: CacheConfig;
108
- retry?: RetryConfig;
109
- timeout?: number;
110
- }
111
- /**
112
- * Service method options
113
- */
114
- export interface ServiceMethodOptions {
115
- timeout?: number;
116
- retry?: RetryConfig;
117
- cache?: boolean;
118
- headers?: RestApiHeaders;
119
- }
120
- /**
121
- * Base entity interface
122
- */
123
- export interface BaseEntity {
124
- id: string;
125
- createdAt?: string;
126
- updatedAt?: string;
127
- createdBy?: string;
128
- updatedBy?: string;
129
- }
130
- /**
131
- * Address interface
132
- */
133
- export interface Address {
134
- street?: string;
135
- city?: string;
136
- state?: string;
137
- country?: string;
138
- postalCode?: string;
139
- fullAddress?: string;
140
- }
141
- /**
142
- * Contact information
143
- */
144
- export interface ContactInfo {
145
- email?: string;
146
- phone?: string;
147
- website?: string;
148
- }
149
- /**
150
- * Money/Price interface
151
- */
152
- export interface Money {
153
- amount: number;
154
- currency?: string;
155
- formatted?: string;
156
- }
157
- /**
158
- * Image interface
159
- */
160
- export interface Image {
161
- id?: string;
162
- url: string;
163
- alt?: string;
164
- width?: number;
165
- height?: number;
166
- size?: number;
167
- }
168
- /**
169
- * Category interface
170
- */
171
- export interface Category extends BaseEntity {
172
- title: string;
173
- handle?: string;
174
- description?: string;
175
- image?: string;
176
- icon?: string;
177
- parentId?: string;
178
- level?: number;
179
- children?: Category[];
180
- }
181
- /**
182
- * Tag interface
183
- */
184
- export interface Tag {
185
- id: string;
186
- name: string;
187
- color?: string;
188
- }
189
- /**
190
- * Attribute interface
191
- */
192
- export interface Attribute {
193
- name: string;
194
- value: string;
195
- type?: string;
196
- }
197
- /**
198
- * Unit interface
199
- */
200
- export interface Unit {
201
- id: string;
202
- name: string;
203
- symbol?: string;
204
- }
205
- /**
206
- * Status enum
207
- */
208
- export declare enum Status {
209
- ACTIVE = "ACTIVE",
210
- INACTIVE = "INACTIVE",
211
- PENDING = "PENDING",
212
- DRAFT = "DRAFT",
213
- PUBLISHED = "PUBLISHED",
214
- ARCHIVED = "ARCHIVED"
215
- }
216
- /**
217
- * Gender enum
218
- */
219
- export declare enum Gender {
220
- MALE = "MALE",
221
- FEMALE = "FEMALE",
222
- OTHER = "OTHER"
223
- }
224
- /**
225
- * Sort order enum
226
- */
227
- export declare enum SortOrder {
228
- ASC = "ASC",
229
- DESC = "DESC"
230
- }
231
- /**
232
- * Utility type for making all properties optional
233
- */
234
- export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
235
- /**
236
- * Utility type for making all properties required
237
- */
238
- export type RequiredBy<T, K extends keyof T> = T & Required<Pick<T, K>>;
239
- /**
240
- * Utility type for nullable properties
241
- */
242
- export type Nullable<T> = T | null;
243
- /**
244
- * Utility type for optional properties
245
- */
246
- export type Optional<T> = T | undefined;
247
- /**
248
- * Deep partial type
249
- */
250
- export type DeepPartial<T> = {
251
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
252
- };
253
- /**
254
- * Promise result type
255
- */
256
- export type PromiseResult<T> = Promise<T>;
257
- /**
258
- * Callback function type
259
- */
260
- export type Callback<T = void> = (error?: Error, result?: T) => void;
261
- /**
262
- * Event handler type
263
- */
264
- export type EventHandler<T = any> = (event: T) => void;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- /**
3
- * Common types used across the SDK
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SortOrder = exports.Gender = exports.Status = void 0;
7
- /**
8
- * Status enum
9
- */
10
- var Status;
11
- (function (Status) {
12
- Status["ACTIVE"] = "ACTIVE";
13
- Status["INACTIVE"] = "INACTIVE";
14
- Status["PENDING"] = "PENDING";
15
- Status["DRAFT"] = "DRAFT";
16
- Status["PUBLISHED"] = "PUBLISHED";
17
- Status["ARCHIVED"] = "ARCHIVED";
18
- })(Status || (exports.Status = Status = {}));
19
- /**
20
- * Gender enum
21
- */
22
- var Gender;
23
- (function (Gender) {
24
- Gender["MALE"] = "MALE";
25
- Gender["FEMALE"] = "FEMALE";
26
- Gender["OTHER"] = "OTHER";
27
- })(Gender || (exports.Gender = Gender = {}));
28
- /**
29
- * Sort order enum
30
- */
31
- var SortOrder;
32
- (function (SortOrder) {
33
- SortOrder["ASC"] = "ASC";
34
- SortOrder["DESC"] = "DESC";
35
- })(SortOrder || (exports.SortOrder = SortOrder = {}));