@aranova/tracking-next 0.20.2 → 0.21.0
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.
- package/README.md +80 -1
- package/dist/calendar-server.d.mts +53 -0
- package/dist/calendar-server.d.ts +53 -0
- package/dist/calendar-server.js +206 -0
- package/dist/calendar-server.js.map +1 -0
- package/dist/calendar-server.mjs +180 -0
- package/dist/calendar-server.mjs.map +1 -0
- package/dist/calendar.d.mts +112 -0
- package/dist/calendar.d.ts +112 -0
- package/dist/calendar.js +517 -0
- package/dist/calendar.js.map +1 -0
- package/dist/calendar.mjs +457 -0
- package/dist/calendar.mjs.map +1 -0
- package/dist/date-BHetnL7s.d.mts +26 -0
- package/dist/date-BHetnL7s.d.ts +26 -0
- package/dist/index.d.mts +60 -3
- package/dist/index.d.ts +60 -3
- package/dist/index.js +511 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +474 -18
- package/dist/index.mjs.map +1 -1
- package/dist/request-Doq36Rt0.d.mts +19 -0
- package/dist/request-Doq36Rt0.d.ts +19 -0
- package/dist/{sales-DrH6dY5F.d.mts → sales-B3BnYncU.d.mts} +5 -44
- package/dist/{sales-DrH6dY5F.d.ts → sales-CDjXRdmd.d.ts} +5 -44
- package/dist/sales.d.mts +3 -1
- package/dist/sales.d.ts +3 -1
- package/dist/sales.js +22 -17
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +22 -17
- package/dist/sales.mjs.map +1 -1
- package/dist/transport-Bku8zftU.d.mts +721 -0
- package/dist/transport-DsOY6kcW.d.ts +721 -0
- package/package.json +21 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Shared config for every awaited (non fire-and-forget) API helper. */
|
|
2
|
+
interface ApiTransportConfig {
|
|
3
|
+
/** Public (`aranv_pk_…`) or secret (`aranv_sk_…`) API key. */
|
|
4
|
+
apiKey: string;
|
|
5
|
+
/** Base tracking endpoint, e.g. `https://aranovainternal-production.up.railway.app/tracking`. */
|
|
6
|
+
endpoint: string;
|
|
7
|
+
/** Optional SDK identity headers (mirrors the event ingest client). */
|
|
8
|
+
sdkVersion?: string;
|
|
9
|
+
packageName?: string;
|
|
10
|
+
surface?: string;
|
|
11
|
+
environment?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Single awaited request. Unlike the event queue, this surfaces failures: any
|
|
15
|
+
* non-2xx rejects with an {@link AranovaApiError}. Returns `undefined` for 204.
|
|
16
|
+
*/
|
|
17
|
+
declare function apiRequest<T>(config: ApiTransportConfig, method: string, path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<T>;
|
|
18
|
+
|
|
19
|
+
export { type ApiTransportConfig as A, apiRequest as a };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Shared config for every awaited (non fire-and-forget) API helper. */
|
|
2
|
+
interface ApiTransportConfig {
|
|
3
|
+
/** Public (`aranv_pk_…`) or secret (`aranv_sk_…`) API key. */
|
|
4
|
+
apiKey: string;
|
|
5
|
+
/** Base tracking endpoint, e.g. `https://aranovainternal-production.up.railway.app/tracking`. */
|
|
6
|
+
endpoint: string;
|
|
7
|
+
/** Optional SDK identity headers (mirrors the event ingest client). */
|
|
8
|
+
sdkVersion?: string;
|
|
9
|
+
packageName?: string;
|
|
10
|
+
surface?: string;
|
|
11
|
+
environment?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Single awaited request. Unlike the event queue, this surfaces failures: any
|
|
15
|
+
* non-2xx rejects with an {@link AranovaApiError}. Returns `undefined` for 204.
|
|
16
|
+
*/
|
|
17
|
+
declare function apiRequest<T>(config: ApiTransportConfig, method: string, path: string, body?: unknown, extraHeaders?: Record<string, string>): Promise<T>;
|
|
18
|
+
|
|
19
|
+
export { type ApiTransportConfig as A, apiRequest as a };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { CountryCode } from 'libphonenumber-js';
|
|
3
|
+
import { A as ApiTransportConfig, a as apiRequest } from './request-Doq36Rt0.mjs';
|
|
4
|
+
import './date-BHetnL7s.mjs';
|
|
3
5
|
|
|
4
6
|
/** Raw identifiers a caller may hand us (normalized before use). */
|
|
5
7
|
interface ConversionUserData {
|
|
@@ -815,27 +817,8 @@ interface BusinessConfig {
|
|
|
815
817
|
features: BusinessConfigFeatures;
|
|
816
818
|
}
|
|
817
819
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
/** Public (`aranv_pk_…`) or secret (`aranv_sk_…`) API key. */
|
|
821
|
-
apiKey: string;
|
|
822
|
-
/**
|
|
823
|
-
* Base tracking endpoint, e.g. `https://aranovainternal-production.up.railway.app/tracking`.
|
|
824
|
-
* The `/sales` path is appended by the helpers.
|
|
825
|
-
*/
|
|
826
|
-
endpoint: string;
|
|
827
|
-
/** Optional SDK identity headers (mirrors the event ingest client). */
|
|
828
|
-
sdkVersion?: string;
|
|
829
|
-
packageName?: string;
|
|
830
|
-
surface?: string;
|
|
831
|
-
environment?: string;
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Single awaited request used by every sales helper. Unlike the event queue,
|
|
835
|
-
* this surfaces failures: any non-2xx rejects with an {@link AranovaApiError}.
|
|
836
|
-
* Returns `undefined` for 204 No Content.
|
|
837
|
-
*/
|
|
838
|
-
declare function salesRequest<T>(config: SalesTransportConfig, method: string, path: string, body?: unknown): Promise<T>;
|
|
820
|
+
type SalesTransportConfig = ApiTransportConfig;
|
|
821
|
+
declare const salesRequest: typeof apiRequest;
|
|
839
822
|
|
|
840
823
|
/** Config for {@link createSalesClient}. */
|
|
841
824
|
interface SalesClientConfig extends SalesTransportConfig {
|
|
@@ -937,22 +920,6 @@ interface SalesClient<TService extends string = string, TConversion extends stri
|
|
|
937
920
|
}
|
|
938
921
|
declare function createSalesClient<TService extends string = string, TConversion extends string = string>(config: SalesClientConfig): SalesClient<TService, TConversion>;
|
|
939
922
|
|
|
940
|
-
/**
|
|
941
|
-
* Error thrown by the sales client (`createSalesClient`) on a
|
|
942
|
-
* non-2xx response. Unlike the fire-and-forget event queue (which swallows
|
|
943
|
-
* failures), a sale is a transaction the caller must be able to react to.
|
|
944
|
-
*/
|
|
945
|
-
declare class AranovaApiError extends Error {
|
|
946
|
-
readonly status: number;
|
|
947
|
-
readonly code: string | undefined;
|
|
948
|
-
readonly requestId: string | undefined;
|
|
949
|
-
constructor(message: string, options: {
|
|
950
|
-
status: number;
|
|
951
|
-
code?: string;
|
|
952
|
-
requestId?: string;
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
|
|
956
923
|
/**
|
|
957
924
|
* Convert a major amount (dollars `250.5`) to integer minor units (`25050`).
|
|
958
925
|
*
|
|
@@ -969,12 +936,6 @@ declare function fromMinor(cents: number, currency: SupportedCurrency): number;
|
|
|
969
936
|
* Uses the built-in `Intl.NumberFormat` — no extra dependency.
|
|
970
937
|
*/
|
|
971
938
|
declare function formatMoney(cents: number, currency: SupportedCurrency, locale?: string): string;
|
|
972
|
-
/**
|
|
973
|
-
* Format an ISO timestamp in a specific IANA time zone (e.g. `America/Toronto`),
|
|
974
|
-
* so dashboards stop hand-rolling `Intl`. Defaults to a short date-time; pass
|
|
975
|
-
* `opts` to override fields. The `timeZone` is always forced to the argument.
|
|
976
|
-
*/
|
|
977
|
-
declare function formatDateInTz(iso: string, timeZone: string, opts?: Intl.DateTimeFormatOptions, locale?: string): string;
|
|
978
939
|
|
|
979
940
|
/** A business's active service, as returned by `GET /tracking/services`. */
|
|
980
941
|
interface PublicServiceItem {
|
|
@@ -988,4 +949,4 @@ interface PublicServiceItem {
|
|
|
988
949
|
*/
|
|
989
950
|
declare function fetchServices(config: SalesTransportConfig): Promise<PublicServiceItem[]>;
|
|
990
951
|
|
|
991
|
-
export { type
|
|
952
|
+
export { type SalesClientConfig as $, type SaleItem as A, type BusinessConfig as B, type ConversionConfig as C, type DistinctCustomersByCurrency as D, type SaleItemInput as E, type SaleKeysetSortField as F, type Granularity as G, type SaleListPage as H, type SaleListQuery as I, type SaleListQueryV2 as J, type SaleService as K, type SaleServiceInput as L, type SaleSortField as M, NAMED_RANGES as N, type SaleSortOrder as O, type PublicServiceItem as P, type SaleSummary as Q, type SaleSummaryPrevious as R, SUPPORTED_CURRENCIES as S, type TrackingConfigReference as T, type SaleSummaryQuery as U, type SaleSummaryQueryV2 as V, type SaleSummaryV2 as W, type SaleUpdateInput as X, type SalesBusinessClient as Y, type SalesCategoryBreakdown as Z, type SalesClient as _, type BusinessConfigFeatures as a, type SalesCustomersClient as a0, type SalesServiceBreakdown as a1, type SalesTransportConfig as a2, type SalesTrendPoint as a3, type SummaryCurrencyDelta as a4, type SummaryDeltas as a5, type SummaryWindow as a6, type SupportedCurrency as a7, TRACKING_RANGES as a8, type TrackingOverviewRange as a9, clearStashedUserData as aa, createSalesClient as ab, fetchServices as ac, formatMoney as ad, fromMinor as ae, getTrackingConfigRuntime as af, resolveConversionConfig as ag, saleCreateSchema as ah, saleItemSchema as ai, saleServiceSchema as aj, saleUpdateSchema as ak, salesRequest as al, stashUserData as am, toMinor as an, type BusinessConfigService as b, type CompareTo as c, type ConversionConfigStore as d, type ConversionUserData as e, type CurrencyRevenue as f, type CustomerCurrencyDelta as g, type CustomerCurrencyTotal as h, type CustomerGetOptions as i, type CustomerGetResult as j, type CustomerKpis as k, type CustomerKpisDeltas as l, type CustomerKpisPrevious as m, type CustomerListPage as n, type CustomerListQuery as o, type CustomerProfile as p, type CustomerSegment as q, type CustomerSegmentCount as r, type CustomerSortField as s, type CustomerSummary as t, type CustomerSummaryQuery as u, type NamedRange as v, type Sale as w, type SaleCursorPage as x, type SaleFilters as y, type SaleInput as z };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { CountryCode } from 'libphonenumber-js';
|
|
3
|
+
import { A as ApiTransportConfig, a as apiRequest } from './request-Doq36Rt0.js';
|
|
4
|
+
import './date-BHetnL7s.js';
|
|
3
5
|
|
|
4
6
|
/** Raw identifiers a caller may hand us (normalized before use). */
|
|
5
7
|
interface ConversionUserData {
|
|
@@ -815,27 +817,8 @@ interface BusinessConfig {
|
|
|
815
817
|
features: BusinessConfigFeatures;
|
|
816
818
|
}
|
|
817
819
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
/** Public (`aranv_pk_…`) or secret (`aranv_sk_…`) API key. */
|
|
821
|
-
apiKey: string;
|
|
822
|
-
/**
|
|
823
|
-
* Base tracking endpoint, e.g. `https://aranovainternal-production.up.railway.app/tracking`.
|
|
824
|
-
* The `/sales` path is appended by the helpers.
|
|
825
|
-
*/
|
|
826
|
-
endpoint: string;
|
|
827
|
-
/** Optional SDK identity headers (mirrors the event ingest client). */
|
|
828
|
-
sdkVersion?: string;
|
|
829
|
-
packageName?: string;
|
|
830
|
-
surface?: string;
|
|
831
|
-
environment?: string;
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Single awaited request used by every sales helper. Unlike the event queue,
|
|
835
|
-
* this surfaces failures: any non-2xx rejects with an {@link AranovaApiError}.
|
|
836
|
-
* Returns `undefined` for 204 No Content.
|
|
837
|
-
*/
|
|
838
|
-
declare function salesRequest<T>(config: SalesTransportConfig, method: string, path: string, body?: unknown): Promise<T>;
|
|
820
|
+
type SalesTransportConfig = ApiTransportConfig;
|
|
821
|
+
declare const salesRequest: typeof apiRequest;
|
|
839
822
|
|
|
840
823
|
/** Config for {@link createSalesClient}. */
|
|
841
824
|
interface SalesClientConfig extends SalesTransportConfig {
|
|
@@ -937,22 +920,6 @@ interface SalesClient<TService extends string = string, TConversion extends stri
|
|
|
937
920
|
}
|
|
938
921
|
declare function createSalesClient<TService extends string = string, TConversion extends string = string>(config: SalesClientConfig): SalesClient<TService, TConversion>;
|
|
939
922
|
|
|
940
|
-
/**
|
|
941
|
-
* Error thrown by the sales client (`createSalesClient`) on a
|
|
942
|
-
* non-2xx response. Unlike the fire-and-forget event queue (which swallows
|
|
943
|
-
* failures), a sale is a transaction the caller must be able to react to.
|
|
944
|
-
*/
|
|
945
|
-
declare class AranovaApiError extends Error {
|
|
946
|
-
readonly status: number;
|
|
947
|
-
readonly code: string | undefined;
|
|
948
|
-
readonly requestId: string | undefined;
|
|
949
|
-
constructor(message: string, options: {
|
|
950
|
-
status: number;
|
|
951
|
-
code?: string;
|
|
952
|
-
requestId?: string;
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
|
|
956
923
|
/**
|
|
957
924
|
* Convert a major amount (dollars `250.5`) to integer minor units (`25050`).
|
|
958
925
|
*
|
|
@@ -969,12 +936,6 @@ declare function fromMinor(cents: number, currency: SupportedCurrency): number;
|
|
|
969
936
|
* Uses the built-in `Intl.NumberFormat` — no extra dependency.
|
|
970
937
|
*/
|
|
971
938
|
declare function formatMoney(cents: number, currency: SupportedCurrency, locale?: string): string;
|
|
972
|
-
/**
|
|
973
|
-
* Format an ISO timestamp in a specific IANA time zone (e.g. `America/Toronto`),
|
|
974
|
-
* so dashboards stop hand-rolling `Intl`. Defaults to a short date-time; pass
|
|
975
|
-
* `opts` to override fields. The `timeZone` is always forced to the argument.
|
|
976
|
-
*/
|
|
977
|
-
declare function formatDateInTz(iso: string, timeZone: string, opts?: Intl.DateTimeFormatOptions, locale?: string): string;
|
|
978
939
|
|
|
979
940
|
/** A business's active service, as returned by `GET /tracking/services`. */
|
|
980
941
|
interface PublicServiceItem {
|
|
@@ -988,4 +949,4 @@ interface PublicServiceItem {
|
|
|
988
949
|
*/
|
|
989
950
|
declare function fetchServices(config: SalesTransportConfig): Promise<PublicServiceItem[]>;
|
|
990
951
|
|
|
991
|
-
export { type
|
|
952
|
+
export { type SalesClientConfig as $, type SaleItem as A, type BusinessConfig as B, type ConversionConfig as C, type DistinctCustomersByCurrency as D, type SaleItemInput as E, type SaleKeysetSortField as F, type Granularity as G, type SaleListPage as H, type SaleListQuery as I, type SaleListQueryV2 as J, type SaleService as K, type SaleServiceInput as L, type SaleSortField as M, NAMED_RANGES as N, type SaleSortOrder as O, type PublicServiceItem as P, type SaleSummary as Q, type SaleSummaryPrevious as R, SUPPORTED_CURRENCIES as S, type TrackingConfigReference as T, type SaleSummaryQuery as U, type SaleSummaryQueryV2 as V, type SaleSummaryV2 as W, type SaleUpdateInput as X, type SalesBusinessClient as Y, type SalesCategoryBreakdown as Z, type SalesClient as _, type BusinessConfigFeatures as a, type SalesCustomersClient as a0, type SalesServiceBreakdown as a1, type SalesTransportConfig as a2, type SalesTrendPoint as a3, type SummaryCurrencyDelta as a4, type SummaryDeltas as a5, type SummaryWindow as a6, type SupportedCurrency as a7, TRACKING_RANGES as a8, type TrackingOverviewRange as a9, clearStashedUserData as aa, createSalesClient as ab, fetchServices as ac, formatMoney as ad, fromMinor as ae, getTrackingConfigRuntime as af, resolveConversionConfig as ag, saleCreateSchema as ah, saleItemSchema as ai, saleServiceSchema as aj, saleUpdateSchema as ak, salesRequest as al, stashUserData as am, toMinor as an, type BusinessConfigService as b, type CompareTo as c, type ConversionConfigStore as d, type ConversionUserData as e, type CurrencyRevenue as f, type CustomerCurrencyDelta as g, type CustomerCurrencyTotal as h, type CustomerGetOptions as i, type CustomerGetResult as j, type CustomerKpis as k, type CustomerKpisDeltas as l, type CustomerKpisPrevious as m, type CustomerListPage as n, type CustomerListQuery as o, type CustomerProfile as p, type CustomerSegment as q, type CustomerSegmentCount as r, type CustomerSortField as s, type CustomerSummary as t, type CustomerSummaryQuery as u, type NamedRange as v, type Sale as w, type SaleCursorPage as x, type SaleFilters as y, type SaleInput as z };
|
package/dist/sales.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, f as CurrencyRevenue, g as CustomerCurrencyDelta, h as CustomerCurrencyTotal, i as CustomerGetOptions, j as CustomerGetResult, k as CustomerKpis, l as CustomerKpisDeltas, m as CustomerKpisPrevious, n as CustomerListPage, o as CustomerListQuery, p as CustomerProfile, q as CustomerSegment, r as CustomerSegmentCount, s as CustomerSortField, t as CustomerSummary, u as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, v as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, w as Sale, x as SaleCursorPage, y as SaleFilters, z as SaleInput, A as SaleItem, E as SaleItemInput, F as SaleKeysetSortField, H as SaleListPage, I as SaleListQuery, J as SaleListQueryV2, K as SaleService, L as SaleServiceInput, M as SaleSortField, O as SaleSortOrder, Q as SaleSummary, R as SaleSummaryPrevious, U as SaleSummaryQuery, V as SaleSummaryQueryV2, W as SaleSummaryV2, X as SaleUpdateInput, Y as SalesBusinessClient, Z as SalesCategoryBreakdown, _ as SalesClient, $ as SalesClientConfig, a0 as SalesCustomersClient, a1 as SalesServiceBreakdown, a2 as SalesTransportConfig, a3 as SalesTrendPoint, a4 as SummaryCurrencyDelta, a5 as SummaryDeltas, a6 as SummaryWindow, a7 as SupportedCurrency, a8 as TRACKING_RANGES, a9 as TrackingOverviewRange, ab as createSalesClient, ac as fetchServices, ad as formatMoney, ae as fromMinor, ah as saleCreateSchema, ai as saleItemSchema, aj as saleServiceSchema, ak as saleUpdateSchema, al as salesRequest, an as toMinor } from './sales-B3BnYncU.mjs';
|
|
2
|
+
export { A as AranovaApiError, f as formatDateInTz } from './date-BHetnL7s.mjs';
|
|
2
3
|
import 'zod';
|
|
3
4
|
import 'libphonenumber-js';
|
|
5
|
+
import './request-Doq36Rt0.mjs';
|
package/dist/sales.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { B as BusinessConfig, a as BusinessConfigFeatures, b as BusinessConfigService, c as CompareTo, f as CurrencyRevenue, g as CustomerCurrencyDelta, h as CustomerCurrencyTotal, i as CustomerGetOptions, j as CustomerGetResult, k as CustomerKpis, l as CustomerKpisDeltas, m as CustomerKpisPrevious, n as CustomerListPage, o as CustomerListQuery, p as CustomerProfile, q as CustomerSegment, r as CustomerSegmentCount, s as CustomerSortField, t as CustomerSummary, u as CustomerSummaryQuery, D as DistinctCustomersByCurrency, G as Granularity, N as NAMED_RANGES, v as NamedRange, P as PublicServiceItem, S as SUPPORTED_CURRENCIES, w as Sale, x as SaleCursorPage, y as SaleFilters, z as SaleInput, A as SaleItem, E as SaleItemInput, F as SaleKeysetSortField, H as SaleListPage, I as SaleListQuery, J as SaleListQueryV2, K as SaleService, L as SaleServiceInput, M as SaleSortField, O as SaleSortOrder, Q as SaleSummary, R as SaleSummaryPrevious, U as SaleSummaryQuery, V as SaleSummaryQueryV2, W as SaleSummaryV2, X as SaleUpdateInput, Y as SalesBusinessClient, Z as SalesCategoryBreakdown, _ as SalesClient, $ as SalesClientConfig, a0 as SalesCustomersClient, a1 as SalesServiceBreakdown, a2 as SalesTransportConfig, a3 as SalesTrendPoint, a4 as SummaryCurrencyDelta, a5 as SummaryDeltas, a6 as SummaryWindow, a7 as SupportedCurrency, a8 as TRACKING_RANGES, a9 as TrackingOverviewRange, ab as createSalesClient, ac as fetchServices, ad as formatMoney, ae as fromMinor, ah as saleCreateSchema, ai as saleItemSchema, aj as saleServiceSchema, ak as saleUpdateSchema, al as salesRequest, an as toMinor } from './sales-CDjXRdmd.js';
|
|
2
|
+
export { A as AranovaApiError, f as formatDateInTz } from './date-BHetnL7s.js';
|
|
2
3
|
import 'zod';
|
|
3
4
|
import 'libphonenumber-js';
|
|
5
|
+
import './request-Doq36Rt0.js';
|
package/dist/sales.js
CHANGED
|
@@ -234,7 +234,7 @@ var SDK_PACKAGE_HEADER = "X-Aranova-Sdk-Package";
|
|
|
234
234
|
var SDK_SURFACE_HEADER = "X-Aranova-Sdk-Surface";
|
|
235
235
|
var SDK_ENVIRONMENT_HEADER = "X-Aranova-Sdk-Environment";
|
|
236
236
|
|
|
237
|
-
// ../tracking-core/src/resources/
|
|
237
|
+
// ../tracking-core/src/resources/http/errors.ts
|
|
238
238
|
var AranovaApiError = class extends Error {
|
|
239
239
|
constructor(message, options) {
|
|
240
240
|
super(message);
|
|
@@ -245,7 +245,7 @@ var AranovaApiError = class extends Error {
|
|
|
245
245
|
}
|
|
246
246
|
};
|
|
247
247
|
|
|
248
|
-
// ../tracking-core/src/resources/
|
|
248
|
+
// ../tracking-core/src/resources/http/request.ts
|
|
249
249
|
function identityHeaders(config) {
|
|
250
250
|
const headers = { [API_KEY_HEADER]: config.apiKey };
|
|
251
251
|
if (config.sdkVersion) headers[SDK_VERSION_HEADER] = config.sdkVersion;
|
|
@@ -257,8 +257,8 @@ function identityHeaders(config) {
|
|
|
257
257
|
function joinUrl(endpoint, path) {
|
|
258
258
|
return `${endpoint.replace(/\/$/, "")}${path}`;
|
|
259
259
|
}
|
|
260
|
-
async function
|
|
261
|
-
const headers = identityHeaders(config);
|
|
260
|
+
async function apiRequest(config, method, path, body, extraHeaders) {
|
|
261
|
+
const headers = { ...identityHeaders(config), ...extraHeaders };
|
|
262
262
|
if (body !== void 0) headers["Content-Type"] = "application/json";
|
|
263
263
|
const response = await fetch(joinUrl(config.endpoint, path), {
|
|
264
264
|
method,
|
|
@@ -287,6 +287,24 @@ async function salesRequest(config, method, path, body) {
|
|
|
287
287
|
return await response.json();
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
// ../tracking-core/src/resources/sales/transport.ts
|
|
291
|
+
var salesRequest = apiRequest;
|
|
292
|
+
|
|
293
|
+
// ../tracking-core/src/resources/intl/date.ts
|
|
294
|
+
function formatDateInTz(iso, timeZone, opts, locale) {
|
|
295
|
+
const date = new Date(iso);
|
|
296
|
+
if (Number.isNaN(date.getTime())) return iso;
|
|
297
|
+
return new Intl.DateTimeFormat(locale, {
|
|
298
|
+
year: "numeric",
|
|
299
|
+
month: "short",
|
|
300
|
+
day: "2-digit",
|
|
301
|
+
hour: "2-digit",
|
|
302
|
+
minute: "2-digit",
|
|
303
|
+
...opts,
|
|
304
|
+
timeZone
|
|
305
|
+
}).format(date);
|
|
306
|
+
}
|
|
307
|
+
|
|
290
308
|
// ../tracking-core/src/resources/sales/money.ts
|
|
291
309
|
var MINOR_UNIT_EXPONENT = {
|
|
292
310
|
USD: 2,
|
|
@@ -306,19 +324,6 @@ function formatMoney(cents, currency, locale) {
|
|
|
306
324
|
fromMinor(cents, currency)
|
|
307
325
|
);
|
|
308
326
|
}
|
|
309
|
-
function formatDateInTz(iso, timeZone, opts, locale) {
|
|
310
|
-
const date = new Date(iso);
|
|
311
|
-
if (Number.isNaN(date.getTime())) return iso;
|
|
312
|
-
return new Intl.DateTimeFormat(locale, {
|
|
313
|
-
year: "numeric",
|
|
314
|
-
month: "short",
|
|
315
|
-
day: "2-digit",
|
|
316
|
-
hour: "2-digit",
|
|
317
|
-
minute: "2-digit",
|
|
318
|
-
...opts,
|
|
319
|
-
timeZone
|
|
320
|
-
}).format(date);
|
|
321
|
-
}
|
|
322
327
|
|
|
323
328
|
// ../tracking-core/src/resources/sales/client.ts
|
|
324
329
|
function fireRecordedConversions(firing, input, recorded, sale, currency) {
|