@goldenhippo/builder-cart-plugin 0.1.0 → 0.3.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.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # @goldenhippo/builder-cart-plugin
2
+
3
+ React 18 plugin running inside Builder.io's editor iframe. Manages pages, products, blogs, comments, and brand configuration for Golden Hippo cart/commerce sites.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Features](#features)
8
+ - [Installation in Builder.io](#installation-in-builderio)
9
+ - [Development](#development)
10
+ - [Production (CDN)](#production-cdn)
11
+ - [Plugin Settings](#plugin-settings)
12
+ - [Architecture](#architecture)
13
+ - [Entry Point](#entry-point)
14
+ - [Application](#application)
15
+ - [Core](#core)
16
+ - [Services](#services)
17
+ - [Path Aliases](#path-aliases)
18
+ - [Development Commands](#development-commands)
19
+
20
+ ## Features
21
+
22
+ - **Dashboard** — overview of content across all models
23
+ - **Page Manager** — create, search, filter, and validate pages (General, PDP, Blog)
24
+ - **Products** — browse product catalog from Hippo Commerce API
25
+ - **Blogs** — manage blog content with category filtering
26
+ - **Comments** — approve/reject blog comments
27
+ - **Settings** — user profile and plugin configuration
28
+ - **Auto-provisioning** — automatically creates all 13 Builder.io models on settings save
29
+
30
+ ## Installation in Builder.io
31
+
32
+ ### Development
33
+
34
+ 1. Start the dev server:
35
+ ```bash
36
+ npm run dev:plugin # http://localhost:1268
37
+ ```
38
+ 2. In Builder.io: **Settings > Plugins > Add Plugin**
39
+ 3. Enter URL: `http://localhost:1268/plugin.system.js`
40
+
41
+ ### Production (CDN)
42
+
43
+ After publishing, use the jsdelivr CDN URL:
44
+
45
+ ```
46
+ https://cdn.jsdelivr.net/npm/@goldenhippo/builder-cart-plugin@<version>/dist/plugin.system.js
47
+ ```
48
+
49
+ ## Plugin Settings
50
+
51
+ | Setting | Description |
52
+ | ------------ | ----------------------------------- |
53
+ | Brand | Brand name for multi-brand support |
54
+ | Edit URL | Frontend site URL for page previews |
55
+ | API URL | Hippo Commerce API base URL |
56
+ | API User | Commerce API username |
57
+ | API Password | Commerce API password |
58
+
59
+ Saving settings triggers auto-provisioning of all 13 Builder.io models via the API.
60
+
61
+ ## Architecture
62
+
63
+ ### Entry Point
64
+
65
+ `src/plugin.ts` — registers plugin settings, the app tab ("Hippo CMS"), and the 8-phase model auto-creation flow on settings save.
66
+
67
+ ### Application
68
+
69
+ `src/application/` — app shell and page components:
70
+
71
+ - `AppCore` — MobX state management with cookie-based routing
72
+ - `HippoCMSManager` — wrapper component
73
+ - Pages: Home, PageManager, Products, Blogs, Comments, Settings, Admin
74
+
75
+ ### Core
76
+
77
+ `src/core/models/` — `BuilderHelper` singleton that orchestrates all 13 model definitions. Factory functions are imported from `@goldenhippo/builder-cart-schemas`.
78
+
79
+ ### Services
80
+
81
+ `src/services/` — API clients:
82
+
83
+ - `BuilderApi` — paginated Builder.io content fetching
84
+ - `CommerceApi` — product feed and brand settings via Hippo Commerce API
85
+ - `UserManagementService` — extracts user context from Builder.io
86
+
87
+ ## Path Aliases
88
+
89
+ Configured in both `tsconfig.json` and `webpack.config.js`:
90
+
91
+ | Alias | Path |
92
+ | ---------------- | ------------------ |
93
+ | `@application/*` | `src/application/` |
94
+ | `@components/*` | `src/components/` |
95
+ | `@core/*` | `src/core/` |
96
+ | `@services/*` | `src/services/` |
97
+ | `@utils/*` | `src/utils/` |
98
+
99
+ ## Development Commands
100
+
101
+ ```bash
102
+ npm run dev:plugin # Start dev server on port 1268
103
+ npm run build:plugin # Production build
104
+ npm run typecheck # Type-check with tsc
105
+ npm run lint # Lint with eslint
106
+ ```