@heymantle/core-api-client 0.1.5 → 0.1.7
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 +1056 -61
- package/dist/index.d.mts +182 -31
- package/dist/index.d.ts +182 -31
- package/dist/index.js +64 -0
- package/dist/index.mjs +64 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -339,7 +339,7 @@ interface CustomFieldUpdateParams extends Partial<Omit<CustomFieldCreateParams,
|
|
|
339
339
|
/**
|
|
340
340
|
* Valid social profile types
|
|
341
341
|
*/
|
|
342
|
-
type SocialProfileType =
|
|
342
|
+
type SocialProfileType = "linkedin" | "x" | "facebook" | "instagram" | "website";
|
|
343
343
|
/**
|
|
344
344
|
* Social profile for a contact
|
|
345
345
|
*/
|
|
@@ -391,7 +391,10 @@ interface ContactCreateParams {
|
|
|
391
391
|
jobTitle?: string;
|
|
392
392
|
notes?: string;
|
|
393
393
|
tags?: string[];
|
|
394
|
-
customers?: string[]
|
|
394
|
+
customers?: string[] | Array<{
|
|
395
|
+
id: string;
|
|
396
|
+
name?: string;
|
|
397
|
+
}>;
|
|
395
398
|
socialProfiles?: SocialProfile[];
|
|
396
399
|
}
|
|
397
400
|
/**
|
|
@@ -758,39 +761,70 @@ interface Deal {
|
|
|
758
761
|
currentAmount?: number;
|
|
759
762
|
acquisitionChannel?: string;
|
|
760
763
|
acquisitionSource?: string;
|
|
761
|
-
firstInteractionAt?: string;
|
|
762
|
-
closingAt?: string;
|
|
763
|
-
closedAt?: string;
|
|
764
|
-
stage?: string;
|
|
765
|
-
step?: number;
|
|
766
|
-
dealFlowId?: string;
|
|
767
|
-
dealStageId?: string;
|
|
768
|
-
customerId?: string;
|
|
769
|
-
domain?: string;
|
|
770
|
-
shopifyDomain?: string;
|
|
771
|
-
companyId?: string;
|
|
772
|
-
appId?: string;
|
|
773
|
-
planId?: string;
|
|
774
|
-
ownerIds?: string[];
|
|
775
|
-
contactIds?: string[];
|
|
776
764
|
notes?: string;
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
765
|
+
firstInteractionAt?: string | null;
|
|
766
|
+
closingAt?: string | null;
|
|
767
|
+
closedAt?: string | null;
|
|
768
|
+
archivedAt?: string | null;
|
|
780
769
|
createdAt: string;
|
|
781
770
|
updatedAt: string;
|
|
771
|
+
dealStage?: {
|
|
772
|
+
id: string;
|
|
773
|
+
name: string;
|
|
774
|
+
stage?: string;
|
|
775
|
+
weight?: number;
|
|
776
|
+
} | null;
|
|
777
|
+
dealFlow?: {
|
|
778
|
+
id: string;
|
|
779
|
+
name: string;
|
|
780
|
+
} | null;
|
|
782
781
|
customer?: {
|
|
783
782
|
id: string;
|
|
784
783
|
name?: string;
|
|
785
|
-
|
|
786
|
-
|
|
784
|
+
email?: string;
|
|
785
|
+
domain?: string;
|
|
786
|
+
shopifyDomain?: string;
|
|
787
|
+
} | null;
|
|
788
|
+
app?: {
|
|
787
789
|
id: string;
|
|
788
790
|
name: string;
|
|
789
|
-
};
|
|
790
|
-
|
|
791
|
+
} | null;
|
|
792
|
+
plan?: {
|
|
791
793
|
id: string;
|
|
792
794
|
name: string;
|
|
793
|
-
};
|
|
795
|
+
} | null;
|
|
796
|
+
affiliate?: {
|
|
797
|
+
id: string;
|
|
798
|
+
name?: string;
|
|
799
|
+
} | null;
|
|
800
|
+
partnership?: {
|
|
801
|
+
id: string;
|
|
802
|
+
name?: string;
|
|
803
|
+
displayName?: string;
|
|
804
|
+
} | null;
|
|
805
|
+
acquirer?: {
|
|
806
|
+
id: string;
|
|
807
|
+
name?: string;
|
|
808
|
+
email?: string;
|
|
809
|
+
} | null;
|
|
810
|
+
owners?: Array<{
|
|
811
|
+
id: string;
|
|
812
|
+
userId: string;
|
|
813
|
+
user?: {
|
|
814
|
+
id: string;
|
|
815
|
+
name?: string;
|
|
816
|
+
email?: string;
|
|
817
|
+
} | null;
|
|
818
|
+
}>;
|
|
819
|
+
contacts?: Array<{
|
|
820
|
+
id: string;
|
|
821
|
+
contactId: string;
|
|
822
|
+
contact?: {
|
|
823
|
+
id: string;
|
|
824
|
+
name?: string;
|
|
825
|
+
email?: string;
|
|
826
|
+
} | null;
|
|
827
|
+
}>;
|
|
794
828
|
}
|
|
795
829
|
/**
|
|
796
830
|
* Parameters for listing deals
|
|
@@ -872,44 +906,97 @@ interface DealContactInput {
|
|
|
872
906
|
}
|
|
873
907
|
/**
|
|
874
908
|
* Parameters for creating a deal
|
|
909
|
+
*
|
|
910
|
+
* **Customer Linking Options** (use only one approach):
|
|
911
|
+
* - `customerId` - Link to an existing customer by ID
|
|
912
|
+
* - `customer` - Create/update a customer inline (matches by domain or shopifyDomain)
|
|
913
|
+
* - `domain`/`shopifyDomain` alone - Find or create a customer by domain
|
|
914
|
+
*
|
|
915
|
+
* Note: `domain` and `shopifyDomain` can be provided alongside `customerId` or `customer`
|
|
916
|
+
* to update the customer's domain fields if they are not already set.
|
|
917
|
+
*
|
|
918
|
+
* **Contact Linking Options** (use only one approach):
|
|
919
|
+
* - `contactIds` - Link to existing contacts by their IDs
|
|
920
|
+
* - `contacts` - Create/update contacts inline (matches by email)
|
|
875
921
|
*/
|
|
876
922
|
interface DealCreateParams {
|
|
923
|
+
/** The name of the deal */
|
|
877
924
|
name: string;
|
|
925
|
+
/** The monetary value of the deal */
|
|
878
926
|
amount?: number;
|
|
927
|
+
/** The currency code for the deal amount (e.g., 'USD', 'EUR') */
|
|
879
928
|
amountCurrencyCode?: string;
|
|
929
|
+
/** The channel through which the deal was acquired */
|
|
880
930
|
acquisitionChannel?: string;
|
|
931
|
+
/** The specific source of the deal acquisition */
|
|
881
932
|
acquisitionSource?: string;
|
|
933
|
+
/** The timestamp of the first interaction with the prospect */
|
|
882
934
|
firstInteractionAt?: string;
|
|
935
|
+
/** The expected closing date for the deal */
|
|
883
936
|
closingAt?: string;
|
|
937
|
+
/** The actual closing date for the deal */
|
|
884
938
|
closedAt?: string;
|
|
939
|
+
/** The ID of the deal flow */
|
|
885
940
|
dealFlowId?: string;
|
|
941
|
+
/** The ID of the deal stage within the flow */
|
|
886
942
|
dealStageId?: string;
|
|
887
|
-
/**
|
|
943
|
+
/**
|
|
944
|
+
* Link to an existing customer by ID.
|
|
945
|
+
* Cannot be used together with `customer` object.
|
|
946
|
+
*/
|
|
888
947
|
customerId?: string;
|
|
889
948
|
/**
|
|
890
|
-
* Create or update a customer inline
|
|
891
|
-
* Matches existing customers by domain or shopifyDomain
|
|
949
|
+
* Create or update a customer inline.
|
|
950
|
+
* Matches existing customers by `domain` or `shopifyDomain`.
|
|
951
|
+
* Cannot be used together with `customerId`.
|
|
892
952
|
*/
|
|
893
953
|
customer?: DealCustomerInput;
|
|
954
|
+
/**
|
|
955
|
+
* The domain of the customer (e.g., 'acme.com').
|
|
956
|
+
* URLs are automatically normalized (protocol and path stripped).
|
|
957
|
+
* Used to find/create a customer if no `customerId` or `customer` provided,
|
|
958
|
+
* or to update the customer's domain if not already set.
|
|
959
|
+
*/
|
|
894
960
|
domain?: string;
|
|
961
|
+
/**
|
|
962
|
+
* The Shopify domain of the customer (e.g., 'acme.myshopify.com').
|
|
963
|
+
* URLs are automatically normalized (protocol and path stripped).
|
|
964
|
+
* Used to find/create a customer if no `customerId` or `customer` provided,
|
|
965
|
+
* or to update the customer's shopifyDomain if not already set.
|
|
966
|
+
*/
|
|
895
967
|
shopifyDomain?: string;
|
|
968
|
+
/** The ID of the company to associate with the deal */
|
|
896
969
|
companyId?: string;
|
|
970
|
+
/** The ID of the app to associate with the deal */
|
|
897
971
|
appId?: string;
|
|
972
|
+
/** The ID of the plan to associate with the deal */
|
|
898
973
|
planId?: string;
|
|
974
|
+
/** Array of user IDs to assign as deal owners */
|
|
899
975
|
ownerIds?: string[];
|
|
900
|
-
/**
|
|
976
|
+
/**
|
|
977
|
+
* Link to existing contacts by their IDs.
|
|
978
|
+
* Cannot be used together with `contacts` array.
|
|
979
|
+
*/
|
|
901
980
|
contactIds?: string[];
|
|
902
981
|
/**
|
|
903
|
-
* Create or update contacts inline
|
|
904
|
-
* Matches existing contacts by email.
|
|
982
|
+
* Create or update contacts inline.
|
|
983
|
+
* Matches existing contacts by email.
|
|
984
|
+
* Contacts are automatically linked to both the customer and the deal.
|
|
985
|
+
* Cannot be used together with `contactIds`.
|
|
905
986
|
*/
|
|
906
987
|
contacts?: DealContactInput[];
|
|
988
|
+
/** Additional notes about the deal */
|
|
907
989
|
notes?: string;
|
|
990
|
+
/** The ID of the affiliate to associate with the deal */
|
|
908
991
|
affiliateId?: string;
|
|
992
|
+
/** The ID of the partnership to associate with the deal */
|
|
909
993
|
partnershipId?: string;
|
|
910
994
|
}
|
|
911
995
|
/**
|
|
912
996
|
* Parameters for updating a deal
|
|
997
|
+
*
|
|
998
|
+
* All fields are optional. See {@link DealCreateParams} for detailed documentation
|
|
999
|
+
* on customer and contact linking options.
|
|
913
1000
|
*/
|
|
914
1001
|
interface DealUpdateParams extends Partial<DealCreateParams> {
|
|
915
1002
|
}
|
|
@@ -2260,12 +2347,76 @@ declare class DealsResource extends BaseResource {
|
|
|
2260
2347
|
}>;
|
|
2261
2348
|
/**
|
|
2262
2349
|
* Create a new deal
|
|
2350
|
+
*
|
|
2351
|
+
* **Linking a Customer:**
|
|
2352
|
+
* There are three ways to associate a customer with a deal (use only one):
|
|
2353
|
+
*
|
|
2354
|
+
* 1. `customerId` - Link to an existing customer by ID
|
|
2355
|
+
* 2. `customer` - Create or update a customer inline. Matches existing customers
|
|
2356
|
+
* by `domain` or `shopifyDomain`. If no match, creates a new customer.
|
|
2357
|
+
* 3. `domain` and/or `shopifyDomain` - Find an existing customer by domain,
|
|
2358
|
+
* or create a minimal customer record if not found.
|
|
2359
|
+
*
|
|
2360
|
+
* If `domain` or `shopifyDomain` are provided alongside `customerId` or `customer`,
|
|
2361
|
+
* they will be used to update the customer's domain fields only if not already set.
|
|
2362
|
+
*
|
|
2363
|
+
* **Linking Contacts:**
|
|
2364
|
+
* There are two ways to associate contacts with a deal (use only one):
|
|
2365
|
+
*
|
|
2366
|
+
* 1. `contactIds` - Link to existing contacts by their IDs
|
|
2367
|
+
* 2. `contacts` - Create or update contacts inline. Matches existing contacts
|
|
2368
|
+
* by email. Contacts are automatically linked to both the customer and the deal.
|
|
2369
|
+
*
|
|
2370
|
+
* @example
|
|
2371
|
+
* // Using an existing customer
|
|
2372
|
+
* await client.deals.create({ name: 'Deal', customerId: 'cust_123', dealFlowId: '...', dealStageId: '...' });
|
|
2373
|
+
*
|
|
2374
|
+
* // Creating a customer inline
|
|
2375
|
+
* await client.deals.create({
|
|
2376
|
+
* name: 'Deal',
|
|
2377
|
+
* customer: { name: 'Acme Corp', domain: 'acme.com', email: 'info@acme.com' },
|
|
2378
|
+
* contacts: [{ email: 'john@acme.com', name: 'John Doe', jobTitle: 'CEO' }],
|
|
2379
|
+
* dealFlowId: '...',
|
|
2380
|
+
* dealStageId: '...',
|
|
2381
|
+
* });
|
|
2382
|
+
*
|
|
2383
|
+
* // Using domain to find/create customer
|
|
2384
|
+
* await client.deals.create({ name: 'Deal', shopifyDomain: 'acme.myshopify.com', dealFlowId: '...', dealStageId: '...' });
|
|
2263
2385
|
*/
|
|
2264
2386
|
create(data: DealCreateParams): Promise<{
|
|
2265
2387
|
deal: Deal;
|
|
2266
2388
|
}>;
|
|
2267
2389
|
/**
|
|
2268
2390
|
* Update an existing deal
|
|
2391
|
+
*
|
|
2392
|
+
* **Updating Customer Association:**
|
|
2393
|
+
* There are three ways to change or update the customer (use only one):
|
|
2394
|
+
*
|
|
2395
|
+
* 1. `customerId` - Change to a different existing customer
|
|
2396
|
+
* 2. `customer` - Update the linked customer inline, or create/link a new one.
|
|
2397
|
+
* Matches existing customers by `domain` or `shopifyDomain`.
|
|
2398
|
+
* 3. `domain` and/or `shopifyDomain` - Find a different customer by domain,
|
|
2399
|
+
* or create a minimal customer record if not found.
|
|
2400
|
+
*
|
|
2401
|
+
* If `domain` or `shopifyDomain` are provided alongside `customerId` or `customer`,
|
|
2402
|
+
* they will be used to update the customer's domain fields only if not already set.
|
|
2403
|
+
*
|
|
2404
|
+
* **Updating Contacts:**
|
|
2405
|
+
* There are two ways to update contacts (use only one):
|
|
2406
|
+
*
|
|
2407
|
+
* 1. `contactIds` - Replace deal contacts with the specified contact IDs
|
|
2408
|
+
* 2. `contacts` - Create or update contacts inline. Matches existing contacts
|
|
2409
|
+
* by email. Contacts are automatically linked to both the customer and the deal.
|
|
2410
|
+
*
|
|
2411
|
+
* @example
|
|
2412
|
+
* // Update customer's domain if not set
|
|
2413
|
+
* await client.deals.update('deal_123', { customerId: 'cust_456', domain: 'newdomain.com' });
|
|
2414
|
+
*
|
|
2415
|
+
* // Update customer and contacts inline
|
|
2416
|
+
* await client.deals.update('deal_123', {
|
|
2417
|
+
* customer: { name: 'Updated Name', domain: 'acme.com' },
|
|
2418
|
+
* contacts: [{ email: 'new@acme.com', name: 'New Contact' }],
|
|
2419
|
+
* });
|
|
2269
2420
|
*/
|
|
2270
2421
|
update(dealId: string, data: DealUpdateParams): Promise<{
|
|
2271
2422
|
deal: Deal;
|
package/dist/index.d.ts
CHANGED
|
@@ -339,7 +339,7 @@ interface CustomFieldUpdateParams extends Partial<Omit<CustomFieldCreateParams,
|
|
|
339
339
|
/**
|
|
340
340
|
* Valid social profile types
|
|
341
341
|
*/
|
|
342
|
-
type SocialProfileType =
|
|
342
|
+
type SocialProfileType = "linkedin" | "x" | "facebook" | "instagram" | "website";
|
|
343
343
|
/**
|
|
344
344
|
* Social profile for a contact
|
|
345
345
|
*/
|
|
@@ -391,7 +391,10 @@ interface ContactCreateParams {
|
|
|
391
391
|
jobTitle?: string;
|
|
392
392
|
notes?: string;
|
|
393
393
|
tags?: string[];
|
|
394
|
-
customers?: string[]
|
|
394
|
+
customers?: string[] | Array<{
|
|
395
|
+
id: string;
|
|
396
|
+
name?: string;
|
|
397
|
+
}>;
|
|
395
398
|
socialProfiles?: SocialProfile[];
|
|
396
399
|
}
|
|
397
400
|
/**
|
|
@@ -758,39 +761,70 @@ interface Deal {
|
|
|
758
761
|
currentAmount?: number;
|
|
759
762
|
acquisitionChannel?: string;
|
|
760
763
|
acquisitionSource?: string;
|
|
761
|
-
firstInteractionAt?: string;
|
|
762
|
-
closingAt?: string;
|
|
763
|
-
closedAt?: string;
|
|
764
|
-
stage?: string;
|
|
765
|
-
step?: number;
|
|
766
|
-
dealFlowId?: string;
|
|
767
|
-
dealStageId?: string;
|
|
768
|
-
customerId?: string;
|
|
769
|
-
domain?: string;
|
|
770
|
-
shopifyDomain?: string;
|
|
771
|
-
companyId?: string;
|
|
772
|
-
appId?: string;
|
|
773
|
-
planId?: string;
|
|
774
|
-
ownerIds?: string[];
|
|
775
|
-
contactIds?: string[];
|
|
776
764
|
notes?: string;
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
765
|
+
firstInteractionAt?: string | null;
|
|
766
|
+
closingAt?: string | null;
|
|
767
|
+
closedAt?: string | null;
|
|
768
|
+
archivedAt?: string | null;
|
|
780
769
|
createdAt: string;
|
|
781
770
|
updatedAt: string;
|
|
771
|
+
dealStage?: {
|
|
772
|
+
id: string;
|
|
773
|
+
name: string;
|
|
774
|
+
stage?: string;
|
|
775
|
+
weight?: number;
|
|
776
|
+
} | null;
|
|
777
|
+
dealFlow?: {
|
|
778
|
+
id: string;
|
|
779
|
+
name: string;
|
|
780
|
+
} | null;
|
|
782
781
|
customer?: {
|
|
783
782
|
id: string;
|
|
784
783
|
name?: string;
|
|
785
|
-
|
|
786
|
-
|
|
784
|
+
email?: string;
|
|
785
|
+
domain?: string;
|
|
786
|
+
shopifyDomain?: string;
|
|
787
|
+
} | null;
|
|
788
|
+
app?: {
|
|
787
789
|
id: string;
|
|
788
790
|
name: string;
|
|
789
|
-
};
|
|
790
|
-
|
|
791
|
+
} | null;
|
|
792
|
+
plan?: {
|
|
791
793
|
id: string;
|
|
792
794
|
name: string;
|
|
793
|
-
};
|
|
795
|
+
} | null;
|
|
796
|
+
affiliate?: {
|
|
797
|
+
id: string;
|
|
798
|
+
name?: string;
|
|
799
|
+
} | null;
|
|
800
|
+
partnership?: {
|
|
801
|
+
id: string;
|
|
802
|
+
name?: string;
|
|
803
|
+
displayName?: string;
|
|
804
|
+
} | null;
|
|
805
|
+
acquirer?: {
|
|
806
|
+
id: string;
|
|
807
|
+
name?: string;
|
|
808
|
+
email?: string;
|
|
809
|
+
} | null;
|
|
810
|
+
owners?: Array<{
|
|
811
|
+
id: string;
|
|
812
|
+
userId: string;
|
|
813
|
+
user?: {
|
|
814
|
+
id: string;
|
|
815
|
+
name?: string;
|
|
816
|
+
email?: string;
|
|
817
|
+
} | null;
|
|
818
|
+
}>;
|
|
819
|
+
contacts?: Array<{
|
|
820
|
+
id: string;
|
|
821
|
+
contactId: string;
|
|
822
|
+
contact?: {
|
|
823
|
+
id: string;
|
|
824
|
+
name?: string;
|
|
825
|
+
email?: string;
|
|
826
|
+
} | null;
|
|
827
|
+
}>;
|
|
794
828
|
}
|
|
795
829
|
/**
|
|
796
830
|
* Parameters for listing deals
|
|
@@ -872,44 +906,97 @@ interface DealContactInput {
|
|
|
872
906
|
}
|
|
873
907
|
/**
|
|
874
908
|
* Parameters for creating a deal
|
|
909
|
+
*
|
|
910
|
+
* **Customer Linking Options** (use only one approach):
|
|
911
|
+
* - `customerId` - Link to an existing customer by ID
|
|
912
|
+
* - `customer` - Create/update a customer inline (matches by domain or shopifyDomain)
|
|
913
|
+
* - `domain`/`shopifyDomain` alone - Find or create a customer by domain
|
|
914
|
+
*
|
|
915
|
+
* Note: `domain` and `shopifyDomain` can be provided alongside `customerId` or `customer`
|
|
916
|
+
* to update the customer's domain fields if they are not already set.
|
|
917
|
+
*
|
|
918
|
+
* **Contact Linking Options** (use only one approach):
|
|
919
|
+
* - `contactIds` - Link to existing contacts by their IDs
|
|
920
|
+
* - `contacts` - Create/update contacts inline (matches by email)
|
|
875
921
|
*/
|
|
876
922
|
interface DealCreateParams {
|
|
923
|
+
/** The name of the deal */
|
|
877
924
|
name: string;
|
|
925
|
+
/** The monetary value of the deal */
|
|
878
926
|
amount?: number;
|
|
927
|
+
/** The currency code for the deal amount (e.g., 'USD', 'EUR') */
|
|
879
928
|
amountCurrencyCode?: string;
|
|
929
|
+
/** The channel through which the deal was acquired */
|
|
880
930
|
acquisitionChannel?: string;
|
|
931
|
+
/** The specific source of the deal acquisition */
|
|
881
932
|
acquisitionSource?: string;
|
|
933
|
+
/** The timestamp of the first interaction with the prospect */
|
|
882
934
|
firstInteractionAt?: string;
|
|
935
|
+
/** The expected closing date for the deal */
|
|
883
936
|
closingAt?: string;
|
|
937
|
+
/** The actual closing date for the deal */
|
|
884
938
|
closedAt?: string;
|
|
939
|
+
/** The ID of the deal flow */
|
|
885
940
|
dealFlowId?: string;
|
|
941
|
+
/** The ID of the deal stage within the flow */
|
|
886
942
|
dealStageId?: string;
|
|
887
|
-
/**
|
|
943
|
+
/**
|
|
944
|
+
* Link to an existing customer by ID.
|
|
945
|
+
* Cannot be used together with `customer` object.
|
|
946
|
+
*/
|
|
888
947
|
customerId?: string;
|
|
889
948
|
/**
|
|
890
|
-
* Create or update a customer inline
|
|
891
|
-
* Matches existing customers by domain or shopifyDomain
|
|
949
|
+
* Create or update a customer inline.
|
|
950
|
+
* Matches existing customers by `domain` or `shopifyDomain`.
|
|
951
|
+
* Cannot be used together with `customerId`.
|
|
892
952
|
*/
|
|
893
953
|
customer?: DealCustomerInput;
|
|
954
|
+
/**
|
|
955
|
+
* The domain of the customer (e.g., 'acme.com').
|
|
956
|
+
* URLs are automatically normalized (protocol and path stripped).
|
|
957
|
+
* Used to find/create a customer if no `customerId` or `customer` provided,
|
|
958
|
+
* or to update the customer's domain if not already set.
|
|
959
|
+
*/
|
|
894
960
|
domain?: string;
|
|
961
|
+
/**
|
|
962
|
+
* The Shopify domain of the customer (e.g., 'acme.myshopify.com').
|
|
963
|
+
* URLs are automatically normalized (protocol and path stripped).
|
|
964
|
+
* Used to find/create a customer if no `customerId` or `customer` provided,
|
|
965
|
+
* or to update the customer's shopifyDomain if not already set.
|
|
966
|
+
*/
|
|
895
967
|
shopifyDomain?: string;
|
|
968
|
+
/** The ID of the company to associate with the deal */
|
|
896
969
|
companyId?: string;
|
|
970
|
+
/** The ID of the app to associate with the deal */
|
|
897
971
|
appId?: string;
|
|
972
|
+
/** The ID of the plan to associate with the deal */
|
|
898
973
|
planId?: string;
|
|
974
|
+
/** Array of user IDs to assign as deal owners */
|
|
899
975
|
ownerIds?: string[];
|
|
900
|
-
/**
|
|
976
|
+
/**
|
|
977
|
+
* Link to existing contacts by their IDs.
|
|
978
|
+
* Cannot be used together with `contacts` array.
|
|
979
|
+
*/
|
|
901
980
|
contactIds?: string[];
|
|
902
981
|
/**
|
|
903
|
-
* Create or update contacts inline
|
|
904
|
-
* Matches existing contacts by email.
|
|
982
|
+
* Create or update contacts inline.
|
|
983
|
+
* Matches existing contacts by email.
|
|
984
|
+
* Contacts are automatically linked to both the customer and the deal.
|
|
985
|
+
* Cannot be used together with `contactIds`.
|
|
905
986
|
*/
|
|
906
987
|
contacts?: DealContactInput[];
|
|
988
|
+
/** Additional notes about the deal */
|
|
907
989
|
notes?: string;
|
|
990
|
+
/** The ID of the affiliate to associate with the deal */
|
|
908
991
|
affiliateId?: string;
|
|
992
|
+
/** The ID of the partnership to associate with the deal */
|
|
909
993
|
partnershipId?: string;
|
|
910
994
|
}
|
|
911
995
|
/**
|
|
912
996
|
* Parameters for updating a deal
|
|
997
|
+
*
|
|
998
|
+
* All fields are optional. See {@link DealCreateParams} for detailed documentation
|
|
999
|
+
* on customer and contact linking options.
|
|
913
1000
|
*/
|
|
914
1001
|
interface DealUpdateParams extends Partial<DealCreateParams> {
|
|
915
1002
|
}
|
|
@@ -2260,12 +2347,76 @@ declare class DealsResource extends BaseResource {
|
|
|
2260
2347
|
}>;
|
|
2261
2348
|
/**
|
|
2262
2349
|
* Create a new deal
|
|
2350
|
+
*
|
|
2351
|
+
* **Linking a Customer:**
|
|
2352
|
+
* There are three ways to associate a customer with a deal (use only one):
|
|
2353
|
+
*
|
|
2354
|
+
* 1. `customerId` - Link to an existing customer by ID
|
|
2355
|
+
* 2. `customer` - Create or update a customer inline. Matches existing customers
|
|
2356
|
+
* by `domain` or `shopifyDomain`. If no match, creates a new customer.
|
|
2357
|
+
* 3. `domain` and/or `shopifyDomain` - Find an existing customer by domain,
|
|
2358
|
+
* or create a minimal customer record if not found.
|
|
2359
|
+
*
|
|
2360
|
+
* If `domain` or `shopifyDomain` are provided alongside `customerId` or `customer`,
|
|
2361
|
+
* they will be used to update the customer's domain fields only if not already set.
|
|
2362
|
+
*
|
|
2363
|
+
* **Linking Contacts:**
|
|
2364
|
+
* There are two ways to associate contacts with a deal (use only one):
|
|
2365
|
+
*
|
|
2366
|
+
* 1. `contactIds` - Link to existing contacts by their IDs
|
|
2367
|
+
* 2. `contacts` - Create or update contacts inline. Matches existing contacts
|
|
2368
|
+
* by email. Contacts are automatically linked to both the customer and the deal.
|
|
2369
|
+
*
|
|
2370
|
+
* @example
|
|
2371
|
+
* // Using an existing customer
|
|
2372
|
+
* await client.deals.create({ name: 'Deal', customerId: 'cust_123', dealFlowId: '...', dealStageId: '...' });
|
|
2373
|
+
*
|
|
2374
|
+
* // Creating a customer inline
|
|
2375
|
+
* await client.deals.create({
|
|
2376
|
+
* name: 'Deal',
|
|
2377
|
+
* customer: { name: 'Acme Corp', domain: 'acme.com', email: 'info@acme.com' },
|
|
2378
|
+
* contacts: [{ email: 'john@acme.com', name: 'John Doe', jobTitle: 'CEO' }],
|
|
2379
|
+
* dealFlowId: '...',
|
|
2380
|
+
* dealStageId: '...',
|
|
2381
|
+
* });
|
|
2382
|
+
*
|
|
2383
|
+
* // Using domain to find/create customer
|
|
2384
|
+
* await client.deals.create({ name: 'Deal', shopifyDomain: 'acme.myshopify.com', dealFlowId: '...', dealStageId: '...' });
|
|
2263
2385
|
*/
|
|
2264
2386
|
create(data: DealCreateParams): Promise<{
|
|
2265
2387
|
deal: Deal;
|
|
2266
2388
|
}>;
|
|
2267
2389
|
/**
|
|
2268
2390
|
* Update an existing deal
|
|
2391
|
+
*
|
|
2392
|
+
* **Updating Customer Association:**
|
|
2393
|
+
* There are three ways to change or update the customer (use only one):
|
|
2394
|
+
*
|
|
2395
|
+
* 1. `customerId` - Change to a different existing customer
|
|
2396
|
+
* 2. `customer` - Update the linked customer inline, or create/link a new one.
|
|
2397
|
+
* Matches existing customers by `domain` or `shopifyDomain`.
|
|
2398
|
+
* 3. `domain` and/or `shopifyDomain` - Find a different customer by domain,
|
|
2399
|
+
* or create a minimal customer record if not found.
|
|
2400
|
+
*
|
|
2401
|
+
* If `domain` or `shopifyDomain` are provided alongside `customerId` or `customer`,
|
|
2402
|
+
* they will be used to update the customer's domain fields only if not already set.
|
|
2403
|
+
*
|
|
2404
|
+
* **Updating Contacts:**
|
|
2405
|
+
* There are two ways to update contacts (use only one):
|
|
2406
|
+
*
|
|
2407
|
+
* 1. `contactIds` - Replace deal contacts with the specified contact IDs
|
|
2408
|
+
* 2. `contacts` - Create or update contacts inline. Matches existing contacts
|
|
2409
|
+
* by email. Contacts are automatically linked to both the customer and the deal.
|
|
2410
|
+
*
|
|
2411
|
+
* @example
|
|
2412
|
+
* // Update customer's domain if not set
|
|
2413
|
+
* await client.deals.update('deal_123', { customerId: 'cust_456', domain: 'newdomain.com' });
|
|
2414
|
+
*
|
|
2415
|
+
* // Update customer and contacts inline
|
|
2416
|
+
* await client.deals.update('deal_123', {
|
|
2417
|
+
* customer: { name: 'Updated Name', domain: 'acme.com' },
|
|
2418
|
+
* contacts: [{ email: 'new@acme.com', name: 'New Contact' }],
|
|
2419
|
+
* });
|
|
2269
2420
|
*/
|
|
2270
2421
|
update(dealId: string, data: DealUpdateParams): Promise<{
|
|
2271
2422
|
deal: Deal;
|
package/dist/index.js
CHANGED
|
@@ -766,12 +766,76 @@ var DealsResource = class extends BaseResource {
|
|
|
766
766
|
}
|
|
767
767
|
/**
|
|
768
768
|
* Create a new deal
|
|
769
|
+
*
|
|
770
|
+
* **Linking a Customer:**
|
|
771
|
+
* There are three ways to associate a customer with a deal (use only one):
|
|
772
|
+
*
|
|
773
|
+
* 1. `customerId` - Link to an existing customer by ID
|
|
774
|
+
* 2. `customer` - Create or update a customer inline. Matches existing customers
|
|
775
|
+
* by `domain` or `shopifyDomain`. If no match, creates a new customer.
|
|
776
|
+
* 3. `domain` and/or `shopifyDomain` - Find an existing customer by domain,
|
|
777
|
+
* or create a minimal customer record if not found.
|
|
778
|
+
*
|
|
779
|
+
* If `domain` or `shopifyDomain` are provided alongside `customerId` or `customer`,
|
|
780
|
+
* they will be used to update the customer's domain fields only if not already set.
|
|
781
|
+
*
|
|
782
|
+
* **Linking Contacts:**
|
|
783
|
+
* There are two ways to associate contacts with a deal (use only one):
|
|
784
|
+
*
|
|
785
|
+
* 1. `contactIds` - Link to existing contacts by their IDs
|
|
786
|
+
* 2. `contacts` - Create or update contacts inline. Matches existing contacts
|
|
787
|
+
* by email. Contacts are automatically linked to both the customer and the deal.
|
|
788
|
+
*
|
|
789
|
+
* @example
|
|
790
|
+
* // Using an existing customer
|
|
791
|
+
* await client.deals.create({ name: 'Deal', customerId: 'cust_123', dealFlowId: '...', dealStageId: '...' });
|
|
792
|
+
*
|
|
793
|
+
* // Creating a customer inline
|
|
794
|
+
* await client.deals.create({
|
|
795
|
+
* name: 'Deal',
|
|
796
|
+
* customer: { name: 'Acme Corp', domain: 'acme.com', email: 'info@acme.com' },
|
|
797
|
+
* contacts: [{ email: 'john@acme.com', name: 'John Doe', jobTitle: 'CEO' }],
|
|
798
|
+
* dealFlowId: '...',
|
|
799
|
+
* dealStageId: '...',
|
|
800
|
+
* });
|
|
801
|
+
*
|
|
802
|
+
* // Using domain to find/create customer
|
|
803
|
+
* await client.deals.create({ name: 'Deal', shopifyDomain: 'acme.myshopify.com', dealFlowId: '...', dealStageId: '...' });
|
|
769
804
|
*/
|
|
770
805
|
async create(data) {
|
|
771
806
|
return this.post("/deals", data);
|
|
772
807
|
}
|
|
773
808
|
/**
|
|
774
809
|
* Update an existing deal
|
|
810
|
+
*
|
|
811
|
+
* **Updating Customer Association:**
|
|
812
|
+
* There are three ways to change or update the customer (use only one):
|
|
813
|
+
*
|
|
814
|
+
* 1. `customerId` - Change to a different existing customer
|
|
815
|
+
* 2. `customer` - Update the linked customer inline, or create/link a new one.
|
|
816
|
+
* Matches existing customers by `domain` or `shopifyDomain`.
|
|
817
|
+
* 3. `domain` and/or `shopifyDomain` - Find a different customer by domain,
|
|
818
|
+
* or create a minimal customer record if not found.
|
|
819
|
+
*
|
|
820
|
+
* If `domain` or `shopifyDomain` are provided alongside `customerId` or `customer`,
|
|
821
|
+
* they will be used to update the customer's domain fields only if not already set.
|
|
822
|
+
*
|
|
823
|
+
* **Updating Contacts:**
|
|
824
|
+
* There are two ways to update contacts (use only one):
|
|
825
|
+
*
|
|
826
|
+
* 1. `contactIds` - Replace deal contacts with the specified contact IDs
|
|
827
|
+
* 2. `contacts` - Create or update contacts inline. Matches existing contacts
|
|
828
|
+
* by email. Contacts are automatically linked to both the customer and the deal.
|
|
829
|
+
*
|
|
830
|
+
* @example
|
|
831
|
+
* // Update customer's domain if not set
|
|
832
|
+
* await client.deals.update('deal_123', { customerId: 'cust_456', domain: 'newdomain.com' });
|
|
833
|
+
*
|
|
834
|
+
* // Update customer and contacts inline
|
|
835
|
+
* await client.deals.update('deal_123', {
|
|
836
|
+
* customer: { name: 'Updated Name', domain: 'acme.com' },
|
|
837
|
+
* contacts: [{ email: 'new@acme.com', name: 'New Contact' }],
|
|
838
|
+
* });
|
|
775
839
|
*/
|
|
776
840
|
async update(dealId, data) {
|
|
777
841
|
return this.put(`/deals/${dealId}`, data);
|