@kodaris/krubble-app-components 1.0.65 → 1.0.67

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.
@@ -342,6 +342,7 @@ var __decorate$5 = (undefined && undefined.__decorate) || function (decorators,
342
342
  * @property {KRNavItem[]} nav - Navigation items as JSON array
343
343
  * @property {KRUser} user - User profile data
344
344
  * @property {boolean} navEnabled - Whether to show the nav drawer (menu toggle remains visible when false)
345
+ * @property {'employee'|'customer'} user-type - User type. Customers skip all `/api/system` calls since that endpoint is employee-only. Defaults to 'employee'.
345
346
  *
346
347
  *
347
348
  * TODO
@@ -394,6 +395,10 @@ let KRScaffold = class KRScaffold extends i$1 {
394
395
  * Menu toggle button remains visible and emits menu-click events.
395
396
  */
396
397
  this.navEnabled = true;
398
+ /**
399
+ * User type. Set to 'customer' to skip all /api/system calls — customers don't have access to that endpoint.
400
+ */
401
+ this.userType = 'employee';
397
402
  /**
398
403
  * Breadcrumbs to display in the subbar
399
404
  */
@@ -403,9 +408,13 @@ let KRScaffold = class KRScaffold extends i$1 {
403
408
  }
404
409
  connectedCallback() {
405
410
  super.connectedCallback();
406
- this.loadPref();
407
411
  this.installFetchInterceptor();
408
412
  }
413
+ // Attributes are not reflected into properties until after the first update,
414
+ // so loadPref() must run here (not connectedCallback) for user-type to be set.
415
+ firstUpdated() {
416
+ this.loadPref();
417
+ }
409
418
  updated(changedProperties) {
410
419
  super.updated(changedProperties);
411
420
  if (changedProperties.has('nav') && this.nav.length > 0) {
@@ -777,6 +786,8 @@ let KRScaffold = class KRScaffold extends i$1 {
777
786
  this.pref.nav = {};
778
787
  }
779
788
  savePref() {
789
+ if (this.userType === 'customer')
790
+ return;
780
791
  const url = this.pref.uuid
781
792
  ? `/api/system/preference/json/scaffold/${this.pref.uuid}?global=true`
782
793
  : `/api/system/preference/json/scaffold?global=true`;
@@ -795,6 +806,8 @@ let KRScaffold = class KRScaffold extends i$1 {
795
806
  });
796
807
  }
797
808
  loadPref() {
809
+ if (this.userType === 'customer')
810
+ return;
798
811
  KRHttp.fetch({
799
812
  url: '/api/system/preference/json/scaffold?global=true',
800
813
  method: 'GET',
@@ -2207,6 +2220,9 @@ __decorate$5([
2207
2220
  __decorate$5([
2208
2221
  n({ type: Boolean, attribute: 'nav-enabled' })
2209
2222
  ], KRScaffold.prototype, "navEnabled", void 0);
2223
+ __decorate$5([
2224
+ n({ type: String, attribute: 'user-type' })
2225
+ ], KRScaffold.prototype, "userType", void 0);
2210
2226
  __decorate$5([
2211
2227
  n({ type: Array })
2212
2228
  ], KRScaffold.prototype, "breadcrumbs", void 0);