@itm-studio/partner-sdk 0.3.4 → 0.3.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/README.md CHANGED
@@ -515,6 +515,114 @@ The response is always scoped by the partner token; do not pass a brand ID.
515
515
  `coverImageMobile` and `musicLink` can be `null`, so handle those as optional in
516
516
  rendering code.
517
517
 
518
+ ### `getPartnerContributionPages`
519
+
520
+ Get paginated contribution (tip/donation) pages for the brand associated with
521
+ your partner token, newest first. Each page carries its hosted checkout URL
522
+ (`publicUrl`) and confirmed-money totals, so a partner site can link straight
523
+ to checkout and show progress without computing anything itself.
524
+
525
+ Like every contribution operation, this query is guarded for the brand partner
526
+ token (`BrandPartnerGuard`): call it from a `token` client. Brand Agent
527
+ `agentSession` and `agentAccess` clients are not authorized for it and fail
528
+ closed, and the brand is always derived from the token — never pass a brand ID.
529
+
530
+ Supported filters:
531
+
532
+ - `status`: `ACCEPTING`, `PAUSED`, or `ARCHIVED`; omit for all pages.
533
+ - `search`: case-insensitive match over title and slug.
534
+ - `cursor` and `take` (1–100, default 25): use `nextCursor` while `hasNextPage` is true.
535
+
536
+ ```typescript
537
+ const { getPartnerContributionPages } = await itm.query({
538
+ getPartnerContributionPages: {
539
+ __args: { status: "ACCEPTING", take: 20 },
540
+ items: {
541
+ uid: true,
542
+ slug: true,
543
+ title: true,
544
+ description: true,
545
+ publicUrl: true, // hosted checkout page on ITM
546
+ qrCodeImageUrl: true, // data URL that resolves to publicUrl
547
+ canContribute: true,
548
+ currency: { code: true, symbol: true },
549
+ suggestedAmountsCents: true,
550
+ recommendedAmountCents: true,
551
+ successfulContributionCount: true,
552
+ grossAmountCents: true,
553
+ netAmountCents: true,
554
+ },
555
+ totalCount: true,
556
+ hasNextPage: true,
557
+ nextCursor: true,
558
+ },
559
+ });
560
+ ```
561
+
562
+ `grossAmountCents`, `refundedAmountCents`, and `netAmountCents` are strings
563
+ because totals can exceed a GraphQL `Int`. `canContribute` is `false` while a
564
+ page is paused, archived, or its payout account is not verified; render the
565
+ link only when it is `true`.
566
+
567
+ ### `getPartnerContributions`
568
+
569
+ Get paginated contributions for the brand associated with your partner token,
570
+ newest first. This is the feed for a live contributor wall or rolling counter:
571
+ filter `status: "SUCCEEDED"` to list only confirmed contributors, and read
572
+ `note` for the optional message they left at checkout.
573
+
574
+ This query runs behind the same brand partner guard as
575
+ `getPartnerContributionPages`, so it requires a `token` client; Brand Agent
576
+ `agentSession` and `agentAccess` credentials are rejected. It is the
577
+ partner-facing feed only — brand-admin contribution and refund administration
578
+ operations are not part of the partner surface.
579
+
580
+ Supported filters:
581
+
582
+ - `contributionPageUid`: restrict to one page owned by the brand (a page from
583
+ another brand returns a `Contribution page not found` error).
584
+ - `status`: `SUCCEEDED`, `PENDING`, `PROCESSING`, `REVIEW_REQUIRED`, `FAILED`,
585
+ or `EXPIRED`; omit for all statuses. Only `SUCCEEDED` is confirmed money.
586
+ - `search`: case-insensitive match over donor name and email.
587
+ - `cursor` and `take` (1–100, default 25): use `nextCursor` while `hasNextPage` is true.
588
+
589
+ ```typescript
590
+ const { getPartnerContributions } = await itm.query({
591
+ getPartnerContributions: {
592
+ __args: {
593
+ contributionPageUid: page.uid,
594
+ status: "SUCCEEDED",
595
+ take: 50,
596
+ cursor: nextCursor,
597
+ },
598
+ items: {
599
+ uid: true,
600
+ donorName: true,
601
+ note: true, // null when the contributor left no note
602
+ amountCents: true,
603
+ currencyCode: true,
604
+ paidAt: true,
605
+ createdAt: true,
606
+ },
607
+ totalCount: true,
608
+ hasNextPage: true,
609
+ nextCursor: true,
610
+ },
611
+ });
612
+
613
+ // Rolling feed: items arrive newest first; totalCount is the number of
614
+ // matching contributions (not distinct donors) for the filter.
615
+ ```
616
+
617
+ Refunds do not change `status`: a fully refunded contribution stays
618
+ `SUCCEEDED` with `refundedAmountCents` equal to `amountCents`. For a public
619
+ wall or counter, also skip rows where `refundedAmountCents >= amountCents`.
620
+ `donorName` and `note` are unmoderated contributor input; escape them and apply
621
+ your own moderation before rendering publicly. `donorEmail` is available for
622
+ reconciliation but is personal data; do not render it on public surfaces.
623
+ Amounts are ITM cents (major units × 100, also for zero-decimal currencies) —
624
+ see [Money Amounts](#money-amounts).
625
+
518
626
  ### `getPartnerMoment`
519
627
 
520
628
  Get a single moment by slug.