business-as-code 2.1.3 → 2.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.
Files changed (260) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +2 -0
  3. package/package.json +16 -13
  4. package/src/dollar.ts +5 -2
  5. package/src/entities/organization.ts +31 -18
  6. package/src/goals.ts +78 -12
  7. package/src/index.ts +48 -18
  8. package/src/kpis.ts +62 -8
  9. package/src/metrics.ts +92 -79
  10. package/src/okrs.ts +120 -20
  11. package/src/organization.ts +12 -15
  12. package/src/process.ts +11 -12
  13. package/src/product.ts +8 -9
  14. package/src/queries.ts +238 -75
  15. package/src/roles.ts +62 -61
  16. package/src/workflow.ts +22 -15
  17. package/test/business.test.ts +282 -0
  18. package/test/dollar.test.ts +270 -0
  19. package/test/entities.test.ts +628 -0
  20. package/test/financials.test.ts +539 -0
  21. package/test/goals.test.ts +451 -0
  22. package/{src → test}/index.test.ts +1 -1
  23. package/test/kpis.test.ts +440 -0
  24. package/test/metrics.test.ts +744 -0
  25. package/test/okrs.test.ts +741 -0
  26. package/test/organization.test.ts +548 -0
  27. package/test/process.test.ts +503 -0
  28. package/test/product.test.ts +430 -0
  29. package/test/queries.test.ts +556 -0
  30. package/test/roles.test.ts +546 -0
  31. package/test/service.test.ts +450 -0
  32. package/test/types.test.ts +1141 -0
  33. package/test/vision.test.ts +214 -0
  34. package/test/workflow.test.ts +501 -0
  35. package/vitest.config.ts +47 -0
  36. package/.turbo/turbo-build.log +0 -5
  37. package/LICENSE +0 -21
  38. package/dist/business.d.ts +0 -62
  39. package/dist/business.d.ts.map +0 -1
  40. package/dist/business.js +0 -109
  41. package/dist/business.js.map +0 -1
  42. package/dist/canvas/activities.d.ts +0 -19
  43. package/dist/canvas/activities.d.ts.map +0 -1
  44. package/dist/canvas/activities.js +0 -20
  45. package/dist/canvas/activities.js.map +0 -1
  46. package/dist/canvas/channels.d.ts +0 -20
  47. package/dist/canvas/channels.d.ts.map +0 -1
  48. package/dist/canvas/channels.js +0 -21
  49. package/dist/canvas/channels.js.map +0 -1
  50. package/dist/canvas/relationships.d.ts +0 -20
  51. package/dist/canvas/relationships.d.ts.map +0 -1
  52. package/dist/canvas/relationships.js +0 -21
  53. package/dist/canvas/relationships.js.map +0 -1
  54. package/dist/canvas/resources.d.ts +0 -20
  55. package/dist/canvas/resources.d.ts.map +0 -1
  56. package/dist/canvas/resources.js +0 -30
  57. package/dist/canvas/resources.js.map +0 -1
  58. package/dist/canvas/revenue.d.ts +0 -22
  59. package/dist/canvas/revenue.d.ts.map +0 -1
  60. package/dist/canvas/revenue.js +0 -30
  61. package/dist/canvas/revenue.js.map +0 -1
  62. package/dist/canvas/segments.d.ts +0 -20
  63. package/dist/canvas/segments.d.ts.map +0 -1
  64. package/dist/canvas/segments.js +0 -28
  65. package/dist/canvas/segments.js.map +0 -1
  66. package/dist/canvas/types.d.ts +0 -232
  67. package/dist/canvas/types.d.ts.map +0 -1
  68. package/dist/canvas/types.js +0 -8
  69. package/dist/canvas/types.js.map +0 -1
  70. package/dist/canvas/value.d.ts +0 -20
  71. package/dist/canvas/value.d.ts.map +0 -1
  72. package/dist/canvas/value.js +0 -21
  73. package/dist/canvas/value.js.map +0 -1
  74. package/dist/dollar.d.ts +0 -60
  75. package/dist/dollar.d.ts.map +0 -1
  76. package/dist/dollar.js +0 -107
  77. package/dist/dollar.js.map +0 -1
  78. package/dist/entities/assets.d.ts +0 -21
  79. package/dist/entities/assets.d.ts.map +0 -1
  80. package/dist/entities/assets.js +0 -323
  81. package/dist/entities/assets.js.map +0 -1
  82. package/dist/entities/business.d.ts +0 -36
  83. package/dist/entities/business.d.ts.map +0 -1
  84. package/dist/entities/business.js +0 -370
  85. package/dist/entities/business.js.map +0 -1
  86. package/dist/entities/communication.d.ts +0 -21
  87. package/dist/entities/communication.d.ts.map +0 -1
  88. package/dist/entities/communication.js +0 -255
  89. package/dist/entities/communication.js.map +0 -1
  90. package/dist/entities/customers.d.ts +0 -58
  91. package/dist/entities/customers.d.ts.map +0 -1
  92. package/dist/entities/customers.js +0 -989
  93. package/dist/entities/customers.js.map +0 -1
  94. package/dist/entities/financials.d.ts +0 -59
  95. package/dist/entities/financials.d.ts.map +0 -1
  96. package/dist/entities/financials.js +0 -932
  97. package/dist/entities/financials.js.map +0 -1
  98. package/dist/entities/goals.d.ts +0 -58
  99. package/dist/entities/goals.d.ts.map +0 -1
  100. package/dist/entities/goals.js +0 -800
  101. package/dist/entities/goals.js.map +0 -1
  102. package/dist/entities/index.d.ts +0 -299
  103. package/dist/entities/index.d.ts.map +0 -1
  104. package/dist/entities/index.js +0 -198
  105. package/dist/entities/index.js.map +0 -1
  106. package/dist/entities/legal.d.ts +0 -21
  107. package/dist/entities/legal.d.ts.map +0 -1
  108. package/dist/entities/legal.js +0 -301
  109. package/dist/entities/legal.js.map +0 -1
  110. package/dist/entities/market.d.ts +0 -21
  111. package/dist/entities/market.d.ts.map +0 -1
  112. package/dist/entities/market.js +0 -301
  113. package/dist/entities/market.js.map +0 -1
  114. package/dist/entities/marketing.d.ts +0 -67
  115. package/dist/entities/marketing.d.ts.map +0 -1
  116. package/dist/entities/marketing.js +0 -1157
  117. package/dist/entities/marketing.js.map +0 -1
  118. package/dist/entities/offerings.d.ts +0 -51
  119. package/dist/entities/offerings.d.ts.map +0 -1
  120. package/dist/entities/offerings.js +0 -727
  121. package/dist/entities/offerings.js.map +0 -1
  122. package/dist/entities/operations.d.ts +0 -58
  123. package/dist/entities/operations.d.ts.map +0 -1
  124. package/dist/entities/operations.js +0 -787
  125. package/dist/entities/operations.js.map +0 -1
  126. package/dist/entities/organization.d.ts +0 -57
  127. package/dist/entities/organization.d.ts.map +0 -1
  128. package/dist/entities/organization.js +0 -807
  129. package/dist/entities/organization.js.map +0 -1
  130. package/dist/entities/partnerships.d.ts +0 -21
  131. package/dist/entities/partnerships.d.ts.map +0 -1
  132. package/dist/entities/partnerships.js +0 -300
  133. package/dist/entities/partnerships.js.map +0 -1
  134. package/dist/entities/planning.d.ts +0 -0
  135. package/dist/entities/planning.d.ts.map +0 -1
  136. package/dist/entities/planning.js +0 -271
  137. package/dist/entities/planning.js.map +0 -1
  138. package/dist/entities/projects.d.ts +0 -25
  139. package/dist/entities/projects.d.ts.map +0 -1
  140. package/dist/entities/projects.js +0 -349
  141. package/dist/entities/projects.js.map +0 -1
  142. package/dist/entities/risk.d.ts +0 -21
  143. package/dist/entities/risk.d.ts.map +0 -1
  144. package/dist/entities/risk.js +0 -293
  145. package/dist/entities/risk.js.map +0 -1
  146. package/dist/entities/sales.d.ts +0 -72
  147. package/dist/entities/sales.d.ts.map +0 -1
  148. package/dist/entities/sales.js +0 -1248
  149. package/dist/entities/sales.js.map +0 -1
  150. package/dist/financials.d.ts +0 -130
  151. package/dist/financials.d.ts.map +0 -1
  152. package/dist/financials.js +0 -297
  153. package/dist/financials.js.map +0 -1
  154. package/dist/goals.d.ts +0 -87
  155. package/dist/goals.d.ts.map +0 -1
  156. package/dist/goals.js +0 -215
  157. package/dist/goals.js.map +0 -1
  158. package/dist/index.d.ts +0 -97
  159. package/dist/index.d.ts.map +0 -1
  160. package/dist/index.js +0 -132
  161. package/dist/index.js.map +0 -1
  162. package/dist/kpis.d.ts +0 -118
  163. package/dist/kpis.d.ts.map +0 -1
  164. package/dist/kpis.js +0 -232
  165. package/dist/kpis.js.map +0 -1
  166. package/dist/metrics.d.ts +0 -448
  167. package/dist/metrics.d.ts.map +0 -1
  168. package/dist/metrics.js +0 -325
  169. package/dist/metrics.js.map +0 -1
  170. package/dist/okrs.d.ts +0 -123
  171. package/dist/okrs.d.ts.map +0 -1
  172. package/dist/okrs.js +0 -269
  173. package/dist/okrs.js.map +0 -1
  174. package/dist/organization.d.ts +0 -585
  175. package/dist/organization.d.ts.map +0 -1
  176. package/dist/organization.js +0 -173
  177. package/dist/organization.js.map +0 -1
  178. package/dist/process.d.ts +0 -112
  179. package/dist/process.d.ts.map +0 -1
  180. package/dist/process.js +0 -241
  181. package/dist/process.js.map +0 -1
  182. package/dist/product.d.ts +0 -85
  183. package/dist/product.d.ts.map +0 -1
  184. package/dist/product.js +0 -145
  185. package/dist/product.js.map +0 -1
  186. package/dist/queries.d.ts +0 -304
  187. package/dist/queries.d.ts.map +0 -1
  188. package/dist/queries.js +0 -415
  189. package/dist/queries.js.map +0 -1
  190. package/dist/roles.d.ts +0 -340
  191. package/dist/roles.d.ts.map +0 -1
  192. package/dist/roles.js +0 -255
  193. package/dist/roles.js.map +0 -1
  194. package/dist/service.d.ts +0 -61
  195. package/dist/service.d.ts.map +0 -1
  196. package/dist/service.js +0 -140
  197. package/dist/service.js.map +0 -1
  198. package/dist/types.d.ts +0 -459
  199. package/dist/types.d.ts.map +0 -1
  200. package/dist/types.js +0 -5
  201. package/dist/types.js.map +0 -1
  202. package/dist/vision.d.ts +0 -38
  203. package/dist/vision.d.ts.map +0 -1
  204. package/dist/vision.js +0 -68
  205. package/dist/vision.js.map +0 -1
  206. package/dist/workflow.d.ts +0 -115
  207. package/dist/workflow.d.ts.map +0 -1
  208. package/dist/workflow.js +0 -247
  209. package/dist/workflow.js.map +0 -1
  210. package/src/business.js +0 -108
  211. package/src/canvas/activities.ts +0 -32
  212. package/src/canvas/canvas.ts +0 -482
  213. package/src/canvas/channels.ts +0 -34
  214. package/src/canvas/costs.ts +0 -43
  215. package/src/canvas/economics.ts +0 -99
  216. package/src/canvas/index.ts +0 -206
  217. package/src/canvas/partnerships.ts +0 -34
  218. package/src/canvas/projections.ts +0 -141
  219. package/src/canvas/relationships.ts +0 -34
  220. package/src/canvas/resources.ts +0 -43
  221. package/src/canvas/revenue.ts +0 -56
  222. package/src/canvas/segments.ts +0 -42
  223. package/src/canvas/types.ts +0 -363
  224. package/src/canvas/value.ts +0 -34
  225. package/src/dollar.js +0 -106
  226. package/src/entities/assets.js +0 -322
  227. package/src/entities/business.js +0 -369
  228. package/src/entities/communication.js +0 -254
  229. package/src/entities/customers.js +0 -988
  230. package/src/entities/financials.js +0 -931
  231. package/src/entities/goals.js +0 -799
  232. package/src/entities/index.js +0 -197
  233. package/src/entities/legal.js +0 -300
  234. package/src/entities/market.js +0 -300
  235. package/src/entities/marketing.js +0 -1156
  236. package/src/entities/offerings.js +0 -726
  237. package/src/entities/operations.js +0 -786
  238. package/src/entities/organization.js +0 -806
  239. package/src/entities/partnerships.js +0 -299
  240. package/src/entities/planning.js +0 -270
  241. package/src/entities/projects.js +0 -348
  242. package/src/entities/risk.js +0 -292
  243. package/src/entities/sales.js +0 -1247
  244. package/src/financials.js +0 -296
  245. package/src/goals.js +0 -214
  246. package/src/index.js +0 -131
  247. package/src/index.test.js +0 -274
  248. package/src/kpis.js +0 -231
  249. package/src/metrics.js +0 -324
  250. package/src/okrs.js +0 -268
  251. package/src/organization.js +0 -172
  252. package/src/process.js +0 -240
  253. package/src/product.js +0 -144
  254. package/src/queries.js +0 -414
  255. package/src/roles.js +0 -254
  256. package/src/service.js +0 -139
  257. package/src/types.js +0 -4
  258. package/src/vision.js +0 -67
  259. package/src/workflow.js +0 -246
  260. package/tests/canvas.test.ts +0 -842
@@ -1,989 +0,0 @@
1
- /**
2
- * Customer Entity Types (Nouns)
3
- *
4
- * Customer and relationship management: Customer, Account, Contact, Segment, Persona.
5
- *
6
- * @packageDocumentation
7
- */
8
- // =============================================================================
9
- // Customer
10
- // =============================================================================
11
- /**
12
- * Customer entity
13
- *
14
- * Represents a customer (individual or company).
15
- */
16
- export const Customer = {
17
- singular: 'customer',
18
- plural: 'customers',
19
- description: 'A customer (individual or company)',
20
- properties: {
21
- // Identity
22
- name: {
23
- type: 'string',
24
- description: 'Customer name',
25
- },
26
- email: {
27
- type: 'string',
28
- optional: true,
29
- description: 'Primary email',
30
- },
31
- phone: {
32
- type: 'string',
33
- optional: true,
34
- description: 'Primary phone',
35
- },
36
- // Type
37
- type: {
38
- type: 'string',
39
- description: 'Customer type',
40
- examples: ['individual', 'company', 'nonprofit', 'government'],
41
- },
42
- // Classification
43
- tier: {
44
- type: 'string',
45
- optional: true,
46
- description: 'Customer tier',
47
- examples: ['free', 'starter', 'pro', 'business', 'enterprise', 'strategic'],
48
- },
49
- segment: {
50
- type: 'string',
51
- optional: true,
52
- description: 'Customer segment',
53
- },
54
- industry: {
55
- type: 'string',
56
- optional: true,
57
- description: 'Industry',
58
- },
59
- // Lifecycle
60
- stage: {
61
- type: 'string',
62
- description: 'Customer lifecycle stage',
63
- examples: ['prospect', 'trial', 'onboarding', 'active', 'at-risk', 'churned', 'won-back'],
64
- },
65
- source: {
66
- type: 'string',
67
- optional: true,
68
- description: 'Acquisition source',
69
- examples: ['organic', 'paid', 'referral', 'partner', 'outbound', 'event'],
70
- },
71
- referredBy: {
72
- type: 'string',
73
- optional: true,
74
- description: 'Referrer ID or name',
75
- },
76
- // Dates
77
- firstContactAt: {
78
- type: 'datetime',
79
- optional: true,
80
- description: 'First contact date',
81
- },
82
- convertedAt: {
83
- type: 'datetime',
84
- optional: true,
85
- description: 'Conversion date',
86
- },
87
- churnedAt: {
88
- type: 'datetime',
89
- optional: true,
90
- description: 'Churn date',
91
- },
92
- // Value
93
- lifetimeValue: {
94
- type: 'number',
95
- optional: true,
96
- description: 'Customer lifetime value',
97
- },
98
- mrr: {
99
- type: 'number',
100
- optional: true,
101
- description: 'Monthly recurring revenue',
102
- },
103
- arr: {
104
- type: 'number',
105
- optional: true,
106
- description: 'Annual recurring revenue',
107
- },
108
- currency: {
109
- type: 'string',
110
- optional: true,
111
- description: 'Currency code',
112
- },
113
- // Health
114
- healthScore: {
115
- type: 'number',
116
- optional: true,
117
- description: 'Customer health score (0-100)',
118
- },
119
- nps: {
120
- type: 'number',
121
- optional: true,
122
- description: 'Net Promoter Score (-100 to 100)',
123
- },
124
- lastActivityAt: {
125
- type: 'datetime',
126
- optional: true,
127
- description: 'Last activity date',
128
- },
129
- // Location
130
- country: {
131
- type: 'string',
132
- optional: true,
133
- description: 'Country',
134
- },
135
- region: {
136
- type: 'string',
137
- optional: true,
138
- description: 'Region',
139
- },
140
- timezone: {
141
- type: 'string',
142
- optional: true,
143
- description: 'Timezone',
144
- },
145
- // Company info (for B2B)
146
- companySize: {
147
- type: 'string',
148
- optional: true,
149
- description: 'Company size',
150
- examples: ['1-10', '11-50', '51-200', '201-500', '501-1000', '1000+'],
151
- },
152
- annualRevenue: {
153
- type: 'number',
154
- optional: true,
155
- description: 'Annual revenue',
156
- },
157
- website: {
158
- type: 'url',
159
- optional: true,
160
- description: 'Website URL',
161
- },
162
- // Tags
163
- tags: {
164
- type: 'string',
165
- array: true,
166
- optional: true,
167
- description: 'Tags',
168
- },
169
- // Status
170
- status: {
171
- type: 'string',
172
- description: 'Customer status',
173
- examples: ['active', 'inactive', 'suspended', 'deleted'],
174
- },
175
- },
176
- relationships: {
177
- account: {
178
- type: 'Account',
179
- required: false,
180
- description: 'Parent account (for B2B)',
181
- },
182
- contacts: {
183
- type: 'Contact[]',
184
- description: 'Associated contacts',
185
- },
186
- owner: {
187
- type: 'Worker',
188
- required: false,
189
- description: 'Account owner/CSM',
190
- },
191
- segment: {
192
- type: 'Segment',
193
- required: false,
194
- description: 'Customer segment',
195
- },
196
- subscriptions: {
197
- type: 'Subscription[]',
198
- description: 'Active subscriptions',
199
- },
200
- contracts: {
201
- type: 'Contract[]',
202
- description: 'Contracts',
203
- },
204
- deals: {
205
- type: 'Deal[]',
206
- description: 'Sales deals',
207
- },
208
- interactions: {
209
- type: 'Interaction[]',
210
- description: 'Interaction history',
211
- },
212
- },
213
- actions: [
214
- 'create',
215
- 'update',
216
- 'qualify',
217
- 'convert',
218
- 'onboard',
219
- 'upgrade',
220
- 'downgrade',
221
- 'renew',
222
- 'markAtRisk',
223
- 'churn',
224
- 'winBack',
225
- 'merge',
226
- 'archive',
227
- ],
228
- events: [
229
- 'created',
230
- 'updated',
231
- 'qualified',
232
- 'converted',
233
- 'onboarded',
234
- 'upgraded',
235
- 'downgraded',
236
- 'renewed',
237
- 'markedAtRisk',
238
- 'churned',
239
- 'wonBack',
240
- 'merged',
241
- 'archived',
242
- ],
243
- };
244
- // =============================================================================
245
- // Account
246
- // =============================================================================
247
- /**
248
- * Account entity
249
- *
250
- * Represents a company account (B2B).
251
- */
252
- export const Account = {
253
- singular: 'account',
254
- plural: 'accounts',
255
- description: 'A company account (B2B)',
256
- properties: {
257
- // Identity
258
- name: {
259
- type: 'string',
260
- description: 'Account/company name',
261
- },
262
- legalName: {
263
- type: 'string',
264
- optional: true,
265
- description: 'Legal entity name',
266
- },
267
- domain: {
268
- type: 'string',
269
- optional: true,
270
- description: 'Primary domain',
271
- },
272
- website: {
273
- type: 'url',
274
- optional: true,
275
- description: 'Website URL',
276
- },
277
- // Classification
278
- type: {
279
- type: 'string',
280
- optional: true,
281
- description: 'Account type',
282
- examples: ['prospect', 'customer', 'partner', 'competitor'],
283
- },
284
- tier: {
285
- type: 'string',
286
- optional: true,
287
- description: 'Account tier',
288
- examples: ['smb', 'mid-market', 'enterprise', 'strategic'],
289
- },
290
- industry: {
291
- type: 'string',
292
- optional: true,
293
- description: 'Industry',
294
- },
295
- // Size
296
- employees: {
297
- type: 'number',
298
- optional: true,
299
- description: 'Employee count',
300
- },
301
- annualRevenue: {
302
- type: 'number',
303
- optional: true,
304
- description: 'Annual revenue',
305
- },
306
- // Location
307
- headquarters: {
308
- type: 'string',
309
- optional: true,
310
- description: 'Headquarters location',
311
- },
312
- country: {
313
- type: 'string',
314
- optional: true,
315
- description: 'Country',
316
- },
317
- region: {
318
- type: 'string',
319
- optional: true,
320
- description: 'Region',
321
- },
322
- // Relationship
323
- parentAccountId: {
324
- type: 'string',
325
- optional: true,
326
- description: 'Parent account (for subsidiaries)',
327
- },
328
- // Value
329
- totalContractValue: {
330
- type: 'number',
331
- optional: true,
332
- description: 'Total contract value',
333
- },
334
- arr: {
335
- type: 'number',
336
- optional: true,
337
- description: 'Annual recurring revenue',
338
- },
339
- currency: {
340
- type: 'string',
341
- optional: true,
342
- description: 'Currency code',
343
- },
344
- // Health
345
- healthScore: {
346
- type: 'number',
347
- optional: true,
348
- description: 'Account health score',
349
- },
350
- // IDs
351
- crmId: {
352
- type: 'string',
353
- optional: true,
354
- description: 'External CRM ID',
355
- },
356
- // Status
357
- status: {
358
- type: 'string',
359
- description: 'Account status',
360
- examples: ['active', 'inactive', 'churned', 'archived'],
361
- },
362
- },
363
- relationships: {
364
- owner: {
365
- type: 'Worker',
366
- required: false,
367
- description: 'Account owner',
368
- },
369
- contacts: {
370
- type: 'Contact[]',
371
- description: 'Account contacts',
372
- },
373
- customers: {
374
- type: 'Customer[]',
375
- description: 'Associated customers',
376
- },
377
- deals: {
378
- type: 'Deal[]',
379
- description: 'Sales deals',
380
- },
381
- contracts: {
382
- type: 'Contract[]',
383
- description: 'Contracts',
384
- },
385
- parent: {
386
- type: 'Account',
387
- required: false,
388
- description: 'Parent account',
389
- },
390
- subsidiaries: {
391
- type: 'Account[]',
392
- description: 'Subsidiary accounts',
393
- },
394
- },
395
- actions: [
396
- 'create',
397
- 'update',
398
- 'merge',
399
- 'assignOwner',
400
- 'updateTier',
401
- 'addContact',
402
- 'removeContact',
403
- 'archive',
404
- ],
405
- events: [
406
- 'created',
407
- 'updated',
408
- 'merged',
409
- 'ownerAssigned',
410
- 'tierUpdated',
411
- 'contactAdded',
412
- 'contactRemoved',
413
- 'archived',
414
- ],
415
- };
416
- // =============================================================================
417
- // Contact
418
- // =============================================================================
419
- /**
420
- * Contact entity
421
- *
422
- * Represents a person/contact at a customer or account.
423
- */
424
- export const Contact = {
425
- singular: 'contact',
426
- plural: 'contacts',
427
- description: 'A person/contact at a customer or account',
428
- properties: {
429
- // Identity
430
- firstName: {
431
- type: 'string',
432
- description: 'First name',
433
- },
434
- lastName: {
435
- type: 'string',
436
- description: 'Last name',
437
- },
438
- email: {
439
- type: 'string',
440
- description: 'Email address',
441
- },
442
- phone: {
443
- type: 'string',
444
- optional: true,
445
- description: 'Phone number',
446
- },
447
- // Role
448
- title: {
449
- type: 'string',
450
- optional: true,
451
- description: 'Job title',
452
- },
453
- department: {
454
- type: 'string',
455
- optional: true,
456
- description: 'Department',
457
- },
458
- role: {
459
- type: 'string',
460
- optional: true,
461
- description: 'Role in buying process',
462
- examples: ['decision-maker', 'influencer', 'champion', 'blocker', 'end-user', 'economic-buyer', 'technical-buyer'],
463
- },
464
- seniority: {
465
- type: 'string',
466
- optional: true,
467
- description: 'Seniority level',
468
- examples: ['c-level', 'vp', 'director', 'manager', 'individual-contributor'],
469
- },
470
- // Contact preferences
471
- preferredChannel: {
472
- type: 'string',
473
- optional: true,
474
- description: 'Preferred contact channel',
475
- examples: ['email', 'phone', 'linkedin', 'slack'],
476
- },
477
- timezone: {
478
- type: 'string',
479
- optional: true,
480
- description: 'Timezone',
481
- },
482
- // Social
483
- linkedinUrl: {
484
- type: 'url',
485
- optional: true,
486
- description: 'LinkedIn URL',
487
- },
488
- twitterHandle: {
489
- type: 'string',
490
- optional: true,
491
- description: 'Twitter handle',
492
- },
493
- // Engagement
494
- lastContactedAt: {
495
- type: 'datetime',
496
- optional: true,
497
- description: 'Last contacted date',
498
- },
499
- lastRespondedAt: {
500
- type: 'datetime',
501
- optional: true,
502
- description: 'Last response date',
503
- },
504
- // Opt-in
505
- marketingOptIn: {
506
- type: 'boolean',
507
- optional: true,
508
- description: 'Marketing opt-in',
509
- },
510
- salesOptIn: {
511
- type: 'boolean',
512
- optional: true,
513
- description: 'Sales opt-in',
514
- },
515
- // Tags
516
- tags: {
517
- type: 'string',
518
- array: true,
519
- optional: true,
520
- description: 'Tags',
521
- },
522
- // Status
523
- status: {
524
- type: 'string',
525
- description: 'Contact status',
526
- examples: ['active', 'inactive', 'bounced', 'unsubscribed', 'archived'],
527
- },
528
- },
529
- relationships: {
530
- account: {
531
- type: 'Account',
532
- required: false,
533
- description: 'Parent account',
534
- },
535
- customer: {
536
- type: 'Customer',
537
- required: false,
538
- description: 'Associated customer',
539
- },
540
- owner: {
541
- type: 'Worker',
542
- required: false,
543
- description: 'Contact owner',
544
- },
545
- deals: {
546
- type: 'Deal[]',
547
- description: 'Associated deals',
548
- },
549
- interactions: {
550
- type: 'Interaction[]',
551
- description: 'Interaction history',
552
- },
553
- },
554
- actions: [
555
- 'create',
556
- 'update',
557
- 'merge',
558
- 'assignOwner',
559
- 'optIn',
560
- 'optOut',
561
- 'markBounced',
562
- 'archive',
563
- ],
564
- events: [
565
- 'created',
566
- 'updated',
567
- 'merged',
568
- 'ownerAssigned',
569
- 'optedIn',
570
- 'optedOut',
571
- 'bounced',
572
- 'archived',
573
- ],
574
- };
575
- // =============================================================================
576
- // Segment
577
- // =============================================================================
578
- /**
579
- * Segment entity
580
- *
581
- * Represents a customer segment.
582
- */
583
- export const Segment = {
584
- singular: 'segment',
585
- plural: 'segments',
586
- description: 'A customer segment',
587
- properties: {
588
- // Identity
589
- name: {
590
- type: 'string',
591
- description: 'Segment name',
592
- },
593
- description: {
594
- type: 'string',
595
- optional: true,
596
- description: 'Segment description',
597
- },
598
- // Type
599
- type: {
600
- type: 'string',
601
- optional: true,
602
- description: 'Segment type',
603
- examples: ['demographic', 'behavioral', 'firmographic', 'technographic', 'psychographic'],
604
- },
605
- // Criteria
606
- criteria: {
607
- type: 'json',
608
- optional: true,
609
- description: 'Segment criteria/filters',
610
- },
611
- criteriaDescription: {
612
- type: 'string',
613
- optional: true,
614
- description: 'Human-readable criteria',
615
- },
616
- // Size
617
- size: {
618
- type: 'number',
619
- optional: true,
620
- description: 'Number of customers in segment',
621
- },
622
- // Value
623
- totalRevenue: {
624
- type: 'number',
625
- optional: true,
626
- description: 'Total revenue from segment',
627
- },
628
- avgRevenue: {
629
- type: 'number',
630
- optional: true,
631
- description: 'Average revenue per customer',
632
- },
633
- avgLTV: {
634
- type: 'number',
635
- optional: true,
636
- description: 'Average lifetime value',
637
- },
638
- // Behavior
639
- avgChurnRate: {
640
- type: 'number',
641
- optional: true,
642
- description: 'Average churn rate',
643
- },
644
- avgNPS: {
645
- type: 'number',
646
- optional: true,
647
- description: 'Average NPS',
648
- },
649
- // Dynamic
650
- isDynamic: {
651
- type: 'boolean',
652
- optional: true,
653
- description: 'Auto-updates based on criteria',
654
- },
655
- lastCalculatedAt: {
656
- type: 'datetime',
657
- optional: true,
658
- description: 'Last calculation time',
659
- },
660
- // Status
661
- status: {
662
- type: 'string',
663
- description: 'Segment status',
664
- examples: ['active', 'inactive', 'archived'],
665
- },
666
- },
667
- relationships: {
668
- customers: {
669
- type: 'Customer[]',
670
- description: 'Customers in segment',
671
- },
672
- campaigns: {
673
- type: 'Campaign[]',
674
- description: 'Targeted campaigns',
675
- },
676
- persona: {
677
- type: 'Persona',
678
- required: false,
679
- description: 'Associated persona',
680
- },
681
- },
682
- actions: [
683
- 'create',
684
- 'update',
685
- 'refresh',
686
- 'addCustomer',
687
- 'removeCustomer',
688
- 'archive',
689
- ],
690
- events: [
691
- 'created',
692
- 'updated',
693
- 'refreshed',
694
- 'customerAdded',
695
- 'customerRemoved',
696
- 'archived',
697
- ],
698
- };
699
- // =============================================================================
700
- // Persona
701
- // =============================================================================
702
- /**
703
- * Persona entity
704
- *
705
- * Represents a buyer or user persona.
706
- */
707
- export const Persona = {
708
- singular: 'persona',
709
- plural: 'personas',
710
- description: 'A buyer or user persona',
711
- properties: {
712
- // Identity
713
- name: {
714
- type: 'string',
715
- description: 'Persona name',
716
- },
717
- description: {
718
- type: 'string',
719
- optional: true,
720
- description: 'Persona description',
721
- },
722
- avatarUrl: {
723
- type: 'url',
724
- optional: true,
725
- description: 'Avatar image URL',
726
- },
727
- // Type
728
- type: {
729
- type: 'string',
730
- optional: true,
731
- description: 'Persona type',
732
- examples: ['buyer', 'user', 'influencer', 'decision-maker'],
733
- },
734
- // Demographics
735
- jobTitle: {
736
- type: 'string',
737
- optional: true,
738
- description: 'Typical job title',
739
- },
740
- department: {
741
- type: 'string',
742
- optional: true,
743
- description: 'Typical department',
744
- },
745
- seniority: {
746
- type: 'string',
747
- optional: true,
748
- description: 'Seniority level',
749
- },
750
- companySize: {
751
- type: 'string',
752
- optional: true,
753
- description: 'Typical company size',
754
- },
755
- industry: {
756
- type: 'string',
757
- optional: true,
758
- description: 'Typical industry',
759
- },
760
- // Psychographics
761
- goals: {
762
- type: 'string',
763
- array: true,
764
- optional: true,
765
- description: 'Goals and objectives',
766
- },
767
- challenges: {
768
- type: 'string',
769
- array: true,
770
- optional: true,
771
- description: 'Pain points and challenges',
772
- },
773
- motivations: {
774
- type: 'string',
775
- array: true,
776
- optional: true,
777
- description: 'Motivations',
778
- },
779
- objections: {
780
- type: 'string',
781
- array: true,
782
- optional: true,
783
- description: 'Common objections',
784
- },
785
- // Behavior
786
- preferredChannels: {
787
- type: 'string',
788
- array: true,
789
- optional: true,
790
- description: 'Preferred communication channels',
791
- },
792
- contentPreferences: {
793
- type: 'string',
794
- array: true,
795
- optional: true,
796
- description: 'Content format preferences',
797
- },
798
- buyingProcess: {
799
- type: 'string',
800
- optional: true,
801
- description: 'Typical buying process',
802
- },
803
- // Messaging
804
- valueProposition: {
805
- type: 'string',
806
- optional: true,
807
- description: 'Value proposition for this persona',
808
- },
809
- messagingGuidelines: {
810
- type: 'string',
811
- optional: true,
812
- description: 'Messaging guidelines',
813
- },
814
- keywords: {
815
- type: 'string',
816
- array: true,
817
- optional: true,
818
- description: 'Keywords/phrases that resonate',
819
- },
820
- // Status
821
- status: {
822
- type: 'string',
823
- description: 'Persona status',
824
- examples: ['active', 'draft', 'archived'],
825
- },
826
- },
827
- relationships: {
828
- segments: {
829
- type: 'Segment[]',
830
- description: 'Associated segments',
831
- },
832
- products: {
833
- type: 'Product[]',
834
- description: 'Relevant products',
835
- },
836
- content: {
837
- type: 'Content[]',
838
- description: 'Content for this persona',
839
- },
840
- campaigns: {
841
- type: 'Campaign[]',
842
- description: 'Targeted campaigns',
843
- },
844
- },
845
- actions: [
846
- 'create',
847
- 'update',
848
- 'validate',
849
- 'archive',
850
- ],
851
- events: [
852
- 'created',
853
- 'updated',
854
- 'validated',
855
- 'archived',
856
- ],
857
- };
858
- // =============================================================================
859
- // Interaction
860
- // =============================================================================
861
- /**
862
- * Interaction entity
863
- *
864
- * Represents a customer interaction/touchpoint.
865
- */
866
- export const Interaction = {
867
- singular: 'interaction',
868
- plural: 'interactions',
869
- description: 'A customer interaction or touchpoint',
870
- properties: {
871
- // Type
872
- type: {
873
- type: 'string',
874
- description: 'Interaction type',
875
- examples: ['email', 'call', 'meeting', 'chat', 'support-ticket', 'demo', 'webinar', 'event', 'social'],
876
- },
877
- direction: {
878
- type: 'string',
879
- optional: true,
880
- description: 'Interaction direction',
881
- examples: ['inbound', 'outbound'],
882
- },
883
- // Content
884
- subject: {
885
- type: 'string',
886
- optional: true,
887
- description: 'Subject/title',
888
- },
889
- description: {
890
- type: 'string',
891
- optional: true,
892
- description: 'Description/notes',
893
- },
894
- // Timing
895
- occurredAt: {
896
- type: 'datetime',
897
- description: 'When it occurred',
898
- },
899
- duration: {
900
- type: 'number',
901
- optional: true,
902
- description: 'Duration in minutes',
903
- },
904
- // Outcome
905
- outcome: {
906
- type: 'string',
907
- optional: true,
908
- description: 'Interaction outcome',
909
- examples: ['positive', 'neutral', 'negative', 'no-response'],
910
- },
911
- sentiment: {
912
- type: 'string',
913
- optional: true,
914
- description: 'Customer sentiment',
915
- examples: ['very-positive', 'positive', 'neutral', 'negative', 'very-negative'],
916
- },
917
- nextSteps: {
918
- type: 'string',
919
- optional: true,
920
- description: 'Next steps',
921
- },
922
- // Channel
923
- channel: {
924
- type: 'string',
925
- optional: true,
926
- description: 'Channel used',
927
- },
928
- // Attribution
929
- campaignId: {
930
- type: 'string',
931
- optional: true,
932
- description: 'Associated campaign',
933
- },
934
- },
935
- relationships: {
936
- customer: {
937
- type: 'Customer',
938
- required: false,
939
- description: 'Customer',
940
- },
941
- contact: {
942
- type: 'Contact',
943
- required: false,
944
- description: 'Contact',
945
- },
946
- account: {
947
- type: 'Account',
948
- required: false,
949
- description: 'Account',
950
- },
951
- createdBy: {
952
- type: 'Worker',
953
- required: false,
954
- description: 'Who logged it',
955
- },
956
- deal: {
957
- type: 'Deal',
958
- required: false,
959
- description: 'Associated deal',
960
- },
961
- },
962
- actions: [
963
- 'log',
964
- 'update',
965
- 'delete',
966
- ],
967
- events: [
968
- 'logged',
969
- 'updated',
970
- 'deleted',
971
- ],
972
- };
973
- // =============================================================================
974
- // Exports
975
- // =============================================================================
976
- export const CustomerEntities = {
977
- Customer,
978
- Account,
979
- Contact,
980
- Segment,
981
- Persona,
982
- Interaction,
983
- };
984
- export const CustomerCategories = {
985
- customers: ['Customer', 'Account', 'Contact'],
986
- segmentation: ['Segment', 'Persona'],
987
- engagement: ['Interaction'],
988
- };
989
- //# sourceMappingURL=customers.js.map