@cohostvip/cohost-node 0.1.14 → 0.1.16

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/index.d.mts CHANGED
@@ -370,6 +370,7 @@ interface CostComponent {
370
370
  ops: CostOp[];
371
371
  cap?: CostComponentCap;
372
372
  rules: CostComponentRule[];
373
+ enabled?: boolean;
373
374
  version: "2025-03-25";
374
375
  }
375
376
  interface CalculatedCostComponent extends Omit<CostComponent, "ops" | "cap" | "rules" | "details" | "currency"> {
@@ -456,6 +457,16 @@ interface Offering extends DataRecord {
456
457
  * @ignore
457
458
  */
458
459
  costComponents?: CostComponent[];
460
+ meta?: {
461
+ [key: string]: any;
462
+ };
463
+ config?: {
464
+ groups?: OfferingPurchaseGroupSetting;
465
+ };
466
+ }
467
+ interface OfferingPurchaseGroupSetting {
468
+ enabled: boolean;
469
+ autoGenerateGroupId?: boolean;
459
470
  }
460
471
  interface OfferingOptionsGroup {
461
472
  id: string;
@@ -474,6 +485,7 @@ interface PackageInclude {
474
485
  quantity: number;
475
486
  type: OfferingType;
476
487
  description: string;
488
+ name?: string;
477
489
  /**
478
490
  * path to the offering doc in the db.
479
491
  */
@@ -492,24 +504,401 @@ interface Ticket extends Omit<Offering, "hidden" | "constraints" | "type"> {
492
504
  refId?: string;
493
505
  }
494
506
  /**
495
- * Person interface
496
- */
507
+ * Represents a physical address with comprehensive localization support.
508
+ *
509
+ * @interface Address
510
+ * @example
511
+ * ```typescript
512
+ * // Basic US address
513
+ * const usAddress: Address = {
514
+ * address_1: "123 Main Street",
515
+ * address_2: "Apt 4B",
516
+ * city: "New York",
517
+ * country: "US",
518
+ * postal_code: "10001",
519
+ * region: "NY"
520
+ * };
521
+ *
522
+ * // US address with premise
523
+ * const businessAddress: Address = {
524
+ * address_1: "1600 Pennsylvania Avenue NW",
525
+ * city: "Washington",
526
+ * country: "US",
527
+ * premise: "West Wing",
528
+ * postal_code: "20500",
529
+ * region: "DC"
530
+ * };
531
+ *
532
+ * // US address with formatting
533
+ * const formattedAddress: Address = {
534
+ * address_1: "350 Fifth Avenue",
535
+ * city: "New York",
536
+ * country: "US",
537
+ * postal_code: "10118",
538
+ * region: "NY",
539
+ * formattedAddress: "350 Fifth Avenue, New York, NY 10118, US",
540
+ * localized_multi_line_address_display: [
541
+ * "350 Fifth Avenue",
542
+ * "New York, NY 10118"
543
+ * ]
544
+ * };
545
+ * ```
546
+ */
547
+ interface Address {
548
+ /**
549
+ * Primary street address line.
550
+ *
551
+ * @example "123 Main Street"
552
+ * @example "1600 Pennsylvania Avenue NW"
553
+ */
554
+ address_1: string;
555
+ /**
556
+ * Secondary address line for apartment, suite, or unit numbers.
557
+ *
558
+ * @example "Apt 4B"
559
+ * @example "Suite 100"
560
+ * @example "Unit 12"
561
+ */
562
+ address_2?: string;
563
+ /**
564
+ * City or locality name.
565
+ *
566
+ * @example "New York"
567
+ * @example "San Francisco"
568
+ * @example "Chicago"
569
+ */
570
+ city: string;
571
+ /**
572
+ * ISO 3166-1 alpha-2 country code.
573
+ *
574
+ * @example "US" // United States
575
+ */
576
+ country: string;
577
+ /**
578
+ * Building or premise identifier (building name, floor, etc.).
579
+ *
580
+ * @example "Building A"
581
+ * @example "3rd Floor"
582
+ * @example "West Wing"
583
+ */
584
+ premise?: string;
585
+ /**
586
+ * Complete formatted address as a single string.
587
+ * Useful for display purposes or geocoding services.
588
+ *
589
+ * @example "123 Main Street, Apt 4B, New York, NY 10001, US"
590
+ * @example "1600 Pennsylvania Avenue NW, Washington, DC 20500, US"
591
+ */
592
+ formattedAddress?: string;
593
+ /**
594
+ * Localized version of the complete address.
595
+ * For US addresses, typically the same as the standard format.
596
+ *
597
+ * @example "123 Main Street, New York, NY 10001"
598
+ */
599
+ localized_address_display?: string;
600
+ /**
601
+ * Localized area/region display combining city and state.
602
+ *
603
+ * @example "Brooklyn, NY"
604
+ * @example "Los Angeles, CA"
605
+ * @example "Miami, FL"
606
+ */
607
+ localized_area_display?: string;
608
+ /**
609
+ * Multi-line address display as an array of strings.
610
+ * Each element represents a line for proper address formatting on labels or forms.
611
+ *
612
+ * @example
613
+ * [
614
+ * "123 Main Street",
615
+ * "Apt 4B",
616
+ * "New York, NY 10001"
617
+ * ]
618
+ *
619
+ * @example
620
+ * [
621
+ * "350 Fifth Avenue",
622
+ * "New York, NY 10118"
623
+ * ]
624
+ */
625
+ localized_multi_line_address_display?: string[];
626
+ /**
627
+ * US ZIP code or ZIP+4 format.
628
+ *
629
+ * @example "10001" // Standard ZIP
630
+ * @example "10001-1234" // ZIP+4 format
631
+ * @example "90210" // Beverly Hills ZIP
632
+ */
633
+ postal_code: string;
634
+ /**
635
+ * US state or territory 2-letter abbreviation.
636
+ *
637
+ * @example "NY" // New York
638
+ * @example "CA" // California
639
+ * @example "TX" // Texas
640
+ * @example "DC" // District of Columbia
641
+ */
642
+ region: string;
643
+ }
644
+ /**
645
+ * Represents a person with basic identity information.
646
+ *
647
+ * @interface Person
648
+ * @example
649
+ * ```typescript
650
+ * const person: Person = {
651
+ * name: "John Michael Smith",
652
+ * displayName: "John Smith",
653
+ * first: "John",
654
+ * last: "Smith",
655
+ * gender: "male",
656
+ * birthdate: "1990-05-15",
657
+ * age: 33,
658
+ * photoURL: "https://example.com/photos/john-smith.jpg"
659
+ * };
660
+ * ```
661
+ */
497
662
  interface Person {
663
+ /**
664
+ * Full name of the person.
665
+ *
666
+ * @example "John Michael Smith"
667
+ * @example "Sarah Johnson"
668
+ */
498
669
  name: string;
670
+ /**
671
+ * URL to the person's profile photo or avatar.
672
+ * Can be null if no photo is available.
673
+ *
674
+ * @example "https://example.com/photos/john-smith.jpg"
675
+ * @example "https://cdn.example.com/avatars/user123.png"
676
+ * @example null
677
+ */
499
678
  photoURL?: string | null;
679
+ /**
680
+ * Preferred display name for the person.
681
+ * Often a shortened or preferred version of their full name.
682
+ *
683
+ * @example "John Smith"
684
+ * @example "Mike"
685
+ * @example "Dr. Johnson"
686
+ */
500
687
  displayName: string;
688
+ /**
689
+ * First name or given name.
690
+ *
691
+ * @example "John"
692
+ * @example "Sarah"
693
+ * @example "Michael"
694
+ */
501
695
  first: string;
696
+ /**
697
+ * Last name or family name.
698
+ *
699
+ * @example "Smith"
700
+ * @example "Johnson"
701
+ * @example "Williams"
702
+ */
502
703
  last: string;
704
+ /**
705
+ * Gender identity of the person.
706
+ * Can be null if not specified or prefer not to answer.
707
+ *
708
+ * @example "male"
709
+ * @example "female"
710
+ * @example "other"
711
+ * @example null
712
+ */
503
713
  gender: null | string | "male" | "female" | "other";
714
+ /**
715
+ * Date of birth in ISO 8601 format (YYYY-MM-DD).
716
+ * Can be null if not provided.
717
+ *
718
+ * @example "1990-05-15"
719
+ * @example "1985-12-25"
720
+ * @example null
721
+ */
504
722
  birthdate?: string | null;
723
+ /**
724
+ * Current age in years.
725
+ * Typically calculated from birthdate.
726
+ *
727
+ * @example 33
728
+ * @example 28
729
+ * @example 45
730
+ */
505
731
  age?: number;
506
732
  }
733
+ /**
734
+ * Contact information for a person.
735
+ *
736
+ * @interface PersonContact
737
+ * @example
738
+ * ```typescript
739
+ * const contact: PersonContact = {
740
+ * email: "john.smith@example.com",
741
+ * phone: "+1-555-123-4567"
742
+ * };
743
+ *
744
+ * // Minimal contact with only email
745
+ * const emailOnly: PersonContact = {
746
+ * email: "sarah@example.com",
747
+ * phone: null
748
+ * };
749
+ * ```
750
+ */
507
751
  interface PersonContact {
752
+ /**
753
+ * Primary email address.
754
+ * Can be null if no email is provided.
755
+ *
756
+ * @example "john.smith@example.com"
757
+ * @example "user123@gmail.com"
758
+ * @example null
759
+ */
508
760
  email: string | null;
761
+ /**
762
+ * Primary phone number.
763
+ * Can be null if no phone number is provided.
764
+ * Format may vary (with/without country code, formatting).
765
+ *
766
+ * @example "+1-555-123-4567"
767
+ * @example "(555) 123-4567"
768
+ * @example "5551234567"
769
+ * @example null
770
+ */
509
771
  phone: string | null;
510
772
  }
773
+ /**
774
+ * Address information with associated person's name.
775
+ * Extends the base Address interface with first and last name fields.
776
+ * Useful for shipping/billing addresses where the recipient name may differ from the customer.
777
+ *
778
+ * @interface PersonAddress
779
+ * @extends Address
780
+ * @example
781
+ * ```typescript
782
+ * const shippingAddress: PersonAddress = {
783
+ * first: "John",
784
+ * last: "Smith",
785
+ * address_1: "123 Main Street",
786
+ * address_2: "Apt 4B",
787
+ * city: "New York",
788
+ * country: "US",
789
+ * postal_code: "10001",
790
+ * region: "NY"
791
+ * };
792
+ *
793
+ * // Gift shipping to different recipient
794
+ * const giftAddress: PersonAddress = {
795
+ * first: "Jane",
796
+ * last: "Doe",
797
+ * address_1: "456 Oak Avenue",
798
+ * city: "Los Angeles",
799
+ * country: "US",
800
+ * postal_code: "90210",
801
+ * region: "CA"
802
+ * };
803
+ * ```
804
+ */
805
+ interface PersonAddress extends Address {
806
+ /**
807
+ * First name of the person at this address.
808
+ * May differ from the customer's name for gift deliveries.
809
+ *
810
+ * @example "John"
811
+ * @example "Jane"
812
+ */
813
+ first: string;
814
+ /**
815
+ * Last name of the person at this address.
816
+ * May differ from the customer's name for gift deliveries.
817
+ *
818
+ * @example "Smith"
819
+ * @example "Doe"
820
+ */
821
+ last: string;
822
+ }
823
+ /**
824
+ * Complete customer information combining personal details, contact info, and addresses.
825
+ * Represents a customer in an e-commerce or service system.
826
+ *
827
+ * @type Customer
828
+ * @example
829
+ * ```typescript
830
+ * const customer: Customer = {
831
+ * uid: "user_abc123",
832
+ * name: "John Michael Smith",
833
+ * displayName: "John Smith",
834
+ * first: "John",
835
+ * last: "Smith",
836
+ * gender: "male",
837
+ * birthdate: "1990-05-15",
838
+ * age: 33,
839
+ * email: "john.smith@example.com",
840
+ * phone: "+1-555-123-4567",
841
+ * billingAddress: {
842
+ * first: "John",
843
+ * last: "Smith",
844
+ * address_1: "123 Main Street",
845
+ * city: "New York",
846
+ * country: "US",
847
+ * postal_code: "10001",
848
+ * region: "NY"
849
+ * },
850
+ * shippingAddress: {
851
+ * first: "John",
852
+ * last: "Smith",
853
+ * address_1: "456 Work Plaza",
854
+ * address_2: "Suite 100",
855
+ * city: "New York",
856
+ * country: "US",
857
+ * postal_code: "10005",
858
+ * region: "NY"
859
+ * }
860
+ * };
861
+ *
862
+ * // Guest customer (no account)
863
+ * const guestCustomer: Customer = {
864
+ * uid: null,
865
+ * name: "Jane Doe",
866
+ * displayName: "Jane Doe",
867
+ * first: "Jane",
868
+ * last: "Doe",
869
+ * gender: null,
870
+ * email: "jane@example.com",
871
+ * phone: null
872
+ * };
873
+ * ```
874
+ */
511
875
  type Customer = Person & PersonContact & {
876
+ /**
877
+ * Unique identifier for the customer account.
878
+ * Can be null for guest customers who haven't created an account.
879
+ *
880
+ * @example "user_abc123"
881
+ * @example "cust_def456"
882
+ * @example null // Guest customer
883
+ */
512
884
  uid: string | null;
885
+ /**
886
+ * Billing address for payment and invoicing.
887
+ * Can be null if not yet provided.
888
+ *
889
+ * @example PersonAddress object with billing details
890
+ * @example null
891
+ */
892
+ billingAddress?: PersonAddress | null;
893
+ /**
894
+ * Shipping address for order delivery.
895
+ * Can be null for digital products or if not yet provided.
896
+ * May differ from billing address.
897
+ *
898
+ * @example PersonAddress object with shipping details
899
+ * @example null
900
+ */
901
+ shippingAddress?: PersonAddress | null;
513
902
  };
514
903
  type AttendeeStatus = "attending" | "checkedIn" | "cancelled" | "refunded" | "noShow" | "unknown" | string;
515
904
  interface Attendee extends DataRecord {
@@ -557,19 +946,6 @@ interface EventFeature {
557
946
  meta?: any;
558
947
  data: any;
559
948
  }
560
- interface Address {
561
- address_1: string;
562
- address_2?: string;
563
- city: string;
564
- country: string;
565
- premise?: string;
566
- formattedAddress?: string;
567
- localized_address_display?: string;
568
- localized_area_display?: string;
569
- localized_multi_line_address_display?: string[];
570
- postal_code: string;
571
- region: string;
572
- }
573
949
  /**
574
950
  * A simple point geometry consisting of latitude and longitude.
575
951
  *
@@ -916,7 +1292,7 @@ interface OrderItem {
916
1292
  * @example "item_abc123"
917
1293
  */
918
1294
  id: string;
919
- tableCommitmentId: string | null;
1295
+ purchaseGroupId: string | null;
920
1296
  tableCommitment?: {
921
1297
  id: string;
922
1298
  groupSize: number;
@@ -957,7 +1333,10 @@ interface OrderItem {
957
1333
  * This can include custom fields or additional information.
958
1334
  * @example { "customField": "value" }
959
1335
  */
960
- meta: any;
1336
+ meta?: null | {
1337
+ groups?: OfferingPurchaseGroupSetting;
1338
+ [key: string]: any;
1339
+ };
961
1340
  details: string | null;
962
1341
  options: any | null;
963
1342
  offering: OrderItemOffering;
@@ -1225,7 +1604,7 @@ type StartCartSessionInput = {
1225
1604
  sessionContext: Partial<OrderContext$1>;
1226
1605
  };
1227
1606
  type CartSessionItemOffering = OrderItemOffering & Pick<Offering, "options" | "maximumQuantity" | "minimumQuantity" | "status" | "includes">;
1228
- type CartSessionItem = Pick<OrderItem, "id" | "details" | "offeringId" | "quantity" | "options" | "tableCommitmentId"> & {
1607
+ type CartSessionItem = Pick<OrderItem, "id" | "details" | "offeringId" | "quantity" | "options" | "purchaseGroupId"> & {
1229
1608
  costs?: OrderItemCosts;
1230
1609
  offering: CartSessionItemOffering;
1231
1610
  };
@@ -1235,8 +1614,9 @@ type CartSessionItem = Pick<OrderItem, "id" | "details" | "offeringId" | "quanti
1235
1614
  *
1236
1615
  * @export
1237
1616
  */
1238
- interface CartSession extends DataRecord, Pick<Order, "currency" | "contextId" | "version" | "coupons" | "companyId" | "organizerId" | "meta"> {
1617
+ interface CartSession extends DataRecord, Pick<Order, "currency" | "contextId" | "version" | "coupons" | "companyId" | "organizerId"> {
1239
1618
  orderId?: string;
1619
+ orderNumber?: string;
1240
1620
  /**
1241
1621
  * Authenticated user ID, if available.
1242
1622
  * @example "uid_123abc"
@@ -1290,8 +1670,36 @@ interface CartSession extends DataRecord, Pick<Order, "currency" | "contextId" |
1290
1670
  * Customer answers
1291
1671
  */
1292
1672
  customerAnswers?: any;
1293
- status: "started" | "completed" | "abandoned" | "cancelled";
1673
+ status: "started" | "completed" | "stale" | "abandoned" | "cancelled";
1674
+ meta: CartSessionMeta;
1294
1675
  }
1676
+ type StaleMeta = {
1677
+ /**
1678
+ * Hard stale time in milliseconds.
1679
+ * After this time, the cart is considered abandoned.
1680
+ */
1681
+ hard: number;
1682
+ /**
1683
+ * Soft stale time in milliseconds.
1684
+ * After this time, the cart is considered abandoned.
1685
+ * This is the last change+idle, no later than hard time.
1686
+ */
1687
+ soft: number;
1688
+ /**
1689
+ * Idle time in milliseconds.s
1690
+ */
1691
+ idle: number;
1692
+ };
1693
+ type CartSessionMeta = Partial<Pick<Order, "meta">> & {
1694
+ paymentIntent?: any;
1695
+ /** policy for cart to become abandon */
1696
+ stale: StaleMeta;
1697
+ /**
1698
+ * Any additional internal system flags, A/B test conditions, or
1699
+ * non-critical partner payloads.
1700
+ */
1701
+ [key: string]: any;
1702
+ };
1295
1703
  type UpdatableCartSession = Pick<CartSession, "customer" | "items" | "customerAnswers" | "forwarded">;
1296
1704
 
1297
1705
  /**
@@ -1616,4 +2024,4 @@ declare class CohostClient {
1616
2024
  */
1617
2025
  declare function createCohostClient(options: CohostClientOptions): CohostClient;
1618
2026
 
1619
- export { type ActiveOfferingStatus, type Address, type ApiVersion, type Attendee, type AttendeeStatus, type BuzzBuilder, type CalculatedCostComponent, type CartSession, type CartSessionItem, type CartSessionItemOffering, CohostClient, type CohostClientSettings, type ContextId, type CostBase, type CostBucket, type CostComponent, type CostComponentCap, type CostComponentRule, type CostComponentRuleCondition, type CostOp, type Coupon, type CouponSummary, type CurrencyAmount, type Customer, type DataRecord, type EqualOperator, type EventBase, type EventFeature, type EventProfile, type EventStatus, type GeometryPoint, type Location, type LocationGeometry, type MultipartText, type Offering, type OfferingCosts, type OfferingOption, type OfferingOptionsGroup, type OfferingStatus, type OfferingType, type Order, type OrderContext, type OrderCosts, type OrderItem, type OrderItemCosts, type OrderItemOffering, type OrderStatus, type PackageInclude, type PaginatedRequest, type PaginatedResponse, type Pagination$1 as Pagination, type PaginationResponse, type Person, type PersonContact, type Photo, type PriceCategory, type ResolvedCartContext, type ResolvedCartContextOffering, type Schedule, type StartCartSessionInput, type StructuredCost, type StructuredDate, type Ticket, type TimeOrOffset, type UpdatableCartSession, type VCDataRecord, type Venue, type VenueBase, type VersionedDataRecord, createCohostClient };
2027
+ export { type ActiveOfferingStatus, type Address, type ApiVersion, type Attendee, type AttendeeStatus, type BuzzBuilder, type CalculatedCostComponent, type CartSession, type CartSessionItem, type CartSessionItemOffering, type CartSessionMeta, CohostClient, type CohostClientSettings, type ContextId, type CostBase, type CostBucket, type CostComponent, type CostComponentCap, type CostComponentRule, type CostComponentRuleCondition, type CostOp, type Coupon, type CouponSummary, type CurrencyAmount, type Customer, type DataRecord, type EqualOperator, type EventBase, type EventFeature, type EventProfile, type EventStatus, type GeometryPoint, type Location, type LocationGeometry, type MultipartText, type Offering, type OfferingCosts, type OfferingOption, type OfferingOptionsGroup, type OfferingPurchaseGroupSetting, type OfferingStatus, type OfferingType, type Order, type OrderContext, type OrderCosts, type OrderItem, type OrderItemCosts, type OrderItemOffering, type OrderStatus, type PackageInclude, type PaginatedRequest, type PaginatedResponse, type Pagination$1 as Pagination, type PaginationResponse, type Person, type PersonAddress, type PersonContact, type Photo, type PriceCategory, type ResolvedCartContext, type ResolvedCartContextOffering, type Schedule, type StaleMeta, type StartCartSessionInput, type StructuredCost, type StructuredDate, type Ticket, type TimeOrOffset, type UpdatableCartSession, type VCDataRecord, type Venue, type VenueBase, type VersionedDataRecord, createCohostClient };