@vrplatform/hyperline-client 1.0.14 → 1.0.15

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.
@@ -139,6 +139,9 @@ export class HyperlineAPI {
139
139
  return await this.fetch('/v2/subscriptions', { method: 'POST' }, data);
140
140
  }
141
141
  async updateSubscription(id, data) {
142
+ return await this.fetch(`/v2/subscriptions/${id}`, { method: 'PUT' }, data);
143
+ }
144
+ async createSubscriptionUpdate(id, data) {
142
145
  return await this.fetch(`/v1/subscriptions/${id}/update`, { method: 'POST' }, data);
143
146
  }
144
147
  async cancelSubscription(id, data) {
@@ -176,8 +179,17 @@ export class HyperlineAPI {
176
179
  .map(([key, value]) => `&${key}=${value}`)
177
180
  .join('')}`);
178
181
  }
179
- async getInvoicesByCustomerId(id) {
180
- return await this.fetch(`/v1/invoices?customerId__equals=${id}`);
182
+ async getInvoicesByCustomerId(id, filters) {
183
+ const queryParams = new URLSearchParams();
184
+ queryParams.append('customerId__equals', id);
185
+ if (filters) {
186
+ Object.entries(filters).forEach(([key, value]) => {
187
+ if (value !== undefined && value !== null) {
188
+ queryParams.append(key, value.toString());
189
+ }
190
+ });
191
+ }
192
+ return await this.fetch(`/v1/invoices?${queryParams.toString()}`);
181
193
  }
182
194
  async getInvoiceDownload(id) {
183
195
  return await this.fetch(
@@ -198,6 +210,9 @@ export class HyperlineAPI {
198
210
  : [...items, ...data];
199
211
  }
200
212
  // OTHERS
213
+ async getPaymentMethod(customerId, paymentMethodId) {
214
+ return await this.fetch(`/v1/customers/${customerId}/payment-methods/${paymentMethodId}`);
215
+ }
201
216
  async createBillableEvent(data) {
202
217
  if (!data.length)
203
218
  return { events_created: [] };
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"src/","sources":["client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAGvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC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AAE,EAClB,IAAI,CACL,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,IAEvB;QACC,OAAO,MAAM,IAAI,CAAC,KAAK,CAErB,mCAAmC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;CACF","sourcesContent":["import { utc } from '@finalytic/utils';\nimport type { operations, paths } from './_types.generated';\nimport { BillableEvents, CreateBillableEvent } from './types';\nimport { arrayBufferToBase64 } from './utils';\n\nexport type Logger = { error(message?: any, ...optionalParams: any[]): void };\n\nexport class HyperlineAPI {\n constructor(token: string, logger: Logger = console) {\n this.headers = {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n };\n this.logger = logger;\n }\n\n private headers: Record<string, string>;\n\n private logger: Logger;\n\n private async fetchBasic<T>(\n path: string,\n options?: RequestInit,\n data?: Record<string, any>\n ): Promise<T | null> {\n if (data) options = { body: JSON.stringify(data), ...(options || {}) };\n\n const sandbox = this.headers.Authorization.includes('test')\n ? 'sandbox.'\n : '';\n\n const result = await fetch(`https://${sandbox}${path}`, {\n method: 'GET',\n ...options,\n headers: { ...this.headers, ...options?.headers },\n });\n\n if (!result || !result?.ok) {\n const status = result?.status;\n const statusText = result?.statusText;\n\n if (status === 429) {\n // get difference between rate limit reset and now\n const rateLimitReset = utc(result?.headers.get('x-ratelimit-reset'));\n const diff = rateLimitReset.diff(utc(), 'milliseconds');\n\n // wait until rate limit resets\n await new Promise((resolve) => setTimeout(resolve, diff));\n\n return await this.fetchBasic<T>(path, options, data);\n } else if (status === 404) {\n return null;\n } else {\n const content: any = await result.json();\n throw new Error(\n `Hyperline Error ${status} (${statusText}) in ${path} for ${options?.method || 'GET'}: ${content.message}`\n );\n }\n } else if (result.headers.get('content-type')?.includes('application/pdf'))\n return arrayBufferToBase64(await result.arrayBuffer()) as T;\n\n return (await result.json()) as T;\n }\n\n private async fetch<T>(\n path: string,\n options?: RequestInit,\n data?: Record<string, any>\n ): Promise<T | null> {\n return await this.fetchBasic(`api.hyperline.co${path}`, options, data);\n }\n\n private async fetchIngest<T>(\n path: string,\n options?: RequestInit,\n data?: Record<string, any>\n ): Promise<T | null> {\n return await this.fetchBasic(`ingest.hyperline.co${path}`, options, data);\n }\n\n // CUSTOMER\n\n async getCustomer(id?: string) {\n if (!id) {\n this.logger.error('Missing customer ID', { id });\n throw new Error('Missing customer ID');\n }\n\n return await this.fetch<\n paths['/v1/customers/{id}']['get']['responses'][200]['content']['application/json']\n >(`/v1/customers/${id}`);\n }\n\n async getCustomerById(id?: string) {\n if (!id) {\n this.logger.error('Missing tenant ID', { id });\n throw new Error('Missing tenant ID');\n }\n\n const results = await this.fetch<\n paths['/v1/customers']['get']['responses'][200]['content']['application/json']\n >(`/v1/customers?external_id__equals=${id}`);\n\n return results?.data[0];\n }\n\n async getCustomers(\n skip = 0,\n take = 100,\n query: operations['getCustomers']['parameters']['query'] = {}\n ) {\n return await this.fetch<\n paths['/v1/customers']['get']['responses'][200]['content']['application/json']\n >(\n `/v1/customers?take=${take}&skip=${skip}&${Object.entries(query)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => `&${key}=${value}`)\n .join('')}`\n );\n }\n\n async getAllCustomers(\n items: paths['/v1/customers']['get']['responses'][200]['content']['application/json']['data'] = [],\n query: operations['getCustomers']['parameters']['query'] = {}\n ): Promise<\n paths['/v1/customers']['get']['responses'][200]['content']['application/json']['data']\n > {\n const { data } = (await this.getCustomers(items.length, 100, {\n status: 'all',\n ...query,\n })) || {\n data: [],\n };\n\n return data.length\n ? this.getAllCustomers([...items, ...data], { status: 'all', ...query })\n : [...items, ...data];\n }\n\n async createCustomer(\n data: NonNullable<\n paths['/v1/customers']['post']['requestBody']\n >['content']['application/json']\n ) {\n return await this.fetch<\n paths['/v1/customers']['post']['responses'][201]['content']['application/json']\n >(\n '/v1/customers',\n { method: 'POST' },\n { currency: 'USD', timezone: 'Etc/UTC', ...data }\n );\n }\n\n async updateCustomer(\n id: string,\n data: NonNullable<\n paths['/v1/customers/{id}']['put']['requestBody']\n >['content']['application/json']\n ) {\n if (!id) {\n this.logger.error('Missing customer ID', { id });\n throw new Error('Missing customer ID');\n }\n\n return await this.fetch<\n paths['/v1/customers/{id}']['put']['responses'][200]['content']['application/json']\n >(`/v1/customers/${id}`, { method: 'PUT' }, data);\n }\n\n async deleteCustomer(id: string) {\n return await this.fetch<\n paths['/v1/customers/{id}']['delete']['responses'][204]['content']\n >(`/v1/customers/${id}`, {\n method: 'DELETE',\n });\n }\n\n async archiveCustomer(id: string) {\n return await this.fetch<\n paths['/v1/customers/{id}/archive']['put']['responses'][200]['content']['application/json']\n >(`/v1/customers/${id}/archive`, {\n method: 'PUT',\n });\n }\n\n async unarchiveCustomer(id: string) {\n if (!id) {\n this.logger.error('Missing customer ID', { id });\n throw new Error('Missing customer ID');\n }\n\n return await this.fetch<\n paths['/v1/customers/{id}/unarchive']['put']['responses'][200]['content']['application/json']\n >(`/v1/customers/${id}/unarchive`, { method: 'PUT' });\n }\n\n async getCustomerPortal(id: string) {\n return await this.fetch<\n paths['/v1/customers/{id}/portal']['get']['responses'][200]['content']['application/json']\n >(`/v1/customers/${id}/portal`);\n }\n\n // SUBSCRIPTION\n\n async getSubscription(id: string, liveBilling = false) {\n if (!id) {\n this.logger.error('Missing subscription ID', { id });\n throw new Error('Missing subscription ID');\n }\n\n return await this.fetch<\n paths['/v2/subscriptions/{id}']['get']['responses'][200]['content']['application/json']\n >(\n `/v2/subscriptions/${id}?include_live_billing=${liveBilling ? 'true' : 'false'}`\n );\n }\n\n async getSubscriptions(\n skip = 0,\n take = 100,\n query: operations['getSubscriptions']['parameters']['query'] = {\n status: 'all',\n }\n ) {\n return await this.fetch<\n paths['/v2/subscriptions']['get']['responses'][200]['content']['application/json']\n >(\n `/v2/subscriptions?take=${take}&skip=${skip}${Object.entries(query)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => `&${key}=${value}`)\n .join('')}`\n );\n }\n\n async getAllSubscriptions(\n items: paths['/v2/subscriptions']['get']['responses'][200]['content']['application/json']['data'] = [],\n query: operations['getSubscriptions']['parameters']['query'] = {}\n ): Promise<\n paths['/v2/subscriptions']['get']['responses'][200]['content']['application/json']['data']\n > {\n const { data } = (await this.getSubscriptions(\n items.length,\n 100,\n query\n )) || { data: [] };\n\n return data.length\n ? this.getAllSubscriptions([...items, ...data], query)\n : [...items, ...data];\n }\n\n async createSubscription(\n data: NonNullable<\n paths['/v2/subscriptions']['post']['requestBody']\n >['content']['application/json']\n ) {\n return await this.fetch<\n paths['/v2/subscriptions']['post']['responses'][201]['content']['application/json']\n >('/v2/subscriptions', { method: 'POST' }, data);\n }\n\n async updateSubscription(\n id: string,\n data: NonNullable<\n paths['/v1/subscriptions/{id}/update']['post']['requestBody']\n >['content']['application/json']\n ) {\n return await this.fetch<\n paths['/v1/subscriptions/{id}/update']['post']['responses'][201]['content']['application/json']\n >(`/v1/subscriptions/${id}/update`, { method: 'POST' }, data);\n }\n\n async cancelSubscription(\n id: string,\n data: NonNullable<\n paths['/v1/subscriptions/{id}/cancel']['post']['requestBody']\n >['content']['application/json']\n ) {\n return await this.fetch<\n paths['/v1/subscriptions/{id}/cancel']['post']['responses'][200]['content']['application/json']\n >(\n `/v1/subscriptions/${id}/cancel`,\n {\n method: 'POST',\n },\n data\n );\n }\n\n async reinstateSubscription(id: string) {\n return await this.fetch<\n paths['/v1/subscriptions/{id}/reinstate']['post']['responses'][200]['content']['application/json']\n >(`/v1/subscriptions/${id}/reinstate`, {\n method: 'POST',\n });\n }\n\n // PLAN\n\n async getPlan(id: string) {\n if (!id) {\n this.logger.error('Missing plan ID', { id });\n throw new Error('Missing plan ID');\n }\n\n return await this.fetch<\n paths['/v1/plans/{id}']['get']['responses'][200]['content']['application/json']\n >(`/v1/plans/${id}`);\n }\n\n async getPlans(skip = 0, take = 100) {\n return await this.fetch<\n paths['/v1/plans']['get']['responses'][200]['content']['application/json']\n >(`/v1/plans?take=${take}&skip=${skip}`);\n }\n\n // INVOICE\n\n async getInvoice(id: string) {\n if (!id) {\n this.logger.error('Missing invoice ID', { id });\n throw new Error('Missing invoice ID');\n }\n\n return await this.fetch<\n paths['/v1/invoices/{id}']['get']['responses'][200]['content']['application/json']\n >(`/v1/invoices/${id}`);\n }\n\n async getInvoices(\n skip = 0,\n take = 100,\n query: operations['getInvoices']['parameters']['query'] = { status: 'all' }\n ) {\n return await this.fetch<\n paths['/v1/invoices']['get']['responses'][200]['content']['application/json']\n >(\n `/v1/invoices?take=${take}&skip=${skip}&${Object.entries(query)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => `&${key}=${value}`)\n .join('')}`\n );\n }\n\n async getInvoicesByCustomerId(id: string) {\n return await this.fetch<\n paths['/v1/invoices']['get']['responses'][200]['content']['application/json']\n >(`/v1/invoices?customerId__equals=${id}`);\n }\n\n async getInvoiceDownload(id: string) {\n return await this.fetch<string>(\n // TODO: fix if type != unknown paths['/v1/invoices/{id}/download']['get']['responses'][200]['content']['application/pdf']\n `/v1/invoices/${id}/download`,\n {\n headers: { 'Content-type': 'application/pdf' },\n }\n );\n }\n\n async getAllInvoices(\n items: paths['/v1/invoices']['get']['responses'][200]['content']['application/json']['data'] = [],\n query: operations['getInvoices']['parameters']['query'] = { status: 'all' }\n ): Promise<\n paths['/v1/invoices']['get']['responses'][200]['content']['application/json']['data']\n > {\n const { data } = (await this.getInvoices(items.length, 100, {\n status: 'all',\n ...query,\n })) || {\n data: [],\n };\n\n return data.length\n ? this.getAllInvoices([...items, ...data], { status: 'all', ...query })\n : [...items, ...data];\n }\n\n // OTHERS\n\n async createBillableEvent(data: CreateBillableEvent[]) {\n if (!data.length) return { events_created: [] };\n\n return await this.fetchIngest<BillableEvents>(\n '/v1/events/batch',\n { method: 'POST' },\n data\n );\n }\n\n async getComponentToken(data: {\n customer_id: string;\n }) {\n return await this.fetch<\n paths['/v1/integrations/components/token']['post']['responses'][201]['content']['application/json']\n >('/v1/integrations/components/token', { method: 'POST' }, data);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nimport type { operations, paths } from './_types.generated';\nimport { BillableEvents, CreateBillableEvent } from './types';\nimport { arrayBufferToBase64 } from './utils';\n\nexport type Logger = { error(message?: any, ...optionalParams: any[]): void };\n\nexport class HyperlineAPI {\n constructor(token: string, logger: Logger = console) {\n this.headers = {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n };\n this.logger = logger;\n }\n\n private headers: Record<string, string>;\n\n private logger: Logger;\n\n private async fetchBasic<T>(\n path: string,\n options?: RequestInit,\n data?: Record<string, any>\n ): Promise<T | null> {\n if (data) options = { body: JSON.stringify(data), ...(options || {}) };\n\n const sandbox = this.headers.Authorization.includes('test')\n ? 'sandbox.'\n : '';\n\n const result = await fetch(`https://${sandbox}${path}`, {\n method: 'GET',\n ...options,\n headers: { ...this.headers, ...options?.headers },\n });\n\n if (!result || !result?.ok) {\n const status = result?.status;\n const statusText = result?.statusText;\n\n if (status === 429) {\n // get difference between rate limit reset and now\n const rateLimitReset = utc(result?.headers.get('x-ratelimit-reset'));\n const diff = rateLimitReset.diff(utc(), 'milliseconds');\n\n // wait until rate limit resets\n await new Promise((resolve) => setTimeout(resolve, diff));\n\n return await this.fetchBasic<T>(path, options, data);\n } else if (status === 404) {\n return null;\n } else {\n const content: any = await result.json();\n throw new Error(\n `Hyperline Error ${status} (${statusText}) in ${path} for ${options?.method || 'GET'}: ${content.message}`\n );\n }\n } else if (result.headers.get('content-type')?.includes('application/pdf'))\n return arrayBufferToBase64(await result.arrayBuffer()) as T;\n\n return (await result.json()) as T;\n }\n\n private async fetch<T>(\n path: string,\n options?: RequestInit,\n data?: Record<string, any>\n ): Promise<T | null> {\n return await this.fetchBasic(`api.hyperline.co${path}`, options, data);\n }\n\n private async fetchIngest<T>(\n path: string,\n options?: RequestInit,\n data?: Record<string, any>\n ): Promise<T | null> {\n return await this.fetchBasic(`ingest.hyperline.co${path}`, options, data);\n }\n\n // CUSTOMER\n\n async getCustomer(id?: string) {\n if (!id) {\n this.logger.error('Missing customer ID', { id });\n throw new Error('Missing customer ID');\n }\n\n return await this.fetch<\n paths['/v1/customers/{id}']['get']['responses'][200]['content']['application/json']\n >(`/v1/customers/${id}`);\n }\n\n async getCustomerById(id?: string) {\n if (!id) {\n this.logger.error('Missing tenant ID', { id });\n throw new Error('Missing tenant ID');\n }\n\n const results = await this.fetch<\n paths['/v1/customers']['get']['responses'][200]['content']['application/json']\n >(`/v1/customers?external_id__equals=${id}`);\n\n return results?.data[0];\n }\n\n async getCustomers(\n skip = 0,\n take = 100,\n query: operations['getCustomers']['parameters']['query'] = {}\n ) {\n return await this.fetch<\n paths['/v1/customers']['get']['responses'][200]['content']['application/json']\n >(\n `/v1/customers?take=${take}&skip=${skip}&${Object.entries(query)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => `&${key}=${value}`)\n .join('')}`\n );\n }\n\n async getAllCustomers(\n items: paths['/v1/customers']['get']['responses'][200]['content']['application/json']['data'] = [],\n query: operations['getCustomers']['parameters']['query'] = {}\n ): Promise<\n paths['/v1/customers']['get']['responses'][200]['content']['application/json']['data']\n > {\n const { data } = (await this.getCustomers(items.length, 100, {\n status: 'all',\n ...query,\n })) || {\n data: [],\n };\n\n return data.length\n ? this.getAllCustomers([...items, ...data], { status: 'all', ...query })\n : [...items, ...data];\n }\n\n async createCustomer(\n data: NonNullable<\n paths['/v1/customers']['post']['requestBody']\n >['content']['application/json']\n ) {\n return await this.fetch<\n paths['/v1/customers']['post']['responses'][201]['content']['application/json']\n >(\n '/v1/customers',\n { method: 'POST' },\n { currency: 'USD', timezone: 'Etc/UTC', ...data }\n );\n }\n\n async updateCustomer(\n id: string,\n data: NonNullable<\n paths['/v1/customers/{id}']['put']['requestBody']\n >['content']['application/json']\n ) {\n if (!id) {\n this.logger.error('Missing customer ID', { id });\n throw new Error('Missing customer ID');\n }\n\n return await this.fetch<\n paths['/v1/customers/{id}']['put']['responses'][200]['content']['application/json']\n >(`/v1/customers/${id}`, { method: 'PUT' }, data);\n }\n\n async deleteCustomer(id: string) {\n return await this.fetch<\n paths['/v1/customers/{id}']['delete']['responses'][204]['content']\n >(`/v1/customers/${id}`, {\n method: 'DELETE',\n });\n }\n\n async archiveCustomer(id: string) {\n return await this.fetch<\n paths['/v1/customers/{id}/archive']['put']['responses'][200]['content']['application/json']\n >(`/v1/customers/${id}/archive`, {\n method: 'PUT',\n });\n }\n\n async unarchiveCustomer(id: string) {\n if (!id) {\n this.logger.error('Missing customer ID', { id });\n throw new Error('Missing customer ID');\n }\n\n return await this.fetch<\n paths['/v1/customers/{id}/unarchive']['put']['responses'][200]['content']['application/json']\n >(`/v1/customers/${id}/unarchive`, { method: 'PUT' });\n }\n\n async getCustomerPortal(id: string) {\n return await this.fetch<\n paths['/v1/customers/{id}/portal']['get']['responses'][200]['content']['application/json']\n >(`/v1/customers/${id}/portal`);\n }\n\n // SUBSCRIPTION\n\n async getSubscription(id: string, liveBilling = false) {\n if (!id) {\n this.logger.error('Missing subscription ID', { id });\n throw new Error('Missing subscription ID');\n }\n\n return await this.fetch<\n paths['/v2/subscriptions/{id}']['get']['responses'][200]['content']['application/json']\n >(\n `/v2/subscriptions/${id}?include_live_billing=${liveBilling ? 'true' : 'false'}`\n );\n }\n\n async getSubscriptions(\n skip = 0,\n take = 100,\n query: operations['getSubscriptions']['parameters']['query'] = {\n status: 'all',\n }\n ) {\n return await this.fetch<\n paths['/v2/subscriptions']['get']['responses'][200]['content']['application/json']\n >(\n `/v2/subscriptions?take=${take}&skip=${skip}${Object.entries(query)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => `&${key}=${value}`)\n .join('')}`\n );\n }\n\n async getAllSubscriptions(\n items: paths['/v2/subscriptions']['get']['responses'][200]['content']['application/json']['data'] = [],\n query: operations['getSubscriptions']['parameters']['query'] = {}\n ): Promise<\n paths['/v2/subscriptions']['get']['responses'][200]['content']['application/json']['data']\n > {\n const { data } = (await this.getSubscriptions(\n items.length,\n 100,\n query\n )) || { data: [] };\n\n return data.length\n ? this.getAllSubscriptions([...items, ...data], query)\n : [...items, ...data];\n }\n\n async createSubscription(\n data: NonNullable<\n paths['/v2/subscriptions']['post']['requestBody']\n >['content']['application/json']\n ) {\n return await this.fetch<\n paths['/v2/subscriptions']['post']['responses'][201]['content']['application/json']\n >('/v2/subscriptions', { method: 'POST' }, data);\n }\n\n async updateSubscription(\n id: string,\n data: NonNullable<\n paths['/v2/subscriptions/{id}']['put']['requestBody']\n >['content']['application/json']\n ) {\n return await this.fetch<\n paths['/v2/subscriptions/{id}']['put']['responses'][200]['content']['application/json']\n >(`/v2/subscriptions/${id}`, { method: 'PUT' }, data);\n }\n\n async createSubscriptionUpdate(\n id: string,\n data: NonNullable<\n paths['/v1/subscriptions/{id}/update']['post']['requestBody']\n >['content']['application/json']\n ) {\n return await this.fetch<\n paths['/v1/subscriptions/{id}/update']['post']['responses'][201]['content']['application/json']\n >(`/v1/subscriptions/${id}/update`, { method: 'POST' }, data);\n }\n\n async cancelSubscription(\n id: string,\n data: NonNullable<\n paths['/v1/subscriptions/{id}/cancel']['post']['requestBody']\n >['content']['application/json']\n ) {\n return await this.fetch<\n paths['/v1/subscriptions/{id}/cancel']['post']['responses'][200]['content']['application/json']\n >(\n `/v1/subscriptions/${id}/cancel`,\n {\n method: 'POST',\n },\n data\n );\n }\n\n async reinstateSubscription(id: string) {\n return await this.fetch<\n paths['/v1/subscriptions/{id}/reinstate']['post']['responses'][200]['content']['application/json']\n >(`/v1/subscriptions/${id}/reinstate`, {\n method: 'POST',\n });\n }\n\n // PLAN\n\n async getPlan(id: string) {\n if (!id) {\n this.logger.error('Missing plan ID', { id });\n throw new Error('Missing plan ID');\n }\n\n return await this.fetch<\n paths['/v1/plans/{id}']['get']['responses'][200]['content']['application/json']\n >(`/v1/plans/${id}`);\n }\n\n async getPlans(skip = 0, take = 100) {\n return await this.fetch<\n paths['/v1/plans']['get']['responses'][200]['content']['application/json']\n >(`/v1/plans?take=${take}&skip=${skip}`);\n }\n\n // INVOICE\n\n async getInvoice(id: string) {\n if (!id) {\n this.logger.error('Missing invoice ID', { id });\n throw new Error('Missing invoice ID');\n }\n\n return await this.fetch<\n paths['/v1/invoices/{id}']['get']['responses'][200]['content']['application/json']\n >(`/v1/invoices/${id}`);\n }\n\n async getInvoices(\n skip = 0,\n take = 100,\n query: operations['getInvoices']['parameters']['query'] = { status: 'all' }\n ) {\n return await this.fetch<\n paths['/v1/invoices']['get']['responses'][200]['content']['application/json']\n >(\n `/v1/invoices?take=${take}&skip=${skip}&${Object.entries(query)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => `&${key}=${value}`)\n .join('')}`\n );\n }\n\n async getInvoicesByCustomerId(\n id: string,\n filters?: Partial<operations['getInvoices']['parameters']['query']>\n ) {\n const queryParams = new URLSearchParams();\n queryParams.append('customerId__equals', id);\n\n if (filters) {\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n queryParams.append(key, value.toString());\n }\n });\n }\n\n return await this.fetch<\n paths['/v1/invoices']['get']['responses'][200]['content']['application/json']\n >(`/v1/invoices?${queryParams.toString()}`);\n }\n\n async getInvoiceDownload(id: string) {\n return await this.fetch<string>(\n // TODO: fix if type != unknown paths['/v1/invoices/{id}/download']['get']['responses'][200]['content']['application/pdf']\n `/v1/invoices/${id}/download`,\n {\n headers: { 'Content-type': 'application/pdf' },\n }\n );\n }\n\n async getAllInvoices(\n items: paths['/v1/invoices']['get']['responses'][200]['content']['application/json']['data'] = [],\n query: operations['getInvoices']['parameters']['query'] = { status: 'all' }\n ): Promise<\n paths['/v1/invoices']['get']['responses'][200]['content']['application/json']['data']\n > {\n const { data } = (await this.getInvoices(items.length, 100, {\n status: 'all',\n ...query,\n })) || {\n data: [],\n };\n\n return data.length\n ? this.getAllInvoices([...items, ...data], { status: 'all', ...query })\n : [...items, ...data];\n }\n\n // OTHERS\n\n async getPaymentMethod(customerId: string, paymentMethodId: string) {\n return await this.fetch<\n paths['/v1/customers/{id}/payment-methods/{paymentMethodId}']['get']['responses'][200]['content']['application/json']\n >(`/v1/customers/${customerId}/payment-methods/${paymentMethodId}`);\n }\n\n async createBillableEvent(data: CreateBillableEvent[]) {\n if (!data.length) return { events_created: [] };\n\n return await this.fetchIngest<BillableEvents>(\n '/v1/events/batch',\n { method: 'POST' },\n data\n );\n }\n\n async getComponentToken(data: {\n customer_id: string;\n }) {\n return await this.fetch<\n paths['/v1/integrations/components/token']['post']['responses'][201]['content']['application/json']\n >('/v1/integrations/components/token', { method: 'POST' }, data);\n }\n}\n"]}
@@ -17,6 +17,7 @@ export declare const HYPERLINE_DEFAULT_PLAN_ID = "plan_Dyb5P0ICZ6HsIT";
17
17
  export declare const HYPERLINE_DEFAULT_DEV_PLAN_ID = "plan_UTCVXFQnKD0oMS";
18
18
  export declare const HYPERLINE_DEFAULT_PLAN_NAME = "All-in-One VRP Subscription";
19
19
  export declare const HYPERLINE_DEFAULT_PRODUCT_ID = "itm_9NU7ffT14I4ris";
20
+ export declare const HYPERLINE_DEFAULT_MIN_AMOUNT = 12500;
20
21
  export declare const HYPERLINE_PARTNER_PLAN_ID = "plan_vkYJcCz7z0XD0N";
21
22
  export declare const HYPERLINE_PARTNER_DEV_PLAN_ID = "plan_8qtj8T4j0W3oiS";
22
23
  export declare const HYPERLINE_PARTNER_PLAN_NAME = "VRP Subscription - Partners";
@@ -25,6 +26,7 @@ export declare const GL_HYPERLINE_DEFAULT_PLAN_ID = "plan_JXviWSpU5yuokD";
25
26
  export declare const GL_HYPERLINE_DEFAULT_DEV_PLAN_ID = "plan_Nnozk8_TfYqTkj";
26
27
  export declare const GL_HYPERLINE_DEFAULT_PLAN_NAME = "VRTrust Subscription";
27
28
  export declare const GL_HYPERLINE_DEFAULT_PRODUCT_ID = "itm_NRTRBQ0fc8bFGW";
29
+ export declare const GL_HYPERLINE_DEFAULT_MIN_AMOUNT = 25000;
28
30
  export declare const GL_HYPERLINE_PARTNER_PLAN_ID = "plan_vyxckdvUi8X_mr";
29
31
  export declare const GL_HYPERLINE_PARTNER_DEV_PLAN_ID = "plan_CVXQ47ErOWANhJ";
30
32
  export declare const GL_HYPERLINE_PARTNER_PLAN_NAME = "VRTrust Subscription - Partners";
@@ -51,4 +53,4 @@ export declare const WEBHOOKS: {
51
53
  'invoice.settled': "hyperline_invoice_settled";
52
54
  'invoice.voided': "hyperline_invoice_voided";
53
55
  };
54
- export declare const CURRENCY_MAP: Record<currency_enum, HyperlineEntities['Currency'] | undefined>;
56
+ export declare const CURRENCY_MAP: Record<currency_enum, HyperlineEntities['Invoice']['currency'] | undefined>;
@@ -19,6 +19,7 @@ export const HYPERLINE_DEFAULT_PLAN_ID = 'plan_Dyb5P0ICZ6HsIT';
19
19
  export const HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_UTCVXFQnKD0oMS';
20
20
  export const HYPERLINE_DEFAULT_PLAN_NAME = 'All-in-One VRP Subscription';
21
21
  export const HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_9NU7ffT14I4ris';
22
+ export const HYPERLINE_DEFAULT_MIN_AMOUNT = 12500;
22
23
  export const HYPERLINE_PARTNER_PLAN_ID = 'plan_vkYJcCz7z0XD0N';
23
24
  export const HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_8qtj8T4j0W3oiS';
24
25
  export const HYPERLINE_PARTNER_PLAN_NAME = 'VRP Subscription - Partners';
@@ -27,6 +28,7 @@ export const GL_HYPERLINE_DEFAULT_PLAN_ID = 'plan_JXviWSpU5yuokD';
27
28
  export const GL_HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_Nnozk8_TfYqTkj';
28
29
  export const GL_HYPERLINE_DEFAULT_PLAN_NAME = 'VRTrust Subscription';
29
30
  export const GL_HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_NRTRBQ0fc8bFGW';
31
+ export const GL_HYPERLINE_DEFAULT_MIN_AMOUNT = 25000;
30
32
  export const GL_HYPERLINE_PARTNER_PLAN_ID = 'plan_vyxckdvUi8X_mr';
31
33
  export const GL_HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_CVXQ47ErOWANhJ';
32
34
  export const GL_HYPERLINE_PARTNER_PLAN_NAME = 'VRTrust Subscription - Partners';
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"src/","sources":["const.ts"],"names":[],"mappings":"AAIA,UAAU;AACV,MAAM,CAAC,MAAM,aAAa,GAAG,sCAAsC,CAAC;AACpE,MAAM,CAAC,MAAM,2BAA2B,GACtC,sCAAsC,CAAC;AACzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AAEzE,YAAY;AACZ,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AACzD,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE7D,UAAU;AACV,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAE3D,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AACjE,MAAM,CAAC,MAAM,gCAAgC,GAAG,oBAAoB,CAAC;AAErE,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC,CAAC,UAAU;AAC5E,MAAM,CAAC,MAAM,gCAAgC,GAAG,oBAAoB,CAAC,CAAC,UAAU;AAChF,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC,CAAC,WAAW;AAC7E,MAAM,CAAC,MAAM,gCAAgC,GAAG,oBAAoB,CAAC,CAAC,WAAW;AAEjF,QAAQ;AACR,MAAM,CAAC,MAAM,yBAAyB,GAAG,qBAAqB,CAAC;AAC/D,MAAM,CAAC,MAAM,6BAA6B,GAAG,qBAAqB,CAAC;AACnE,MAAM,CAAC,MAAM,2BAA2B,GAAG,6BAA6B,CAAC;AACzE,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AAEjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,qBAAqB,CAAC;AAC/D,MAAM,CAAC,M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G,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;CACf,CAAC","sourcesContent":["import type { currency_enum } from '@finalytic/graphql';\nimport type { TrackingEvent } from '@vrplatform/log';\nimport { HyperlineEntities } from './types';\n\n// Tenants\nexport const VRP_TENANT_ID = '7bfec41f-aa3f-4602-95d2-f7996e4f0e59';\nexport const DEMO_TEST_PARTNER_TENANT_ID =\n '0b6a7bd6-56cc-46b5-b2ab-1bd7d1e994fa';\nexport const XIMPLIFI_TENANT_ID = 'd6ab2bbe-e0fc-48d9-89a3-c3c05f4e79b5';\n\n// Customers\nexport const XIMPLIFI_CUSTOMER_ID = 'cus_HDUZawnaJbPa9p';\nexport const XIMPLIFI_DEV_CUSTOMER_ID = 'cus_dNUGCETGYVu3ZV';\n\n// Coupons\nexport const XIMPLIFI_COUPON_ID = 'cou_MXCaik3r19_Xkn';\nexport const XIMPLIFI_DEV_COUPON_ID = 'cou_MGtxHbT8IR1gK9';\n\nexport const ACCOUNTING_PARTNER_COUPON_ID = 'cou_PJQ328MBAD9kxY';\nexport const ACCOUNTING_PARTNER_DEV_COUPON_ID = 'cou_y6UfaI2X1m34Qg';\n\nexport const VRTRUST_HALF_PRICE_COUPON_ID = 'cou_CTOQqs0SOeSc-e'; // 50% off\nexport const VRTRUST_HALF_PRICE_DEV_COUPON_ID = 'cou_tHLiRdwQ6xGqKA'; // 50% off\nexport const VRTRUST_FREE_PRICE_COUPON_ID = 'cou_JGiLite8_nFtnX'; // 100% off\nexport const VRTRUST_FREE_PRICE_DEV_COUPON_ID = 'cou_N4GNqSSLEFscto'; // 100% off\n\n// Plans\nexport const HYPERLINE_DEFAULT_PLAN_ID = 'plan_Dyb5P0ICZ6HsIT';\nexport const HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_UTCVXFQnKD0oMS';\nexport const HYPERLINE_DEFAULT_PLAN_NAME = 'All-in-One VRP Subscription';\nexport const HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_9NU7ffT14I4ris';\n\nexport const HYPERLINE_PARTNER_PLAN_ID = 'plan_vkYJcCz7z0XD0N';\nexport const HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_8qtj8T4j0W3oiS';\nexport const HYPERLINE_PARTNER_PLAN_NAME = 'VRP Subscription - Partners';\nexport const HYPERLINE_PARTNER_PRODUCT_ID = 'itm_AJBM0_jPsrqizl';\n\nexport const GL_HYPERLINE_DEFAULT_PLAN_ID = 'plan_JXviWSpU5yuokD';\nexport const GL_HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_Nnozk8_TfYqTkj';\nexport const GL_HYPERLINE_DEFAULT_PLAN_NAME = 'VRTrust Subscription';\nexport const GL_HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_NRTRBQ0fc8bFGW';\n\nexport const GL_HYPERLINE_PARTNER_PLAN_ID = 'plan_vyxckdvUi8X_mr';\nexport const GL_HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_CVXQ47ErOWANhJ';\nexport const GL_HYPERLINE_PARTNER_PLAN_NAME = 'VRTrust Subscription - Partners';\nexport const GL_HYPERLINE_PARTNER_PRODUCT_ID = 'itm_bE4y9lhrZ6Qtsf';\n\nexport const WEBHOOKS = {\n 'payment_method.created': 'hyperline_payment_method_created',\n 'payment_method.errored': 'hyperline_payment_method_errored',\n 'payment_method.deleted': 'hyperline_payment_method_deleted',\n 'subscription.activated': 'hyperline_subscription_status_changed',\n 'subscription.reactivated': 'hyperline_subscription_status_changed',\n 'subscription.cancellation_scheduled':\n 'hyperline_subscription_cancellation_scheduled',\n 'subscription.cancelled': 'hyperline_subscription_status_changed',\n 'subscription.reinstated': 'hyperline_subscription_status_changed',\n 'subscription.charged': 'hyperline_subscription_charged',\n 'subscription.errored': 'hyperline_subscription_status_changed',\n 'subscription.paused': 'hyperline_subscription_status_changed',\n 'subscription.trial_ended': 'hyperline_trial_ended',\n 'subscription.voided': 'hyperline_subscription_status_changed',\n 'customer.created': 'hyperline_customer_created',\n 'customer.updated': 'hyperline_customer_updated',\n 'customer.deleted': 'hyperline_customer_deleted',\n 'invoice.errored': 'hyperline_invoice_errored',\n 'invoice.ready': 'hyperline_invoice_ready',\n 'invoice.settled': 'hyperline_invoice_settled',\n 'invoice.voided': 'hyperline_invoice_voided',\n} satisfies Record<string, TrackingEvent>;\n\nexport const CURRENCY_MAP: Record<\n currency_enum,\n HyperlineEntities['Currency'] | undefined\n> = {\n aed: 'AED',\n afn: 'AFN',\n all: 'ALL',\n amd: 'AMD',\n ang: 'ANG',\n aoa: 'AOA',\n ars: 'ARS',\n aud: 'AUD',\n awg: 'AWG',\n azn: 'AZN',\n bam: 'BAM',\n bbd: 'BBD',\n bdt: 'BDT',\n bgn: 'BGN',\n bhd: 'BHD',\n bif: 'BIF',\n bmd: 'BMD',\n bnd: 'BND',\n bob: 'BOB',\n bov: 'BOB',\n brl: 'BRL',\n bsd: 'BSD',\n btn: 'BTN',\n bwp: 'BWP',\n byn: 'BYR',\n byr: 'BYR',\n bzd: 'BZD',\n cad: 'CAD',\n cdf: 'CDF',\n che: 'CHF',\n chf: 'CHF',\n chw: 'CHF',\n clf: 'CLP',\n clp: 'CLP',\n cny: 'CNY',\n cop: 'COP',\n cou: 'COP',\n crc: 'CRC',\n cuc: 'CUP',\n cup: 'CUP',\n cve: 'CVE',\n czk: 'CZK',\n djf: 'DJF',\n dkk: 'DKK',\n dop: 'DOP',\n dzd: 'DZD',\n egp: 'EGP',\n ern: 'ERN',\n etb: 'ETB',\n eur: 'EUR',\n fjd: 'FJD',\n fkp: 'FKP',\n gbp: 'GBP',\n gel: 'GEL',\n ghs: 'GHS',\n gip: 'GIP',\n gmd: 'GMD',\n gnf: 'GNF',\n gtq: 'GTQ',\n gyd: 'GYD',\n hkd: 'HKD',\n hnl: 'HNL',\n hrk: 'HRK',\n htg: 'HTG',\n huf: 'HUF',\n idr: 'IDR',\n ils: 'ILS',\n inr: 'INR',\n iqd: 'IQD',\n irr: 'IRR',\n isk: 'ISK',\n jmd: 'JMD',\n jod: 'JOD',\n jpy: 'JPY',\n kes: 'KES',\n kgs: 'KGS',\n khr: 'KHR',\n kmf: 'KMF',\n kpw: 'KPW',\n krw: 'KRW',\n kwd: 'KWD',\n kyd: 'KYD',\n kzt: 'KZT',\n lak: 'LAK',\n lbp: 'LBP',\n lkr: 'LKR',\n lrd: 'LRD',\n lsl: 'LSL',\n ltl: 'EUR',\n lvl: 'EUR',\n lyd: 'LYD',\n mad: 'MAD',\n mdl: 'MDL',\n mga: 'MGA',\n mkd: 'MKD',\n mmk: 'MMK',\n mnt: 'MNT',\n mop: 'MOP',\n mro: 'MRO',\n mur: 'MUR',\n mvr: 'MVR',\n mwk: 'MWK',\n mxn: 'MXN',\n mxv: 'MXN',\n myr: 'MYR',\n mzn: 'MZN',\n nad: 'NAD',\n ngn: 'NGN',\n nio: 'NIO',\n nok: 'NOK',\n npr: 'NPR',\n nzd: 'NZD',\n omr: 'OMR',\n pab: 'PAB',\n pen: 'PEN',\n pgk: 'PGK',\n php: 'PHP',\n pkr: 'PKR',\n pln: 'PLN',\n pyg: 'PYG',\n qar: 'QAR',\n ron: 'RON',\n rsd: 'RSD',\n rub: 'RUB',\n rwf: 'RWF',\n sar: 'SAR',\n sbd: 'SBD',\n scr: 'SCR',\n sdg: 'SDG',\n sek: 'SEK',\n sgd: 'SGD',\n shp: 'SHP',\n sll: 'SLL',\n sos: 'SOS',\n srd: 'SRD',\n ssp: 'SSP',\n std: 'STD',\n syp: 'SYP',\n szl: 'SZL',\n thb: 'THB',\n tjs: 'TJS',\n tmt: 'TMT',\n tnd: 'TND',\n top: 'TOP',\n try: 'TRY',\n ttd: 'TTD',\n twd: 'TWD',\n tzs: 'TZS',\n uah: 'UAH',\n ugx: 'UGX',\n usd: 'USD',\n uyu: 'UYU',\n uzs: 'UZS',\n vef: 'VEF',\n vnd: 'VND',\n vuv: 'VUV',\n wst: 'WST',\n xaf: 'XAF',\n xpf: 'XPF',\n yer: 'YER',\n zar: 'ZAR',\n zmw: 'ZMW',\n zwl: 'ZWL',\n usn: undefined,\n uss: undefined,\n uyi: undefined,\n xag: undefined,\n xau: undefined,\n xba: undefined,\n xbb: undefined,\n xbc: undefined,\n xbd: undefined,\n xcd: undefined,\n xdr: undefined,\n xfu: undefined,\n xof: undefined,\n xpd: undefined,\n xpt: undefined,\n xts: undefined,\n xxx: undefined,\n};\n"]}
1
+ {"version":3,"file":"const.js","sourceRoot":"src/","sources":["const.ts"],"names":[],"mappings":"AAIA,UAAU;AACV,MAAM,CAAC,MAAM,aAAa,GAAG,sCAAsC,CAAC;AACpE,MAAM,CAAC,MAAM,2BAA2B,GACtC,sCAAsC,CAAC;AACzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,sCAAsC,CAAC;AAEzE,YAAY;AACZ,MAAM,CAAC,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AACzD,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAE7D,UAAU;AACV,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AACvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAE3D,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC;AACjE,MAAM,CAAC,MAAM,gCAAgC,GAAG,oBAAoB,CAAC;AAErE,MAAM,CAAC,MAAM,4BAA4B,GAAG,oBAAoB,CAAC,CAAC,UAA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,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;CACf,CAAC","sourcesContent":["import type { currency_enum } from '@finalytic/graphql';\nimport type { TrackingEvent } from '@vrplatform/log';\nimport { HyperlineEntities } from './types';\n\n// Tenants\nexport const VRP_TENANT_ID = '7bfec41f-aa3f-4602-95d2-f7996e4f0e59';\nexport const DEMO_TEST_PARTNER_TENANT_ID =\n '0b6a7bd6-56cc-46b5-b2ab-1bd7d1e994fa';\nexport const XIMPLIFI_TENANT_ID = 'd6ab2bbe-e0fc-48d9-89a3-c3c05f4e79b5';\n\n// Customers\nexport const XIMPLIFI_CUSTOMER_ID = 'cus_HDUZawnaJbPa9p';\nexport const XIMPLIFI_DEV_CUSTOMER_ID = 'cus_dNUGCETGYVu3ZV';\n\n// Coupons\nexport const XIMPLIFI_COUPON_ID = 'cou_MXCaik3r19_Xkn';\nexport const XIMPLIFI_DEV_COUPON_ID = 'cou_MGtxHbT8IR1gK9';\n\nexport const ACCOUNTING_PARTNER_COUPON_ID = 'cou_PJQ328MBAD9kxY';\nexport const ACCOUNTING_PARTNER_DEV_COUPON_ID = 'cou_y6UfaI2X1m34Qg';\n\nexport const VRTRUST_HALF_PRICE_COUPON_ID = 'cou_CTOQqs0SOeSc-e'; // 50% off\nexport const VRTRUST_HALF_PRICE_DEV_COUPON_ID = 'cou_tHLiRdwQ6xGqKA'; // 50% off\nexport const VRTRUST_FREE_PRICE_COUPON_ID = 'cou_JGiLite8_nFtnX'; // 100% off\nexport const VRTRUST_FREE_PRICE_DEV_COUPON_ID = 'cou_N4GNqSSLEFscto'; // 100% off\n\n// Plans\nexport const HYPERLINE_DEFAULT_PLAN_ID = 'plan_Dyb5P0ICZ6HsIT';\nexport const HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_UTCVXFQnKD0oMS';\nexport const HYPERLINE_DEFAULT_PLAN_NAME = 'All-in-One VRP Subscription';\nexport const HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_9NU7ffT14I4ris';\nexport const HYPERLINE_DEFAULT_MIN_AMOUNT = 12500;\n\nexport const HYPERLINE_PARTNER_PLAN_ID = 'plan_vkYJcCz7z0XD0N';\nexport const HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_8qtj8T4j0W3oiS';\nexport const HYPERLINE_PARTNER_PLAN_NAME = 'VRP Subscription - Partners';\nexport const HYPERLINE_PARTNER_PRODUCT_ID = 'itm_AJBM0_jPsrqizl';\n\nexport const GL_HYPERLINE_DEFAULT_PLAN_ID = 'plan_JXviWSpU5yuokD';\nexport const GL_HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_Nnozk8_TfYqTkj';\nexport const GL_HYPERLINE_DEFAULT_PLAN_NAME = 'VRTrust Subscription';\nexport const GL_HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_NRTRBQ0fc8bFGW';\nexport const GL_HYPERLINE_DEFAULT_MIN_AMOUNT = 25000;\n\nexport const GL_HYPERLINE_PARTNER_PLAN_ID = 'plan_vyxckdvUi8X_mr';\nexport const GL_HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_CVXQ47ErOWANhJ';\nexport const GL_HYPERLINE_PARTNER_PLAN_NAME = 'VRTrust Subscription - Partners';\nexport const GL_HYPERLINE_PARTNER_PRODUCT_ID = 'itm_bE4y9lhrZ6Qtsf';\n\nexport const WEBHOOKS = {\n 'payment_method.created': 'hyperline_payment_method_created',\n 'payment_method.errored': 'hyperline_payment_method_errored',\n 'payment_method.deleted': 'hyperline_payment_method_deleted',\n 'subscription.activated': 'hyperline_subscription_status_changed',\n 'subscription.reactivated': 'hyperline_subscription_status_changed',\n 'subscription.cancellation_scheduled':\n 'hyperline_subscription_cancellation_scheduled',\n 'subscription.cancelled': 'hyperline_subscription_status_changed',\n 'subscription.reinstated': 'hyperline_subscription_status_changed',\n 'subscription.charged': 'hyperline_subscription_charged',\n 'subscription.errored': 'hyperline_subscription_status_changed',\n 'subscription.paused': 'hyperline_subscription_status_changed',\n 'subscription.trial_ended': 'hyperline_trial_ended',\n 'subscription.voided': 'hyperline_subscription_status_changed',\n 'customer.created': 'hyperline_customer_created',\n 'customer.updated': 'hyperline_customer_updated',\n 'customer.deleted': 'hyperline_customer_deleted',\n 'invoice.errored': 'hyperline_invoice_errored',\n 'invoice.ready': 'hyperline_invoice_ready',\n 'invoice.settled': 'hyperline_invoice_settled',\n 'invoice.voided': 'hyperline_invoice_voided',\n} satisfies Record<string, TrackingEvent>;\n\nexport const CURRENCY_MAP: Record<\n currency_enum,\n HyperlineEntities['Invoice']['currency'] | undefined\n> = {\n aed: 'AED',\n afn: 'AFN',\n all: 'ALL',\n amd: 'AMD',\n ang: 'ANG',\n aoa: 'AOA',\n ars: 'ARS',\n aud: 'AUD',\n awg: 'AWG',\n azn: 'AZN',\n bam: 'BAM',\n bbd: 'BBD',\n bdt: 'BDT',\n bgn: 'BGN',\n bhd: 'BHD',\n bif: 'BIF',\n bmd: 'BMD',\n bnd: 'BND',\n bob: 'BOB',\n bov: 'BOB',\n brl: 'BRL',\n bsd: 'BSD',\n btn: 'BTN',\n bwp: 'BWP',\n byn: 'BYR',\n byr: 'BYR',\n bzd: 'BZD',\n cad: 'CAD',\n cdf: 'CDF',\n che: 'CHF',\n chf: 'CHF',\n chw: 'CHF',\n clf: 'CLP',\n clp: 'CLP',\n cny: 'CNY',\n cop: 'COP',\n cou: 'COP',\n crc: 'CRC',\n cuc: 'CUP',\n cup: 'CUP',\n cve: 'CVE',\n czk: 'CZK',\n djf: 'DJF',\n dkk: 'DKK',\n dop: 'DOP',\n dzd: 'DZD',\n egp: 'EGP',\n ern: 'ERN',\n etb: 'ETB',\n eur: 'EUR',\n fjd: 'FJD',\n fkp: 'FKP',\n gbp: 'GBP',\n gel: 'GEL',\n ghs: 'GHS',\n gip: 'GIP',\n gmd: 'GMD',\n gnf: 'GNF',\n gtq: 'GTQ',\n gyd: 'GYD',\n hkd: 'HKD',\n hnl: 'HNL',\n hrk: 'HRK',\n htg: 'HTG',\n huf: 'HUF',\n idr: 'IDR',\n ils: 'ILS',\n inr: 'INR',\n iqd: 'IQD',\n irr: 'IRR',\n isk: 'ISK',\n jmd: 'JMD',\n jod: 'JOD',\n jpy: 'JPY',\n kes: 'KES',\n kgs: 'KGS',\n khr: 'KHR',\n kmf: 'KMF',\n kpw: 'KPW',\n krw: 'KRW',\n kwd: 'KWD',\n kyd: 'KYD',\n kzt: 'KZT',\n lak: 'LAK',\n lbp: 'LBP',\n lkr: 'LKR',\n lrd: 'LRD',\n lsl: 'LSL',\n ltl: 'EUR',\n lvl: 'EUR',\n lyd: 'LYD',\n mad: 'MAD',\n mdl: 'MDL',\n mga: 'MGA',\n mkd: 'MKD',\n mmk: 'MMK',\n mnt: 'MNT',\n mop: 'MOP',\n mro: 'MRO',\n mur: 'MUR',\n mvr: 'MVR',\n mwk: 'MWK',\n mxn: 'MXN',\n mxv: 'MXN',\n myr: 'MYR',\n mzn: 'MZN',\n nad: 'NAD',\n ngn: 'NGN',\n nio: 'NIO',\n nok: 'NOK',\n npr: 'NPR',\n nzd: 'NZD',\n omr: 'OMR',\n pab: 'PAB',\n pen: 'PEN',\n pgk: 'PGK',\n php: 'PHP',\n pkr: 'PKR',\n pln: 'PLN',\n pyg: 'PYG',\n qar: 'QAR',\n ron: 'RON',\n rsd: 'RSD',\n rub: 'RUB',\n rwf: 'RWF',\n sar: 'SAR',\n sbd: 'SBD',\n scr: 'SCR',\n sdg: 'SDG',\n sek: 'SEK',\n sgd: 'SGD',\n shp: 'SHP',\n sll: 'SLL',\n sos: 'SOS',\n srd: 'SRD',\n ssp: 'SSP',\n std: 'STD',\n syp: 'SYP',\n szl: 'SZL',\n thb: 'THB',\n tjs: 'TJS',\n tmt: 'TMT',\n tnd: 'TND',\n top: 'TOP',\n try: 'TRY',\n ttd: 'TTD',\n twd: 'TWD',\n tzs: 'TZS',\n uah: 'UAH',\n ugx: 'UGX',\n usd: 'USD',\n uyu: 'UYU',\n uzs: 'UZS',\n vef: 'VEF',\n vnd: 'VND',\n vuv: 'VUV',\n wst: 'WST',\n xaf: 'XAF',\n xpf: 'XPF',\n yer: 'YER',\n zar: 'ZAR',\n zmw: 'ZMW',\n zwl: 'ZWL',\n usn: undefined,\n uss: undefined,\n uyi: undefined,\n xag: undefined,\n xau: undefined,\n xba: undefined,\n xbb: undefined,\n xbc: undefined,\n xbd: undefined,\n xcd: undefined,\n xdr: undefined,\n xfu: undefined,\n xof: undefined,\n xpd: undefined,\n xpt: undefined,\n xts: undefined,\n xxx: undefined,\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vrplatform/hyperline-client",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "main": "build/main/index.js",
5
5
  "publishConfig": {
6
6
  "access": "public"