@aranova/tracking-react 0.20.1 → 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/dist/sales.mjs CHANGED
@@ -194,7 +194,7 @@ var SDK_PACKAGE_HEADER = "X-Aranova-Sdk-Package";
194
194
  var SDK_SURFACE_HEADER = "X-Aranova-Sdk-Surface";
195
195
  var SDK_ENVIRONMENT_HEADER = "X-Aranova-Sdk-Environment";
196
196
 
197
- // ../tracking-core/src/resources/sales/errors.ts
197
+ // ../tracking-core/src/resources/http/errors.ts
198
198
  var AranovaApiError = class extends Error {
199
199
  constructor(message, options) {
200
200
  super(message);
@@ -205,7 +205,7 @@ var AranovaApiError = class extends Error {
205
205
  }
206
206
  };
207
207
 
208
- // ../tracking-core/src/resources/sales/transport.ts
208
+ // ../tracking-core/src/resources/http/request.ts
209
209
  function identityHeaders(config) {
210
210
  const headers = { [API_KEY_HEADER]: config.apiKey };
211
211
  if (config.sdkVersion) headers[SDK_VERSION_HEADER] = config.sdkVersion;
@@ -217,8 +217,8 @@ function identityHeaders(config) {
217
217
  function joinUrl(endpoint, path) {
218
218
  return `${endpoint.replace(/\/$/, "")}${path}`;
219
219
  }
220
- async function salesRequest(config, method, path, body) {
221
- const headers = identityHeaders(config);
220
+ async function apiRequest(config, method, path, body, extraHeaders) {
221
+ const headers = { ...identityHeaders(config), ...extraHeaders };
222
222
  if (body !== void 0) headers["Content-Type"] = "application/json";
223
223
  const response = await fetch(joinUrl(config.endpoint, path), {
224
224
  method,
@@ -247,6 +247,24 @@ async function salesRequest(config, method, path, body) {
247
247
  return await response.json();
248
248
  }
249
249
 
250
+ // ../tracking-core/src/resources/sales/transport.ts
251
+ var salesRequest = apiRequest;
252
+
253
+ // ../tracking-core/src/resources/intl/date.ts
254
+ function formatDateInTz(iso, timeZone, opts, locale) {
255
+ const date = new Date(iso);
256
+ if (Number.isNaN(date.getTime())) return iso;
257
+ return new Intl.DateTimeFormat(locale, {
258
+ year: "numeric",
259
+ month: "short",
260
+ day: "2-digit",
261
+ hour: "2-digit",
262
+ minute: "2-digit",
263
+ ...opts,
264
+ timeZone
265
+ }).format(date);
266
+ }
267
+
250
268
  // ../tracking-core/src/resources/sales/money.ts
251
269
  var MINOR_UNIT_EXPONENT = {
252
270
  USD: 2,
@@ -266,19 +284,6 @@ function formatMoney(cents, currency, locale) {
266
284
  fromMinor(cents, currency)
267
285
  );
268
286
  }
269
- function formatDateInTz(iso, timeZone, opts, locale) {
270
- const date = new Date(iso);
271
- if (Number.isNaN(date.getTime())) return iso;
272
- return new Intl.DateTimeFormat(locale, {
273
- year: "numeric",
274
- month: "short",
275
- day: "2-digit",
276
- hour: "2-digit",
277
- minute: "2-digit",
278
- ...opts,
279
- timeZone
280
- }).format(date);
281
- }
282
287
 
283
288
  // ../tracking-core/src/resources/sales/client.ts
284
289
  function fireRecordedConversions(firing, input, recorded, sale, currency) {