@bringg/dashboard-sdk 1.10.0 → 2.0.0-pre
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 +17 -10
- package/dist/BringgDashboardSDK.js +280 -197
- 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/Core/Polly.d.ts +0 -1
- package/dist/Core/Polly.js +1 -9
- package/dist/Core/Polly.js.map +1 -1
- package/dist/Core/RouteGenerator.d.ts +8 -1
- package/dist/Core/RouteGenerator.js +25 -16
- package/dist/Core/RouteGenerator.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.d.ts +2 -1
- package/dist/Services/ServiceRequest.js +4 -3
- package/dist/Services/ServiceRequest.js.map +1 -1
- package/dist/Services/SessionBasedService.js +8 -8
- package/dist/Services/SessionBasedService.js.map +1 -1
- package/dist/Upload/v2/upload-api.d.ts +89 -0
- package/dist/Upload/v2/upload-api.js +104 -0
- package/dist/Upload/v2/upload-api.js.map +1 -0
- package/dist/Upload/v2/upload-service.d.ts +93 -0
- package/dist/Upload/v2/upload-service.js +433 -0
- package/dist/Upload/v2/upload-service.js.map +1 -0
- package/dist/Upload/v2/upload.consts.d.ts +90 -0
- package/dist/Upload/v2/upload.consts.js +28 -0
- package/dist/Upload/v2/upload.consts.js.map +1 -0
- package/dist/bringg-dashboard-sdk-cjs2.js +2766 -2104
- package/dist/bringg-dashboard-sdk-cjs2.js.map +1 -1
- package/dist/bringg-dashboard-sdk.js +51 -12
- package/dist/bringg-dashboard-sdk.min.js +4 -4
- package/dist/bringg-dashboard-sdk.min.js.map +1 -1
- package/dist/index.d.ts +30 -27
- package/dist/index.js +41 -54
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -88,9 +88,8 @@ import { DataEntity, StorableItemMapper } from './data-entity';
|
|
|
88
88
|
import { WorkflowResponse } from '@bringg/types';
|
|
89
89
|
import CustomAttributesApi from './CustomAttributes/CustomAttributesApi';
|
|
90
90
|
import PlannedDeliveryWindowsApi from './PlannedDeliveryWindows/planned-delivery-windows-api';
|
|
91
|
+
import UploadApi from './Upload/v2/upload-api';
|
|
91
92
|
export declare class BringgDashboardSDK {
|
|
92
|
-
private static _environment;
|
|
93
|
-
private static _configurationProvider;
|
|
94
93
|
session: Session;
|
|
95
94
|
applicationMerchantConfiguration: ApplicationMerchantConfigurationApi;
|
|
96
95
|
applicationTeamConfiguration: ApplicationTeamConfigurationApi;
|
|
@@ -182,16 +181,13 @@ export declare class BringgDashboardSDK {
|
|
|
182
181
|
createWorkflows: <T extends DataEntity>(mapper: StorableItemMapper<T, WorkflowResponse>) => WorkflowsApi<T>;
|
|
183
182
|
workflows: <T extends DataEntity>() => WorkflowsApi<T>;
|
|
184
183
|
runs: RunsApi;
|
|
184
|
+
uploads: UploadApi;
|
|
185
185
|
};
|
|
186
|
-
private static workflows;
|
|
187
186
|
constructor(session: Session);
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
static setConfigurationProvider: typeof setConfigurationProvider;
|
|
188
|
+
static setEnvironment: typeof setEnvironment;
|
|
189
|
+
static getCountriesList: typeof getCountriesList;
|
|
190
190
|
static setConfigurations(apiEndpointURL: string, monitorEndpointURL: string, generalEnvApiEndpoint: string): void;
|
|
191
|
-
static setConfigurationProvider: (configurationProvider: ConfigurationProvider) => void;
|
|
192
|
-
static get configurationProvider(): ConfigurationProvider;
|
|
193
|
-
static setEnvironment: (environment: string) => void;
|
|
194
|
-
static get environment(): string;
|
|
195
191
|
static initWithSessionCode(code: string, session: string, region?: string): Promise<BringgDashboardSDK>;
|
|
196
192
|
static initWithEmail(email: string, password: string, merchant_uuid?: string, recaptchaToken?: string, recaptcha_qa_token?: string, region?: string): Promise<BringgDashboardSDK>;
|
|
197
193
|
static initWithAuthToken(region: string, authenticationToken: string): Promise<BringgDashboardSDK>;
|
|
@@ -199,9 +195,20 @@ export declare class BringgDashboardSDK {
|
|
|
199
195
|
static login(params: TokenParams | EmailParams | SessionParams | UserParams): Promise<BringgDashboardSDK>;
|
|
200
196
|
logout(keepServerSession?: boolean): Promise<boolean>;
|
|
201
197
|
static resendConfirmationEmail(params: EmailParams): Promise<boolean>;
|
|
202
|
-
static getCountriesList(): Promise<CountryInfo[]>;
|
|
203
198
|
switchAccounts(): Promise<BringgDashboardSDK>;
|
|
204
199
|
impersonate(user_id: number): Promise<BringgDashboardSDK>;
|
|
205
200
|
impersonateByTeam(team_id: number): Promise<BringgDashboardSDK>;
|
|
206
201
|
unwindImpersonation(): Promise<BringgDashboardSDK>;
|
|
207
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");
|
|
@@ -127,6 +152,9 @@ var workflows_api_1 = require("./Workflow/v2/workflows-api");
|
|
|
127
152
|
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");
|
|
155
|
+
var upload_api_1 = require("./Upload/v2/upload-api");
|
|
156
|
+
var environment = 'production';
|
|
157
|
+
var configurationProvider = null;
|
|
130
158
|
var BringgDashboardSDK = /** @class */ (function () {
|
|
131
159
|
function BringgDashboardSDK(session) {
|
|
132
160
|
this.applicationMerchantConfiguration = null;
|
|
@@ -174,166 +202,13 @@ var BringgDashboardSDK = /** @class */ (function () {
|
|
|
174
202
|
this.vehicles = null;
|
|
175
203
|
this.session = session;
|
|
176
204
|
}
|
|
177
|
-
BringgDashboardSDK.init = function (session) {
|
|
178
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
179
|
-
var bringg;
|
|
180
|
-
return __generator(this, function (_a) {
|
|
181
|
-
switch (_a.label) {
|
|
182
|
-
case 0:
|
|
183
|
-
bringg = new BringgDashboardSDK(session);
|
|
184
|
-
bringg.v2 = {
|
|
185
|
-
vehicles: new vehicles_api_1.default(session),
|
|
186
|
-
plannedDeliveryWindows: new planned_delivery_windows_api_1.default(session),
|
|
187
|
-
lookup: new lookup_api_1.default(session),
|
|
188
|
-
createWorkflows: function (mapper) {
|
|
189
|
-
BringgDashboardSDK.workflows = new workflows_api_1.default(session, mapper);
|
|
190
|
-
return BringgDashboardSDK.workflows;
|
|
191
|
-
},
|
|
192
|
-
workflows: function () {
|
|
193
|
-
return BringgDashboardSDK.workflows;
|
|
194
|
-
},
|
|
195
|
-
runs: new runs_api_1.default(session)
|
|
196
|
-
};
|
|
197
|
-
bringg.application = new ApplicationApi_1.default(session);
|
|
198
|
-
bringg.chat = new ChatConversationApi_1.default(session);
|
|
199
|
-
bringg.companies = new Company_1.default(session);
|
|
200
|
-
bringg.crossAppTransport = new CrossAppTransport_1.default();
|
|
201
|
-
bringg.customerConfiguration = new customer_configuration_1.default(session);
|
|
202
|
-
bringg.customers = new Customer_1.default(session);
|
|
203
|
-
bringg.dashboard = new dashboard_1.default(session);
|
|
204
|
-
bringg.deliveryBlocks = new DeliveryBlocksApi_1.DeliveryBlocksApi(session);
|
|
205
|
-
bringg.fleets = new FleetApi_1.default(session);
|
|
206
|
-
bringg.rules = new RuleApi_1.default(session);
|
|
207
|
-
bringg.fleetRouterApi = new FleetRouterApi_1.default(session);
|
|
208
|
-
bringg.alertConfiguration = new AlertConfigurationApi_1.default(session);
|
|
209
|
-
bringg.workflow = new WorkflowApi_1.default(session);
|
|
210
|
-
bringg.floatingInventory = new FloatingInventoryApi_1.default(session);
|
|
211
|
-
bringg.geocoding = new GeocodingApi_1.default(session);
|
|
212
|
-
bringg.googleMapsHelper = new GoogleMapsHelperApi_1.default(session);
|
|
213
|
-
bringg.inventoryActionsConfigurations = new InventoryActionsConfiguration_1.default(session);
|
|
214
|
-
bringg.languages = new Language_1.Language(session);
|
|
215
|
-
bringg.merchant = new MerchantApi_1.default(session);
|
|
216
|
-
bringg.merchantConfiguration = new MerchantConfigurationApi_1.MerchantConfigurationApi(session);
|
|
217
|
-
bringg.notificationTemplates = new NotificationTemplate_1.NotificationTemplate(session);
|
|
218
|
-
bringg.notificationTypes = new NotificationType_1.NotificationType(session);
|
|
219
|
-
bringg.oauthApplication = new OauthApplicationApi_1.default(session);
|
|
220
|
-
bringg.onboardings = new OnboardingApi_1.default(session);
|
|
221
|
-
bringg.photos = new Photo_1.default(session);
|
|
222
|
-
bringg.plannedRoutes = new PlannedRoutesApi_1.default(session);
|
|
223
|
-
bringg.privileges = new PrivilegesApi_1.default(session);
|
|
224
|
-
bringg.pushTokenSubscription = new PushTokenSubscriptionApi_1.default(session);
|
|
225
|
-
bringg.pushNotificationRegistration = new PushNotificationRegistration_1.default(session);
|
|
226
|
-
bringg.reasonToChangeInventory = new ReasonToChangeInventory_1.default(session);
|
|
227
|
-
bringg.reasonToReassignTasks = new ReasonToReassignTasksApi_1.default(session);
|
|
228
|
-
bringg.reasonToCancelTasks = new ReasonToCancelTasksApi_1.default(session);
|
|
229
|
-
bringg.reportPreferences = new ReportPreference_1.default(session);
|
|
230
|
-
bringg.reports = new reports_1.default(session);
|
|
231
|
-
bringg.runs = new runs_1.default(session);
|
|
232
|
-
bringg.scans = new ScanApi_1.default(session);
|
|
233
|
-
bringg.rollouts = new RolloutsApi_1.default(session);
|
|
234
|
-
bringg.service = new ServiceApi_1.default(session);
|
|
235
|
-
bringg.signatures = new Signature_1.default(session);
|
|
236
|
-
bringg.skills = new SkillsApi_1.default(session);
|
|
237
|
-
bringg.tagCustomerConfigurations = new TagCustomerConfiguration_1.default(session);
|
|
238
|
-
bringg.tagMerchantConfigurations = new TagMerchantConfiguration_1.default(session);
|
|
239
|
-
bringg.tags = new Tag_1.default(session);
|
|
240
|
-
bringg.taskConfigurations = new TaskConfiguration_1.default(session);
|
|
241
|
-
bringg.taskInventory = new TaskInventory_1.default(session);
|
|
242
|
-
bringg.inventory = new Inventory_1.default(session);
|
|
243
|
-
bringg.tasks = new TaskApi_1.default(session);
|
|
244
|
-
bringg.teamConfiguration = new TeamConfigurationApi_1.default(session);
|
|
245
|
-
bringg.teams = new TeamApi_1.default(session);
|
|
246
|
-
bringg.resourceUploads = new ResourceUploadApi_1.default(session);
|
|
247
|
-
bringg.userConfigurations = new UserConfiguration_1.default(session);
|
|
248
|
-
bringg.userTypes = new UserTypeApi_1.default(session);
|
|
249
|
-
bringg.users = new Users_1.default(session);
|
|
250
|
-
bringg.vehicleTypes = new VehicleTypeApi_1.default(session);
|
|
251
|
-
bringg.vehicles = new VehicleApi_1.default(session);
|
|
252
|
-
bringg.vrpAutoDispatchAnalytic = new VrpAutoDispatchAnalyticApi_1.default(session);
|
|
253
|
-
bringg.webApplicationConfiguration = new WebApplicationConfigurationApi_1.default(session);
|
|
254
|
-
bringg.fleetTemplates = new FleetTemplateApi_1.default(session);
|
|
255
|
-
bringg.openFleets = new OpenFleetApi_1.default(session);
|
|
256
|
-
bringg.customerAvailabilityHours = new CustomerAvailabilityHourApi_1.default(session);
|
|
257
|
-
bringg.exclusionWindows = new ExclusionWindowApi_1.default(session);
|
|
258
|
-
bringg.shifts = new ShiftsApi_1.default(session);
|
|
259
|
-
bringg.customFilters = new CustomFilterApi_1.default(session);
|
|
260
|
-
bringg.serviceAreas = new ServiceAreaApi_1.default(session);
|
|
261
|
-
bringg.billing = new BillingApi_1.default(session);
|
|
262
|
-
bringg.userAnalytics = new UserAnalyticsApi_1.default(session);
|
|
263
|
-
bringg.analyticsReports = new AnalyticsReportsApi_1.default(session);
|
|
264
|
-
bringg.servicePlans = new ServicePlansApi_1.default(session);
|
|
265
|
-
bringg.alertsApi = new AlertsApi_1.default(session);
|
|
266
|
-
bringg.deliveryCatalog = new DeliveryCatalogApi_1.default(session);
|
|
267
|
-
bringg.deliveryCatalogGeneralEnv = new DeliveryCatalogApi_2.default(session);
|
|
268
|
-
bringg.packageApi = new PackageApi_1.default(session);
|
|
269
|
-
bringg.templatesApi = new TemplatesApi_1.default(session);
|
|
270
|
-
bringg.routeOptimizationApi = new RouteOptimizationApi_1.default(session);
|
|
271
|
-
bringg.ratesApi = new RatesApi_1.default(session);
|
|
272
|
-
bringg.routeOptimizationService = new RouteOptimizationService_1.default(session);
|
|
273
|
-
bringg.parkingSpotApi = new ParkingSpotApi_1.default(session);
|
|
274
|
-
bringg.customAttributesApi = new CustomAttributesApi_1.default(session);
|
|
275
|
-
// dependent
|
|
276
|
-
bringg.crews = new Crew_1.default(session, bringg.users);
|
|
277
|
-
bringg.applicationMerchantConfiguration = new ApplicationMerchantConfigurationApi_1.default(session, bringg.merchantConfiguration);
|
|
278
|
-
bringg.applicationTeamConfiguration = new ApplicationTeamConfigurationApi_1.default(session);
|
|
279
|
-
return [4 /*yield*/, BringgDashboardSDK.initSessionConfiguration(bringg)];
|
|
280
|
-
case 1:
|
|
281
|
-
_a.sent();
|
|
282
|
-
return [2 /*return*/, Object.freeze(bringg)];
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
};
|
|
287
|
-
BringgDashboardSDK.initSessionConfiguration = function (bringg) {
|
|
288
|
-
var _a, _b;
|
|
289
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
290
|
-
var apiKey;
|
|
291
|
-
return __generator(this, function (_c) {
|
|
292
|
-
switch (_c.label) {
|
|
293
|
-
case 0: return [4 /*yield*/, Promise.all([bringg.merchantConfiguration.get(), bringg.webApplicationConfiguration.get()])];
|
|
294
|
-
case 1:
|
|
295
|
-
_c.sent();
|
|
296
|
-
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];
|
|
297
|
-
apiKey = this._configurationProvider.getUserAnalyticsApiKey();
|
|
298
|
-
return [4 /*yield*/, bringg.userAnalytics.addSnippet({ apiKey: apiKey })];
|
|
299
|
-
case 2:
|
|
300
|
-
_c.sent();
|
|
301
|
-
return [4 /*yield*/, bringg.merchant.get()];
|
|
302
|
-
case 3:
|
|
303
|
-
_c.sent();
|
|
304
|
-
return [4 /*yield*/, bringg.userAnalytics.run({
|
|
305
|
-
apiKey: apiKey,
|
|
306
|
-
environment: BringgDashboardSDK._environment
|
|
307
|
-
})];
|
|
308
|
-
case 4:
|
|
309
|
-
_c.sent();
|
|
310
|
-
_c.label = 5;
|
|
311
|
-
case 5: return [2 /*return*/];
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
};
|
|
316
205
|
BringgDashboardSDK.setConfigurations = function (apiEndpointURL, monitorEndpointURL, generalEnvApiEndpoint) {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
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; };
|
|
322
211
|
};
|
|
323
|
-
Object.defineProperty(BringgDashboardSDK, "configurationProvider", {
|
|
324
|
-
get: function () {
|
|
325
|
-
return BringgDashboardSDK._configurationProvider;
|
|
326
|
-
},
|
|
327
|
-
enumerable: false,
|
|
328
|
-
configurable: true
|
|
329
|
-
});
|
|
330
|
-
Object.defineProperty(BringgDashboardSDK, "environment", {
|
|
331
|
-
get: function () {
|
|
332
|
-
return this._environment;
|
|
333
|
-
},
|
|
334
|
-
enumerable: false,
|
|
335
|
-
configurable: true
|
|
336
|
-
});
|
|
337
212
|
BringgDashboardSDK.initWithSessionCode = function (code, session, region) {
|
|
338
213
|
return __awaiter(this, void 0, void 0, function () {
|
|
339
214
|
return __generator(this, function (_a) {
|
|
@@ -390,13 +265,13 @@ var BringgDashboardSDK = /** @class */ (function () {
|
|
|
390
265
|
return __generator(this, function (_a) {
|
|
391
266
|
switch (_a.label) {
|
|
392
267
|
case 0:
|
|
393
|
-
if (!(
|
|
394
|
-
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()))];
|
|
395
270
|
case 1:
|
|
396
271
|
configuration = _a.sent();
|
|
397
272
|
BringgDashboardSDK.setConfigurationProvider(configuration);
|
|
398
273
|
_a.label = 2;
|
|
399
|
-
case 2: return [4 /*yield*/, this.loginInternal(function (a) { return
|
|
274
|
+
case 2: return [4 /*yield*/, this.loginInternal(function (a) { return init(a); }, params)];
|
|
400
275
|
case 3: return [2 /*return*/, _a.sent()];
|
|
401
276
|
}
|
|
402
277
|
});
|
|
@@ -427,74 +302,282 @@ var BringgDashboardSDK = /** @class */ (function () {
|
|
|
427
302
|
});
|
|
428
303
|
});
|
|
429
304
|
};
|
|
430
|
-
BringgDashboardSDK.getCountriesList = function () {
|
|
431
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
432
|
-
return __generator(this, function (_a) {
|
|
433
|
-
return [2 /*return*/, Country_1.default.getCountries()];
|
|
434
|
-
});
|
|
435
|
-
});
|
|
436
|
-
};
|
|
437
305
|
BringgDashboardSDK.prototype.switchAccounts = function () {
|
|
438
306
|
return __awaiter(this, void 0, void 0, function () {
|
|
439
|
-
var _a
|
|
440
|
-
return __generator(this, function (
|
|
441
|
-
switch (
|
|
307
|
+
var _a;
|
|
308
|
+
return __generator(this, function (_b) {
|
|
309
|
+
switch (_b.label) {
|
|
442
310
|
case 0:
|
|
443
|
-
|
|
311
|
+
_a = init;
|
|
444
312
|
return [4 /*yield*/, this.session.switchAccounts()];
|
|
445
|
-
case 1: return [2 /*return*/,
|
|
313
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
|
446
314
|
}
|
|
447
315
|
});
|
|
448
316
|
});
|
|
449
317
|
};
|
|
450
318
|
BringgDashboardSDK.prototype.impersonate = function (user_id) {
|
|
451
319
|
return __awaiter(this, void 0, void 0, function () {
|
|
452
|
-
var _a
|
|
453
|
-
return __generator(this, function (
|
|
454
|
-
switch (
|
|
320
|
+
var _a;
|
|
321
|
+
return __generator(this, function (_b) {
|
|
322
|
+
switch (_b.label) {
|
|
455
323
|
case 0:
|
|
456
|
-
|
|
324
|
+
_a = init;
|
|
457
325
|
return [4 /*yield*/, this.session.impersonate(user_id)];
|
|
458
|
-
case 1: return [2 /*return*/,
|
|
326
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
|
459
327
|
}
|
|
460
328
|
});
|
|
461
329
|
});
|
|
462
330
|
};
|
|
463
331
|
BringgDashboardSDK.prototype.impersonateByTeam = function (team_id) {
|
|
464
332
|
return __awaiter(this, void 0, void 0, function () {
|
|
465
|
-
var _a
|
|
466
|
-
return __generator(this, function (
|
|
467
|
-
switch (
|
|
333
|
+
var _a;
|
|
334
|
+
return __generator(this, function (_b) {
|
|
335
|
+
switch (_b.label) {
|
|
468
336
|
case 0:
|
|
469
|
-
|
|
337
|
+
_a = init;
|
|
470
338
|
return [4 /*yield*/, this.session.impersonateByTeam(team_id)];
|
|
471
|
-
case 1: return [2 /*return*/,
|
|
339
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
|
472
340
|
}
|
|
473
341
|
});
|
|
474
342
|
});
|
|
475
343
|
};
|
|
476
344
|
BringgDashboardSDK.prototype.unwindImpersonation = function () {
|
|
477
345
|
return __awaiter(this, void 0, void 0, function () {
|
|
478
|
-
var _a
|
|
479
|
-
return __generator(this, function (
|
|
480
|
-
switch (
|
|
346
|
+
var _a;
|
|
347
|
+
return __generator(this, function (_b) {
|
|
348
|
+
switch (_b.label) {
|
|
481
349
|
case 0:
|
|
482
|
-
|
|
350
|
+
_a = init;
|
|
483
351
|
return [4 /*yield*/, this.session.unwindImpersonation()];
|
|
484
|
-
case 1: return [2 /*return*/,
|
|
352
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
|
485
353
|
}
|
|
486
354
|
});
|
|
487
355
|
});
|
|
488
356
|
};
|
|
489
|
-
BringgDashboardSDK.
|
|
490
|
-
BringgDashboardSDK.
|
|
491
|
-
BringgDashboardSDK.
|
|
492
|
-
BringgDashboardSDK._configurationProvider = configurationProvider;
|
|
493
|
-
};
|
|
494
|
-
BringgDashboardSDK.setEnvironment = function (environment) {
|
|
495
|
-
BringgDashboardSDK._environment = environment;
|
|
496
|
-
};
|
|
357
|
+
BringgDashboardSDK.setConfigurationProvider = setConfigurationProvider;
|
|
358
|
+
BringgDashboardSDK.setEnvironment = setEnvironment;
|
|
359
|
+
BringgDashboardSDK.getCountriesList = getCountriesList;
|
|
497
360
|
return BringgDashboardSDK;
|
|
498
361
|
}());
|
|
499
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;
|
|
500
583
|
//# sourceMappingURL=BringgDashboardSDK.js.map
|