@greensecurity/javascript-sdk 0.43.1-beta.70 → 0.43.1-beta.74

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 (211) 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 +2 -3
  9. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  10. package/dist/commonjs/funcs/invoicesListInvoices.d.ts +2 -0
  11. package/dist/commonjs/funcs/invoicesListInvoices.d.ts.map +1 -1
  12. package/dist/commonjs/funcs/invoicesListInvoices.js +2 -0
  13. package/dist/commonjs/funcs/invoicesListInvoices.js.map +1 -1
  14. package/dist/commonjs/funcs/paymentProfileGetPaymentProfile.d.ts +21 -0
  15. package/dist/commonjs/funcs/paymentProfileGetPaymentProfile.d.ts.map +1 -0
  16. package/dist/commonjs/funcs/paymentProfileGetPaymentProfile.js +110 -0
  17. package/dist/commonjs/funcs/paymentProfileGetPaymentProfile.js.map +1 -0
  18. package/dist/commonjs/funcs/vendorsGetVendorInvoiceDetails.d.ts +1 -0
  19. package/dist/commonjs/funcs/vendorsGetVendorInvoiceDetails.d.ts.map +1 -1
  20. package/dist/commonjs/funcs/vendorsGetVendorInvoiceDetails.js +1 -0
  21. package/dist/commonjs/funcs/vendorsGetVendorInvoiceDetails.js.map +1 -1
  22. package/dist/commonjs/funcs/vendorsListVendorInvoices.d.ts +1 -0
  23. package/dist/commonjs/funcs/vendorsListVendorInvoices.d.ts.map +1 -1
  24. package/dist/commonjs/funcs/vendorsListVendorInvoices.js +1 -0
  25. package/dist/commonjs/funcs/vendorsListVendorInvoices.js.map +1 -1
  26. package/dist/commonjs/lib/config.d.ts +2 -2
  27. package/dist/commonjs/lib/config.js +2 -2
  28. package/dist/commonjs/models/components/expand.d.ts +2 -0
  29. package/dist/commonjs/models/components/expand.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/expand.js +2 -0
  31. package/dist/commonjs/models/components/expand.js.map +1 -1
  32. package/dist/commonjs/models/components/feed.d.ts +6 -0
  33. package/dist/commonjs/models/components/feed.d.ts.map +1 -1
  34. package/dist/commonjs/models/components/feed.js.map +1 -1
  35. package/dist/commonjs/models/components/index.d.ts +1 -0
  36. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  37. package/dist/commonjs/models/components/index.js +1 -0
  38. package/dist/commonjs/models/components/index.js.map +1 -1
  39. package/dist/commonjs/models/components/invoice.d.ts +47 -0
  40. package/dist/commonjs/models/components/invoice.d.ts.map +1 -1
  41. package/dist/commonjs/models/components/invoice.js +22 -1
  42. package/dist/commonjs/models/components/invoice.js.map +1 -1
  43. package/dist/commonjs/models/components/paymentprofileinfo.d.ts +46 -0
  44. package/dist/commonjs/models/components/paymentprofileinfo.d.ts.map +1 -0
  45. package/dist/commonjs/models/components/paymentprofileinfo.js +113 -0
  46. package/dist/commonjs/models/components/paymentprofileinfo.js.map +1 -0
  47. package/dist/commonjs/models/components/pendinginvitation.d.ts +6 -0
  48. package/dist/commonjs/models/components/pendinginvitation.d.ts.map +1 -1
  49. package/dist/commonjs/models/components/pendinginvitation.js.map +1 -1
  50. package/dist/commonjs/models/components/standingappointment.d.ts +6 -0
  51. package/dist/commonjs/models/components/standingappointment.d.ts.map +1 -1
  52. package/dist/commonjs/models/components/standingappointment.js.map +1 -1
  53. package/dist/commonjs/react-query/index.d.ts +1 -0
  54. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  55. package/dist/commonjs/react-query/index.js +1 -0
  56. package/dist/commonjs/react-query/index.js.map +1 -1
  57. package/dist/commonjs/react-query/invoicesListInvoices.d.ts +8 -0
  58. package/dist/commonjs/react-query/invoicesListInvoices.d.ts.map +1 -1
  59. package/dist/commonjs/react-query/invoicesListInvoices.js +8 -0
  60. package/dist/commonjs/react-query/invoicesListInvoices.js.map +1 -1
  61. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.core.d.ts +12 -0
  62. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.core.d.ts.map +1 -0
  63. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.core.js +38 -0
  64. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.core.js.map +1 -0
  65. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.d.ts +27 -0
  66. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.d.ts.map +1 -0
  67. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.js +63 -0
  68. package/dist/commonjs/react-query/paymentProfileGetPaymentProfile.js.map +1 -0
  69. package/dist/commonjs/react-query/vendorsGetVendorInvoiceDetails.d.ts +2 -0
  70. package/dist/commonjs/react-query/vendorsGetVendorInvoiceDetails.d.ts.map +1 -1
  71. package/dist/commonjs/react-query/vendorsGetVendorInvoiceDetails.js +2 -0
  72. package/dist/commonjs/react-query/vendorsGetVendorInvoiceDetails.js.map +1 -1
  73. package/dist/commonjs/react-query/vendorsListVendorInvoices.d.ts +4 -0
  74. package/dist/commonjs/react-query/vendorsListVendorInvoices.d.ts.map +1 -1
  75. package/dist/commonjs/react-query/vendorsListVendorInvoices.js +4 -0
  76. package/dist/commonjs/react-query/vendorsListVendorInvoices.js.map +1 -1
  77. package/dist/commonjs/sdk/invoices.d.ts +2 -0
  78. package/dist/commonjs/sdk/invoices.d.ts.map +1 -1
  79. package/dist/commonjs/sdk/invoices.js +2 -0
  80. package/dist/commonjs/sdk/invoices.js.map +1 -1
  81. package/dist/commonjs/sdk/paymentprofile.d.ts +15 -0
  82. package/dist/commonjs/sdk/paymentprofile.d.ts.map +1 -0
  83. package/dist/commonjs/sdk/paymentprofile.js +25 -0
  84. package/dist/commonjs/sdk/paymentprofile.js.map +1 -0
  85. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  86. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  87. package/dist/commonjs/sdk/sdk.js +4 -0
  88. package/dist/commonjs/sdk/sdk.js.map +1 -1
  89. package/dist/commonjs/sdk/vendors.d.ts +2 -0
  90. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  91. package/dist/commonjs/sdk/vendors.js +2 -0
  92. package/dist/commonjs/sdk/vendors.js.map +1 -1
  93. package/dist/esm/__tests__/paymentprofile.test.d.ts +2 -0
  94. package/dist/esm/__tests__/paymentprofile.test.d.ts.map +1 -0
  95. package/dist/esm/__tests__/paymentprofile.test.js +23 -0
  96. package/dist/esm/__tests__/paymentprofile.test.js.map +1 -0
  97. package/dist/esm/__tests__/webhooks.test.js +1 -1
  98. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  99. package/dist/esm/__tests__/zones.test.js +2 -3
  100. package/dist/esm/__tests__/zones.test.js.map +1 -1
  101. package/dist/esm/funcs/invoicesListInvoices.d.ts +2 -0
  102. package/dist/esm/funcs/invoicesListInvoices.d.ts.map +1 -1
  103. package/dist/esm/funcs/invoicesListInvoices.js +2 -0
  104. package/dist/esm/funcs/invoicesListInvoices.js.map +1 -1
  105. package/dist/esm/funcs/paymentProfileGetPaymentProfile.d.ts +21 -0
  106. package/dist/esm/funcs/paymentProfileGetPaymentProfile.d.ts.map +1 -0
  107. package/dist/esm/funcs/paymentProfileGetPaymentProfile.js +74 -0
  108. package/dist/esm/funcs/paymentProfileGetPaymentProfile.js.map +1 -0
  109. package/dist/esm/funcs/vendorsGetVendorInvoiceDetails.d.ts +1 -0
  110. package/dist/esm/funcs/vendorsGetVendorInvoiceDetails.d.ts.map +1 -1
  111. package/dist/esm/funcs/vendorsGetVendorInvoiceDetails.js +1 -0
  112. package/dist/esm/funcs/vendorsGetVendorInvoiceDetails.js.map +1 -1
  113. package/dist/esm/funcs/vendorsListVendorInvoices.d.ts +1 -0
  114. package/dist/esm/funcs/vendorsListVendorInvoices.d.ts.map +1 -1
  115. package/dist/esm/funcs/vendorsListVendorInvoices.js +1 -0
  116. package/dist/esm/funcs/vendorsListVendorInvoices.js.map +1 -1
  117. package/dist/esm/lib/config.d.ts +2 -2
  118. package/dist/esm/lib/config.js +2 -2
  119. package/dist/esm/models/components/expand.d.ts +2 -0
  120. package/dist/esm/models/components/expand.d.ts.map +1 -1
  121. package/dist/esm/models/components/expand.js +2 -0
  122. package/dist/esm/models/components/expand.js.map +1 -1
  123. package/dist/esm/models/components/feed.d.ts +6 -0
  124. package/dist/esm/models/components/feed.d.ts.map +1 -1
  125. package/dist/esm/models/components/feed.js.map +1 -1
  126. package/dist/esm/models/components/index.d.ts +1 -0
  127. package/dist/esm/models/components/index.d.ts.map +1 -1
  128. package/dist/esm/models/components/index.js +1 -0
  129. package/dist/esm/models/components/index.js.map +1 -1
  130. package/dist/esm/models/components/invoice.d.ts +47 -0
  131. package/dist/esm/models/components/invoice.d.ts.map +1 -1
  132. package/dist/esm/models/components/invoice.js +19 -0
  133. package/dist/esm/models/components/invoice.js.map +1 -1
  134. package/dist/esm/models/components/paymentprofileinfo.d.ts +46 -0
  135. package/dist/esm/models/components/paymentprofileinfo.d.ts.map +1 -0
  136. package/dist/esm/models/components/paymentprofileinfo.js +72 -0
  137. package/dist/esm/models/components/paymentprofileinfo.js.map +1 -0
  138. package/dist/esm/models/components/pendinginvitation.d.ts +6 -0
  139. package/dist/esm/models/components/pendinginvitation.d.ts.map +1 -1
  140. package/dist/esm/models/components/pendinginvitation.js.map +1 -1
  141. package/dist/esm/models/components/standingappointment.d.ts +6 -0
  142. package/dist/esm/models/components/standingappointment.d.ts.map +1 -1
  143. package/dist/esm/models/components/standingappointment.js.map +1 -1
  144. package/dist/esm/react-query/index.d.ts +1 -0
  145. package/dist/esm/react-query/index.d.ts.map +1 -1
  146. package/dist/esm/react-query/index.js +1 -0
  147. package/dist/esm/react-query/index.js.map +1 -1
  148. package/dist/esm/react-query/invoicesListInvoices.d.ts +8 -0
  149. package/dist/esm/react-query/invoicesListInvoices.d.ts.map +1 -1
  150. package/dist/esm/react-query/invoicesListInvoices.js +8 -0
  151. package/dist/esm/react-query/invoicesListInvoices.js.map +1 -1
  152. package/dist/esm/react-query/paymentProfileGetPaymentProfile.core.d.ts +12 -0
  153. package/dist/esm/react-query/paymentProfileGetPaymentProfile.core.d.ts.map +1 -0
  154. package/dist/esm/react-query/paymentProfileGetPaymentProfile.core.js +33 -0
  155. package/dist/esm/react-query/paymentProfileGetPaymentProfile.core.js.map +1 -0
  156. package/dist/esm/react-query/paymentProfileGetPaymentProfile.d.ts +27 -0
  157. package/dist/esm/react-query/paymentProfileGetPaymentProfile.d.ts.map +1 -0
  158. package/dist/esm/react-query/paymentProfileGetPaymentProfile.js +54 -0
  159. package/dist/esm/react-query/paymentProfileGetPaymentProfile.js.map +1 -0
  160. package/dist/esm/react-query/vendorsGetVendorInvoiceDetails.d.ts +2 -0
  161. package/dist/esm/react-query/vendorsGetVendorInvoiceDetails.d.ts.map +1 -1
  162. package/dist/esm/react-query/vendorsGetVendorInvoiceDetails.js +2 -0
  163. package/dist/esm/react-query/vendorsGetVendorInvoiceDetails.js.map +1 -1
  164. package/dist/esm/react-query/vendorsListVendorInvoices.d.ts +4 -0
  165. package/dist/esm/react-query/vendorsListVendorInvoices.d.ts.map +1 -1
  166. package/dist/esm/react-query/vendorsListVendorInvoices.js +4 -0
  167. package/dist/esm/react-query/vendorsListVendorInvoices.js.map +1 -1
  168. package/dist/esm/sdk/invoices.d.ts +2 -0
  169. package/dist/esm/sdk/invoices.d.ts.map +1 -1
  170. package/dist/esm/sdk/invoices.js +2 -0
  171. package/dist/esm/sdk/invoices.js.map +1 -1
  172. package/dist/esm/sdk/paymentprofile.d.ts +15 -0
  173. package/dist/esm/sdk/paymentprofile.d.ts.map +1 -0
  174. package/dist/esm/sdk/paymentprofile.js +21 -0
  175. package/dist/esm/sdk/paymentprofile.js.map +1 -0
  176. package/dist/esm/sdk/sdk.d.ts +3 -0
  177. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  178. package/dist/esm/sdk/sdk.js +4 -0
  179. package/dist/esm/sdk/sdk.js.map +1 -1
  180. package/dist/esm/sdk/vendors.d.ts +2 -0
  181. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  182. package/dist/esm/sdk/vendors.js +2 -0
  183. package/dist/esm/sdk/vendors.js.map +1 -1
  184. package/examples/package-lock.json +1 -1
  185. package/jsr.json +1 -1
  186. package/package.json +1 -1
  187. package/src/__tests__/paymentprofile.test.ts +26 -0
  188. package/src/__tests__/webhooks.test.ts +1 -1
  189. package/src/__tests__/zones.test.ts +2 -3
  190. package/src/funcs/invoicesListInvoices.ts +2 -0
  191. package/src/funcs/paymentProfileGetPaymentProfile.ts +153 -0
  192. package/src/funcs/vendorsGetVendorInvoiceDetails.ts +1 -0
  193. package/src/funcs/vendorsListVendorInvoices.ts +1 -0
  194. package/src/lib/config.ts +2 -2
  195. package/src/models/components/expand.ts +2 -0
  196. package/src/models/components/feed.ts +6 -0
  197. package/src/models/components/index.ts +1 -0
  198. package/src/models/components/invoice.ts +86 -0
  199. package/src/models/components/paymentprofileinfo.ts +182 -0
  200. package/src/models/components/pendinginvitation.ts +6 -0
  201. package/src/models/components/standingappointment.ts +6 -0
  202. package/src/react-query/index.ts +1 -0
  203. package/src/react-query/invoicesListInvoices.ts +8 -0
  204. package/src/react-query/paymentProfileGetPaymentProfile.core.ts +71 -0
  205. package/src/react-query/paymentProfileGetPaymentProfile.ts +96 -0
  206. package/src/react-query/vendorsGetVendorInvoiceDetails.ts +2 -0
  207. package/src/react-query/vendorsListVendorInvoices.ts +4 -0
  208. package/src/sdk/invoices.ts +2 -0
  209. package/src/sdk/paymentprofile.ts +28 -0
  210. package/src/sdk/sdk.ts +6 -0
  211. package/src/sdk/vendors.ts +2 -0
@@ -53,7 +53,9 @@ export const Expand = {
53
53
  InvoiceLineItems: "invoice.line_items",
54
54
  InvoiceInvoiceTransactions: "invoice.invoice_transactions",
55
55
  InvoiceRepresentative: "invoice.representative",
56
+ InvoiceCustomFields: "invoice.custom_fields",
56
57
  InvoiceInvoiceType: "invoice.invoice_type",
58
+ InvoiceMayPayInvoice: "invoice.may_pay_invoice",
57
59
  VendorCredentialCredential: "vendor_credential.credential",
58
60
  VendorCredentialVendor: "vendor_credential.vendor",
59
61
  VendorCredentialInvoice: "vendor_credential.invoice",
@@ -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,11 @@ 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
+
19
24
  /**
20
25
  * The type of invoice based on its line items. Used to categorize invoices for display and filtering purposes.
21
26
  *
@@ -42,6 +47,28 @@ export const InvoiceType = {
42
47
  */
43
48
  export type InvoiceType = OpenEnum<typeof InvoiceType>;
44
49
 
50
+ /**
51
+ * User IDs and company IDs that can pay this invoice. Only included when `invoice.may_pay_invoice` is requested in the expand parameter.
52
+ *
53
+ * @remarks
54
+ *
55
+ * This is used exclusively to control the visibility of the "Make Payment" button in the UI.
56
+ * It is not used for any other invoice logic or backend decision-making.
57
+ *
58
+ * Frontend should compare the logged-in user's ID (for vendors) or company_id (for company managers)
59
+ * with these arrays to determine if the payment button should be shown.
60
+ */
61
+ export type MayPayInvoice = {
62
+ /**
63
+ * Array of user IDs (vendor user IDs) that can pay this invoice
64
+ */
65
+ users?: Array<number> | undefined;
66
+ /**
67
+ * Array of company IDs (company manager company IDs) that can pay this invoice
68
+ */
69
+ companies?: Array<number> | undefined;
70
+ };
71
+
45
72
  /**
46
73
  * A simplified representation of an Invoice
47
74
  */
@@ -58,6 +85,10 @@ export type Invoice = {
58
85
  tax?: number | null | undefined;
59
86
  convenienceFee?: number | null | undefined;
60
87
  shipping?: number | null | undefined;
88
+ /**
89
+ * Custom fields assigned by the company to this vendor.
90
+ */
91
+ customFields?: CustomFields | null | undefined;
61
92
  lines?: Array<InvoiceItem | null> | null | undefined;
62
93
  transactions?: Array<InvoiceTransaction> | null | undefined;
63
94
  representative?: string | null | undefined;
@@ -71,8 +102,37 @@ export type Invoice = {
71
102
  * - "Other": Invoice does not match any of the above categories
72
103
  */
73
104
  invoiceType?: InvoiceType | undefined;
105
+ /**
106
+ * User IDs and company IDs that can pay this invoice. Only included when `invoice.may_pay_invoice` is requested in the expand parameter.
107
+ *
108
+ * @remarks
109
+ *
110
+ * This is used exclusively to control the visibility of the "Make Payment" button in the UI.
111
+ * It is not used for any other invoice logic or backend decision-making.
112
+ *
113
+ * Frontend should compare the logged-in user's ID (for vendors) or company_id (for company managers)
114
+ * with these arrays to determine if the payment button should be shown.
115
+ */
116
+ mayPayInvoice?: MayPayInvoice | null | undefined;
74
117
  };
75
118
 
119
+ /** @internal */
120
+ export const CustomFields$inboundSchema: z.ZodType<
121
+ CustomFields,
122
+ z.ZodTypeDef,
123
+ unknown
124
+ > = z.object({});
125
+
126
+ export function customFieldsFromJSON(
127
+ jsonString: string,
128
+ ): SafeParseResult<CustomFields, SDKValidationError> {
129
+ return safeParse(
130
+ jsonString,
131
+ (x) => CustomFields$inboundSchema.parse(JSON.parse(x)),
132
+ `Failed to parse 'CustomFields' from JSON`,
133
+ );
134
+ }
135
+
76
136
  /** @internal */
77
137
  export const InvoiceType$inboundSchema: z.ZodType<
78
138
  InvoiceType,
@@ -80,6 +140,26 @@ export const InvoiceType$inboundSchema: z.ZodType<
80
140
  unknown
81
141
  > = openEnums.inboundSchema(InvoiceType);
82
142
 
143
+ /** @internal */
144
+ export const MayPayInvoice$inboundSchema: z.ZodType<
145
+ MayPayInvoice,
146
+ z.ZodTypeDef,
147
+ unknown
148
+ > = z.object({
149
+ users: types.optional(z.array(types.number())),
150
+ companies: types.optional(z.array(types.number())),
151
+ });
152
+
153
+ export function mayPayInvoiceFromJSON(
154
+ jsonString: string,
155
+ ): SafeParseResult<MayPayInvoice, SDKValidationError> {
156
+ return safeParse(
157
+ jsonString,
158
+ (x) => MayPayInvoice$inboundSchema.parse(JSON.parse(x)),
159
+ `Failed to parse 'MayPayInvoice' from JSON`,
160
+ );
161
+ }
162
+
83
163
  /** @internal */
84
164
  export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
85
165
  z.object({
@@ -95,12 +175,16 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
95
175
  tax: z.nullable(types.number()).optional(),
96
176
  convenience_fee: z.nullable(types.number()).optional(),
97
177
  shipping: z.nullable(types.number()).optional(),
178
+ custom_fields: z.nullable(z.lazy(() => CustomFields$inboundSchema))
179
+ .optional(),
98
180
  lines: z.nullable(z.array(types.nullable(InvoiceItem$inboundSchema)))
99
181
  .optional(),
100
182
  transactions: z.nullable(z.array(InvoiceTransaction$inboundSchema))
101
183
  .optional(),
102
184
  representative: z.nullable(types.string()).optional(),
103
185
  invoice_type: types.optional(InvoiceType$inboundSchema),
186
+ may_pay_invoice: z.nullable(z.lazy(() => MayPayInvoice$inboundSchema))
187
+ .optional(),
104
188
  }).transform((v) => {
105
189
  return remap$(v, {
106
190
  "invoice_number": "invoiceNumber",
@@ -110,7 +194,9 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
110
194
  "financial_status": "financialStatus",
111
195
  "amount_not_paid": "amountNotPaid",
112
196
  "convenience_fee": "convenienceFee",
197
+ "custom_fields": "customFields",
113
198
  "invoice_type": "invoiceType",
199
+ "may_pay_invoice": "mayPayInvoice",
114
200
  });
115
201
  });
116
202
 
@@ -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,
@@ -0,0 +1,28 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { paymentProfileGetPaymentProfile } from "../funcs/paymentProfileGetPaymentProfile.js";
6
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
+ import * as components from "../models/components/index.js";
8
+ import { unwrapAsync } from "../types/fp.js";
9
+
10
+ export class PaymentProfile extends ClientSDK {
11
+ /**
12
+ * Get payment profile information
13
+ *
14
+ * @remarks
15
+ * Returns payment profile information for the logged-in user (vendor or company manager).
16
+ * This includes credit_balance and payment_profile which are account-level data, not invoice-specific.
17
+ *
18
+ * Only vendors and company managers can access this endpoint.
19
+ */
20
+ async getPaymentProfile(
21
+ options?: RequestOptions,
22
+ ): Promise<components.PaymentProfileInfo> {
23
+ return unwrapAsync(paymentProfileGetPaymentProfile(
24
+ this,
25
+ options,
26
+ ));
27
+ }
28
+ }