masterypath-sdk 0.0.13 → 0.1.1
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/MasterypathSDK.d.ts +8 -8
- package/dist/MasterypathSDK.js +8 -8
- package/dist/cli/cli.d.ts +1 -1
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +1 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/commands/chat.d.ts.map +1 -1
- package/dist/cli/commands/chat.js +10 -5
- package/dist/cli/commands/chat.js.map +1 -1
- package/dist/cli/commands/organizations.d.ts.map +1 -1
- package/dist/cli/commands/organizations.js +9 -70
- package/dist/cli/commands/organizations.js.map +1 -1
- package/dist/cli/commands/uploads.d.ts +2 -2
- package/dist/cli/commands/uploads.d.ts.map +1 -1
- package/dist/cli/commands/uploads.js +8 -8
- package/dist/cli/commands/uploads.js.map +1 -1
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +15 -13
- package/dist/cli/output.js.map +1 -1
- package/dist/domains/chat/ChatClient.d.ts +8 -8
- package/dist/domains/chat/ChatClient.d.ts.map +1 -1
- package/dist/domains/chat/ChatClient.js +16 -16
- package/dist/domains/chat/ChatClient.js.map +1 -1
- package/dist/domains/containers/ContainersClient.d.ts +187 -63
- package/dist/domains/containers/ContainersClient.js +542 -376
- package/dist/domains/index.d.ts +9 -9
- package/dist/domains/index.d.ts.map +1 -1
- package/dist/domains/index.js +5 -5
- package/dist/domains/listings/ListingsClient.d.ts +35 -12
- package/dist/domains/listings/ListingsClient.js +100 -84
- package/dist/domains/merchants/MerchantsClient.d.ts +124 -31
- package/dist/domains/merchants/MerchantsClient.js +420 -303
- package/dist/domains/mindmaps/MindmapsClient.d.ts +6 -6
- package/dist/domains/mindmaps/MindmapsClient.d.ts.map +1 -1
- package/dist/domains/mindmaps/MindmapsClient.js +12 -13
- package/dist/domains/mindmaps/MindmapsClient.js.map +1 -1
- package/dist/domains/mindmaps/types.d.ts.map +1 -1
- package/dist/domains/orders/OrdersClient.d.ts +327 -94
- package/dist/domains/orders/OrdersClient.js +934 -662
- package/dist/domains/orders/types.d.ts +45 -36
- package/dist/domains/orders/types.js +1 -1
- package/dist/domains/organizations/OrganizationsClient.d.ts +8 -5
- package/dist/domains/organizations/OrganizationsClient.d.ts.map +1 -1
- package/dist/domains/organizations/OrganizationsClient.js +21 -30
- package/dist/domains/organizations/OrganizationsClient.js.map +1 -1
- package/dist/domains/plants/PlantsClient.d.ts +43 -28
- package/dist/domains/plants/PlantsClient.js +51 -47
- package/dist/domains/products/ProductsClient.d.ts +34 -12
- package/dist/domains/products/ProductsClient.js +94 -83
- package/dist/domains/public-api/PublicApiClient.d.ts +22 -0
- package/dist/domains/public-api/PublicApiClient.d.ts.map +1 -1
- package/dist/domains/public-api/PublicApiClient.js +51 -0
- package/dist/domains/public-api/PublicApiClient.js.map +1 -1
- package/dist/domains/uploads/UploadsClient.d.ts.map +1 -1
- package/dist/domains/uploads/UploadsClient.js +1 -3
- package/dist/domains/uploads/UploadsClient.js.map +1 -1
- package/dist/domains/usdazones/UsdazonesClient.d.ts +6 -6
- package/dist/domains/usdazones/UsdazonesClient.js +15 -15
- package/dist/domains/users/UsersClient.d.ts +4 -4
- package/dist/domains/users/UsersClient.d.ts.map +1 -1
- package/dist/domains/users/UsersClient.js +24 -22
- package/dist/domains/users/UsersClient.js.map +1 -1
- package/dist/generated/graphql.d.ts +1162 -1079
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +5618 -84
- package/dist/generated/graphql.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/shared/fulfillmentWindows.js +4 -4
- package/dist/utils/errors.js +3 -3
- package/package.json +1 -1
|
@@ -1,330 +1,447 @@
|
|
|
1
|
-
import { print } from
|
|
2
|
-
import {
|
|
1
|
+
import { print } from "graphql";
|
|
2
|
+
import {
|
|
3
|
+
GetOnboardingDocument,
|
|
4
|
+
BeginStripeOnboardingDocument,
|
|
5
|
+
VerifyOnboardingCompletedDocument,
|
|
6
|
+
CreateMerchantDocument,
|
|
7
|
+
GetMerchantDocument,
|
|
8
|
+
GetMerchantByIdDocument,
|
|
9
|
+
GetMerchantByHandleDocument,
|
|
10
|
+
UpdateMerchantDocument,
|
|
11
|
+
GetMerchantLocationsDocument,
|
|
12
|
+
CreateLocationDocument,
|
|
13
|
+
UpdateLocationDocument,
|
|
14
|
+
DeleteLocationDocument,
|
|
15
|
+
RestoreLocationDocument,
|
|
16
|
+
GetLocationTaxJurisdictionsDocument,
|
|
17
|
+
CreateLocationTaxJurisdictionDocument,
|
|
18
|
+
UpdateLocationTaxJurisdictionDocument,
|
|
19
|
+
DeleteLocationTaxJurisdictionDocument,
|
|
20
|
+
InviteUserToMerchantDocument,
|
|
21
|
+
AcceptInvitationDocument,
|
|
22
|
+
DeleteInvitationDocument,
|
|
23
|
+
RemoveUserFromMerchantDocument,
|
|
24
|
+
ListRolesDocument,
|
|
25
|
+
ListMerchantUsersDocument,
|
|
26
|
+
ListLocationUsersDocument,
|
|
27
|
+
AssignRolesToUserDocument,
|
|
28
|
+
SetUserLocationsDocument,
|
|
29
|
+
} from "../../generated/graphql";
|
|
3
30
|
export class MerchantsClient {
|
|
4
|
-
|
|
5
|
-
|
|
31
|
+
constructor(httpClient) {
|
|
32
|
+
this.httpClient = httpClient;
|
|
33
|
+
}
|
|
34
|
+
async getOnboarding(merchantId) {
|
|
35
|
+
const response = await this.httpClient.request("/graphql-merchants", {
|
|
36
|
+
query: print(GetOnboardingDocument),
|
|
37
|
+
variables: { merchantId },
|
|
38
|
+
});
|
|
39
|
+
return response.data?.getOnboarding ?? null;
|
|
40
|
+
}
|
|
41
|
+
async beginStripeOnboarding(merchantId) {
|
|
42
|
+
if (!merchantId || merchantId.trim() === "") {
|
|
43
|
+
throw new Error("merchantId is required for beginStripeOnboarding");
|
|
6
44
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
45
|
+
const response = await this.httpClient.request(
|
|
46
|
+
"/graphql-merchants",
|
|
47
|
+
{
|
|
48
|
+
query: print(BeginStripeOnboardingDocument),
|
|
49
|
+
variables: {},
|
|
50
|
+
},
|
|
51
|
+
merchantId,
|
|
52
|
+
);
|
|
53
|
+
if (!response.data?.beginStripeOnboarding) {
|
|
54
|
+
throw new Error("Failed to begin Stripe onboarding: No data returned");
|
|
13
55
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
query: print(BeginStripeOnboardingDocument),
|
|
20
|
-
variables: {},
|
|
21
|
-
}, merchantId);
|
|
22
|
-
if (!response.data?.beginStripeOnboarding) {
|
|
23
|
-
throw new Error('Failed to begin Stripe onboarding: No data returned');
|
|
24
|
-
}
|
|
25
|
-
return response.data.beginStripeOnboarding;
|
|
56
|
+
return response.data.beginStripeOnboarding;
|
|
57
|
+
}
|
|
58
|
+
async verifyOnboardingCompleted(merchantId) {
|
|
59
|
+
if (!merchantId || merchantId.trim() === "") {
|
|
60
|
+
throw new Error("merchantId is required for verifyOnboardingCompleted");
|
|
26
61
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
62
|
+
const response = await this.httpClient.request(
|
|
63
|
+
"/graphql-merchants",
|
|
64
|
+
{
|
|
65
|
+
query: print(VerifyOnboardingCompletedDocument),
|
|
66
|
+
variables: {},
|
|
67
|
+
},
|
|
68
|
+
merchantId,
|
|
69
|
+
);
|
|
70
|
+
if (!response.data?.verifyOnboardingCompleted) {
|
|
71
|
+
throw new Error(
|
|
72
|
+
"Failed to verify onboarding completion: No data returned",
|
|
73
|
+
);
|
|
39
74
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
75
|
+
return response.data.verifyOnboardingCompleted;
|
|
76
|
+
}
|
|
77
|
+
async createMerchant(input) {
|
|
78
|
+
const response = await this.httpClient.request("/graphql-merchants", {
|
|
79
|
+
query: print(CreateMerchantDocument),
|
|
80
|
+
variables: {
|
|
81
|
+
input,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
if (!response.data?.createMerchant) {
|
|
85
|
+
throw new Error("Failed to create merchant: No data returned");
|
|
51
86
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
query: print(GetMerchantDocument),
|
|
58
|
-
variables: {},
|
|
59
|
-
}, merchantId);
|
|
60
|
-
return response.data?.getMerchant ?? null;
|
|
87
|
+
return response.data.createMerchant;
|
|
88
|
+
}
|
|
89
|
+
async getMerchant(merchantId) {
|
|
90
|
+
if (!merchantId) {
|
|
91
|
+
throw new Error("merchantId is required for getMerchant");
|
|
61
92
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
93
|
+
const response = await this.httpClient.request(
|
|
94
|
+
"/graphql-merchants",
|
|
95
|
+
{
|
|
96
|
+
query: print(GetMerchantDocument),
|
|
97
|
+
variables: {},
|
|
98
|
+
},
|
|
99
|
+
merchantId,
|
|
100
|
+
);
|
|
101
|
+
return response.data?.getMerchant ?? null;
|
|
102
|
+
}
|
|
103
|
+
async getMerchantById(merchantId) {
|
|
104
|
+
const response = await this.httpClient.request(
|
|
105
|
+
"/graphql-merchants",
|
|
106
|
+
{
|
|
107
|
+
query: print(GetMerchantByIdDocument),
|
|
108
|
+
variables: {
|
|
109
|
+
merchantId,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
merchantId,
|
|
113
|
+
);
|
|
114
|
+
return response.data?.getMerchantById ?? null;
|
|
115
|
+
}
|
|
116
|
+
async getMerchantByHandle(handle) {
|
|
117
|
+
const response = await this.httpClient.request("/graphql-merchants", {
|
|
118
|
+
query: print(GetMerchantByHandleDocument),
|
|
119
|
+
variables: {
|
|
120
|
+
handle,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
return response.data?.getMerchantByHandle ?? null;
|
|
124
|
+
}
|
|
125
|
+
async updateMerchant(input, merchantId) {
|
|
126
|
+
const response = await this.httpClient.request(
|
|
127
|
+
"/graphql-merchants",
|
|
128
|
+
{
|
|
129
|
+
query: print(UpdateMerchantDocument),
|
|
130
|
+
variables: {
|
|
131
|
+
input,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
merchantId,
|
|
135
|
+
);
|
|
136
|
+
if (!response.data?.updateMerchant) {
|
|
137
|
+
throw new Error("Failed to update merchant: No data returned");
|
|
70
138
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
139
|
+
return response.data.updateMerchant;
|
|
140
|
+
}
|
|
141
|
+
async getMerchantLocations(merchantId, includeDeleted) {
|
|
142
|
+
const response = await this.httpClient.request(
|
|
143
|
+
"/graphql-merchants",
|
|
144
|
+
{
|
|
145
|
+
query: print(GetMerchantLocationsDocument),
|
|
146
|
+
variables: {
|
|
147
|
+
includeDeleted: includeDeleted ?? undefined,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
merchantId,
|
|
151
|
+
);
|
|
152
|
+
if (!response.data?.getMerchantLocations) {
|
|
153
|
+
throw new Error("Failed to get merchant locations: No data returned");
|
|
79
154
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
155
|
+
return response.data.getMerchantLocations;
|
|
156
|
+
}
|
|
157
|
+
async createLocation(input, merchantId) {
|
|
158
|
+
const response = await this.httpClient.request(
|
|
159
|
+
"/graphql-merchants",
|
|
160
|
+
{
|
|
161
|
+
query: print(CreateLocationDocument),
|
|
162
|
+
variables: {
|
|
163
|
+
input,
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
merchantId,
|
|
167
|
+
);
|
|
168
|
+
if (!response.data?.createLocation) {
|
|
169
|
+
throw new Error("Failed to create location: No data returned");
|
|
91
170
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
171
|
+
return response.data.createLocation;
|
|
172
|
+
}
|
|
173
|
+
async updateLocation(id, input, merchantId) {
|
|
174
|
+
const response = await this.httpClient.request(
|
|
175
|
+
"/graphql-merchants",
|
|
176
|
+
{
|
|
177
|
+
query: print(UpdateLocationDocument),
|
|
178
|
+
variables: {
|
|
179
|
+
id,
|
|
180
|
+
input,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
merchantId,
|
|
184
|
+
);
|
|
185
|
+
if (!response.data?.updateLocation) {
|
|
186
|
+
throw new Error("Failed to update location: No data returned");
|
|
103
187
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
188
|
+
return response.data.updateLocation;
|
|
189
|
+
}
|
|
190
|
+
async deleteLocation(id, merchantId) {
|
|
191
|
+
const response = await this.httpClient.request(
|
|
192
|
+
"/graphql-merchants",
|
|
193
|
+
{
|
|
194
|
+
query: print(DeleteLocationDocument),
|
|
195
|
+
variables: {
|
|
196
|
+
id,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
merchantId,
|
|
200
|
+
);
|
|
201
|
+
if (
|
|
202
|
+
response.data?.deleteLocation === undefined ||
|
|
203
|
+
response.data.deleteLocation === null
|
|
204
|
+
) {
|
|
205
|
+
throw new Error("Failed to delete location: No data returned");
|
|
115
206
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
207
|
+
return response.data.deleteLocation;
|
|
208
|
+
}
|
|
209
|
+
async restoreLocation(id, merchantId) {
|
|
210
|
+
const response = await this.httpClient.request(
|
|
211
|
+
"/graphql-merchants",
|
|
212
|
+
{
|
|
213
|
+
query: print(RestoreLocationDocument),
|
|
214
|
+
variables: {
|
|
215
|
+
id,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
merchantId,
|
|
219
|
+
);
|
|
220
|
+
if (!response.data?.restoreLocation) {
|
|
221
|
+
throw new Error("Failed to restore location: No data returned");
|
|
128
222
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
223
|
+
return response.data.restoreLocation;
|
|
224
|
+
}
|
|
225
|
+
async getLocationTaxJurisdictions(locationId) {
|
|
226
|
+
const response = await this.httpClient.request("/graphql-merchants", {
|
|
227
|
+
query: print(GetLocationTaxJurisdictionsDocument),
|
|
228
|
+
variables: {
|
|
229
|
+
locationId,
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
if (!response.data?.getLocationTaxJurisdictions) {
|
|
233
|
+
throw new Error(
|
|
234
|
+
"Failed to get location tax jurisdictions: No data returned",
|
|
235
|
+
);
|
|
141
236
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
237
|
+
return response.data.getLocationTaxJurisdictions;
|
|
238
|
+
}
|
|
239
|
+
async createLocationTaxJurisdiction(input) {
|
|
240
|
+
const response = await this.httpClient.request("/graphql-merchants", {
|
|
241
|
+
query: print(CreateLocationTaxJurisdictionDocument),
|
|
242
|
+
variables: {
|
|
243
|
+
input,
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
if (!response.data?.createLocationTaxJurisdiction) {
|
|
247
|
+
throw new Error(
|
|
248
|
+
"Failed to create location tax jurisdiction: No data returned",
|
|
249
|
+
);
|
|
153
250
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
251
|
+
return response.data.createLocationTaxJurisdiction;
|
|
252
|
+
}
|
|
253
|
+
async updateLocationTaxJurisdiction(id, input, merchantId) {
|
|
254
|
+
const response = await this.httpClient.request(
|
|
255
|
+
"/graphql-merchants",
|
|
256
|
+
{
|
|
257
|
+
query: print(UpdateLocationTaxJurisdictionDocument),
|
|
258
|
+
variables: {
|
|
259
|
+
id,
|
|
260
|
+
input,
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
merchantId,
|
|
264
|
+
);
|
|
265
|
+
if (!response.data?.updateLocationTaxJurisdiction) {
|
|
266
|
+
throw new Error(
|
|
267
|
+
"Failed to update location tax jurisdiction: No data returned",
|
|
268
|
+
);
|
|
165
269
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
|
|
270
|
+
return response.data.updateLocationTaxJurisdiction;
|
|
271
|
+
}
|
|
272
|
+
async deleteLocationTaxJurisdiction(id, merchantId) {
|
|
273
|
+
const response = await this.httpClient.request(
|
|
274
|
+
"/graphql-merchants",
|
|
275
|
+
{
|
|
276
|
+
query: print(DeleteLocationTaxJurisdictionDocument),
|
|
277
|
+
variables: {
|
|
278
|
+
id,
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
merchantId,
|
|
282
|
+
);
|
|
283
|
+
if (
|
|
284
|
+
response.data?.deleteLocationTaxJurisdiction === undefined ||
|
|
285
|
+
response.data.deleteLocationTaxJurisdiction === null
|
|
286
|
+
) {
|
|
287
|
+
throw new Error(
|
|
288
|
+
"Failed to delete location tax jurisdiction: No data returned",
|
|
289
|
+
);
|
|
177
290
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
291
|
+
return response.data.deleteLocationTaxJurisdiction;
|
|
292
|
+
}
|
|
293
|
+
async inviteUserToMerchant(input, merchantId) {
|
|
294
|
+
const response = await this.httpClient.request(
|
|
295
|
+
"/graphql-merchants",
|
|
296
|
+
{
|
|
297
|
+
query: print(InviteUserToMerchantDocument),
|
|
298
|
+
variables: {
|
|
299
|
+
input,
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
merchantId,
|
|
303
|
+
);
|
|
304
|
+
if (!response.data?.inviteUserToMerchant) {
|
|
305
|
+
throw new Error("Failed to invite user to merchant: No data returned");
|
|
190
306
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
307
|
+
return response.data.inviteUserToMerchant;
|
|
308
|
+
}
|
|
309
|
+
async listMerchantUsers(merchantId) {
|
|
310
|
+
const response = await this.httpClient.request(
|
|
311
|
+
"/graphql-merchants",
|
|
312
|
+
{
|
|
313
|
+
query: print(ListMerchantUsersDocument),
|
|
314
|
+
variables: {
|
|
315
|
+
merchantId,
|
|
316
|
+
},
|
|
317
|
+
},
|
|
318
|
+
merchantId,
|
|
319
|
+
);
|
|
320
|
+
if (!response.data?.listMerchantUsers) {
|
|
321
|
+
throw new Error("Failed to list merchant users: No data returned");
|
|
203
322
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
323
|
+
return response.data.listMerchantUsers;
|
|
324
|
+
}
|
|
325
|
+
async listLocationUsers(locationId, merchantId) {
|
|
326
|
+
const response = await this.httpClient.request(
|
|
327
|
+
"/graphql-merchants",
|
|
328
|
+
{
|
|
329
|
+
query: print(ListLocationUsersDocument),
|
|
330
|
+
variables: {
|
|
331
|
+
locationId,
|
|
332
|
+
merchantId,
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
merchantId,
|
|
336
|
+
);
|
|
337
|
+
if (!response.data?.listLocationUsers) {
|
|
338
|
+
throw new Error("Failed to list location users: No data returned");
|
|
215
339
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
return response.data.listMerchantUsers;
|
|
340
|
+
return response.data.listLocationUsers;
|
|
341
|
+
}
|
|
342
|
+
async listRoles() {
|
|
343
|
+
const response = await this.httpClient.request("/graphql-merchants", {
|
|
344
|
+
query: print(ListRolesDocument),
|
|
345
|
+
variables: {},
|
|
346
|
+
});
|
|
347
|
+
if (!response.data?.listRoles) {
|
|
348
|
+
throw new Error("Failed to list roles: No data returned");
|
|
227
349
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
350
|
+
return response.data.listRoles;
|
|
351
|
+
}
|
|
352
|
+
async acceptInvitation(email, merchantId) {
|
|
353
|
+
const response = await this.httpClient.request("/graphql-merchants", {
|
|
354
|
+
query: print(AcceptInvitationDocument),
|
|
355
|
+
variables: {
|
|
356
|
+
input: {
|
|
357
|
+
email,
|
|
358
|
+
merchantId,
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
if (!response.data?.acceptInvitation) {
|
|
363
|
+
throw new Error("Failed to accept invitation: No data returned");
|
|
240
364
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
365
|
+
return response.data.acceptInvitation;
|
|
366
|
+
}
|
|
367
|
+
async deleteInvitation(email, merchantId) {
|
|
368
|
+
const response = await this.httpClient.request(
|
|
369
|
+
"/graphql-merchants",
|
|
370
|
+
{
|
|
371
|
+
query: print(DeleteInvitationDocument),
|
|
372
|
+
variables: {
|
|
373
|
+
input: {
|
|
374
|
+
email,
|
|
375
|
+
merchantId,
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
merchantId,
|
|
380
|
+
);
|
|
381
|
+
if (response.data?.deleteInvitation === undefined) {
|
|
382
|
+
throw new Error("Failed to delete invitation: No data returned");
|
|
250
383
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
|
|
384
|
+
return response.data.deleteInvitation;
|
|
385
|
+
}
|
|
386
|
+
async removeUserFromMerchant(userId, merchantId) {
|
|
387
|
+
const response = await this.httpClient.request(
|
|
388
|
+
"/graphql-merchants",
|
|
389
|
+
{
|
|
390
|
+
query: print(RemoveUserFromMerchantDocument),
|
|
391
|
+
variables: {
|
|
392
|
+
input: {
|
|
393
|
+
userId,
|
|
394
|
+
merchantId,
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
merchantId,
|
|
399
|
+
);
|
|
400
|
+
if (response.data?.removeUserFromMerchant === undefined) {
|
|
401
|
+
throw new Error("Failed to remove user from merchant: No data returned");
|
|
265
402
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
403
|
+
return response.data.removeUserFromMerchant;
|
|
404
|
+
}
|
|
405
|
+
async assignRolesToUser(userId, merchantId, roleNames, locationIds) {
|
|
406
|
+
const response = await this.httpClient.request(
|
|
407
|
+
"/graphql-merchants",
|
|
408
|
+
{
|
|
409
|
+
query: print(AssignRolesToUserDocument),
|
|
410
|
+
variables: {
|
|
411
|
+
input: {
|
|
412
|
+
userId,
|
|
413
|
+
merchantId,
|
|
414
|
+
roleNames,
|
|
415
|
+
locations: locationIds,
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
merchantId,
|
|
420
|
+
);
|
|
421
|
+
if (!response.data?.assignRolesToUser) {
|
|
422
|
+
throw new Error("Failed to assign roles to user: No data returned");
|
|
280
423
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
input: {
|
|
301
|
-
userId,
|
|
302
|
-
merchantId,
|
|
303
|
-
roleNames,
|
|
304
|
-
locations: locationIds,
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
}, merchantId);
|
|
308
|
-
if (!response.data?.assignRolesToUser) {
|
|
309
|
-
throw new Error('Failed to assign roles to user: No data returned');
|
|
310
|
-
}
|
|
311
|
-
return response.data.assignRolesToUser;
|
|
312
|
-
}
|
|
313
|
-
async setUserLocations(userId, merchantId, locationIds) {
|
|
314
|
-
const response = await this.httpClient.request('/graphql-merchants', {
|
|
315
|
-
query: print(SetUserLocationsDocument),
|
|
316
|
-
variables: {
|
|
317
|
-
input: {
|
|
318
|
-
userId,
|
|
319
|
-
merchantId,
|
|
320
|
-
locationIds,
|
|
321
|
-
},
|
|
322
|
-
},
|
|
323
|
-
}, merchantId);
|
|
324
|
-
if (!response.data?.setUserLocations) {
|
|
325
|
-
throw new Error('Failed to set user locations: No data returned');
|
|
326
|
-
}
|
|
327
|
-
return response.data.setUserLocations;
|
|
424
|
+
return response.data.assignRolesToUser;
|
|
425
|
+
}
|
|
426
|
+
async setUserLocations(userId, merchantId, locationIds) {
|
|
427
|
+
const response = await this.httpClient.request(
|
|
428
|
+
"/graphql-merchants",
|
|
429
|
+
{
|
|
430
|
+
query: print(SetUserLocationsDocument),
|
|
431
|
+
variables: {
|
|
432
|
+
input: {
|
|
433
|
+
userId,
|
|
434
|
+
merchantId,
|
|
435
|
+
locationIds,
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
merchantId,
|
|
440
|
+
);
|
|
441
|
+
if (!response.data?.setUserLocations) {
|
|
442
|
+
throw new Error("Failed to set user locations: No data returned");
|
|
328
443
|
}
|
|
444
|
+
return response.data.setUserLocations;
|
|
445
|
+
}
|
|
329
446
|
}
|
|
330
|
-
//# sourceMappingURL=MerchantsClient.js.map
|
|
447
|
+
//# sourceMappingURL=MerchantsClient.js.map
|