@greensecurity/javascript-sdk 0.43.1-beta.72 → 0.43.1-beta.76

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 (209) hide show
  1. package/README.md +6 -0
  2. package/dist/commonjs/__tests__/paymentprofile.test.d.ts +2 -0
  3. package/dist/commonjs/__tests__/paymentprofile.test.d.ts.map +1 -0
  4. package/dist/commonjs/__tests__/paymentprofile.test.js +25 -0
  5. package/dist/commonjs/__tests__/paymentprofile.test.js.map +1 -0
  6. package/dist/commonjs/__tests__/webhooks.test.js +1 -1
  7. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  8. package/dist/commonjs/__tests__/zones.test.js +1 -1
  9. package/dist/commonjs/funcs/invoicesListInvoices.d.ts +2 -0
  10. package/dist/commonjs/funcs/invoicesListInvoices.d.ts.map +1 -1
  11. package/dist/commonjs/funcs/invoicesListInvoices.js +2 -0
  12. package/dist/commonjs/funcs/invoicesListInvoices.js.map +1 -1
  13. package/dist/commonjs/funcs/paymentProfileGetPaymentProfile.d.ts +21 -0
  14. package/dist/commonjs/funcs/paymentProfileGetPaymentProfile.d.ts.map +1 -0
  15. package/dist/commonjs/funcs/paymentProfileGetPaymentProfile.js +110 -0
  16. package/dist/commonjs/funcs/paymentProfileGetPaymentProfile.js.map +1 -0
  17. package/dist/commonjs/funcs/vendorsGetVendorInvoiceDetails.d.ts +1 -0
  18. package/dist/commonjs/funcs/vendorsGetVendorInvoiceDetails.d.ts.map +1 -1
  19. package/dist/commonjs/funcs/vendorsGetVendorInvoiceDetails.js +1 -0
  20. package/dist/commonjs/funcs/vendorsGetVendorInvoiceDetails.js.map +1 -1
  21. package/dist/commonjs/funcs/vendorsListVendorInvoices.d.ts +1 -0
  22. package/dist/commonjs/funcs/vendorsListVendorInvoices.d.ts.map +1 -1
  23. package/dist/commonjs/funcs/vendorsListVendorInvoices.js +1 -0
  24. package/dist/commonjs/funcs/vendorsListVendorInvoices.js.map +1 -1
  25. package/dist/commonjs/lib/config.d.ts +2 -2
  26. package/dist/commonjs/lib/config.js +2 -2
  27. package/dist/commonjs/models/components/expand.d.ts +2 -0
  28. package/dist/commonjs/models/components/expand.d.ts.map +1 -1
  29. package/dist/commonjs/models/components/expand.js +2 -0
  30. package/dist/commonjs/models/components/expand.js.map +1 -1
  31. package/dist/commonjs/models/components/feed.d.ts +6 -0
  32. package/dist/commonjs/models/components/feed.d.ts.map +1 -1
  33. package/dist/commonjs/models/components/feed.js.map +1 -1
  34. package/dist/commonjs/models/components/index.d.ts +1 -0
  35. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  36. package/dist/commonjs/models/components/index.js +1 -0
  37. package/dist/commonjs/models/components/index.js.map +1 -1
  38. package/dist/commonjs/models/components/invoice.d.ts +55 -0
  39. package/dist/commonjs/models/components/invoice.d.ts.map +1 -1
  40. package/dist/commonjs/models/components/invoice.js +32 -1
  41. package/dist/commonjs/models/components/invoice.js.map +1 -1
  42. package/dist/commonjs/models/components/paymentprofileinfo.d.ts +46 -0
  43. package/dist/commonjs/models/components/paymentprofileinfo.d.ts.map +1 -0
  44. package/dist/commonjs/models/components/paymentprofileinfo.js +113 -0
  45. package/dist/commonjs/models/components/paymentprofileinfo.js.map +1 -0
  46. package/dist/commonjs/models/components/pendinginvitation.d.ts +6 -0
  47. package/dist/commonjs/models/components/pendinginvitation.d.ts.map +1 -1
  48. package/dist/commonjs/models/components/pendinginvitation.js.map +1 -1
  49. package/dist/commonjs/models/components/standingappointment.d.ts +6 -0
  50. package/dist/commonjs/models/components/standingappointment.d.ts.map +1 -1
  51. package/dist/commonjs/models/components/standingappointment.js.map +1 -1
  52. package/dist/commonjs/react-query/index.d.ts +1 -0
  53. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  54. package/dist/commonjs/react-query/index.js +1 -0
  55. package/dist/commonjs/react-query/index.js.map +1 -1
  56. package/dist/commonjs/react-query/invoicesListInvoices.d.ts +8 -0
  57. package/dist/commonjs/react-query/invoicesListInvoices.d.ts.map +1 -1
  58. package/dist/commonjs/react-query/invoicesListInvoices.js +8 -0
  59. package/dist/commonjs/react-query/invoicesListInvoices.js.map +1 -1
  60. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.core.d.ts +12 -0
  61. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.core.d.ts.map +1 -0
  62. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.core.js +38 -0
  63. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.core.js.map +1 -0
  64. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.d.ts +27 -0
  65. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.d.ts.map +1 -0
  66. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.js +63 -0
  67. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.js.map +1 -0
  68. package/dist/commonjs/react-query/vendorsGetVendorInvoiceDetails.d.ts +2 -0
  69. package/dist/commonjs/react-query/vendorsGetVendorInvoiceDetails.d.ts.map +1 -1
  70. package/dist/commonjs/react-query/vendorsGetVendorInvoiceDetails.js +2 -0
  71. package/dist/commonjs/react-query/vendorsGetVendorInvoiceDetails.js.map +1 -1
  72. package/dist/commonjs/react-query/vendorsListVendorInvoices.d.ts +4 -0
  73. package/dist/commonjs/react-query/vendorsListVendorInvoices.d.ts.map +1 -1
  74. package/dist/commonjs/react-query/vendorsListVendorInvoices.js +4 -0
  75. package/dist/commonjs/react-query/vendorsListVendorInvoices.js.map +1 -1
  76. package/dist/commonjs/sdk/invoices.d.ts +2 -0
  77. package/dist/commonjs/sdk/invoices.d.ts.map +1 -1
  78. package/dist/commonjs/sdk/invoices.js +2 -0
  79. package/dist/commonjs/sdk/invoices.js.map +1 -1
  80. package/dist/commonjs/sdk/paymentprofile.d.ts +15 -0
  81. package/dist/commonjs/sdk/paymentprofile.d.ts.map +1 -0
  82. package/dist/commonjs/sdk/paymentprofile.js +25 -0
  83. package/dist/commonjs/sdk/paymentprofile.js.map +1 -0
  84. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  85. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  86. package/dist/commonjs/sdk/sdk.js +4 -0
  87. package/dist/commonjs/sdk/sdk.js.map +1 -1
  88. package/dist/commonjs/sdk/vendors.d.ts +2 -0
  89. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  90. package/dist/commonjs/sdk/vendors.js +2 -0
  91. package/dist/commonjs/sdk/vendors.js.map +1 -1
  92. package/dist/esm/__tests__/paymentprofile.test.d.ts +2 -0
  93. package/dist/esm/__tests__/paymentprofile.test.d.ts.map +1 -0
  94. package/dist/esm/__tests__/paymentprofile.test.js +23 -0
  95. package/dist/esm/__tests__/paymentprofile.test.js.map +1 -0
  96. package/dist/esm/__tests__/webhooks.test.js +1 -1
  97. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  98. package/dist/esm/__tests__/zones.test.js +1 -1
  99. package/dist/esm/funcs/invoicesListInvoices.d.ts +2 -0
  100. package/dist/esm/funcs/invoicesListInvoices.d.ts.map +1 -1
  101. package/dist/esm/funcs/invoicesListInvoices.js +2 -0
  102. package/dist/esm/funcs/invoicesListInvoices.js.map +1 -1
  103. package/dist/esm/funcs/paymentProfileGetPaymentProfile.d.ts +21 -0
  104. package/dist/esm/funcs/paymentProfileGetPaymentProfile.d.ts.map +1 -0
  105. package/dist/esm/funcs/paymentProfileGetPaymentProfile.js +74 -0
  106. package/dist/esm/funcs/paymentProfileGetPaymentProfile.js.map +1 -0
  107. package/dist/esm/funcs/vendorsGetVendorInvoiceDetails.d.ts +1 -0
  108. package/dist/esm/funcs/vendorsGetVendorInvoiceDetails.d.ts.map +1 -1
  109. package/dist/esm/funcs/vendorsGetVendorInvoiceDetails.js +1 -0
  110. package/dist/esm/funcs/vendorsGetVendorInvoiceDetails.js.map +1 -1
  111. package/dist/esm/funcs/vendorsListVendorInvoices.d.ts +1 -0
  112. package/dist/esm/funcs/vendorsListVendorInvoices.d.ts.map +1 -1
  113. package/dist/esm/funcs/vendorsListVendorInvoices.js +1 -0
  114. package/dist/esm/funcs/vendorsListVendorInvoices.js.map +1 -1
  115. package/dist/esm/lib/config.d.ts +2 -2
  116. package/dist/esm/lib/config.js +2 -2
  117. package/dist/esm/models/components/expand.d.ts +2 -0
  118. package/dist/esm/models/components/expand.d.ts.map +1 -1
  119. package/dist/esm/models/components/expand.js +2 -0
  120. package/dist/esm/models/components/expand.js.map +1 -1
  121. package/dist/esm/models/components/feed.d.ts +6 -0
  122. package/dist/esm/models/components/feed.d.ts.map +1 -1
  123. package/dist/esm/models/components/feed.js.map +1 -1
  124. package/dist/esm/models/components/index.d.ts +1 -0
  125. package/dist/esm/models/components/index.d.ts.map +1 -1
  126. package/dist/esm/models/components/index.js +1 -0
  127. package/dist/esm/models/components/index.js.map +1 -1
  128. package/dist/esm/models/components/invoice.d.ts +55 -0
  129. package/dist/esm/models/components/invoice.d.ts.map +1 -1
  130. package/dist/esm/models/components/invoice.js +29 -0
  131. package/dist/esm/models/components/invoice.js.map +1 -1
  132. package/dist/esm/models/components/paymentprofileinfo.d.ts +46 -0
  133. package/dist/esm/models/components/paymentprofileinfo.d.ts.map +1 -0
  134. package/dist/esm/models/components/paymentprofileinfo.js +72 -0
  135. package/dist/esm/models/components/paymentprofileinfo.js.map +1 -0
  136. package/dist/esm/models/components/pendinginvitation.d.ts +6 -0
  137. package/dist/esm/models/components/pendinginvitation.d.ts.map +1 -1
  138. package/dist/esm/models/components/pendinginvitation.js.map +1 -1
  139. package/dist/esm/models/components/standingappointment.d.ts +6 -0
  140. package/dist/esm/models/components/standingappointment.d.ts.map +1 -1
  141. package/dist/esm/models/components/standingappointment.js.map +1 -1
  142. package/dist/esm/react-query/index.d.ts +1 -0
  143. package/dist/esm/react-query/index.d.ts.map +1 -1
  144. package/dist/esm/react-query/index.js +1 -0
  145. package/dist/esm/react-query/index.js.map +1 -1
  146. package/dist/esm/react-query/invoicesListInvoices.d.ts +8 -0
  147. package/dist/esm/react-query/invoicesListInvoices.d.ts.map +1 -1
  148. package/dist/esm/react-query/invoicesListInvoices.js +8 -0
  149. package/dist/esm/react-query/invoicesListInvoices.js.map +1 -1
  150. package/dist/esm/react-query/paymentProfileGetPaymentProfile.core.d.ts +12 -0
  151. package/dist/esm/react-query/paymentProfileGetPaymentProfile.core.d.ts.map +1 -0
  152. package/dist/esm/react-query/paymentProfileGetPaymentProfile.core.js +33 -0
  153. package/dist/esm/react-query/paymentProfileGetPaymentProfile.core.js.map +1 -0
  154. package/dist/esm/react-query/paymentProfileGetPaymentProfile.d.ts +27 -0
  155. package/dist/esm/react-query/paymentProfileGetPaymentProfile.d.ts.map +1 -0
  156. package/dist/esm/react-query/paymentProfileGetPaymentProfile.js +54 -0
  157. package/dist/esm/react-query/paymentProfileGetPaymentProfile.js.map +1 -0
  158. package/dist/esm/react-query/vendorsGetVendorInvoiceDetails.d.ts +2 -0
  159. package/dist/esm/react-query/vendorsGetVendorInvoiceDetails.d.ts.map +1 -1
  160. package/dist/esm/react-query/vendorsGetVendorInvoiceDetails.js +2 -0
  161. package/dist/esm/react-query/vendorsGetVendorInvoiceDetails.js.map +1 -1
  162. package/dist/esm/react-query/vendorsListVendorInvoices.d.ts +4 -0
  163. package/dist/esm/react-query/vendorsListVendorInvoices.d.ts.map +1 -1
  164. package/dist/esm/react-query/vendorsListVendorInvoices.js +4 -0
  165. package/dist/esm/react-query/vendorsListVendorInvoices.js.map +1 -1
  166. package/dist/esm/sdk/invoices.d.ts +2 -0
  167. package/dist/esm/sdk/invoices.d.ts.map +1 -1
  168. package/dist/esm/sdk/invoices.js +2 -0
  169. package/dist/esm/sdk/invoices.js.map +1 -1
  170. package/dist/esm/sdk/paymentprofile.d.ts +15 -0
  171. package/dist/esm/sdk/paymentprofile.d.ts.map +1 -0
  172. package/dist/esm/sdk/paymentprofile.js +21 -0
  173. package/dist/esm/sdk/paymentprofile.js.map +1 -0
  174. package/dist/esm/sdk/sdk.d.ts +3 -0
  175. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  176. package/dist/esm/sdk/sdk.js +4 -0
  177. package/dist/esm/sdk/sdk.js.map +1 -1
  178. package/dist/esm/sdk/vendors.d.ts +2 -0
  179. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  180. package/dist/esm/sdk/vendors.js +2 -0
  181. package/dist/esm/sdk/vendors.js.map +1 -1
  182. package/examples/package-lock.json +1 -1
  183. package/jsr.json +1 -1
  184. package/package.json +1 -1
  185. package/src/__tests__/paymentprofile.test.ts +26 -0
  186. package/src/__tests__/webhooks.test.ts +1 -1
  187. package/src/__tests__/zones.test.ts +1 -1
  188. package/src/funcs/invoicesListInvoices.ts +2 -0
  189. package/src/funcs/paymentProfileGetPaymentProfile.ts +153 -0
  190. package/src/funcs/vendorsGetVendorInvoiceDetails.ts +1 -0
  191. package/src/funcs/vendorsListVendorInvoices.ts +1 -0
  192. package/src/lib/config.ts +2 -2
  193. package/src/models/components/expand.ts +2 -0
  194. package/src/models/components/feed.ts +6 -0
  195. package/src/models/components/index.ts +1 -0
  196. package/src/models/components/invoice.ts +104 -0
  197. package/src/models/components/paymentprofileinfo.ts +182 -0
  198. package/src/models/components/pendinginvitation.ts +6 -0
  199. package/src/models/components/standingappointment.ts +6 -0
  200. package/src/react-query/index.ts +1 -0
  201. package/src/react-query/invoicesListInvoices.ts +8 -0
  202. package/src/react-query/paymentProfileGetPaymentProfile.core.ts +71 -0
  203. package/src/react-query/paymentProfileGetPaymentProfile.ts +96 -0
  204. package/src/react-query/vendorsGetVendorInvoiceDetails.ts +2 -0
  205. package/src/react-query/vendorsListVendorInvoices.ts +4 -0
  206. package/src/sdk/invoices.ts +2 -0
  207. package/src/sdk/paymentprofile.ts +28 -0
  208. package/src/sdk/sdk.ts +6 -0
  209. package/src/sdk/vendors.ts +2 -0
@@ -16,7 +16,13 @@ import { Invitee, Invitee$inboundSchema } from "./invitee.js";
16
16
  export type Feed = {
17
17
  id?: number | undefined;
18
18
  title?: string | null | undefined;
19
+ /**
20
+ * Start date and time in UTC (ISO 8601 format, e.g. 2026-02-23T14:00:00Z). Null if not set.
21
+ */
19
22
  start?: string | null | undefined;
23
+ /**
24
+ * End date and time in UTC (ISO 8601 format, e.g. 2026-02-23T15:00:00Z). Null if not set.
25
+ */
20
26
  end?: string | null | undefined;
21
27
  status?: string | null | undefined;
22
28
  allDay?: boolean | undefined;
@@ -43,6 +43,7 @@ export * from "./mfarequiredresponse.js";
43
43
  export * from "./pager.js";
44
44
  export * from "./passwordrequiredresponse.js";
45
45
  export * from "./paymentprofile.js";
46
+ export * from "./paymentprofileinfo.js";
46
47
  export * from "./pendinginvitation.js";
47
48
  export * from "./product.js";
48
49
  export * from "./productvariant.js";
@@ -16,6 +16,19 @@ import {
16
16
  InvoiceTransaction$inboundSchema,
17
17
  } from "./invoicetransaction.js";
18
18
 
19
+ /**
20
+ * Custom fields assigned by the company to this vendor.
21
+ */
22
+ export type CustomFields = {
23
+ name?: string | null | undefined;
24
+ fieldType?: string | null | undefined;
25
+ /**
26
+ * Value of the custom field
27
+ */
28
+ value?: string | null | undefined;
29
+ vendorFieldId?: number | null | undefined;
30
+ };
31
+
19
32
  /**
20
33
  * The type of invoice based on its line items. Used to categorize invoices for display and filtering purposes.
21
34
  *
@@ -42,6 +55,28 @@ export const InvoiceType = {
42
55
  */
43
56
  export type InvoiceType = OpenEnum<typeof InvoiceType>;
44
57
 
58
+ /**
59
+ * User IDs and company IDs that can pay this invoice. Only included when `invoice.may_pay_invoice` is requested in the expand parameter.
60
+ *
61
+ * @remarks
62
+ *
63
+ * This is used exclusively to control the visibility of the "Make Payment" button in the UI.
64
+ * It is not used for any other invoice logic or backend decision-making.
65
+ *
66
+ * Frontend should compare the logged-in user's ID (for vendors) or company_id (for company managers)
67
+ * with these arrays to determine if the payment button should be shown.
68
+ */
69
+ export type MayPayInvoice = {
70
+ /**
71
+ * Array of user IDs (vendor user IDs) that can pay this invoice
72
+ */
73
+ users?: Array<number> | undefined;
74
+ /**
75
+ * Array of company IDs (company manager company IDs) that can pay this invoice
76
+ */
77
+ companies?: Array<number> | undefined;
78
+ };
79
+
45
80
  /**
46
81
  * A simplified representation of an Invoice
47
82
  */
@@ -58,6 +93,10 @@ export type Invoice = {
58
93
  tax?: number | null | undefined;
59
94
  convenienceFee?: number | null | undefined;
60
95
  shipping?: number | null | undefined;
96
+ /**
97
+ * Custom fields assigned by the company to this vendor.
98
+ */
99
+ customFields?: CustomFields | null | undefined;
61
100
  lines?: Array<InvoiceItem | null> | null | undefined;
62
101
  transactions?: Array<InvoiceTransaction> | null | undefined;
63
102
  representative?: string | null | undefined;
@@ -71,8 +110,47 @@ export type Invoice = {
71
110
  * - "Other": Invoice does not match any of the above categories
72
111
  */
73
112
  invoiceType?: InvoiceType | undefined;
113
+ /**
114
+ * User IDs and company IDs that can pay this invoice. Only included when `invoice.may_pay_invoice` is requested in the expand parameter.
115
+ *
116
+ * @remarks
117
+ *
118
+ * This is used exclusively to control the visibility of the "Make Payment" button in the UI.
119
+ * It is not used for any other invoice logic or backend decision-making.
120
+ *
121
+ * Frontend should compare the logged-in user's ID (for vendors) or company_id (for company managers)
122
+ * with these arrays to determine if the payment button should be shown.
123
+ */
124
+ mayPayInvoice?: MayPayInvoice | null | undefined;
74
125
  };
75
126
 
127
+ /** @internal */
128
+ export const CustomFields$inboundSchema: z.ZodType<
129
+ CustomFields,
130
+ z.ZodTypeDef,
131
+ unknown
132
+ > = z.object({
133
+ name: z.nullable(types.string()).optional(),
134
+ field_type: z.nullable(types.string()).optional(),
135
+ value: z.nullable(types.string()).optional(),
136
+ vendor_field_id: z.nullable(types.number()).optional(),
137
+ }).transform((v) => {
138
+ return remap$(v, {
139
+ "field_type": "fieldType",
140
+ "vendor_field_id": "vendorFieldId",
141
+ });
142
+ });
143
+
144
+ export function customFieldsFromJSON(
145
+ jsonString: string,
146
+ ): SafeParseResult<CustomFields, SDKValidationError> {
147
+ return safeParse(
148
+ jsonString,
149
+ (x) => CustomFields$inboundSchema.parse(JSON.parse(x)),
150
+ `Failed to parse 'CustomFields' from JSON`,
151
+ );
152
+ }
153
+
76
154
  /** @internal */
77
155
  export const InvoiceType$inboundSchema: z.ZodType<
78
156
  InvoiceType,
@@ -80,6 +158,26 @@ export const InvoiceType$inboundSchema: z.ZodType<
80
158
  unknown
81
159
  > = openEnums.inboundSchema(InvoiceType);
82
160
 
161
+ /** @internal */
162
+ export const MayPayInvoice$inboundSchema: z.ZodType<
163
+ MayPayInvoice,
164
+ z.ZodTypeDef,
165
+ unknown
166
+ > = z.object({
167
+ users: types.optional(z.array(types.number())),
168
+ companies: types.optional(z.array(types.number())),
169
+ });
170
+
171
+ export function mayPayInvoiceFromJSON(
172
+ jsonString: string,
173
+ ): SafeParseResult<MayPayInvoice, SDKValidationError> {
174
+ return safeParse(
175
+ jsonString,
176
+ (x) => MayPayInvoice$inboundSchema.parse(JSON.parse(x)),
177
+ `Failed to parse 'MayPayInvoice' from JSON`,
178
+ );
179
+ }
180
+
83
181
  /** @internal */
84
182
  export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
85
183
  z.object({
@@ -95,12 +193,16 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
95
193
  tax: z.nullable(types.number()).optional(),
96
194
  convenience_fee: z.nullable(types.number()).optional(),
97
195
  shipping: z.nullable(types.number()).optional(),
196
+ custom_fields: z.nullable(z.lazy(() => CustomFields$inboundSchema))
197
+ .optional(),
98
198
  lines: z.nullable(z.array(types.nullable(InvoiceItem$inboundSchema)))
99
199
  .optional(),
100
200
  transactions: z.nullable(z.array(InvoiceTransaction$inboundSchema))
101
201
  .optional(),
102
202
  representative: z.nullable(types.string()).optional(),
103
203
  invoice_type: types.optional(InvoiceType$inboundSchema),
204
+ may_pay_invoice: z.nullable(z.lazy(() => MayPayInvoice$inboundSchema))
205
+ .optional(),
104
206
  }).transform((v) => {
105
207
  return remap$(v, {
106
208
  "invoice_number": "invoiceNumber",
@@ -110,7 +212,9 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
110
212
  "financial_status": "financialStatus",
111
213
  "amount_not_paid": "amountNotPaid",
112
214
  "convenience_fee": "convenienceFee",
215
+ "custom_fields": "customFields",
113
216
  "invoice_type": "invoiceType",
217
+ "may_pay_invoice": "mayPayInvoice",
114
218
  });
115
219
  });
116
220
 
@@ -0,0 +1,182 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { smartUnion } from "../../types/smartUnion.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type PaymentProfileInfo22 = {};
14
+
15
+ export type PaymentProfileInfoPaymentProfile2 = number | PaymentProfileInfo22;
16
+
17
+ export type PaymentProfileInfoPaymentProfile1 = {
18
+ id?: number | undefined;
19
+ isValid?: boolean | null | undefined;
20
+ cardType?: string | null | undefined;
21
+ cardLast4?: string | null | undefined;
22
+ isDummy?: boolean | null | undefined;
23
+ profileType?: string | null | undefined;
24
+ };
25
+
26
+ /**
27
+ * Reduced list of attributes of the Payment Profile record
28
+ */
29
+ export type PaymentProfileInfoPaymentProfilePaymentProfile =
30
+ | PaymentProfileInfoPaymentProfile1
31
+ | number
32
+ | PaymentProfileInfo22;
33
+
34
+ /**
35
+ * Payment profile information for the logged-in user. This is account-level data, not invoice-specific.
36
+ */
37
+ export type PaymentProfileInfo = {
38
+ /**
39
+ * Credit balance for the logged in user (vendor or company manager)
40
+ */
41
+ creditBalance: number | null;
42
+ /**
43
+ * Payment profile for the logged in user (vendor or company manager)
44
+ */
45
+ paymentProfile:
46
+ | PaymentProfileInfoPaymentProfile1
47
+ | number
48
+ | PaymentProfileInfo22
49
+ | null;
50
+ };
51
+
52
+ /** @internal */
53
+ export const PaymentProfileInfo22$inboundSchema: z.ZodType<
54
+ PaymentProfileInfo22,
55
+ z.ZodTypeDef,
56
+ unknown
57
+ > = z.object({});
58
+
59
+ export function paymentProfileInfo22FromJSON(
60
+ jsonString: string,
61
+ ): SafeParseResult<PaymentProfileInfo22, SDKValidationError> {
62
+ return safeParse(
63
+ jsonString,
64
+ (x) => PaymentProfileInfo22$inboundSchema.parse(JSON.parse(x)),
65
+ `Failed to parse 'PaymentProfileInfo22' from JSON`,
66
+ );
67
+ }
68
+
69
+ /** @internal */
70
+ export const PaymentProfileInfoPaymentProfile2$inboundSchema: z.ZodType<
71
+ PaymentProfileInfoPaymentProfile2,
72
+ z.ZodTypeDef,
73
+ unknown
74
+ > = smartUnion([
75
+ types.number(),
76
+ z.lazy(() => PaymentProfileInfo22$inboundSchema),
77
+ ]);
78
+
79
+ export function paymentProfileInfoPaymentProfile2FromJSON(
80
+ jsonString: string,
81
+ ): SafeParseResult<PaymentProfileInfoPaymentProfile2, SDKValidationError> {
82
+ return safeParse(
83
+ jsonString,
84
+ (x) => PaymentProfileInfoPaymentProfile2$inboundSchema.parse(JSON.parse(x)),
85
+ `Failed to parse 'PaymentProfileInfoPaymentProfile2' from JSON`,
86
+ );
87
+ }
88
+
89
+ /** @internal */
90
+ export const PaymentProfileInfoPaymentProfile1$inboundSchema: z.ZodType<
91
+ PaymentProfileInfoPaymentProfile1,
92
+ z.ZodTypeDef,
93
+ unknown
94
+ > = z.object({
95
+ id: types.optional(types.number()),
96
+ is_valid: z.nullable(types.boolean()).optional(),
97
+ card_type: z.nullable(types.string()).optional(),
98
+ card_last4: z.nullable(types.string()).optional(),
99
+ is_dummy: z.nullable(types.boolean()).optional(),
100
+ profile_type: z.nullable(types.string()).optional(),
101
+ }).transform((v) => {
102
+ return remap$(v, {
103
+ "is_valid": "isValid",
104
+ "card_type": "cardType",
105
+ "card_last4": "cardLast4",
106
+ "is_dummy": "isDummy",
107
+ "profile_type": "profileType",
108
+ });
109
+ });
110
+
111
+ export function paymentProfileInfoPaymentProfile1FromJSON(
112
+ jsonString: string,
113
+ ): SafeParseResult<PaymentProfileInfoPaymentProfile1, SDKValidationError> {
114
+ return safeParse(
115
+ jsonString,
116
+ (x) => PaymentProfileInfoPaymentProfile1$inboundSchema.parse(JSON.parse(x)),
117
+ `Failed to parse 'PaymentProfileInfoPaymentProfile1' from JSON`,
118
+ );
119
+ }
120
+
121
+ /** @internal */
122
+ export const PaymentProfileInfoPaymentProfilePaymentProfile$inboundSchema:
123
+ z.ZodType<
124
+ PaymentProfileInfoPaymentProfilePaymentProfile,
125
+ z.ZodTypeDef,
126
+ unknown
127
+ > = smartUnion([
128
+ z.lazy(() => PaymentProfileInfoPaymentProfile1$inboundSchema),
129
+ smartUnion([
130
+ types.number(),
131
+ z.lazy(() => PaymentProfileInfo22$inboundSchema),
132
+ ]),
133
+ ]);
134
+
135
+ export function paymentProfileInfoPaymentProfilePaymentProfileFromJSON(
136
+ jsonString: string,
137
+ ): SafeParseResult<
138
+ PaymentProfileInfoPaymentProfilePaymentProfile,
139
+ SDKValidationError
140
+ > {
141
+ return safeParse(
142
+ jsonString,
143
+ (x) =>
144
+ PaymentProfileInfoPaymentProfilePaymentProfile$inboundSchema.parse(
145
+ JSON.parse(x),
146
+ ),
147
+ `Failed to parse 'PaymentProfileInfoPaymentProfilePaymentProfile' from JSON`,
148
+ );
149
+ }
150
+
151
+ /** @internal */
152
+ export const PaymentProfileInfo$inboundSchema: z.ZodType<
153
+ PaymentProfileInfo,
154
+ z.ZodTypeDef,
155
+ unknown
156
+ > = z.object({
157
+ credit_balance: types.nullable(types.number()),
158
+ payment_profile: types.nullable(
159
+ smartUnion([
160
+ z.lazy(() => PaymentProfileInfoPaymentProfile1$inboundSchema),
161
+ smartUnion([
162
+ types.number(),
163
+ z.lazy(() => PaymentProfileInfo22$inboundSchema),
164
+ ]),
165
+ ]),
166
+ ),
167
+ }).transform((v) => {
168
+ return remap$(v, {
169
+ "credit_balance": "creditBalance",
170
+ "payment_profile": "paymentProfile",
171
+ });
172
+ });
173
+
174
+ export function paymentProfileInfoFromJSON(
175
+ jsonString: string,
176
+ ): SafeParseResult<PaymentProfileInfo, SDKValidationError> {
177
+ return safeParse(
178
+ jsonString,
179
+ (x) => PaymentProfileInfo$inboundSchema.parse(JSON.parse(x)),
180
+ `Failed to parse 'PaymentProfileInfo' from JSON`,
181
+ );
182
+ }
@@ -17,7 +17,13 @@ export type Event = {
17
17
  userId?: number | undefined;
18
18
  title?: string | null | undefined;
19
19
  location?: string | null | undefined;
20
+ /**
21
+ * Start date and time in UTC (ISO 8601 format, e.g. 2026-02-23T14:00:00Z).
22
+ */
20
23
  start?: string | undefined;
24
+ /**
25
+ * End date and time in UTC (ISO 8601 format, e.g. 2026-02-23T15:00:00Z).
26
+ */
21
27
  end?: string | undefined;
22
28
  allDay?: boolean | undefined;
23
29
  standingAppt?: boolean | undefined;
@@ -18,7 +18,13 @@ export type StandingAppointment = {
18
18
  title?: string | null | undefined;
19
19
  location?: string | null | undefined;
20
20
  attendees?: Array<string> | undefined;
21
+ /**
22
+ * Start date and time in UTC (ISO 8601 format, e.g. 2026-02-23T14:00:00Z). Null if not set.
23
+ */
21
24
  start?: string | null | undefined;
25
+ /**
26
+ * End date and time in UTC (ISO 8601 format, e.g. 2026-02-23T15:00:00Z). Null if not set.
27
+ */
22
28
  end?: string | null | undefined;
23
29
  status?: string | null | undefined;
24
30
  standingAppt?: boolean | undefined;
@@ -36,6 +36,7 @@ export * from "./organizationsGetFacility.js";
36
36
  export * from "./organizationsListOrSearchDepartmentContacts.js";
37
37
  export * from "./organizationsListOrSearchDepartments.js";
38
38
  export * from "./organizationsListOrSearchFacilities.js";
39
+ export * from "./paymentProfileGetPaymentProfile.js";
39
40
  export * from "./supportArticlesGetSupportArticle.js";
40
41
  export * from "./supportArticlesListOrSearchSupportArticles.js";
41
42
  export * from "./systemsListSystems.js";
@@ -66,7 +66,9 @@ export {
66
66
  * - invoice.line_items
67
67
  * - invoice.invoice_transactions
68
68
  * - invoice.representative
69
+ * - invoice.custom_fields
69
70
  * - invoice.invoice_type
71
+ * - invoice.may_pay_invoice
70
72
  */
71
73
  export function useInvoicesListInvoices(
72
74
  request: operations.ListInvoicesRequest,
@@ -100,7 +102,9 @@ export function useInvoicesListInvoices(
100
102
  * - invoice.line_items
101
103
  * - invoice.invoice_transactions
102
104
  * - invoice.representative
105
+ * - invoice.custom_fields
103
106
  * - invoice.invoice_type
107
+ * - invoice.may_pay_invoice
104
108
  */
105
109
  export function useInvoicesListInvoicesSuspense(
106
110
  request: operations.ListInvoicesRequest,
@@ -134,7 +138,9 @@ export function useInvoicesListInvoicesSuspense(
134
138
  * - invoice.line_items
135
139
  * - invoice.invoice_transactions
136
140
  * - invoice.representative
141
+ * - invoice.custom_fields
137
142
  * - invoice.invoice_type
143
+ * - invoice.may_pay_invoice
138
144
  */
139
145
  export function useInvoicesListInvoicesInfinite(
140
146
  request: operations.ListInvoicesRequest,
@@ -185,7 +191,9 @@ export function useInvoicesListInvoicesInfinite(
185
191
  * - invoice.line_items
186
192
  * - invoice.invoice_transactions
187
193
  * - invoice.representative
194
+ * - invoice.custom_fields
188
195
  * - invoice.invoice_type
196
+ * - invoice.may_pay_invoice
189
197
  */
190
198
  export function useInvoicesListInvoicesInfiniteSuspense(
191
199
  request: operations.ListInvoicesRequest,
@@ -0,0 +1,71 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ QueryClient,
7
+ QueryFunctionContext,
8
+ QueryKey,
9
+ } from "@tanstack/react-query";
10
+ import { GreenSecurityCore } from "../core.js";
11
+ import { paymentProfileGetPaymentProfile } from "../funcs/paymentProfileGetPaymentProfile.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import * as components from "../models/components/index.js";
15
+ import { unwrapAsync } from "../types/fp.js";
16
+ export type PaymentProfileGetPaymentProfileQueryData =
17
+ components.PaymentProfileInfo;
18
+
19
+ export function prefetchPaymentProfileGetPaymentProfile(
20
+ queryClient: QueryClient,
21
+ client$: GreenSecurityCore,
22
+ options?: RequestOptions,
23
+ ): Promise<void> {
24
+ return queryClient.prefetchQuery({
25
+ ...buildPaymentProfileGetPaymentProfileQuery(
26
+ client$,
27
+ options,
28
+ ),
29
+ });
30
+ }
31
+
32
+ export function buildPaymentProfileGetPaymentProfileQuery(
33
+ client$: GreenSecurityCore,
34
+ options?: RequestOptions,
35
+ ): {
36
+ queryKey: QueryKey;
37
+ queryFn: (
38
+ context: QueryFunctionContext,
39
+ ) => Promise<PaymentProfileGetPaymentProfileQueryData>;
40
+ } {
41
+ return {
42
+ queryKey: queryKeyPaymentProfileGetPaymentProfile(),
43
+ queryFn: async function paymentProfileGetPaymentProfileQueryFn(
44
+ ctx,
45
+ ): Promise<PaymentProfileGetPaymentProfileQueryData> {
46
+ const sig = combineSignals(
47
+ ctx.signal,
48
+ options?.signal,
49
+ options?.fetchOptions?.signal,
50
+ );
51
+ const mergedOptions = {
52
+ ...options?.fetchOptions,
53
+ ...options,
54
+ signal: sig,
55
+ };
56
+
57
+ return unwrapAsync(paymentProfileGetPaymentProfile(
58
+ client$,
59
+ mergedOptions,
60
+ ));
61
+ },
62
+ };
63
+ }
64
+
65
+ export function queryKeyPaymentProfileGetPaymentProfile(): QueryKey {
66
+ return [
67
+ "@greensecurity/javascript-sdk",
68
+ "payment-profile",
69
+ "getPaymentProfile",
70
+ ];
71
+ }
@@ -0,0 +1,96 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ InvalidateQueryFilters,
7
+ QueryClient,
8
+ useQuery,
9
+ UseQueryResult,
10
+ useSuspenseQuery,
11
+ UseSuspenseQueryResult,
12
+ } from "@tanstack/react-query";
13
+ import { useGreenSecurityContext } from "./_context.js";
14
+ import { QueryHookOptions, SuspenseQueryHookOptions } from "./_types.js";
15
+ import {
16
+ buildPaymentProfileGetPaymentProfileQuery,
17
+ PaymentProfileGetPaymentProfileQueryData,
18
+ prefetchPaymentProfileGetPaymentProfile,
19
+ queryKeyPaymentProfileGetPaymentProfile,
20
+ } from "./paymentProfileGetPaymentProfile.core.js";
21
+ export {
22
+ buildPaymentProfileGetPaymentProfileQuery,
23
+ type PaymentProfileGetPaymentProfileQueryData,
24
+ prefetchPaymentProfileGetPaymentProfile,
25
+ queryKeyPaymentProfileGetPaymentProfile,
26
+ };
27
+
28
+ /**
29
+ * Get payment profile information
30
+ *
31
+ * @remarks
32
+ * Returns payment profile information for the logged-in user (vendor or company manager).
33
+ * This includes credit_balance and payment_profile which are account-level data, not invoice-specific.
34
+ *
35
+ * Only vendors and company managers can access this endpoint.
36
+ */
37
+ export function usePaymentProfileGetPaymentProfile(
38
+ options?: QueryHookOptions<PaymentProfileGetPaymentProfileQueryData>,
39
+ ): UseQueryResult<PaymentProfileGetPaymentProfileQueryData, Error> {
40
+ const client = useGreenSecurityContext();
41
+ return useQuery({
42
+ ...buildPaymentProfileGetPaymentProfileQuery(
43
+ client,
44
+ options,
45
+ ),
46
+ ...options,
47
+ });
48
+ }
49
+
50
+ /**
51
+ * Get payment profile information
52
+ *
53
+ * @remarks
54
+ * Returns payment profile information for the logged-in user (vendor or company manager).
55
+ * This includes credit_balance and payment_profile which are account-level data, not invoice-specific.
56
+ *
57
+ * Only vendors and company managers can access this endpoint.
58
+ */
59
+ export function usePaymentProfileGetPaymentProfileSuspense(
60
+ options?: SuspenseQueryHookOptions<PaymentProfileGetPaymentProfileQueryData>,
61
+ ): UseSuspenseQueryResult<PaymentProfileGetPaymentProfileQueryData, Error> {
62
+ const client = useGreenSecurityContext();
63
+ return useSuspenseQuery({
64
+ ...buildPaymentProfileGetPaymentProfileQuery(
65
+ client,
66
+ options,
67
+ ),
68
+ ...options,
69
+ });
70
+ }
71
+
72
+ export function setPaymentProfileGetPaymentProfileData(
73
+ client: QueryClient,
74
+ data: PaymentProfileGetPaymentProfileQueryData,
75
+ ): PaymentProfileGetPaymentProfileQueryData | undefined {
76
+ const key = queryKeyPaymentProfileGetPaymentProfile();
77
+
78
+ return client.setQueryData<PaymentProfileGetPaymentProfileQueryData>(
79
+ key,
80
+ data,
81
+ );
82
+ }
83
+
84
+ export function invalidateAllPaymentProfileGetPaymentProfile(
85
+ client: QueryClient,
86
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
87
+ ): Promise<void> {
88
+ return client.invalidateQueries({
89
+ ...filters,
90
+ queryKey: [
91
+ "@greensecurity/javascript-sdk",
92
+ "payment-profile",
93
+ "getPaymentProfile",
94
+ ],
95
+ });
96
+ }
@@ -41,6 +41,7 @@ export {
41
41
  *
42
42
  * invoice.line_items
43
43
  * invoice.invoice_transactions
44
+ * invoice.may_pay_invoice
44
45
  */
45
46
  export function useVendorsGetVendorInvoiceDetails(
46
47
  request: operations.GetVendorInvoiceDetailsRequest,
@@ -67,6 +68,7 @@ export function useVendorsGetVendorInvoiceDetails(
67
68
  *
68
69
  * invoice.line_items
69
70
  * invoice.invoice_transactions
71
+ * invoice.may_pay_invoice
70
72
  */
71
73
  export function useVendorsGetVendorInvoiceDetailsSuspense(
72
74
  request: operations.GetVendorInvoiceDetailsRequest,
@@ -58,6 +58,7 @@ export {
58
58
  * Available `expand` scopes are:
59
59
  *
60
60
  * invoice.line_items
61
+ * invoice.may_pay_invoice
61
62
  */
62
63
  export function useVendorsListVendorInvoices(
63
64
  request: operations.ListVendorInvoicesRequest,
@@ -83,6 +84,7 @@ export function useVendorsListVendorInvoices(
83
84
  * Available `expand` scopes are:
84
85
  *
85
86
  * invoice.line_items
87
+ * invoice.may_pay_invoice
86
88
  */
87
89
  export function useVendorsListVendorInvoicesSuspense(
88
90
  request: operations.ListVendorInvoicesRequest,
@@ -108,6 +110,7 @@ export function useVendorsListVendorInvoicesSuspense(
108
110
  * Available `expand` scopes are:
109
111
  *
110
112
  * invoice.line_items
113
+ * invoice.may_pay_invoice
111
114
  */
112
115
  export function useVendorsListVendorInvoicesInfinite(
113
116
  request: operations.ListVendorInvoicesRequest,
@@ -152,6 +155,7 @@ export function useVendorsListVendorInvoicesInfinite(
152
155
  * Available `expand` scopes are:
153
156
  *
154
157
  * invoice.line_items
158
+ * invoice.may_pay_invoice
155
159
  */
156
160
  export function useVendorsListVendorInvoicesInfiniteSuspense(
157
161
  request: operations.ListVendorInvoicesRequest,
@@ -29,7 +29,9 @@ export class Invoices extends ClientSDK {
29
29
  * - invoice.line_items
30
30
  * - invoice.invoice_transactions
31
31
  * - invoice.representative
32
+ * - invoice.custom_fields
32
33
  * - invoice.invoice_type
34
+ * - invoice.may_pay_invoice
33
35
  */
34
36
  async listInvoices(
35
37
  request: operations.ListInvoicesRequest,