@chordcommerce/analytics 1.12.2 → 1.13.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.
@@ -67,7 +67,7 @@ export declare class ChordAnalytics<T extends ObjectTypes = ObjectTypes> {
67
67
  * Send a `page` event to the CDP.
68
68
  */
69
69
  page: {
70
- (): void;
70
+ (props?: Record<string, any>): void;
71
71
  };
72
72
  reset: () => void;
73
73
  trackCartViewed: (props: CartViewedInput<T>, options?: AnyOptions) => Promise<void>;
@@ -167,19 +167,19 @@ export class ChordAnalytics {
167
167
  /**
168
168
  * Send a `page` event to the CDP.
169
169
  */
170
- this.page = () => {
170
+ this.page = (props = {}) => {
171
171
  try {
172
172
  const pagePromises = [];
173
173
  const a = this.ccdp();
174
174
  if (a && typeof a.page === 'function') {
175
175
  pagePromises.push(new Promise((resolve) => {
176
- a.page({ meta: this.meta() }, () => resolve());
176
+ a.page(Object.assign(Object.assign({}, props), { meta: this.meta() }), () => resolve());
177
177
  }));
178
178
  }
179
179
  const b = this.cdp();
180
180
  if (b && typeof b.page === 'function') {
181
181
  pagePromises.push(new Promise((resolve) => {
182
- b.page({ meta: this.meta() }, () => resolve());
182
+ b.page(Object.assign(Object.assign({}, props), { meta: this.meta() }), () => resolve());
183
183
  }));
184
184
  }
185
185
  // We don't return the promise to maintain the void return type
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.12.2",
4
+ "version": "1.13.0",
5
5
  "author": "Chord Commerce <help@chord.co> (https://www.chord.co)",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",