@bringg/dashboard-sdk 0.4.66 → 0.4.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/ApplicationTeamConfiguration/ApplicationTeamConfigurationApi.d.ts +9 -0
  2. package/dist/ApplicationTeamConfiguration/ApplicationTeamConfigurationApi.js +77 -0
  3. package/dist/ApplicationTeamConfiguration/ApplicationTeamConfigurationApi.js.map +1 -0
  4. package/dist/ApplicationTeamConfiguration/Entity/ApplicationTeamConfigurationEntity.d.ts +9 -0
  5. package/dist/ApplicationTeamConfiguration/Entity/ApplicationTeamConfigurationEntity.js +107 -0
  6. package/dist/ApplicationTeamConfiguration/Entity/ApplicationTeamConfigurationEntity.js.map +1 -0
  7. package/dist/BringgDashboardSDK.d.ts +6 -2
  8. package/dist/BringgDashboardSDK.js +23 -6
  9. package/dist/BringgDashboardSDK.js.map +1 -1
  10. package/dist/Core/ConfigurationProvider.d.ts +4 -0
  11. package/dist/Core/ConfigurationProvider.js +6 -0
  12. package/dist/Core/ConfigurationProvider.js.map +1 -1
  13. package/dist/MerchantConfiguration/MerchantConfiguration.consts.js +1 -0
  14. package/dist/MerchantConfiguration/MerchantConfiguration.consts.js.map +1 -1
  15. package/dist/ServicePlans/Entity/ServicePlansEntity.d.ts +8 -0
  16. package/dist/ServicePlans/Entity/ServicePlansEntity.js +83 -0
  17. package/dist/ServicePlans/Entity/ServicePlansEntity.js.map +1 -0
  18. package/dist/ServicePlans/ServicePlans.consts.d.ts +6 -0
  19. package/dist/ServicePlans/ServicePlans.consts.js +8 -0
  20. package/dist/ServicePlans/ServicePlans.consts.js.map +1 -0
  21. package/dist/ServicePlans/ServicePlansApi.d.ts +8 -0
  22. package/dist/ServicePlans/ServicePlansApi.js +17 -0
  23. package/dist/ServicePlans/ServicePlansApi.js.map +1 -0
  24. package/dist/Services/ServiceRequest.js +1 -1
  25. package/dist/UserAnalytics/UserAnalyticsApi.d.ts +10 -0
  26. package/dist/UserAnalytics/UserAnalyticsApi.js +93 -0
  27. package/dist/UserAnalytics/UserAnalyticsApi.js.map +1 -0
  28. package/dist/bringg-dashboard-sdk-cjs2.js +825 -229
  29. package/dist/bringg-dashboard-sdk-cjs2.js.map +1 -1
  30. package/dist/bringg-dashboard-sdk.js +168 -38
  31. package/dist/bringg-dashboard-sdk.min.js +2 -2
  32. package/dist/bringg-dashboard-sdk.min.js.map +1 -1
  33. package/dist/stats.json +4456 -2642
  34. package/package.json +87 -87
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var user_analytics_1 = require("@bringg/user-analytics");
40
+ var types_1 = require("@bringg/user-analytics/types");
41
+ var UserAnalyticsApi = /** @class */ (function () {
42
+ function UserAnalyticsApi(session) {
43
+ this.session = session;
44
+ this.userAnalytics = new user_analytics_1.default();
45
+ }
46
+ UserAnalyticsApi.prototype.addSnippet = function (_a) {
47
+ var apiKey = _a.apiKey;
48
+ return __awaiter(this, void 0, void 0, function () {
49
+ return __generator(this, function (_b) {
50
+ switch (_b.label) {
51
+ case 0: return [4 /*yield*/, this.userAnalytics.addSnippet({ apiKey: apiKey })];
52
+ case 1: return [2 /*return*/, _b.sent()];
53
+ }
54
+ });
55
+ });
56
+ };
57
+ UserAnalyticsApi.prototype.run = function () {
58
+ return __awaiter(this, void 0, void 0, function () {
59
+ var role;
60
+ return __generator(this, function (_a) {
61
+ switch (_a.label) {
62
+ case 0:
63
+ role = (this.session.user.admin && types_1.Role.ADMIN) ||
64
+ (this.session.user.dispatcher && types_1.Role.DISPATCHER) ||
65
+ (this.session.user.driver && types_1.Role.DRIVER) ||
66
+ undefined;
67
+ if (!role) {
68
+ throw new Error('Invalid analytics user role');
69
+ }
70
+ return [4 /*yield*/, this.userAnalytics.run({
71
+ user: {
72
+ id: this.session.user.id,
73
+ name: this.session.user.name,
74
+ email: this.session.user.email,
75
+ role: role,
76
+ isImpersonated: typeof localStorage !== 'undefined' && Boolean(localStorage.getItem('impersonate_original_user'))
77
+ },
78
+ merchant: {
79
+ id: this.session.merchant.id,
80
+ name: this.session.merchant.name,
81
+ environment: this.session.user.region,
82
+ isBringgAccount: this.session.merchant.id === 1
83
+ }
84
+ })];
85
+ case 1: return [2 /*return*/, _a.sent()];
86
+ }
87
+ });
88
+ });
89
+ };
90
+ return UserAnalyticsApi;
91
+ }());
92
+ exports.default = UserAnalyticsApi;
93
+ //# sourceMappingURL=UserAnalyticsApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserAnalyticsApi.js","sourceRoot":"","sources":["../../src/UserAnalytics/UserAnalyticsApi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAmD;AACnD,sDAAoD;AAGpD;IAIC,0BAAY,OAAgB;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,IAAI,wBAAa,EAAE,CAAC;IAC1C,CAAC;IAEK,qCAAU,GAAhB,UAAiB,EAA8B;YAA5B,MAAM,YAAA;;;;4BACjB,qBAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,MAAM,QAAA,EAAE,CAAC,EAAA;4BAAtD,sBAAO,SAA+C,EAAC;;;;KACvD;IAEK,8BAAG,GAAT;;;;;;wBACO,IAAI,GACT,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,YAAI,CAAC,KAAK,CAAC;4BACvC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,IAAI,YAAI,CAAC,UAAU,CAAC;4BACjD,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,YAAI,CAAC,MAA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