@fluid-app/portal-sdk 0.1.115 → 0.1.116

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