@fayz-ai/plugin-marketing 0.1.2 → 0.1.4
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/LICENSE +21 -0
- package/dist/index.cjs +46 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -2
- package/dist/index.js.map +1 -1
- package/dist/registries.d.ts +7 -0
- package/dist/registries.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/index.ts +13 -1
- package/src/registries.ts +48 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginRegistryDef } from '@fayz-ai/core';
|
|
2
|
+
import type { AcquisitionChannel } from './types';
|
|
3
|
+
/** Build the marketing settings registries, seeding Channels from the resolved
|
|
4
|
+
* domain preset. Read-only today (channels come from the preset); flip
|
|
5
|
+
* readOnly + add a `data.table` to make them tenant-editable. */
|
|
6
|
+
export declare function buildMarketingRegistries(channels: AcquisitionChannel[]): PluginRegistryDef[];
|
|
7
|
+
//# sourceMappingURL=registries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../src/registries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAa,MAAM,eAAe,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AA+BjD;;kEAEkE;AAClE,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,GAAG,iBAAiB,EAAE,CAY5F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fayz-ai/plugin-marketing",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Fayz SDK — marketing campaigns & broadcasts plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"@tanstack/react-table": "^8.20.0",
|
|
27
27
|
"lucide-react": "^0.400.0",
|
|
28
28
|
"zustand": "^4.5.0",
|
|
29
|
-
"@fayz-ai/
|
|
30
|
-
"@fayz-ai/
|
|
31
|
-
"@fayz-ai/
|
|
29
|
+
"@fayz-ai/ui": "^0.2.1",
|
|
30
|
+
"@fayz-ai/core": "^0.2.0",
|
|
31
|
+
"@fayz-ai/saas": "^0.3.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/react": "^18.3.0",
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import type { PluginManifest, PluginScope, VerticalId } from '@fayz-ai/core'
|
|
3
3
|
import { getSupabaseClientOptional, registerTranslations } from '@fayz-ai/core'
|
|
4
|
+
import { PluginSettingsPanel } from '@fayz-ai/saas'
|
|
4
5
|
import { MarketingPage } from './MarketingPage'
|
|
5
6
|
import { SettingsView } from './views/SettingsView'
|
|
7
|
+
import { buildMarketingRegistries } from './registries'
|
|
6
8
|
import { createMarketingDashboardWidgets } from './views/dashboardWidgets'
|
|
7
9
|
import {
|
|
8
10
|
MarketingContextProvider,
|
|
@@ -97,9 +99,18 @@ export function createMarketingPlugin(options?: MarketingPluginOptions): PluginM
|
|
|
97
99
|
PageComponent.displayName = 'MarketingPage'
|
|
98
100
|
|
|
99
101
|
// Settings lives in the SDK-core central Settings area (not a module tab).
|
|
102
|
+
// General preferences (channel tracking toggles) + a Channels registry tab,
|
|
103
|
+
// mirroring how plugin-menu surfaces Allergens.
|
|
104
|
+
const marketingRegistries = buildMarketingRegistries(config.channels)
|
|
100
105
|
const SettingsComponent: React.ComponentType<unknown> = () =>
|
|
101
106
|
React.createElement(MarketingContextProvider, { config, provider, store },
|
|
102
|
-
React.createElement(
|
|
107
|
+
React.createElement(PluginSettingsPanel, {
|
|
108
|
+
title: config.labels.settings ?? config.labels.pageTitle,
|
|
109
|
+
subtitle: config.labels.pageSubtitle,
|
|
110
|
+
generalSettings: React.createElement(SettingsView),
|
|
111
|
+
registries: marketingRegistries,
|
|
112
|
+
routeBase: '/settings/marketing',
|
|
113
|
+
}))
|
|
103
114
|
SettingsComponent.displayName = 'MarketingSettings'
|
|
104
115
|
|
|
105
116
|
return {
|
|
@@ -195,6 +206,7 @@ export function createMarketingPlugin(options?: MarketingPluginOptions): PluginM
|
|
|
195
206
|
permission: { feature: 'marketing', action: 'create' as const },
|
|
196
207
|
},
|
|
197
208
|
],
|
|
209
|
+
registries: marketingRegistries,
|
|
198
210
|
settings: [
|
|
199
211
|
{
|
|
200
212
|
id: 'marketing',
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { PluginRegistryDef, EntityDef } from '@fayz-ai/core'
|
|
2
|
+
import type { AcquisitionChannel } from './types'
|
|
3
|
+
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Settings registries — surfaced as CRUD tabs in the central Settings area
|
|
6
|
+
// (mirrors how plugin-menu exposes Allergens / Dietary Tags). "Channels" lists
|
|
7
|
+
// the acquisition channels resolved from the domain preset.
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
const KIND_OPTIONS = [
|
|
11
|
+
{ value: 'paid', label: 'Paid' },
|
|
12
|
+
{ value: 'organic', label: 'Organic' },
|
|
13
|
+
{ value: 'social', label: 'Social' },
|
|
14
|
+
{ value: 'referral', label: 'Referral' },
|
|
15
|
+
{ value: 'direct', label: 'Direct' },
|
|
16
|
+
{ value: 'outbound', label: 'Outbound' },
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
const channelEntity: EntityDef = {
|
|
20
|
+
name: 'Channel',
|
|
21
|
+
namePlural: 'Channels',
|
|
22
|
+
icon: 'Radio',
|
|
23
|
+
displayField: 'label',
|
|
24
|
+
defaultSort: 'label',
|
|
25
|
+
fields: [
|
|
26
|
+
{ key: 'label', label: 'Channel', type: 'text', required: true, showInTable: true, searchable: true },
|
|
27
|
+
{ key: 'kind', label: 'Type', type: 'select', options: KIND_OPTIONS, showInTable: true },
|
|
28
|
+
{ key: 'icon', label: 'Icon', type: 'text', showInTable: true },
|
|
29
|
+
],
|
|
30
|
+
facets: [{ field: 'kind' }],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Build the marketing settings registries, seeding Channels from the resolved
|
|
34
|
+
* domain preset. Read-only today (channels come from the preset); flip
|
|
35
|
+
* readOnly + add a `data.table` to make them tenant-editable. */
|
|
36
|
+
export function buildMarketingRegistries(channels: AcquisitionChannel[]): PluginRegistryDef[] {
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
id: 'channels',
|
|
40
|
+
entity: channelEntity,
|
|
41
|
+
icon: 'Radio',
|
|
42
|
+
description: 'Acquisition channels tracked for this workspace',
|
|
43
|
+
display: 'table',
|
|
44
|
+
readOnly: true,
|
|
45
|
+
seedData: channels.map((c) => ({ id: c.id, label: c.label, kind: c.kind, icon: c.icon })),
|
|
46
|
+
},
|
|
47
|
+
]
|
|
48
|
+
}
|