@itm-studio/partner-sdk 0.6.2 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -777,6 +777,124 @@ const { getMomentLineupByToken } = await itm.query({
777
777
  });
778
778
  ```
779
779
 
780
+ ### In-person POS orders and charges
781
+
782
+ Use `getPartnerInPersonOrdersForMoment` for itemized POS sales at a moment,
783
+ `getPartnerInPersonOrder` to retrieve one order by UID, and
784
+ `getPartnerInPersonChargesForMoment` for payment records, including older charges
785
+ that have no itemized order (`orderUid: null`). These reads require a partner
786
+ API key; agent credentials are not accepted.
787
+
788
+ The order and charge lists default to confirmed sales: `PAID` and
789
+ `PARTIALLY_REFUNDED`. Omitted or `null` `statuses` uses that default. Pass a
790
+ nonempty status list to select other states, or `statuses: []` to include every
791
+ state, including pending, failed, canceled, expired, and fully refunded records.
792
+ The single-order query can retrieve any status.
793
+
794
+ ```typescript
795
+ const page = await itm.query({
796
+ getPartnerInPersonOrdersForMoment: {
797
+ __args: { momentSlug: "test-moment", take: 50 },
798
+ orders: {
799
+ uid: true,
800
+ momentUid: true,
801
+ momentSlug: true,
802
+ status: true,
803
+ currencyCode: true,
804
+ grossAmount: true,
805
+ subtotalAmount: true,
806
+ taxAmount: true,
807
+ refundedAmount: true,
808
+ paidAt: true,
809
+ user: { uid: true, name: true, primaryEmail: true },
810
+ charge: { uid: true, orderUid: true, status: true, amount: true },
811
+ items: {
812
+ uid: true,
813
+ type: true,
814
+ category: true,
815
+ name: true,
816
+ quantity: true,
817
+ unitAmount: true,
818
+ lineAmount: true,
819
+ refundedQuantity: true,
820
+ refundableQuantity: true,
821
+ ticketTierUid: true,
822
+ merchUid: true,
823
+ contributionUid: true,
824
+ },
825
+ refunds: { uid: true, amount: true, status: true },
826
+ },
827
+ totalCount: true,
828
+ hasNextPage: true,
829
+ nextCursor: true,
830
+ },
831
+ });
832
+
833
+ const single = await itm.query({
834
+ getPartnerInPersonOrder: {
835
+ __args: { orderUid: "order-uid" },
836
+ uid: true,
837
+ status: true,
838
+ refundedAmount: true,
839
+ refunds: {
840
+ uid: true,
841
+ amount: true,
842
+ status: true,
843
+ allocations: { orderItemUid: true, quantity: true, ticketUids: true },
844
+ },
845
+ },
846
+ });
847
+
848
+ const charges = await itm.query({
849
+ getPartnerInPersonChargesForMoment: {
850
+ __args: {
851
+ momentSlug: "test-moment",
852
+ statuses: [], // explicitly include every payment state
853
+ category: "MERCH", // optional ChargeCategory filter
854
+ take: 50,
855
+ },
856
+ charges: {
857
+ uid: true,
858
+ orderUid: true,
859
+ status: true,
860
+ category: true,
861
+ amount: true,
862
+ currencyCode: true,
863
+ },
864
+ totalCount: true,
865
+ hasNextPage: true,
866
+ nextCursor: true,
867
+ },
868
+ });
869
+ ```
870
+
871
+ Both lists sort newest first with a stable tie-breaker. Pass `nextCursor` as
872
+ `cursor` with the same moment and filters to continue. The default page size is
873
+ 50, larger values are capped at 100, and nonpositive values are rejected.
874
+ `totalCount` is the count matching the filters across all pages. Unknown,
875
+ foreign-moment, or filtered-out cursors are rejected. Each page is read from a
876
+ consistent database snapshot; the complete walk is not a frozen export.
877
+
878
+ Amounts are integer currency minor units: 1500 means USD 15.00 or JPY 1500.
879
+ `grossAmount` includes tax; `refundedAmount` is the recorded order refund total.
880
+ Refund records also include their own status, so pending or failed refunds
881
+ must not be counted as successful refunds. Customer and charge details can be
882
+ null for anonymous or incomplete orders. The order's customer and the card's
883
+ billing email can differ.
884
+
885
+ `getPartnerMomentStats` also exposes `inPersonOrdersCount` and
886
+ `inPersonChargesCount` for paid or partially refunded records. Those counts
887
+ share its five-minute cache. Order-backed charges appear in both counts;
888
+ do not add them together. POS-issued tickets with a holder appear in the existing
889
+ ticket/customer queries and attendance counts. Ownerless box-office walk-up
890
+ tickets are excluded from the partner ticket/customer lists. Their online `payment` can be
891
+ null because POS payments live in the in-person charge model. Bar, merchandise,
892
+ and other POS-only purchases require these order or charge queries.
893
+
894
+ This is a read API. It does not add POS checkout, cancellation, refund, or
895
+ terminal-token mutations to the partner SDK. Deploy the backend contract before
896
+ publishing an SDK version that uses these fields.
897
+
780
898
  ### `getPartnerMomentStats`
781
899
 
782
900
  Get cached partner-facing counts for a moment owned by the authenticated partner's brand. Counts
@@ -789,6 +907,8 @@ can be up to five minutes old.
789
907
  - `waitlistCount` counts active waitlist entries.
790
908
  - `externalRsvpCount` counts external RSVPs.
791
909
  - `ticketRsvpRequestsCount` counts ticket RSVP requests.
910
+ - `inPersonOrdersCount` counts paid or partially refunded itemized POS orders.
911
+ - `inPersonChargesCount` counts paid or partially refunded POS charges, including legacy charges. It overlaps with the order count.
792
912
 
793
913
  ```typescript
794
914
  const { getPartnerMomentStats } = await itm.query({
@@ -801,6 +921,8 @@ const { getPartnerMomentStats } = await itm.query({
801
921
  waitlistCount: true,
802
922
  externalRsvpCount: true,
803
923
  ticketRsvpRequestsCount: true,
924
+ inPersonOrdersCount: true,
925
+ inPersonChargesCount: true,
804
926
  guestlist: { names: true, people: true, plusOnes: true, peopleCheckedIn: true },
805
927
  },
806
928
  });
@@ -1272,6 +1394,126 @@ amount. These are ITM prices, not Stripe minor-unit amounts.
1272
1394
  `activeMemberCount` counts ACTIVE and PAST_DUE membership rows, excluding deleted
1273
1395
  users; it is not a count of distinct people.
1274
1396
 
1397
+ #### Render a public membership grid and enroll in a selected level
1398
+
1399
+ Fetch the catalog on your server with `isActive: true` and `isPublic: true`.
1400
+ Do not expose the partner token in browser code. Use `name` as the membership
1401
+ card title, and preserve each tier's `slug` for its Join action. Continue through
1402
+ all pages; a single request does not necessarily return the entire catalog.
1403
+
1404
+ ```typescript
1405
+ import type { GetPartnerMembershipTiersInput } from "@itm-studio/partner-sdk";
1406
+
1407
+ const { getPartnerBrand: brand } = await itm.query({
1408
+ getPartnerBrand: { publicUrl: true },
1409
+ });
1410
+ let cursor: string | null = null;
1411
+ do {
1412
+ const input: GetPartnerMembershipTiersInput = {
1413
+ isActive: true, isPublic: true, take: 100, cursor,
1414
+ };
1415
+ const { getPartnerMembershipTiers: page } = await itm.query({
1416
+ getPartnerMembershipTiers: {
1417
+ __args: { input },
1418
+ membershipTiers: {
1419
+ uid: true, slug: true, name: true, description: true, benefits: true,
1420
+ coverImage: {
1421
+ url: true, mimeType: true, dimensions: { width: true, height: true },
1422
+ transforms: { original: true, small: true, medium: true, large: true },
1423
+ },
1424
+ currencyCode: true, price: true, yearlyPrice: true, oneTimePrice: true,
1425
+ passType: true, billingInterval: true, trialDays: true,
1426
+ expiryType: true, durationDays: true, fixedEndDate: true, totalUses: true,
1427
+ memberLimit: true, supplyCap: true, activeMemberCount: true,
1428
+ sortOrder: true, finePrint: true,
1429
+ payWhatYouWantMaxPrice: true, payWhatYouWantSuggestedPrice: true,
1430
+ payWhatYouWantMessage: true,
1431
+ },
1432
+ hasNextPage: true, nextCursor: true,
1433
+ },
1434
+ });
1435
+ const cards = page.membershipTiers.map(tier => ({
1436
+ ...tier,
1437
+ enrollmentUrl: new URL(
1438
+ `/passes/${encodeURIComponent(tier.slug)}/embed/modal`, brand.publicUrl,
1439
+ ).href,
1440
+ }));
1441
+ // Return cards to your frontend and append them in the received order.
1442
+ // On Join, open that card's enrollmentUrl in your enrollment iframe/modal.
1443
+ if (!page.hasNextPage) break;
1444
+ if (!page.nextCursor || page.nextCursor === cursor) {
1445
+ throw new Error("Missing or repeated membership tier cursor");
1446
+ }
1447
+ cursor = page.nextCursor;
1448
+ } while (true);
1449
+ ```
1450
+
1451
+ The selected pass is part of the URL path: use its **slug**, not its UID or
1452
+ `name`. The ITM enrollment widget loads that level's current checkout rules and
1453
+ pricing, including any eligibility requirements. A public/active listing is not
1454
+ a guarantee of checkout availability. Use `/passes/{slug}/embed/inline` for an
1455
+ inline iframe, or `/passes/{slug}` for a normal page. For the ITM button and
1456
+ parent modal event handling, copy the pass embed from Backstage's Embed page.
1457
+ Allow `payment` on the enrollment iframe.
1458
+
1459
+ `RECURRING` and `RECURRING_OR_ONE_TIME` passes use `billingInterval` to describe
1460
+ recurring choices: `MONTHLY`, `YEARLY`, or `MONTHLY_OR_YEARLY`. For the latter,
1461
+ `price` is the monthly amount and `yearlyPrice` is the annual amount. For
1462
+ `YEARLY`, `price` is the annual amount. A `ONE_TIME` pass uses `price`;
1463
+ `RECURRING_OR_ONE_TIME` also offers `oneTimePrice`. If `yearlyPrice` or
1464
+ `oneTimePrice` is null, checkout falls back to `price`; use `??` so zero-priced
1465
+ options remain free. Display `trialDays` and the
1466
+ expiry/use limits when present. Do not infer a recurring interval for a one-time
1467
+ pass. Optional contribution amounts use the same x100 display units as tier
1468
+ prices and are **added to** the base price. Artwork, fine print, and optional
1469
+ contribution settings can be null.
1470
+
1471
+ The new `coverImage`, `finePrint`, and `payWhatYouWant*` selections require the
1472
+ matching backend contract to be deployed before an SDK release selects them.
1473
+
1474
+ #### Fetch a moment's photo gallery
1475
+
1476
+ `getMomentGalleryPhotos` reads the photos attached to a moment, separate from
1477
+ `Moment.coverImage`. These are the same `MomentMedia` photos uploaded, removed,
1478
+ and reordered through Backstage's `MomentGallery` on the moment page. Pass the
1479
+ moment **UID** returned by `getPartnerMoment` or
1480
+ `getPartnerMomentsForBrand`. This is an existing public read operation; it does
1481
+ not grant gallery editing access or change visibility rules. The default page
1482
+ size is 20, capped at 50. Results follow the configured gallery order; append
1483
+ pages in the order returned rather than sorting fractional `sortOrder` strings
1484
+ with locale-aware sorting.
1485
+
1486
+ ```typescript
1487
+ let photoCursor: string | null = null;
1488
+ do {
1489
+ const photoArgs: { momentUid: string; take: number; cursor: string | null } = {
1490
+ momentUid: "moment-uid", take: 50, cursor: photoCursor,
1491
+ };
1492
+ const { getMomentGalleryPhotos: page } = await itm.query({
1493
+ getMomentGalleryPhotos: {
1494
+ __args: photoArgs,
1495
+ momentMedia: {
1496
+ uid: true, sortOrder: true,
1497
+ mediaAsset: {
1498
+ uid: true, url: true, mimeType: true,
1499
+ dimensions: { width: true, height: true },
1500
+ placeholderUrl: true, blurhash: true,
1501
+ transforms: { original: true, small: true, medium: true, large: true },
1502
+ },
1503
+ },
1504
+ totalCount: true, hasNextPage: true, nextCursor: true,
1505
+ },
1506
+ });
1507
+ // Render each entry.mediaAsset; use transforms?.medium ?? url for a thumbnail.
1508
+ // Empty galleries return momentMedia: [] and hasNextPage: false.
1509
+ if (!page.hasNextPage) break;
1510
+ if (!page.nextCursor || page.nextCursor === photoCursor) {
1511
+ throw new Error("Missing or repeated moment photo cursor");
1512
+ }
1513
+ photoCursor = page.nextCursor;
1514
+ } while (true);
1515
+ ```
1516
+
1275
1517
  #### `getPartnerMembers`: fetch brand-wide or selected tiers
1276
1518
 
1277
1519
  Each `members` row represents one membership, identified by its `uid`, with