@longvansoftware/storefront-js-client 0.0.3 → 1.0.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.
- package/README.md +93 -93
- package/dist/config/config.d.ts +16 -0
- package/dist/config/config.js +19 -0
- package/dist/{constants/graphql/mutations/authorizationMutations.js → src/graphql/auth/mutations.js} +88 -88
- package/dist/src/graphql/crm/mutations.d.ts +0 -0
- package/dist/src/graphql/crm/mutations.js +1 -0
- package/dist/src/graphql/crm/queries.d.ts +0 -0
- package/dist/src/graphql/crm/queries.js +1 -0
- package/dist/src/graphql/product/mutations.d.ts +0 -0
- package/dist/src/graphql/product/mutations.js +1 -0
- package/dist/{constants/graphql/queries/productQueries.d.ts → src/graphql/product/queries.d.ts} +1 -1
- package/dist/src/graphql/product/queries.js +394 -0
- package/dist/src/graphql/user/queries.d.ts +1 -0
- package/dist/src/graphql/user/queries.js +33 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +5 -0
- package/dist/src/lib/SDK.d.ts +23 -0
- package/dist/src/lib/SDK.js +38 -0
- package/dist/src/lib/auth/index.d.ts +26 -0
- package/dist/src/lib/auth/index.js +54 -0
- package/dist/src/lib/crm/index.d.ts +0 -0
- package/dist/src/lib/crm/index.js +1 -0
- package/dist/src/lib/order/index.d.ts +78 -0
- package/dist/src/lib/order/index.js +187 -0
- package/dist/src/lib/product/index.d.ts +35 -0
- package/dist/src/lib/product/index.js +98 -0
- package/dist/src/lib/service.d.ts +14 -0
- package/dist/src/lib/service.js +97 -0
- package/dist/src/lib/user/index.d.ts +5 -0
- package/dist/src/lib/user/index.js +34 -0
- package/dist/src/types/crm.d.ts +0 -0
- package/dist/src/types/crm.js +1 -0
- package/dist/src/types/order.d.ts +7 -0
- package/dist/src/utils/helpers.d.ts +4 -0
- package/dist/src/utils/helpers.js +41 -0
- package/package.json +40 -36
- package/dist/constants/graphql/mutations/crmMutations.d.ts +0 -8
- package/dist/constants/graphql/mutations/crmMutations.js +0 -368
- package/dist/constants/graphql/mutations/userMutations.d.ts +0 -4
- package/dist/constants/graphql/mutations/userMutations.js +0 -116
- package/dist/constants/graphql/queries/crmQueries.d.ts +0 -1
- package/dist/constants/graphql/queries/crmQueries.js +0 -45
- package/dist/constants/graphql/queries/productQueries.js +0 -368
- package/dist/constants/interfaces/crm.d.ts +0 -218
- package/dist/constants/interfaces/user.d.ts +0 -49
- package/dist/constants/interfaces/user.js +0 -2
- package/dist/index.d.ts +0 -19
- package/dist/index.js +0 -17
- package/dist/modules/authorization/graphql.d.ts +0 -15
- package/dist/modules/authorization/graphql.js +0 -116
- package/dist/modules/crm/graphql.d.ts +0 -19
- package/dist/modules/crm/graphql.js +0 -291
- package/dist/modules/product/graphql.d.ts +0 -19
- package/dist/modules/product/graphql.js +0 -180
- package/dist/modules/user/graphql.d.ts +0 -14
- package/dist/modules/user/graphql.js +0 -156
- /package/dist/{constants/graphql/mutations/authorizationMutations.d.ts → src/graphql/auth/mutations.d.ts} +0 -0
- /package/dist/{constants/interfaces/authorization.d.ts → src/types/auth.d.ts} +0 -0
- /package/dist/{constants/interfaces/authorization.js → src/types/auth.js} +0 -0
- /package/dist/{constants/interfaces/crm.js → src/types/order.js} +0 -0
- /package/dist/{constants/interfaces → src/types}/product.d.ts +0 -0
- /package/dist/{constants/interfaces → src/types}/product.js +0 -0
|
@@ -1,156 +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.USERModuleGraphQL = void 0;
|
|
13
|
-
const graphql_request_1 = require("graphql-request");
|
|
14
|
-
const userMutations_1 = require("../../constants/graphql/mutations/userMutations");
|
|
15
|
-
class USERModuleGraphQL {
|
|
16
|
-
constructor(endpoint, partnerId, storeId) {
|
|
17
|
-
this.endpoint = endpoint;
|
|
18
|
-
this.partnerId = partnerId;
|
|
19
|
-
this.storeId = storeId;
|
|
20
|
-
this.client = new graphql_request_1.GraphQLClient(endpoint);
|
|
21
|
-
}
|
|
22
|
-
getClient() {
|
|
23
|
-
return this.client;
|
|
24
|
-
}
|
|
25
|
-
createCompany(payload, createdBy) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const variables = {
|
|
28
|
-
orgId: this.partnerId,
|
|
29
|
-
createCompanyRequest: {
|
|
30
|
-
name: payload === null || payload === void 0 ? void 0 : payload.name,
|
|
31
|
-
phone: payload === null || payload === void 0 ? void 0 : payload.phone,
|
|
32
|
-
address: payload === null || payload === void 0 ? void 0 : payload.address,
|
|
33
|
-
},
|
|
34
|
-
createTaxCodeRequest: null,
|
|
35
|
-
createdBy,
|
|
36
|
-
};
|
|
37
|
-
try {
|
|
38
|
-
const response = yield this.client.request(userMutations_1.CREATE_COMPANY, variables);
|
|
39
|
-
if (response && response.createCompany) {
|
|
40
|
-
return response.createCompany;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
throw new Error("No createCompany returned from the backend");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
if (error.response &&
|
|
48
|
-
error.response.errors &&
|
|
49
|
-
error.response.errors.length > 0) {
|
|
50
|
-
const errorMessage = error.response.errors[0].message;
|
|
51
|
-
throw new Error(errorMessage);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
throw new Error("Unknown error occurred");
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
;
|
|
60
|
-
updateCompanyInfo(id, fieldName, valueUpdate, updatedBy) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
const variables = {
|
|
63
|
-
orgId: this.partnerId,
|
|
64
|
-
id,
|
|
65
|
-
fieldName,
|
|
66
|
-
valueUpdate,
|
|
67
|
-
updatedBy,
|
|
68
|
-
};
|
|
69
|
-
try {
|
|
70
|
-
const response = yield this.client.request(userMutations_1.UPDATE_COMPANY_INFOR, variables);
|
|
71
|
-
if (response && response.updateCompanyInfo) {
|
|
72
|
-
return response.updateCompanyInfo;
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
throw new Error("No updateCompanyInfo returned from the backend");
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
if (error.response &&
|
|
80
|
-
error.response.errors &&
|
|
81
|
-
error.response.errors.length > 0) {
|
|
82
|
-
const errorMessage = error.response.errors[0].message;
|
|
83
|
-
throw new Error(errorMessage);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
throw new Error("Unknown error occurred");
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
;
|
|
92
|
-
updateCustomerV2(id, customerItem, updatedBy) {
|
|
93
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
const variables = {
|
|
95
|
-
tenantId: this.partnerId,
|
|
96
|
-
id,
|
|
97
|
-
updateCustomerRequest: {
|
|
98
|
-
name: customerItem === null || customerItem === void 0 ? void 0 : customerItem.fullName,
|
|
99
|
-
phone: customerItem === null || customerItem === void 0 ? void 0 : customerItem.phone,
|
|
100
|
-
address: customerItem === null || customerItem === void 0 ? void 0 : customerItem.address
|
|
101
|
-
},
|
|
102
|
-
updatedBy,
|
|
103
|
-
};
|
|
104
|
-
try {
|
|
105
|
-
const response = yield this.client.request(userMutations_1.UPDATE_CUSTOMER_V2, variables);
|
|
106
|
-
if (response && response.updateCustomerV2) {
|
|
107
|
-
return response.updateCustomerV2;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
throw new Error("No updateCustomerV2 returned from the backend");
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
if (error.response &&
|
|
115
|
-
error.response.errors &&
|
|
116
|
-
error.response.errors.length > 0) {
|
|
117
|
-
const errorMessage = error.response.errors[0].message;
|
|
118
|
-
throw new Error(errorMessage);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
throw new Error(error);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
;
|
|
127
|
-
getPersonByPartyIds(partyIds) {
|
|
128
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
-
const variables = {
|
|
130
|
-
partyIds
|
|
131
|
-
};
|
|
132
|
-
try {
|
|
133
|
-
const response = yield this.client.request(userMutations_1.GET_PERSON_BY_PARTY_IDS, variables);
|
|
134
|
-
if (response && response.getPersonByPartyIds) {
|
|
135
|
-
return response.getPersonByPartyIds;
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
throw new Error("No getPersonByPartyIds returned from the backend");
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
catch (error) {
|
|
142
|
-
if (error.response &&
|
|
143
|
-
error.response.errors &&
|
|
144
|
-
error.response.errors.length > 0) {
|
|
145
|
-
const errorMessage = error.response.errors[0].message;
|
|
146
|
-
throw new Error(errorMessage);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
throw new Error(error);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
;
|
|
155
|
-
}
|
|
156
|
-
exports.USERModuleGraphQL = USERModuleGraphQL;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|