@fluid-app/portal-sdk 0.1.115 → 0.1.117

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.
@@ -4091,54 +4091,126 @@ async function updateUserTask(client, id, body) {
4091
4091
  return client.patch(`/api/users/v2025-06/tasks/${id}`, body);
4092
4092
  }
4093
4093
  //#endregion
4094
+ //#region ../../contacts/api-client/src/adapter.ts
4095
+ /**
4096
+ * Creates a ContactsApi adapter backed by the user-contacts generated client.
4097
+ *
4098
+ * Bridges the auto-generated namespace functions to the abstract ContactsApi
4099
+ * port, closing over the FetchClient so consumers don't pass it per-call.
4100
+ *
4101
+ * Read methods map responses through `satisfies` for compile-time drift
4102
+ * detection. Mutation methods use input-side assertions where the port
4103
+ * intentionally uses loose types (Record<string, unknown>) that don't match
4104
+ * the generated client's strict body schemas.
4105
+ */
4106
+ function createContactsApiAdapter(client) {
4107
+ return {
4108
+ getContact: async (id) => {
4109
+ return { contact: (await getUserContact(client, id)).contact ?? {} };
4110
+ },
4111
+ listContacts: async (params) => {
4112
+ const response = await listUserContacts(client, params);
4113
+ return {
4114
+ contacts: response.contacts ?? [],
4115
+ meta: response.meta ?? {}
4116
+ };
4117
+ },
4118
+ createContact: (data) => createUserContact(client, { contact: data }),
4119
+ updateContact: (id, data) => updateUserContact(client, id, {
4120
+ id: Number(id),
4121
+ contact: data
4122
+ }),
4123
+ deleteContact: (id) => deleteUserContact(client, id),
4124
+ bulkDeleteContacts: (ids) => bulkDeleteUserContacts(client, { contact_ids: ids }),
4125
+ listActivities: async (contactId) => {
4126
+ const response = await listUserContactActivities(client, contactId);
4127
+ return {
4128
+ activities: response.activities ?? [],
4129
+ meta: response.meta ?? {}
4130
+ };
4131
+ },
4132
+ markRead: (contactId) => markUserContactRead(client, contactId),
4133
+ listOrders: async (contactId, params) => {
4134
+ const response = await listUserContactOrders(client, contactId, params);
4135
+ return {
4136
+ orders: response.orders ?? [],
4137
+ meta: response.meta ?? {}
4138
+ };
4139
+ },
4140
+ listSubscriptionOrders: async (contactId, params) => {
4141
+ const response = await listUserContactSubscriptionOrders(client, contactId, params);
4142
+ return {
4143
+ subscription_orders: response.subscription_orders ?? [],
4144
+ meta: response.meta ?? {}
4145
+ };
4146
+ }
4147
+ };
4148
+ }
4149
+ /**
4150
+ * Creates a NotesApi adapter backed by the user-contacts and user-notes
4151
+ * generated clients.
4152
+ *
4153
+ * List and create use the contact sub-resource endpoints (usersContacts),
4154
+ * while update and delete use the standalone notes endpoints (usersNotes).
4155
+ */
4156
+ function createNotesApiAdapter(client) {
4157
+ return {
4158
+ listNotes: async (contactId) => {
4159
+ return { notes: (await listUserContactNotes(client, contactId)).notes ?? [] };
4160
+ },
4161
+ createNote: (contactId, input) => createUserContactNote(client, contactId, {
4162
+ id: Number(contactId),
4163
+ note: input
4164
+ }),
4165
+ updateNote: (noteId, contactId, input) => updateUserNote(client, noteId, {
4166
+ contact_id: Number(contactId),
4167
+ id: noteId,
4168
+ note: input
4169
+ }),
4170
+ deleteNote: (noteId, contactId) => deleteUserNote(client, noteId, { contact_id: Number(contactId) })
4171
+ };
4172
+ }
4173
+ /**
4174
+ * Creates a TasksApi adapter backed by the user-contacts and user-tasks
4175
+ * generated clients.
4176
+ *
4177
+ * List and create use the contact sub-resource endpoints (usersContacts),
4178
+ * while update and delete use the standalone tasks endpoints (usersTasks).
4179
+ */
4180
+ function createTasksApiAdapter(client) {
4181
+ return {
4182
+ listTasks: async (contactId) => {
4183
+ return { tasks: (await listUserContactTasks(client, contactId)).tasks ?? [] };
4184
+ },
4185
+ createTask: (contactId, input) => createUserContactTask(client, contactId, {
4186
+ id: Number(contactId),
4187
+ task: input
4188
+ }),
4189
+ updateTask: (taskId, input) => updateUserTask(client, taskId, {
4190
+ id: taskId,
4191
+ task: input
4192
+ }),
4193
+ deleteTask: (taskId) => deleteUserTask(client, taskId)
4194
+ };
4195
+ }
4196
+ /**
4197
+ * Creates a composite ContactsDomainApi adapter that bundles contacts,
4198
+ * notes, and tasks adapters into a single object suitable for the
4199
+ * ContactsApiProvider context.
4200
+ */
4201
+ function createContactsDomainApiAdapter(client) {
4202
+ return {
4203
+ contacts: createContactsApiAdapter(client),
4204
+ notes: createNotesApiAdapter(client),
4205
+ tasks: createTasksApiAdapter(client)
4206
+ };
4207
+ }
4208
+ //#endregion
4094
4209
  //#region src/contacts/PortalContactsApiProvider.tsx
4095
4210
  function PortalContactsApiProvider({ children }) {
4096
4211
  const { client } = useContactsConfig();
4097
4212
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContactsApiProvider, {
4098
- value: (0, react.useMemo)(() => {
4099
- return {
4100
- contacts: {
4101
- getContact: (id) => getUserContact(client, id),
4102
- listContacts: (params) => listUserContacts(client, params),
4103
- createContact: (data) => createUserContact(client, { contact: data }),
4104
- updateContact: (id, data) => updateUserContact(client, id, {
4105
- id: Number(id),
4106
- contact: data
4107
- }),
4108
- deleteContact: (id) => deleteUserContact(client, id),
4109
- bulkDeleteContacts: (ids) => bulkDeleteUserContacts(client, { contact_ids: ids }),
4110
- listActivities: (contactId) => listUserContactActivities(client, contactId),
4111
- markRead: (contactId) => markUserContactRead(client, contactId),
4112
- listOrders: (contactId, params) => listUserContactOrders(client, contactId, params),
4113
- listSubscriptionOrders: (contactId, params) => listUserContactSubscriptionOrders(client, contactId, params)
4114
- },
4115
- notes: {
4116
- listNotes: (contactId) => listUserContactNotes(client, contactId),
4117
- createNote: (contactId, input) => createUserContactNote(client, contactId, {
4118
- id: Number(contactId),
4119
- note: input
4120
- }),
4121
- updateNote: (noteId, contactId, input) => updateUserNote(client, noteId, {
4122
- contact_id: Number(contactId),
4123
- id: noteId,
4124
- note: input
4125
- }),
4126
- deleteNote: (noteId, contactId) => deleteUserNote(client, noteId, { contact_id: Number(contactId) })
4127
- },
4128
- tasks: {
4129
- listTasks: (contactId) => listUserContactTasks(client, contactId),
4130
- createTask: (contactId, input) => createUserContactTask(client, contactId, {
4131
- id: Number(contactId),
4132
- task: input
4133
- }),
4134
- updateTask: (taskId, input) => updateUserTask(client, taskId, {
4135
- id: taskId,
4136
- task: input
4137
- }),
4138
- deleteTask: (taskId) => deleteUserTask(client, taskId)
4139
- }
4140
- };
4141
- }, [client]),
4213
+ value: (0, react.useMemo)(() => createContactsDomainApiAdapter(client), [client]),
4142
4214
  children
4143
4215
  });
4144
4216
  }
@@ -4343,4 +4415,4 @@ Object.defineProperty(exports, "contactsScreenPropertySchema", {
4343
4415
  }
4344
4416
  });
4345
4417
 
4346
- //# sourceMappingURL=ContactsScreen-CjMFgsml.cjs.map
4418
+ //# sourceMappingURL=ContactsScreen-D0LZl9eo.cjs.map