@busiverse/ui 0.2.20 → 0.2.21

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/billing.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  getServicePricingSummaries,
17
17
  getServicePricingSummary,
18
18
  labelCadence
19
- } from "./chunk-YLQKXFA7.js";
19
+ } from "./chunk-OMH22UAV.js";
20
20
  import {
21
21
  busiverseSupportedRegions,
22
22
  getSupportedRegion
@@ -2264,7 +2264,7 @@ var busiverseServicePricingCatalog = [
2264
2264
  },
2265
2265
  {
2266
2266
  "service": "communication",
2267
- "operationCode": "COMM_EMAIL_SEND",
2267
+ "operationCode": "COMMUNICATION_EMAIL_SENT",
2268
2268
  "displayName": "Email send",
2269
2269
  "category": "DELIVERY",
2270
2270
  "unit": "message",
@@ -2293,7 +2293,7 @@ var busiverseServicePricingCatalog = [
2293
2293
  },
2294
2294
  {
2295
2295
  "service": "communication",
2296
- "operationCode": "COMM_SMS_SEGMENT_SENT",
2296
+ "operationCode": "COMMUNICATION_SMS_SENT",
2297
2297
  "displayName": "SMS segment sent",
2298
2298
  "category": "DELIVERY",
2299
2299
  "unit": "segment",
@@ -2322,7 +2322,7 @@ var busiverseServicePricingCatalog = [
2322
2322
  },
2323
2323
  {
2324
2324
  "service": "communication",
2325
- "operationCode": "COMM_PUSH_NOTIFICATION_SENT",
2325
+ "operationCode": "COMMUNICATION_PUSH_SENT",
2326
2326
  "displayName": "Push notification sent",
2327
2327
  "category": "DELIVERY",
2328
2328
  "unit": "recipient",
@@ -2351,7 +2351,7 @@ var busiverseServicePricingCatalog = [
2351
2351
  },
2352
2352
  {
2353
2353
  "service": "communication",
2354
- "operationCode": "COMM_IN_APP_NOTIFICATION_SENT",
2354
+ "operationCode": "COMMUNICATION_INAPP_NOTIFICATION_CREATED",
2355
2355
  "displayName": "In-app notification sent",
2356
2356
  "category": "DELIVERY",
2357
2357
  "unit": "recipient",
@@ -2380,7 +2380,7 @@ var busiverseServicePricingCatalog = [
2380
2380
  },
2381
2381
  {
2382
2382
  "service": "communication",
2383
- "operationCode": "COMM_WHATSAPP_MESSAGE_SENT",
2383
+ "operationCode": "COMMUNICATION_WHATSAPP_SENT",
2384
2384
  "displayName": "WhatsApp message sent",
2385
2385
  "category": "DELIVERY",
2386
2386
  "unit": "message",
@@ -2409,7 +2409,7 @@ var busiverseServicePricingCatalog = [
2409
2409
  },
2410
2410
  {
2411
2411
  "service": "communication",
2412
- "operationCode": "COMM_BROADCAST_RECIPIENT",
2412
+ "operationCode": "COMMUNICATION_BROADCAST_RECIPIENT",
2413
2413
  "displayName": "Broadcast recipient",
2414
2414
  "category": "DELIVERY",
2415
2415
  "unit": "recipient",
@@ -2438,7 +2438,7 @@ var busiverseServicePricingCatalog = [
2438
2438
  },
2439
2439
  {
2440
2440
  "service": "communication",
2441
- "operationCode": "COMM_CAMPAIGN_STEP_EXECUTED",
2441
+ "operationCode": "COMMUNICATION_CAMPAIGN_AUTOMATION_STEP",
2442
2442
  "displayName": "Campaign step execution",
2443
2443
  "category": "PLATFORM",
2444
2444
  "unit": "step",
@@ -2467,7 +2467,7 @@ var busiverseServicePricingCatalog = [
2467
2467
  },
2468
2468
  {
2469
2469
  "service": "communication",
2470
- "operationCode": "COMM_WEBHOOK_DELIVERY_ATTEMPT",
2470
+ "operationCode": "COMMUNICATION_WEBHOOK_DELIVERY_ATTEMPT",
2471
2471
  "displayName": "Webhook delivery attempt",
2472
2472
  "category": "DELIVERY",
2473
2473
  "unit": "attempt",
@@ -2496,7 +2496,7 @@ var busiverseServicePricingCatalog = [
2496
2496
  },
2497
2497
  {
2498
2498
  "service": "communication",
2499
- "operationCode": "COMM_DOMAIN_VERIFICATION",
2499
+ "operationCode": "COMMUNICATION_DOMAIN_VERIFICATION",
2500
2500
  "displayName": "Sender domain verification",
2501
2501
  "category": "GOVERNANCE",
2502
2502
  "unit": "domain",
@@ -2583,7 +2583,7 @@ var busiverseServicePricingCatalog = [
2583
2583
  },
2584
2584
  {
2585
2585
  "service": "communication",
2586
- "operationCode": "COMM_INBOUND_MESSAGE_PROCESSED",
2586
+ "operationCode": "COMMUNICATION_INBOUND_MESSAGE_RECEIVED",
2587
2587
  "displayName": "Inbound message processing",
2588
2588
  "category": "USAGE",
2589
2589
  "unit": "message",
@@ -7368,7 +7368,7 @@ var busiverseServicePricingCatalog = [
7368
7368
  },
7369
7369
  {
7370
7370
  "service": "wallet",
7371
- "operationCode": "WALLET_TRANSFER_SUBMITTED",
7371
+ "operationCode": "WALLET_TRANSFER_EXECUTED",
7372
7372
  "displayName": "Wallet transfer submission",
7373
7373
  "category": "FINANCIAL",
7374
7374
  "unit": "transfer",
package/dist/index.js CHANGED
@@ -1,3 +1,10 @@
1
+ import {
2
+ BusiverseGithubIcon,
3
+ BusiverseLinkedInIcon,
4
+ BusiverseMailIcon,
5
+ BusiverseSocialIcon,
6
+ BusiverseXIcon
7
+ } from "./chunk-2TTXWTIT.js";
1
8
  import {
2
9
  busiverseColors,
3
10
  busiverseContainers,
@@ -41,7 +48,7 @@ import {
41
48
  getServicePricingSummaries,
42
49
  getServicePricingSummary,
43
50
  labelCadence
44
- } from "./chunk-YLQKXFA7.js";
51
+ } from "./chunk-OMH22UAV.js";
45
52
  import {
46
53
  BusiverseBrandHead,
47
54
  applyBusiverseBrandHead
@@ -72,13 +79,6 @@ import {
72
79
  import {
73
80
  BusiverseLogo
74
81
  } from "./chunk-RO6ZPS75.js";
75
- import {
76
- BusiverseGithubIcon,
77
- BusiverseLinkedInIcon,
78
- BusiverseMailIcon,
79
- BusiverseSocialIcon,
80
- BusiverseXIcon
81
- } from "./chunk-2TTXWTIT.js";
82
82
  import {
83
83
  cn
84
84
  } from "./chunk-PYZVP4NI.js";
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Where the signed-in person is, recorded with location so every entity they make can be placed.
3
+ *
4
+ * The browser is asked first, through its own permission prompt. Given, the reading is sent as the
5
+ * browser took it. Refused, unavailable or slow, location is asked to place the person by the network
6
+ * address the request came from instead, so every signed-in session has a position: precise where the
7
+ * person allowed it, approximate where they did not.
8
+ */
9
+ /** A reading the browser took. */
10
+ export interface PositionReading {
11
+ latitude: number;
12
+ longitude: number;
13
+ /** How far from the point the person may be, in metres, as the browser states it. */
14
+ accuracyMeters: number | null;
15
+ /** When the browser took the reading, as an ISO-8601 instant. */
16
+ capturedAt: string;
17
+ }
18
+ /** How the position reaches location; each frontend sends it with its own signed-in client. */
19
+ export interface PositionSender {
20
+ /** Sends a reading to `POST /location/api/v1/positions/mine`. */
21
+ record(reading: PositionReading): Promise<unknown>;
22
+ /** Asks `POST /location/api/v1/positions/mine/approximate` to place the person by their address. */
23
+ recordApproximate(): Promise<unknown>;
24
+ }
25
+ /** A console's own signed-in request: it attaches the person's token, as the console's other calls do. */
26
+ export type SignedInSend = (url: string, init: {
27
+ method: "POST";
28
+ headers: Record<string, string>;
29
+ body?: string;
30
+ }) => Promise<unknown>;
31
+ /**
32
+ * The sender every console uses: location's own-position endpoints behind the gateway, reached with
33
+ * the console's signed-in request. Every request at the edge reads `/<service>/api/v1/<resource>`,
34
+ * so location's paths follow from the gateway alone.
35
+ */
36
+ export declare function positionSender(gatewayUrl: string, send: SignedInSend): PositionSender;
37
+ /** What was recorded: the browser's reading, or the network's approximation. */
38
+ export type PositionOutcome = "browser" | "approximate";
39
+ export interface CaptureOptions {
40
+ /** The browser's geolocation; absent where the browser offers none. */
41
+ geolocation?: Geolocation | null;
42
+ /** How long to wait for the browser before falling back, in milliseconds. */
43
+ timeoutMs?: number;
44
+ }
45
+ /**
46
+ * Records the person's position once: the browser's reading when it gives one, the network's
47
+ * approximation when it does not. A failure to send either is the caller's to see.
48
+ */
49
+ export declare function capturePosition(sender: PositionSender, options?: CaptureOptions): Promise<PositionOutcome>;
50
+ //# sourceMappingURL=capturePosition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capturePosition.d.ts","sourceRoot":"","sources":["../../src/position/capturePosition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,kCAAkC;AAClC,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,+FAA+F;AAC/F,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD,oGAAoG;IACpG,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACvC;AAED,0GAA0G;AAC1G,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEvI;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,cAAc,CAOrF;AAED,gFAAgF;AAChF,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,aAAa,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAmBD;;;GAGG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAWpH"}
@@ -0,0 +1,13 @@
1
+ import { type CaptureOptions, type PositionSender } from "./capturePosition";
2
+ /** Session storage key: this tab has already recorded the signed-in person's position. */
3
+ export declare const POSITION_CAPTURED_KEY = "busiverse.position.captured";
4
+ /**
5
+ * Records the signed-in person's position once per tab, as soon as they are signed in.
6
+ *
7
+ * Mount it once, at the root of a console, with the console's own signed-in client. A send that
8
+ * fails is reported to `onError` and tried again on the next sign-in or page load.
9
+ */
10
+ export declare function usePositionCapture(signedIn: boolean, sender: PositionSender, options?: CaptureOptions & {
11
+ onError?: (cause: unknown) => void;
12
+ }): void;
13
+ //# sourceMappingURL=usePositionCapture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePositionCapture.d.ts","sourceRoot":"","sources":["../../src/position/usePositionCapture.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9F,0FAA0F;AAC1F,eAAO,MAAM,qBAAqB,gCAAgC,CAAC;AAkBnE;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,cAAc,GAAG;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAAO,GACpE,IAAI,CAWN"}
@@ -0,0 +1,4 @@
1
+ export { capturePosition, positionSender } from "./position/capturePosition";
2
+ export type { CaptureOptions, PositionOutcome, PositionReading, PositionSender, SignedInSend } from "./position/capturePosition";
3
+ export { POSITION_CAPTURED_KEY, usePositionCapture } from "./position/usePositionCapture";
4
+ //# sourceMappingURL=position.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../src/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC7E,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACjI,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,69 @@
1
+ // src/position/capturePosition.ts
2
+ function positionSender(gatewayUrl, send) {
3
+ const base = `${gatewayUrl.replace(/\/+$/, "")}/location/api/v1/positions/mine`;
4
+ const headers = { "Content-Type": "application/json" };
5
+ return {
6
+ record: (reading) => send(base, { method: "POST", headers, body: JSON.stringify(reading) }),
7
+ recordApproximate: () => send(`${base}/approximate`, { method: "POST", headers })
8
+ };
9
+ }
10
+ var MAXIMUM_AGE_MS = 5 * 60 * 1e3;
11
+ var readBrowser = (geolocation, timeoutMs) => new Promise((resolve) => {
12
+ geolocation.getCurrentPosition(
13
+ (position) => resolve({
14
+ latitude: position.coords.latitude,
15
+ longitude: position.coords.longitude,
16
+ accuracyMeters: Number.isFinite(position.coords.accuracy) ? position.coords.accuracy : null,
17
+ capturedAt: new Date(position.timestamp).toISOString()
18
+ }),
19
+ () => resolve(null),
20
+ { enableHighAccuracy: false, timeout: timeoutMs, maximumAge: MAXIMUM_AGE_MS }
21
+ );
22
+ });
23
+ async function capturePosition(sender, options = {}) {
24
+ const geolocation = options.geolocation === void 0 ? typeof navigator !== "undefined" ? navigator.geolocation ?? null : null : options.geolocation;
25
+ const reading = geolocation ? await readBrowser(geolocation, options.timeoutMs ?? 1e4) : null;
26
+ if (reading) {
27
+ await sender.record(reading);
28
+ return "browser";
29
+ }
30
+ await sender.recordApproximate();
31
+ return "approximate";
32
+ }
33
+
34
+ // src/position/usePositionCapture.ts
35
+ import { useEffect } from "react";
36
+ var POSITION_CAPTURED_KEY = "busiverse.position.captured";
37
+ var alreadyCaptured = () => {
38
+ try {
39
+ return typeof sessionStorage !== "undefined" && sessionStorage.getItem(POSITION_CAPTURED_KEY) === "1";
40
+ } catch {
41
+ return false;
42
+ }
43
+ };
44
+ var markCaptured = () => {
45
+ try {
46
+ sessionStorage.setItem(POSITION_CAPTURED_KEY, "1");
47
+ } catch {
48
+ }
49
+ };
50
+ function usePositionCapture(signedIn, sender, options = {}) {
51
+ useEffect(() => {
52
+ if (!signedIn || alreadyCaptured()) return;
53
+ let cancelled = false;
54
+ capturePosition(sender, options).then(() => {
55
+ if (!cancelled) markCaptured();
56
+ }).catch((cause) => {
57
+ if (!cancelled) options.onError?.(cause);
58
+ });
59
+ return () => {
60
+ cancelled = true;
61
+ };
62
+ }, [signedIn]);
63
+ }
64
+ export {
65
+ POSITION_CAPTURED_KEY,
66
+ capturePosition,
67
+ positionSender,
68
+ usePositionCapture
69
+ };
package/dist/styles.css CHANGED
@@ -4,8 +4,8 @@
4
4
  * itself, and substituting theme-scoped tokens into the kit would invert every one of its
5
5
  * surfaces. What guards this file is busiverse-ui/tests/brand-compliance.test.mjs, which holds
6
6
  * every value here to the brand document and measures the contrast of each pair -- a stronger
7
- * check than the literal scan. The absence of a theme-independent slate is recorded in
8
- * DECISIONS-PENDING.md. */
7
+ * check than the literal scan. The theme-independent slates are --color-absolute-slate-950 and
8
+ * --color-absolute-slate-900, below. */
9
9
  /* Font loading is intentionally app-owned. Self-host or load Space Grotesk, Inter, and JetBrains Mono in each frontend. */
10
10
  :root,
11
11
  .light {
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * A hex literal in that position renders the same but stops tracking the brand the moment the token
15
15
  * moves, and nothing fails when it diverges — a colour is never an error.
16
- * `ops/check-brand-tokens.sh` reports literals that a token already covers.
16
+ * `harness/ops/check-brand-tokens.sh` reports literals that a token already covers.
17
17
  *
18
18
  * <h2>Why it reads the live value rather than returning a constant</h2>
19
19
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@busiverse/ui",
3
- "version": "0.2.20",
3
+ "version": "0.2.21",
4
4
  "author": "Joel Julius Okoromi <okmarq@gmail.com> (https://busiversehq.com)",
5
5
  "description": "BUSIVERSE shared React UI, design tokens, pricing, i18n, auth helpers, and product shell. Network-neutral core; Gateway transport is app-injected.",
6
6
  "type": "module",
@@ -66,11 +66,16 @@
66
66
  "types": "./dist/sandbox.d.ts",
67
67
  "import": "./dist/sandbox.js",
68
68
  "default": "./dist/sandbox.js"
69
+ },
70
+ "./position": {
71
+ "types": "./dist/position.d.ts",
72
+ "import": "./dist/position.js",
73
+ "default": "./dist/position.js"
69
74
  }
70
75
  },
71
76
  "scripts": {
72
77
  "clean": "node scripts/clean.mjs",
73
- "build": "npm run clean && tsup src/index.ts src/tailwind-public.ts src/brand.ts src/i18n-public.ts src/billing.ts src/social.ts src/marketing.ts src/assets-public.ts src/theme-public.ts src/sandbox.ts --format esm --target es2022 && tsc -p tsconfig.build.json && node scripts/copy-static.mjs",
78
+ "build": "npm run clean && tsup src/index.ts src/tailwind-public.ts src/brand.ts src/i18n-public.ts src/billing.ts src/social.ts src/marketing.ts src/assets-public.ts src/theme-public.ts src/sandbox.ts src/position.ts --format esm --target es2022 && tsc -p tsconfig.build.json && node scripts/copy-static.mjs",
74
79
  "typecheck": "tsc --noEmit",
75
80
  "lint": "eslint .",
76
81
  "test": "node --test tests/*.test.mjs",