@bringg/dashboard-sdk 10.3.0 → 10.4.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/Customer/Customer.consts.d.ts +2 -0
- package/dist/Customer/Customer.consts.js +3 -1
- package/dist/Customer/Customer.consts.js.map +1 -1
- package/dist/Customer/v2/customers-api.d.ts +8 -0
- package/dist/Customer/v2/customers-api.js +20 -3
- package/dist/Customer/v2/customers-api.js.map +1 -1
- package/dist/Data/data-store-with-signals.d.ts +34 -0
- package/dist/Data/data-store-with-signals.js +81 -0
- package/dist/Data/data-store-with-signals.js.map +1 -0
- package/dist/Data/item-change-signals.d.ts +27 -0
- package/dist/Data/item-change-signals.js +152 -0
- package/dist/Data/item-change-signals.js.map +1 -0
- package/dist/Data/main-data-store.d.ts +11 -0
- package/dist/Data/main-data-store.js +3 -0
- package/dist/Data/main-data-store.js.map +1 -0
- package/dist/Data/merge-mapper.d.ts +2 -2
- package/dist/Data/merge-mapper.js.map +1 -1
- package/dist/Data/storable-realtime-subscriptions.d.ts +2 -2
- package/dist/Data/storable-realtime-subscriptions.js.map +1 -1
- package/dist/MerchantConfiguration/MerchantConfiguration.consts.js +0 -1
- package/dist/MerchantConfiguration/MerchantConfiguration.consts.js.map +1 -1
- package/dist/bringg-dashboard-sdk-cjs2.js +271 -6
- package/dist/bringg-dashboard-sdk-cjs2.js.map +1 -1
- package/dist/bringg-dashboard-sdk.js +26 -4
- package/dist/bringg-dashboard-sdk.min.js +1 -1
- package/dist/bringg-dashboard-sdk.min.js.map +1 -1
- package/dist/storable-data-service.d.ts +2 -2
- package/dist/storable-data-service.js.map +1 -1
- package/package.json +2 -2
|
@@ -8300,13 +8300,15 @@ exports["default"] = CustomAttributesEntity;
|
|
|
8300
8300
|
"use strict";
|
|
8301
8301
|
|
|
8302
8302
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8303
|
-
exports.RealtimeEvents = void 0;
|
|
8303
|
+
exports.WAYPOINT_CUSTOMER_FROM_STORE_FF = exports.RealtimeEvents = void 0;
|
|
8304
8304
|
var RealtimeEvents;
|
|
8305
8305
|
(function (RealtimeEvents) {
|
|
8306
8306
|
RealtimeEvents["Created"] = "customer created";
|
|
8307
8307
|
RealtimeEvents["Updated"] = "customer update";
|
|
8308
8308
|
RealtimeEvents["Deleted"] = "customer delete";
|
|
8309
8309
|
})(RealtimeEvents = exports.RealtimeEvents || (exports.RealtimeEvents = {}));
|
|
8310
|
+
/** Feature flag of the waypoint customer from the customers store (bringg-frontend, Angular, dashboard-sdk). */
|
|
8311
|
+
exports.WAYPOINT_CUSTOMER_FROM_STORE_FF = 'enable_waypoint_customer_from_store';
|
|
8310
8312
|
//# sourceMappingURL=Customer.consts.js.map
|
|
8311
8313
|
|
|
8312
8314
|
/***/ }),
|
|
@@ -8368,10 +8370,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8368
8370
|
};
|
|
8369
8371
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8370
8372
|
var lodash_1 = __importDefault(__webpack_require__(96486));
|
|
8373
|
+
var data_store_with_signals_1 = __importDefault(__webpack_require__(56692));
|
|
8371
8374
|
var merge_mapper_1 = __webpack_require__(59200);
|
|
8372
8375
|
var storable_realtime_subscriptions_1 = __importDefault(__webpack_require__(1227));
|
|
8373
8376
|
var data_entity_1 = __webpack_require__(91083);
|
|
8374
|
-
var data_store_1 = __importDefault(__webpack_require__(73135));
|
|
8375
8377
|
var storable_data_service_1 = __importDefault(__webpack_require__(45297));
|
|
8376
8378
|
var array_utils_1 = __webpack_require__(43052);
|
|
8377
8379
|
var Customer_consts_1 = __webpack_require__(85240);
|
|
@@ -8379,7 +8381,8 @@ var customers_service_1 = __importDefault(__webpack_require__(52639));
|
|
|
8379
8381
|
var CustomersApi = /** @class */ (function () {
|
|
8380
8382
|
function CustomersApi(session) {
|
|
8381
8383
|
var _this = this;
|
|
8382
|
-
this.
|
|
8384
|
+
this.session = session;
|
|
8385
|
+
this.customersStore = new data_store_with_signals_1.default('customersStore');
|
|
8383
8386
|
this.customersService = new customers_service_1.default(session);
|
|
8384
8387
|
this.storableDataService = new storable_data_service_1.default(this.customersStore, function (customer) {
|
|
8385
8388
|
return merge_mapper_1.mergeMapper.mergeIntoExisting(_this.customersStore, customer);
|
|
@@ -8398,8 +8401,20 @@ var CustomersApi = /** @class */ (function () {
|
|
|
8398
8401
|
CustomersApi.prototype.onCreate = function (callback) {
|
|
8399
8402
|
return this.storableRealtimeSubscriptions.onEvent(Customer_consts_1.RealtimeEvents.Created, function (item) { return callback(item.current); });
|
|
8400
8403
|
};
|
|
8404
|
+
/**
|
|
8405
|
+
* Self-push: Angular pushes back the stored customer object after the tasks merge changed it in place, so the merge
|
|
8406
|
+
* finds no diff and `set` reports the change. Cost: every such push re-renders that customer's views even with no
|
|
8407
|
+
* change. Remove it with the Angular pushes once customer realtime events and this flag are on.
|
|
8408
|
+
* Do not call it from a MobX reaction or an observer render: with the flag on, the self-push fires the signal that
|
|
8409
|
+
* the reaction just read, so it runs again until MobX stops it (100 runs).
|
|
8410
|
+
*/
|
|
8401
8411
|
CustomersApi.prototype.add = function (customer) {
|
|
8402
|
-
|
|
8412
|
+
var isSelfPush = this.customersStore.allItems[customer.id] === customer;
|
|
8413
|
+
var mapped = this.storableDataService.updateInStores(customer);
|
|
8414
|
+
if (isSelfPush && isWaypointCustomerFromStoreEnabled(this.session)) {
|
|
8415
|
+
this.customersStore.set(customer);
|
|
8416
|
+
}
|
|
8417
|
+
return mapped;
|
|
8403
8418
|
};
|
|
8404
8419
|
CustomersApi.prototype.getAll = function () {
|
|
8405
8420
|
return this.customersStore.getAll();
|
|
@@ -8480,6 +8495,10 @@ var CustomersApi = /** @class */ (function () {
|
|
|
8480
8495
|
return CustomersApi;
|
|
8481
8496
|
}());
|
|
8482
8497
|
exports["default"] = CustomersApi;
|
|
8498
|
+
function isWaypointCustomerFromStoreEnabled(session) {
|
|
8499
|
+
var _a, _b;
|
|
8500
|
+
return Boolean((_b = (_a = session.user) === null || _a === void 0 ? void 0 : _a.feature_flags) === null || _b === void 0 ? void 0 : _b[Customer_consts_1.WAYPOINT_CUSTOMER_FROM_STORE_FF]);
|
|
8501
|
+
}
|
|
8483
8502
|
//# sourceMappingURL=customers-api.js.map
|
|
8484
8503
|
|
|
8485
8504
|
/***/ }),
|
|
@@ -8979,6 +8998,253 @@ exports["default"] = Dashboard;
|
|
|
8979
8998
|
|
|
8980
8999
|
/***/ }),
|
|
8981
9000
|
|
|
9001
|
+
/***/ 56692:
|
|
9002
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
9003
|
+
|
|
9004
|
+
"use strict";
|
|
9005
|
+
|
|
9006
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9007
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9008
|
+
};
|
|
9009
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9010
|
+
var data_store_1 = __importDefault(__webpack_require__(73135));
|
|
9011
|
+
var item_change_signals_1 = __importDefault(__webpack_require__(5508));
|
|
9012
|
+
/**
|
|
9013
|
+
* A shallow `DataStore` whose MobX reactions re-run when an item they read is added, changed or removed.
|
|
9014
|
+
* Items stay plain objects. Readers report what they read, writers fire the signals, the inner store holds the data.
|
|
9015
|
+
* When to use it instead of `DataStore`: see "Choosing a store" in `.cursor/rules/v2-apis.mdc`.
|
|
9016
|
+
*/
|
|
9017
|
+
var DataStoreWithSignals = /** @class */ (function () {
|
|
9018
|
+
/**
|
|
9019
|
+
* @param storeId - Store name for the MobX atom names, for example `customersStore`
|
|
9020
|
+
* @param groupFilters - Passed to the inner `DataStore`
|
|
9021
|
+
*/
|
|
9022
|
+
function DataStoreWithSignals(storeId, groupFilters) {
|
|
9023
|
+
if (groupFilters === void 0) { groupFilters = []; }
|
|
9024
|
+
this.store = new data_store_1.default(groupFilters, { shallow: true });
|
|
9025
|
+
this.signals = new item_change_signals_1.default(storeId);
|
|
9026
|
+
}
|
|
9027
|
+
Object.defineProperty(DataStoreWithSignals.prototype, "allItems", {
|
|
9028
|
+
/** The inner items by id. Reading it subscribes nothing: use it in writers, never in views. */
|
|
9029
|
+
get: function () {
|
|
9030
|
+
return this.store.allItems;
|
|
9031
|
+
},
|
|
9032
|
+
enumerable: false,
|
|
9033
|
+
configurable: true
|
|
9034
|
+
});
|
|
9035
|
+
DataStoreWithSignals.prototype.get = function (id) {
|
|
9036
|
+
this.signals.observe(id);
|
|
9037
|
+
return this.store.get(id);
|
|
9038
|
+
};
|
|
9039
|
+
DataStoreWithSignals.prototype.getAll = function () {
|
|
9040
|
+
this.signals.observeAll();
|
|
9041
|
+
return this.store.getAll();
|
|
9042
|
+
};
|
|
9043
|
+
DataStoreWithSignals.prototype.getGroup = function (group, groupValue) {
|
|
9044
|
+
this.signals.observeAll();
|
|
9045
|
+
return this.store.getGroup(group, groupValue);
|
|
9046
|
+
};
|
|
9047
|
+
DataStoreWithSignals.prototype.isGroupInitialized = function (groupType, groupValue) {
|
|
9048
|
+
return this.store.isGroupInitialized(groupType, groupValue);
|
|
9049
|
+
};
|
|
9050
|
+
DataStoreWithSignals.prototype.set = function (item) {
|
|
9051
|
+
this.store.set(item);
|
|
9052
|
+
this.signals.notify([item.id]);
|
|
9053
|
+
};
|
|
9054
|
+
DataStoreWithSignals.prototype.remove = function (id) {
|
|
9055
|
+
this.store.remove(id);
|
|
9056
|
+
this.signals.notify([id]);
|
|
9057
|
+
};
|
|
9058
|
+
DataStoreWithSignals.prototype.setMany = function (items) {
|
|
9059
|
+
this.store.setMany(items);
|
|
9060
|
+
this.signals.notify(items.filter(isChanged).map(function (item) { return item.current.id; }));
|
|
9061
|
+
};
|
|
9062
|
+
DataStoreWithSignals.prototype.setAll = function (items) {
|
|
9063
|
+
this.store.setAll(items);
|
|
9064
|
+
this.signals.notifyAllObserved();
|
|
9065
|
+
};
|
|
9066
|
+
DataStoreWithSignals.prototype.setGroup = function (groupType, groupValue, items) {
|
|
9067
|
+
this.store.setGroup(groupType, groupValue, items);
|
|
9068
|
+
this.signals.notifyAllObserved();
|
|
9069
|
+
};
|
|
9070
|
+
Object.defineProperty(DataStoreWithSignals.prototype, "observedItemsCount", {
|
|
9071
|
+
/** @internal Number of items that reactions observe right now. For tests. */
|
|
9072
|
+
get: function () {
|
|
9073
|
+
return this.signals.observedCount;
|
|
9074
|
+
},
|
|
9075
|
+
enumerable: false,
|
|
9076
|
+
configurable: true
|
|
9077
|
+
});
|
|
9078
|
+
return DataStoreWithSignals;
|
|
9079
|
+
}());
|
|
9080
|
+
exports["default"] = DataStoreWithSignals;
|
|
9081
|
+
// No diff = a new item. An empty diff = nothing changed.
|
|
9082
|
+
function isChanged(item) {
|
|
9083
|
+
return !item.diff || Object.keys(item.diff).length > 0;
|
|
9084
|
+
}
|
|
9085
|
+
//# sourceMappingURL=data-store-with-signals.js.map
|
|
9086
|
+
|
|
9087
|
+
/***/ }),
|
|
9088
|
+
|
|
9089
|
+
/***/ 5508:
|
|
9090
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
9091
|
+
|
|
9092
|
+
"use strict";
|
|
9093
|
+
|
|
9094
|
+
var __values = (this && this.__values) || function(o) {
|
|
9095
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
9096
|
+
if (m) return m.call(o);
|
|
9097
|
+
if (o && typeof o.length === "number") return {
|
|
9098
|
+
next: function () {
|
|
9099
|
+
if (o && i >= o.length) o = void 0;
|
|
9100
|
+
return { value: o && o[i++], done: !o };
|
|
9101
|
+
}
|
|
9102
|
+
};
|
|
9103
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
9104
|
+
};
|
|
9105
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9106
|
+
var BringgDashboardSDK_1 = __webpack_require__(5655);
|
|
9107
|
+
/**
|
|
9108
|
+
* Per-item change signals for a shallow DataStore: a reaction that reads an id re-runs when that id changes.
|
|
9109
|
+
* Id signals live only while a reaction reads them; other reads watch `anyChange`, so no change is lost (mobx >= 6.7).
|
|
9110
|
+
* Uses only the MobX instance passed at login, so the host app's reactions track it.
|
|
9111
|
+
*/
|
|
9112
|
+
var ItemChangeSignals = /** @class */ (function () {
|
|
9113
|
+
/** @param storeId - Store name for the MobX atom names (devtools and spy only), for example `customersStore`. */
|
|
9114
|
+
function ItemChangeSignals(storeId) {
|
|
9115
|
+
this.storeId = storeId;
|
|
9116
|
+
// Keyed by Number(id): stores accept number-like string ids too.
|
|
9117
|
+
this.atoms = new Map();
|
|
9118
|
+
}
|
|
9119
|
+
/** Reports a read of `id`. Subscribes the current reaction to changes of that id. */
|
|
9120
|
+
ItemChangeSignals.prototype.observe = function (id) {
|
|
9121
|
+
if (id === undefined || id === null || !getMobx()) {
|
|
9122
|
+
return;
|
|
9123
|
+
}
|
|
9124
|
+
id = Number(id);
|
|
9125
|
+
// Cheap filter, the probe never fires: false for a read outside any derivation, so no per-id atom is created on the
|
|
9126
|
+
// hot path. Such a read reports only the shared `anyChange` atom.
|
|
9127
|
+
if (!this.getProbe().reportObserved()) {
|
|
9128
|
+
this.getAnyChange().reportObserved();
|
|
9129
|
+
return;
|
|
9130
|
+
}
|
|
9131
|
+
var atom = this.atoms.get(id);
|
|
9132
|
+
var isNew = !atom;
|
|
9133
|
+
if (isNew) {
|
|
9134
|
+
atom = this.createAtom(id);
|
|
9135
|
+
}
|
|
9136
|
+
// Exact check: false for a new atom read by a computed evaluated inside an action (no reaction behind it).
|
|
9137
|
+
// MobX never calls the unobserve callback of such an atom, so it would leak; watch `anyChange` instead.
|
|
9138
|
+
if (!atom.reportObserved()) {
|
|
9139
|
+
if (isNew) {
|
|
9140
|
+
this.atoms.delete(id);
|
|
9141
|
+
}
|
|
9142
|
+
this.getAnyChange().reportObserved();
|
|
9143
|
+
}
|
|
9144
|
+
};
|
|
9145
|
+
/** Reports a read of the whole store (list readers). Subscribes the current reaction to every change. */
|
|
9146
|
+
ItemChangeSignals.prototype.observeAll = function () {
|
|
9147
|
+
if (getMobx()) {
|
|
9148
|
+
this.getAnyChange().reportObserved();
|
|
9149
|
+
}
|
|
9150
|
+
};
|
|
9151
|
+
/** Reports a change of each id, in one MobX action, then fires `anyChange` once. */
|
|
9152
|
+
ItemChangeSignals.prototype.notify = function (ids) {
|
|
9153
|
+
var _this = this;
|
|
9154
|
+
if (!ids.length || !this.hasBeenRead()) {
|
|
9155
|
+
return;
|
|
9156
|
+
}
|
|
9157
|
+
getMobx().runInAction(function () {
|
|
9158
|
+
var e_1, _a;
|
|
9159
|
+
var _b;
|
|
9160
|
+
try {
|
|
9161
|
+
for (var ids_1 = __values(ids), ids_1_1 = ids_1.next(); !ids_1_1.done; ids_1_1 = ids_1.next()) {
|
|
9162
|
+
var id = ids_1_1.value;
|
|
9163
|
+
(_b = _this.atoms.get(Number(id))) === null || _b === void 0 ? void 0 : _b.reportChanged();
|
|
9164
|
+
}
|
|
9165
|
+
}
|
|
9166
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
9167
|
+
finally {
|
|
9168
|
+
try {
|
|
9169
|
+
if (ids_1_1 && !ids_1_1.done && (_a = ids_1.return)) _a.call(ids_1);
|
|
9170
|
+
}
|
|
9171
|
+
finally { if (e_1) throw e_1.error; }
|
|
9172
|
+
}
|
|
9173
|
+
_this.getAnyChange().reportChanged();
|
|
9174
|
+
});
|
|
9175
|
+
};
|
|
9176
|
+
/** Reports a change of every observed id (a store reload or a bulk remove). */
|
|
9177
|
+
ItemChangeSignals.prototype.notifyAllObserved = function () {
|
|
9178
|
+
var _this = this;
|
|
9179
|
+
if (!this.hasBeenRead()) {
|
|
9180
|
+
return;
|
|
9181
|
+
}
|
|
9182
|
+
getMobx().runInAction(function () {
|
|
9183
|
+
var e_2, _a;
|
|
9184
|
+
try {
|
|
9185
|
+
for (var _b = __values(_this.atoms.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
9186
|
+
var atom = _c.value;
|
|
9187
|
+
atom.reportChanged();
|
|
9188
|
+
}
|
|
9189
|
+
}
|
|
9190
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
9191
|
+
finally {
|
|
9192
|
+
try {
|
|
9193
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
9194
|
+
}
|
|
9195
|
+
finally { if (e_2) throw e_2.error; }
|
|
9196
|
+
}
|
|
9197
|
+
_this.getAnyChange().reportChanged();
|
|
9198
|
+
});
|
|
9199
|
+
};
|
|
9200
|
+
Object.defineProperty(ItemChangeSignals.prototype, "observedCount", {
|
|
9201
|
+
/** Number of live id atoms. For tests only. */
|
|
9202
|
+
get: function () {
|
|
9203
|
+
return this.atoms.size;
|
|
9204
|
+
},
|
|
9205
|
+
enumerable: false,
|
|
9206
|
+
configurable: true
|
|
9207
|
+
});
|
|
9208
|
+
// False until the first read: before it, no reaction can be watching.
|
|
9209
|
+
ItemChangeSignals.prototype.hasBeenRead = function () {
|
|
9210
|
+
return Boolean(this.anyChange) || this.atoms.size > 0;
|
|
9211
|
+
};
|
|
9212
|
+
ItemChangeSignals.prototype.createAtom = function (id) {
|
|
9213
|
+
var _this = this;
|
|
9214
|
+
// The callback reads `atom` only when MobX calls it, at the end of a batch after the last observer left,
|
|
9215
|
+
// never during `createAtom`.
|
|
9216
|
+
var atom = getMobx().createAtom("".concat(this.storeId, ".item.").concat(id), undefined, function () {
|
|
9217
|
+
if (_this.atoms.get(id) === atom) {
|
|
9218
|
+
_this.atoms.delete(id);
|
|
9219
|
+
}
|
|
9220
|
+
});
|
|
9221
|
+
this.atoms.set(id, atom);
|
|
9222
|
+
return atom;
|
|
9223
|
+
};
|
|
9224
|
+
ItemChangeSignals.prototype.getProbe = function () {
|
|
9225
|
+
if (!this.probe) {
|
|
9226
|
+
this.probe = getMobx().createAtom("".concat(this.storeId, ".probe"));
|
|
9227
|
+
}
|
|
9228
|
+
return this.probe;
|
|
9229
|
+
};
|
|
9230
|
+
ItemChangeSignals.prototype.getAnyChange = function () {
|
|
9231
|
+
if (!this.anyChange) {
|
|
9232
|
+
this.anyChange = getMobx().createAtom("".concat(this.storeId, ".anyChange"));
|
|
9233
|
+
}
|
|
9234
|
+
return this.anyChange;
|
|
9235
|
+
};
|
|
9236
|
+
return ItemChangeSignals;
|
|
9237
|
+
}());
|
|
9238
|
+
exports["default"] = ItemChangeSignals;
|
|
9239
|
+
// Null before login (globals are set by `BringgDashboardSDK.login`): no MobX, so no reaction can observe anything.
|
|
9240
|
+
function getMobx() {
|
|
9241
|
+
var _a;
|
|
9242
|
+
return (_a = (0, BringgDashboardSDK_1.getGlobals)()) === null || _a === void 0 ? void 0 : _a.mobx;
|
|
9243
|
+
}
|
|
9244
|
+
//# sourceMappingURL=item-change-signals.js.map
|
|
9245
|
+
|
|
9246
|
+
/***/ }),
|
|
9247
|
+
|
|
8982
9248
|
/***/ 93670:
|
|
8983
9249
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
8984
9250
|
|
|
@@ -14666,7 +14932,6 @@ exports.MerchantConfigurationKeys = [
|
|
|
14666
14932
|
'application_configurations',
|
|
14667
14933
|
'application_merchant_configurations',
|
|
14668
14934
|
'applications',
|
|
14669
|
-
'auto_dispatch',
|
|
14670
14935
|
'auto_dispatch_optimization_method',
|
|
14671
14936
|
'auto_dispatch_timeout',
|
|
14672
14937
|
'auto_dispatch_timeout_per_driver',
|
|
@@ -25231,7 +25496,7 @@ var BringgException_1 = __webpack_require__(43605);
|
|
|
25231
25496
|
var client_page_1 = __webpack_require__(16573);
|
|
25232
25497
|
var Logger_1 = __importDefault(__webpack_require__(55860));
|
|
25233
25498
|
var abort_1 = __webpack_require__(34179);
|
|
25234
|
-
var version = '10.
|
|
25499
|
+
var version = '10.4.0';
|
|
25235
25500
|
function logErrorResponse(response) {
|
|
25236
25501
|
var data = response.data, status = response.status;
|
|
25237
25502
|
try {
|