@commercebuild/extension 0.0.15 → 0.0.17
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 +3 -3
- package/types/global.d.ts +49 -13
- package/types/index.d.ts +0 -2
- package/types/category.d.ts +0 -7
- package/types/product.d.ts +0 -14
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercebuild/extension",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"./config/tsconfig.extension.json": "./config/tsconfig.extension.json"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@commercebuild/platform-api": "^0
|
|
14
|
-
"@commercebuild/ui": "
|
|
13
|
+
"@commercebuild/platform-api": "^0.11.33",
|
|
14
|
+
"@commercebuild/ui": "~0.0.9",
|
|
15
15
|
"@headlessui/react": "^2.2.4",
|
|
16
16
|
"@tailwindcss/postcss": "^4.1.10",
|
|
17
17
|
"@tailwindcss/vite": "^4.1.11",
|
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 {
|
|
@@ -54,6 +54,12 @@ interface AddToCartProps {
|
|
|
54
54
|
className?: string;
|
|
55
55
|
/** Inline style forwarded to the button (e.g. Product Card button-scheme vars). */
|
|
56
56
|
style?: CSSProperties;
|
|
57
|
+
/**
|
|
58
|
+
* Button-scheme variant forwarded to the button, which opts it into the
|
|
59
|
+
* `data-btn-variant` colour and hover-animation rules in globals.css. Only
|
|
60
|
+
* set by callers that also apply a `button-scheme-{key}` class.
|
|
61
|
+
*/
|
|
62
|
+
btnVariant?: "primary" | "secondary" | "outline";
|
|
57
63
|
/**
|
|
58
64
|
* Width control (opt-in). Omit for the default responsive width; `true` = full
|
|
59
65
|
* width at all breakpoints; `false` = content width (auto).
|
|
@@ -66,6 +72,7 @@ declare function AddToCart({
|
|
|
66
72
|
onSuccessCallback,
|
|
67
73
|
className,
|
|
68
74
|
style,
|
|
75
|
+
btnVariant,
|
|
69
76
|
fullWidth,
|
|
70
77
|
}: AddToCartProps): React.JSX.Element;
|
|
71
78
|
|
|
@@ -285,6 +292,22 @@ declare function revalidatePath(
|
|
|
285
292
|
): Promise<void>;
|
|
286
293
|
declare function revalidate(): Promise<void>;
|
|
287
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Firebase web config (the firebaseConfig snippet from the Firebase
|
|
297
|
+
* console). Not a secret — it ships to every browser by design; access
|
|
298
|
+
* control lives entirely in the project's Security Rules. Keys must
|
|
299
|
+
* stay in sync with PROVIDER_FIELDS.firebase below.
|
|
300
|
+
*/
|
|
301
|
+
interface FirebaseConnectionConfig {
|
|
302
|
+
apiKey: string;
|
|
303
|
+
projectId: string;
|
|
304
|
+
authDomain?: string;
|
|
305
|
+
storageBucket?: string;
|
|
306
|
+
messagingSenderId?: string;
|
|
307
|
+
appId?: string;
|
|
308
|
+
measurementId?: string;
|
|
309
|
+
}
|
|
310
|
+
|
|
288
311
|
/**
|
|
289
312
|
* Per-extension render scope.
|
|
290
313
|
*
|
|
@@ -302,19 +325,13 @@ declare function revalidate(): Promise<void>;
|
|
|
302
325
|
*/
|
|
303
326
|
|
|
304
327
|
/**
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
328
|
+
* The provider type family (config shapes, the ResolvedConnection
|
|
329
|
+
* discriminated union) is owned by the provider registry in
|
|
330
|
+
* @commercebuild/extension-host-libs — one place declares them for the
|
|
331
|
+
* storefront, storeadmin and the config JSON Schema alike. This module
|
|
332
|
+
* re-exports the contract-facing names.
|
|
308
333
|
*/
|
|
309
|
-
|
|
310
|
-
apiKey: string;
|
|
311
|
-
projectId: string;
|
|
312
|
-
authDomain?: string;
|
|
313
|
-
storageBucket?: string;
|
|
314
|
-
messagingSenderId?: string;
|
|
315
|
-
appId?: string;
|
|
316
|
-
measurementId?: string;
|
|
317
|
-
}
|
|
334
|
+
type CbFirebaseConfig = FirebaseConnectionConfig;
|
|
318
335
|
|
|
319
336
|
/**
|
|
320
337
|
* The extension host API contract (`window.cb`).
|
|
@@ -366,6 +383,8 @@ interface CbHostDeps {
|
|
|
366
383
|
router: CbRouter;
|
|
367
384
|
tmsg: TranslationHelpers["tmsg"];
|
|
368
385
|
tlink: TranslationHelpers["tlink"];
|
|
386
|
+
/** Session store settings; null before/without a platform session. */
|
|
387
|
+
settings?: customer_v1.UserSelfSettingsInterface | null;
|
|
369
388
|
}
|
|
370
389
|
type CbClassValue =
|
|
371
390
|
| string
|
|
@@ -503,6 +522,23 @@ interface CbHostApi {
|
|
|
503
522
|
requireLib: <S extends keyof CbHostLibs>(spec: S) => CbHostLibs[S];
|
|
504
523
|
/** The platform (commerce backend) API SDK client. */
|
|
505
524
|
platform: Platform;
|
|
525
|
+
/**
|
|
526
|
+
* Store settings from the current platform session — `storeId`,
|
|
527
|
+
* `companyName`, `themeName`, `cdnPath`, `timeZone`, feature flags…
|
|
528
|
+
* Store-level (not user-level), so it is populated for guests too.
|
|
529
|
+
*
|
|
530
|
+
* OPTIONAL on purpose: it is absent while no platform session exists
|
|
531
|
+
* (a failed session fetch, or after `signOut`). Guard it —
|
|
532
|
+
* `cb.settings?.storeId` — or feature-detect with
|
|
533
|
+
* `cb.has("settings")`.
|
|
534
|
+
*
|
|
535
|
+
* The same object `cb.platform.auth().getUserSelf()` returns, exposed
|
|
536
|
+
* synchronously. Its `firebaseApiKey` / `mfaTenantId` / `googleApiKey`
|
|
537
|
+
* are the HOST's own integration keys (login MFA, address
|
|
538
|
+
* autocomplete) — read them for display/diagnostics only; an app's own
|
|
539
|
+
* data connections come from `cb.utils.useFirebaseApp()`.
|
|
540
|
+
*/
|
|
541
|
+
settings?: customer_v1.UserSelfSettingsInterface;
|
|
506
542
|
/**
|
|
507
543
|
* Feature-detect a member by dotted path, e.g.
|
|
508
544
|
* `cb.has("com.Product.ProductMakeOffer")`. Lets an extension degrade
|
package/types/index.d.ts
CHANGED
package/types/category.d.ts
DELETED
package/types/product.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { catalog_v1 } from "@commercebuild/platform-api";
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
interface Product extends catalog_v1.CatalogProductSearchProduct {
|
|
5
|
-
image: Required<
|
|
6
|
-
Pick<catalog_v1.CatalogProductSearchProduct["details"]["images"], "main">
|
|
7
|
-
>["main"];
|
|
8
|
-
originalPrice?: catalog_v1.CatalogPriceItemDto;
|
|
9
|
-
formattedPrice: string;
|
|
10
|
-
href: string;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export {};
|