@itm-studio/partner-sdk 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -162,6 +162,13 @@ interface PartnerCustomer {
162
162
  tickets: Ticket[];
163
163
  __typename: 'PartnerCustomer';
164
164
  }
165
+ interface PartnerMomentStats {
166
+ ticketsCount: Scalars['Int'];
167
+ waitlistCount: Scalars['Int'];
168
+ externalRsvpCount: Scalars['Int'];
169
+ ticketRsvpRequestsCount: Scalars['Int'];
170
+ __typename: 'PartnerMomentStats';
171
+ }
165
172
  interface MomentCollectionLink {
166
173
  uid: Scalars['ID'];
167
174
  url: Scalars['String'];
@@ -260,11 +267,24 @@ interface GetBrandEchoesForUserResponse {
260
267
  nextCursor: (Scalars['String'] | null);
261
268
  __typename: 'GetBrandEchoesForUserResponse';
262
269
  }
270
+ interface BrandSubscription {
271
+ uid: Scalars['ID'];
272
+ isActive: Scalars['Boolean'];
273
+ subscribedAt: Scalars['DateTime'];
274
+ createdAt: Scalars['DateTime'];
275
+ updatedAt: Scalars['DateTime'];
276
+ __typename: 'BrandSubscription';
277
+ }
263
278
  interface Query {
264
279
  /** Get paginated moments for the brand associated with the partner token. */
265
280
  getPartnerMomentsForBrand: GetPublicMomentsResponse;
266
281
  /** Get a single moment by slug. */
267
282
  getPartnerMoment: (Moment | null);
283
+ /**
284
+ * Get cached partner-facing counts for a moment.
285
+ * Only returns stats for moments owned by the authenticated partner's brand.
286
+ */
287
+ getPartnerMomentStats: (PartnerMomentStats | null);
268
288
  /** Get paginated tickets for a moment. */
269
289
  getPartnerTicketsForMoment: GetTicketsResponse;
270
290
  /**
@@ -315,6 +335,12 @@ interface MediaAsset {
315
335
  updatedAt: Scalars['DateTime'];
316
336
  __typename: 'MediaAsset';
317
337
  }
338
+ interface CreatePartnerBrandSubscriptionResponse {
339
+ subscription: (BrandSubscription | null);
340
+ verificationRequired: Scalars['Boolean'];
341
+ verificationToken: (Scalars['String'] | null);
342
+ __typename: 'CreatePartnerBrandSubscriptionResponse';
343
+ }
318
344
  interface Mutation {
319
345
  /**
320
346
  * Get a presigned S3 URL for direct file upload.
@@ -326,11 +352,18 @@ interface Mutation {
326
352
  * Call after uploading to S3 via the presigned URL from getPartnerUploadUrl.
327
353
  */
328
354
  createPartnerMediaAsset: MediaAsset;
355
+ /**
356
+ * Subscribe a user to the authenticated partner brand.
357
+ * Set requireOtpVerification to true to start a two-step OTP flow.
358
+ */
359
+ createPartnerBrandSubscription: CreatePartnerBrandSubscriptionResponse;
329
360
  /**
330
361
  * Create a moment with optional venue and ticket tiers in one atomic operation.
331
362
  * When type is IRL, the venue field is required.
332
363
  */
333
364
  createPartnerMoment: Moment;
365
+ /** Complete a partner brand subscription that was created with requireOtpVerification=true. */
366
+ verifyPartnerBrandSubscription: BrandSubscription;
334
367
  __typename: 'Mutation';
335
368
  }
336
369
  interface CurrencyGenqlSelection {
@@ -484,6 +517,14 @@ interface PartnerCustomerGenqlSelection {
484
517
  __typename?: boolean | number;
485
518
  __scalar?: boolean | number;
486
519
  }
520
+ interface PartnerMomentStatsGenqlSelection {
521
+ ticketsCount?: boolean | number;
522
+ waitlistCount?: boolean | number;
523
+ externalRsvpCount?: boolean | number;
524
+ ticketRsvpRequestsCount?: boolean | number;
525
+ __typename?: boolean | number;
526
+ __scalar?: boolean | number;
527
+ }
487
528
  interface MomentCollectionLinkGenqlSelection {
488
529
  uid?: boolean | number;
489
530
  url?: boolean | number;
@@ -595,6 +636,15 @@ interface GetBrandEchoesForUserResponseGenqlSelection {
595
636
  __typename?: boolean | number;
596
637
  __scalar?: boolean | number;
597
638
  }
639
+ interface BrandSubscriptionGenqlSelection {
640
+ uid?: boolean | number;
641
+ isActive?: boolean | number;
642
+ subscribedAt?: boolean | number;
643
+ createdAt?: boolean | number;
644
+ updatedAt?: boolean | number;
645
+ __typename?: boolean | number;
646
+ __scalar?: boolean | number;
647
+ }
598
648
  interface QueryGenqlSelection {
599
649
  /** Get paginated moments for the brand associated with the partner token. */
600
650
  getPartnerMomentsForBrand?: (GetPublicMomentsResponseGenqlSelection & {
@@ -613,6 +663,15 @@ interface QueryGenqlSelection {
613
663
  slug: Scalars['String'];
614
664
  };
615
665
  });
666
+ /**
667
+ * Get cached partner-facing counts for a moment.
668
+ * Only returns stats for moments owned by the authenticated partner's brand.
669
+ */
670
+ getPartnerMomentStats?: (PartnerMomentStatsGenqlSelection & {
671
+ __args: {
672
+ momentSlug: Scalars['String'];
673
+ };
674
+ });
616
675
  /** Get paginated tickets for a moment. */
617
676
  getPartnerTicketsForMoment?: (GetTicketsResponseGenqlSelection & {
618
677
  __args: {
@@ -713,6 +772,44 @@ interface CreatePartnerMomentInput {
713
772
  /** Ticket tiers to create along with the moment. */
714
773
  ticketTiers?: (CreatePartnerTicketTierInput[] | null);
715
774
  }
775
+ interface SubscriptionComplianceInput {
776
+ browserName?: (Scalars['String'] | null);
777
+ browserVersion?: (Scalars['String'] | null);
778
+ deviceType?: (Scalars['String'] | null);
779
+ geoAccuracy?: (Scalars['Float'] | null);
780
+ geoCity?: (Scalars['String'] | null);
781
+ geoCountry?: (Scalars['String'] | null);
782
+ geoLatitude?: (Scalars['Float'] | null);
783
+ geoLongitude?: (Scalars['Float'] | null);
784
+ geoRegion?: (Scalars['String'] | null);
785
+ ipAddress?: (Scalars['String'] | null);
786
+ language?: (Scalars['String'] | null);
787
+ osName?: (Scalars['String'] | null);
788
+ osVersion?: (Scalars['String'] | null);
789
+ pageUrl?: (Scalars['String'] | null);
790
+ referrerUrl?: (Scalars['String'] | null);
791
+ screenHeight?: (Scalars['Int'] | null);
792
+ screenWidth?: (Scalars['Int'] | null);
793
+ submissionMethod?: (Scalars['String'] | null);
794
+ submittedAt?: (Scalars['DateTime'] | null);
795
+ timezone?: (Scalars['String'] | null);
796
+ userAgent?: (Scalars['String'] | null);
797
+ }
798
+ interface CreatePartnerBrandSubscriptionInput {
799
+ compliance?: (SubscriptionComplianceInput | null);
800
+ email?: (Scalars['String'] | null);
801
+ /** Optional full name. If provided, include first and last name. */
802
+ fullName?: (Scalars['String'] | null);
803
+ /** Optional brand list names to attach the subscribed user to. Missing lists are created automatically. */
804
+ listNames?: (Scalars['String'][] | null);
805
+ /** E.164 phone number (for example +14155551234) */
806
+ phoneNumber: Scalars['String'];
807
+ requireOtpVerification?: (Scalars['Boolean'] | null);
808
+ }
809
+ interface VerifyPartnerBrandSubscriptionInput {
810
+ code: Scalars['String'];
811
+ verificationToken: Scalars['String'];
812
+ }
716
813
  /**
717
814
  * A presigned S3 upload URL and the generated filename.
718
815
  * Returned by getPartnerUploadUrl.
@@ -745,6 +842,13 @@ interface MediaAssetGenqlSelection {
745
842
  __typename?: boolean | number;
746
843
  __scalar?: boolean | number;
747
844
  }
845
+ interface CreatePartnerBrandSubscriptionResponseGenqlSelection {
846
+ subscription?: BrandSubscriptionGenqlSelection;
847
+ verificationRequired?: boolean | number;
848
+ verificationToken?: boolean | number;
849
+ __typename?: boolean | number;
850
+ __scalar?: boolean | number;
851
+ }
748
852
  interface MutationGenqlSelection {
749
853
  /**
750
854
  * Get a presigned S3 URL for direct file upload.
@@ -767,6 +871,15 @@ interface MutationGenqlSelection {
767
871
  dimensions: DimensionsInput;
768
872
  };
769
873
  });
874
+ /**
875
+ * Subscribe a user to the authenticated partner brand.
876
+ * Set requireOtpVerification to true to start a two-step OTP flow.
877
+ */
878
+ createPartnerBrandSubscription?: (CreatePartnerBrandSubscriptionResponseGenqlSelection & {
879
+ __args: {
880
+ input: CreatePartnerBrandSubscriptionInput;
881
+ };
882
+ });
770
883
  /**
771
884
  * Create a moment with optional venue and ticket tiers in one atomic operation.
772
885
  * When type is IRL, the venue field is required.
@@ -776,6 +889,12 @@ interface MutationGenqlSelection {
776
889
  input: CreatePartnerMomentInput;
777
890
  };
778
891
  });
892
+ /** Complete a partner brand subscription that was created with requireOtpVerification=true. */
893
+ verifyPartnerBrandSubscription?: (BrandSubscriptionGenqlSelection & {
894
+ __args: {
895
+ input: VerifyPartnerBrandSubscriptionInput;
896
+ };
897
+ });
779
898
  __typename?: boolean | number;
780
899
  __scalar?: boolean | number;
781
900
  }
@@ -838,6 +957,9 @@ declare const generateMutationOp: (fields: MutationGenqlSelection & {
838
957
  * Default ITM backend production API endpoint.
839
958
  */
840
959
  declare const DEFAULT_API_URL = "https://itm-backend-production.up.railway.app/graphql";
960
+ type MaybePromise<T> = T | Promise<T>;
961
+ type ITMPartnerHeadersObject = Record<string, string>;
962
+ type ITMPartnerHeaders = ITMPartnerHeadersObject | (() => MaybePromise<ITMPartnerHeadersObject | undefined>);
841
963
  interface ITMPartnerClientConfig {
842
964
  /**
843
965
  * Partner API token (from backstage: Settings > Partner API).
@@ -851,8 +973,10 @@ interface ITMPartnerClientConfig {
851
973
  baseUrl?: string;
852
974
  /**
853
975
  * Additional headers to include on every request.
976
+ * A function is useful for request-scoped values like `x-forwarded-for`
977
+ * and `user-agent` when proxying end-user traffic through your server.
854
978
  */
855
- headers?: Record<string, string>;
979
+ headers?: ITMPartnerHeaders;
856
980
  }
857
981
  type ITMPartnerClient = Client;
858
982
  /**
@@ -885,4 +1009,4 @@ type ITMPartnerClient = Client;
885
1009
  */
886
1010
  declare function createITMPartnerClient(config: ITMPartnerClientConfig): ITMPartnerClient;
887
1011
 
888
- export { type CreatePartnerMomentInput, type CreatePartnerTicketTierInput, type Currency, DEFAULT_API_URL, type Dimensions, type DimensionsInput, type Echo, type EchoMediaAsset, type EchoType, type GetBrandEchoesForUserResponse, type GetPartnerCustomersResponse, type GetPublicMomentsResponse, type GetTicketsResponse, type ITMPartnerClient, type ITMPartnerClientConfig, type MediaAsset, type MediaAssetUploadUrl, type MerchPurchase, type Moment, type MomentCategory, type MomentCollection, type MomentCollectionLink, type MomentDiscountCodeUsage, type MomentSortOrder, type MomentStatus, type MomentSubcategory, type MomentType, type Mutation, type PartnerCustomer, type Payment, type PaymentStatus, type Query, type ThirdPartyEchoType, type Ticket, type TicketExtension, type TicketExtensionStatus, type TicketTier, type User, type Venue, type VenueInput, createITMPartnerClient, everything, generateMutationOp, generateQueryOp };
1012
+ export { type BrandSubscription, type CreatePartnerBrandSubscriptionInput, type CreatePartnerBrandSubscriptionResponse, type CreatePartnerMomentInput, type CreatePartnerTicketTierInput, type Currency, DEFAULT_API_URL, type Dimensions, type DimensionsInput, type Echo, type EchoMediaAsset, type EchoType, type GetBrandEchoesForUserResponse, type GetPartnerCustomersResponse, type GetPublicMomentsResponse, type GetTicketsResponse, type ITMPartnerClient, type ITMPartnerClientConfig, type ITMPartnerHeaders, type ITMPartnerHeadersObject, type MediaAsset, type MediaAssetUploadUrl, type MerchPurchase, type Moment, type MomentCategory, type MomentCollection, type MomentCollectionLink, type MomentDiscountCodeUsage, type MomentSortOrder, type MomentStatus, type MomentSubcategory, type MomentType, type Mutation, type PartnerCustomer, type PartnerMomentStats, type Payment, type PaymentStatus, type Query, type SubscriptionComplianceInput, type ThirdPartyEchoType, type Ticket, type TicketExtension, type TicketExtensionStatus, type TicketTier, type User, type Venue, type VenueInput, type VerifyPartnerBrandSubscriptionInput, createITMPartnerClient, everything, generateMutationOp, generateQueryOp };
package/dist/index.js CHANGED
@@ -954,6 +954,23 @@ var types_default = {
954
954
  13
955
955
  ]
956
956
  },
957
+ "PartnerMomentStats": {
958
+ "ticketsCount": [
959
+ 18
960
+ ],
961
+ "waitlistCount": [
962
+ 18
963
+ ],
964
+ "externalRsvpCount": [
965
+ 18
966
+ ],
967
+ "ticketRsvpRequestsCount": [
968
+ 18
969
+ ],
970
+ "__typename": [
971
+ 13
972
+ ]
973
+ },
957
974
  "MomentCollectionLink": {
958
975
  "uid": [
959
976
  12
@@ -1003,7 +1020,7 @@ var types_default = {
1003
1020
  }
1004
1021
  ],
1005
1022
  "links": [
1006
- 28
1023
+ 29
1007
1024
  ],
1008
1025
  "createdAt": [
1009
1026
  0
@@ -1037,7 +1054,7 @@ var types_default = {
1037
1054
  13
1038
1055
  ],
1039
1056
  "dimensions": [
1040
- 30
1057
+ 31
1041
1058
  ],
1042
1059
  "size": [
1043
1060
  18
@@ -1096,10 +1113,10 @@ var types_default = {
1096
1113
  1
1097
1114
  ],
1098
1115
  "mediaAsset": [
1099
- 31
1116
+ 32
1100
1117
  ],
1101
1118
  "echoMedia": [
1102
- 31
1119
+ 32
1103
1120
  ],
1104
1121
  "moment": [
1105
1122
  16
@@ -1167,7 +1184,7 @@ var types_default = {
1167
1184
  },
1168
1185
  "GetBrandEchoesForUserResponse": {
1169
1186
  "echoes": [
1170
- 32
1187
+ 33
1171
1188
  ],
1172
1189
  "totalCount": [
1173
1190
  18
@@ -1182,9 +1199,29 @@ var types_default = {
1182
1199
  13
1183
1200
  ]
1184
1201
  },
1202
+ "BrandSubscription": {
1203
+ "uid": [
1204
+ 12
1205
+ ],
1206
+ "isActive": [
1207
+ 17
1208
+ ],
1209
+ "subscribedAt": [
1210
+ 0
1211
+ ],
1212
+ "createdAt": [
1213
+ 0
1214
+ ],
1215
+ "updatedAt": [
1216
+ 0
1217
+ ],
1218
+ "__typename": [
1219
+ 13
1220
+ ]
1221
+ },
1185
1222
  "Query": {
1186
1223
  "getPartnerMomentsForBrand": [
1187
- 33,
1224
+ 34,
1188
1225
  {
1189
1226
  "cursor": [
1190
1227
  13
@@ -1209,8 +1246,17 @@ var types_default = {
1209
1246
  ]
1210
1247
  }
1211
1248
  ],
1249
+ "getPartnerMomentStats": [
1250
+ 28,
1251
+ {
1252
+ "momentSlug": [
1253
+ 13,
1254
+ "String!"
1255
+ ]
1256
+ }
1257
+ ],
1212
1258
  "getPartnerTicketsForMoment": [
1213
- 34,
1259
+ 35,
1214
1260
  {
1215
1261
  "momentSlug": [
1216
1262
  13,
@@ -1228,7 +1274,7 @@ var types_default = {
1228
1274
  }
1229
1275
  ],
1230
1276
  "getPartnerCustomersForMoment": [
1231
- 35,
1277
+ 36,
1232
1278
  {
1233
1279
  "momentSlug": [
1234
1280
  13,
@@ -1243,7 +1289,7 @@ var types_default = {
1243
1289
  }
1244
1290
  ],
1245
1291
  "getPartnerMomentCollection": [
1246
- 29,
1292
+ 30,
1247
1293
  {
1248
1294
  "slug": [
1249
1295
  13,
@@ -1252,7 +1298,7 @@ var types_default = {
1252
1298
  }
1253
1299
  ],
1254
1300
  "getPartnerPublicEchoes": [
1255
- 36,
1301
+ 37,
1256
1302
  {
1257
1303
  "momentSlug": [
1258
1304
  13
@@ -1358,7 +1404,7 @@ var types_default = {
1358
1404
  13
1359
1405
  ],
1360
1406
  "venue": [
1361
- 39
1407
+ 41
1362
1408
  ],
1363
1409
  "isPrivate": [
1364
1410
  17
@@ -1370,7 +1416,109 @@ var types_default = {
1370
1416
  6
1371
1417
  ],
1372
1418
  "ticketTiers": [
1373
- 40
1419
+ 42
1420
+ ],
1421
+ "__typename": [
1422
+ 13
1423
+ ]
1424
+ },
1425
+ "SubscriptionComplianceInput": {
1426
+ "browserName": [
1427
+ 13
1428
+ ],
1429
+ "browserVersion": [
1430
+ 13
1431
+ ],
1432
+ "deviceType": [
1433
+ 13
1434
+ ],
1435
+ "geoAccuracy": [
1436
+ 20
1437
+ ],
1438
+ "geoCity": [
1439
+ 13
1440
+ ],
1441
+ "geoCountry": [
1442
+ 13
1443
+ ],
1444
+ "geoLatitude": [
1445
+ 20
1446
+ ],
1447
+ "geoLongitude": [
1448
+ 20
1449
+ ],
1450
+ "geoRegion": [
1451
+ 13
1452
+ ],
1453
+ "ipAddress": [
1454
+ 13
1455
+ ],
1456
+ "language": [
1457
+ 13
1458
+ ],
1459
+ "osName": [
1460
+ 13
1461
+ ],
1462
+ "osVersion": [
1463
+ 13
1464
+ ],
1465
+ "pageUrl": [
1466
+ 13
1467
+ ],
1468
+ "referrerUrl": [
1469
+ 13
1470
+ ],
1471
+ "screenHeight": [
1472
+ 18
1473
+ ],
1474
+ "screenWidth": [
1475
+ 18
1476
+ ],
1477
+ "submissionMethod": [
1478
+ 13
1479
+ ],
1480
+ "submittedAt": [
1481
+ 0
1482
+ ],
1483
+ "timezone": [
1484
+ 13
1485
+ ],
1486
+ "userAgent": [
1487
+ 13
1488
+ ],
1489
+ "__typename": [
1490
+ 13
1491
+ ]
1492
+ },
1493
+ "CreatePartnerBrandSubscriptionInput": {
1494
+ "compliance": [
1495
+ 44
1496
+ ],
1497
+ "email": [
1498
+ 13
1499
+ ],
1500
+ "fullName": [
1501
+ 13
1502
+ ],
1503
+ "listNames": [
1504
+ 13
1505
+ ],
1506
+ "phoneNumber": [
1507
+ 13
1508
+ ],
1509
+ "requireOtpVerification": [
1510
+ 17
1511
+ ],
1512
+ "__typename": [
1513
+ 13
1514
+ ]
1515
+ },
1516
+ "VerifyPartnerBrandSubscriptionInput": {
1517
+ "code": [
1518
+ 13
1519
+ ],
1520
+ "verificationToken": [
1521
+ 13
1374
1522
  ],
1375
1523
  "__typename": [
1376
1524
  13
@@ -1401,7 +1549,7 @@ var types_default = {
1401
1549
  13
1402
1550
  ],
1403
1551
  "dimensions": [
1404
- 30
1552
+ 31
1405
1553
  ],
1406
1554
  "size": [
1407
1555
  18
@@ -1422,9 +1570,23 @@ var types_default = {
1422
1570
  13
1423
1571
  ]
1424
1572
  },
1573
+ "CreatePartnerBrandSubscriptionResponse": {
1574
+ "subscription": [
1575
+ 38
1576
+ ],
1577
+ "verificationRequired": [
1578
+ 17
1579
+ ],
1580
+ "verificationToken": [
1581
+ 13
1582
+ ],
1583
+ "__typename": [
1584
+ 13
1585
+ ]
1586
+ },
1425
1587
  "Mutation": {
1426
1588
  "getPartnerUploadUrl": [
1427
- 42,
1589
+ 47,
1428
1590
  {
1429
1591
  "filename": [
1430
1592
  13,
@@ -1437,7 +1599,7 @@ var types_default = {
1437
1599
  }
1438
1600
  ],
1439
1601
  "createPartnerMediaAsset": [
1440
- 43,
1602
+ 48,
1441
1603
  {
1442
1604
  "mimetype": [
1443
1605
  13,
@@ -1448,20 +1610,38 @@ var types_default = {
1448
1610
  "String!"
1449
1611
  ],
1450
1612
  "dimensions": [
1451
- 38,
1613
+ 40,
1452
1614
  "DimensionsInput!"
1453
1615
  ]
1454
1616
  }
1455
1617
  ],
1618
+ "createPartnerBrandSubscription": [
1619
+ 49,
1620
+ {
1621
+ "input": [
1622
+ 45,
1623
+ "CreatePartnerBrandSubscriptionInput!"
1624
+ ]
1625
+ }
1626
+ ],
1456
1627
  "createPartnerMoment": [
1457
1628
  16,
1458
1629
  {
1459
1630
  "input": [
1460
- 41,
1631
+ 43,
1461
1632
  "CreatePartnerMomentInput!"
1462
1633
  ]
1463
1634
  }
1464
1635
  ],
1636
+ "verifyPartnerBrandSubscription": [
1637
+ 38,
1638
+ {
1639
+ "input": [
1640
+ 46,
1641
+ "VerifyPartnerBrandSubscriptionInput!"
1642
+ ]
1643
+ }
1644
+ ],
1465
1645
  "__typename": [
1466
1646
  13
1467
1647
  ]
@@ -1501,10 +1681,13 @@ function createITMPartnerClient(config) {
1501
1681
  }
1502
1682
  return createClient2({
1503
1683
  url: baseUrl ?? DEFAULT_API_URL,
1504
- headers: {
1505
- "x-partner-api-key": token,
1506
- "Content-Type": "application/json",
1507
- ...extraHeaders
1684
+ headers: async () => {
1685
+ const resolvedExtraHeaders = typeof extraHeaders === "function" ? await extraHeaders() : extraHeaders;
1686
+ return {
1687
+ ...resolvedExtraHeaders ?? {},
1688
+ "x-partner-api-key": token,
1689
+ "Content-Type": "application/json"
1690
+ };
1508
1691
  }
1509
1692
  });
1510
1693
  }