@itm-studio/partner-sdk 0.2.5 → 0.2.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.
Files changed (2) hide show
  1. package/README.md +25 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -90,6 +90,30 @@ export function createITMClientForRequest(request: Request) {
90
90
 
91
91
  If you also send `input.compliance`, the backend keeps the values you provide and backfills missing `ipAddress` and `userAgent` from the forwarded headers when available.
92
92
 
93
+ ## Money Amounts
94
+
95
+ Partner API price values are always encoded as `amount * 100`. Divide by `100` before rendering a major-unit display amount (dollars for USD, euros for EUR, yen for JPY, etc.).
96
+
97
+ This convention also applies to zero-decimal currencies such as JPY and KRW. The rendering conversion is always `price / 100`; zero-decimal status only controls whether the formatted display shows fractional digits. For example, `2500` should be displayed as `JPY 25`, not `JPY 2,500`.
98
+
99
+ ```typescript
100
+ const ZERO_DECIMAL_CURRENCIES = new Set(['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'UGX', 'VND', 'VUV', 'XAF', 'XOF', 'XPF']);
101
+
102
+ function formatPartnerPrice(priceInCents: number, currencyCode: string) {
103
+ if (priceInCents === 0) return 'Free';
104
+
105
+ const amount = priceInCents / 100;
106
+ const maximumFractionDigits = ZERO_DECIMAL_CURRENCIES.has(currencyCode) ? 0 : 2;
107
+
108
+ return new Intl.NumberFormat('en-US', {
109
+ style: 'currency',
110
+ currency: currencyCode,
111
+ minimumFractionDigits: maximumFractionDigits,
112
+ maximumFractionDigits,
113
+ }).format(amount);
114
+ }
115
+ ```
116
+
93
117
  ## Available Queries
94
118
 
95
119
  ### `getPartnerMomentsForBrand`
@@ -960,7 +984,7 @@ const { createPartnerMoment } = await itm.mutation({
960
984
  - `IRL` — in-person event (requires `venue`)
961
985
  - `DIGITAL` — online event (no venue needed)
962
986
 
963
- **Ticket tier pricing:** `price` is in **cents** (e.g. `2500` = $25.00). Use `0` for free tiers.
987
+ **Ticket tier pricing:** `price` is in **cents** (e.g. `2500` = $25.00 for USD). Use `0` for free tiers. See [Money Amounts](#money-amounts) for display formatting, including zero-decimal currencies.
964
988
 
965
989
  ### Complete Upload + Create Moment Flow
966
990
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itm-studio/partner-sdk",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "TypeScript SDK for the ITM Partner API — typed GraphQL client with zero introspection required",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",