@bringg/dashboard-sdk 1.12.0 → 2.0.0
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/BringgDashboardSDK.d.ts +15 -10
- package/dist/BringgDashboardSDK.js +279 -198
- package/dist/BringgDashboardSDK.js.map +1 -1
- package/dist/Core/ConfigurationProvider.js +1 -1
- package/dist/Core/ConfigurationProvider.js.map +1 -1
- package/dist/Core/Logger.d.ts +4 -2
- package/dist/Core/Logger.js +11 -7
- package/dist/Core/Logger.js.map +1 -1
- package/dist/Country/Country.js +3 -2
- package/dist/Country/Country.js.map +1 -1
- package/dist/DeliveryCatalogGeneralEnv/Service/DeliveryCatalogGEService.js +3 -2
- package/dist/DeliveryCatalogGeneralEnv/Service/DeliveryCatalogGEService.js.map +1 -1
- package/dist/Services/Identity/AuthService.js +4 -3
- package/dist/Services/Identity/AuthService.js.map +1 -1
- package/dist/Services/Identity/Session.js +6 -6
- package/dist/Services/Identity/Session.js.map +1 -1
- package/dist/Services/ServiceRequest.js +1 -1
- package/dist/Upload/v2/upload-service.js +1 -1
- package/dist/Upload/v2/upload-service.js.map +1 -1
- package/dist/bringg-dashboard-sdk-cjs2.js +615 -545
- package/dist/bringg-dashboard-sdk-cjs2.js.map +1 -1
- package/dist/bringg-dashboard-sdk.js +10 -10
- package/dist/bringg-dashboard-sdk.min.js +3 -3
- package/dist/bringg-dashboard-sdk.min.js.map +1 -1
- package/dist/index.d.ts +31 -30
- package/dist/index.js +41 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -90,8 +90,6 @@ import CustomAttributesApi from './CustomAttributes/CustomAttributesApi';
|
|
|
90
90
|
import PlannedDeliveryWindowsApi from './PlannedDeliveryWindows/planned-delivery-windows-api';
|
|
91
91
|
import UploadApi from './Upload/v2/upload-api';
|
|
92
92
|
export declare class BringgDashboardSDK {
|
|
93
|
-
private static _environment;
|
|
94
|
-
private static _configurationProvider;
|
|
95
93
|
session: Session;
|
|
96
94
|
applicationMerchantConfiguration: ApplicationMerchantConfigurationApi;
|
|
97
95
|
applicationTeamConfiguration: ApplicationTeamConfigurationApi;
|
|
@@ -185,15 +183,11 @@ export declare class BringgDashboardSDK {
|
|
|
185
183
|
runs: RunsApi;
|
|
186
184
|
uploads: UploadApi;
|
|
187
185
|
};
|
|
188
|
-
private static workflows;
|
|
189
186
|
constructor(session: Session);
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
static setConfigurationProvider: typeof setConfigurationProvider;
|
|
188
|
+
static setEnvironment: typeof setEnvironment;
|
|
189
|
+
static getCountriesList: typeof getCountriesList;
|
|
192
190
|
static setConfigurations(apiEndpointURL: string, monitorEndpointURL: string, generalEnvApiEndpoint: string): void;
|
|
193
|
-
static setConfigurationProvider: (configurationProvider: ConfigurationProvider) => void;
|
|
194
|
-
static get configurationProvider(): ConfigurationProvider;
|
|
195
|
-
static setEnvironment: (environment: string) => void;
|
|
196
|
-
static get environment(): string;
|
|
197
191
|
static initWithSessionCode(code: string, session: string, region?: string): Promise<BringgDashboardSDK>;
|
|
198
192
|
static initWithEmail(email: string, password: string, merchant_uuid?: string, recaptchaToken?: string, recaptcha_qa_token?: string, region?: string): Promise<BringgDashboardSDK>;
|
|
199
193
|
static initWithAuthToken(region: string, authenticationToken: string): Promise<BringgDashboardSDK>;
|
|
@@ -201,9 +195,20 @@ export declare class BringgDashboardSDK {
|
|
|
201
195
|
static login(params: TokenParams | EmailParams | SessionParams | UserParams): Promise<BringgDashboardSDK>;
|
|
202
196
|
logout(keepServerSession?: boolean): Promise<boolean>;
|
|
203
197
|
static resendConfirmationEmail(params: EmailParams): Promise<boolean>;
|
|
204
|
-
static getCountriesList(): Promise<CountryInfo[]>;
|
|
205
198
|
switchAccounts(): Promise<BringgDashboardSDK>;
|
|
206
199
|
impersonate(user_id: number): Promise<BringgDashboardSDK>;
|
|
207
200
|
impersonateByTeam(team_id: number): Promise<BringgDashboardSDK>;
|
|
208
201
|
unwindImpersonation(): Promise<BringgDashboardSDK>;
|
|
209
202
|
}
|
|
203
|
+
export declare function setConfigurations(...args: Parameters<typeof BringgDashboardSDK['setConfigurations']>): ReturnType<typeof BringgDashboardSDK['setConfigurations']>;
|
|
204
|
+
export declare function initWithSessionCode(...args: Parameters<typeof BringgDashboardSDK['initWithSessionCode']>): ReturnType<typeof BringgDashboardSDK['initWithSessionCode']>;
|
|
205
|
+
export declare function initWithEmail(...args: Parameters<typeof BringgDashboardSDK['initWithEmail']>): ReturnType<typeof BringgDashboardSDK['initWithEmail']>;
|
|
206
|
+
export declare function initWithAuthToken(...args: Parameters<typeof BringgDashboardSDK['initWithAuthToken']>): ReturnType<typeof BringgDashboardSDK['initWithAuthToken']>;
|
|
207
|
+
export declare function loginInternal(...args: Parameters<typeof BringgDashboardSDK['loginInternal']>): ReturnType<typeof BringgDashboardSDK['loginInternal']>;
|
|
208
|
+
export declare function login(...args: Parameters<typeof BringgDashboardSDK['login']>): ReturnType<typeof BringgDashboardSDK['login']>;
|
|
209
|
+
export declare function resendConfirmationEmail(...args: Parameters<typeof BringgDashboardSDK['resendConfirmationEmail']>): ReturnType<typeof BringgDashboardSDK['resendConfirmationEmail']>;
|
|
210
|
+
export declare function getConfigurationProvider(): ConfigurationProvider;
|
|
211
|
+
export declare function setConfigurationProvider(provider: ConfigurationProvider): void;
|
|
212
|
+
export declare function getEnvironment(): string;
|
|
213
|
+
export declare function setEnvironment(env: string): void;
|
|
214
|
+
export declare function getCountriesList(): Promise<CountryInfo[]>;
|
|
@@ -35,8 +35,33 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
39
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
|
+
if (!m) return o;
|
|
41
|
+
var i = m.call(o), r, ar = [], e;
|
|
42
|
+
try {
|
|
43
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
44
|
+
}
|
|
45
|
+
catch (error) { e = { error: error }; }
|
|
46
|
+
finally {
|
|
47
|
+
try {
|
|
48
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
49
|
+
}
|
|
50
|
+
finally { if (e) throw e.error; }
|
|
51
|
+
}
|
|
52
|
+
return ar;
|
|
53
|
+
};
|
|
54
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
55
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
56
|
+
if (ar || !(i in from)) {
|
|
57
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
58
|
+
ar[i] = from[i];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
62
|
+
};
|
|
38
63
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.BringgDashboardSDK = void 0;
|
|
64
|
+
exports.getCountriesList = exports.setEnvironment = exports.getEnvironment = exports.setConfigurationProvider = exports.getConfigurationProvider = exports.resendConfirmationEmail = exports.login = exports.loginInternal = exports.initWithAuthToken = exports.initWithEmail = exports.initWithSessionCode = exports.setConfigurations = exports.BringgDashboardSDK = void 0;
|
|
40
65
|
var Session_1 = require("./Services/Identity/Session");
|
|
41
66
|
var MerchantApi_1 = require("./Merchant/MerchantApi");
|
|
42
67
|
var RolloutsApi_1 = require("./Rollouts/RolloutsApi");
|
|
@@ -128,6 +153,8 @@ var runs_api_1 = require("./Run/v2/runs-api");
|
|
|
128
153
|
var CustomAttributesApi_1 = require("./CustomAttributes/CustomAttributesApi");
|
|
129
154
|
var planned_delivery_windows_api_1 = require("./PlannedDeliveryWindows/planned-delivery-windows-api");
|
|
130
155
|
var upload_api_1 = require("./Upload/v2/upload-api");
|
|
156
|
+
var environment = 'production';
|
|
157
|
+
var configurationProvider = null;
|
|
131
158
|
var BringgDashboardSDK = /** @class */ (function () {
|
|
132
159
|
function BringgDashboardSDK(session) {
|
|
133
160
|
this.applicationMerchantConfiguration = null;
|
|
@@ -175,167 +202,13 @@ var BringgDashboardSDK = /** @class */ (function () {
|
|
|
175
202
|
this.vehicles = null;
|
|
176
203
|
this.session = session;
|
|
177
204
|
}
|
|
178
|
-
BringgDashboardSDK.init = function (session) {
|
|
179
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
180
|
-
var bringg;
|
|
181
|
-
return __generator(this, function (_a) {
|
|
182
|
-
switch (_a.label) {
|
|
183
|
-
case 0:
|
|
184
|
-
bringg = new BringgDashboardSDK(session);
|
|
185
|
-
bringg.v2 = {
|
|
186
|
-
vehicles: new vehicles_api_1.default(session),
|
|
187
|
-
plannedDeliveryWindows: new planned_delivery_windows_api_1.default(session),
|
|
188
|
-
lookup: new lookup_api_1.default(session),
|
|
189
|
-
createWorkflows: function (mapper) {
|
|
190
|
-
BringgDashboardSDK.workflows = new workflows_api_1.default(session, mapper);
|
|
191
|
-
return BringgDashboardSDK.workflows;
|
|
192
|
-
},
|
|
193
|
-
workflows: function () {
|
|
194
|
-
return BringgDashboardSDK.workflows;
|
|
195
|
-
},
|
|
196
|
-
runs: new runs_api_1.default(session),
|
|
197
|
-
uploads: new upload_api_1.default(session)
|
|
198
|
-
};
|
|
199
|
-
bringg.application = new ApplicationApi_1.default(session);
|
|
200
|
-
bringg.chat = new ChatConversationApi_1.default(session);
|
|
201
|
-
bringg.companies = new Company_1.default(session);
|
|
202
|
-
bringg.crossAppTransport = new CrossAppTransport_1.default();
|
|
203
|
-
bringg.customerConfiguration = new customer_configuration_1.default(session);
|
|
204
|
-
bringg.customers = new Customer_1.default(session);
|
|
205
|
-
bringg.dashboard = new dashboard_1.default(session);
|
|
206
|
-
bringg.deliveryBlocks = new DeliveryBlocksApi_1.DeliveryBlocksApi(session);
|
|
207
|
-
bringg.fleets = new FleetApi_1.default(session);
|
|
208
|
-
bringg.rules = new RuleApi_1.default(session);
|
|
209
|
-
bringg.fleetRouterApi = new FleetRouterApi_1.default(session);
|
|
210
|
-
bringg.alertConfiguration = new AlertConfigurationApi_1.default(session);
|
|
211
|
-
bringg.workflow = new WorkflowApi_1.default(session);
|
|
212
|
-
bringg.floatingInventory = new FloatingInventoryApi_1.default(session);
|
|
213
|
-
bringg.geocoding = new GeocodingApi_1.default(session);
|
|
214
|
-
bringg.googleMapsHelper = new GoogleMapsHelperApi_1.default(session);
|
|
215
|
-
bringg.inventoryActionsConfigurations = new InventoryActionsConfiguration_1.default(session);
|
|
216
|
-
bringg.languages = new Language_1.Language(session);
|
|
217
|
-
bringg.merchant = new MerchantApi_1.default(session);
|
|
218
|
-
bringg.merchantConfiguration = new MerchantConfigurationApi_1.MerchantConfigurationApi(session);
|
|
219
|
-
bringg.notificationTemplates = new NotificationTemplate_1.NotificationTemplate(session);
|
|
220
|
-
bringg.notificationTypes = new NotificationType_1.NotificationType(session);
|
|
221
|
-
bringg.oauthApplication = new OauthApplicationApi_1.default(session);
|
|
222
|
-
bringg.onboardings = new OnboardingApi_1.default(session);
|
|
223
|
-
bringg.photos = new Photo_1.default(session);
|
|
224
|
-
bringg.plannedRoutes = new PlannedRoutesApi_1.default(session);
|
|
225
|
-
bringg.privileges = new PrivilegesApi_1.default(session);
|
|
226
|
-
bringg.pushTokenSubscription = new PushTokenSubscriptionApi_1.default(session);
|
|
227
|
-
bringg.pushNotificationRegistration = new PushNotificationRegistration_1.default(session);
|
|
228
|
-
bringg.reasonToChangeInventory = new ReasonToChangeInventory_1.default(session);
|
|
229
|
-
bringg.reasonToReassignTasks = new ReasonToReassignTasksApi_1.default(session);
|
|
230
|
-
bringg.reasonToCancelTasks = new ReasonToCancelTasksApi_1.default(session);
|
|
231
|
-
bringg.reportPreferences = new ReportPreference_1.default(session);
|
|
232
|
-
bringg.reports = new reports_1.default(session);
|
|
233
|
-
bringg.runs = new runs_1.default(session);
|
|
234
|
-
bringg.scans = new ScanApi_1.default(session);
|
|
235
|
-
bringg.rollouts = new RolloutsApi_1.default(session);
|
|
236
|
-
bringg.service = new ServiceApi_1.default(session);
|
|
237
|
-
bringg.signatures = new Signature_1.default(session);
|
|
238
|
-
bringg.skills = new SkillsApi_1.default(session);
|
|
239
|
-
bringg.tagCustomerConfigurations = new TagCustomerConfiguration_1.default(session);
|
|
240
|
-
bringg.tagMerchantConfigurations = new TagMerchantConfiguration_1.default(session);
|
|
241
|
-
bringg.tags = new Tag_1.default(session);
|
|
242
|
-
bringg.taskConfigurations = new TaskConfiguration_1.default(session);
|
|
243
|
-
bringg.taskInventory = new TaskInventory_1.default(session);
|
|
244
|
-
bringg.inventory = new Inventory_1.default(session);
|
|
245
|
-
bringg.tasks = new TaskApi_1.default(session);
|
|
246
|
-
bringg.teamConfiguration = new TeamConfigurationApi_1.default(session);
|
|
247
|
-
bringg.teams = new TeamApi_1.default(session);
|
|
248
|
-
bringg.resourceUploads = new ResourceUploadApi_1.default(session);
|
|
249
|
-
bringg.userConfigurations = new UserConfiguration_1.default(session);
|
|
250
|
-
bringg.userTypes = new UserTypeApi_1.default(session);
|
|
251
|
-
bringg.users = new Users_1.default(session);
|
|
252
|
-
bringg.vehicleTypes = new VehicleTypeApi_1.default(session);
|
|
253
|
-
bringg.vehicles = new VehicleApi_1.default(session);
|
|
254
|
-
bringg.vrpAutoDispatchAnalytic = new VrpAutoDispatchAnalyticApi_1.default(session);
|
|
255
|
-
bringg.webApplicationConfiguration = new WebApplicationConfigurationApi_1.default(session);
|
|
256
|
-
bringg.fleetTemplates = new FleetTemplateApi_1.default(session);
|
|
257
|
-
bringg.openFleets = new OpenFleetApi_1.default(session);
|
|
258
|
-
bringg.customerAvailabilityHours = new CustomerAvailabilityHourApi_1.default(session);
|
|
259
|
-
bringg.exclusionWindows = new ExclusionWindowApi_1.default(session);
|
|
260
|
-
bringg.shifts = new ShiftsApi_1.default(session);
|
|
261
|
-
bringg.customFilters = new CustomFilterApi_1.default(session);
|
|
262
|
-
bringg.serviceAreas = new ServiceAreaApi_1.default(session);
|
|
263
|
-
bringg.billing = new BillingApi_1.default(session);
|
|
264
|
-
bringg.userAnalytics = new UserAnalyticsApi_1.default(session);
|
|
265
|
-
bringg.analyticsReports = new AnalyticsReportsApi_1.default(session);
|
|
266
|
-
bringg.servicePlans = new ServicePlansApi_1.default(session);
|
|
267
|
-
bringg.alertsApi = new AlertsApi_1.default(session);
|
|
268
|
-
bringg.deliveryCatalog = new DeliveryCatalogApi_1.default(session);
|
|
269
|
-
bringg.deliveryCatalogGeneralEnv = new DeliveryCatalogApi_2.default(session);
|
|
270
|
-
bringg.packageApi = new PackageApi_1.default(session);
|
|
271
|
-
bringg.templatesApi = new TemplatesApi_1.default(session);
|
|
272
|
-
bringg.routeOptimizationApi = new RouteOptimizationApi_1.default(session);
|
|
273
|
-
bringg.ratesApi = new RatesApi_1.default(session);
|
|
274
|
-
bringg.routeOptimizationService = new RouteOptimizationService_1.default(session);
|
|
275
|
-
bringg.parkingSpotApi = new ParkingSpotApi_1.default(session);
|
|
276
|
-
bringg.customAttributesApi = new CustomAttributesApi_1.default(session);
|
|
277
|
-
// dependent
|
|
278
|
-
bringg.crews = new Crew_1.default(session, bringg.users);
|
|
279
|
-
bringg.applicationMerchantConfiguration = new ApplicationMerchantConfigurationApi_1.default(session, bringg.merchantConfiguration);
|
|
280
|
-
bringg.applicationTeamConfiguration = new ApplicationTeamConfigurationApi_1.default(session);
|
|
281
|
-
return [4 /*yield*/, BringgDashboardSDK.initSessionConfiguration(bringg)];
|
|
282
|
-
case 1:
|
|
283
|
-
_a.sent();
|
|
284
|
-
return [2 /*return*/, Object.freeze(bringg)];
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
};
|
|
289
|
-
BringgDashboardSDK.initSessionConfiguration = function (bringg) {
|
|
290
|
-
var _a, _b;
|
|
291
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
292
|
-
var apiKey;
|
|
293
|
-
return __generator(this, function (_c) {
|
|
294
|
-
switch (_c.label) {
|
|
295
|
-
case 0: return [4 /*yield*/, Promise.all([bringg.merchantConfiguration.get(), bringg.webApplicationConfiguration.get()])];
|
|
296
|
-
case 1:
|
|
297
|
-
_c.sent();
|
|
298
|
-
if (!((_b = (_a = this._configurationProvider) === null || _a === void 0 ? void 0 : _a.isUserAnalyticsEnabled) === null || _b === void 0 ? void 0 : _b.call(_a))) return [3 /*break*/, 5];
|
|
299
|
-
apiKey = this._configurationProvider.getUserAnalyticsApiKey();
|
|
300
|
-
return [4 /*yield*/, bringg.userAnalytics.addSnippet({ apiKey: apiKey })];
|
|
301
|
-
case 2:
|
|
302
|
-
_c.sent();
|
|
303
|
-
return [4 /*yield*/, bringg.merchant.get()];
|
|
304
|
-
case 3:
|
|
305
|
-
_c.sent();
|
|
306
|
-
return [4 /*yield*/, bringg.userAnalytics.run({
|
|
307
|
-
apiKey: apiKey,
|
|
308
|
-
environment: BringgDashboardSDK._environment
|
|
309
|
-
})];
|
|
310
|
-
case 4:
|
|
311
|
-
_c.sent();
|
|
312
|
-
_c.label = 5;
|
|
313
|
-
case 5: return [2 /*return*/];
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
};
|
|
318
205
|
BringgDashboardSDK.setConfigurations = function (apiEndpointURL, monitorEndpointURL, generalEnvApiEndpoint) {
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
206
|
+
configurationProvider.getApiEndpoint = function () { return apiEndpointURL; };
|
|
207
|
+
configurationProvider.getAuthenticationEndpoint = function () { return apiEndpointURL; };
|
|
208
|
+
configurationProvider.getRegionDiscoveryEndpoint = function () { return apiEndpointURL; };
|
|
209
|
+
configurationProvider.getMonitoringEndpoint = function () { return monitorEndpointURL; };
|
|
210
|
+
configurationProvider.getGeneralEnvApiEndpoint = function () { return generalEnvApiEndpoint; };
|
|
324
211
|
};
|
|
325
|
-
Object.defineProperty(BringgDashboardSDK, "configurationProvider", {
|
|
326
|
-
get: function () {
|
|
327
|
-
return BringgDashboardSDK._configurationProvider;
|
|
328
|
-
},
|
|
329
|
-
enumerable: false,
|
|
330
|
-
configurable: true
|
|
331
|
-
});
|
|
332
|
-
Object.defineProperty(BringgDashboardSDK, "environment", {
|
|
333
|
-
get: function () {
|
|
334
|
-
return this._environment;
|
|
335
|
-
},
|
|
336
|
-
enumerable: false,
|
|
337
|
-
configurable: true
|
|
338
|
-
});
|
|
339
212
|
BringgDashboardSDK.initWithSessionCode = function (code, session, region) {
|
|
340
213
|
return __awaiter(this, void 0, void 0, function () {
|
|
341
214
|
return __generator(this, function (_a) {
|
|
@@ -392,13 +265,13 @@ var BringgDashboardSDK = /** @class */ (function () {
|
|
|
392
265
|
return __generator(this, function (_a) {
|
|
393
266
|
switch (_a.label) {
|
|
394
267
|
case 0:
|
|
395
|
-
if (!(
|
|
396
|
-
return [4 /*yield*/, ConfigurationProvider_1.ConfigurationProvider.fromUrl(ConfigurationProvider_1.ConfigurationProvider.getConfigUrl(
|
|
268
|
+
if (!(getConfigurationProvider() === null)) return [3 /*break*/, 2];
|
|
269
|
+
return [4 /*yield*/, ConfigurationProvider_1.ConfigurationProvider.fromUrl(ConfigurationProvider_1.ConfigurationProvider.getConfigUrl(getEnvironment()))];
|
|
397
270
|
case 1:
|
|
398
271
|
configuration = _a.sent();
|
|
399
272
|
BringgDashboardSDK.setConfigurationProvider(configuration);
|
|
400
273
|
_a.label = 2;
|
|
401
|
-
case 2: return [4 /*yield*/, this.loginInternal(function (a) { return
|
|
274
|
+
case 2: return [4 /*yield*/, this.loginInternal(function (a) { return init(a); }, params)];
|
|
402
275
|
case 3: return [2 /*return*/, _a.sent()];
|
|
403
276
|
}
|
|
404
277
|
});
|
|
@@ -429,74 +302,282 @@ var BringgDashboardSDK = /** @class */ (function () {
|
|
|
429
302
|
});
|
|
430
303
|
});
|
|
431
304
|
};
|
|
432
|
-
BringgDashboardSDK.getCountriesList = function () {
|
|
433
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
434
|
-
return __generator(this, function (_a) {
|
|
435
|
-
return [2 /*return*/, Country_1.default.getCountries()];
|
|
436
|
-
});
|
|
437
|
-
});
|
|
438
|
-
};
|
|
439
305
|
BringgDashboardSDK.prototype.switchAccounts = function () {
|
|
440
306
|
return __awaiter(this, void 0, void 0, function () {
|
|
441
|
-
var _a
|
|
442
|
-
return __generator(this, function (
|
|
443
|
-
switch (
|
|
307
|
+
var _a;
|
|
308
|
+
return __generator(this, function (_b) {
|
|
309
|
+
switch (_b.label) {
|
|
444
310
|
case 0:
|
|
445
|
-
|
|
311
|
+
_a = init;
|
|
446
312
|
return [4 /*yield*/, this.session.switchAccounts()];
|
|
447
|
-
case 1: return [2 /*return*/,
|
|
313
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
|
448
314
|
}
|
|
449
315
|
});
|
|
450
316
|
});
|
|
451
317
|
};
|
|
452
318
|
BringgDashboardSDK.prototype.impersonate = function (user_id) {
|
|
453
319
|
return __awaiter(this, void 0, void 0, function () {
|
|
454
|
-
var _a
|
|
455
|
-
return __generator(this, function (
|
|
456
|
-
switch (
|
|
320
|
+
var _a;
|
|
321
|
+
return __generator(this, function (_b) {
|
|
322
|
+
switch (_b.label) {
|
|
457
323
|
case 0:
|
|
458
|
-
|
|
324
|
+
_a = init;
|
|
459
325
|
return [4 /*yield*/, this.session.impersonate(user_id)];
|
|
460
|
-
case 1: return [2 /*return*/,
|
|
326
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
|
461
327
|
}
|
|
462
328
|
});
|
|
463
329
|
});
|
|
464
330
|
};
|
|
465
331
|
BringgDashboardSDK.prototype.impersonateByTeam = function (team_id) {
|
|
466
332
|
return __awaiter(this, void 0, void 0, function () {
|
|
467
|
-
var _a
|
|
468
|
-
return __generator(this, function (
|
|
469
|
-
switch (
|
|
333
|
+
var _a;
|
|
334
|
+
return __generator(this, function (_b) {
|
|
335
|
+
switch (_b.label) {
|
|
470
336
|
case 0:
|
|
471
|
-
|
|
337
|
+
_a = init;
|
|
472
338
|
return [4 /*yield*/, this.session.impersonateByTeam(team_id)];
|
|
473
|
-
case 1: return [2 /*return*/,
|
|
339
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
|
474
340
|
}
|
|
475
341
|
});
|
|
476
342
|
});
|
|
477
343
|
};
|
|
478
344
|
BringgDashboardSDK.prototype.unwindImpersonation = function () {
|
|
479
345
|
return __awaiter(this, void 0, void 0, function () {
|
|
480
|
-
var _a
|
|
481
|
-
return __generator(this, function (
|
|
482
|
-
switch (
|
|
346
|
+
var _a;
|
|
347
|
+
return __generator(this, function (_b) {
|
|
348
|
+
switch (_b.label) {
|
|
483
349
|
case 0:
|
|
484
|
-
|
|
350
|
+
_a = init;
|
|
485
351
|
return [4 /*yield*/, this.session.unwindImpersonation()];
|
|
486
|
-
case 1: return [2 /*return*/,
|
|
352
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
|
487
353
|
}
|
|
488
354
|
});
|
|
489
355
|
});
|
|
490
356
|
};
|
|
491
|
-
BringgDashboardSDK.
|
|
492
|
-
BringgDashboardSDK.
|
|
493
|
-
BringgDashboardSDK.
|
|
494
|
-
BringgDashboardSDK._configurationProvider = configurationProvider;
|
|
495
|
-
};
|
|
496
|
-
BringgDashboardSDK.setEnvironment = function (environment) {
|
|
497
|
-
BringgDashboardSDK._environment = environment;
|
|
498
|
-
};
|
|
357
|
+
BringgDashboardSDK.setConfigurationProvider = setConfigurationProvider;
|
|
358
|
+
BringgDashboardSDK.setEnvironment = setEnvironment;
|
|
359
|
+
BringgDashboardSDK.getCountriesList = getCountriesList;
|
|
499
360
|
return BringgDashboardSDK;
|
|
500
361
|
}());
|
|
501
362
|
exports.BringgDashboardSDK = BringgDashboardSDK;
|
|
363
|
+
function init(session) {
|
|
364
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
365
|
+
var bringg, workflows;
|
|
366
|
+
return __generator(this, function (_a) {
|
|
367
|
+
switch (_a.label) {
|
|
368
|
+
case 0:
|
|
369
|
+
bringg = new BringgDashboardSDK(session);
|
|
370
|
+
bringg.v2 = {
|
|
371
|
+
vehicles: new vehicles_api_1.default(session),
|
|
372
|
+
plannedDeliveryWindows: new planned_delivery_windows_api_1.default(session),
|
|
373
|
+
lookup: new lookup_api_1.default(session),
|
|
374
|
+
createWorkflows: function (mapper) {
|
|
375
|
+
workflows = new workflows_api_1.default(session, mapper);
|
|
376
|
+
return workflows;
|
|
377
|
+
},
|
|
378
|
+
workflows: function () {
|
|
379
|
+
return workflows;
|
|
380
|
+
},
|
|
381
|
+
runs: new runs_api_1.default(session),
|
|
382
|
+
uploads: new upload_api_1.default(session)
|
|
383
|
+
};
|
|
384
|
+
bringg.application = new ApplicationApi_1.default(session);
|
|
385
|
+
bringg.chat = new ChatConversationApi_1.default(session);
|
|
386
|
+
bringg.companies = new Company_1.default(session);
|
|
387
|
+
bringg.crossAppTransport = new CrossAppTransport_1.default();
|
|
388
|
+
bringg.customerConfiguration = new customer_configuration_1.default(session);
|
|
389
|
+
bringg.customers = new Customer_1.default(session);
|
|
390
|
+
bringg.dashboard = new dashboard_1.default(session);
|
|
391
|
+
bringg.deliveryBlocks = new DeliveryBlocksApi_1.DeliveryBlocksApi(session);
|
|
392
|
+
bringg.fleets = new FleetApi_1.default(session);
|
|
393
|
+
bringg.rules = new RuleApi_1.default(session);
|
|
394
|
+
bringg.fleetRouterApi = new FleetRouterApi_1.default(session);
|
|
395
|
+
bringg.alertConfiguration = new AlertConfigurationApi_1.default(session);
|
|
396
|
+
bringg.workflow = new WorkflowApi_1.default(session);
|
|
397
|
+
bringg.floatingInventory = new FloatingInventoryApi_1.default(session);
|
|
398
|
+
bringg.geocoding = new GeocodingApi_1.default(session);
|
|
399
|
+
bringg.googleMapsHelper = new GoogleMapsHelperApi_1.default(session);
|
|
400
|
+
bringg.inventoryActionsConfigurations = new InventoryActionsConfiguration_1.default(session);
|
|
401
|
+
bringg.languages = new Language_1.Language(session);
|
|
402
|
+
bringg.merchant = new MerchantApi_1.default(session);
|
|
403
|
+
bringg.merchantConfiguration = new MerchantConfigurationApi_1.MerchantConfigurationApi(session);
|
|
404
|
+
bringg.notificationTemplates = new NotificationTemplate_1.NotificationTemplate(session);
|
|
405
|
+
bringg.notificationTypes = new NotificationType_1.NotificationType(session);
|
|
406
|
+
bringg.oauthApplication = new OauthApplicationApi_1.default(session);
|
|
407
|
+
bringg.onboardings = new OnboardingApi_1.default(session);
|
|
408
|
+
bringg.photos = new Photo_1.default(session);
|
|
409
|
+
bringg.plannedRoutes = new PlannedRoutesApi_1.default(session);
|
|
410
|
+
bringg.privileges = new PrivilegesApi_1.default(session);
|
|
411
|
+
bringg.pushTokenSubscription = new PushTokenSubscriptionApi_1.default(session);
|
|
412
|
+
bringg.pushNotificationRegistration = new PushNotificationRegistration_1.default(session);
|
|
413
|
+
bringg.reasonToChangeInventory = new ReasonToChangeInventory_1.default(session);
|
|
414
|
+
bringg.reasonToReassignTasks = new ReasonToReassignTasksApi_1.default(session);
|
|
415
|
+
bringg.reasonToCancelTasks = new ReasonToCancelTasksApi_1.default(session);
|
|
416
|
+
bringg.reportPreferences = new ReportPreference_1.default(session);
|
|
417
|
+
bringg.reports = new reports_1.default(session);
|
|
418
|
+
bringg.runs = new runs_1.default(session);
|
|
419
|
+
bringg.scans = new ScanApi_1.default(session);
|
|
420
|
+
bringg.rollouts = new RolloutsApi_1.default(session);
|
|
421
|
+
bringg.service = new ServiceApi_1.default(session);
|
|
422
|
+
bringg.signatures = new Signature_1.default(session);
|
|
423
|
+
bringg.skills = new SkillsApi_1.default(session);
|
|
424
|
+
bringg.tagCustomerConfigurations = new TagCustomerConfiguration_1.default(session);
|
|
425
|
+
bringg.tagMerchantConfigurations = new TagMerchantConfiguration_1.default(session);
|
|
426
|
+
bringg.tags = new Tag_1.default(session);
|
|
427
|
+
bringg.taskConfigurations = new TaskConfiguration_1.default(session);
|
|
428
|
+
bringg.taskInventory = new TaskInventory_1.default(session);
|
|
429
|
+
bringg.inventory = new Inventory_1.default(session);
|
|
430
|
+
bringg.tasks = new TaskApi_1.default(session);
|
|
431
|
+
bringg.teamConfiguration = new TeamConfigurationApi_1.default(session);
|
|
432
|
+
bringg.teams = new TeamApi_1.default(session);
|
|
433
|
+
bringg.resourceUploads = new ResourceUploadApi_1.default(session);
|
|
434
|
+
bringg.userConfigurations = new UserConfiguration_1.default(session);
|
|
435
|
+
bringg.userTypes = new UserTypeApi_1.default(session);
|
|
436
|
+
bringg.users = new Users_1.default(session);
|
|
437
|
+
bringg.vehicleTypes = new VehicleTypeApi_1.default(session);
|
|
438
|
+
bringg.vehicles = new VehicleApi_1.default(session);
|
|
439
|
+
bringg.vrpAutoDispatchAnalytic = new VrpAutoDispatchAnalyticApi_1.default(session);
|
|
440
|
+
bringg.webApplicationConfiguration = new WebApplicationConfigurationApi_1.default(session);
|
|
441
|
+
bringg.fleetTemplates = new FleetTemplateApi_1.default(session);
|
|
442
|
+
bringg.openFleets = new OpenFleetApi_1.default(session);
|
|
443
|
+
bringg.customerAvailabilityHours = new CustomerAvailabilityHourApi_1.default(session);
|
|
444
|
+
bringg.exclusionWindows = new ExclusionWindowApi_1.default(session);
|
|
445
|
+
bringg.shifts = new ShiftsApi_1.default(session);
|
|
446
|
+
bringg.customFilters = new CustomFilterApi_1.default(session);
|
|
447
|
+
bringg.serviceAreas = new ServiceAreaApi_1.default(session);
|
|
448
|
+
bringg.billing = new BillingApi_1.default(session);
|
|
449
|
+
bringg.userAnalytics = new UserAnalyticsApi_1.default(session);
|
|
450
|
+
bringg.analyticsReports = new AnalyticsReportsApi_1.default(session);
|
|
451
|
+
bringg.servicePlans = new ServicePlansApi_1.default(session);
|
|
452
|
+
bringg.alertsApi = new AlertsApi_1.default(session);
|
|
453
|
+
bringg.deliveryCatalog = new DeliveryCatalogApi_1.default(session);
|
|
454
|
+
bringg.deliveryCatalogGeneralEnv = new DeliveryCatalogApi_2.default(session);
|
|
455
|
+
bringg.packageApi = new PackageApi_1.default(session);
|
|
456
|
+
bringg.templatesApi = new TemplatesApi_1.default(session);
|
|
457
|
+
bringg.routeOptimizationApi = new RouteOptimizationApi_1.default(session);
|
|
458
|
+
bringg.ratesApi = new RatesApi_1.default(session);
|
|
459
|
+
bringg.routeOptimizationService = new RouteOptimizationService_1.default(session);
|
|
460
|
+
bringg.parkingSpotApi = new ParkingSpotApi_1.default(session);
|
|
461
|
+
bringg.customAttributesApi = new CustomAttributesApi_1.default(session);
|
|
462
|
+
// dependent
|
|
463
|
+
bringg.crews = new Crew_1.default(session, bringg.users);
|
|
464
|
+
bringg.applicationMerchantConfiguration = new ApplicationMerchantConfigurationApi_1.default(session, bringg.merchantConfiguration);
|
|
465
|
+
bringg.applicationTeamConfiguration = new ApplicationTeamConfigurationApi_1.default(session);
|
|
466
|
+
return [4 /*yield*/, initSessionConfiguration(bringg)];
|
|
467
|
+
case 1:
|
|
468
|
+
_a.sent();
|
|
469
|
+
return [2 /*return*/, Object.freeze(bringg)];
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
function initSessionConfiguration(bringg) {
|
|
475
|
+
var _a;
|
|
476
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
477
|
+
var apiKey;
|
|
478
|
+
return __generator(this, function (_b) {
|
|
479
|
+
switch (_b.label) {
|
|
480
|
+
case 0: return [4 /*yield*/, Promise.all([bringg.merchantConfiguration.get(), bringg.webApplicationConfiguration.get()])];
|
|
481
|
+
case 1:
|
|
482
|
+
_b.sent();
|
|
483
|
+
if (!((_a = configurationProvider === null || configurationProvider === void 0 ? void 0 : configurationProvider.isUserAnalyticsEnabled) === null || _a === void 0 ? void 0 : _a.call(configurationProvider))) return [3 /*break*/, 5];
|
|
484
|
+
apiKey = configurationProvider.getUserAnalyticsApiKey();
|
|
485
|
+
return [4 /*yield*/, bringg.userAnalytics.addSnippet({ apiKey: apiKey })];
|
|
486
|
+
case 2:
|
|
487
|
+
_b.sent();
|
|
488
|
+
return [4 /*yield*/, bringg.merchant.get()];
|
|
489
|
+
case 3:
|
|
490
|
+
_b.sent();
|
|
491
|
+
return [4 /*yield*/, bringg.userAnalytics.run({
|
|
492
|
+
apiKey: apiKey,
|
|
493
|
+
environment: environment
|
|
494
|
+
})];
|
|
495
|
+
case 4:
|
|
496
|
+
_b.sent();
|
|
497
|
+
_b.label = 5;
|
|
498
|
+
case 5: return [2 /*return*/];
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
function setConfigurations() {
|
|
504
|
+
var args = [];
|
|
505
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
506
|
+
args[_i] = arguments[_i];
|
|
507
|
+
}
|
|
508
|
+
return BringgDashboardSDK.setConfigurations.apply(BringgDashboardSDK, __spreadArray([], __read(args), false));
|
|
509
|
+
}
|
|
510
|
+
exports.setConfigurations = setConfigurations;
|
|
511
|
+
function initWithSessionCode() {
|
|
512
|
+
var args = [];
|
|
513
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
514
|
+
args[_i] = arguments[_i];
|
|
515
|
+
}
|
|
516
|
+
return BringgDashboardSDK.initWithSessionCode.apply(BringgDashboardSDK, __spreadArray([], __read(args), false));
|
|
517
|
+
}
|
|
518
|
+
exports.initWithSessionCode = initWithSessionCode;
|
|
519
|
+
function initWithEmail() {
|
|
520
|
+
var args = [];
|
|
521
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
522
|
+
args[_i] = arguments[_i];
|
|
523
|
+
}
|
|
524
|
+
return BringgDashboardSDK.initWithEmail.apply(BringgDashboardSDK, __spreadArray([], __read(args), false));
|
|
525
|
+
}
|
|
526
|
+
exports.initWithEmail = initWithEmail;
|
|
527
|
+
function initWithAuthToken() {
|
|
528
|
+
var args = [];
|
|
529
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
530
|
+
args[_i] = arguments[_i];
|
|
531
|
+
}
|
|
532
|
+
return BringgDashboardSDK.initWithAuthToken.apply(BringgDashboardSDK, __spreadArray([], __read(args), false));
|
|
533
|
+
}
|
|
534
|
+
exports.initWithAuthToken = initWithAuthToken;
|
|
535
|
+
function loginInternal() {
|
|
536
|
+
var args = [];
|
|
537
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
538
|
+
args[_i] = arguments[_i];
|
|
539
|
+
}
|
|
540
|
+
return BringgDashboardSDK.loginInternal.apply(BringgDashboardSDK, __spreadArray([], __read(args), false));
|
|
541
|
+
}
|
|
542
|
+
exports.loginInternal = loginInternal;
|
|
543
|
+
function login() {
|
|
544
|
+
var args = [];
|
|
545
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
546
|
+
args[_i] = arguments[_i];
|
|
547
|
+
}
|
|
548
|
+
return BringgDashboardSDK.login.apply(BringgDashboardSDK, __spreadArray([], __read(args), false));
|
|
549
|
+
}
|
|
550
|
+
exports.login = login;
|
|
551
|
+
function resendConfirmationEmail() {
|
|
552
|
+
var args = [];
|
|
553
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
554
|
+
args[_i] = arguments[_i];
|
|
555
|
+
}
|
|
556
|
+
return BringgDashboardSDK.resendConfirmationEmail.apply(BringgDashboardSDK, __spreadArray([], __read(args), false));
|
|
557
|
+
}
|
|
558
|
+
exports.resendConfirmationEmail = resendConfirmationEmail;
|
|
559
|
+
function getConfigurationProvider() {
|
|
560
|
+
return configurationProvider;
|
|
561
|
+
}
|
|
562
|
+
exports.getConfigurationProvider = getConfigurationProvider;
|
|
563
|
+
function setConfigurationProvider(provider) {
|
|
564
|
+
configurationProvider = provider;
|
|
565
|
+
}
|
|
566
|
+
exports.setConfigurationProvider = setConfigurationProvider;
|
|
567
|
+
function getEnvironment() {
|
|
568
|
+
return environment;
|
|
569
|
+
}
|
|
570
|
+
exports.getEnvironment = getEnvironment;
|
|
571
|
+
function setEnvironment(env) {
|
|
572
|
+
environment = env;
|
|
573
|
+
}
|
|
574
|
+
exports.setEnvironment = setEnvironment;
|
|
575
|
+
function getCountriesList() {
|
|
576
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
577
|
+
return __generator(this, function (_a) {
|
|
578
|
+
return [2 /*return*/, Country_1.default.getCountries()];
|
|
579
|
+
});
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
exports.getCountriesList = getCountriesList;
|
|
502
583
|
//# sourceMappingURL=BringgDashboardSDK.js.map
|