@a-cube-io/ereceipts-js-sdk 2.0.3 → 2.0.4
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/index.cjs.js +13 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.esm.js +13 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.js +13 -2
- package/dist/index.native.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -7651,6 +7651,10 @@ class AxiosHttpAdapter {
|
|
|
7651
7651
|
this.client.interceptors.request.use((config) => {
|
|
7652
7652
|
if (this.authToken) {
|
|
7653
7653
|
config.headers.Authorization = `Bearer ${this.authToken}`;
|
|
7654
|
+
log$2.debug('Adding JWT token to request');
|
|
7655
|
+
}
|
|
7656
|
+
else {
|
|
7657
|
+
log$2.warn('No JWT token available for request:', { url: config.url });
|
|
7654
7658
|
}
|
|
7655
7659
|
const method = config.method?.toUpperCase() ?? 'UNKNOWN';
|
|
7656
7660
|
log$2.debug(`→ ${method} ${config.url}`);
|
|
@@ -7746,6 +7750,7 @@ class AxiosHttpAdapter {
|
|
|
7746
7750
|
return this.mapResponse(response);
|
|
7747
7751
|
}
|
|
7748
7752
|
setAuthToken(token) {
|
|
7753
|
+
log$2.info('setAuthToken called:', { hasToken: !!token, tokenPrefix: token?.substring(0, 20) });
|
|
7749
7754
|
this.authToken = token;
|
|
7750
7755
|
}
|
|
7751
7756
|
getAuthToken() {
|
|
@@ -8786,8 +8791,14 @@ class SDKManager {
|
|
|
8786
8791
|
this.telemetryService.state$.subscribe(this.events.onTelemetryStateChanged);
|
|
8787
8792
|
}
|
|
8788
8793
|
this.isInitialized = true;
|
|
8789
|
-
|
|
8790
|
-
this.
|
|
8794
|
+
// Only start polling for MERCHANT/CASHIER users (SUPPLIER gets 401 on these endpoints)
|
|
8795
|
+
const user = await this.sdk.getCurrentUser();
|
|
8796
|
+
const canPoll = user && hasAnyRole(user.roles, ['ROLE_MERCHANT', 'ROLE_CASHIER']);
|
|
8797
|
+
if (canPoll) {
|
|
8798
|
+
this.notificationService.startPolling();
|
|
8799
|
+
await this.startTelemetryPollingAuto();
|
|
8800
|
+
}
|
|
8801
|
+
// AppStateService remains active for all users (handles OFFLINE network state)
|
|
8791
8802
|
}
|
|
8792
8803
|
/**
|
|
8793
8804
|
* Observable stream of app state
|