@fayz-ai/storefront 0.8.4 → 0.9.0-next.0

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.
@@ -11,4 +11,5 @@ export declare function StorefrontScaffold({ manifest, surface }: {
11
11
  export declare namespace StorefrontScaffold {
12
12
  var displayName: string;
13
13
  }
14
+ export declare function registerStorefrontScaffold(): void;
14
15
  //# sourceMappingURL=scaffold.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,eAAe,CAAA;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIhD,OAAO,UAAU,CAAA;AAgBjB,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,WAAW,CAiCtE;AAgCD,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;IAAE,QAAQ,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,qBAanG;yBAbe,kBAAkB"}
1
+ {"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../src/scaffold.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,eAAe,CAAA;AAEjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAIhD,OAAO,UAAU,CAAA;AAgBjB,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,WAAW,CAiCtE;AAgCD,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;IAAE,QAAQ,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,qBAanG;yBAbe,kBAAkB;;;AAoBlC,wBAAgB,0BAA0B,IAAI,IAAI,CAIjD"}
package/package.json CHANGED
@@ -3,36 +3,33 @@
3
3
  "fayz": {
4
4
  "status": "beta"
5
5
  },
6
- "version": "0.8.4",
6
+ "version": "0.9.0-next.0",
7
7
  "description": "Fayz SDK storefront kit — Shopify-style customer-facing ecommerce template components",
8
8
  "type": "module",
9
- "main": "./dist/index.cjs",
9
+ "sideEffects": false,
10
+ "main": "./dist/index.js",
10
11
  "module": "./dist/index.js",
11
12
  "types": "./dist/index.d.ts",
12
13
  "exports": {
13
14
  ".": {
14
15
  "source": "./src/index.ts",
15
16
  "types": "./dist/index.d.ts",
16
- "import": "./dist/index.js",
17
- "require": "./dist/index.cjs"
17
+ "import": "./dist/index.js"
18
18
  },
19
19
  "./ui": {
20
20
  "source": "./src/ui.ts",
21
21
  "types": "./dist/ui.d.ts",
22
- "import": "./dist/ui.js",
23
- "require": "./dist/ui.cjs"
22
+ "import": "./dist/ui.js"
24
23
  },
25
24
  "./catalog": {
26
25
  "source": "./src/catalog.ts",
27
26
  "types": "./dist/catalog.d.ts",
28
- "import": "./dist/catalog.js",
29
- "require": "./dist/catalog.cjs"
27
+ "import": "./dist/catalog.js"
30
28
  },
31
29
  "./shop": {
32
30
  "source": "./src/shop.ts",
33
31
  "types": "./dist/shop.d.ts",
34
- "import": "./dist/shop.js",
35
- "require": "./dist/shop.cjs"
32
+ "import": "./dist/shop.js"
36
33
  }
37
34
  },
38
35
  "files": [
@@ -40,25 +37,28 @@
40
37
  "src"
41
38
  ],
42
39
  "dependencies": {
43
- "@supabase/supabase-js": "^2.45.0",
44
- "lucide-react": "^0.400.0",
45
- "zustand": "^4.5.0",
46
- "@fayz-ai/auth": "^0.8.4",
47
- "@fayz-ai/core": "^0.8.4",
48
- "@fayz-ai/sdk": "^0.8.4",
49
- "@fayz-ai/plugin-auth": "^0.8.0",
50
- "@fayz-ai/shop": "^0.8.4",
51
- "@fayz-ai/ui": "^0.8.4"
40
+ "@fayz-ai/core": "^0.9.0-next.0",
41
+ "@fayz-ai/plugin-auth": "^0.9.0-next.0",
42
+ "@fayz-ai/auth": "^0.9.0-next.0",
43
+ "@fayz-ai/ui": "^0.9.0-next.0",
44
+ "@fayz-ai/sdk": "^0.9.0-next.0",
45
+ "@fayz-ai/shop": "^0.9.0-next.0"
52
46
  },
53
47
  "peerDependencies": {
54
48
  "react": "^18.0.0 || ^19.0.0",
55
- "react-dom": "^18.0.0 || ^19.0.0"
49
+ "react-dom": "^18.0.0 || ^19.0.0",
50
+ "zustand": "^4.5.0",
51
+ "@supabase/supabase-js": "^2.45.0",
52
+ "lucide-react": ">=0.400.0 <1.0.0"
56
53
  },
57
54
  "devDependencies": {
58
55
  "@types/react": "^18.3.0",
59
56
  "react": "^18.3.0",
60
57
  "tsup": "^8.2.0",
61
- "typescript": "^5.5.0"
58
+ "typescript": "^5.5.0",
59
+ "zustand": "^4.5.0",
60
+ "@supabase/supabase-js": "^2.45.0",
61
+ "lucide-react": "^0.400.0"
62
62
  },
63
63
  "keywords": [
64
64
  "fayz",
package/src/blocks.tsx CHANGED
@@ -39,8 +39,8 @@ export function registerStorefrontBlocks(): void {
39
39
  registerBlock('newsletter', NewsletterBand, { source: 'sdk', label: 'Newsletter band' })
40
40
  }
41
41
 
42
- // Register on import so any consumer of the storefront package has the blocks.
43
- registerStorefrontBlocks()
42
+ // Registration happens in initStorefrontRuntime (both the scaffold and
43
+ // createStorefront call it) so importing this module stays side-effect-free.
44
44
 
45
45
  /** Convert the typed storefront section blueprint into a generic block tree. */
46
46
  export function sectionsToBlocks(sections: readonly StorefrontSection[]): BlockNode[] {
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import * as LucideIcons from 'lucide-react'
2
+ import { getLucideIcon } from '@fayz-ai/ui/icons'
3
3
  import { bannerPlaceholder } from '../../sections'
4
4
  import { Reveal } from '../../motion'
5
5
  import { Link } from '../../router'
@@ -7,7 +7,7 @@ import { TID } from '../../testids'
7
7
  import { SmoothImage } from '../SmoothImage'
8
8
 
9
9
  function Icon({ name, className }: { name: string; className?: string }) {
10
- const C = (LucideIcons as unknown as Record<string, React.ComponentType<{ className?: string }>>)[name]
10
+ const C = getLucideIcon(name)
11
11
  return C ? <C className={className} /> : null
12
12
  }
13
13
 
@@ -5,6 +5,7 @@ import type { MockShopSeed } from '@fayz-ai/shop/mock'
5
5
  import type { Discount } from '@fayz-ai/shop/types'
6
6
  import type { ShopProvider } from '@fayz-ai/shop/provider'
7
7
  import { initCustomerAuth, resolveAuthAdapter } from './auth'
8
+ import { registerStorefrontBlocks } from './blocks'
8
9
  import { getStorefrontComponents, StorefrontConfigProvider, resolveConfig, useStorefrontConfig } from './config'
9
10
  import type { StorefrontConfig, StorefrontDiscountConfig } from './config'
10
11
  import type { StorefrontComponents } from './component-contracts'
@@ -120,6 +121,7 @@ function buildMockSeed(config: StorefrontConfig): MockShopSeed | undefined {
120
121
  }
121
122
 
122
123
  export function initStorefrontRuntime(config: StorefrontConfig): void {
124
+ registerStorefrontBlocks()
123
125
  if (resolveConfig(config).features.accounts) {
124
126
  initCustomerAuth(resolveAuthAdapter(config.auth, {
125
127
  supabaseUrl: config.supabaseUrl,
package/src/index.ts CHANGED
@@ -188,4 +188,15 @@ export type {
188
188
  // live on their own subpaths (./ui, ./catalog, ./shop) to keep module graphs
189
189
  // separate. Mirrors the @fayz-ai/saas front door.
190
190
  // ---------------------------------------------------------------------------
191
- export { renderApp, getSupabaseClientOptional } from '@fayz-ai/core'
191
+ // renderApp is wrapped (not re-exported) so the 'storefront' scaffold registers
192
+ // on first render instead of at import time — keeps the barrel side-effect-free.
193
+ import { renderApp as coreRenderApp } from '@fayz-ai/core'
194
+ import { registerStorefrontScaffold } from './scaffold'
195
+
196
+ export const renderApp: typeof coreRenderApp = (...args) => {
197
+ registerStorefrontScaffold()
198
+ return coreRenderApp(...args)
199
+ }
200
+
201
+ export { getSupabaseClientOptional } from '@fayz-ai/core'
202
+ export { registerStorefrontScaffold } from './scaffold'
package/src/scaffold.tsx CHANGED
@@ -104,6 +104,12 @@ export function StorefrontScaffold({ manifest, surface }: { manifest: AppManifes
104
104
  }
105
105
  StorefrontScaffold.displayName = 'StorefrontScaffold'
106
106
 
107
- // Self-register so `renderApp(manifest)` can resolve the 'storefront' scaffold
108
- // whenever this package is imported.
109
- registerScaffold('storefront', StorefrontScaffold, { source: 'sdk', label: 'Storefront' })
107
+ // Registration is lazy (called from the storefront renderApp wrapper and
108
+ // createStorefront*) so that importing the @fayz-ai/storefront barrel stays
109
+ // side-effect-free and tree-shakable.
110
+ let storefrontScaffoldRegistered = false
111
+ export function registerStorefrontScaffold(): void {
112
+ if (storefrontScaffoldRegistered) return
113
+ storefrontScaffoldRegistered = true
114
+ registerScaffold('storefront', StorefrontScaffold, { source: 'sdk', label: 'Storefront' })
115
+ }
package/dist/catalog.cjs DELETED
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- var catalog = require('@fayz-ai/shop/catalog');
4
-
5
-
6
-
7
- Object.keys(catalog).forEach(function (k) {
8
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
- enumerable: true,
10
- get: function () { return catalog[k]; }
11
- });
12
- });
13
- //# sourceMappingURL=catalog.cjs.map
14
- //# sourceMappingURL=catalog.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"catalog.cjs","sourcesContent":[]}