@nuwah/vertical-sdk 0.0.0-stage → 0.2.0-rc.1

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 (239) hide show
  1. package/LICENSE +17 -0
  2. package/README.md +229 -2
  3. package/bin/nuwah-contract-check-rules.d.mts +41 -0
  4. package/bin/nuwah-contract-check-rules.mjs +333 -0
  5. package/bin/nuwah-contract-check.mjs +64 -0
  6. package/dist/accounting.d.ts +1417 -0
  7. package/dist/accounting.js +274 -0
  8. package/dist/active-org.d.ts +13 -0
  9. package/dist/active-org.js +59 -0
  10. package/dist/actors.d.ts +448 -0
  11. package/dist/actors.js +143 -0
  12. package/dist/ai.d.ts +359 -0
  13. package/dist/ai.js +229 -0
  14. package/dist/analytics.d.ts +37 -0
  15. package/dist/analytics.js +8 -0
  16. package/dist/atlas.d.ts +291 -0
  17. package/dist/atlas.js +78 -0
  18. package/dist/audit.d.ts +193 -0
  19. package/dist/audit.js +26 -0
  20. package/dist/authentication.d.ts +119 -0
  21. package/dist/authentication.js +83 -0
  22. package/dist/awards.d.ts +38 -0
  23. package/dist/awards.js +10 -0
  24. package/dist/blueprint/document.d.ts +178 -0
  25. package/dist/blueprint/document.js +17 -0
  26. package/dist/blueprint/index.d.ts +3 -0
  27. package/dist/blueprint/index.js +5 -0
  28. package/dist/blueprint/manifest.d.ts +105 -0
  29. package/dist/blueprint/manifest.js +11 -0
  30. package/dist/blueprint/validate.d.ts +14 -0
  31. package/dist/blueprint/validate.js +416 -0
  32. package/dist/bookings-directory.d.ts +118 -0
  33. package/dist/bookings-directory.js +289 -0
  34. package/dist/bookings-extra.d.ts +1448 -0
  35. package/dist/bookings-extra.js +582 -0
  36. package/dist/bookings.d.ts +1365 -0
  37. package/dist/bookings.js +305 -0
  38. package/dist/builder-code.d.ts +164 -0
  39. package/dist/builder-code.js +12 -0
  40. package/dist/builder-core-gaps.d.ts +83 -0
  41. package/dist/builder-core-gaps.js +8 -0
  42. package/dist/builder-repos.d.ts +73 -0
  43. package/dist/builder-repos.js +37 -0
  44. package/dist/builder.d.ts +730 -0
  45. package/dist/builder.js +105 -0
  46. package/dist/campaigns.d.ts +105 -0
  47. package/dist/campaigns.js +25 -0
  48. package/dist/catalogs.d.ts +188 -0
  49. package/dist/catalogs.js +36 -0
  50. package/dist/commerce-ai.d.ts +182 -0
  51. package/dist/commerce-ai.js +27 -0
  52. package/dist/connections.d.ts +278 -0
  53. package/dist/connections.js +96 -0
  54. package/dist/content-control.d.ts +121 -0
  55. package/dist/content-control.js +23 -0
  56. package/dist/contributions.d.ts +560 -0
  57. package/dist/contributions.js +140 -0
  58. package/dist/conversation-assist.d.ts +154 -0
  59. package/dist/conversation-assist.js +51 -0
  60. package/dist/conversation-info.d.ts +219 -0
  61. package/dist/conversation-info.js +43 -0
  62. package/dist/crm.d.ts +533 -0
  63. package/dist/crm.js +142 -0
  64. package/dist/dashboards.d.ts +119 -0
  65. package/dist/dashboards.js +22 -0
  66. package/dist/delegations.d.ts +161 -0
  67. package/dist/delegations.js +39 -0
  68. package/dist/docs.d.ts +289 -0
  69. package/dist/docs.js +49 -0
  70. package/dist/documents.d.ts +317 -0
  71. package/dist/documents.js +84 -0
  72. package/dist/drafts.d.ts +132 -0
  73. package/dist/drafts.js +56 -0
  74. package/dist/engagements.d.ts +133 -0
  75. package/dist/engagements.js +15 -0
  76. package/dist/event-stream.d.ts +54 -0
  77. package/dist/event-stream.js +228 -0
  78. package/dist/exchanges.d.ts +447 -0
  79. package/dist/exchanges.js +145 -0
  80. package/dist/exports.d.ts +113 -0
  81. package/dist/exports.js +81 -0
  82. package/dist/feeds.d.ts +228 -0
  83. package/dist/feeds.js +52 -0
  84. package/dist/files.d.ts +56 -0
  85. package/dist/files.js +55 -0
  86. package/dist/finance-insights.d.ts +41 -0
  87. package/dist/finance-insights.js +61 -0
  88. package/dist/fixed-assets.d.ts +155 -0
  89. package/dist/fixed-assets.js +28 -0
  90. package/dist/fulfilment-jobs.d.ts +405 -0
  91. package/dist/fulfilment-jobs.js +76 -0
  92. package/dist/fulfilment.d.ts +205 -0
  93. package/dist/fulfilment.js +39 -0
  94. package/dist/hr.d.ts +350 -0
  95. package/dist/hr.js +94 -0
  96. package/dist/http.d.ts +124 -0
  97. package/dist/http.js +392 -0
  98. package/dist/inbox.d.ts +206 -0
  99. package/dist/inbox.js +36 -0
  100. package/dist/index.d.ts +384 -0
  101. package/dist/index.js +294 -0
  102. package/dist/insights.d.ts +176 -0
  103. package/dist/insights.js +52 -0
  104. package/dist/inventory.d.ts +797 -0
  105. package/dist/inventory.js +120 -0
  106. package/dist/list-query.d.ts +211 -0
  107. package/dist/list-query.js +158 -0
  108. package/dist/listings.d.ts +381 -0
  109. package/dist/listings.js +173 -0
  110. package/dist/location-sharing.d.ts +83 -0
  111. package/dist/location-sharing.js +20 -0
  112. package/dist/marketplace.d.ts +268 -0
  113. package/dist/marketplace.js +59 -0
  114. package/dist/matching.d.ts +103 -0
  115. package/dist/matching.js +22 -0
  116. package/dist/media.d.ts +221 -0
  117. package/dist/media.js +239 -0
  118. package/dist/metrics.d.ts +125 -0
  119. package/dist/metrics.js +45 -0
  120. package/dist/moderation.d.ts +240 -0
  121. package/dist/moderation.js +40 -0
  122. package/dist/money.d.ts +41 -0
  123. package/dist/money.js +79 -0
  124. package/dist/my-data.d.ts +266 -0
  125. package/dist/my-data.js +32 -0
  126. package/dist/names.d.ts +14 -0
  127. package/dist/names.js +17 -0
  128. package/dist/occasions.d.ts +256 -0
  129. package/dist/occasions.js +40 -0
  130. package/dist/onboarding.d.ts +88 -0
  131. package/dist/onboarding.js +38 -0
  132. package/dist/pagination.d.ts +204 -0
  133. package/dist/pagination.js +141 -0
  134. package/dist/party-baseline-attributes.d.ts +245 -0
  135. package/dist/party-baseline-attributes.js +36 -0
  136. package/dist/party.d.ts +401 -0
  137. package/dist/party.js +56 -0
  138. package/dist/patient.d.ts +161 -0
  139. package/dist/patient.js +45 -0
  140. package/dist/payroll.d.ts +378 -0
  141. package/dist/payroll.js +60 -0
  142. package/dist/person-addresses.d.ts +88 -0
  143. package/dist/person-addresses.js +18 -0
  144. package/dist/person-cart.d.ts +250 -0
  145. package/dist/person-cart.js +63 -0
  146. package/dist/person-chat-assist.d.ts +47 -0
  147. package/dist/person-chat-assist.js +13 -0
  148. package/dist/person-data-webhooks.d.ts +72 -0
  149. package/dist/person-data-webhooks.js +86 -0
  150. package/dist/person-data.d.ts +212 -0
  151. package/dist/person-data.js +162 -0
  152. package/dist/person-locations.d.ts +54 -0
  153. package/dist/person-locations.js +6 -0
  154. package/dist/person-messaging.d.ts +405 -0
  155. package/dist/person-messaging.js +112 -0
  156. package/dist/person-notifications.d.ts +319 -0
  157. package/dist/person-notifications.js +164 -0
  158. package/dist/personalisation.d.ts +21 -0
  159. package/dist/personalisation.js +8 -0
  160. package/dist/platform.d.ts +63 -0
  161. package/dist/platform.js +45 -0
  162. package/dist/portfolio.d.ts +163 -0
  163. package/dist/portfolio.js +28 -0
  164. package/dist/pos.d.ts +743 -0
  165. package/dist/pos.js +129 -0
  166. package/dist/procurement.d.ts +664 -0
  167. package/dist/procurement.js +157 -0
  168. package/dist/promotions.d.ts +169 -0
  169. package/dist/promotions.js +39 -0
  170. package/dist/publications.d.ts +583 -0
  171. package/dist/publications.js +164 -0
  172. package/dist/ranking.d.ts +43 -0
  173. package/dist/ranking.js +34 -0
  174. package/dist/ratings.d.ts +293 -0
  175. package/dist/ratings.js +109 -0
  176. package/dist/reactions.d.ts +123 -0
  177. package/dist/reactions.js +41 -0
  178. package/dist/recipient-orders.d.ts +294 -0
  179. package/dist/recipient-orders.js +73 -0
  180. package/dist/relationships.d.ts +18 -0
  181. package/dist/relationships.js +8 -0
  182. package/dist/reporting.d.ts +107 -0
  183. package/dist/reporting.js +56 -0
  184. package/dist/sales.d.ts +270 -0
  185. package/dist/sales.js +66 -0
  186. package/dist/shares.d.ts +105 -0
  187. package/dist/shares.js +27 -0
  188. package/dist/shop.d.ts +993 -0
  189. package/dist/shop.js +215 -0
  190. package/dist/shopping-assistant.d.ts +65 -0
  191. package/dist/shopping-assistant.js +14 -0
  192. package/dist/spaces.d.ts +422 -0
  193. package/dist/spaces.js +118 -0
  194. package/dist/stored-value.d.ts +754 -0
  195. package/dist/stored-value.js +177 -0
  196. package/dist/types.d.ts +83 -0
  197. package/dist/types.js +2 -0
  198. package/dist/vault.d.ts +290 -0
  199. package/dist/vault.js +55 -0
  200. package/dist/vertical-runtime.d.ts +17 -0
  201. package/dist/vertical-runtime.js +8 -0
  202. package/dist/vite/build-manifest-plugin.d.ts +42 -0
  203. package/dist/vite/build-manifest-plugin.js +42 -0
  204. package/dist/vite/first-paint-plugin.d.ts +26 -0
  205. package/dist/vite/first-paint-plugin.js +57 -0
  206. package/dist/wishlists.d.ts +591 -0
  207. package/dist/wishlists.js +188 -0
  208. package/dist/workbench.d.ts +114 -0
  209. package/dist/workbench.js +22 -0
  210. package/dist/workspace.d.ts +190 -0
  211. package/dist/workspace.js +41 -0
  212. package/package.json +52 -4
  213. package/templates/extension-image.Dockerfile +38 -0
  214. package/templates/nuwah-vertical.yml +102 -0
  215. package/templates/vertical-app/.env.example +34 -0
  216. package/templates/vertical-app/README.md +108 -0
  217. package/templates/vertical-app/github/workflows/ci.yml +51 -0
  218. package/templates/vertical-app/gitignore +5 -0
  219. package/templates/vertical-app/index.html +12 -0
  220. package/templates/vertical-app/package.json +28 -0
  221. package/templates/vertical-app/src/App.tsx +64 -0
  222. package/templates/vertical-app/src/blueprint/blueprint.ts +45 -0
  223. package/templates/vertical-app/src/blueprint/screens.ts +15 -0
  224. package/templates/vertical-app/src/env.d.ts +18 -0
  225. package/templates/vertical-app/src/index.css +139 -0
  226. package/templates/vertical-app/src/lib/i18n.ts +5 -0
  227. package/templates/vertical-app/src/lib/iam.ts +19 -0
  228. package/templates/vertical-app/src/lib/operations.ts +93 -0
  229. package/templates/vertical-app/src/lib/router.ts +24 -0
  230. package/templates/vertical-app/src/lib/sdk.ts +21 -0
  231. package/templates/vertical-app/src/lib/theme.ts +18 -0
  232. package/templates/vertical-app/src/lib/words.ts +39 -0
  233. package/templates/vertical-app/src/main.tsx +25 -0
  234. package/templates/vertical-app/src/pages/AppScreens.tsx +71 -0
  235. package/templates/vertical-app/src/pages/AuthCallback.tsx +44 -0
  236. package/templates/vertical-app/src/pages/Home.tsx +36 -0
  237. package/templates/vertical-app/tsconfig.json +24 -0
  238. package/templates/vertical-app/vite.config.ts +23 -0
  239. package/templates/vertical-ci.yml +192 -0
package/dist/index.js ADDED
@@ -0,0 +1,294 @@
1
+
2
+
3
+ import { createHttp } from './http.js';
4
+ import { createCrmNamespace } from './crm.js';
5
+ import { createBookingsNamespace } from './bookings.js';
6
+ import { createBookingsExtraNamespace } from './bookings-extra.js';
7
+ import { createAccountingNamespace } from './accounting.js';
8
+ import { createFinanceInsights } from './finance-insights.js';
9
+ import { createHrNamespace } from './hr.js';
10
+ import { createPosNamespace } from './pos.js';
11
+ import { createInventoryNamespace } from './inventory.js';
12
+ import { createFixedAssetsNamespace } from './fixed-assets.js';
13
+ import { createPayrollNamespace } from './payroll.js';
14
+ import { createSalesNamespace } from './sales.js';
15
+ import { createProcurementNamespace } from './procurement.js';
16
+ import { createFilesNamespace } from './files.js';
17
+ import { createPlatformNamespace } from './platform.js';
18
+ import { createDocumentsNamespace } from './documents.js';
19
+ import { createDocsNamespace } from './docs.js';
20
+ import { createReportingNamespace } from './reporting.js';
21
+ import { createDashboardsNamespace } from './dashboards.js';
22
+ import { createCampaignsNamespace } from './campaigns.js';
23
+ import { createInboxNamespace } from './inbox.js';
24
+ import { createAuditNamespace } from './audit.js';
25
+ import { createExportsNamespace } from './exports.js';
26
+ import { createAnalyticsNamespace } from './analytics.js';
27
+ import { createWorkbenchNamespace } from './workbench.js';
28
+ import { createWorkspaceNamespace } from './workspace.js';
29
+ import { createAwardsNamespace } from './awards.js';
30
+ import { createPortfolioNamespace } from './portfolio.js';
31
+ import { createAtlasNamespace } from './atlas.js';
32
+ import { createPartyNamespace } from './party.js';
33
+
34
+ import { createActorsNamespace } from './actors.js';
35
+ import { createConnectionsNamespace } from './connections.js';
36
+ import { createPublicationsNamespace } from './publications.js';
37
+ import { createReactionsNamespace } from './reactions.js';
38
+ import { createDelegationsNamespace } from './delegations.js';
39
+ import { createMyDataNamespace } from './my-data.js';
40
+ import { createRelationshipsNamespace } from './relationships.js';
41
+ import { createVaultNamespace } from './vault.js';
42
+ import { createPersonDataNamespace } from './person-data.js';
43
+ import { createInsightsNamespace } from './insights.js';
44
+ import { createFeedsNamespace } from './feeds.js';
45
+ import { createStoredValueNamespace } from './stored-value.js';
46
+ import { createPersonNotificationsNamespace } from './person-notifications.js';
47
+ import { createSharesNamespace } from './shares.js';
48
+ import { createDraftsNamespace, createWorkspaceDraftsNamespace } from './drafts.js';
49
+ import { createExchangesNamespace } from './exchanges.js';
50
+ import { createRatingsNamespace } from './ratings.js';
51
+ import { createWishlistsNamespace } from './wishlists.js';
52
+ import { createPersonAddressesNamespace } from './person-addresses.js';
53
+ import { createShoppingAssistantNamespace } from './shopping-assistant.js';
54
+ import { createPersonLocationsNamespace } from './person-locations.js';
55
+ import { createPersonCartNamespace } from './person-cart.js';
56
+ import { createRecipientOrdersNamespace } from './recipient-orders.js';
57
+ import { createConversationInfoNamespace } from './conversation-info.js';
58
+ import { createContributionsNamespace } from './contributions.js';
59
+ import { createCommerceAiNamespace } from './commerce-ai.js';
60
+ import { createMarketplaceNamespace } from './marketplace.js';
61
+ import { createOccasionsNamespace } from './occasions.js';
62
+ import { createMetricsNamespace } from './metrics.js';
63
+ import { createFulfilmentJobsNamespace } from './fulfilment-jobs.js';
64
+ import { createFulfilmentNamespace } from './fulfilment.js';
65
+ import { createLocationSharingNamespace } from './location-sharing.js';
66
+ import { createShopNamespace } from './shop.js';
67
+ import { createPersonMessagingNamespace } from './person-messaging.js';
68
+ import { createListingsNamespace } from './listings.js';
69
+ import { createPersonalisationNamespace } from './personalisation.js';
70
+ import { createMediaNamespace } from './media.js';
71
+ import { createSpacesNamespace } from './spaces.js';
72
+ import { createModerationNamespace } from './moderation.js';
73
+ import { createEngagementsNamespace } from './engagements.js';
74
+ import { createCatalogsNamespace } from './catalogs.js';
75
+ import { createMatchingNamespace } from './matching.js';
76
+ import { createAiNamespace } from './ai.js';
77
+ import { createContentControlNamespace } from './content-control.js';
78
+ import { createConversationAssistNamespace } from './conversation-assist.js';
79
+ import { createBuilderNamespace } from './builder.js';
80
+ import { createBuilderReposNamespace } from './builder-repos.js';
81
+ import { createBuilderCodeNamespace } from './builder-code.js';
82
+ import { createBuilderCoreGapsNamespace } from './builder-core-gaps.js';
83
+ import { createVerticalRuntimeNamespace } from './vertical-runtime.js';
84
+ import { createOnboardingNamespace } from './onboarding.js';
85
+ import { createSearchRankingNamespace } from './ranking.js';
86
+ import { createPromotionsNamespace } from './promotions.js';
87
+ import { createPersonChatAssistNamespace } from './person-chat-assist.js';
88
+
89
+ export function createNuwahClient(config) {
90
+ const http = createHttp(config);
91
+
92
+ const accounting = createAccountingNamespace(http, config);
93
+ return {
94
+ crm: createCrmNamespace(http),
95
+ bookings: createBookingsNamespace(http),
96
+ bookingsExtra: createBookingsExtraNamespace(http),
97
+ accounting,
98
+ financeInsights: createFinanceInsights(accounting),
99
+ hr: createHrNamespace(http),
100
+ pos: createPosNamespace(http),
101
+ inventory: createInventoryNamespace(http),
102
+ fixedAssets: createFixedAssetsNamespace(http),
103
+ payroll: createPayrollNamespace(http),
104
+ sales: createSalesNamespace(http),
105
+ procurement: createProcurementNamespace(http),
106
+ files: createFilesNamespace(http, config),
107
+ platform: createPlatformNamespace(http),
108
+ documents: createDocumentsNamespace(http),
109
+ docs: createDocsNamespace(http),
110
+ reporting: createReportingNamespace(http),
111
+ dashboards: createDashboardsNamespace(http),
112
+ campaigns: createCampaignsNamespace(http),
113
+ inbox: createInboxNamespace(http),
114
+ audit: createAuditNamespace(http),
115
+ exports: createExportsNamespace(http, config),
116
+ analytics: createAnalyticsNamespace(http),
117
+ workbench: createWorkbenchNamespace(http),
118
+ workspace: createWorkspaceNamespace(http),
119
+ awards: createAwardsNamespace(http),
120
+ portfolio: createPortfolioNamespace(http),
121
+ atlas: createAtlasNamespace(http),
122
+ party: createPartyNamespace(http),
123
+ actors: createActorsNamespace(http),
124
+ connections: createConnectionsNamespace(http),
125
+ publications: createPublicationsNamespace(http),
126
+ reactions: createReactionsNamespace(http),
127
+ delegations: createDelegationsNamespace(http),
128
+ myData: createMyDataNamespace(http),
129
+ relationships: createRelationshipsNamespace(http),
130
+ vault: createVaultNamespace(http),
131
+ personData: createPersonDataNamespace(http),
132
+ insights: createInsightsNamespace(http),
133
+ feeds: createFeedsNamespace(http),
134
+ storedValue: createStoredValueNamespace(http),
135
+ personNotifications: createPersonNotificationsNamespace(http),
136
+ shares: createSharesNamespace(http),
137
+ drafts: createDraftsNamespace(http),
138
+ workspaceDrafts: createWorkspaceDraftsNamespace(http),
139
+ exchanges: createExchangesNamespace(http),
140
+ ratings: createRatingsNamespace(http),
141
+ wishlists: createWishlistsNamespace(http),
142
+ personAddresses: createPersonAddressesNamespace(http),
143
+ shoppingAssistant: createShoppingAssistantNamespace(http),
144
+ commerceAi: createCommerceAiNamespace(http),
145
+ marketplace: createMarketplaceNamespace(http),
146
+ occasions: createOccasionsNamespace(http),
147
+ metrics: createMetricsNamespace(http, config),
148
+ fulfilmentJobs: createFulfilmentJobsNamespace(http),
149
+ fulfilment: createFulfilmentNamespace(http),
150
+ locationSharing: createLocationSharingNamespace(http),
151
+ personLocations: createPersonLocationsNamespace(http),
152
+ personCart: createPersonCartNamespace(http),
153
+ recipientOrders: createRecipientOrdersNamespace(http),
154
+ conversationInfo: createConversationInfoNamespace(http),
155
+ contributions: createContributionsNamespace(http),
156
+ shop: createShopNamespace(http),
157
+ personMessaging: createPersonMessagingNamespace(http),
158
+ listings: createListingsNamespace(http),
159
+ personalisation: createPersonalisationNamespace(http),
160
+ media: createMediaNamespace(http),
161
+ spaces: createSpacesNamespace(http),
162
+ moderation: createModerationNamespace(http),
163
+ engagements: createEngagementsNamespace(http),
164
+ catalogs: createCatalogsNamespace(http),
165
+ matching: createMatchingNamespace(http),
166
+ ai: createAiNamespace(http, config),
167
+ contentControl: createContentControlNamespace(http),
168
+ conversationAssist: createConversationAssistNamespace(http),
169
+ builder: createBuilderNamespace(http, config),
170
+ builderRepos: createBuilderReposNamespace(http, config),
171
+ builderCode: createBuilderCodeNamespace(http),
172
+ builderCoreGaps: createBuilderCoreGapsNamespace(http),
173
+ verticalRuntime: createVerticalRuntimeNamespace(http),
174
+ onboarding: createOnboardingNamespace(http, config),
175
+ searchRanking: createSearchRankingNamespace(http),
176
+ promotions: createPromotionsNamespace(http),
177
+ personChatAssist: createPersonChatAssistNamespace(http),
178
+ http,
179
+ };
180
+ }
181
+ export { NuwahApiError, setHttpObserver, refusalReason, isIdempotencyKeyReused, IDEMPOTENCY_KEY_REUSED } from './http.js';
182
+
183
+ export { NUWAH_API_VERSION, NUWAH_API_MEDIA_TYPE, deprecationNoticeFrom } from './http.js';
184
+
185
+ export { createActiveOrgStore, fetchMyOrgIds } from './active-org.js';
186
+
187
+ export * from './authentication.js';
188
+ export * from './crm.js';
189
+ export * from './bookings.js';
190
+ export * from './bookings-extra.js';
191
+ export * from './accounting.js';
192
+
193
+ export * from './money.js';
194
+ export * from './finance-insights.js';
195
+ export * from './hr.js';
196
+ export * from './pos.js';
197
+ export * from './inventory.js';
198
+ export * from './fixed-assets.js';
199
+ export * from './payroll.js';
200
+ export * from './sales.js';
201
+ export * from './procurement.js';
202
+ export * from './files.js';
203
+ export * from './platform.js';
204
+ export * from './patient.js';
205
+ export * from './documents.js';
206
+ export * from './docs.js';
207
+ export * from './reporting.js';
208
+ export * from './dashboards.js';
209
+ export * from './campaigns.js';
210
+ export * from './inbox.js';
211
+ export * from './audit.js';
212
+ export * from './exports.js';
213
+ export * from './analytics.js';
214
+ export * from './workbench.js';
215
+ export * from './workspace.js';
216
+ export * from './awards.js';
217
+ export * from './portfolio.js';
218
+ export * from './atlas.js';
219
+ export * from './party.js';
220
+
221
+ export * from './actors.js';
222
+ export * from './connections.js';
223
+ export * from './publications.js';
224
+ export * from './reactions.js';
225
+ export * from './delegations.js';
226
+ export * from './my-data.js';
227
+ export * from './relationships.js';
228
+ export * from './vault.js';
229
+ export * from './person-data.js';
230
+ export * from './person-data-webhooks.js';
231
+ export * from './insights.js';
232
+ export * from './feeds.js';
233
+ export * from './stored-value.js';
234
+ export * from './person-notifications.js';
235
+ export * from './shares.js';
236
+ export * from './drafts.js';
237
+ export * from './exchanges.js';
238
+ export * from './ratings.js';
239
+ export * from './wishlists.js';
240
+ export * from './person-addresses.js';
241
+ export * from './shopping-assistant.js';
242
+
243
+ export * from './commerce-ai.js';
244
+ export * from './person-locations.js';
245
+ export * from './person-cart.js';
246
+ export * from './recipient-orders.js';
247
+ export * from './conversation-info.js';
248
+ export * from './contributions.js';
249
+ export * from './shop.js';
250
+ export * from './person-messaging.js';
251
+
252
+ export * from './list-query.js';
253
+ export * from './listings.js';
254
+ export * from './personalisation.js';
255
+
256
+ export * from './media.js';
257
+ export * from './spaces.js';
258
+ export * from './moderation.js';
259
+ export * from './engagements.js';
260
+ export * from './catalogs.js';
261
+ export * from './matching.js';
262
+ export * from './event-stream.js';
263
+ export * from './ai.js';
264
+ export * from './content-control.js';
265
+ export * from './ranking.js';
266
+
267
+ export * from './conversation-assist.js';
268
+
269
+ export * from './builder.js';
270
+
271
+ export * from './builder-repos.js';
272
+
273
+ export * from './builder-code.js';
274
+ export * from './builder-core-gaps.js';
275
+ export * from './blueprint/index.js';
276
+ export * from './vertical-runtime.js';
277
+
278
+ export * from './onboarding.js';
279
+
280
+ export { createPromotionsNamespace } from './promotions.js';
281
+ export * from './person-chat-assist.js';
282
+
283
+ export * from './pagination.js';
284
+
285
+ export * from './marketplace.js';
286
+
287
+ export * from './occasions.js';
288
+
289
+ export * from './metrics.js';
290
+
291
+ export * from './fulfilment-jobs.js';
292
+
293
+ export * from './fulfilment.js';
294
+ export * from './location-sharing.js';
@@ -0,0 +1,176 @@
1
+ /**
2
+ * Insights — `/api/person/insights/*`: a profile's (or the person's own) daily figures, composed by
3
+ * core from every module that declares an insights provider (Publications: views, reach,
4
+ * reactions…; Actors: profile views, visitors, contact taps, link opens; Listings: published,
5
+ * sold or exchanged, saves).
6
+ *
7
+ * WHOSE: the acting party. Pass `actingAs: 'actor:<uuid>'` to read a profile — the member needs
8
+ * the declared capability `insights.view` (`insights.export` for the CSV); without it the answer
9
+ * is 404, the same as a profile that does not exist. Without `actingAs`, the person's own.
10
+ *
11
+ * NUMBERS ARE DECIMAL STRINGS, never floats. A `null` value with `suppressed: true` is a count of
12
+ * people below the subject's minimum audience (policy `insights.minimum_audience`, default 5):
13
+ * show "fewer than N", never 0. `exact: false` means a day could only be cut in UTC.
14
+ *
15
+ * Days are LOCAL days in the subject's time zone (`settings().time_zone`); the first
16
+ * `overview`/`daily` read enrols the subject (with `time_zone` if given) and queues a 90-day
17
+ * backfill — `counted_through_day` is null until it lands ("preparing").
18
+ *
19
+ * Profile engagement capture: `recordProfileEngagement` (`POST /api/person/actors/{id}/engagement`)
20
+ * — call it once when a profile is opened, and on each contact tap / link open. Always 204.
21
+ */
22
+ import type { Http } from './http.js';
23
+ import { type BilingualText, type PersonDomainCallOptions, type PersonDomainCursorPage, type PersonDomainEnvelope } from './actors.js';
24
+ export type InsightsMetricUnit = 'count' | 'money';
25
+ export type InsightsMetricAggregation = 'sum' | 'last';
26
+ export interface InsightsMetric {
27
+ /** `<source>.<name>`, e.g. `publications.views`. */
28
+ key: string;
29
+ label: BilingualText;
30
+ /** Dashboard group: `content`, `profile`, `catalog`, … (a provider may add its own). */
31
+ section: string;
32
+ unit: InsightsMetricUnit;
33
+ aggregation: InsightsMetricAggregation;
34
+ /** True for distinct-people metrics, which can be suppressed. */
35
+ counts_people: boolean;
36
+ /** The declared splits of this metric, for {@link createInsightsNamespace} `breakdown()`. */
37
+ breakdowns: Array<{
38
+ dimension: string;
39
+ label: BilingualText;
40
+ }>;
41
+ }
42
+ /**
43
+ * One metric split by one dimension over a range (reviews by score, connections by kind, orders
44
+ * by fulfilment). For a people-counting metric a small bucket is suppressed (`value: null`), and so
45
+ * is at least one more, so no hidden bucket can be worked out from `total` minus the shown ones.
46
+ */
47
+ export interface InsightsBreakdown {
48
+ subject: InsightsSubject;
49
+ time_zone: string;
50
+ from: string;
51
+ to: string;
52
+ metric_key: string;
53
+ dimension: string;
54
+ label: BilingualText;
55
+ minimum_audience: number;
56
+ total: InsightsFigure;
57
+ /** Declared buckets first (zeros included), then any others, largest first. */
58
+ buckets: Array<{
59
+ bucket: string;
60
+ label: BilingualText | null;
61
+ value: string | null;
62
+ suppressed: boolean;
63
+ }>;
64
+ }
65
+ export interface InsightsFigure {
66
+ /** Decimal string, or null when suppressed. */
67
+ value: string | null;
68
+ suppressed: boolean;
69
+ exact: boolean;
70
+ }
71
+ export interface InsightsSubject {
72
+ kind: 'actor' | 'person';
73
+ id: string;
74
+ }
75
+ export interface InsightsMetricTotal {
76
+ metric_key: string;
77
+ section: string;
78
+ unit: InsightsMetricUnit;
79
+ aggregation: InsightsMetricAggregation;
80
+ /** ISO-4217 for money, null for a count. */
81
+ currency_code: string | null;
82
+ current: InsightsFigure;
83
+ /** The equally long period just before `from`. */
84
+ previous: InsightsFigure;
85
+ }
86
+ export interface InsightsOverview {
87
+ subject: InsightsSubject;
88
+ time_zone: string;
89
+ from: string;
90
+ to: string;
91
+ previous_from: string;
92
+ previous_to: string;
93
+ /** The last local day rolled up; null while the first roll-up is queued. */
94
+ counted_through_day: string | null;
95
+ refreshed_at: string | null;
96
+ /** The first day the retention policy keeps; null = no limit. */
97
+ kept_from_day: string | null;
98
+ minimum_audience: number;
99
+ totals: InsightsMetricTotal[];
100
+ }
101
+ export interface InsightsSeriesPoint extends InsightsFigure {
102
+ /** `YYYY-MM-DD`, every day of the range present. */
103
+ day: string;
104
+ }
105
+ export interface InsightsSeries {
106
+ subject: InsightsSubject;
107
+ time_zone: string;
108
+ from: string;
109
+ to: string;
110
+ minimum_audience: number;
111
+ series: Array<{
112
+ metric_key: string;
113
+ currency_code: string | null;
114
+ points: InsightsSeriesPoint[];
115
+ }>;
116
+ }
117
+ export interface InsightsContentItem {
118
+ id: string;
119
+ source_key: string;
120
+ /** `publications.item`, `listings.listing`, … */
121
+ content_type: string;
122
+ content_id: string;
123
+ published_at: string | null;
124
+ /** The subject's own words (a title, a post's opening), at most 160 characters. */
125
+ excerpt: string | null;
126
+ /** App-relative path to open the item (`/publications/{id}`, `/market/listings/{id}`). */
127
+ deep_link_path: string | null;
128
+ /** Declared metric keys → whole counts. */
129
+ metrics: Record<string, number>;
130
+ refreshed_at: string;
131
+ }
132
+ export interface InsightsSettings {
133
+ subject: InsightsSubject;
134
+ time_zone: string;
135
+ retention: 'days_90' | 'days_365' | 'days_730' | 'unlimited';
136
+ kept_from_day: string | null;
137
+ minimum_audience: 'none' | 'five' | 'ten';
138
+ minimum_audience_threshold: number;
139
+ counted_through_day: string | null;
140
+ export_allowed: boolean;
141
+ }
142
+ export interface InsightsRange {
143
+ /** `YYYY-MM-DD`, local days; both optional (default: the last 28 days through today). */
144
+ from?: string;
145
+ to?: string;
146
+ /** Used only when the subject enrols (its first read). */
147
+ time_zone?: string;
148
+ }
149
+ export type ProfileEngagementKind = 'profile_view' | 'contact_action' | 'link_open';
150
+ export declare function createInsightsNamespace(http: Http): {
151
+ /** GET /metrics — every declared metric with its bilingual label. */
152
+ metrics: (options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<InsightsMetric[]>>;
153
+ /** GET /overview — totals for the range and the equally long period before it. */
154
+ overview: (range?: InsightsRange, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<InsightsOverview>>;
155
+ /** GET /daily — one series per metric (≤ 30 keys; omitted = all), every day present. */
156
+ daily: (range?: InsightsRange & {
157
+ metrics?: string[];
158
+ }, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<InsightsSeries>>;
159
+ /** GET /breakdown — one declared split of a metric over the range, suppressed where it counts people. */
160
+ breakdown: (metricKey: string, dimension: string, range?: InsightsRange, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<InsightsBreakdown>>;
161
+ /** GET /content — items ranked by a metric key (highest first) or `published_at` (newest). */
162
+ content: (query?: {
163
+ sort?: string;
164
+ cursor?: string | null;
165
+ limit?: number;
166
+ }, options?: PersonDomainCallOptions) => Promise<PersonDomainCursorPage<InsightsContentItem>>;
167
+ /** GET /settings — time zone, resolved retention and minimum audience, export allowed. */
168
+ settings: (options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<InsightsSettings>>;
169
+ /** PUT /settings — change the time zone; every day is re-cut (re-rolled) in it. Idempotent. */
170
+ changeTimeZone: (timeZone: string, options?: PersonDomainCallOptions) => Promise<PersonDomainEnvelope<InsightsSettings>>;
171
+ /** The CSV export's path with its query (fetch it with auth and `X-Acting-As`; needs `insights.export`). */
172
+ exportPath: (range?: InsightsRange) => string;
173
+ /** POST /api/person/actors/{id}/engagement — count a profile view, contact tap or link open. */
174
+ recordProfileEngagement: (actorId: string, kind: ProfileEngagementKind, actionKey?: string, options?: PersonDomainCallOptions) => Promise<void>;
175
+ };
176
+ export type InsightsNamespace = ReturnType<typeof createInsightsNamespace>;
@@ -0,0 +1,52 @@
1
+ import { personDomainRequest, } from './actors.js';
2
+ const BASE = '/api/person/insights';
3
+ function rangeParams(range = {}) {
4
+ const params = {};
5
+ if (range.from)
6
+ params.from = range.from;
7
+ if (range.to)
8
+ params.to = range.to;
9
+ if (range.time_zone)
10
+ params.time_zone = range.time_zone;
11
+ return params;
12
+ }
13
+ export function createInsightsNamespace(http) {
14
+ return {
15
+
16
+ metrics: (options) => http.get(`${BASE}/metrics`, personDomainRequest(options)),
17
+
18
+ overview: (range, options) => http.get(`${BASE}/overview`, personDomainRequest(options, false, rangeParams(range))),
19
+
20
+ daily: (range, options) => {
21
+ const params = rangeParams(range);
22
+
23
+ if (range?.metrics?.length)
24
+ params.metrics = range.metrics;
25
+ return http.get(`${BASE}/daily`, personDomainRequest(options, false, params));
26
+ },
27
+
28
+ breakdown: (metricKey, dimension, range, options) => http.get(`${BASE}/breakdown`, personDomainRequest(options, false, { metric_key: metricKey, dimension, ...rangeParams(range) })),
29
+
30
+ content: (query = {}, options) => {
31
+ const params = {};
32
+ if (query.sort)
33
+ params.sort = query.sort;
34
+ if (query.cursor)
35
+ params.cursor = query.cursor;
36
+ if (query.limit)
37
+ params.limit = String(query.limit);
38
+ return http.get(`${BASE}/content`, personDomainRequest(options, false, params));
39
+ },
40
+
41
+ settings: (options) => http.get(`${BASE}/settings`, personDomainRequest(options)),
42
+
43
+ changeTimeZone: (timeZone, options) => http.put(`${BASE}/settings`, { time_zone: timeZone }, personDomainRequest(options, true)),
44
+
45
+ exportPath: (range) => {
46
+ const query = new URLSearchParams(rangeParams(range)).toString();
47
+ return `${BASE}/export${query ? `?${query}` : ''}`;
48
+ },
49
+
50
+ recordProfileEngagement: (actorId, kind, actionKey, options) => http.post(`/api/person/actors/${encodeURIComponent(actorId)}/engagement`, kind === 'profile_view' ? { kind } : { kind, action_key: actionKey }, personDomainRequest(options, true)),
51
+ };
52
+ }