@chordcommerce/analytics 1.24.1 → 1.24.2

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 CHANGED
@@ -127,7 +127,7 @@ event in that order.
127
127
 
128
128
  A middleware may be synchronous or asynchronous. Synchronous middleware is never
129
129
  awaited, so it adds no delay to event delivery. Asynchronous middleware is
130
- awaited before the event is sent, capped at one second — a middleware that has
130
+ awaited before the event is sent, capped at three seconds — a middleware that has
131
131
  not resolved by then is abandoned, a warning is logged, and the event is sent
132
132
  without its properties. A middleware that throws or rejects is logged and
133
133
  skipped. A middleware never prevents an event from being sent.
@@ -174,7 +174,7 @@ Useage Example
174
174
  };
175
175
  });
176
176
 
177
- // Asynchronous middleware: the event waits for the lookup, up to one second.
177
+ // Asynchronous middleware: the event waits for the lookup, up to three seconds.
178
178
  analytics.addSourceMiddleware(async ({ payload }) => {
179
179
  if (payload.obj.event !== 'Order Completed') return;
180
180
 
@@ -7,8 +7,17 @@ export declare const pruneNullValues: (props: EventProperties) => EventPropertie
7
7
  * Middleware runs on the path to the CDP, so an unbounded wait would let one
8
8
  * slow lookup hold up delivery indefinitely. `Order Completed` in particular
9
9
  * fires on a confirmation page shoppers close, so a late event is a lost one.
10
+ *
11
+ * The cap has to clear the work real middleware does. The case this was built
12
+ * for looks up an order count to decide whether a shopper is new, which costs
13
+ * an auth token and then the lookup itself -- two sequential round trips. That
14
+ * measured 811ms from a warm browser console, and an order confirmation page,
15
+ * still mounting and with other events in flight, is slower than a console. At
16
+ * one second it was dropping its properties in the field; three gives the
17
+ * round trips room without holding an event long enough for a shopper to
18
+ * navigate away from it.
10
19
  */
11
- export declare const MIDDLEWARE_TIMEOUT_MS = 1000;
20
+ export declare const MIDDLEWARE_TIMEOUT_MS = 3000;
12
21
  /** Returned by {@link withTimeout} when the promise did not settle in time. */
13
22
  export declare const TIMED_OUT: unique symbol;
14
23
  export declare const isPromise: (value: unknown) => value is Promise<unknown>;
package/dist/cjs/utils.js CHANGED
@@ -66,8 +66,17 @@ exports.pruneNullValues = pruneNullValues;
66
66
  * Middleware runs on the path to the CDP, so an unbounded wait would let one
67
67
  * slow lookup hold up delivery indefinitely. `Order Completed` in particular
68
68
  * fires on a confirmation page shoppers close, so a late event is a lost one.
69
+ *
70
+ * The cap has to clear the work real middleware does. The case this was built
71
+ * for looks up an order count to decide whether a shopper is new, which costs
72
+ * an auth token and then the lookup itself -- two sequential round trips. That
73
+ * measured 811ms from a warm browser console, and an order confirmation page,
74
+ * still mounting and with other events in flight, is slower than a console. At
75
+ * one second it was dropping its properties in the field; three gives the
76
+ * round trips room without holding an event long enough for a shopper to
77
+ * navigate away from it.
69
78
  */
70
- exports.MIDDLEWARE_TIMEOUT_MS = 1000;
79
+ exports.MIDDLEWARE_TIMEOUT_MS = 3000;
71
80
  /** Returned by {@link withTimeout} when the promise did not settle in time. */
72
81
  exports.TIMED_OUT = Symbol('timed-out');
73
82
  var isPromise = function (value) {
package/dist/utils.d.ts CHANGED
@@ -7,8 +7,17 @@ export declare const pruneNullValues: (props: EventProperties) => EventPropertie
7
7
  * Middleware runs on the path to the CDP, so an unbounded wait would let one
8
8
  * slow lookup hold up delivery indefinitely. `Order Completed` in particular
9
9
  * fires on a confirmation page shoppers close, so a late event is a lost one.
10
+ *
11
+ * The cap has to clear the work real middleware does. The case this was built
12
+ * for looks up an order count to decide whether a shopper is new, which costs
13
+ * an auth token and then the lookup itself -- two sequential round trips. That
14
+ * measured 811ms from a warm browser console, and an order confirmation page,
15
+ * still mounting and with other events in flight, is slower than a console. At
16
+ * one second it was dropping its properties in the field; three gives the
17
+ * round trips room without holding an event long enough for a shopper to
18
+ * navigate away from it.
10
19
  */
11
- export declare const MIDDLEWARE_TIMEOUT_MS = 1000;
20
+ export declare const MIDDLEWARE_TIMEOUT_MS = 3000;
12
21
  /** Returned by {@link withTimeout} when the promise did not settle in time. */
13
22
  export declare const TIMED_OUT: unique symbol;
14
23
  export declare const isPromise: (value: unknown) => value is Promise<unknown>;
package/dist/utils.js CHANGED
@@ -35,8 +35,17 @@ export const pruneNullValues = (props) => {
35
35
  * Middleware runs on the path to the CDP, so an unbounded wait would let one
36
36
  * slow lookup hold up delivery indefinitely. `Order Completed` in particular
37
37
  * fires on a confirmation page shoppers close, so a late event is a lost one.
38
+ *
39
+ * The cap has to clear the work real middleware does. The case this was built
40
+ * for looks up an order count to decide whether a shopper is new, which costs
41
+ * an auth token and then the lookup itself -- two sequential round trips. That
42
+ * measured 811ms from a warm browser console, and an order confirmation page,
43
+ * still mounting and with other events in flight, is slower than a console. At
44
+ * one second it was dropping its properties in the field; three gives the
45
+ * round trips room without holding an event long enough for a shopper to
46
+ * navigate away from it.
38
47
  */
39
- export const MIDDLEWARE_TIMEOUT_MS = 1000;
48
+ export const MIDDLEWARE_TIMEOUT_MS = 3000;
40
49
  /** Returned by {@link withTimeout} when the promise did not settle in time. */
41
50
  export const TIMED_OUT = Symbol('timed-out');
42
51
  export const isPromise = (value) => typeof (value === null || value === void 0 ? void 0 : value.then) === 'function';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chordcommerce/analytics",
3
3
  "description": "Chord Commerce event tracking",
4
- "version": "1.24.1",
4
+ "version": "1.24.2",
5
5
  "author": "Chord Commerce <help@chord.co> (https://www.chord.co)",
6
6
  "repository": {
7
7
  "type": "git",