@commercebuild/extension 0.0.15 → 0.0.16
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/config/host-libs.json +0 -2
- package/package.json +1 -1
- package/types/global.d.ts +42 -13
package/config/host-libs.json
CHANGED
|
@@ -3,14 +3,12 @@
|
|
|
3
3
|
"external": [
|
|
4
4
|
"react",
|
|
5
5
|
"react-dom",
|
|
6
|
-
"react-dom/client",
|
|
7
6
|
"firebase/app",
|
|
8
7
|
"firebase/firestore"
|
|
9
8
|
],
|
|
10
9
|
"globals": {
|
|
11
10
|
"react": "cb.lib.React",
|
|
12
11
|
"react-dom": "cb.lib.ReactDOM",
|
|
13
|
-
"react-dom/client": "cb.lib.ReactDOM",
|
|
14
12
|
"firebase/app": "cb.lib.firebase.app",
|
|
15
13
|
"firebase/firestore": "cb.lib.firebase.firestore"
|
|
16
14
|
},
|
package/package.json
CHANGED
package/types/global.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import React__default, { CSSProperties } from "react";
|
|
|
8
8
|
import * as ReactDOM from "react-dom";
|
|
9
9
|
import * as FirebaseAppNs from "firebase/app";
|
|
10
10
|
import * as FirebaseFirestoreNs from "firebase/firestore";
|
|
11
|
-
import { cart_v2, catalog_v1, Platform } from "@commercebuild/platform-api";
|
|
11
|
+
import { cart_v2, catalog_v1, Platform, customer_v1 } from "@commercebuild/platform-api";
|
|
12
12
|
import * as icons from "lucide-react";
|
|
13
13
|
import * as uis from "@commercebuild/ui";
|
|
14
14
|
import {
|
|
@@ -285,6 +285,22 @@ declare function revalidatePath(
|
|
|
285
285
|
): Promise<void>;
|
|
286
286
|
declare function revalidate(): Promise<void>;
|
|
287
287
|
|
|
288
|
+
/**
|
|
289
|
+
* Firebase web config (the firebaseConfig snippet from the Firebase
|
|
290
|
+
* console). Not a secret — it ships to every browser by design; access
|
|
291
|
+
* control lives entirely in the project's Security Rules. Keys must
|
|
292
|
+
* stay in sync with PROVIDER_FIELDS.firebase below.
|
|
293
|
+
*/
|
|
294
|
+
interface FirebaseConnectionConfig {
|
|
295
|
+
apiKey: string;
|
|
296
|
+
projectId: string;
|
|
297
|
+
authDomain?: string;
|
|
298
|
+
storageBucket?: string;
|
|
299
|
+
messagingSenderId?: string;
|
|
300
|
+
appId?: string;
|
|
301
|
+
measurementId?: string;
|
|
302
|
+
}
|
|
303
|
+
|
|
288
304
|
/**
|
|
289
305
|
* Per-extension render scope.
|
|
290
306
|
*
|
|
@@ -302,19 +318,13 @@ declare function revalidate(): Promise<void>;
|
|
|
302
318
|
*/
|
|
303
319
|
|
|
304
320
|
/**
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
321
|
+
* The provider type family (config shapes, the ResolvedConnection
|
|
322
|
+
* discriminated union) is owned by the provider registry in
|
|
323
|
+
* @commercebuild/extension-host-libs — one place declares them for the
|
|
324
|
+
* storefront, storeadmin and the config JSON Schema alike. This module
|
|
325
|
+
* re-exports the contract-facing names.
|
|
308
326
|
*/
|
|
309
|
-
|
|
310
|
-
apiKey: string;
|
|
311
|
-
projectId: string;
|
|
312
|
-
authDomain?: string;
|
|
313
|
-
storageBucket?: string;
|
|
314
|
-
messagingSenderId?: string;
|
|
315
|
-
appId?: string;
|
|
316
|
-
measurementId?: string;
|
|
317
|
-
}
|
|
327
|
+
type CbFirebaseConfig = FirebaseConnectionConfig;
|
|
318
328
|
|
|
319
329
|
/**
|
|
320
330
|
* The extension host API contract (`window.cb`).
|
|
@@ -366,6 +376,8 @@ interface CbHostDeps {
|
|
|
366
376
|
router: CbRouter;
|
|
367
377
|
tmsg: TranslationHelpers["tmsg"];
|
|
368
378
|
tlink: TranslationHelpers["tlink"];
|
|
379
|
+
/** Session store settings; null before/without a platform session. */
|
|
380
|
+
settings?: customer_v1.UserSelfSettingsInterface | null;
|
|
369
381
|
}
|
|
370
382
|
type CbClassValue =
|
|
371
383
|
| string
|
|
@@ -503,6 +515,23 @@ interface CbHostApi {
|
|
|
503
515
|
requireLib: <S extends keyof CbHostLibs>(spec: S) => CbHostLibs[S];
|
|
504
516
|
/** The platform (commerce backend) API SDK client. */
|
|
505
517
|
platform: Platform;
|
|
518
|
+
/**
|
|
519
|
+
* Store settings from the current platform session — `storeId`,
|
|
520
|
+
* `companyName`, `themeName`, `cdnPath`, `timeZone`, feature flags…
|
|
521
|
+
* Store-level (not user-level), so it is populated for guests too.
|
|
522
|
+
*
|
|
523
|
+
* OPTIONAL on purpose: it is absent while no platform session exists
|
|
524
|
+
* (a failed session fetch, or after `signOut`). Guard it —
|
|
525
|
+
* `cb.settings?.storeId` — or feature-detect with
|
|
526
|
+
* `cb.has("settings")`.
|
|
527
|
+
*
|
|
528
|
+
* The same object `cb.platform.auth().getUserSelf()` returns, exposed
|
|
529
|
+
* synchronously. Its `firebaseApiKey` / `mfaTenantId` / `googleApiKey`
|
|
530
|
+
* are the HOST's own integration keys (login MFA, address
|
|
531
|
+
* autocomplete) — read them for display/diagnostics only; an app's own
|
|
532
|
+
* data connections come from `cb.utils.useFirebaseApp()`.
|
|
533
|
+
*/
|
|
534
|
+
settings?: customer_v1.UserSelfSettingsInterface;
|
|
506
535
|
/**
|
|
507
536
|
* Feature-detect a member by dotted path, e.g.
|
|
508
537
|
* `cb.has("com.Product.ProductMakeOffer")`. Lets an extension degrade
|