@kyoji2/intercom-cli 0.1.4 → 0.1.6

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.js CHANGED
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
5
5
  var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
8
13
  var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
9
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
10
22
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
23
  for (let key of __getOwnPropNames(mod))
12
24
  if (!__hasOwnProp.call(to, key))
13
25
  __defProp(to, key, {
14
- get: () => mod[key],
26
+ get: __accessProp.bind(mod, key),
15
27
  enumerable: true
16
28
  });
29
+ if (canCache)
30
+ cache.set(mod, to);
17
31
  return to;
18
32
  };
19
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
+ var __returnValue = (v) => v;
35
+ function __exportSetter(name, newValue) {
36
+ this[name] = __returnValue.bind(null, newValue);
37
+ }
20
38
  var __export = (target, all) => {
21
39
  for (var name in all)
22
40
  __defProp(target, name, {
23
41
  get: all[name],
24
42
  enumerable: true,
25
43
  configurable: true,
26
- set: (newValue) => all[name] = () => newValue
44
+ set: __exportSetter.bind(all, name)
27
45
  });
28
46
  };
29
47
  var __require = import.meta.require;
@@ -5340,6 +5358,49 @@ class Ora {
5340
5358
  function ora(options) {
5341
5359
  return new Ora(options);
5342
5360
  }
5361
+ // node_modules/intercom-client/dist/esm/core/auth/NoOpAuthProvider.mjs
5362
+ class NoOpAuthProvider {
5363
+ getAuthRequest() {
5364
+ return Promise.resolve({ headers: {} });
5365
+ }
5366
+ }
5367
+ // node_modules/intercom-client/dist/esm/core/fetcher/EndpointSupplier.mjs
5368
+ var __awaiter = function(thisArg, _arguments, P, generator) {
5369
+ function adopt(value) {
5370
+ return value instanceof P ? value : new P(function(resolve) {
5371
+ resolve(value);
5372
+ });
5373
+ }
5374
+ return new (P || (P = Promise))(function(resolve, reject) {
5375
+ function fulfilled(value) {
5376
+ try {
5377
+ step(generator.next(value));
5378
+ } catch (e) {
5379
+ reject(e);
5380
+ }
5381
+ }
5382
+ function rejected(value) {
5383
+ try {
5384
+ step(generator["throw"](value));
5385
+ } catch (e) {
5386
+ reject(e);
5387
+ }
5388
+ }
5389
+ function step(result) {
5390
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
5391
+ }
5392
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
5393
+ });
5394
+ };
5395
+ var EndpointSupplier = {
5396
+ get: (supplier, arg) => __awaiter(undefined, undefined, undefined, function* () {
5397
+ if (typeof supplier === "function") {
5398
+ return supplier(arg);
5399
+ } else {
5400
+ return supplier;
5401
+ }
5402
+ })
5403
+ };
5343
5404
 
5344
5405
  // node_modules/intercom-client/dist/esm/core/json.mjs
5345
5406
  var toJson = (value, replacer, space) => {
@@ -5349,1608 +5410,575 @@ function fromJson(text, reviver) {
5349
5410
  return JSON.parse(text, reviver);
5350
5411
  }
5351
5412
 
5352
- // node_modules/intercom-client/dist/esm/errors/IntercomError.mjs
5353
- class IntercomError extends Error {
5354
- constructor({ message, statusCode, body, rawResponse }) {
5355
- super(buildMessage({ message, statusCode, body }));
5356
- Object.setPrototypeOf(this, IntercomError.prototype);
5357
- this.statusCode = statusCode;
5358
- this.body = body;
5359
- this.rawResponse = rawResponse;
5413
+ // node_modules/intercom-client/dist/esm/core/logging/logger.mjs
5414
+ var LogLevel = {
5415
+ Debug: "debug",
5416
+ Info: "info",
5417
+ Warn: "warn",
5418
+ Error: "error"
5419
+ };
5420
+ var logLevelMap = {
5421
+ [LogLevel.Debug]: 1,
5422
+ [LogLevel.Info]: 2,
5423
+ [LogLevel.Warn]: 3,
5424
+ [LogLevel.Error]: 4
5425
+ };
5426
+
5427
+ class ConsoleLogger {
5428
+ debug(message, ...args) {
5429
+ console.debug(message, ...args);
5360
5430
  }
5361
- }
5362
- function buildMessage({ message, statusCode, body }) {
5363
- const lines = [];
5364
- if (message != null) {
5365
- lines.push(message);
5431
+ info(message, ...args) {
5432
+ console.info(message, ...args);
5366
5433
  }
5367
- if (statusCode != null) {
5368
- lines.push(`Status code: ${statusCode.toString()}`);
5434
+ warn(message, ...args) {
5435
+ console.warn(message, ...args);
5369
5436
  }
5370
- if (body != null) {
5371
- lines.push(`Body: ${toJson(body, undefined, 2)}`);
5437
+ error(message, ...args) {
5438
+ console.error(message, ...args);
5372
5439
  }
5373
- return lines.join(`
5374
- `);
5375
5440
  }
5376
- // node_modules/intercom-client/dist/esm/errors/IntercomTimeoutError.mjs
5377
- class IntercomTimeoutError extends Error {
5378
- constructor(message) {
5379
- super(message);
5380
- Object.setPrototypeOf(this, IntercomTimeoutError.prototype);
5441
+
5442
+ class Logger {
5443
+ constructor(config) {
5444
+ this.level = logLevelMap[config.level];
5445
+ this.logger = config.logger;
5446
+ this.silent = config.silent;
5447
+ }
5448
+ shouldLog(level) {
5449
+ return !this.silent && this.level <= logLevelMap[level];
5450
+ }
5451
+ isDebug() {
5452
+ return this.shouldLog(LogLevel.Debug);
5453
+ }
5454
+ debug(message, ...args) {
5455
+ if (this.isDebug()) {
5456
+ this.logger.debug(message, ...args);
5457
+ }
5458
+ }
5459
+ isInfo() {
5460
+ return this.shouldLog(LogLevel.Info);
5461
+ }
5462
+ info(message, ...args) {
5463
+ if (this.isInfo()) {
5464
+ this.logger.info(message, ...args);
5465
+ }
5466
+ }
5467
+ isWarn() {
5468
+ return this.shouldLog(LogLevel.Warn);
5469
+ }
5470
+ warn(message, ...args) {
5471
+ if (this.isWarn()) {
5472
+ this.logger.warn(message, ...args);
5473
+ }
5474
+ }
5475
+ isError() {
5476
+ return this.shouldLog(LogLevel.Error);
5477
+ }
5478
+ error(message, ...args) {
5479
+ if (this.isError()) {
5480
+ this.logger.error(message, ...args);
5481
+ }
5381
5482
  }
5382
5483
  }
5383
- // node_modules/intercom-client/dist/esm/api/errors/BadRequestError.mjs
5384
- class BadRequestError extends IntercomError {
5385
- constructor(body, rawResponse) {
5386
- super({
5387
- message: "BadRequestError",
5388
- statusCode: 400,
5389
- body,
5390
- rawResponse
5391
- });
5392
- Object.setPrototypeOf(this, BadRequestError.prototype);
5484
+ function createLogger(config) {
5485
+ var _a, _b, _c;
5486
+ if (config == null) {
5487
+ return defaultLogger;
5393
5488
  }
5489
+ if (config instanceof Logger) {
5490
+ return config;
5491
+ }
5492
+ config = config !== null && config !== undefined ? config : {};
5493
+ (_a = config.level) !== null && _a !== undefined || (config.level = LogLevel.Info);
5494
+ (_b = config.logger) !== null && _b !== undefined || (config.logger = new ConsoleLogger);
5495
+ (_c = config.silent) !== null && _c !== undefined || (config.silent = true);
5496
+ return new Logger(config);
5394
5497
  }
5498
+ var defaultLogger = new Logger({
5499
+ level: LogLevel.Info,
5500
+ logger: new ConsoleLogger,
5501
+ silent: true
5502
+ });
5395
5503
 
5396
- // node_modules/intercom-client/dist/esm/api/errors/ForbiddenError.mjs
5397
- class ForbiddenError extends IntercomError {
5398
- constructor(body, rawResponse) {
5399
- super({
5400
- message: "ForbiddenError",
5401
- statusCode: 403,
5402
- body,
5403
- rawResponse
5404
- });
5405
- Object.setPrototypeOf(this, ForbiddenError.prototype);
5504
+ // node_modules/intercom-client/dist/esm/core/url/qs.mjs
5505
+ var defaultQsOptions = {
5506
+ arrayFormat: "indices",
5507
+ encode: true
5508
+ };
5509
+ function encodeValue(value, shouldEncode) {
5510
+ if (value === undefined) {
5511
+ return "";
5512
+ }
5513
+ if (value === null) {
5514
+ return "";
5406
5515
  }
5516
+ const stringValue = String(value);
5517
+ return shouldEncode ? encodeURIComponent(stringValue) : stringValue;
5407
5518
  }
5408
-
5409
- // node_modules/intercom-client/dist/esm/api/errors/NotFoundError.mjs
5410
- class NotFoundError extends IntercomError {
5411
- constructor(body, rawResponse) {
5412
- super({
5413
- message: "NotFoundError",
5414
- statusCode: 404,
5415
- body,
5416
- rawResponse
5417
- });
5418
- Object.setPrototypeOf(this, NotFoundError.prototype);
5519
+ function stringifyObject(obj, prefix = "", options) {
5520
+ const parts = [];
5521
+ for (const [key, value] of Object.entries(obj)) {
5522
+ const fullKey = prefix ? `${prefix}[${key}]` : key;
5523
+ if (value === undefined) {
5524
+ continue;
5525
+ }
5526
+ if (Array.isArray(value)) {
5527
+ if (value.length === 0) {
5528
+ continue;
5529
+ }
5530
+ for (let i = 0;i < value.length; i++) {
5531
+ const item = value[i];
5532
+ if (item === undefined) {
5533
+ continue;
5534
+ }
5535
+ if (typeof item === "object" && !Array.isArray(item) && item !== null) {
5536
+ const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
5537
+ parts.push(...stringifyObject(item, arrayKey, options));
5538
+ } else {
5539
+ const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
5540
+ const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
5541
+ parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
5542
+ }
5543
+ }
5544
+ } else if (typeof value === "object" && value !== null) {
5545
+ if (Object.keys(value).length === 0) {
5546
+ continue;
5547
+ }
5548
+ parts.push(...stringifyObject(value, fullKey, options));
5549
+ } else {
5550
+ const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
5551
+ parts.push(`${encodedKey}=${encodeValue(value, options.encode)}`);
5552
+ }
5419
5553
  }
5554
+ return parts;
5420
5555
  }
5421
-
5422
- // node_modules/intercom-client/dist/esm/api/errors/TooManyRequestsError.mjs
5423
- class TooManyRequestsError extends IntercomError {
5424
- constructor(body, rawResponse) {
5425
- super({
5426
- message: "TooManyRequestsError",
5427
- statusCode: 429,
5428
- body,
5429
- rawResponse
5430
- });
5431
- Object.setPrototypeOf(this, TooManyRequestsError.prototype);
5556
+ function toQueryString(obj, options) {
5557
+ if (obj == null || typeof obj !== "object") {
5558
+ return "";
5432
5559
  }
5560
+ const parts = stringifyObject(obj, "", Object.assign(Object.assign({}, defaultQsOptions), options));
5561
+ return parts.join("&");
5433
5562
  }
5434
5563
 
5435
- // node_modules/intercom-client/dist/esm/api/errors/UnauthorizedError.mjs
5436
- class UnauthorizedError extends IntercomError {
5437
- constructor(body, rawResponse) {
5438
- super({
5439
- message: "UnauthorizedError",
5440
- statusCode: 401,
5441
- body,
5442
- rawResponse
5443
- });
5444
- Object.setPrototypeOf(this, UnauthorizedError.prototype);
5445
- }
5446
- }
5447
-
5448
- // node_modules/intercom-client/dist/esm/api/errors/UnprocessableEntityError.mjs
5449
- class UnprocessableEntityError extends IntercomError {
5450
- constructor(body, rawResponse) {
5451
- super({
5452
- message: "UnprocessableEntityError",
5453
- statusCode: 422,
5454
- body,
5455
- rawResponse
5456
- });
5457
- Object.setPrototypeOf(this, UnprocessableEntityError.prototype);
5458
- }
5459
- }
5460
- // node_modules/intercom-client/dist/esm/api/resources/unstable/index.mjs
5461
- var exports_unstable = {};
5462
- __export(exports_unstable, {
5463
- visitors: () => exports_visitors,
5464
- tickets: () => exports_tickets,
5465
- ticketTypes: () => exports_ticketTypes,
5466
- ticketTypeAttributes: () => exports_ticketTypeAttributes,
5467
- ticketStates: () => exports_ticketStates,
5468
- teams: () => exports_teams,
5469
- tags: () => exports_tags,
5470
- switch_: () => exports_switch,
5471
- subscriptionTypes: () => exports_subscriptionTypes,
5472
- segments: () => exports_segments,
5473
- notes: () => exports_notes,
5474
- news: () => exports_news,
5475
- messages: () => exports_messages,
5476
- macros: () => exports_macros,
5477
- jobs: () => exports_jobs,
5478
- internalArticles: () => exports_internalArticles,
5479
- helpCenter: () => exports_helpCenter,
5480
- export_: () => exports_export,
5481
- emails: () => exports_emails,
5482
- dataExport: () => exports_dataExport,
5483
- dataEvents: () => exports_dataEvents,
5484
- dataAttributes: () => exports_dataAttributes,
5485
- customObjectInstances: () => exports_customObjectInstances,
5486
- customChannelEvents: () => exports_customChannelEvents,
5487
- conversations: () => exports_conversations,
5488
- contacts: () => exports_contacts,
5489
- companies: () => exports_companies,
5490
- calls: () => exports_calls,
5491
- brands: () => exports_brands,
5492
- awayStatusReasons: () => exports_awayStatusReasons,
5493
- articles: () => exports_articles,
5494
- aiContentSource: () => exports_aiContentSource,
5495
- aiContent: () => exports_aiContent,
5496
- aiAgent: () => exports_aiAgent,
5497
- admins: () => exports_admins,
5498
- WhatsappMessageStatusList: () => WhatsappMessageStatusList,
5499
- UnprocessableEntityError: () => UnprocessableEntityError2,
5500
- UnauthorizedError: () => UnauthorizedError2,
5501
- TooManyRequestsError: () => TooManyRequestsError2,
5502
- TicketType: () => TicketType,
5503
- TicketStateDetailed: () => TicketStateDetailed,
5504
- TicketState: () => TicketState,
5505
- TicketReply: () => TicketReply,
5506
- TicketPartAuthor: () => TicketPartAuthor,
5507
- TicketPart: () => TicketPart,
5508
- Ticket: () => Ticket,
5509
- SubscriptionType: () => SubscriptionType,
5510
- SlaApplied: () => SlaApplied,
5511
- SingleFilterSearchRequest: () => SingleFilterSearchRequest,
5512
- Segment: () => Segment,
5513
- RegisterFinVoiceCallRequest: () => RegisterFinVoiceCallRequest,
5514
- Recipient: () => Recipient,
5515
- PaginatedResponse: () => PaginatedResponse,
5516
- NotFoundError: () => NotFoundError2,
5517
- NewsItemRequest: () => NewsItemRequest,
5518
- NewsItem: () => NewsItem,
5519
- MultipleFilterSearchRequest: () => MultipleFilterSearchRequest,
5520
- Message: () => Message,
5521
- Macro: () => Macro,
5522
- LisDataAttributesRequestModel: () => LisDataAttributesRequestModel,
5523
- LinkedObject: () => LinkedObject,
5524
- Jobs: () => Jobs,
5525
- InternalServerError: () => InternalServerError,
5526
- ForbiddenError: () => ForbiddenError2,
5527
- DataExport: () => DataExport,
5528
- DataAttribute: () => DataAttribute,
5529
- CustomChannelContact: () => CustomChannelContact,
5530
- CustomActionFinished: () => CustomActionFinished,
5531
- CreateTicketTypeRequest: () => CreateTicketTypeRequest,
5532
- CreateArticleRequest: () => CreateArticleRequest,
5533
- ConversationSource: () => ConversationSource,
5534
- ConversationPart: () => ConversationPart,
5535
- Conversation: () => Conversation,
5536
- ContentSource: () => ContentSource,
5537
- ContentImportSource: () => ContentImportSource,
5538
- ConflictError: () => ConflictError,
5539
- BadRequestError: () => BadRequestError2,
5540
- AssignConversationRequest: () => AssignConversationRequest,
5541
- ArticleSearchHighlights: () => ArticleSearchHighlights,
5542
- ArticleListItem: () => ArticleListItem,
5543
- ArticleContent: () => ArticleContent,
5544
- AiAgent: () => AiAgent,
5545
- AdminReplyTicketRequest: () => AdminReplyTicketRequest,
5546
- AdminReplyConversationRequest: () => AdminReplyConversationRequest,
5547
- ActivityLog: () => ActivityLog
5548
- });
5549
-
5550
- // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/BadRequestError.mjs
5551
- class BadRequestError2 extends IntercomError {
5552
- constructor(body, rawResponse) {
5553
- super({
5554
- message: "BadRequestError",
5555
- statusCode: 400,
5556
- body,
5557
- rawResponse
5558
- });
5559
- Object.setPrototypeOf(this, BadRequestError2.prototype);
5560
- }
5564
+ // node_modules/intercom-client/dist/esm/core/fetcher/createRequestUrl.mjs
5565
+ function createRequestUrl(baseUrl, queryParameters) {
5566
+ const queryString = toQueryString(queryParameters, { arrayFormat: "repeat" });
5567
+ return queryString ? `${baseUrl}?${queryString}` : baseUrl;
5561
5568
  }
5562
5569
 
5563
- // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/ConflictError.mjs
5564
- class ConflictError extends IntercomError {
5565
- constructor(body, rawResponse) {
5566
- super({
5567
- message: "ConflictError",
5568
- statusCode: 409,
5569
- body,
5570
- rawResponse
5571
- });
5572
- Object.setPrototypeOf(this, ConflictError.prototype);
5570
+ // node_modules/intercom-client/dist/esm/core/fetcher/BinaryResponse.mjs
5571
+ function getBinaryResponse(response) {
5572
+ const binaryResponse = {
5573
+ get bodyUsed() {
5574
+ return response.bodyUsed;
5575
+ },
5576
+ stream: () => response.body,
5577
+ arrayBuffer: response.arrayBuffer.bind(response),
5578
+ blob: response.blob.bind(response)
5579
+ };
5580
+ if ("bytes" in response && typeof response.bytes === "function") {
5581
+ binaryResponse.bytes = response.bytes.bind(response);
5573
5582
  }
5583
+ return binaryResponse;
5574
5584
  }
5575
5585
 
5576
- // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/ForbiddenError.mjs
5577
- class ForbiddenError2 extends IntercomError {
5578
- constructor(body, rawResponse) {
5579
- super({
5580
- message: "ForbiddenError",
5581
- statusCode: 403,
5582
- body,
5583
- rawResponse
5586
+ // node_modules/intercom-client/dist/esm/core/fetcher/getResponseBody.mjs
5587
+ var __awaiter2 = function(thisArg, _arguments, P, generator) {
5588
+ function adopt(value) {
5589
+ return value instanceof P ? value : new P(function(resolve) {
5590
+ resolve(value);
5584
5591
  });
5585
- Object.setPrototypeOf(this, ForbiddenError2.prototype);
5586
5592
  }
5593
+ return new (P || (P = Promise))(function(resolve, reject) {
5594
+ function fulfilled(value) {
5595
+ try {
5596
+ step(generator.next(value));
5597
+ } catch (e) {
5598
+ reject(e);
5599
+ }
5600
+ }
5601
+ function rejected(value) {
5602
+ try {
5603
+ step(generator["throw"](value));
5604
+ } catch (e) {
5605
+ reject(e);
5606
+ }
5607
+ }
5608
+ function step(result) {
5609
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
5610
+ }
5611
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
5612
+ });
5613
+ };
5614
+ function getResponseBody(response, responseType) {
5615
+ return __awaiter2(this, undefined, undefined, function* () {
5616
+ switch (responseType) {
5617
+ case "binary-response":
5618
+ return getBinaryResponse(response);
5619
+ case "blob":
5620
+ return yield response.blob();
5621
+ case "arrayBuffer":
5622
+ return yield response.arrayBuffer();
5623
+ case "sse":
5624
+ if (response.body == null) {
5625
+ return {
5626
+ ok: false,
5627
+ error: {
5628
+ reason: "body-is-null",
5629
+ statusCode: response.status
5630
+ }
5631
+ };
5632
+ }
5633
+ return response.body;
5634
+ case "streaming":
5635
+ if (response.body == null) {
5636
+ return {
5637
+ ok: false,
5638
+ error: {
5639
+ reason: "body-is-null",
5640
+ statusCode: response.status
5641
+ }
5642
+ };
5643
+ }
5644
+ return response.body;
5645
+ case "text":
5646
+ return yield response.text();
5647
+ }
5648
+ const text = yield response.text();
5649
+ if (text.length > 0) {
5650
+ try {
5651
+ const responseBody = fromJson(text);
5652
+ return responseBody;
5653
+ } catch (_err) {
5654
+ return {
5655
+ ok: false,
5656
+ error: {
5657
+ reason: "non-json",
5658
+ statusCode: response.status,
5659
+ rawBody: text
5660
+ }
5661
+ };
5662
+ }
5663
+ }
5664
+ return;
5665
+ });
5587
5666
  }
5588
5667
 
5589
- // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/InternalServerError.mjs
5590
- class InternalServerError extends IntercomError {
5591
- constructor(body, rawResponse) {
5592
- super({
5593
- message: "InternalServerError",
5594
- statusCode: 500,
5595
- body,
5596
- rawResponse
5668
+ // node_modules/intercom-client/dist/esm/core/fetcher/getErrorResponseBody.mjs
5669
+ var __awaiter3 = function(thisArg, _arguments, P, generator) {
5670
+ function adopt(value) {
5671
+ return value instanceof P ? value : new P(function(resolve) {
5672
+ resolve(value);
5597
5673
  });
5598
- Object.setPrototypeOf(this, InternalServerError.prototype);
5599
- }
5600
- }
5601
-
5602
- // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/NotFoundError.mjs
5603
- class NotFoundError2 extends IntercomError {
5604
- constructor(body, rawResponse) {
5605
- super({
5606
- message: "NotFoundError",
5607
- statusCode: 404,
5608
- body,
5609
- rawResponse
5610
- });
5611
- Object.setPrototypeOf(this, NotFoundError2.prototype);
5612
5674
  }
5675
+ return new (P || (P = Promise))(function(resolve, reject) {
5676
+ function fulfilled(value) {
5677
+ try {
5678
+ step(generator.next(value));
5679
+ } catch (e) {
5680
+ reject(e);
5681
+ }
5682
+ }
5683
+ function rejected(value) {
5684
+ try {
5685
+ step(generator["throw"](value));
5686
+ } catch (e) {
5687
+ reject(e);
5688
+ }
5689
+ }
5690
+ function step(result) {
5691
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
5692
+ }
5693
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
5694
+ });
5695
+ };
5696
+ function getErrorResponseBody(response) {
5697
+ return __awaiter3(this, undefined, undefined, function* () {
5698
+ var _a, _b, _c;
5699
+ let contentType = (_a = response.headers.get("Content-Type")) === null || _a === undefined ? undefined : _a.toLowerCase();
5700
+ if (contentType == null || contentType.length === 0) {
5701
+ return getResponseBody(response);
5702
+ }
5703
+ if (contentType.indexOf(";") !== -1) {
5704
+ contentType = (_c = (_b = contentType.split(";")[0]) === null || _b === undefined ? undefined : _b.trim()) !== null && _c !== undefined ? _c : "";
5705
+ }
5706
+ switch (contentType) {
5707
+ case "application/hal+json":
5708
+ case "application/json":
5709
+ case "application/ld+json":
5710
+ case "application/problem+json":
5711
+ case "application/vnd.api+json":
5712
+ case "text/json": {
5713
+ const text = yield response.text();
5714
+ return text.length > 0 ? fromJson(text) : undefined;
5715
+ }
5716
+ default:
5717
+ if (contentType.startsWith("application/vnd.") && contentType.endsWith("+json")) {
5718
+ const text = yield response.text();
5719
+ return text.length > 0 ? fromJson(text) : undefined;
5720
+ }
5721
+ return yield response.text();
5722
+ }
5723
+ });
5613
5724
  }
5614
5725
 
5615
- // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/TooManyRequestsError.mjs
5616
- class TooManyRequestsError2 extends IntercomError {
5617
- constructor(body, rawResponse) {
5618
- super({
5619
- message: "TooManyRequestsError",
5620
- statusCode: 429,
5621
- body,
5622
- rawResponse
5726
+ // node_modules/intercom-client/dist/esm/core/fetcher/getFetchFn.mjs
5727
+ var __awaiter4 = function(thisArg, _arguments, P, generator) {
5728
+ function adopt(value) {
5729
+ return value instanceof P ? value : new P(function(resolve) {
5730
+ resolve(value);
5623
5731
  });
5624
- Object.setPrototypeOf(this, TooManyRequestsError2.prototype);
5625
5732
  }
5733
+ return new (P || (P = Promise))(function(resolve, reject) {
5734
+ function fulfilled(value) {
5735
+ try {
5736
+ step(generator.next(value));
5737
+ } catch (e) {
5738
+ reject(e);
5739
+ }
5740
+ }
5741
+ function rejected(value) {
5742
+ try {
5743
+ step(generator["throw"](value));
5744
+ } catch (e) {
5745
+ reject(e);
5746
+ }
5747
+ }
5748
+ function step(result) {
5749
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
5750
+ }
5751
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
5752
+ });
5753
+ };
5754
+ function getFetchFn() {
5755
+ return __awaiter4(this, undefined, undefined, function* () {
5756
+ return fetch;
5757
+ });
5626
5758
  }
5627
5759
 
5628
- // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/UnauthorizedError.mjs
5629
- class UnauthorizedError2 extends IntercomError {
5630
- constructor(body, rawResponse) {
5631
- super({
5632
- message: "UnauthorizedError",
5633
- statusCode: 401,
5634
- body,
5635
- rawResponse
5760
+ // node_modules/intercom-client/dist/esm/core/fetcher/getRequestBody.mjs
5761
+ var __awaiter5 = function(thisArg, _arguments, P, generator) {
5762
+ function adopt(value) {
5763
+ return value instanceof P ? value : new P(function(resolve) {
5764
+ resolve(value);
5636
5765
  });
5637
- Object.setPrototypeOf(this, UnauthorizedError2.prototype);
5638
5766
  }
5767
+ return new (P || (P = Promise))(function(resolve, reject) {
5768
+ function fulfilled(value) {
5769
+ try {
5770
+ step(generator.next(value));
5771
+ } catch (e) {
5772
+ reject(e);
5773
+ }
5774
+ }
5775
+ function rejected(value) {
5776
+ try {
5777
+ step(generator["throw"](value));
5778
+ } catch (e) {
5779
+ reject(e);
5780
+ }
5781
+ }
5782
+ function step(result) {
5783
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
5784
+ }
5785
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
5786
+ });
5787
+ };
5788
+ function getRequestBody(_a) {
5789
+ return __awaiter5(this, arguments, undefined, function* ({ body, type }) {
5790
+ if (type === "form") {
5791
+ return toQueryString(body, { arrayFormat: "repeat", encode: true });
5792
+ }
5793
+ if (type.includes("json")) {
5794
+ return toJson(body);
5795
+ } else {
5796
+ return body;
5797
+ }
5798
+ });
5639
5799
  }
5640
5800
 
5641
- // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/UnprocessableEntityError.mjs
5642
- class UnprocessableEntityError2 extends IntercomError {
5643
- constructor(body, rawResponse) {
5644
- super({
5645
- message: "UnprocessableEntityError",
5646
- statusCode: 422,
5647
- body,
5648
- rawResponse
5801
+ // node_modules/intercom-client/dist/esm/core/fetcher/Headers.mjs
5802
+ var Headers;
5803
+ if (typeof globalThis.Headers !== "undefined") {
5804
+ Headers = globalThis.Headers;
5805
+ } else {
5806
+ Headers = class Headers2 {
5807
+ constructor(init) {
5808
+ this.headers = new Map;
5809
+ if (init) {
5810
+ if (init instanceof Headers2) {
5811
+ init.forEach((value, key) => this.append(key, value));
5812
+ } else if (Array.isArray(init)) {
5813
+ for (const [key, value] of init) {
5814
+ if (typeof key === "string" && typeof value === "string") {
5815
+ this.append(key, value);
5816
+ } else {
5817
+ throw new TypeError("Each header entry must be a [string, string] tuple");
5818
+ }
5819
+ }
5820
+ } else {
5821
+ for (const [key, value] of Object.entries(init)) {
5822
+ if (typeof value === "string") {
5823
+ this.append(key, value);
5824
+ } else {
5825
+ throw new TypeError("Header values must be strings");
5826
+ }
5827
+ }
5828
+ }
5829
+ }
5830
+ }
5831
+ append(name, value) {
5832
+ const key = name.toLowerCase();
5833
+ const existing = this.headers.get(key) || [];
5834
+ this.headers.set(key, [...existing, value]);
5835
+ }
5836
+ delete(name) {
5837
+ const key = name.toLowerCase();
5838
+ this.headers.delete(key);
5839
+ }
5840
+ get(name) {
5841
+ const key = name.toLowerCase();
5842
+ const values = this.headers.get(key);
5843
+ return values ? values.join(", ") : null;
5844
+ }
5845
+ has(name) {
5846
+ const key = name.toLowerCase();
5847
+ return this.headers.has(key);
5848
+ }
5849
+ set(name, value) {
5850
+ const key = name.toLowerCase();
5851
+ this.headers.set(key, [value]);
5852
+ }
5853
+ forEach(callbackfn, thisArg) {
5854
+ const boundCallback = thisArg ? callbackfn.bind(thisArg) : callbackfn;
5855
+ this.headers.forEach((values, key) => boundCallback(values.join(", "), key, this));
5856
+ }
5857
+ getSetCookie() {
5858
+ return this.headers.get("set-cookie") || [];
5859
+ }
5860
+ *entries() {
5861
+ for (const [key, values] of this.headers.entries()) {
5862
+ yield [key, values.join(", ")];
5863
+ }
5864
+ }
5865
+ *keys() {
5866
+ yield* this.headers.keys();
5867
+ }
5868
+ *values() {
5869
+ for (const values of this.headers.values()) {
5870
+ yield values.join(", ");
5871
+ }
5872
+ }
5873
+ [Symbol.iterator]() {
5874
+ return this.entries();
5875
+ }
5876
+ };
5877
+ }
5878
+
5879
+ // node_modules/intercom-client/dist/esm/core/fetcher/signals.mjs
5880
+ var TIMEOUT = "timeout";
5881
+ function getTimeoutSignal(timeoutMs) {
5882
+ const controller = new AbortController;
5883
+ const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
5884
+ return { signal: controller.signal, abortId };
5885
+ }
5886
+ function anySignal(...args) {
5887
+ const signals2 = args.length === 1 && Array.isArray(args[0]) ? args[0] : args;
5888
+ const controller = new AbortController;
5889
+ for (const signal of signals2) {
5890
+ if (signal.aborted) {
5891
+ controller.abort(signal === null || signal === undefined ? undefined : signal.reason);
5892
+ break;
5893
+ }
5894
+ signal.addEventListener("abort", () => controller.abort(signal === null || signal === undefined ? undefined : signal.reason), {
5895
+ signal: controller.signal
5649
5896
  });
5650
- Object.setPrototypeOf(this, UnprocessableEntityError2.prototype);
5651
5897
  }
5898
+ return controller.signal;
5652
5899
  }
5653
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/admins/index.mjs
5654
- var exports_admins = {};
5655
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiAgent/index.mjs
5656
- var exports_aiAgent = {};
5657
- __export(exports_aiAgent, {
5658
- AiAgent: () => AiAgent
5659
- });
5660
5900
 
5661
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiAgent/types/AiAgent.mjs
5662
- var AiAgent;
5663
- (function(AiAgent2) {
5664
- AiAgent2.SourceType = {
5665
- EssentialsPlanSetup: "essentials_plan_setup",
5666
- Profile: "profile",
5667
- Workflow: "workflow",
5668
- WorkflowPreview: "workflow_preview",
5669
- FinPreview: "fin_preview"
5670
- };
5671
- AiAgent2.LastAnswerType = {
5672
- AiAnswer: "ai_answer",
5673
- CustomAnswer: "custom_answer"
5674
- };
5675
- AiAgent2.ResolutionState = {
5676
- AssumedResolution: "assumed_resolution",
5677
- ConfirmedResolution: "confirmed_resolution",
5678
- Escalated: "escalated",
5679
- NegativeFeedback: "negative_feedback"
5680
- };
5681
- })(AiAgent || (AiAgent = {}));
5682
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiContent/index.mjs
5683
- var exports_aiContent = {};
5684
- __export(exports_aiContent, {
5685
- ContentImportSource: () => ContentImportSource
5686
- });
5687
-
5688
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiContent/types/ContentImportSource.mjs
5689
- var ContentImportSource;
5690
- (function(ContentImportSource2) {
5691
- ContentImportSource2.SyncBehavior = {
5692
- Api: "api",
5693
- Automatic: "automatic",
5694
- Manual: "manual"
5695
- };
5696
- ContentImportSource2.Status = {
5697
- Active: "active",
5698
- Deactivated: "deactivated"
5699
- };
5700
- })(ContentImportSource || (ContentImportSource = {}));
5701
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiContentSource/index.mjs
5702
- var exports_aiContentSource = {};
5703
- __export(exports_aiContentSource, {
5704
- ContentSource: () => ContentSource
5705
- });
5706
-
5707
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiContentSource/types/ContentSource.mjs
5708
- var ContentSource;
5709
- (function(ContentSource2) {
5710
- ContentSource2.ContentType = {
5711
- File: "file",
5712
- Article: "article",
5713
- ExternalContent: "external_content",
5714
- ContentSnippet: "content_snippet",
5715
- WorkflowConnectorAction: "workflow_connector_action"
5716
- };
5717
- })(ContentSource || (ContentSource = {}));
5718
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/articles/index.mjs
5719
- var exports_articles = {};
5720
- __export(exports_articles, {
5721
- ArticleSearchHighlights: () => ArticleSearchHighlights,
5722
- ArticleListItem: () => ArticleListItem
5723
- });
5724
-
5725
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/articles/types/ArticleListItem.mjs
5726
- var ArticleListItem;
5727
- (function(ArticleListItem2) {
5728
- ArticleListItem2.State = {
5729
- Published: "published",
5730
- Draft: "draft"
5731
- };
5732
- })(ArticleListItem || (ArticleListItem = {}));
5733
-
5734
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/articles/types/ArticleSearchHighlights.mjs
5735
- var ArticleSearchHighlights;
5736
- (function(ArticleSearchHighlights2) {
5737
- let HighlightedTitle;
5738
- (function(HighlightedTitle2) {
5739
- let Item;
5740
- (function(Item2) {
5741
- Item2.Type = {
5742
- Highlight: "highlight",
5743
- Plain: "plain"
5744
- };
5745
- })(Item = HighlightedTitle2.Item || (HighlightedTitle2.Item = {}));
5746
- })(HighlightedTitle = ArticleSearchHighlights2.HighlightedTitle || (ArticleSearchHighlights2.HighlightedTitle = {}));
5747
- let HighlightedSummary;
5748
- (function(HighlightedSummary2) {
5749
- let Item;
5750
- (function(Item2) {
5751
- Item2.Type = {
5752
- Highlight: "highlight",
5753
- Plain: "plain"
5754
- };
5755
- })(Item = HighlightedSummary2.Item || (HighlightedSummary2.Item = {}));
5756
- })(HighlightedSummary = ArticleSearchHighlights2.HighlightedSummary || (ArticleSearchHighlights2.HighlightedSummary = {}));
5757
- })(ArticleSearchHighlights || (ArticleSearchHighlights = {}));
5758
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/awayStatusReasons/index.mjs
5759
- var exports_awayStatusReasons = {};
5760
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/brands/index.mjs
5761
- var exports_brands = {};
5762
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/calls/index.mjs
5763
- var exports_calls = {};
5764
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/companies/index.mjs
5765
- var exports_companies = {};
5766
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/contacts/index.mjs
5767
- var exports_contacts = {};
5768
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/conversations/index.mjs
5769
- var exports_conversations = {};
5770
- __export(exports_conversations, {
5771
- Conversation: () => Conversation
5772
- });
5773
-
5774
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/conversations/types/Conversation.mjs
5775
- var Conversation;
5776
- (function(Conversation2) {
5777
- Conversation2.State = {
5778
- Open: "open",
5779
- Closed: "closed",
5780
- Snoozed: "snoozed"
5781
- };
5782
- Conversation2.Priority = {
5783
- Priority: "priority",
5784
- NotPriority: "not_priority"
5785
- };
5786
- })(Conversation || (Conversation = {}));
5787
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/customChannelEvents/index.mjs
5788
- var exports_customChannelEvents = {};
5789
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/customObjectInstances/index.mjs
5790
- var exports_customObjectInstances = {};
5791
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataAttributes/index.mjs
5792
- var exports_dataAttributes = {};
5793
- __export(exports_dataAttributes, {
5794
- LisDataAttributesRequestModel: () => LisDataAttributesRequestModel,
5795
- DataAttribute: () => DataAttribute
5796
- });
5797
-
5798
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataAttributes/types/DataAttribute.mjs
5799
- var DataAttribute;
5800
- (function(DataAttribute2) {
5801
- DataAttribute2.Model = {
5802
- Contact: "contact",
5803
- Company: "company"
5804
- };
5805
- DataAttribute2.DataType = {
5806
- String: "string",
5807
- Integer: "integer",
5808
- Float: "float",
5809
- Boolean: "boolean",
5810
- Date: "date"
5811
- };
5812
- })(DataAttribute || (DataAttribute = {}));
5813
-
5814
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataAttributes/types/LisDataAttributesRequestModel.mjs
5815
- var LisDataAttributesRequestModel = {
5816
- Contact: "contact",
5817
- Company: "company",
5818
- Conversation: "conversation"
5901
+ // node_modules/intercom-client/dist/esm/core/fetcher/makeRequest.mjs
5902
+ var __awaiter6 = function(thisArg, _arguments, P, generator) {
5903
+ function adopt(value) {
5904
+ return value instanceof P ? value : new P(function(resolve) {
5905
+ resolve(value);
5906
+ });
5907
+ }
5908
+ return new (P || (P = Promise))(function(resolve, reject) {
5909
+ function fulfilled(value) {
5910
+ try {
5911
+ step(generator.next(value));
5912
+ } catch (e) {
5913
+ reject(e);
5914
+ }
5915
+ }
5916
+ function rejected(value) {
5917
+ try {
5918
+ step(generator["throw"](value));
5919
+ } catch (e) {
5920
+ reject(e);
5921
+ }
5922
+ }
5923
+ function step(result) {
5924
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
5925
+ }
5926
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
5927
+ });
5819
5928
  };
5820
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataEvents/index.mjs
5821
- var exports_dataEvents = {};
5822
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataExport/index.mjs
5823
- var exports_dataExport = {};
5824
- __export(exports_dataExport, {
5825
- DataExport: () => DataExport
5929
+ var makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex) => __awaiter6(undefined, undefined, undefined, function* () {
5930
+ const signals2 = [];
5931
+ let timeoutAbortId;
5932
+ if (timeoutMs != null) {
5933
+ const { signal, abortId } = getTimeoutSignal(timeoutMs);
5934
+ timeoutAbortId = abortId;
5935
+ signals2.push(signal);
5936
+ }
5937
+ if (abortSignal != null) {
5938
+ signals2.push(abortSignal);
5939
+ }
5940
+ const newSignals = anySignal(signals2);
5941
+ const response = yield fetchFn(url, {
5942
+ method,
5943
+ headers,
5944
+ body: requestBody,
5945
+ signal: newSignals,
5946
+ credentials: withCredentials ? "include" : undefined,
5947
+ duplex
5948
+ });
5949
+ if (timeoutAbortId != null) {
5950
+ clearTimeout(timeoutAbortId);
5951
+ }
5952
+ return response;
5826
5953
  });
5827
5954
 
5828
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataExport/types/DataExport.mjs
5829
- var DataExport;
5830
- (function(DataExport2) {
5831
- DataExport2.Status = {
5832
- Pending: "pending",
5833
- InProgress: "in_progress",
5834
- Failed: "failed",
5835
- Completed: "completed",
5836
- NoData: "no_data",
5837
- Canceled: "canceled"
5955
+ // node_modules/intercom-client/dist/esm/core/fetcher/RawResponse.mjs
5956
+ var abortRawResponse = {
5957
+ headers: new Headers,
5958
+ redirected: false,
5959
+ status: 499,
5960
+ statusText: "Client Closed Request",
5961
+ type: "error",
5962
+ url: ""
5963
+ };
5964
+ var unknownRawResponse = {
5965
+ headers: new Headers,
5966
+ redirected: false,
5967
+ status: 0,
5968
+ statusText: "Unknown Error",
5969
+ type: "error",
5970
+ url: ""
5971
+ };
5972
+ function toRawResponse(response) {
5973
+ return {
5974
+ headers: response.headers,
5975
+ redirected: response.redirected,
5976
+ status: response.status,
5977
+ statusText: response.statusText,
5978
+ type: response.type,
5979
+ url: response.url
5838
5980
  };
5839
- })(DataExport || (DataExport = {}));
5840
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/emails/index.mjs
5841
- var exports_emails = {};
5842
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/export/index.mjs
5843
- var exports_export = {};
5844
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/helpCenter/index.mjs
5845
- var exports_helpCenter = {};
5846
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/internalArticles/index.mjs
5847
- var exports_internalArticles = {};
5848
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/jobs/index.mjs
5849
- var exports_jobs = {};
5850
- __export(exports_jobs, {
5851
- Jobs: () => Jobs
5852
- });
5853
-
5854
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/jobs/types/Jobs.mjs
5855
- var Jobs;
5856
- (function(Jobs2) {
5857
- Jobs2.Status = {
5858
- Pending: "pending",
5859
- Success: "success",
5860
- Failed: "failed"
5861
- };
5862
- })(Jobs || (Jobs = {}));
5863
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/macros/index.mjs
5864
- var exports_macros = {};
5865
- __export(exports_macros, {
5866
- Macro: () => Macro
5867
- });
5868
-
5869
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/macros/types/Macro.mjs
5870
- var Macro;
5871
- (function(Macro2) {
5872
- Macro2.VisibleTo = {
5873
- Everyone: "everyone",
5874
- SpecificTeams: "specific_teams"
5875
- };
5876
- let AvailableOn;
5877
- (function(AvailableOn2) {
5878
- AvailableOn2.Item = {
5879
- Inbox: "inbox",
5880
- Messenger: "messenger"
5881
- };
5882
- })(AvailableOn = Macro2.AvailableOn || (Macro2.AvailableOn = {}));
5883
- })(Macro || (Macro = {}));
5884
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/messages/index.mjs
5885
- var exports_messages = {};
5886
- __export(exports_messages, {
5887
- Message: () => Message
5888
- });
5889
-
5890
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/messages/types/Message.mjs
5891
- var Message;
5892
- (function(Message2) {
5893
- Message2.MessageType = {
5894
- Email: "email",
5895
- Inapp: "inapp",
5896
- Facebook: "facebook",
5897
- Twitter: "twitter",
5898
- Sms: "sms",
5899
- Whatsapp: "whatsapp"
5900
- };
5901
- })(Message || (Message = {}));
5902
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/news/index.mjs
5903
- var exports_news = {};
5904
- __export(exports_news, {
5905
- NewsItem: () => NewsItem
5906
- });
5907
-
5908
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/news/types/NewsItem.mjs
5909
- var NewsItem;
5910
- (function(NewsItem2) {
5911
- NewsItem2.State = {
5912
- Draft: "draft",
5913
- Live: "live"
5914
- };
5915
- })(NewsItem || (NewsItem = {}));
5916
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/notes/index.mjs
5917
- var exports_notes = {};
5918
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/segments/index.mjs
5919
- var exports_segments = {};
5920
- __export(exports_segments, {
5921
- Segment: () => Segment
5922
- });
5923
-
5924
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/segments/types/Segment.mjs
5925
- var Segment;
5926
- (function(Segment2) {
5927
- Segment2.PersonType = {
5928
- Contact: "contact",
5929
- User: "user"
5930
- };
5931
- })(Segment || (Segment = {}));
5932
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/subscriptionTypes/index.mjs
5933
- var exports_subscriptionTypes = {};
5934
- __export(exports_subscriptionTypes, {
5935
- SubscriptionType: () => SubscriptionType
5936
- });
5937
-
5938
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/subscriptionTypes/types/SubscriptionType.mjs
5939
- var SubscriptionType;
5940
- (function(SubscriptionType2) {
5941
- SubscriptionType2.State = {
5942
- Live: "live",
5943
- Draft: "draft",
5944
- Archived: "archived"
5945
- };
5946
- SubscriptionType2.ConsentType = {
5947
- OptOut: "opt_out",
5948
- OptIn: "opt_in"
5949
- };
5950
- let ContentTypes;
5951
- (function(ContentTypes2) {
5952
- ContentTypes2.Item = {
5953
- Email: "email",
5954
- SmsMessage: "sms_message"
5955
- };
5956
- })(ContentTypes = SubscriptionType2.ContentTypes || (SubscriptionType2.ContentTypes = {}));
5957
- })(SubscriptionType || (SubscriptionType = {}));
5958
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/switch/index.mjs
5959
- var exports_switch = {};
5960
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tags/index.mjs
5961
- var exports_tags = {};
5962
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/teams/index.mjs
5963
- var exports_teams = {};
5964
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/ticketStates/index.mjs
5965
- var exports_ticketStates = {};
5966
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/index.mjs
5967
- var exports_tickets = {};
5968
- __export(exports_tickets, {
5969
- TicketType: () => TicketType,
5970
- TicketStateDetailed: () => TicketStateDetailed,
5971
- TicketState: () => TicketState,
5972
- TicketPart: () => TicketPart,
5973
- Ticket: () => Ticket
5974
- });
5975
-
5976
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/types/Ticket.mjs
5977
- var Ticket;
5978
- (function(Ticket2) {
5979
- Ticket2.Category = {
5980
- Customer: "Customer",
5981
- BackOffice: "Back-office",
5982
- Tracker: "Tracker"
5983
- };
5984
- })(Ticket || (Ticket = {}));
5985
-
5986
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/types/TicketPart.mjs
5987
- var TicketPart;
5988
- (function(TicketPart2) {
5989
- TicketPart2.PreviousTicketState = {
5990
- Submitted: "submitted",
5991
- InProgress: "in_progress",
5992
- WaitingOnCustomer: "waiting_on_customer",
5993
- Resolved: "resolved"
5994
- };
5995
- TicketPart2.TicketState = {
5996
- Submitted: "submitted",
5997
- InProgress: "in_progress",
5998
- WaitingOnCustomer: "waiting_on_customer",
5999
- Resolved: "resolved"
6000
- };
6001
- })(TicketPart || (TicketPart = {}));
6002
-
6003
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/types/TicketState.mjs
6004
- var TicketState;
6005
- (function(TicketState2) {
6006
- TicketState2.Category = {
6007
- Submitted: "submitted",
6008
- InProgress: "in_progress",
6009
- WaitingOnCustomer: "waiting_on_customer",
6010
- Resolved: "resolved"
6011
- };
6012
- })(TicketState || (TicketState = {}));
6013
-
6014
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/types/TicketStateDetailed.mjs
6015
- var TicketStateDetailed;
6016
- (function(TicketStateDetailed2) {
6017
- TicketStateDetailed2.Category = {
6018
- Submitted: "submitted",
6019
- InProgress: "in_progress",
6020
- WaitingOnCustomer: "waiting_on_customer",
6021
- Resolved: "resolved"
6022
- };
6023
- })(TicketStateDetailed || (TicketStateDetailed = {}));
6024
-
6025
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/types/TicketType.mjs
6026
- var TicketType;
6027
- (function(TicketType2) {
6028
- TicketType2.Category = {
6029
- Customer: "Customer",
6030
- BackOffice: "Back-office",
6031
- Tracker: "Tracker"
6032
- };
6033
- })(TicketType || (TicketType = {}));
6034
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/ticketTypeAttributes/index.mjs
6035
- var exports_ticketTypeAttributes = {};
6036
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/ticketTypes/index.mjs
6037
- var exports_ticketTypes = {};
6038
- // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/visitors/index.mjs
6039
- var exports_visitors = {};
6040
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/ActivityLog.mjs
6041
- var ActivityLog;
6042
- (function(ActivityLog2) {
6043
- ActivityLog2.ActivityType = {
6044
- AdminConversationAssignmentLimitChange: "admin_conversation_assignment_limit_change",
6045
- AdminTicketAssignmentLimitChange: "admin_ticket_assignment_limit_change",
6046
- AdminAwayModeChange: "admin_away_mode_change",
6047
- AdminDeletion: "admin_deletion",
6048
- AdminDeprovisioned: "admin_deprovisioned",
6049
- AdminImpersonationEnd: "admin_impersonation_end",
6050
- AdminImpersonationStart: "admin_impersonation_start",
6051
- AdminInviteChange: "admin_invite_change",
6052
- AdminInviteCreation: "admin_invite_creation",
6053
- AdminInviteDeletion: "admin_invite_deletion",
6054
- AdminLoginFailure: "admin_login_failure",
6055
- AdminLoginSuccess: "admin_login_success",
6056
- AdminLogout: "admin_logout",
6057
- AdminPasswordResetRequest: "admin_password_reset_request",
6058
- AdminPasswordResetSuccess: "admin_password_reset_success",
6059
- AdminPermissionChange: "admin_permission_change",
6060
- AdminProvisioned: "admin_provisioned",
6061
- AdminTwoFactorAuthChange: "admin_two_factor_auth_change",
6062
- AdminUnauthorizedSignInMethod: "admin_unauthorized_sign_in_method",
6063
- AppAdminJoin: "app_admin_join",
6064
- AppAuthenticationMethodChange: "app_authentication_method_change",
6065
- AppDataDeletion: "app_data_deletion",
6066
- AppDataExport: "app_data_export",
6067
- AppGoogleSsoDomainChange: "app_google_sso_domain_change",
6068
- AppIdentityVerificationChange: "app_identity_verification_change",
6069
- AppNameChange: "app_name_change",
6070
- AppOutboundAddressChange: "app_outbound_address_change",
6071
- AppPackageInstallation: "app_package_installation",
6072
- AppPackageTokenRegeneration: "app_package_token_regeneration",
6073
- AppPackageUninstallation: "app_package_uninstallation",
6074
- AppTeamCreation: "app_team_creation",
6075
- AppTeamDeletion: "app_team_deletion",
6076
- AppTeamMembershipModification: "app_team_membership_modification",
6077
- AppTimezoneChange: "app_timezone_change",
6078
- AppWebhookCreation: "app_webhook_creation",
6079
- AppWebhookDeletion: "app_webhook_deletion",
6080
- ArticlesInMessengerEnabledChange: "articles_in_messenger_enabled_change",
6081
- BulkDelete: "bulk_delete",
6082
- BulkExport: "bulk_export",
6083
- CampaignDeletion: "campaign_deletion",
6084
- CampaignStateChange: "campaign_state_change",
6085
- ConversationPartDeletion: "conversation_part_deletion",
6086
- ConversationTopicChange: "conversation_topic_change",
6087
- ConversationTopicCreation: "conversation_topic_creation",
6088
- ConversationTopicDeletion: "conversation_topic_deletion",
6089
- HelpCenterSettingsChange: "help_center_settings_change",
6090
- InboundConversationsChange: "inbound_conversations_change",
6091
- InboxAccessChange: "inbox_access_change",
6092
- MessageDeletion: "message_deletion",
6093
- MessageStateChange: "message_state_change",
6094
- MessengerLookAndFeelChange: "messenger_look_and_feel_change",
6095
- MessengerSearchRequiredChange: "messenger_search_required_change",
6096
- MessengerSpacesChange: "messenger_spaces_change",
6097
- OfficeHoursChange: "office_hours_change",
6098
- RoleChange: "role_change",
6099
- RoleCreation: "role_creation",
6100
- RoleDeletion: "role_deletion",
6101
- RulesetActivationTitlePreview: "ruleset_activation_title_preview",
6102
- RulesetCreation: "ruleset_creation",
6103
- RulesetDeletion: "ruleset_deletion",
6104
- SearchBrowseEnabledChange: "search_browse_enabled_change",
6105
- SearchBrowseRequiredChange: "search_browse_required_change",
6106
- SeatChange: "seat_change",
6107
- SeatRevoke: "seat_revoke",
6108
- SecuritySettingsChange: "security_settings_change",
6109
- TemporaryExpectationChange: "temporary_expectation_change",
6110
- UpfrontEmailCollectionChange: "upfront_email_collection_change",
6111
- WelcomeMessageChange: "welcome_message_change"
6112
- };
6113
- })(ActivityLog || (ActivityLog = {}));
6114
-
6115
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/AdminReplyConversationRequest.mjs
6116
- var AdminReplyConversationRequest;
6117
- (function(AdminReplyConversationRequest2) {
6118
- AdminReplyConversationRequest2.MessageType = {
6119
- Comment: "comment",
6120
- Note: "note",
6121
- QuickReply: "quick_reply"
6122
- };
6123
- })(AdminReplyConversationRequest || (AdminReplyConversationRequest = {}));
6124
-
6125
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/AdminReplyTicketRequest.mjs
6126
- var AdminReplyTicketRequest;
6127
- (function(AdminReplyTicketRequest2) {
6128
- AdminReplyTicketRequest2.MessageType = {
6129
- Comment: "comment",
6130
- Note: "note",
6131
- QuickReply: "quick_reply"
6132
- };
6133
- })(AdminReplyTicketRequest || (AdminReplyTicketRequest = {}));
6134
-
6135
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/ArticleContent.mjs
6136
- var ArticleContent;
6137
- (function(ArticleContent2) {
6138
- ArticleContent2.State = {
6139
- Published: "published",
6140
- Draft: "draft"
6141
- };
6142
- })(ArticleContent || (ArticleContent = {}));
6143
-
6144
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/AssignConversationRequest.mjs
6145
- var AssignConversationRequest;
6146
- (function(AssignConversationRequest2) {
6147
- AssignConversationRequest2.Type = {
6148
- Admin: "admin",
6149
- Team: "team"
6150
- };
6151
- })(AssignConversationRequest || (AssignConversationRequest = {}));
6152
-
6153
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/ConversationPart.mjs
6154
- var ConversationPart;
6155
- (function(ConversationPart2) {
6156
- ConversationPart2.State = {
6157
- Open: "open",
6158
- Closed: "closed",
6159
- Snoozed: "snoozed"
6160
- };
6161
- })(ConversationPart || (ConversationPart = {}));
6162
-
6163
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/ConversationSource.mjs
6164
- var ConversationSource;
6165
- (function(ConversationSource2) {
6166
- ConversationSource2.Type = {
6167
- Conversation: "conversation",
6168
- Email: "email",
6169
- Facebook: "facebook",
6170
- Instagram: "instagram",
6171
- PhoneCall: "phone_call",
6172
- PhoneSwitch: "phone_switch",
6173
- Push: "push",
6174
- Sms: "sms",
6175
- Twitter: "twitter",
6176
- Whatsapp: "whatsapp"
6177
- };
6178
- })(ConversationSource || (ConversationSource = {}));
6179
-
6180
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/CreateArticleRequest.mjs
6181
- var CreateArticleRequest;
6182
- (function(CreateArticleRequest2) {
6183
- CreateArticleRequest2.State = {
6184
- Published: "published",
6185
- Draft: "draft"
6186
- };
6187
- })(CreateArticleRequest || (CreateArticleRequest = {}));
6188
-
6189
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/CreateTicketTypeRequest.mjs
6190
- var CreateTicketTypeRequest;
6191
- (function(CreateTicketTypeRequest2) {
6192
- CreateTicketTypeRequest2.Category = {
6193
- Customer: "Customer",
6194
- BackOffice: "Back-office",
6195
- Tracker: "Tracker"
6196
- };
6197
- })(CreateTicketTypeRequest || (CreateTicketTypeRequest = {}));
6198
-
6199
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/CustomActionFinished.mjs
6200
- var CustomActionFinished;
6201
- (function(CustomActionFinished2) {
6202
- let Action;
6203
- (function(Action2) {
6204
- Action2.Result = {
6205
- Success: "success",
6206
- Failed: "failed"
6207
- };
6208
- })(Action = CustomActionFinished2.Action || (CustomActionFinished2.Action = {}));
6209
- })(CustomActionFinished || (CustomActionFinished = {}));
6210
-
6211
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/CustomChannelContact.mjs
6212
- var CustomChannelContact;
6213
- (function(CustomChannelContact2) {
6214
- CustomChannelContact2.Type = {
6215
- User: "user",
6216
- Lead: "lead"
6217
- };
6218
- })(CustomChannelContact || (CustomChannelContact = {}));
6219
-
6220
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/LinkedObject.mjs
6221
- var LinkedObject;
6222
- (function(LinkedObject2) {
6223
- LinkedObject2.Type = {
6224
- Ticket: "ticket",
6225
- Conversation: "conversation"
6226
- };
6227
- LinkedObject2.Category = {
6228
- Customer: "Customer",
6229
- BackOffice: "Back-office",
6230
- Tracker: "Tracker"
6231
- };
6232
- })(LinkedObject || (LinkedObject = {}));
6233
-
6234
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/MultipleFilterSearchRequest.mjs
6235
- var MultipleFilterSearchRequest;
6236
- (function(MultipleFilterSearchRequest2) {
6237
- MultipleFilterSearchRequest2.Operator = {
6238
- And: "AND",
6239
- Or: "OR"
6240
- };
6241
- })(MultipleFilterSearchRequest || (MultipleFilterSearchRequest = {}));
6242
-
6243
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/NewsItemRequest.mjs
6244
- var NewsItemRequest;
6245
- (function(NewsItemRequest2) {
6246
- NewsItemRequest2.State = {
6247
- Draft: "draft",
6248
- Live: "live"
6249
- };
6250
- })(NewsItemRequest || (NewsItemRequest = {}));
6251
-
6252
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/PaginatedResponse.mjs
6253
- var PaginatedResponse;
6254
- (function(PaginatedResponse2) {
6255
- PaginatedResponse2.Type = {
6256
- List: "list",
6257
- ConversationList: "conversation.list"
6258
- };
6259
- })(PaginatedResponse || (PaginatedResponse = {}));
6260
-
6261
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/Recipient.mjs
6262
- var Recipient;
6263
- (function(Recipient2) {
6264
- Recipient2.Type = {
6265
- User: "user",
6266
- Lead: "lead"
6267
- };
6268
- })(Recipient || (Recipient = {}));
6269
-
6270
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/RegisterFinVoiceCallRequest.mjs
6271
- var RegisterFinVoiceCallRequest;
6272
- (function(RegisterFinVoiceCallRequest2) {
6273
- RegisterFinVoiceCallRequest2.Source = {
6274
- Five9: "five9",
6275
- ZoomPhone: "zoom_phone",
6276
- AwsConnect: "aws_connect"
6277
- };
6278
- })(RegisterFinVoiceCallRequest || (RegisterFinVoiceCallRequest = {}));
6279
-
6280
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/SingleFilterSearchRequest.mjs
6281
- var SingleFilterSearchRequest;
6282
- (function(SingleFilterSearchRequest2) {
6283
- SingleFilterSearchRequest2.Operator = {
6284
- EqualTo: "=",
6285
- NotEquals: "!=",
6286
- In: "IN",
6287
- Nin: "NIN",
6288
- LessThan: "<",
6289
- GreaterThan: ">"
6290
- };
6291
- })(SingleFilterSearchRequest || (SingleFilterSearchRequest = {}));
6292
-
6293
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/SlaApplied.mjs
6294
- var SlaApplied;
6295
- (function(SlaApplied2) {
6296
- SlaApplied2.SlaStatus = {
6297
- Hit: "hit",
6298
- Missed: "missed",
6299
- Cancelled: "cancelled",
6300
- Active: "active"
6301
- };
6302
- })(SlaApplied || (SlaApplied = {}));
6303
-
6304
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/TicketPartAuthor.mjs
6305
- var TicketPartAuthor;
6306
- (function(TicketPartAuthor2) {
6307
- TicketPartAuthor2.Type = {
6308
- Admin: "admin",
6309
- Bot: "bot",
6310
- Team: "team",
6311
- User: "user"
6312
- };
6313
- })(TicketPartAuthor || (TicketPartAuthor = {}));
6314
-
6315
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/TicketReply.mjs
6316
- var TicketReply;
6317
- (function(TicketReply2) {
6318
- TicketReply2.PartType = {
6319
- Note: "note",
6320
- Comment: "comment",
6321
- QuickReply: "quick_reply"
6322
- };
6323
- })(TicketReply || (TicketReply = {}));
6324
-
6325
- // node_modules/intercom-client/dist/esm/api/resources/unstable/types/WhatsappMessageStatusList.mjs
6326
- var WhatsappMessageStatusList;
6327
- (function(WhatsappMessageStatusList2) {
6328
- let Events;
6329
- (function(Events2) {
6330
- let Item;
6331
- (function(Item2) {
6332
- Item2.Status = {
6333
- Sent: "sent",
6334
- Delivered: "delivered",
6335
- Read: "read",
6336
- Failed: "failed"
6337
- };
6338
- })(Item = Events2.Item || (Events2.Item = {}));
6339
- })(Events = WhatsappMessageStatusList2.Events || (WhatsappMessageStatusList2.Events = {}));
6340
- })(WhatsappMessageStatusList || (WhatsappMessageStatusList = {}));
6341
- // node_modules/intercom-client/dist/esm/core/auth/NoOpAuthProvider.mjs
6342
- class NoOpAuthProvider {
6343
- getAuthRequest() {
6344
- return Promise.resolve({ headers: {} });
6345
- }
6346
- }
6347
- // node_modules/intercom-client/dist/esm/core/fetcher/EndpointSupplier.mjs
6348
- var __awaiter = function(thisArg, _arguments, P, generator) {
6349
- function adopt(value) {
6350
- return value instanceof P ? value : new P(function(resolve) {
6351
- resolve(value);
6352
- });
6353
- }
6354
- return new (P || (P = Promise))(function(resolve, reject) {
6355
- function fulfilled(value) {
6356
- try {
6357
- step(generator.next(value));
6358
- } catch (e) {
6359
- reject(e);
6360
- }
6361
- }
6362
- function rejected(value) {
6363
- try {
6364
- step(generator["throw"](value));
6365
- } catch (e) {
6366
- reject(e);
6367
- }
6368
- }
6369
- function step(result) {
6370
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6371
- }
6372
- step((generator = generator.apply(thisArg, _arguments || [])).next());
6373
- });
6374
- };
6375
- var EndpointSupplier = {
6376
- get: (supplier, arg) => __awaiter(undefined, undefined, undefined, function* () {
6377
- if (typeof supplier === "function") {
6378
- return supplier(arg);
6379
- } else {
6380
- return supplier;
6381
- }
6382
- })
6383
- };
6384
-
6385
- // node_modules/intercom-client/dist/esm/core/logging/logger.mjs
6386
- var LogLevel = {
6387
- Debug: "debug",
6388
- Info: "info",
6389
- Warn: "warn",
6390
- Error: "error"
6391
- };
6392
- var logLevelMap = {
6393
- [LogLevel.Debug]: 1,
6394
- [LogLevel.Info]: 2,
6395
- [LogLevel.Warn]: 3,
6396
- [LogLevel.Error]: 4
6397
- };
6398
-
6399
- class ConsoleLogger {
6400
- debug(message, ...args) {
6401
- console.debug(message, ...args);
6402
- }
6403
- info(message, ...args) {
6404
- console.info(message, ...args);
6405
- }
6406
- warn(message, ...args) {
6407
- console.warn(message, ...args);
6408
- }
6409
- error(message, ...args) {
6410
- console.error(message, ...args);
6411
- }
6412
- }
6413
-
6414
- class Logger {
6415
- constructor(config) {
6416
- this.level = logLevelMap[config.level];
6417
- this.logger = config.logger;
6418
- this.silent = config.silent;
6419
- }
6420
- shouldLog(level) {
6421
- return !this.silent && this.level <= logLevelMap[level];
6422
- }
6423
- isDebug() {
6424
- return this.shouldLog(LogLevel.Debug);
6425
- }
6426
- debug(message, ...args) {
6427
- if (this.isDebug()) {
6428
- this.logger.debug(message, ...args);
6429
- }
6430
- }
6431
- isInfo() {
6432
- return this.shouldLog(LogLevel.Info);
6433
- }
6434
- info(message, ...args) {
6435
- if (this.isInfo()) {
6436
- this.logger.info(message, ...args);
6437
- }
6438
- }
6439
- isWarn() {
6440
- return this.shouldLog(LogLevel.Warn);
6441
- }
6442
- warn(message, ...args) {
6443
- if (this.isWarn()) {
6444
- this.logger.warn(message, ...args);
6445
- }
6446
- }
6447
- isError() {
6448
- return this.shouldLog(LogLevel.Error);
6449
- }
6450
- error(message, ...args) {
6451
- if (this.isError()) {
6452
- this.logger.error(message, ...args);
6453
- }
6454
- }
6455
- }
6456
- function createLogger(config) {
6457
- var _a, _b, _c;
6458
- if (config == null) {
6459
- return defaultLogger;
6460
- }
6461
- if (config instanceof Logger) {
6462
- return config;
6463
- }
6464
- config = config !== null && config !== undefined ? config : {};
6465
- (_a = config.level) !== null && _a !== undefined || (config.level = LogLevel.Info);
6466
- (_b = config.logger) !== null && _b !== undefined || (config.logger = new ConsoleLogger);
6467
- (_c = config.silent) !== null && _c !== undefined || (config.silent = true);
6468
- return new Logger(config);
6469
- }
6470
- var defaultLogger = new Logger({
6471
- level: LogLevel.Info,
6472
- logger: new ConsoleLogger,
6473
- silent: true
6474
- });
6475
-
6476
- // node_modules/intercom-client/dist/esm/core/url/qs.mjs
6477
- var defaultQsOptions = {
6478
- arrayFormat: "indices",
6479
- encode: true
6480
- };
6481
- function encodeValue(value, shouldEncode) {
6482
- if (value === undefined) {
6483
- return "";
6484
- }
6485
- if (value === null) {
6486
- return "";
6487
- }
6488
- const stringValue = String(value);
6489
- return shouldEncode ? encodeURIComponent(stringValue) : stringValue;
6490
- }
6491
- function stringifyObject(obj, prefix = "", options) {
6492
- const parts = [];
6493
- for (const [key, value] of Object.entries(obj)) {
6494
- const fullKey = prefix ? `${prefix}[${key}]` : key;
6495
- if (value === undefined) {
6496
- continue;
6497
- }
6498
- if (Array.isArray(value)) {
6499
- if (value.length === 0) {
6500
- continue;
6501
- }
6502
- for (let i = 0;i < value.length; i++) {
6503
- const item = value[i];
6504
- if (item === undefined) {
6505
- continue;
6506
- }
6507
- if (typeof item === "object" && !Array.isArray(item) && item !== null) {
6508
- const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
6509
- parts.push(...stringifyObject(item, arrayKey, options));
6510
- } else {
6511
- const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
6512
- const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
6513
- parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
6514
- }
6515
- }
6516
- } else if (typeof value === "object" && value !== null) {
6517
- if (Object.keys(value).length === 0) {
6518
- continue;
6519
- }
6520
- parts.push(...stringifyObject(value, fullKey, options));
6521
- } else {
6522
- const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
6523
- parts.push(`${encodedKey}=${encodeValue(value, options.encode)}`);
6524
- }
6525
- }
6526
- return parts;
6527
- }
6528
- function toQueryString(obj, options) {
6529
- if (obj == null || typeof obj !== "object") {
6530
- return "";
6531
- }
6532
- const parts = stringifyObject(obj, "", Object.assign(Object.assign({}, defaultQsOptions), options));
6533
- return parts.join("&");
6534
- }
6535
-
6536
- // node_modules/intercom-client/dist/esm/core/fetcher/createRequestUrl.mjs
6537
- function createRequestUrl(baseUrl, queryParameters) {
6538
- const queryString = toQueryString(queryParameters, { arrayFormat: "repeat" });
6539
- return queryString ? `${baseUrl}?${queryString}` : baseUrl;
6540
- }
6541
-
6542
- // node_modules/intercom-client/dist/esm/core/fetcher/BinaryResponse.mjs
6543
- function getBinaryResponse(response) {
6544
- const binaryResponse = {
6545
- get bodyUsed() {
6546
- return response.bodyUsed;
6547
- },
6548
- stream: () => response.body,
6549
- arrayBuffer: response.arrayBuffer.bind(response),
6550
- blob: response.blob.bind(response)
6551
- };
6552
- if ("bytes" in response && typeof response.bytes === "function") {
6553
- binaryResponse.bytes = response.bytes.bind(response);
6554
- }
6555
- return binaryResponse;
6556
- }
6557
-
6558
- // node_modules/intercom-client/dist/esm/core/fetcher/getResponseBody.mjs
6559
- var __awaiter2 = function(thisArg, _arguments, P, generator) {
6560
- function adopt(value) {
6561
- return value instanceof P ? value : new P(function(resolve) {
6562
- resolve(value);
6563
- });
6564
- }
6565
- return new (P || (P = Promise))(function(resolve, reject) {
6566
- function fulfilled(value) {
6567
- try {
6568
- step(generator.next(value));
6569
- } catch (e) {
6570
- reject(e);
6571
- }
6572
- }
6573
- function rejected(value) {
6574
- try {
6575
- step(generator["throw"](value));
6576
- } catch (e) {
6577
- reject(e);
6578
- }
6579
- }
6580
- function step(result) {
6581
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6582
- }
6583
- step((generator = generator.apply(thisArg, _arguments || [])).next());
6584
- });
6585
- };
6586
- function getResponseBody(response, responseType) {
6587
- return __awaiter2(this, undefined, undefined, function* () {
6588
- switch (responseType) {
6589
- case "binary-response":
6590
- return getBinaryResponse(response);
6591
- case "blob":
6592
- return yield response.blob();
6593
- case "arrayBuffer":
6594
- return yield response.arrayBuffer();
6595
- case "sse":
6596
- if (response.body == null) {
6597
- return {
6598
- ok: false,
6599
- error: {
6600
- reason: "body-is-null",
6601
- statusCode: response.status
6602
- }
6603
- };
6604
- }
6605
- return response.body;
6606
- case "streaming":
6607
- if (response.body == null) {
6608
- return {
6609
- ok: false,
6610
- error: {
6611
- reason: "body-is-null",
6612
- statusCode: response.status
6613
- }
6614
- };
6615
- }
6616
- return response.body;
6617
- case "text":
6618
- return yield response.text();
6619
- }
6620
- const text = yield response.text();
6621
- if (text.length > 0) {
6622
- try {
6623
- const responseBody = fromJson(text);
6624
- return responseBody;
6625
- } catch (_err) {
6626
- return {
6627
- ok: false,
6628
- error: {
6629
- reason: "non-json",
6630
- statusCode: response.status,
6631
- rawBody: text
6632
- }
6633
- };
6634
- }
6635
- }
6636
- return;
6637
- });
6638
- }
6639
-
6640
- // node_modules/intercom-client/dist/esm/core/fetcher/getErrorResponseBody.mjs
6641
- var __awaiter3 = function(thisArg, _arguments, P, generator) {
6642
- function adopt(value) {
6643
- return value instanceof P ? value : new P(function(resolve) {
6644
- resolve(value);
6645
- });
6646
- }
6647
- return new (P || (P = Promise))(function(resolve, reject) {
6648
- function fulfilled(value) {
6649
- try {
6650
- step(generator.next(value));
6651
- } catch (e) {
6652
- reject(e);
6653
- }
6654
- }
6655
- function rejected(value) {
6656
- try {
6657
- step(generator["throw"](value));
6658
- } catch (e) {
6659
- reject(e);
6660
- }
6661
- }
6662
- function step(result) {
6663
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6664
- }
6665
- step((generator = generator.apply(thisArg, _arguments || [])).next());
6666
- });
6667
- };
6668
- function getErrorResponseBody(response) {
6669
- return __awaiter3(this, undefined, undefined, function* () {
6670
- var _a, _b, _c;
6671
- let contentType = (_a = response.headers.get("Content-Type")) === null || _a === undefined ? undefined : _a.toLowerCase();
6672
- if (contentType == null || contentType.length === 0) {
6673
- return getResponseBody(response);
6674
- }
6675
- if (contentType.indexOf(";") !== -1) {
6676
- contentType = (_c = (_b = contentType.split(";")[0]) === null || _b === undefined ? undefined : _b.trim()) !== null && _c !== undefined ? _c : "";
6677
- }
6678
- switch (contentType) {
6679
- case "application/hal+json":
6680
- case "application/json":
6681
- case "application/ld+json":
6682
- case "application/problem+json":
6683
- case "application/vnd.api+json":
6684
- case "text/json": {
6685
- const text = yield response.text();
6686
- return text.length > 0 ? fromJson(text) : undefined;
6687
- }
6688
- default:
6689
- if (contentType.startsWith("application/vnd.") && contentType.endsWith("+json")) {
6690
- const text = yield response.text();
6691
- return text.length > 0 ? fromJson(text) : undefined;
6692
- }
6693
- return yield response.text();
6694
- }
6695
- });
6696
- }
6697
-
6698
- // node_modules/intercom-client/dist/esm/core/fetcher/getFetchFn.mjs
6699
- var __awaiter4 = function(thisArg, _arguments, P, generator) {
6700
- function adopt(value) {
6701
- return value instanceof P ? value : new P(function(resolve) {
6702
- resolve(value);
6703
- });
6704
- }
6705
- return new (P || (P = Promise))(function(resolve, reject) {
6706
- function fulfilled(value) {
6707
- try {
6708
- step(generator.next(value));
6709
- } catch (e) {
6710
- reject(e);
6711
- }
6712
- }
6713
- function rejected(value) {
6714
- try {
6715
- step(generator["throw"](value));
6716
- } catch (e) {
6717
- reject(e);
6718
- }
6719
- }
6720
- function step(result) {
6721
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6722
- }
6723
- step((generator = generator.apply(thisArg, _arguments || [])).next());
6724
- });
6725
- };
6726
- function getFetchFn() {
6727
- return __awaiter4(this, undefined, undefined, function* () {
6728
- return fetch;
6729
- });
6730
- }
6731
-
6732
- // node_modules/intercom-client/dist/esm/core/fetcher/getRequestBody.mjs
6733
- var __awaiter5 = function(thisArg, _arguments, P, generator) {
6734
- function adopt(value) {
6735
- return value instanceof P ? value : new P(function(resolve) {
6736
- resolve(value);
6737
- });
6738
- }
6739
- return new (P || (P = Promise))(function(resolve, reject) {
6740
- function fulfilled(value) {
6741
- try {
6742
- step(generator.next(value));
6743
- } catch (e) {
6744
- reject(e);
6745
- }
6746
- }
6747
- function rejected(value) {
6748
- try {
6749
- step(generator["throw"](value));
6750
- } catch (e) {
6751
- reject(e);
6752
- }
6753
- }
6754
- function step(result) {
6755
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6756
- }
6757
- step((generator = generator.apply(thisArg, _arguments || [])).next());
6758
- });
6759
- };
6760
- function getRequestBody(_a) {
6761
- return __awaiter5(this, arguments, undefined, function* ({ body, type }) {
6762
- if (type === "form") {
6763
- return toQueryString(body, { arrayFormat: "repeat", encode: true });
6764
- }
6765
- if (type.includes("json")) {
6766
- return toJson(body);
6767
- } else {
6768
- return body;
6769
- }
6770
- });
6771
- }
6772
-
6773
- // node_modules/intercom-client/dist/esm/core/fetcher/Headers.mjs
6774
- var Headers;
6775
- if (typeof globalThis.Headers !== "undefined") {
6776
- Headers = globalThis.Headers;
6777
- } else {
6778
- Headers = class Headers2 {
6779
- constructor(init) {
6780
- this.headers = new Map;
6781
- if (init) {
6782
- if (init instanceof Headers2) {
6783
- init.forEach((value, key) => this.append(key, value));
6784
- } else if (Array.isArray(init)) {
6785
- for (const [key, value] of init) {
6786
- if (typeof key === "string" && typeof value === "string") {
6787
- this.append(key, value);
6788
- } else {
6789
- throw new TypeError("Each header entry must be a [string, string] tuple");
6790
- }
6791
- }
6792
- } else {
6793
- for (const [key, value] of Object.entries(init)) {
6794
- if (typeof value === "string") {
6795
- this.append(key, value);
6796
- } else {
6797
- throw new TypeError("Header values must be strings");
6798
- }
6799
- }
6800
- }
6801
- }
6802
- }
6803
- append(name, value) {
6804
- const key = name.toLowerCase();
6805
- const existing = this.headers.get(key) || [];
6806
- this.headers.set(key, [...existing, value]);
6807
- }
6808
- delete(name) {
6809
- const key = name.toLowerCase();
6810
- this.headers.delete(key);
6811
- }
6812
- get(name) {
6813
- const key = name.toLowerCase();
6814
- const values = this.headers.get(key);
6815
- return values ? values.join(", ") : null;
6816
- }
6817
- has(name) {
6818
- const key = name.toLowerCase();
6819
- return this.headers.has(key);
6820
- }
6821
- set(name, value) {
6822
- const key = name.toLowerCase();
6823
- this.headers.set(key, [value]);
6824
- }
6825
- forEach(callbackfn, thisArg) {
6826
- const boundCallback = thisArg ? callbackfn.bind(thisArg) : callbackfn;
6827
- this.headers.forEach((values, key) => boundCallback(values.join(", "), key, this));
6828
- }
6829
- getSetCookie() {
6830
- return this.headers.get("set-cookie") || [];
6831
- }
6832
- *entries() {
6833
- for (const [key, values] of this.headers.entries()) {
6834
- yield [key, values.join(", ")];
6835
- }
6836
- }
6837
- *keys() {
6838
- yield* this.headers.keys();
6839
- }
6840
- *values() {
6841
- for (const values of this.headers.values()) {
6842
- yield values.join(", ");
6843
- }
6844
- }
6845
- [Symbol.iterator]() {
6846
- return this.entries();
6847
- }
6848
- };
6849
- }
6850
-
6851
- // node_modules/intercom-client/dist/esm/core/fetcher/signals.mjs
6852
- var TIMEOUT = "timeout";
6853
- function getTimeoutSignal(timeoutMs) {
6854
- const controller = new AbortController;
6855
- const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
6856
- return { signal: controller.signal, abortId };
6857
- }
6858
- function anySignal(...args) {
6859
- const signals2 = args.length === 1 && Array.isArray(args[0]) ? args[0] : args;
6860
- const controller = new AbortController;
6861
- for (const signal of signals2) {
6862
- if (signal.aborted) {
6863
- controller.abort(signal === null || signal === undefined ? undefined : signal.reason);
6864
- break;
6865
- }
6866
- signal.addEventListener("abort", () => controller.abort(signal === null || signal === undefined ? undefined : signal.reason), {
6867
- signal: controller.signal
6868
- });
6869
- }
6870
- return controller.signal;
6871
- }
6872
-
6873
- // node_modules/intercom-client/dist/esm/core/fetcher/makeRequest.mjs
6874
- var __awaiter6 = function(thisArg, _arguments, P, generator) {
6875
- function adopt(value) {
6876
- return value instanceof P ? value : new P(function(resolve) {
6877
- resolve(value);
6878
- });
6879
- }
6880
- return new (P || (P = Promise))(function(resolve, reject) {
6881
- function fulfilled(value) {
6882
- try {
6883
- step(generator.next(value));
6884
- } catch (e) {
6885
- reject(e);
6886
- }
6887
- }
6888
- function rejected(value) {
6889
- try {
6890
- step(generator["throw"](value));
6891
- } catch (e) {
6892
- reject(e);
6893
- }
6894
- }
6895
- function step(result) {
6896
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6897
- }
6898
- step((generator = generator.apply(thisArg, _arguments || [])).next());
6899
- });
6900
- };
6901
- var makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex) => __awaiter6(undefined, undefined, undefined, function* () {
6902
- const signals2 = [];
6903
- let timeoutAbortId;
6904
- if (timeoutMs != null) {
6905
- const { signal, abortId } = getTimeoutSignal(timeoutMs);
6906
- timeoutAbortId = abortId;
6907
- signals2.push(signal);
6908
- }
6909
- if (abortSignal != null) {
6910
- signals2.push(abortSignal);
6911
- }
6912
- const newSignals = anySignal(signals2);
6913
- const response = yield fetchFn(url, {
6914
- method,
6915
- headers,
6916
- body: requestBody,
6917
- signal: newSignals,
6918
- credentials: withCredentials ? "include" : undefined,
6919
- duplex
6920
- });
6921
- if (timeoutAbortId != null) {
6922
- clearTimeout(timeoutAbortId);
6923
- }
6924
- return response;
6925
- });
6926
-
6927
- // node_modules/intercom-client/dist/esm/core/fetcher/RawResponse.mjs
6928
- var abortRawResponse = {
6929
- headers: new Headers,
6930
- redirected: false,
6931
- status: 499,
6932
- statusText: "Client Closed Request",
6933
- type: "error",
6934
- url: ""
6935
- };
6936
- var unknownRawResponse = {
6937
- headers: new Headers,
6938
- redirected: false,
6939
- status: 0,
6940
- statusText: "Unknown Error",
6941
- type: "error",
6942
- url: ""
6943
- };
6944
- function toRawResponse(response) {
6945
- return {
6946
- headers: response.headers,
6947
- redirected: response.redirected,
6948
- status: response.status,
6949
- statusText: response.statusText,
6950
- type: response.type,
6951
- url: response.url
6952
- };
6953
- }
5981
+ }
6954
5982
 
6955
5983
  // node_modules/intercom-client/dist/esm/core/fetcher/requestWithRetries.mjs
6956
5984
  var __awaiter7 = function(thisArg, _arguments, P, generator) {
@@ -7188,231 +6216,641 @@ function getHeaders(args) {
7188
6216
  if (args.headers == null) {
7189
6217
  return newHeaders;
7190
6218
  }
7191
- for (const [key, value] of Object.entries(args.headers)) {
7192
- const result = yield EndpointSupplier.get(value, { endpointMetadata: (_a = args.endpointMetadata) !== null && _a !== undefined ? _a : {} });
7193
- if (typeof result === "string") {
7194
- newHeaders.set(key, result);
7195
- continue;
6219
+ for (const [key, value] of Object.entries(args.headers)) {
6220
+ const result = yield EndpointSupplier.get(value, { endpointMetadata: (_a = args.endpointMetadata) !== null && _a !== undefined ? _a : {} });
6221
+ if (typeof result === "string") {
6222
+ newHeaders.set(key, result);
6223
+ continue;
6224
+ }
6225
+ if (result == null) {
6226
+ continue;
6227
+ }
6228
+ newHeaders.set(key, `${result}`);
6229
+ }
6230
+ return newHeaders;
6231
+ });
6232
+ }
6233
+ function fetcherImpl(args) {
6234
+ return __awaiter8(this, undefined, undefined, function* () {
6235
+ var _a, _b, _c;
6236
+ const url = createRequestUrl(args.url, args.queryParameters);
6237
+ const requestBody = yield getRequestBody({
6238
+ body: args.body,
6239
+ type: (_a = args.requestType) !== null && _a !== undefined ? _a : "other"
6240
+ });
6241
+ const fetchFn = (_b = args.fetchFn) !== null && _b !== undefined ? _b : yield getFetchFn();
6242
+ const headers = yield getHeaders(args);
6243
+ const logger = createLogger(args.logging);
6244
+ if (logger.isDebug()) {
6245
+ const metadata = {
6246
+ method: args.method,
6247
+ url: redactUrl(url),
6248
+ headers: redactHeaders(headers),
6249
+ queryParameters: redactQueryParameters(args.queryParameters),
6250
+ hasBody: requestBody != null
6251
+ };
6252
+ logger.debug("Making HTTP request", metadata);
6253
+ }
6254
+ try {
6255
+ const response = yield requestWithRetries(() => __awaiter8(this, undefined, undefined, function* () {
6256
+ return makeRequest(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex);
6257
+ }), args.maxRetries);
6258
+ if (response.status >= 200 && response.status < 400) {
6259
+ if (logger.isDebug()) {
6260
+ const metadata = {
6261
+ method: args.method,
6262
+ url: redactUrl(url),
6263
+ statusCode: response.status,
6264
+ responseHeaders: redactHeaders(response.headers)
6265
+ };
6266
+ logger.debug("HTTP request succeeded", metadata);
6267
+ }
6268
+ const body = yield getResponseBody(response, args.responseType);
6269
+ return {
6270
+ ok: true,
6271
+ body,
6272
+ headers: response.headers,
6273
+ rawResponse: toRawResponse(response)
6274
+ };
6275
+ } else {
6276
+ if (logger.isError()) {
6277
+ const metadata = {
6278
+ method: args.method,
6279
+ url: redactUrl(url),
6280
+ statusCode: response.status,
6281
+ responseHeaders: redactHeaders(Object.fromEntries(response.headers.entries()))
6282
+ };
6283
+ logger.error("HTTP request failed with error status", metadata);
6284
+ }
6285
+ return {
6286
+ ok: false,
6287
+ error: {
6288
+ reason: "status-code",
6289
+ statusCode: response.status,
6290
+ body: yield getErrorResponseBody(response)
6291
+ },
6292
+ rawResponse: toRawResponse(response)
6293
+ };
6294
+ }
6295
+ } catch (error2) {
6296
+ if ((_c = args.abortSignal) === null || _c === undefined ? undefined : _c.aborted) {
6297
+ if (logger.isError()) {
6298
+ const metadata = {
6299
+ method: args.method,
6300
+ url: redactUrl(url)
6301
+ };
6302
+ logger.error("HTTP request was aborted", metadata);
6303
+ }
6304
+ return {
6305
+ ok: false,
6306
+ error: {
6307
+ reason: "unknown",
6308
+ errorMessage: "The user aborted a request"
6309
+ },
6310
+ rawResponse: abortRawResponse
6311
+ };
6312
+ } else if (error2 instanceof Error && error2.name === "AbortError") {
6313
+ if (logger.isError()) {
6314
+ const metadata = {
6315
+ method: args.method,
6316
+ url: redactUrl(url),
6317
+ timeoutMs: args.timeoutMs
6318
+ };
6319
+ logger.error("HTTP request timed out", metadata);
6320
+ }
6321
+ return {
6322
+ ok: false,
6323
+ error: {
6324
+ reason: "timeout"
6325
+ },
6326
+ rawResponse: abortRawResponse
6327
+ };
6328
+ } else if (error2 instanceof Error) {
6329
+ if (logger.isError()) {
6330
+ const metadata = {
6331
+ method: args.method,
6332
+ url: redactUrl(url),
6333
+ errorMessage: error2.message
6334
+ };
6335
+ logger.error("HTTP request failed with error", metadata);
6336
+ }
6337
+ return {
6338
+ ok: false,
6339
+ error: {
6340
+ reason: "unknown",
6341
+ errorMessage: error2.message
6342
+ },
6343
+ rawResponse: unknownRawResponse
6344
+ };
6345
+ }
6346
+ if (logger.isError()) {
6347
+ const metadata = {
6348
+ method: args.method,
6349
+ url: redactUrl(url),
6350
+ error: toJson(error2)
6351
+ };
6352
+ logger.error("HTTP request failed with unknown error", metadata);
6353
+ }
6354
+ return {
6355
+ ok: false,
6356
+ error: {
6357
+ reason: "unknown",
6358
+ errorMessage: toJson(error2)
6359
+ },
6360
+ rawResponse: unknownRawResponse
6361
+ };
6362
+ }
6363
+ });
6364
+ }
6365
+ var fetcher = fetcherImpl;
6366
+ // node_modules/intercom-client/dist/esm/core/fetcher/HttpResponsePromise.mjs
6367
+ var __awaiter9 = function(thisArg, _arguments, P, generator) {
6368
+ function adopt(value) {
6369
+ return value instanceof P ? value : new P(function(resolve) {
6370
+ resolve(value);
6371
+ });
6372
+ }
6373
+ return new (P || (P = Promise))(function(resolve, reject) {
6374
+ function fulfilled(value) {
6375
+ try {
6376
+ step(generator.next(value));
6377
+ } catch (e) {
6378
+ reject(e);
6379
+ }
6380
+ }
6381
+ function rejected(value) {
6382
+ try {
6383
+ step(generator["throw"](value));
6384
+ } catch (e) {
6385
+ reject(e);
6386
+ }
6387
+ }
6388
+ function step(result) {
6389
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6390
+ }
6391
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
6392
+ });
6393
+ };
6394
+
6395
+ class HttpResponsePromise extends Promise {
6396
+ constructor(promise) {
6397
+ super((resolve) => {
6398
+ resolve(undefined);
6399
+ });
6400
+ this.innerPromise = promise;
6401
+ }
6402
+ static fromFunction(fn, ...args) {
6403
+ return new HttpResponsePromise(fn(...args));
6404
+ }
6405
+ static interceptFunction(fn) {
6406
+ return (...args) => {
6407
+ return HttpResponsePromise.fromPromise(fn(...args));
6408
+ };
6409
+ }
6410
+ static fromPromise(promise) {
6411
+ return new HttpResponsePromise(promise);
6412
+ }
6413
+ static fromExecutor(executor) {
6414
+ const promise = new Promise(executor);
6415
+ return new HttpResponsePromise(promise);
6416
+ }
6417
+ static fromResult(result) {
6418
+ const promise = Promise.resolve(result);
6419
+ return new HttpResponsePromise(promise);
6420
+ }
6421
+ unwrap() {
6422
+ if (!this.unwrappedPromise) {
6423
+ this.unwrappedPromise = this.innerPromise.then(({ data }) => data);
6424
+ }
6425
+ return this.unwrappedPromise;
6426
+ }
6427
+ then(onfulfilled, onrejected) {
6428
+ return this.unwrap().then(onfulfilled, onrejected);
6429
+ }
6430
+ catch(onrejected) {
6431
+ return this.unwrap().catch(onrejected);
6432
+ }
6433
+ finally(onfinally) {
6434
+ return this.unwrap().finally(onfinally);
6435
+ }
6436
+ withRawResponse() {
6437
+ return __awaiter9(this, undefined, undefined, function* () {
6438
+ return yield this.innerPromise;
6439
+ });
6440
+ }
6441
+ }
6442
+ // node_modules/intercom-client/dist/esm/core/fetcher/Supplier.mjs
6443
+ var __awaiter10 = function(thisArg, _arguments, P, generator) {
6444
+ function adopt(value) {
6445
+ return value instanceof P ? value : new P(function(resolve) {
6446
+ resolve(value);
6447
+ });
6448
+ }
6449
+ return new (P || (P = Promise))(function(resolve, reject) {
6450
+ function fulfilled(value) {
6451
+ try {
6452
+ step(generator.next(value));
6453
+ } catch (e) {
6454
+ reject(e);
6455
+ }
6456
+ }
6457
+ function rejected(value) {
6458
+ try {
6459
+ step(generator["throw"](value));
6460
+ } catch (e) {
6461
+ reject(e);
6462
+ }
6463
+ }
6464
+ function step(result) {
6465
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6466
+ }
6467
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
6468
+ });
6469
+ };
6470
+ var Supplier = {
6471
+ get: (supplier) => __awaiter10(undefined, undefined, undefined, function* () {
6472
+ if (typeof supplier === "function") {
6473
+ return supplier();
6474
+ } else {
6475
+ return supplier;
6476
+ }
6477
+ })
6478
+ };
6479
+ // node_modules/intercom-client/dist/esm/core/logging/index.mjs
6480
+ var exports_logging = {};
6481
+ __export(exports_logging, {
6482
+ createLogger: () => createLogger,
6483
+ Logger: () => Logger,
6484
+ LogLevel: () => LogLevel,
6485
+ ConsoleLogger: () => ConsoleLogger
6486
+ });
6487
+ // node_modules/intercom-client/dist/esm/core/pagination/Page.mjs
6488
+ var __awaiter11 = function(thisArg, _arguments, P, generator) {
6489
+ function adopt(value) {
6490
+ return value instanceof P ? value : new P(function(resolve) {
6491
+ resolve(value);
6492
+ });
6493
+ }
6494
+ return new (P || (P = Promise))(function(resolve, reject) {
6495
+ function fulfilled(value) {
6496
+ try {
6497
+ step(generator.next(value));
6498
+ } catch (e) {
6499
+ reject(e);
7196
6500
  }
7197
- if (result == null) {
7198
- continue;
6501
+ }
6502
+ function rejected(value) {
6503
+ try {
6504
+ step(generator["throw"](value));
6505
+ } catch (e) {
6506
+ reject(e);
7199
6507
  }
7200
- newHeaders.set(key, `${result}`);
7201
6508
  }
7202
- return newHeaders;
6509
+ function step(result) {
6510
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6511
+ }
6512
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
7203
6513
  });
7204
- }
7205
- function fetcherImpl(args) {
7206
- return __awaiter8(this, undefined, undefined, function* () {
7207
- var _a, _b, _c;
7208
- const url = createRequestUrl(args.url, args.queryParameters);
7209
- const requestBody = yield getRequestBody({
7210
- body: args.body,
7211
- type: (_a = args.requestType) !== null && _a !== undefined ? _a : "other"
7212
- });
7213
- const fetchFn = (_b = args.fetchFn) !== null && _b !== undefined ? _b : yield getFetchFn();
7214
- const headers = yield getHeaders(args);
7215
- const logger = createLogger(args.logging);
7216
- if (logger.isDebug()) {
7217
- const metadata = {
7218
- method: args.method,
7219
- url: redactUrl(url),
7220
- headers: redactHeaders(headers),
7221
- queryParameters: redactQueryParameters(args.queryParameters),
7222
- hasBody: requestBody != null
6514
+ };
6515
+ var __await = function(v) {
6516
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
6517
+ };
6518
+ var __asyncGenerator = function(thisArg, _arguments, generator) {
6519
+ if (!Symbol.asyncIterator)
6520
+ throw new TypeError("Symbol.asyncIterator is not defined.");
6521
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
6522
+ return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
6523
+ return this;
6524
+ }, i;
6525
+ function awaitReturn(f) {
6526
+ return function(v) {
6527
+ return Promise.resolve(v).then(f, reject);
6528
+ };
6529
+ }
6530
+ function verb(n, f) {
6531
+ if (g[n]) {
6532
+ i[n] = function(v) {
6533
+ return new Promise(function(a, b) {
6534
+ q.push([n, v, a, b]) > 1 || resume(n, v);
6535
+ });
7223
6536
  };
7224
- logger.debug("Making HTTP request", metadata);
6537
+ if (f)
6538
+ i[n] = f(i[n]);
7225
6539
  }
6540
+ }
6541
+ function resume(n, v) {
7226
6542
  try {
7227
- const response = yield requestWithRetries(() => __awaiter8(this, undefined, undefined, function* () {
7228
- return makeRequest(fetchFn, url, args.method, headers, requestBody, args.timeoutMs, args.abortSignal, args.withCredentials, args.duplex);
7229
- }), args.maxRetries);
7230
- if (response.status >= 200 && response.status < 400) {
7231
- if (logger.isDebug()) {
7232
- const metadata = {
7233
- method: args.method,
7234
- url: redactUrl(url),
7235
- statusCode: response.status,
7236
- responseHeaders: redactHeaders(response.headers)
7237
- };
7238
- logger.debug("HTTP request succeeded", metadata);
7239
- }
7240
- const body = yield getResponseBody(response, args.responseType);
7241
- return {
7242
- ok: true,
7243
- body,
7244
- headers: response.headers,
7245
- rawResponse: toRawResponse(response)
7246
- };
7247
- } else {
7248
- if (logger.isError()) {
7249
- const metadata = {
7250
- method: args.method,
7251
- url: redactUrl(url),
7252
- statusCode: response.status,
7253
- responseHeaders: redactHeaders(Object.fromEntries(response.headers.entries()))
7254
- };
7255
- logger.error("HTTP request failed with error status", metadata);
7256
- }
7257
- return {
7258
- ok: false,
7259
- error: {
7260
- reason: "status-code",
7261
- statusCode: response.status,
7262
- body: yield getErrorResponseBody(response)
7263
- },
7264
- rawResponse: toRawResponse(response)
7265
- };
7266
- }
7267
- } catch (error2) {
7268
- if ((_c = args.abortSignal) === null || _c === undefined ? undefined : _c.aborted) {
7269
- if (logger.isError()) {
7270
- const metadata = {
7271
- method: args.method,
7272
- url: redactUrl(url)
7273
- };
7274
- logger.error("HTTP request was aborted", metadata);
7275
- }
7276
- return {
7277
- ok: false,
7278
- error: {
7279
- reason: "unknown",
7280
- errorMessage: "The user aborted a request"
7281
- },
7282
- rawResponse: abortRawResponse
7283
- };
7284
- } else if (error2 instanceof Error && error2.name === "AbortError") {
7285
- if (logger.isError()) {
7286
- const metadata = {
7287
- method: args.method,
7288
- url: redactUrl(url),
7289
- timeoutMs: args.timeoutMs
7290
- };
7291
- logger.error("HTTP request timed out", metadata);
7292
- }
7293
- return {
7294
- ok: false,
7295
- error: {
7296
- reason: "timeout"
7297
- },
7298
- rawResponse: abortRawResponse
7299
- };
7300
- } else if (error2 instanceof Error) {
7301
- if (logger.isError()) {
7302
- const metadata = {
7303
- method: args.method,
7304
- url: redactUrl(url),
7305
- errorMessage: error2.message
7306
- };
7307
- logger.error("HTTP request failed with error", metadata);
7308
- }
7309
- return {
7310
- ok: false,
7311
- error: {
7312
- reason: "unknown",
7313
- errorMessage: error2.message
7314
- },
7315
- rawResponse: unknownRawResponse
7316
- };
6543
+ step(g[n](v));
6544
+ } catch (e) {
6545
+ settle(q[0][3], e);
6546
+ }
6547
+ }
6548
+ function step(r) {
6549
+ r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
6550
+ }
6551
+ function fulfill(value) {
6552
+ resume("next", value);
6553
+ }
6554
+ function reject(value) {
6555
+ resume("throw", value);
6556
+ }
6557
+ function settle(f, v) {
6558
+ if (f(v), q.shift(), q.length)
6559
+ resume(q[0][0], q[0][1]);
6560
+ }
6561
+ };
6562
+ var __asyncValues = function(o) {
6563
+ if (!Symbol.asyncIterator)
6564
+ throw new TypeError("Symbol.asyncIterator is not defined.");
6565
+ var m = o[Symbol.asyncIterator], i;
6566
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
6567
+ return this;
6568
+ }, i);
6569
+ function verb(n) {
6570
+ i[n] = o[n] && function(v) {
6571
+ return new Promise(function(resolve, reject) {
6572
+ v = o[n](v), settle(resolve, reject, v.done, v.value);
6573
+ });
6574
+ };
6575
+ }
6576
+ function settle(resolve, reject, d, v) {
6577
+ Promise.resolve(v).then(function(v2) {
6578
+ resolve({ value: v2, done: d });
6579
+ }, reject);
6580
+ }
6581
+ };
6582
+
6583
+ class Page {
6584
+ constructor({ response, rawResponse, hasNextPage, getItems, loadPage }) {
6585
+ this.response = response;
6586
+ this.rawResponse = rawResponse;
6587
+ this.data = getItems(response);
6588
+ this._hasNextPage = hasNextPage;
6589
+ this.getItems = getItems;
6590
+ this.loadNextPage = loadPage;
6591
+ }
6592
+ getNextPage() {
6593
+ return __awaiter11(this, undefined, undefined, function* () {
6594
+ const { data, rawResponse } = yield this.loadNextPage(this.response).withRawResponse();
6595
+ this.response = data;
6596
+ this.rawResponse = rawResponse;
6597
+ this.data = this.getItems(this.response);
6598
+ return this;
6599
+ });
6600
+ }
6601
+ hasNextPage() {
6602
+ return this._hasNextPage(this.response);
6603
+ }
6604
+ iterMessages() {
6605
+ return __asyncGenerator(this, arguments, function* iterMessages_1() {
6606
+ for (const item of this.data) {
6607
+ yield yield __await(item);
7317
6608
  }
7318
- if (logger.isError()) {
7319
- const metadata = {
7320
- method: args.method,
7321
- url: redactUrl(url),
7322
- error: toJson(error2)
7323
- };
7324
- logger.error("HTTP request failed with unknown error", metadata);
6609
+ while (this.hasNextPage()) {
6610
+ yield __await(this.getNextPage());
6611
+ for (const item of this.data) {
6612
+ yield yield __await(item);
6613
+ }
7325
6614
  }
7326
- return {
7327
- ok: false,
7328
- error: {
7329
- reason: "unknown",
7330
- errorMessage: toJson(error2)
7331
- },
7332
- rawResponse: unknownRawResponse
7333
- };
7334
- }
7335
- });
7336
- }
7337
- var fetcher = fetcherImpl;
7338
- // node_modules/intercom-client/dist/esm/core/fetcher/HttpResponsePromise.mjs
7339
- var __awaiter9 = function(thisArg, _arguments, P, generator) {
7340
- function adopt(value) {
7341
- return value instanceof P ? value : new P(function(resolve) {
7342
- resolve(value);
7343
6615
  });
7344
6616
  }
7345
- return new (P || (P = Promise))(function(resolve, reject) {
7346
- function fulfilled(value) {
6617
+ [Symbol.asyncIterator]() {
6618
+ return __asyncGenerator(this, arguments, function* _a() {
6619
+ var _b, e_1, _c, _d;
7347
6620
  try {
7348
- step(generator.next(value));
7349
- } catch (e) {
7350
- reject(e);
6621
+ for (var _e = true, _f = __asyncValues(this.iterMessages()), _g;_g = yield __await(_f.next()), _b = _g.done, !_b; _e = true) {
6622
+ _d = _g.value;
6623
+ _e = false;
6624
+ const message = _d;
6625
+ yield yield __await(message);
6626
+ }
6627
+ } catch (e_1_1) {
6628
+ e_1 = { error: e_1_1 };
6629
+ } finally {
6630
+ try {
6631
+ if (!_e && !_b && (_c = _f.return))
6632
+ yield __await(_c.call(_f));
6633
+ } finally {
6634
+ if (e_1)
6635
+ throw e_1.error;
6636
+ }
7351
6637
  }
6638
+ });
6639
+ }
6640
+ }
6641
+ // node_modules/intercom-client/dist/esm/core/runtime/runtime.mjs
6642
+ var RUNTIME = evaluateRuntime();
6643
+ function evaluateRuntime() {
6644
+ var _a, _b, _c, _d, _e;
6645
+ const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
6646
+ if (isBrowser) {
6647
+ return {
6648
+ type: "browser",
6649
+ version: window.navigator.userAgent
6650
+ };
6651
+ }
6652
+ const isCloudflare = typeof globalThis !== "undefined" && ((_a = globalThis === null || globalThis === undefined ? undefined : globalThis.navigator) === null || _a === undefined ? undefined : _a.userAgent) === "Cloudflare-Workers";
6653
+ if (isCloudflare) {
6654
+ return {
6655
+ type: "workerd"
6656
+ };
6657
+ }
6658
+ const isEdgeRuntime = typeof EdgeRuntime === "string";
6659
+ if (isEdgeRuntime) {
6660
+ return {
6661
+ type: "edge-runtime"
6662
+ };
6663
+ }
6664
+ const isWebWorker = typeof self === "object" && typeof (self === null || self === undefined ? undefined : self.importScripts) === "function" && (((_b = self.constructor) === null || _b === undefined ? undefined : _b.name) === "DedicatedWorkerGlobalScope" || ((_c = self.constructor) === null || _c === undefined ? undefined : _c.name) === "ServiceWorkerGlobalScope" || ((_d = self.constructor) === null || _d === undefined ? undefined : _d.name) === "SharedWorkerGlobalScope");
6665
+ if (isWebWorker) {
6666
+ return {
6667
+ type: "web-worker"
6668
+ };
6669
+ }
6670
+ const isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
6671
+ if (isDeno) {
6672
+ return {
6673
+ type: "deno",
6674
+ version: Deno.version.deno
6675
+ };
6676
+ }
6677
+ const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
6678
+ if (isBun) {
6679
+ return {
6680
+ type: "bun",
6681
+ version: Bun.version
6682
+ };
6683
+ }
6684
+ const isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === undefined ? undefined : navigator.product) === "ReactNative";
6685
+ if (isReactNative) {
6686
+ return {
6687
+ type: "react-native"
6688
+ };
6689
+ }
6690
+ const isNode = typeof process !== "undefined" && "version" in process && !!process.version && "versions" in process && !!((_e = process.versions) === null || _e === undefined ? undefined : _e.node);
6691
+ if (isNode) {
6692
+ return {
6693
+ type: "node",
6694
+ version: process.versions.node,
6695
+ parsedVersion: Number(process.versions.node.split(".")[0])
6696
+ };
6697
+ }
6698
+ return {
6699
+ type: "unknown"
6700
+ };
6701
+ }
6702
+ // node_modules/intercom-client/dist/esm/core/url/index.mjs
6703
+ var exports_url = {};
6704
+ __export(exports_url, {
6705
+ toQueryString: () => toQueryString,
6706
+ join: () => join,
6707
+ encodePathParam: () => encodePathParam
6708
+ });
6709
+
6710
+ // node_modules/intercom-client/dist/esm/core/url/encodePathParam.mjs
6711
+ function encodePathParam(param) {
6712
+ if (param === null) {
6713
+ return "null";
6714
+ }
6715
+ const typeofParam = typeof param;
6716
+ switch (typeofParam) {
6717
+ case "undefined":
6718
+ return "undefined";
6719
+ case "string":
6720
+ case "number":
6721
+ case "boolean":
6722
+ break;
6723
+ default:
6724
+ param = String(param);
6725
+ break;
6726
+ }
6727
+ return encodeURIComponent(param);
6728
+ }
6729
+ // node_modules/intercom-client/dist/esm/core/url/join.mjs
6730
+ function join(base, ...segments) {
6731
+ if (!base) {
6732
+ return "";
6733
+ }
6734
+ if (segments.length === 0) {
6735
+ return base;
6736
+ }
6737
+ if (base.includes("://")) {
6738
+ let url;
6739
+ try {
6740
+ url = new URL(base);
6741
+ } catch (_a) {
6742
+ return joinPath(base, ...segments);
7352
6743
  }
7353
- function rejected(value) {
7354
- try {
7355
- step(generator["throw"](value));
7356
- } catch (e) {
7357
- reject(e);
6744
+ const lastSegment = segments[segments.length - 1];
6745
+ const shouldPreserveTrailingSlash = lastSegment === null || lastSegment === undefined ? undefined : lastSegment.endsWith("/");
6746
+ for (const segment of segments) {
6747
+ const cleanSegment = trimSlashes(segment);
6748
+ if (cleanSegment) {
6749
+ url.pathname = joinPathSegments(url.pathname, cleanSegment);
7358
6750
  }
7359
6751
  }
7360
- function step(result) {
7361
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
6752
+ if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
6753
+ url.pathname += "/";
7362
6754
  }
7363
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7364
- });
7365
- };
7366
-
7367
- class HttpResponsePromise extends Promise {
7368
- constructor(promise) {
7369
- super((resolve) => {
7370
- resolve(undefined);
7371
- });
7372
- this.innerPromise = promise;
6755
+ return url.toString();
7373
6756
  }
7374
- static fromFunction(fn, ...args) {
7375
- return new HttpResponsePromise(fn(...args));
6757
+ return joinPath(base, ...segments);
6758
+ }
6759
+ function joinPath(base, ...segments) {
6760
+ if (segments.length === 0) {
6761
+ return base;
7376
6762
  }
7377
- static interceptFunction(fn) {
7378
- return (...args) => {
7379
- return HttpResponsePromise.fromPromise(fn(...args));
7380
- };
6763
+ let result = base;
6764
+ const lastSegment = segments[segments.length - 1];
6765
+ const shouldPreserveTrailingSlash = lastSegment === null || lastSegment === undefined ? undefined : lastSegment.endsWith("/");
6766
+ for (const segment of segments) {
6767
+ const cleanSegment = trimSlashes(segment);
6768
+ if (cleanSegment) {
6769
+ result = joinPathSegments(result, cleanSegment);
6770
+ }
7381
6771
  }
7382
- static fromPromise(promise) {
7383
- return new HttpResponsePromise(promise);
6772
+ if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
6773
+ result += "/";
7384
6774
  }
7385
- static fromExecutor(executor) {
7386
- const promise = new Promise(executor);
7387
- return new HttpResponsePromise(promise);
6775
+ return result;
6776
+ }
6777
+ function joinPathSegments(left, right) {
6778
+ if (left.endsWith("/")) {
6779
+ return left + right;
7388
6780
  }
7389
- static fromResult(result) {
7390
- const promise = Promise.resolve(result);
7391
- return new HttpResponsePromise(promise);
6781
+ return `${left}/${right}`;
6782
+ }
6783
+ function trimSlashes(str) {
6784
+ if (!str)
6785
+ return str;
6786
+ let start = 0;
6787
+ let end = str.length;
6788
+ if (str.startsWith("/"))
6789
+ start = 1;
6790
+ if (str.endsWith("/"))
6791
+ end = str.length - 1;
6792
+ return start === 0 && end === str.length ? str : str.slice(start, end);
6793
+ }
6794
+ // node_modules/intercom-client/dist/esm/core/utils/setObjectProperty.mjs
6795
+ function setObjectProperty(object, path, value) {
6796
+ if (object == null) {
6797
+ return object;
7392
6798
  }
7393
- unwrap() {
7394
- if (!this.unwrappedPromise) {
7395
- this.unwrappedPromise = this.innerPromise.then(({ data }) => data);
6799
+ const keys = path.split(".");
6800
+ if (keys.length === 0) {
6801
+ return object;
6802
+ }
6803
+ let current = object;
6804
+ for (let i = 0;i < keys.length - 1; i++) {
6805
+ const key = keys[i];
6806
+ if (key == null) {
6807
+ continue;
7396
6808
  }
7397
- return this.unwrappedPromise;
6809
+ if (!current[key] || typeof current[key] !== "object") {
6810
+ current[key] = {};
6811
+ }
6812
+ current = current[key];
6813
+ }
6814
+ const lastKey = keys[keys.length - 1];
6815
+ if (lastKey == null) {
6816
+ return object;
6817
+ }
6818
+ current[lastKey] = value;
6819
+ return object;
6820
+ }
6821
+ // node_modules/intercom-client/dist/esm/errors/IntercomError.mjs
6822
+ class IntercomError extends Error {
6823
+ constructor({ message, statusCode, body, rawResponse }) {
6824
+ super(buildMessage({ message, statusCode, body }));
6825
+ Object.setPrototypeOf(this, IntercomError.prototype);
6826
+ this.statusCode = statusCode;
6827
+ this.body = body;
6828
+ this.rawResponse = rawResponse;
7398
6829
  }
7399
- then(onfulfilled, onrejected) {
7400
- return this.unwrap().then(onfulfilled, onrejected);
6830
+ }
6831
+ function buildMessage({ message, statusCode, body }) {
6832
+ const lines = [];
6833
+ if (message != null) {
6834
+ lines.push(message);
7401
6835
  }
7402
- catch(onrejected) {
7403
- return this.unwrap().catch(onrejected);
6836
+ if (statusCode != null) {
6837
+ lines.push(`Status code: ${statusCode.toString()}`);
7404
6838
  }
7405
- finally(onfinally) {
7406
- return this.unwrap().finally(onfinally);
6839
+ if (body != null) {
6840
+ lines.push(`Body: ${toJson(body, undefined, 2)}`);
7407
6841
  }
7408
- withRawResponse() {
7409
- return __awaiter9(this, undefined, undefined, function* () {
7410
- return yield this.innerPromise;
7411
- });
6842
+ return lines.join(`
6843
+ `);
6844
+ }
6845
+ // node_modules/intercom-client/dist/esm/errors/IntercomTimeoutError.mjs
6846
+ class IntercomTimeoutError extends Error {
6847
+ constructor(message) {
6848
+ super(message);
6849
+ Object.setPrototypeOf(this, IntercomTimeoutError.prototype);
7412
6850
  }
7413
6851
  }
7414
- // node_modules/intercom-client/dist/esm/core/fetcher/Supplier.mjs
7415
- var __awaiter10 = function(thisArg, _arguments, P, generator) {
6852
+ // node_modules/intercom-client/dist/esm/auth/BearerAuthProvider.mjs
6853
+ var __awaiter12 = function(thisArg, _arguments, P, generator) {
7416
6854
  function adopt(value) {
7417
6855
  return value instanceof P ? value : new P(function(resolve) {
7418
6856
  resolve(value);
@@ -7439,495 +6877,1074 @@ var __awaiter10 = function(thisArg, _arguments, P, generator) {
7439
6877
  step((generator = generator.apply(thisArg, _arguments || [])).next());
7440
6878
  });
7441
6879
  };
7442
- var Supplier = {
7443
- get: (supplier) => __awaiter10(undefined, undefined, undefined, function* () {
7444
- if (typeof supplier === "function") {
7445
- return supplier();
7446
- } else {
7447
- return supplier;
7448
- }
7449
- })
7450
- };
7451
- // node_modules/intercom-client/dist/esm/core/logging/index.mjs
7452
- var exports_logging = {};
7453
- __export(exports_logging, {
7454
- createLogger: () => createLogger,
7455
- Logger: () => Logger,
7456
- LogLevel: () => LogLevel,
7457
- ConsoleLogger: () => ConsoleLogger
7458
- });
7459
- // node_modules/intercom-client/dist/esm/core/pagination/Page.mjs
7460
- var __awaiter11 = function(thisArg, _arguments, P, generator) {
7461
- function adopt(value) {
7462
- return value instanceof P ? value : new P(function(resolve) {
7463
- resolve(value);
7464
- });
6880
+
6881
+ class BearerAuthProvider {
6882
+ constructor(options) {
6883
+ this.token = options.token;
7465
6884
  }
7466
- return new (P || (P = Promise))(function(resolve, reject) {
7467
- function fulfilled(value) {
7468
- try {
7469
- step(generator.next(value));
7470
- } catch (e) {
7471
- reject(e);
7472
- }
7473
- }
7474
- function rejected(value) {
7475
- try {
7476
- step(generator["throw"](value));
7477
- } catch (e) {
7478
- reject(e);
7479
- }
7480
- }
7481
- function step(result) {
7482
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
7483
- }
7484
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7485
- });
7486
- };
7487
- var __await = function(v) {
7488
- return this instanceof __await ? (this.v = v, this) : new __await(v);
7489
- };
7490
- var __asyncGenerator = function(thisArg, _arguments, generator) {
7491
- if (!Symbol.asyncIterator)
7492
- throw new TypeError("Symbol.asyncIterator is not defined.");
7493
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
7494
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
7495
- return this;
7496
- }, i;
7497
- function awaitReturn(f) {
7498
- return function(v) {
7499
- return Promise.resolve(v).then(f, reject);
7500
- };
6885
+ static canCreate(options) {
6886
+ var _a;
6887
+ return options.token != null || ((_a = process.env) === null || _a === undefined ? undefined : _a.INTERCOM_API_KEY) != null;
7501
6888
  }
7502
- function verb(n, f) {
7503
- if (g[n]) {
7504
- i[n] = function(v) {
7505
- return new Promise(function(a, b) {
7506
- q.push([n, v, a, b]) > 1 || resume(n, v);
6889
+ getAuthRequest(_arg) {
6890
+ return __awaiter12(this, undefined, undefined, function* () {
6891
+ var _a, _b;
6892
+ const token = (_a = yield Supplier.get(this.token)) !== null && _a !== undefined ? _a : (_b = process.env) === null || _b === undefined ? undefined : _b.INTERCOM_API_KEY;
6893
+ if (token == null) {
6894
+ throw new IntercomError({
6895
+ message: "Please specify a token by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable"
7507
6896
  });
6897
+ }
6898
+ return {
6899
+ headers: { Authorization: `Bearer ${token}` }
7508
6900
  };
7509
- if (f)
7510
- i[n] = f(i[n]);
7511
- }
6901
+ });
7512
6902
  }
7513
- function resume(n, v) {
7514
- try {
7515
- step(g[n](v));
7516
- } catch (e) {
7517
- settle(q[0][3], e);
6903
+ }
6904
+
6905
+ // node_modules/intercom-client/dist/esm/core/headers.mjs
6906
+ function mergeHeaders(...headersArray) {
6907
+ const result = {};
6908
+ for (const [key, value] of headersArray.filter((headers) => headers != null).flatMap((headers) => Object.entries(headers))) {
6909
+ const insensitiveKey = key.toLowerCase();
6910
+ if (value != null) {
6911
+ result[insensitiveKey] = value;
6912
+ } else if (insensitiveKey in result) {
6913
+ delete result[insensitiveKey];
7518
6914
  }
7519
6915
  }
7520
- function step(r) {
7521
- r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
7522
- }
7523
- function fulfill(value) {
7524
- resume("next", value);
7525
- }
7526
- function reject(value) {
7527
- resume("throw", value);
7528
- }
7529
- function settle(f, v) {
7530
- if (f(v), q.shift(), q.length)
7531
- resume(q[0][0], q[0][1]);
6916
+ return result;
6917
+ }
6918
+ function mergeOnlyDefinedHeaders(...headersArray) {
6919
+ const result = {};
6920
+ for (const [key, value] of headersArray.filter((headers) => headers != null).flatMap((headers) => Object.entries(headers))) {
6921
+ const insensitiveKey = key.toLowerCase();
6922
+ if (value != null) {
6923
+ result[insensitiveKey] = value;
6924
+ }
7532
6925
  }
6926
+ return result;
6927
+ }
6928
+
6929
+ // node_modules/intercom-client/dist/esm/BaseClient.mjs
6930
+ function normalizeClientOptions(options) {
6931
+ var _a;
6932
+ const headers = mergeHeaders({
6933
+ "X-Fern-Language": "JavaScript",
6934
+ "X-Fern-SDK-Name": "intercom-client",
6935
+ "X-Fern-SDK-Version": "7.0.0",
6936
+ "User-Agent": "intercom-client/7.0.0",
6937
+ "X-Fern-Runtime": RUNTIME.type,
6938
+ "X-Fern-Runtime-Version": RUNTIME.version,
6939
+ "Intercom-Version": (_a = options === null || options === undefined ? undefined : options.version) !== null && _a !== undefined ? _a : "2.14"
6940
+ }, options === null || options === undefined ? undefined : options.headers);
6941
+ return Object.assign(Object.assign({}, options), { logging: exports_logging.createLogger(options === null || options === undefined ? undefined : options.logging), headers });
6942
+ }
6943
+ function normalizeClientOptionsWithAuth(options) {
6944
+ var _a;
6945
+ const normalized = normalizeClientOptions(options);
6946
+ const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
6947
+ (_a = normalized.authProvider) !== null && _a !== undefined || (normalized.authProvider = new BearerAuthProvider(normalizedWithNoOpAuthProvider));
6948
+ return normalized;
6949
+ }
6950
+ function withNoOpAuthProvider(options) {
6951
+ return Object.assign(Object.assign({}, options), { authProvider: new NoOpAuthProvider });
6952
+ }
6953
+
6954
+ // node_modules/intercom-client/dist/esm/environments.mjs
6955
+ var IntercomEnvironment = {
6956
+ UsProduction: "https://api.intercom.io",
6957
+ EuProduction: "https://api.eu.intercom.io",
6958
+ AuProduction: "https://api.au.intercom.io"
7533
6959
  };
7534
- var __asyncValues = function(o) {
7535
- if (!Symbol.asyncIterator)
7536
- throw new TypeError("Symbol.asyncIterator is not defined.");
7537
- var m = o[Symbol.asyncIterator], i;
7538
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
7539
- return this;
7540
- }, i);
7541
- function verb(n) {
7542
- i[n] = o[n] && function(v) {
7543
- return new Promise(function(resolve, reject) {
7544
- v = o[n](v), settle(resolve, reject, v.done, v.value);
6960
+
6961
+ // node_modules/intercom-client/dist/esm/errors/handleNonStatusCodeError.mjs
6962
+ function handleNonStatusCodeError(error2, rawResponse, method, path) {
6963
+ switch (error2.reason) {
6964
+ case "non-json":
6965
+ throw new IntercomError({
6966
+ statusCode: error2.statusCode,
6967
+ body: error2.rawBody,
6968
+ rawResponse
6969
+ });
6970
+ case "body-is-null":
6971
+ throw new IntercomError({
6972
+ statusCode: error2.statusCode,
6973
+ rawResponse
6974
+ });
6975
+ case "timeout":
6976
+ throw new IntercomTimeoutError(`Timeout exceeded when calling ${method} ${path}.`);
6977
+ case "unknown":
6978
+ throw new IntercomError({
6979
+ message: error2.errorMessage,
6980
+ rawResponse
6981
+ });
6982
+ default:
6983
+ throw new IntercomError({
6984
+ message: "Unknown error",
6985
+ rawResponse
7545
6986
  });
7546
- };
7547
6987
  }
7548
- function settle(resolve, reject, d, v) {
7549
- Promise.resolve(v).then(function(v2) {
7550
- resolve({ value: v2, done: d });
7551
- }, reject);
6988
+ }
6989
+
6990
+ // node_modules/intercom-client/dist/esm/api/errors/BadRequestError.mjs
6991
+ class BadRequestError extends IntercomError {
6992
+ constructor(body, rawResponse) {
6993
+ super({
6994
+ message: "BadRequestError",
6995
+ statusCode: 400,
6996
+ body,
6997
+ rawResponse
6998
+ });
6999
+ Object.setPrototypeOf(this, BadRequestError.prototype);
7000
+ }
7001
+ }
7002
+
7003
+ // node_modules/intercom-client/dist/esm/api/errors/ForbiddenError.mjs
7004
+ class ForbiddenError extends IntercomError {
7005
+ constructor(body, rawResponse) {
7006
+ super({
7007
+ message: "ForbiddenError",
7008
+ statusCode: 403,
7009
+ body,
7010
+ rawResponse
7011
+ });
7012
+ Object.setPrototypeOf(this, ForbiddenError.prototype);
7013
+ }
7014
+ }
7015
+
7016
+ // node_modules/intercom-client/dist/esm/api/errors/NotFoundError.mjs
7017
+ class NotFoundError extends IntercomError {
7018
+ constructor(body, rawResponse) {
7019
+ super({
7020
+ message: "NotFoundError",
7021
+ statusCode: 404,
7022
+ body,
7023
+ rawResponse
7024
+ });
7025
+ Object.setPrototypeOf(this, NotFoundError.prototype);
7552
7026
  }
7553
- };
7027
+ }
7554
7028
 
7555
- class Page {
7556
- constructor({ response, rawResponse, hasNextPage, getItems, loadPage }) {
7557
- this.response = response;
7558
- this.rawResponse = rawResponse;
7559
- this.data = getItems(response);
7560
- this._hasNextPage = hasNextPage;
7561
- this.getItems = getItems;
7562
- this.loadNextPage = loadPage;
7029
+ // node_modules/intercom-client/dist/esm/api/errors/TooManyRequestsError.mjs
7030
+ class TooManyRequestsError extends IntercomError {
7031
+ constructor(body, rawResponse) {
7032
+ super({
7033
+ message: "TooManyRequestsError",
7034
+ statusCode: 429,
7035
+ body,
7036
+ rawResponse
7037
+ });
7038
+ Object.setPrototypeOf(this, TooManyRequestsError.prototype);
7563
7039
  }
7564
- getNextPage() {
7565
- return __awaiter11(this, undefined, undefined, function* () {
7566
- const { data, rawResponse } = yield this.loadNextPage(this.response).withRawResponse();
7567
- this.response = data;
7568
- this.rawResponse = rawResponse;
7569
- this.data = this.getItems(this.response);
7570
- return this;
7040
+ }
7041
+
7042
+ // node_modules/intercom-client/dist/esm/api/errors/UnauthorizedError.mjs
7043
+ class UnauthorizedError extends IntercomError {
7044
+ constructor(body, rawResponse) {
7045
+ super({
7046
+ message: "UnauthorizedError",
7047
+ statusCode: 401,
7048
+ body,
7049
+ rawResponse
7571
7050
  });
7051
+ Object.setPrototypeOf(this, UnauthorizedError.prototype);
7572
7052
  }
7573
- hasNextPage() {
7574
- return this._hasNextPage(this.response);
7053
+ }
7054
+
7055
+ // node_modules/intercom-client/dist/esm/api/errors/UnprocessableEntityError.mjs
7056
+ class UnprocessableEntityError extends IntercomError {
7057
+ constructor(body, rawResponse) {
7058
+ super({
7059
+ message: "UnprocessableEntityError",
7060
+ statusCode: 422,
7061
+ body,
7062
+ rawResponse
7063
+ });
7064
+ Object.setPrototypeOf(this, UnprocessableEntityError.prototype);
7575
7065
  }
7576
- iterMessages() {
7577
- return __asyncGenerator(this, arguments, function* iterMessages_1() {
7578
- for (const item of this.data) {
7579
- yield yield __await(item);
7580
- }
7581
- while (this.hasNextPage()) {
7582
- yield __await(this.getNextPage());
7583
- for (const item of this.data) {
7584
- yield yield __await(item);
7585
- }
7586
- }
7066
+ }
7067
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/index.mjs
7068
+ var exports_unstable = {};
7069
+ __export(exports_unstable, {
7070
+ visitors: () => exports_visitors,
7071
+ tickets: () => exports_tickets,
7072
+ ticketTypes: () => exports_ticketTypes,
7073
+ ticketTypeAttributes: () => exports_ticketTypeAttributes,
7074
+ ticketStates: () => exports_ticketStates,
7075
+ teams: () => exports_teams,
7076
+ tags: () => exports_tags,
7077
+ switch_: () => exports_switch,
7078
+ subscriptionTypes: () => exports_subscriptionTypes,
7079
+ segments: () => exports_segments,
7080
+ notes: () => exports_notes,
7081
+ news: () => exports_news,
7082
+ messages: () => exports_messages,
7083
+ macros: () => exports_macros,
7084
+ jobs: () => exports_jobs,
7085
+ internalArticles: () => exports_internalArticles,
7086
+ helpCenter: () => exports_helpCenter,
7087
+ export_: () => exports_export,
7088
+ emails: () => exports_emails,
7089
+ dataExport: () => exports_dataExport,
7090
+ dataEvents: () => exports_dataEvents,
7091
+ dataAttributes: () => exports_dataAttributes,
7092
+ customObjectInstances: () => exports_customObjectInstances,
7093
+ customChannelEvents: () => exports_customChannelEvents,
7094
+ conversations: () => exports_conversations,
7095
+ contacts: () => exports_contacts,
7096
+ companies: () => exports_companies,
7097
+ calls: () => exports_calls,
7098
+ brands: () => exports_brands,
7099
+ awayStatusReasons: () => exports_awayStatusReasons,
7100
+ articles: () => exports_articles,
7101
+ aiContentSource: () => exports_aiContentSource,
7102
+ aiContent: () => exports_aiContent,
7103
+ aiAgent: () => exports_aiAgent,
7104
+ admins: () => exports_admins,
7105
+ WhatsappMessageStatusList: () => WhatsappMessageStatusList,
7106
+ UnprocessableEntityError: () => UnprocessableEntityError2,
7107
+ UnauthorizedError: () => UnauthorizedError2,
7108
+ TooManyRequestsError: () => TooManyRequestsError2,
7109
+ TicketType: () => TicketType,
7110
+ TicketStateDetailed: () => TicketStateDetailed,
7111
+ TicketState: () => TicketState,
7112
+ TicketReply: () => TicketReply,
7113
+ TicketPartAuthor: () => TicketPartAuthor,
7114
+ TicketPart: () => TicketPart,
7115
+ Ticket: () => Ticket,
7116
+ SubscriptionType: () => SubscriptionType,
7117
+ SlaApplied: () => SlaApplied,
7118
+ SingleFilterSearchRequest: () => SingleFilterSearchRequest,
7119
+ Segment: () => Segment,
7120
+ RegisterFinVoiceCallRequest: () => RegisterFinVoiceCallRequest,
7121
+ Recipient: () => Recipient,
7122
+ PaginatedResponse: () => PaginatedResponse,
7123
+ NotFoundError: () => NotFoundError2,
7124
+ NewsItemRequest: () => NewsItemRequest,
7125
+ NewsItem: () => NewsItem,
7126
+ MultipleFilterSearchRequest: () => MultipleFilterSearchRequest,
7127
+ Message: () => Message,
7128
+ Macro: () => Macro,
7129
+ LisDataAttributesRequestModel: () => LisDataAttributesRequestModel,
7130
+ LinkedObject: () => LinkedObject,
7131
+ Jobs: () => Jobs,
7132
+ InternalServerError: () => InternalServerError,
7133
+ ForbiddenError: () => ForbiddenError2,
7134
+ DataExport: () => DataExport,
7135
+ DataAttribute: () => DataAttribute,
7136
+ CustomChannelContact: () => CustomChannelContact,
7137
+ CustomActionFinished: () => CustomActionFinished,
7138
+ CreateTicketTypeRequest: () => CreateTicketTypeRequest,
7139
+ CreateArticleRequest: () => CreateArticleRequest,
7140
+ ConversationSource: () => ConversationSource,
7141
+ ConversationPart: () => ConversationPart,
7142
+ Conversation: () => Conversation,
7143
+ ContentSource: () => ContentSource,
7144
+ ContentImportSource: () => ContentImportSource,
7145
+ ConflictError: () => ConflictError,
7146
+ BadRequestError: () => BadRequestError2,
7147
+ AssignConversationRequest: () => AssignConversationRequest,
7148
+ ArticleSearchHighlights: () => ArticleSearchHighlights,
7149
+ ArticleListItem: () => ArticleListItem,
7150
+ ArticleContent: () => ArticleContent,
7151
+ AiAgent: () => AiAgent,
7152
+ AdminReplyTicketRequest: () => AdminReplyTicketRequest,
7153
+ AdminReplyConversationRequest: () => AdminReplyConversationRequest,
7154
+ ActivityLog: () => ActivityLog
7155
+ });
7156
+
7157
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/BadRequestError.mjs
7158
+ class BadRequestError2 extends IntercomError {
7159
+ constructor(body, rawResponse) {
7160
+ super({
7161
+ message: "BadRequestError",
7162
+ statusCode: 400,
7163
+ body,
7164
+ rawResponse
7587
7165
  });
7166
+ Object.setPrototypeOf(this, BadRequestError2.prototype);
7588
7167
  }
7589
- [Symbol.asyncIterator]() {
7590
- return __asyncGenerator(this, arguments, function* _a() {
7591
- var _b, e_1, _c, _d;
7592
- try {
7593
- for (var _e = true, _f = __asyncValues(this.iterMessages()), _g;_g = yield __await(_f.next()), _b = _g.done, !_b; _e = true) {
7594
- _d = _g.value;
7595
- _e = false;
7596
- const message = _d;
7597
- yield yield __await(message);
7598
- }
7599
- } catch (e_1_1) {
7600
- e_1 = { error: e_1_1 };
7601
- } finally {
7602
- try {
7603
- if (!_e && !_b && (_c = _f.return))
7604
- yield __await(_c.call(_f));
7605
- } finally {
7606
- if (e_1)
7607
- throw e_1.error;
7608
- }
7609
- }
7168
+ }
7169
+
7170
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/ConflictError.mjs
7171
+ class ConflictError extends IntercomError {
7172
+ constructor(body, rawResponse) {
7173
+ super({
7174
+ message: "ConflictError",
7175
+ statusCode: 409,
7176
+ body,
7177
+ rawResponse
7610
7178
  });
7179
+ Object.setPrototypeOf(this, ConflictError.prototype);
7611
7180
  }
7612
7181
  }
7613
- // node_modules/intercom-client/dist/esm/core/runtime/runtime.mjs
7614
- var RUNTIME = evaluateRuntime();
7615
- function evaluateRuntime() {
7616
- var _a, _b, _c, _d, _e;
7617
- const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
7618
- if (isBrowser) {
7619
- return {
7620
- type: "browser",
7621
- version: window.navigator.userAgent
7622
- };
7182
+
7183
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/ForbiddenError.mjs
7184
+ class ForbiddenError2 extends IntercomError {
7185
+ constructor(body, rawResponse) {
7186
+ super({
7187
+ message: "ForbiddenError",
7188
+ statusCode: 403,
7189
+ body,
7190
+ rawResponse
7191
+ });
7192
+ Object.setPrototypeOf(this, ForbiddenError2.prototype);
7623
7193
  }
7624
- const isCloudflare = typeof globalThis !== "undefined" && ((_a = globalThis === null || globalThis === undefined ? undefined : globalThis.navigator) === null || _a === undefined ? undefined : _a.userAgent) === "Cloudflare-Workers";
7625
- if (isCloudflare) {
7626
- return {
7627
- type: "workerd"
7628
- };
7194
+ }
7195
+
7196
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/InternalServerError.mjs
7197
+ class InternalServerError extends IntercomError {
7198
+ constructor(body, rawResponse) {
7199
+ super({
7200
+ message: "InternalServerError",
7201
+ statusCode: 500,
7202
+ body,
7203
+ rawResponse
7204
+ });
7205
+ Object.setPrototypeOf(this, InternalServerError.prototype);
7629
7206
  }
7630
- const isEdgeRuntime = typeof EdgeRuntime === "string";
7631
- if (isEdgeRuntime) {
7632
- return {
7633
- type: "edge-runtime"
7634
- };
7207
+ }
7208
+
7209
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/NotFoundError.mjs
7210
+ class NotFoundError2 extends IntercomError {
7211
+ constructor(body, rawResponse) {
7212
+ super({
7213
+ message: "NotFoundError",
7214
+ statusCode: 404,
7215
+ body,
7216
+ rawResponse
7217
+ });
7218
+ Object.setPrototypeOf(this, NotFoundError2.prototype);
7635
7219
  }
7636
- const isWebWorker = typeof self === "object" && typeof (self === null || self === undefined ? undefined : self.importScripts) === "function" && (((_b = self.constructor) === null || _b === undefined ? undefined : _b.name) === "DedicatedWorkerGlobalScope" || ((_c = self.constructor) === null || _c === undefined ? undefined : _c.name) === "ServiceWorkerGlobalScope" || ((_d = self.constructor) === null || _d === undefined ? undefined : _d.name) === "SharedWorkerGlobalScope");
7637
- if (isWebWorker) {
7638
- return {
7639
- type: "web-worker"
7640
- };
7220
+ }
7221
+
7222
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/TooManyRequestsError.mjs
7223
+ class TooManyRequestsError2 extends IntercomError {
7224
+ constructor(body, rawResponse) {
7225
+ super({
7226
+ message: "TooManyRequestsError",
7227
+ statusCode: 429,
7228
+ body,
7229
+ rawResponse
7230
+ });
7231
+ Object.setPrototypeOf(this, TooManyRequestsError2.prototype);
7641
7232
  }
7642
- const isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
7643
- if (isDeno) {
7644
- return {
7645
- type: "deno",
7646
- version: Deno.version.deno
7647
- };
7233
+ }
7234
+
7235
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/UnauthorizedError.mjs
7236
+ class UnauthorizedError2 extends IntercomError {
7237
+ constructor(body, rawResponse) {
7238
+ super({
7239
+ message: "UnauthorizedError",
7240
+ statusCode: 401,
7241
+ body,
7242
+ rawResponse
7243
+ });
7244
+ Object.setPrototypeOf(this, UnauthorizedError2.prototype);
7648
7245
  }
7649
- const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
7650
- if (isBun) {
7651
- return {
7652
- type: "bun",
7653
- version: Bun.version
7654
- };
7246
+ }
7247
+
7248
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/errors/UnprocessableEntityError.mjs
7249
+ class UnprocessableEntityError2 extends IntercomError {
7250
+ constructor(body, rawResponse) {
7251
+ super({
7252
+ message: "UnprocessableEntityError",
7253
+ statusCode: 422,
7254
+ body,
7255
+ rawResponse
7256
+ });
7257
+ Object.setPrototypeOf(this, UnprocessableEntityError2.prototype);
7655
7258
  }
7656
- const isReactNative = typeof navigator !== "undefined" && (navigator === null || navigator === undefined ? undefined : navigator.product) === "ReactNative";
7657
- if (isReactNative) {
7658
- return {
7659
- type: "react-native"
7259
+ }
7260
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/admins/index.mjs
7261
+ var exports_admins = {};
7262
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiAgent/index.mjs
7263
+ var exports_aiAgent = {};
7264
+ __export(exports_aiAgent, {
7265
+ AiAgent: () => AiAgent
7266
+ });
7267
+
7268
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiAgent/types/AiAgent.mjs
7269
+ var AiAgent;
7270
+ (function(AiAgent2) {
7271
+ AiAgent2.SourceType = {
7272
+ EssentialsPlanSetup: "essentials_plan_setup",
7273
+ Profile: "profile",
7274
+ Workflow: "workflow",
7275
+ WorkflowPreview: "workflow_preview",
7276
+ FinPreview: "fin_preview"
7277
+ };
7278
+ AiAgent2.LastAnswerType = {
7279
+ AiAnswer: "ai_answer",
7280
+ CustomAnswer: "custom_answer"
7281
+ };
7282
+ AiAgent2.ResolutionState = {
7283
+ AssumedResolution: "assumed_resolution",
7284
+ ConfirmedResolution: "confirmed_resolution",
7285
+ Escalated: "escalated",
7286
+ NegativeFeedback: "negative_feedback"
7287
+ };
7288
+ })(AiAgent || (AiAgent = {}));
7289
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiContent/index.mjs
7290
+ var exports_aiContent = {};
7291
+ __export(exports_aiContent, {
7292
+ ContentImportSource: () => ContentImportSource
7293
+ });
7294
+
7295
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiContent/types/ContentImportSource.mjs
7296
+ var ContentImportSource;
7297
+ (function(ContentImportSource2) {
7298
+ ContentImportSource2.SyncBehavior = {
7299
+ Api: "api",
7300
+ Automatic: "automatic",
7301
+ Manual: "manual"
7302
+ };
7303
+ ContentImportSource2.Status = {
7304
+ Active: "active",
7305
+ Deactivated: "deactivated"
7306
+ };
7307
+ })(ContentImportSource || (ContentImportSource = {}));
7308
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiContentSource/index.mjs
7309
+ var exports_aiContentSource = {};
7310
+ __export(exports_aiContentSource, {
7311
+ ContentSource: () => ContentSource
7312
+ });
7313
+
7314
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/aiContentSource/types/ContentSource.mjs
7315
+ var ContentSource;
7316
+ (function(ContentSource2) {
7317
+ ContentSource2.ContentType = {
7318
+ File: "file",
7319
+ Article: "article",
7320
+ ExternalContent: "external_content",
7321
+ ContentSnippet: "content_snippet",
7322
+ WorkflowConnectorAction: "workflow_connector_action"
7323
+ };
7324
+ })(ContentSource || (ContentSource = {}));
7325
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/articles/index.mjs
7326
+ var exports_articles = {};
7327
+ __export(exports_articles, {
7328
+ ArticleSearchHighlights: () => ArticleSearchHighlights,
7329
+ ArticleListItem: () => ArticleListItem
7330
+ });
7331
+
7332
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/articles/types/ArticleListItem.mjs
7333
+ var ArticleListItem;
7334
+ (function(ArticleListItem2) {
7335
+ ArticleListItem2.State = {
7336
+ Published: "published",
7337
+ Draft: "draft"
7338
+ };
7339
+ })(ArticleListItem || (ArticleListItem = {}));
7340
+
7341
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/articles/types/ArticleSearchHighlights.mjs
7342
+ var ArticleSearchHighlights;
7343
+ (function(ArticleSearchHighlights2) {
7344
+ let HighlightedTitle;
7345
+ (function(HighlightedTitle2) {
7346
+ let Item;
7347
+ (function(Item2) {
7348
+ Item2.Type = {
7349
+ Highlight: "highlight",
7350
+ Plain: "plain"
7351
+ };
7352
+ })(Item = HighlightedTitle2.Item || (HighlightedTitle2.Item = {}));
7353
+ })(HighlightedTitle = ArticleSearchHighlights2.HighlightedTitle || (ArticleSearchHighlights2.HighlightedTitle = {}));
7354
+ let HighlightedSummary;
7355
+ (function(HighlightedSummary2) {
7356
+ let Item;
7357
+ (function(Item2) {
7358
+ Item2.Type = {
7359
+ Highlight: "highlight",
7360
+ Plain: "plain"
7361
+ };
7362
+ })(Item = HighlightedSummary2.Item || (HighlightedSummary2.Item = {}));
7363
+ })(HighlightedSummary = ArticleSearchHighlights2.HighlightedSummary || (ArticleSearchHighlights2.HighlightedSummary = {}));
7364
+ })(ArticleSearchHighlights || (ArticleSearchHighlights = {}));
7365
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/awayStatusReasons/index.mjs
7366
+ var exports_awayStatusReasons = {};
7367
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/brands/index.mjs
7368
+ var exports_brands = {};
7369
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/calls/index.mjs
7370
+ var exports_calls = {};
7371
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/companies/index.mjs
7372
+ var exports_companies = {};
7373
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/contacts/index.mjs
7374
+ var exports_contacts = {};
7375
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/conversations/index.mjs
7376
+ var exports_conversations = {};
7377
+ __export(exports_conversations, {
7378
+ Conversation: () => Conversation
7379
+ });
7380
+
7381
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/conversations/types/Conversation.mjs
7382
+ var Conversation;
7383
+ (function(Conversation2) {
7384
+ Conversation2.State = {
7385
+ Open: "open",
7386
+ Closed: "closed",
7387
+ Snoozed: "snoozed"
7388
+ };
7389
+ Conversation2.Priority = {
7390
+ Priority: "priority",
7391
+ NotPriority: "not_priority"
7392
+ };
7393
+ })(Conversation || (Conversation = {}));
7394
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/customChannelEvents/index.mjs
7395
+ var exports_customChannelEvents = {};
7396
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/customObjectInstances/index.mjs
7397
+ var exports_customObjectInstances = {};
7398
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataAttributes/index.mjs
7399
+ var exports_dataAttributes = {};
7400
+ __export(exports_dataAttributes, {
7401
+ LisDataAttributesRequestModel: () => LisDataAttributesRequestModel,
7402
+ DataAttribute: () => DataAttribute
7403
+ });
7404
+
7405
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataAttributes/types/DataAttribute.mjs
7406
+ var DataAttribute;
7407
+ (function(DataAttribute2) {
7408
+ DataAttribute2.Model = {
7409
+ Contact: "contact",
7410
+ Company: "company"
7411
+ };
7412
+ DataAttribute2.DataType = {
7413
+ String: "string",
7414
+ Integer: "integer",
7415
+ Float: "float",
7416
+ Boolean: "boolean",
7417
+ Date: "date"
7418
+ };
7419
+ })(DataAttribute || (DataAttribute = {}));
7420
+
7421
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataAttributes/types/LisDataAttributesRequestModel.mjs
7422
+ var LisDataAttributesRequestModel = {
7423
+ Contact: "contact",
7424
+ Company: "company",
7425
+ Conversation: "conversation"
7426
+ };
7427
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataEvents/index.mjs
7428
+ var exports_dataEvents = {};
7429
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataExport/index.mjs
7430
+ var exports_dataExport = {};
7431
+ __export(exports_dataExport, {
7432
+ DataExport: () => DataExport
7433
+ });
7434
+
7435
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/dataExport/types/DataExport.mjs
7436
+ var DataExport;
7437
+ (function(DataExport2) {
7438
+ DataExport2.Status = {
7439
+ Pending: "pending",
7440
+ InProgress: "in_progress",
7441
+ Failed: "failed",
7442
+ Completed: "completed",
7443
+ NoData: "no_data",
7444
+ Canceled: "canceled"
7445
+ };
7446
+ })(DataExport || (DataExport = {}));
7447
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/emails/index.mjs
7448
+ var exports_emails = {};
7449
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/export/index.mjs
7450
+ var exports_export = {};
7451
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/helpCenter/index.mjs
7452
+ var exports_helpCenter = {};
7453
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/internalArticles/index.mjs
7454
+ var exports_internalArticles = {};
7455
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/jobs/index.mjs
7456
+ var exports_jobs = {};
7457
+ __export(exports_jobs, {
7458
+ Jobs: () => Jobs
7459
+ });
7460
+
7461
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/jobs/types/Jobs.mjs
7462
+ var Jobs;
7463
+ (function(Jobs2) {
7464
+ Jobs2.Status = {
7465
+ Pending: "pending",
7466
+ Success: "success",
7467
+ Failed: "failed"
7468
+ };
7469
+ })(Jobs || (Jobs = {}));
7470
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/macros/index.mjs
7471
+ var exports_macros = {};
7472
+ __export(exports_macros, {
7473
+ Macro: () => Macro
7474
+ });
7475
+
7476
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/macros/types/Macro.mjs
7477
+ var Macro;
7478
+ (function(Macro2) {
7479
+ Macro2.VisibleTo = {
7480
+ Everyone: "everyone",
7481
+ SpecificTeams: "specific_teams"
7482
+ };
7483
+ let AvailableOn;
7484
+ (function(AvailableOn2) {
7485
+ AvailableOn2.Item = {
7486
+ Inbox: "inbox",
7487
+ Messenger: "messenger"
7660
7488
  };
7661
- }
7662
- const isNode = typeof process !== "undefined" && "version" in process && !!process.version && "versions" in process && !!((_e = process.versions) === null || _e === undefined ? undefined : _e.node);
7663
- if (isNode) {
7664
- return {
7665
- type: "node",
7666
- version: process.versions.node,
7667
- parsedVersion: Number(process.versions.node.split(".")[0])
7489
+ })(AvailableOn = Macro2.AvailableOn || (Macro2.AvailableOn = {}));
7490
+ })(Macro || (Macro = {}));
7491
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/messages/index.mjs
7492
+ var exports_messages = {};
7493
+ __export(exports_messages, {
7494
+ Message: () => Message
7495
+ });
7496
+
7497
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/messages/types/Message.mjs
7498
+ var Message;
7499
+ (function(Message2) {
7500
+ Message2.MessageType = {
7501
+ Email: "email",
7502
+ Inapp: "inapp",
7503
+ Facebook: "facebook",
7504
+ Twitter: "twitter",
7505
+ Sms: "sms",
7506
+ Whatsapp: "whatsapp"
7507
+ };
7508
+ })(Message || (Message = {}));
7509
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/news/index.mjs
7510
+ var exports_news = {};
7511
+ __export(exports_news, {
7512
+ NewsItem: () => NewsItem
7513
+ });
7514
+
7515
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/news/types/NewsItem.mjs
7516
+ var NewsItem;
7517
+ (function(NewsItem2) {
7518
+ NewsItem2.State = {
7519
+ Draft: "draft",
7520
+ Live: "live"
7521
+ };
7522
+ })(NewsItem || (NewsItem = {}));
7523
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/notes/index.mjs
7524
+ var exports_notes = {};
7525
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/segments/index.mjs
7526
+ var exports_segments = {};
7527
+ __export(exports_segments, {
7528
+ Segment: () => Segment
7529
+ });
7530
+
7531
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/segments/types/Segment.mjs
7532
+ var Segment;
7533
+ (function(Segment2) {
7534
+ Segment2.PersonType = {
7535
+ Contact: "contact",
7536
+ User: "user"
7537
+ };
7538
+ })(Segment || (Segment = {}));
7539
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/subscriptionTypes/index.mjs
7540
+ var exports_subscriptionTypes = {};
7541
+ __export(exports_subscriptionTypes, {
7542
+ SubscriptionType: () => SubscriptionType
7543
+ });
7544
+
7545
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/subscriptionTypes/types/SubscriptionType.mjs
7546
+ var SubscriptionType;
7547
+ (function(SubscriptionType2) {
7548
+ SubscriptionType2.State = {
7549
+ Live: "live",
7550
+ Draft: "draft",
7551
+ Archived: "archived"
7552
+ };
7553
+ SubscriptionType2.ConsentType = {
7554
+ OptOut: "opt_out",
7555
+ OptIn: "opt_in"
7556
+ };
7557
+ let ContentTypes;
7558
+ (function(ContentTypes2) {
7559
+ ContentTypes2.Item = {
7560
+ Email: "email",
7561
+ SmsMessage: "sms_message"
7668
7562
  };
7669
- }
7670
- return {
7671
- type: "unknown"
7563
+ })(ContentTypes = SubscriptionType2.ContentTypes || (SubscriptionType2.ContentTypes = {}));
7564
+ })(SubscriptionType || (SubscriptionType = {}));
7565
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/switch/index.mjs
7566
+ var exports_switch = {};
7567
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tags/index.mjs
7568
+ var exports_tags = {};
7569
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/teams/index.mjs
7570
+ var exports_teams = {};
7571
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/ticketStates/index.mjs
7572
+ var exports_ticketStates = {};
7573
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/index.mjs
7574
+ var exports_tickets = {};
7575
+ __export(exports_tickets, {
7576
+ TicketType: () => TicketType,
7577
+ TicketStateDetailed: () => TicketStateDetailed,
7578
+ TicketState: () => TicketState,
7579
+ TicketPart: () => TicketPart,
7580
+ Ticket: () => Ticket
7581
+ });
7582
+
7583
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/types/Ticket.mjs
7584
+ var Ticket;
7585
+ (function(Ticket2) {
7586
+ Ticket2.Category = {
7587
+ Customer: "Customer",
7588
+ BackOffice: "Back-office",
7589
+ Tracker: "Tracker"
7590
+ };
7591
+ })(Ticket || (Ticket = {}));
7592
+
7593
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/types/TicketPart.mjs
7594
+ var TicketPart;
7595
+ (function(TicketPart2) {
7596
+ TicketPart2.PreviousTicketState = {
7597
+ Submitted: "submitted",
7598
+ InProgress: "in_progress",
7599
+ WaitingOnCustomer: "waiting_on_customer",
7600
+ Resolved: "resolved"
7601
+ };
7602
+ TicketPart2.TicketState = {
7603
+ Submitted: "submitted",
7604
+ InProgress: "in_progress",
7605
+ WaitingOnCustomer: "waiting_on_customer",
7606
+ Resolved: "resolved"
7607
+ };
7608
+ })(TicketPart || (TicketPart = {}));
7609
+
7610
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/types/TicketState.mjs
7611
+ var TicketState;
7612
+ (function(TicketState2) {
7613
+ TicketState2.Category = {
7614
+ Submitted: "submitted",
7615
+ InProgress: "in_progress",
7616
+ WaitingOnCustomer: "waiting_on_customer",
7617
+ Resolved: "resolved"
7618
+ };
7619
+ })(TicketState || (TicketState = {}));
7620
+
7621
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/types/TicketStateDetailed.mjs
7622
+ var TicketStateDetailed;
7623
+ (function(TicketStateDetailed2) {
7624
+ TicketStateDetailed2.Category = {
7625
+ Submitted: "submitted",
7626
+ InProgress: "in_progress",
7627
+ WaitingOnCustomer: "waiting_on_customer",
7628
+ Resolved: "resolved"
7629
+ };
7630
+ })(TicketStateDetailed || (TicketStateDetailed = {}));
7631
+
7632
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/tickets/types/TicketType.mjs
7633
+ var TicketType;
7634
+ (function(TicketType2) {
7635
+ TicketType2.Category = {
7636
+ Customer: "Customer",
7637
+ BackOffice: "Back-office",
7638
+ Tracker: "Tracker"
7639
+ };
7640
+ })(TicketType || (TicketType = {}));
7641
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/ticketTypeAttributes/index.mjs
7642
+ var exports_ticketTypeAttributes = {};
7643
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/ticketTypes/index.mjs
7644
+ var exports_ticketTypes = {};
7645
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/resources/visitors/index.mjs
7646
+ var exports_visitors = {};
7647
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/ActivityLog.mjs
7648
+ var ActivityLog;
7649
+ (function(ActivityLog2) {
7650
+ ActivityLog2.ActivityType = {
7651
+ AdminConversationAssignmentLimitChange: "admin_conversation_assignment_limit_change",
7652
+ AdminTicketAssignmentLimitChange: "admin_ticket_assignment_limit_change",
7653
+ AdminAwayModeChange: "admin_away_mode_change",
7654
+ AdminDeletion: "admin_deletion",
7655
+ AdminDeprovisioned: "admin_deprovisioned",
7656
+ AdminImpersonationEnd: "admin_impersonation_end",
7657
+ AdminImpersonationStart: "admin_impersonation_start",
7658
+ AdminInviteChange: "admin_invite_change",
7659
+ AdminInviteCreation: "admin_invite_creation",
7660
+ AdminInviteDeletion: "admin_invite_deletion",
7661
+ AdminLoginFailure: "admin_login_failure",
7662
+ AdminLoginSuccess: "admin_login_success",
7663
+ AdminLogout: "admin_logout",
7664
+ AdminPasswordResetRequest: "admin_password_reset_request",
7665
+ AdminPasswordResetSuccess: "admin_password_reset_success",
7666
+ AdminPermissionChange: "admin_permission_change",
7667
+ AdminProvisioned: "admin_provisioned",
7668
+ AdminTwoFactorAuthChange: "admin_two_factor_auth_change",
7669
+ AdminUnauthorizedSignInMethod: "admin_unauthorized_sign_in_method",
7670
+ AppAdminJoin: "app_admin_join",
7671
+ AppAuthenticationMethodChange: "app_authentication_method_change",
7672
+ AppDataDeletion: "app_data_deletion",
7673
+ AppDataExport: "app_data_export",
7674
+ AppGoogleSsoDomainChange: "app_google_sso_domain_change",
7675
+ AppIdentityVerificationChange: "app_identity_verification_change",
7676
+ AppNameChange: "app_name_change",
7677
+ AppOutboundAddressChange: "app_outbound_address_change",
7678
+ AppPackageInstallation: "app_package_installation",
7679
+ AppPackageTokenRegeneration: "app_package_token_regeneration",
7680
+ AppPackageUninstallation: "app_package_uninstallation",
7681
+ AppTeamCreation: "app_team_creation",
7682
+ AppTeamDeletion: "app_team_deletion",
7683
+ AppTeamMembershipModification: "app_team_membership_modification",
7684
+ AppTimezoneChange: "app_timezone_change",
7685
+ AppWebhookCreation: "app_webhook_creation",
7686
+ AppWebhookDeletion: "app_webhook_deletion",
7687
+ ArticlesInMessengerEnabledChange: "articles_in_messenger_enabled_change",
7688
+ BulkDelete: "bulk_delete",
7689
+ BulkExport: "bulk_export",
7690
+ CampaignDeletion: "campaign_deletion",
7691
+ CampaignStateChange: "campaign_state_change",
7692
+ ConversationPartDeletion: "conversation_part_deletion",
7693
+ ConversationTopicChange: "conversation_topic_change",
7694
+ ConversationTopicCreation: "conversation_topic_creation",
7695
+ ConversationTopicDeletion: "conversation_topic_deletion",
7696
+ HelpCenterSettingsChange: "help_center_settings_change",
7697
+ InboundConversationsChange: "inbound_conversations_change",
7698
+ InboxAccessChange: "inbox_access_change",
7699
+ MessageDeletion: "message_deletion",
7700
+ MessageStateChange: "message_state_change",
7701
+ MessengerLookAndFeelChange: "messenger_look_and_feel_change",
7702
+ MessengerSearchRequiredChange: "messenger_search_required_change",
7703
+ MessengerSpacesChange: "messenger_spaces_change",
7704
+ OfficeHoursChange: "office_hours_change",
7705
+ RoleChange: "role_change",
7706
+ RoleCreation: "role_creation",
7707
+ RoleDeletion: "role_deletion",
7708
+ RulesetActivationTitlePreview: "ruleset_activation_title_preview",
7709
+ RulesetCreation: "ruleset_creation",
7710
+ RulesetDeletion: "ruleset_deletion",
7711
+ SearchBrowseEnabledChange: "search_browse_enabled_change",
7712
+ SearchBrowseRequiredChange: "search_browse_required_change",
7713
+ SeatChange: "seat_change",
7714
+ SeatRevoke: "seat_revoke",
7715
+ SecuritySettingsChange: "security_settings_change",
7716
+ TemporaryExpectationChange: "temporary_expectation_change",
7717
+ UpfrontEmailCollectionChange: "upfront_email_collection_change",
7718
+ WelcomeMessageChange: "welcome_message_change"
7672
7719
  };
7673
- }
7674
- // node_modules/intercom-client/dist/esm/core/url/index.mjs
7675
- var exports_url = {};
7676
- __export(exports_url, {
7677
- toQueryString: () => toQueryString,
7678
- join: () => join,
7679
- encodePathParam: () => encodePathParam
7680
- });
7720
+ })(ActivityLog || (ActivityLog = {}));
7681
7721
 
7682
- // node_modules/intercom-client/dist/esm/core/url/encodePathParam.mjs
7683
- function encodePathParam(param) {
7684
- if (param === null) {
7685
- return "null";
7686
- }
7687
- const typeofParam = typeof param;
7688
- switch (typeofParam) {
7689
- case "undefined":
7690
- return "undefined";
7691
- case "string":
7692
- case "number":
7693
- case "boolean":
7694
- break;
7695
- default:
7696
- param = String(param);
7697
- break;
7698
- }
7699
- return encodeURIComponent(param);
7700
- }
7701
- // node_modules/intercom-client/dist/esm/core/url/join.mjs
7702
- function join(base, ...segments) {
7703
- if (!base) {
7704
- return "";
7705
- }
7706
- if (segments.length === 0) {
7707
- return base;
7708
- }
7709
- if (base.includes("://")) {
7710
- let url;
7711
- try {
7712
- url = new URL(base);
7713
- } catch (_a) {
7714
- return joinPath(base, ...segments);
7715
- }
7716
- const lastSegment = segments[segments.length - 1];
7717
- const shouldPreserveTrailingSlash = lastSegment === null || lastSegment === undefined ? undefined : lastSegment.endsWith("/");
7718
- for (const segment of segments) {
7719
- const cleanSegment = trimSlashes(segment);
7720
- if (cleanSegment) {
7721
- url.pathname = joinPathSegments(url.pathname, cleanSegment);
7722
- }
7723
- }
7724
- if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
7725
- url.pathname += "/";
7726
- }
7727
- return url.toString();
7728
- }
7729
- return joinPath(base, ...segments);
7730
- }
7731
- function joinPath(base, ...segments) {
7732
- if (segments.length === 0) {
7733
- return base;
7734
- }
7735
- let result = base;
7736
- const lastSegment = segments[segments.length - 1];
7737
- const shouldPreserveTrailingSlash = lastSegment === null || lastSegment === undefined ? undefined : lastSegment.endsWith("/");
7738
- for (const segment of segments) {
7739
- const cleanSegment = trimSlashes(segment);
7740
- if (cleanSegment) {
7741
- result = joinPathSegments(result, cleanSegment);
7742
- }
7743
- }
7744
- if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
7745
- result += "/";
7746
- }
7747
- return result;
7748
- }
7749
- function joinPathSegments(left, right) {
7750
- if (left.endsWith("/")) {
7751
- return left + right;
7752
- }
7753
- return `${left}/${right}`;
7754
- }
7755
- function trimSlashes(str) {
7756
- if (!str)
7757
- return str;
7758
- let start = 0;
7759
- let end = str.length;
7760
- if (str.startsWith("/"))
7761
- start = 1;
7762
- if (str.endsWith("/"))
7763
- end = str.length - 1;
7764
- return start === 0 && end === str.length ? str : str.slice(start, end);
7765
- }
7766
- // node_modules/intercom-client/dist/esm/core/utils/setObjectProperty.mjs
7767
- function setObjectProperty(object, path, value) {
7768
- if (object == null) {
7769
- return object;
7770
- }
7771
- const keys = path.split(".");
7772
- if (keys.length === 0) {
7773
- return object;
7774
- }
7775
- let current = object;
7776
- for (let i = 0;i < keys.length - 1; i++) {
7777
- const key = keys[i];
7778
- if (key == null) {
7779
- continue;
7780
- }
7781
- if (!current[key] || typeof current[key] !== "object") {
7782
- current[key] = {};
7783
- }
7784
- current = current[key];
7785
- }
7786
- const lastKey = keys[keys.length - 1];
7787
- if (lastKey == null) {
7788
- return object;
7789
- }
7790
- current[lastKey] = value;
7791
- return object;
7792
- }
7793
- // node_modules/intercom-client/dist/esm/auth/BearerAuthProvider.mjs
7794
- var __awaiter12 = function(thisArg, _arguments, P, generator) {
7795
- function adopt(value) {
7796
- return value instanceof P ? value : new P(function(resolve) {
7797
- resolve(value);
7798
- });
7799
- }
7800
- return new (P || (P = Promise))(function(resolve, reject) {
7801
- function fulfilled(value) {
7802
- try {
7803
- step(generator.next(value));
7804
- } catch (e) {
7805
- reject(e);
7806
- }
7807
- }
7808
- function rejected(value) {
7809
- try {
7810
- step(generator["throw"](value));
7811
- } catch (e) {
7812
- reject(e);
7813
- }
7814
- }
7815
- function step(result) {
7816
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
7817
- }
7818
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7819
- });
7820
- };
7722
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/AdminReplyConversationRequest.mjs
7723
+ var AdminReplyConversationRequest;
7724
+ (function(AdminReplyConversationRequest2) {
7725
+ AdminReplyConversationRequest2.MessageType = {
7726
+ Comment: "comment",
7727
+ Note: "note",
7728
+ QuickReply: "quick_reply"
7729
+ };
7730
+ })(AdminReplyConversationRequest || (AdminReplyConversationRequest = {}));
7731
+
7732
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/AdminReplyTicketRequest.mjs
7733
+ var AdminReplyTicketRequest;
7734
+ (function(AdminReplyTicketRequest2) {
7735
+ AdminReplyTicketRequest2.MessageType = {
7736
+ Comment: "comment",
7737
+ Note: "note",
7738
+ QuickReply: "quick_reply"
7739
+ };
7740
+ })(AdminReplyTicketRequest || (AdminReplyTicketRequest = {}));
7741
+
7742
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/ArticleContent.mjs
7743
+ var ArticleContent;
7744
+ (function(ArticleContent2) {
7745
+ ArticleContent2.State = {
7746
+ Published: "published",
7747
+ Draft: "draft"
7748
+ };
7749
+ })(ArticleContent || (ArticleContent = {}));
7750
+
7751
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/AssignConversationRequest.mjs
7752
+ var AssignConversationRequest;
7753
+ (function(AssignConversationRequest2) {
7754
+ AssignConversationRequest2.Type = {
7755
+ Admin: "admin",
7756
+ Team: "team"
7757
+ };
7758
+ })(AssignConversationRequest || (AssignConversationRequest = {}));
7759
+
7760
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/ConversationPart.mjs
7761
+ var ConversationPart;
7762
+ (function(ConversationPart2) {
7763
+ ConversationPart2.State = {
7764
+ Open: "open",
7765
+ Closed: "closed",
7766
+ Snoozed: "snoozed"
7767
+ };
7768
+ })(ConversationPart || (ConversationPart = {}));
7769
+
7770
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/ConversationSource.mjs
7771
+ var ConversationSource;
7772
+ (function(ConversationSource2) {
7773
+ ConversationSource2.Type = {
7774
+ Conversation: "conversation",
7775
+ Email: "email",
7776
+ Facebook: "facebook",
7777
+ Instagram: "instagram",
7778
+ PhoneCall: "phone_call",
7779
+ PhoneSwitch: "phone_switch",
7780
+ Push: "push",
7781
+ Sms: "sms",
7782
+ Twitter: "twitter",
7783
+ Whatsapp: "whatsapp"
7784
+ };
7785
+ })(ConversationSource || (ConversationSource = {}));
7786
+
7787
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/CreateArticleRequest.mjs
7788
+ var CreateArticleRequest;
7789
+ (function(CreateArticleRequest2) {
7790
+ CreateArticleRequest2.State = {
7791
+ Published: "published",
7792
+ Draft: "draft"
7793
+ };
7794
+ })(CreateArticleRequest || (CreateArticleRequest = {}));
7795
+
7796
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/CreateTicketTypeRequest.mjs
7797
+ var CreateTicketTypeRequest;
7798
+ (function(CreateTicketTypeRequest2) {
7799
+ CreateTicketTypeRequest2.Category = {
7800
+ Customer: "Customer",
7801
+ BackOffice: "Back-office",
7802
+ Tracker: "Tracker"
7803
+ };
7804
+ })(CreateTicketTypeRequest || (CreateTicketTypeRequest = {}));
7805
+
7806
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/CustomActionFinished.mjs
7807
+ var CustomActionFinished;
7808
+ (function(CustomActionFinished2) {
7809
+ let Action;
7810
+ (function(Action2) {
7811
+ Action2.Result = {
7812
+ Success: "success",
7813
+ Failed: "failed"
7814
+ };
7815
+ })(Action = CustomActionFinished2.Action || (CustomActionFinished2.Action = {}));
7816
+ })(CustomActionFinished || (CustomActionFinished = {}));
7821
7817
 
7822
- class BearerAuthProvider {
7823
- constructor(options) {
7824
- this.token = options.token;
7825
- }
7826
- static canCreate(options) {
7827
- var _a;
7828
- return options.token != null || ((_a = process.env) === null || _a === undefined ? undefined : _a.INTERCOM_API_KEY) != null;
7829
- }
7830
- getAuthRequest(_arg) {
7831
- return __awaiter12(this, undefined, undefined, function* () {
7832
- var _a, _b;
7833
- const token = (_a = yield Supplier.get(this.token)) !== null && _a !== undefined ? _a : (_b = process.env) === null || _b === undefined ? undefined : _b.INTERCOM_API_KEY;
7834
- if (token == null) {
7835
- throw new IntercomError({
7836
- message: "Please specify a token by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable"
7837
- });
7838
- }
7839
- return {
7840
- headers: { Authorization: `Bearer ${token}` }
7841
- };
7842
- });
7843
- }
7844
- }
7818
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/CustomChannelContact.mjs
7819
+ var CustomChannelContact;
7820
+ (function(CustomChannelContact2) {
7821
+ CustomChannelContact2.Type = {
7822
+ User: "user",
7823
+ Lead: "lead"
7824
+ };
7825
+ })(CustomChannelContact || (CustomChannelContact = {}));
7845
7826
 
7846
- // node_modules/intercom-client/dist/esm/core/headers.mjs
7847
- function mergeHeaders(...headersArray) {
7848
- const result = {};
7849
- for (const [key, value] of headersArray.filter((headers) => headers != null).flatMap((headers) => Object.entries(headers))) {
7850
- const insensitiveKey = key.toLowerCase();
7851
- if (value != null) {
7852
- result[insensitiveKey] = value;
7853
- } else if (insensitiveKey in result) {
7854
- delete result[insensitiveKey];
7855
- }
7856
- }
7857
- return result;
7858
- }
7859
- function mergeOnlyDefinedHeaders(...headersArray) {
7860
- const result = {};
7861
- for (const [key, value] of headersArray.filter((headers) => headers != null).flatMap((headers) => Object.entries(headers))) {
7862
- const insensitiveKey = key.toLowerCase();
7863
- if (value != null) {
7864
- result[insensitiveKey] = value;
7865
- }
7866
- }
7867
- return result;
7868
- }
7827
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/LinkedObject.mjs
7828
+ var LinkedObject;
7829
+ (function(LinkedObject2) {
7830
+ LinkedObject2.Type = {
7831
+ Ticket: "ticket",
7832
+ Conversation: "conversation"
7833
+ };
7834
+ LinkedObject2.Category = {
7835
+ Customer: "Customer",
7836
+ BackOffice: "Back-office",
7837
+ Tracker: "Tracker"
7838
+ };
7839
+ })(LinkedObject || (LinkedObject = {}));
7869
7840
 
7870
- // node_modules/intercom-client/dist/esm/BaseClient.mjs
7871
- function normalizeClientOptions(options) {
7872
- var _a;
7873
- const headers = mergeHeaders({
7874
- "X-Fern-Language": "JavaScript",
7875
- "X-Fern-SDK-Name": "intercom-client",
7876
- "X-Fern-SDK-Version": "7.0.0",
7877
- "User-Agent": "intercom-client/7.0.0",
7878
- "X-Fern-Runtime": RUNTIME.type,
7879
- "X-Fern-Runtime-Version": RUNTIME.version,
7880
- "Intercom-Version": (_a = options === null || options === undefined ? undefined : options.version) !== null && _a !== undefined ? _a : "2.14"
7881
- }, options === null || options === undefined ? undefined : options.headers);
7882
- return Object.assign(Object.assign({}, options), { logging: exports_logging.createLogger(options === null || options === undefined ? undefined : options.logging), headers });
7883
- }
7884
- function normalizeClientOptionsWithAuth(options) {
7885
- var _a;
7886
- const normalized = normalizeClientOptions(options);
7887
- const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
7888
- (_a = normalized.authProvider) !== null && _a !== undefined || (normalized.authProvider = new BearerAuthProvider(normalizedWithNoOpAuthProvider));
7889
- return normalized;
7890
- }
7891
- function withNoOpAuthProvider(options) {
7892
- return Object.assign(Object.assign({}, options), { authProvider: new NoOpAuthProvider });
7893
- }
7841
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/MultipleFilterSearchRequest.mjs
7842
+ var MultipleFilterSearchRequest;
7843
+ (function(MultipleFilterSearchRequest2) {
7844
+ MultipleFilterSearchRequest2.Operator = {
7845
+ And: "AND",
7846
+ Or: "OR"
7847
+ };
7848
+ })(MultipleFilterSearchRequest || (MultipleFilterSearchRequest = {}));
7894
7849
 
7895
- // node_modules/intercom-client/dist/esm/environments.mjs
7896
- var IntercomEnvironment = {
7897
- UsProduction: "https://api.intercom.io",
7898
- EuProduction: "https://api.eu.intercom.io",
7899
- AuProduction: "https://api.au.intercom.io"
7900
- };
7850
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/NewsItemRequest.mjs
7851
+ var NewsItemRequest;
7852
+ (function(NewsItemRequest2) {
7853
+ NewsItemRequest2.State = {
7854
+ Draft: "draft",
7855
+ Live: "live"
7856
+ };
7857
+ })(NewsItemRequest || (NewsItemRequest = {}));
7901
7858
 
7902
- // node_modules/intercom-client/dist/esm/errors/handleNonStatusCodeError.mjs
7903
- function handleNonStatusCodeError(error2, rawResponse, method, path) {
7904
- switch (error2.reason) {
7905
- case "non-json":
7906
- throw new IntercomError({
7907
- statusCode: error2.statusCode,
7908
- body: error2.rawBody,
7909
- rawResponse
7910
- });
7911
- case "body-is-null":
7912
- throw new IntercomError({
7913
- statusCode: error2.statusCode,
7914
- rawResponse
7915
- });
7916
- case "timeout":
7917
- throw new IntercomTimeoutError(`Timeout exceeded when calling ${method} ${path}.`);
7918
- case "unknown":
7919
- throw new IntercomError({
7920
- message: error2.errorMessage,
7921
- rawResponse
7922
- });
7923
- default:
7924
- throw new IntercomError({
7925
- message: "Unknown error",
7926
- rawResponse
7927
- });
7928
- }
7929
- }
7859
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/PaginatedResponse.mjs
7860
+ var PaginatedResponse;
7861
+ (function(PaginatedResponse2) {
7862
+ PaginatedResponse2.Type = {
7863
+ List: "list",
7864
+ ConversationList: "conversation.list"
7865
+ };
7866
+ })(PaginatedResponse || (PaginatedResponse = {}));
7867
+
7868
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/Recipient.mjs
7869
+ var Recipient;
7870
+ (function(Recipient2) {
7871
+ Recipient2.Type = {
7872
+ User: "user",
7873
+ Lead: "lead"
7874
+ };
7875
+ })(Recipient || (Recipient = {}));
7876
+
7877
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/RegisterFinVoiceCallRequest.mjs
7878
+ var RegisterFinVoiceCallRequest;
7879
+ (function(RegisterFinVoiceCallRequest2) {
7880
+ RegisterFinVoiceCallRequest2.Source = {
7881
+ Five9: "five9",
7882
+ ZoomPhone: "zoom_phone",
7883
+ AwsConnect: "aws_connect"
7884
+ };
7885
+ })(RegisterFinVoiceCallRequest || (RegisterFinVoiceCallRequest = {}));
7886
+
7887
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/SingleFilterSearchRequest.mjs
7888
+ var SingleFilterSearchRequest;
7889
+ (function(SingleFilterSearchRequest2) {
7890
+ SingleFilterSearchRequest2.Operator = {
7891
+ EqualTo: "=",
7892
+ NotEquals: "!=",
7893
+ In: "IN",
7894
+ Nin: "NIN",
7895
+ LessThan: "<",
7896
+ GreaterThan: ">"
7897
+ };
7898
+ })(SingleFilterSearchRequest || (SingleFilterSearchRequest = {}));
7899
+
7900
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/SlaApplied.mjs
7901
+ var SlaApplied;
7902
+ (function(SlaApplied2) {
7903
+ SlaApplied2.SlaStatus = {
7904
+ Hit: "hit",
7905
+ Missed: "missed",
7906
+ Cancelled: "cancelled",
7907
+ Active: "active"
7908
+ };
7909
+ })(SlaApplied || (SlaApplied = {}));
7910
+
7911
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/TicketPartAuthor.mjs
7912
+ var TicketPartAuthor;
7913
+ (function(TicketPartAuthor2) {
7914
+ TicketPartAuthor2.Type = {
7915
+ Admin: "admin",
7916
+ Bot: "bot",
7917
+ Team: "team",
7918
+ User: "user"
7919
+ };
7920
+ })(TicketPartAuthor || (TicketPartAuthor = {}));
7930
7921
 
7922
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/TicketReply.mjs
7923
+ var TicketReply;
7924
+ (function(TicketReply2) {
7925
+ TicketReply2.PartType = {
7926
+ Note: "note",
7927
+ Comment: "comment",
7928
+ QuickReply: "quick_reply"
7929
+ };
7930
+ })(TicketReply || (TicketReply = {}));
7931
+
7932
+ // node_modules/intercom-client/dist/esm/api/resources/unstable/types/WhatsappMessageStatusList.mjs
7933
+ var WhatsappMessageStatusList;
7934
+ (function(WhatsappMessageStatusList2) {
7935
+ let Events;
7936
+ (function(Events2) {
7937
+ let Item;
7938
+ (function(Item2) {
7939
+ Item2.Status = {
7940
+ Sent: "sent",
7941
+ Delivered: "delivered",
7942
+ Read: "read",
7943
+ Failed: "failed"
7944
+ };
7945
+ })(Item = Events2.Item || (Events2.Item = {}));
7946
+ })(Events = WhatsappMessageStatusList2.Events || (WhatsappMessageStatusList2.Events = {}));
7947
+ })(WhatsappMessageStatusList || (WhatsappMessageStatusList = {}));
7931
7948
  // node_modules/intercom-client/dist/esm/api/resources/admins/client/Client.mjs
7932
7949
  var __awaiter13 = function(thisArg, _arguments, P, generator) {
7933
7950
  function adopt(value) {
@@ -24302,6 +24319,9 @@ function getDryRunResponse(method) {
24302
24319
  };
24303
24320
  }
24304
24321
  function handleIntercomError(error2) {
24322
+ if (error2 instanceof SyntaxError) {
24323
+ throw new CLIError("Invalid JSON input provided to command.", 400, "Ensure your JSON data is valid and properly escaped for the shell.");
24324
+ }
24305
24325
  if (error2 instanceof IntercomError) {
24306
24326
  let hint;
24307
24327
  if (error2.statusCode === 401) {
@@ -25093,6 +25113,29 @@ async function cmdContactAttachCompany(options) {
25093
25113
  handleIntercomError(error2);
25094
25114
  }
25095
25115
  }
25116
+ // src/commands/replyPayload.ts
25117
+ function validateReplyType(value, source) {
25118
+ if (value !== "comment" && value !== "note") {
25119
+ throw new CLIError(`Invalid ${source} value for message type: ${String(value)}`, 400, "Use comment or note.");
25120
+ }
25121
+ return value;
25122
+ }
25123
+ function buildAdminReplyPayload(input) {
25124
+ const parsed = input.json ? JSON.parse(input.json) : {};
25125
+ if (parsed === null || Array.isArray(parsed) || typeof parsed !== "object") {
25126
+ throw new CLIError("Invalid --json value. Expected a JSON object.", 400);
25127
+ }
25128
+ const messageTypeFromJson = Object.hasOwn(parsed, "message_type") && parsed.message_type !== undefined ? validateReplyType(parsed.message_type, "--json") : undefined;
25129
+ const messageType = input.messageType ? validateReplyType(input.messageType, "--type") : messageTypeFromJson ?? "comment";
25130
+ return {
25131
+ ...parsed,
25132
+ message_type: messageType,
25133
+ type: "admin",
25134
+ admin_id: input.adminId,
25135
+ body: input.body
25136
+ };
25137
+ }
25138
+
25096
25139
  // src/commands/conversations.ts
25097
25140
  async function requireToken4(configDir) {
25098
25141
  const token = await getTokenAsync(configDir);
@@ -25224,12 +25267,12 @@ async function cmdConversationReply(options) {
25224
25267
  const client35 = createClient({ token, dryRun: options.dryRun });
25225
25268
  const result = await client35.conversations.reply({
25226
25269
  conversation_id: options.id,
25227
- body: {
25228
- message_type: "comment",
25229
- type: "admin",
25230
- admin_id: options.adminId,
25231
- body: options.body
25232
- }
25270
+ body: buildAdminReplyPayload({
25271
+ adminId: options.adminId,
25272
+ body: options.body,
25273
+ messageType: options.messageType,
25274
+ json: options.json
25275
+ })
25233
25276
  });
25234
25277
  spinner.succeed("Reply sent");
25235
25278
  output({
@@ -25539,7 +25582,8 @@ function cmdSchema() {
25539
25582
  create_contact: 'intercom contact create --email "user@example.com" --name "John Doe"',
25540
25583
  search_contacts: 'intercom contact search --email "user@example.com"',
25541
25584
  list_conversations: "intercom conversation list --limit 10",
25542
- reply_conversation: 'intercom conversation reply <id> --admin <admin-id> --body "Thank you!"',
25585
+ reply_conversation: 'intercom conversation reply <id> --admin <admin-id> --body "Internal note" --type note',
25586
+ reply_ticket: `intercom ticket reply <id> --admin <admin-id> --body "Internal note" --json '{"message_type":"note"}'`,
25543
25587
  create_tag: 'intercom tag create "VIP Customer"',
25544
25588
  search_articles: 'intercom article search "getting started"'
25545
25589
  }
@@ -25822,15 +25866,14 @@ async function cmdTicketReply(options) {
25822
25866
  const spinner = ora("Sending reply...").start();
25823
25867
  try {
25824
25868
  const client35 = createClient({ token, dryRun: options.dryRun });
25825
- const messageType = options.messageType === "note" ? "note" : "comment";
25826
25869
  const result = await client35.tickets.reply({
25827
25870
  ticket_id: options.id,
25828
- body: {
25829
- message_type: messageType,
25830
- type: "admin",
25831
- admin_id: options.adminId,
25832
- body: options.body
25833
- }
25871
+ body: buildAdminReplyPayload({
25872
+ adminId: options.adminId,
25873
+ body: options.body,
25874
+ messageType: options.messageType,
25875
+ json: options.json
25876
+ })
25834
25877
  });
25835
25878
  spinner.succeed("Reply sent");
25836
25879
  output({
@@ -26227,13 +26270,17 @@ function registerCommands(program2, ctx) {
26227
26270
  { flags: "--admin <id>", description: "Admin ID sending the reply" },
26228
26271
  { flags: "--body <body>", description: "Reply message body" }
26229
26272
  ],
26230
- options: [{ flags: "--json <json>", description: "Additional reply data as JSON" }],
26273
+ options: [
26274
+ { flags: "--type <type>", description: "Message type (comment, note)" },
26275
+ { flags: "--json <json>", description: "Additional reply data as JSON" }
26276
+ ],
26231
26277
  action: async ({ globals, args, options }) => {
26232
26278
  await cmdConversationReply({
26233
26279
  ...globals,
26234
26280
  id: String(args[0]),
26235
26281
  adminId: options.admin,
26236
26282
  body: options.body,
26283
+ messageType: options.type,
26237
26284
  json: options.json
26238
26285
  });
26239
26286
  }
@@ -26609,14 +26656,18 @@ function registerCommands(program2, ctx) {
26609
26656
  { flags: "--admin <id>", description: "Admin ID sending the reply" },
26610
26657
  { flags: "--body <body>", description: "Reply message body" }
26611
26658
  ],
26612
- options: [{ flags: "--type <type>", description: "Message type (comment, note)", defaultValue: "comment" }],
26659
+ options: [
26660
+ { flags: "--type <type>", description: "Message type (comment, note)" },
26661
+ { flags: "--json <json>", description: "Additional reply data as JSON" }
26662
+ ],
26613
26663
  action: async ({ globals, args, options }) => {
26614
26664
  await cmdTicketReply({
26615
26665
  ...globals,
26616
26666
  id: String(args[0]),
26617
26667
  adminId: options.admin,
26618
26668
  body: options.body,
26619
- messageType: options.type
26669
+ messageType: options.type,
26670
+ json: options.json
26620
26671
  });
26621
26672
  }
26622
26673
  },