crexperium-sdk 1.2.2 → 1.2.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.
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.js +35 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -3
- package/dist/index.mjs.map +1 -1
- package/dist/resources/contacts.d.ts +32 -1
- package/dist/types/contacts.d.ts +12 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -449,11 +449,43 @@ class EventsResource extends BaseResource {
|
|
|
449
449
|
*/
|
|
450
450
|
class ContactsResource extends BaseResource {
|
|
451
451
|
/**
|
|
452
|
-
* Identify a contact (create or update)
|
|
452
|
+
* Identify a contact (create or update by multiple identifiers)
|
|
453
|
+
*
|
|
454
|
+
* Accepts at least ONE of: externalId, visitorId, email, or phone
|
|
455
|
+
* Priority: externalId > visitorId > email > phone
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* // Identify by external ID (after login)
|
|
459
|
+
* await client.contacts.identify({
|
|
460
|
+
* externalId: 'user_123',
|
|
461
|
+
* email: 'user@example.com',
|
|
462
|
+
* firstName: 'John'
|
|
463
|
+
* });
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* // Identify by visitor ID (anonymous → known)
|
|
467
|
+
* await client.contacts.identify({
|
|
468
|
+
* visitorId: client.visitorId.getVisitorId(),
|
|
469
|
+
* email: 'user@example.com'
|
|
470
|
+
* });
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* // Identify by email only
|
|
474
|
+
* await client.contacts.identify({
|
|
475
|
+
* email: 'user@example.com',
|
|
476
|
+
* firstName: 'John'
|
|
477
|
+
* });
|
|
478
|
+
*
|
|
479
|
+
* @example
|
|
480
|
+
* // Identify by phone only
|
|
481
|
+
* await client.contacts.identify({
|
|
482
|
+
* phone: '+1234567890'
|
|
483
|
+
* });
|
|
453
484
|
*/
|
|
454
485
|
async identify(options) {
|
|
455
|
-
|
|
456
|
-
|
|
486
|
+
// Validate that at least one identifier is provided
|
|
487
|
+
if (!options.externalId && !options.visitorId && !options.email && !options.phone) {
|
|
488
|
+
throw new Error('At least one identifier is required: externalId, visitorId, email, or phone');
|
|
457
489
|
}
|
|
458
490
|
const data = this.cleanObject(this.toSnakeCase(options));
|
|
459
491
|
return this.http.post('/api/v1/contacts/identify/', data);
|