@chordcommerce/analytics 1.19.0 → 1.21.0-beta.3

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.
@@ -1,6 +1,6 @@
1
- import type { CartViewed, CheckoutStarted, CheckoutStepCompleted, CheckoutStepViewed, ProductAdded, ProductClicked, VariantClicked, ProductViewed, ProductListViewed, CouponApplied, CouponDenied, CouponEntered, CouponRemoved, EmailCaptured, ProductListFiltered, ProductRemoved, ProductsSearched, SignedIn, SignedOut, SignedUp, LoginStarted, SubscriptionCancelled, NavigationClicked, PaymentInfoEntered } from './typewriter.js';
1
+ import type { CartViewed, CheckoutStarted, CheckoutStepCompleted, CheckoutStepViewed, ProductAdded, ProductClicked, VariantClicked, ProductViewed, ProductListViewed, CouponApplied, CouponDenied, CouponEntered, CouponRemoved, EmailCaptured, ProductListFiltered, ProductRemoved, ProductsSearched, SignedIn, SignedOut, SignedUp, LoginStarted, OrderCompleted, SubscriptionCancelled, NavigationClicked, PaymentInfoEntered } from './typewriter.js';
2
2
  import type { Cart, Checkout, LineItem, Product } from './objects.js';
3
- import type { CartInput, CheckoutInput, CheckoutStepCompletedInput, CheckoutStepViewedInput, LineItemInput, ProductInput, CartViewedInput, CheckoutStartedInput, ProductAddedInput, ProductClickedInput, VariantClickedInput, ProductViewedInput, ProductListViewedInput, ProductListFilteredInput, ProductRemovedInput, CouponAppliedInput, CouponDeniedInput, CouponEnteredInput, CouponRemovedInput, EmailCapturedInput, ProductsSearchedInput, SignedInInput, SignedOutInput, SignedUpInput, LoginStartedInput, SubscriptionCancelledInput, NavigationClickedInput, PaymentInfoEnteredInput } from './input.js';
3
+ import type { CartInput, CheckoutInput, CheckoutStepCompletedInput, CheckoutStepViewedInput, LineItemInput, ProductInput, CartViewedInput, CheckoutStartedInput, ProductAddedInput, ProductClickedInput, VariantClickedInput, ProductViewedInput, ProductListViewedInput, ProductListFilteredInput, ProductRemovedInput, CouponAppliedInput, CouponDeniedInput, CouponEnteredInput, CouponRemovedInput, EmailCapturedInput, ProductsSearchedInput, SignedInInput, SignedOutInput, SignedUpInput, LoginStartedInput, OrderCompletedInput, SubscriptionCancelledInput, NavigationClickedInput, PaymentInfoEnteredInput } from './input.js';
4
4
  import type { ObjectTypes } from './client.js';
5
5
  export type CartFormatter<T = ObjectTypes['Cart']> = (props: CartInput<T>) => Cart;
6
6
  export type CheckoutFormatter<T = ObjectTypes['Checkout']> = (props: CheckoutInput<T>) => Checkout;
@@ -78,6 +78,9 @@ export interface NavigationClickedFormatter {
78
78
  export interface PaymentInfoEnteredFormatter {
79
79
  (props: PaymentInfoEnteredInput, event: PaymentInfoEntered): PaymentInfoEntered;
80
80
  }
81
+ export interface OrderCompletedFormatter {
82
+ (props: OrderCompletedInput, event: OrderCompleted): OrderCompleted;
83
+ }
81
84
  export interface ChordAnalyticsFormatters<T extends ObjectTypes = ObjectTypes> {
82
85
  events?: {
83
86
  cartViewed?: CartViewedFormatter<T>;
@@ -104,6 +107,7 @@ export interface ChordAnalyticsFormatters<T extends ObjectTypes = ObjectTypes> {
104
107
  subscriptionCancelled?: SubscriptionCancelledFormatter;
105
108
  navigationClicked?: NavigationClickedFormatter;
106
109
  paymentInfoEntered?: PaymentInfoEnteredFormatter;
110
+ orderCompleted?: OrderCompletedFormatter;
107
111
  };
108
112
  objects: {
109
113
  cart: CartFormatter<T['Cart']>;
@@ -394,3 +394,248 @@ export interface PaymentInfoEnteredInput<T extends ObjectTypes = ObjectTypes> {
394
394
  */
395
395
  value?: number;
396
396
  }
397
+ export interface OrderCompletedProductInput {
398
+ /**
399
+ * Product affiliation (for example, "Google Store")
400
+ */
401
+ affiliation?: string;
402
+ /**
403
+ * Brand associated with the product
404
+ */
405
+ brand?: string;
406
+ /**
407
+ * Product belongs to a bundle
408
+ */
409
+ bundle?: boolean;
410
+ /**
411
+ * Number of SKUs in the bundle
412
+ */
413
+ bundleSize?: number;
414
+ /**
415
+ * Product category
416
+ */
417
+ category?: string;
418
+ /**
419
+ * Coupon code associated with the product
420
+ */
421
+ coupon?: string;
422
+ /**
423
+ * Quantity sold via cross-selling
424
+ */
425
+ crossSoldQuantity?: number;
426
+ /**
427
+ * Short description of the product
428
+ */
429
+ description?: string;
430
+ /**
431
+ * Image URL of the product
432
+ */
433
+ imageUrl?: string;
434
+ /**
435
+ * Database ID of the line item
436
+ */
437
+ lineItemId?: string;
438
+ /**
439
+ * Name of the product
440
+ */
441
+ name: string;
442
+ /**
443
+ * Option values of the product variant
444
+ */
445
+ optionValues?: string[];
446
+ /**
447
+ * Position in the product list
448
+ */
449
+ position?: number;
450
+ /**
451
+ * Price ($) of the product
452
+ */
453
+ price: number;
454
+ /**
455
+ * Database ID of the product
456
+ */
457
+ productId: string;
458
+ /**
459
+ * Quantity of the product
460
+ */
461
+ quantity: number;
462
+ /**
463
+ * Revenue ($) with discounts and coupons added in
464
+ */
465
+ revenue: number;
466
+ /**
467
+ * SKU of the product variant
468
+ */
469
+ sku: string;
470
+ /**
471
+ * Slug of the product
472
+ */
473
+ slug?: string;
474
+ /**
475
+ * URL of the product page
476
+ */
477
+ url?: string;
478
+ /**
479
+ * Name of the product variant
480
+ */
481
+ variant?: string;
482
+ /**
483
+ * Metadata of the product variant
484
+ */
485
+ variantMetadata?: {
486
+ [key: string]: any;
487
+ };
488
+ [property: string]: any;
489
+ }
490
+ export interface OrderCompletedShippingMethodDetailsInput {
491
+ /**
492
+ * Code of shipping method (for example, "standard_shipping")
493
+ */
494
+ shippingCode?: string;
495
+ /**
496
+ * Name of shipping method (for example, "Standard Shipping")
497
+ */
498
+ shippingMethod?: string;
499
+ }
500
+ export interface OrderCompletedInput {
501
+ /**
502
+ * Store or affiliation from which this transaction occurred
503
+ */
504
+ affiliation?: string;
505
+ /**
506
+ * Order metadata "campaign_id"
507
+ */
508
+ campaignId?: number;
509
+ /**
510
+ * Order category
511
+ */
512
+ category?: string;
513
+ /**
514
+ * Channel where order was placed (for example, "chord")
515
+ */
516
+ channel?: string;
517
+ /**
518
+ * Checkout ID
519
+ */
520
+ checkoutId?: string;
521
+ /**
522
+ * Checkout provider (for example, "stripe")
523
+ */
524
+ checkoutType?: string;
525
+ /**
526
+ * Transaction coupon redeemed with the transaction
527
+ */
528
+ coupon?: string;
529
+ /**
530
+ * Currency code of the transaction (for example, "USD")
531
+ */
532
+ currency: string;
533
+ /**
534
+ * Total discount associated with the transaction
535
+ */
536
+ discount?: number;
537
+ /**
538
+ * Email address associated with the order
539
+ */
540
+ email?: string;
541
+ /**
542
+ * First name in the shipping address for the order
543
+ */
544
+ firstName?: string;
545
+ /**
546
+ * Order contains a subscription
547
+ */
548
+ hasSubscription?: boolean;
549
+ /**
550
+ * Order is a recurring subscription order
551
+ */
552
+ isRecurring?: boolean;
553
+ /**
554
+ * Last name in the shipping address for the order
555
+ */
556
+ lastName?: string;
557
+ /**
558
+ * Metadata of the order
559
+ */
560
+ metadata?: {
561
+ [key: string]: any;
562
+ };
563
+ /**
564
+ * Date and time order was placed
565
+ */
566
+ orderDate: string;
567
+ /**
568
+ * Order/transaction ID
569
+ */
570
+ orderId: string;
571
+ /**
572
+ * Phone number associated with the order
573
+ */
574
+ phone?: string;
575
+ /**
576
+ * Products in the order
577
+ */
578
+ products: OrderCompletedProductInput[];
579
+ /**
580
+ * URL for customer to share to receive referral credit
581
+ */
582
+ purlLink?: string;
583
+ /**
584
+ * ID for referral that customer used to place the order
585
+ */
586
+ referralIdentifierId?: string;
587
+ /**
588
+ * Indicates whether the customer is new or returning
589
+ */
590
+ repeat?: boolean;
591
+ /**
592
+ * Revenue ($) associated with the transaction (excluding shipping and tax)
593
+ */
594
+ revenue: number;
595
+ /**
596
+ * Shipping cost associated with the transaction
597
+ */
598
+ shipping?: number;
599
+ /**
600
+ * City in the shipping address for the order
601
+ */
602
+ shippingCity?: string;
603
+ /**
604
+ * Country in the shipping address for the order
605
+ */
606
+ shippingCountry?: string;
607
+ /**
608
+ * Shipping method details
609
+ */
610
+ shippingMethodDetails?: OrderCompletedShippingMethodDetailsInput;
611
+ /**
612
+ * State in the shipping address for the order
613
+ */
614
+ shippingState?: string;
615
+ /**
616
+ * Zipcode in the shipping address for the order
617
+ */
618
+ shippingZipcode?: string;
619
+ /**
620
+ * Order total after discounts but before taxes and shipping
621
+ */
622
+ subtotal?: number;
623
+ /**
624
+ * Total tax associated with the transaction
625
+ */
626
+ tax?: number;
627
+ /**
628
+ * Order metadata "template_id"
629
+ */
630
+ templateId?: number;
631
+ /**
632
+ * Revenue ($) with discounts and coupons added in
633
+ */
634
+ total: number;
635
+ /**
636
+ * Tracking IDs for third party integrations
637
+ */
638
+ trackingIds?: {
639
+ [key: string]: any;
640
+ };
641
+ }
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.19.0",
4
+ "version": "1.21.0-beta.3",
5
5
  "author": "Chord Commerce <help@chord.co> (https://www.chord.co)",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",