@africanies/angular-web-sdk 0.1.8 → 0.1.9

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 (53) hide show
  1. package/.angular/cache/22.0.9/playground/.tsbuildinfo +1 -1
  2. package/.nx/cache/17289624717336768573/dist/libs/africanies-core/README.md +85 -0
  3. package/.nx/cache/17289624717336768573/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +4639 -0
  4. package/.nx/cache/17289624717336768573/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -0
  5. package/.nx/cache/17289624717336768573/dist/libs/africanies-core/package.json +31 -0
  6. package/.nx/cache/17289624717336768573/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +2748 -0
  7. package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/README.md +68 -0
  8. package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
  9. package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
  10. package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +5 -0
  11. package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/assets/carriers/dhl.svg +7 -0
  12. package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +19500 -0
  13. package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
  14. package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/package.json +35 -0
  15. package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +5521 -0
  16. package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/README.md +46 -0
  17. package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +243 -0
  18. package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
  19. package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/package.json +35 -0
  20. package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/tailwind-preset.cjs +330 -0
  21. package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +176 -0
  22. package/.nx/cache/run.json +25 -25
  23. package/.nx/cache/terminalOutputs/12565224028063674529 +37 -0
  24. package/.nx/cache/terminalOutputs/13478445034325959094 +176 -0
  25. package/.nx/cache/terminalOutputs/15835338512221847842 +184 -182
  26. package/.nx/cache/terminalOutputs/17289624717336768573 +21 -0
  27. package/.nx/cache/terminalOutputs/17571479482482478257 +35 -0
  28. package/.nx/cache/terminalOutputs/3088264223473143358 +8 -0
  29. package/.nx/cache/terminalOutputs/3953970051755345887 +21 -0
  30. package/.nx/cache/terminalOutputs/4225324930345532464 +21 -0
  31. package/.nx/cache/terminalOutputs/4363587767476846758 +176 -0
  32. package/.nx/cache/terminalOutputs/8193462679279018087 +39 -0
  33. package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db +0 -0
  34. package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-shm +0 -0
  35. package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-wal +0 -0
  36. package/.nx/workspace-data/d/daemon.log +4460 -0
  37. package/.nx/workspace-data/d/server-process.json +2 -2
  38. package/.nx/workspace-data/file-map.json +2998 -3006
  39. package/.nx/workspace-data/nx_files.nxt +0 -0
  40. package/.nx/workspace-data/project-graph.json +2 -2
  41. package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +6 -1
  42. package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -1
  43. package/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +6 -1
  44. package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +30 -55
  45. package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -1
  46. package/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +14 -16
  47. package/libs/africanies-core/src/index.ts +1 -1
  48. package/libs/africanies-core/src/lib/notification/notification-link.ts +6 -1
  49. package/libs/africanies-ui/src/lib/layout/app-shell-header.component.ts +9 -9
  50. package/libs/africanies-ui/src/lib/layout/header-greeting.util.ts +0 -2
  51. package/libs/africanies-ui/src/lib/layout/header-weather.spec.ts +11 -40
  52. package/libs/africanies-ui/src/lib/layout/header-weather.ts +22 -63
  53. package/package.json +1 -1
@@ -2241,7 +2241,10 @@ declare class NotificationService {
2241
2241
  static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
2242
2242
  }
2243
2243
 
2244
- /** Signed export downloads and other hosts that must not be rewritten in-app. */
2244
+ /**
2245
+ * Signed export downloads and other hosts that must not be rewritten in-app.
2246
+ * @param link
2247
+ */
2245
2248
  declare function isNotificationExternalLink(link: string): boolean;
2246
2249
  /**
2247
2250
  * Rewrite a notification href for the active {@link ShippingMode}.
@@ -2250,6 +2253,8 @@ declare function isNotificationExternalLink(link: string): boolean;
2250
2253
  * - Legacy portal hosts become relative `/portal/...` paths with query preserved.
2251
2254
  * - When the notification already includes `shipment_app`, it is kept as-is.
2252
2255
  * - Otherwise classic host / `shipment_app` rewriting applies for portal URLs.
2256
+ * @param link
2257
+ * @param mode
2253
2258
  */
2254
2259
  declare function resolveNotificationLinkForMode(link: string | null | undefined, mode: ShippingMode): string;
2255
2260
 
@@ -16091,14 +16091,12 @@ function hashString(value) {
16091
16091
  return hash;
16092
16092
  }
16093
16093
 
16094
- /** Bump when cache shape or city resolution strategy changes. */
16095
- const CACHE_KEY = 'africanies-header-weather-v4';
16094
+ /** Bump when cache shape or lookup strategy changes. */
16095
+ const CACHE_KEY = 'africanies-header-weather-v5';
16096
16096
  const FETCH_MS = 4_000;
16097
16097
  const BROWSER_GEO_MS = 3_500;
16098
- /** IP fallback — city string is often wrong (e.g. NG IPs labelled Lagos). */
16098
+ /** IP fallback for coordinates only — city strings are often wrong. */
16099
16099
  const GEO_URL = 'https://get.geojs.io/v1/ip/geo.json';
16100
- /** Client reverse-geocode so the label matches the forecast coordinates. */
16101
- const REVERSE_GEO_URL = 'https://api.bigdatacloud.net/data/reverse-geocode-client';
16102
16100
  const WEATHER_LABELS = {
16103
16101
  clear: 'Clear',
16104
16102
  cloudy: 'Cloudy',
@@ -16142,9 +16140,13 @@ function mapWmoWeatherCode(code) {
16142
16140
  * Short condition label for the header weather chip.
16143
16141
  *
16144
16142
  * @param kind - Coarse forecast kind.
16145
- * @returns Display label such as `Rain` or `Clear`.
16143
+ * @param hour - Local hour; clear days show as Sunny, nights as Clear.
16144
+ * @returns Display label such as `Rain` or `Sunny`.
16146
16145
  */
16147
- function headerWeatherLabel(kind) {
16146
+ function headerWeatherLabel(kind, hour = new Date().getHours()) {
16147
+ if (kind === 'clear') {
16148
+ return hour >= 19 || hour < 6 ? 'Clear' : 'Sunny';
16149
+ }
16148
16150
  return WEATHER_LABELS[kind];
16149
16151
  }
16150
16152
  /**
@@ -16164,12 +16166,12 @@ function headerWeatherIcon(kind, hour) {
16164
16166
  return 'cloud-o';
16165
16167
  }
16166
16168
  /**
16167
- * City-level forecast via browser / IP geolocation + Open-Meteo (no API key).
16169
+ * Local forecast via browser / IP coordinates + Open-Meteo (no API key).
16168
16170
  *
16169
- * Coordinates prefer the browser Geolocation API (accurate for travellers;
16170
- * may prompt once). Otherwise IP geo is used. The city label is reverse-
16171
- * geocoded from those coordinates IP `city` strings are often wrong for
16172
- * Nigeria (many networks resolve as Lagos).
16171
+ * Coordinates prefer the browser Geolocation API (may prompt once).
16172
+ * Otherwise IP geo is used for lat/lon only — city labels are not shown
16173
+ * because IP and reverse-geocode cities are often wrong (e.g. NG IPs
16174
+ * labelled Lagos).
16173
16175
  *
16174
16176
  * Fails closed: missing browser APIs, timeouts, and HTTP errors all return
16175
16177
  * `null` so the greeting can stay time-of-day only. Cached per local hour
@@ -16206,10 +16208,8 @@ async function loadHeaderWeather(fetchFn) {
16206
16208
  return null;
16207
16209
  }
16208
16210
  const temperatureC = asNumber(forecast?.current?.temperature_2m) ?? undefined;
16209
- const city = (await reverseGeocodeCity(run, coords.latitude, coords.longitude)) ??
16210
- coords.fallbackCity;
16211
- const weather = { kind, temperatureC, city };
16212
- writeCache({ hour, kind, temperatureC, city });
16211
+ const weather = { kind, temperatureC };
16212
+ writeCache({ hour, kind, temperatureC });
16213
16213
  return weather;
16214
16214
  }
16215
16215
  catch {
@@ -16235,7 +16235,6 @@ function readCache(hour) {
16235
16235
  return {
16236
16236
  kind: parsed.kind,
16237
16237
  temperatureC: parsed.temperatureC,
16238
- city: parsed.city,
16239
16238
  };
16240
16239
  }
16241
16240
  catch {
@@ -16252,8 +16251,7 @@ function writeCache(value) {
16252
16251
  }
16253
16252
  /**
16254
16253
  * Prefer device coordinates when available (may prompt once); otherwise fall
16255
- * back to IP geo. IP city labels for Nigeria are often wrong — reverse
16256
- * geocoding from these coordinates still depends on accurate lat/lon.
16254
+ * back to IP lat/lon for the forecast only.
16257
16255
  */
16258
16256
  async function resolveCoordinates(fetchFn) {
16259
16257
  const browser = await tryBrowserGeolocation();
@@ -16266,11 +16264,7 @@ async function resolveCoordinates(fetchFn) {
16266
16264
  if (latitude === null || longitude === null) {
16267
16265
  return null;
16268
16266
  }
16269
- return {
16270
- latitude,
16271
- longitude,
16272
- fallbackCity: asCity(geo?.city),
16273
- };
16267
+ return { latitude, longitude };
16274
16268
  }
16275
16269
  async function tryBrowserGeolocation() {
16276
16270
  if (typeof navigator === 'undefined' ||
@@ -16295,15 +16289,6 @@ async function tryBrowserGeolocation() {
16295
16289
  });
16296
16290
  });
16297
16291
  }
16298
- async function reverseGeocodeCity(fetchFn, latitude, longitude) {
16299
- const url = `${REVERSE_GEO_URL}?latitude=${encodeURIComponent(String(latitude))}` +
16300
- `&longitude=${encodeURIComponent(String(longitude))}` +
16301
- `&localityLanguage=en`;
16302
- const payload = (await fetchJson(fetchFn, url));
16303
- return (asCity(payload?.city) ??
16304
- asCity(payload?.locality) ??
16305
- asCity(payload?.principalSubdivision));
16306
- }
16307
16292
  function asNumber(value) {
16308
16293
  if (typeof value === 'number' && Number.isFinite(value)) {
16309
16294
  return value;
@@ -16314,16 +16299,6 @@ function asNumber(value) {
16314
16299
  }
16315
16300
  return null;
16316
16301
  }
16317
- function asCity(value) {
16318
- if (typeof value !== 'string') {
16319
- return undefined;
16320
- }
16321
- const trimmed = value.trim();
16322
- if (!trimmed || trimmed.toLowerCase() === 'n/a') {
16323
- return undefined;
16324
- }
16325
- return trimmed;
16326
- }
16327
16302
  async function fetchJson(fetchFn, url) {
16328
16303
  const controller = new AbortController();
16329
16304
  const timer = setTimeout(() => controller.abort(), FETCH_MS);
@@ -16456,27 +16431,27 @@ class AppShellHeaderComponent {
16456
16431
  if (temp === undefined || !Number.isFinite(temp)) {
16457
16432
  return null;
16458
16433
  }
16459
- return temp.toFixed(1);
16434
+ return String(Math.round(temp));
16460
16435
  }, /* @ts-ignore */
16461
16436
  ...(ngDevMode ? [{ debugName: "weatherTemp" }] : /* istanbul ignore next */ []));
16462
- weatherPlace = computed(() => {
16437
+ weatherCondition = computed(() => {
16463
16438
  const forecast = this.weather();
16464
16439
  if (!forecast) {
16465
16440
  return '';
16466
16441
  }
16467
- return forecast.city?.trim() || headerWeatherLabel(forecast.kind);
16442
+ return headerWeatherLabel(forecast.kind, this.now().getHours());
16468
16443
  }, /* @ts-ignore */
16469
- ...(ngDevMode ? [{ debugName: "weatherPlace" }] : /* istanbul ignore next */ []));
16444
+ ...(ngDevMode ? [{ debugName: "weatherCondition" }] : /* istanbul ignore next */ []));
16470
16445
  weatherAriaLabel = computed(() => {
16471
16446
  const forecast = this.weather();
16472
16447
  if (!forecast) {
16473
16448
  return 'Weather';
16474
16449
  }
16475
- const condition = headerWeatherLabel(forecast.kind).toLowerCase();
16450
+ const condition = this.weatherCondition().toLowerCase();
16476
16451
  const temp = this.weatherTemp();
16477
- const city = forecast.city?.trim();
16478
- const degrees = temp === null ? condition : `${temp} degrees, ${condition}`;
16479
- return city ? `Weather in ${city}: ${degrees}` : `Weather: ${degrees}`;
16452
+ return temp === null
16453
+ ? `Weather: ${condition}`
16454
+ : `Weather: ${temp} degrees Celsius, ${condition}`;
16480
16455
  }, /* @ts-ignore */
16481
16456
  ...(ngDevMode ? [{ debugName: "weatherAriaLabel" }] : /* istanbul ignore next */ []));
16482
16457
  unreadCount = computed(() => (this.notifications() ?? []).filter((n) => !n.read).length, /* @ts-ignore */
@@ -16577,13 +16552,13 @@ class AppShellHeaderComponent {
16577
16552
  <span
16578
16553
  class="text-body-sm font-medium tabular-nums tracking-tight text-ink dark:text-white"
16579
16554
  >
16580
- {{ temp }}°
16555
+ {{ temp }}°C
16581
16556
  </span>
16582
16557
  }
16583
16558
  <span
16584
16559
  class="hidden text-caption text-neutral-600 md:inline dark:text-neutral-400"
16585
16560
  >
16586
- {{ weatherPlace() }}
16561
+ {{ weatherCondition() }}
16587
16562
  </span>
16588
16563
  </div>
16589
16564
  }
@@ -16704,13 +16679,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
16704
16679
  <span
16705
16680
  class="text-body-sm font-medium tabular-nums tracking-tight text-ink dark:text-white"
16706
16681
  >
16707
- {{ temp }}°
16682
+ {{ temp }}°C
16708
16683
  </span>
16709
16684
  }
16710
16685
  <span
16711
16686
  class="hidden text-caption text-neutral-600 md:inline dark:text-neutral-400"
16712
16687
  >
16713
- {{ weatherPlace() }}
16688
+ {{ weatherCondition() }}
16714
16689
  </span>
16715
16690
  </div>
16716
16691
  }