@connectedxm/admin 6.31.1 → 6.32.0

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
@@ -17268,6 +17268,38 @@ var useGetPayment = (paymentId = "", options = {}) => {
17268
17268
  );
17269
17269
  };
17270
17270
 
17271
+ // src/queries/organization/payment/useGetPaymentTaxMetadata.ts
17272
+ var PAYMENT_TAX_METADATA_QUERY_KEY = (paymentId) => [
17273
+ ...PAYMENT_QUERY_KEY(paymentId),
17274
+ "TAX_METADATA"
17275
+ ];
17276
+ var SET_PAYMENT_TAX_METADATA_QUERY_DATA = (client, keyParams, response) => {
17277
+ client.setQueryData(PAYMENT_TAX_METADATA_QUERY_KEY(...keyParams), response);
17278
+ };
17279
+ var GetPaymentTaxMetadata = async ({
17280
+ paymentId,
17281
+ adminApiParams
17282
+ }) => {
17283
+ const adminApi = await GetAdminAPI(adminApiParams);
17284
+ const { data } = await adminApi.get(
17285
+ `/payments/${paymentId}/tax-metadata`
17286
+ );
17287
+ return data;
17288
+ };
17289
+ var useGetPaymentTaxMetadata = (paymentId = "", options = {}) => {
17290
+ return useConnectedSingleQuery(
17291
+ PAYMENT_TAX_METADATA_QUERY_KEY(paymentId),
17292
+ (params) => GetPaymentTaxMetadata({
17293
+ paymentId,
17294
+ ...params
17295
+ }),
17296
+ {
17297
+ ...options,
17298
+ enabled: !!paymentId && (options.enabled ?? true)
17299
+ }
17300
+ );
17301
+ };
17302
+
17271
17303
  // src/queries/organization/sideEffects/useGetOrganizationSideEffects.ts
17272
17304
  var ORGANIZATION_SIDE_EFFECTS_QUERY_KEY = (triggerType, triggerId) => {
17273
17305
  const keys = [...ORGANIZATION_QUERY_KEY(), "SIDE_EFFECTS"];
@@ -41108,6 +41140,7 @@ export {
41108
41140
  GetOrganizationWebhook,
41109
41141
  GetOrganizationWebhooks,
41110
41142
  GetPayment,
41143
+ GetPaymentTaxMetadata,
41111
41144
  GetPayments,
41112
41145
  GetPreferences,
41113
41146
  GetPreset,
@@ -41322,6 +41355,7 @@ export {
41322
41355
  OrganizationTriggerType,
41323
41356
  PAYMENTS_QUERY_KEY,
41324
41357
  PAYMENT_QUERY_KEY,
41358
+ PAYMENT_TAX_METADATA_QUERY_KEY,
41325
41359
  PREFERENCES_QUERY_KEY,
41326
41360
  PRESETS_QUERY_KEY,
41327
41361
  PRESET_QUERY_KEY,
@@ -41877,6 +41911,7 @@ export {
41877
41911
  SET_PASS_TYPE_COUPONS_QUERY_DATA,
41878
41912
  SET_PAYMENTS_QUERY_DATA,
41879
41913
  SET_PAYMENT_QUERY_DATA,
41914
+ SET_PAYMENT_TAX_METADATA_QUERY_DATA,
41880
41915
  SET_PREFERENCES_QUERY_DATA,
41881
41916
  SET_PRESETS_QUERY_DATA,
41882
41917
  SET_PRESET_QUERY_DATA,
@@ -43076,6 +43111,7 @@ export {
43076
43111
  useGetOrganizationWebhook,
43077
43112
  useGetOrganizationWebhooks,
43078
43113
  useGetPayment,
43114
+ useGetPaymentTaxMetadata,
43079
43115
  useGetPayments,
43080
43116
  useGetPreferences,
43081
43117
  useGetPreset,
package/openapi.json CHANGED
@@ -76424,6 +76424,62 @@
76424
76424
  ]
76425
76425
  }
76426
76426
  },
76427
+ "/payments/{paymentId}/tax-metadata": {
76428
+ "get": {
76429
+ "operationId": "GetPaymentTaxMetadata",
76430
+ "summary": "Get Payment Tax Metadata",
76431
+ "description": "Get Payment Tax Metadata endpoint",
76432
+ "parameters": [
76433
+ {
76434
+ "in": "path",
76435
+ "name": "paymentId",
76436
+ "schema": {
76437
+ "type": "string"
76438
+ },
76439
+ "description": "The payment identifier",
76440
+ "required": true
76441
+ }
76442
+ ],
76443
+ "responses": {
76444
+ "200": {
76445
+ "description": "Successful response",
76446
+ "content": {
76447
+ "application/json": {
76448
+ "schema": {
76449
+ "type": "object",
76450
+ "properties": {
76451
+ "status": {
76452
+ "type": "string",
76453
+ "enum": [
76454
+ "ok"
76455
+ ]
76456
+ },
76457
+ "message": {
76458
+ "type": "string",
76459
+ "example": "Success message."
76460
+ },
76461
+ "data": {
76462
+ "type": "object",
76463
+ "additionalProperties": {
76464
+ "type": "object"
76465
+ }
76466
+ }
76467
+ },
76468
+ "required": [
76469
+ "status",
76470
+ "message",
76471
+ "data"
76472
+ ]
76473
+ }
76474
+ }
76475
+ }
76476
+ }
76477
+ },
76478
+ "tags": [
76479
+ "Organization::Payments"
76480
+ ]
76481
+ }
76482
+ },
76427
76483
  "/preferences": {
76428
76484
  "get": {
76429
76485
  "operationId": "GetPreferences",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectedxm/admin",
3
- "version": "6.31.1",
3
+ "version": "6.32.0",
4
4
  "description": "Admin API javascript SDK",
5
5
  "author": "ConnectedXM Inc.",
6
6
  "type": "module",
@@ -1,220 +0,0 @@
1
- ---
2
- name: ship-to-staging
3
- description: Open a feature PR from the current branch into `staging` in this repo. Handles the full flow — detects the current branch, gathers commits, extracts the Linear ticket reference from the branch name and commit messages, drafts a title and body that match the repo's PR template, picks reviewers, pushes the branch if needed, and (after the user confirms) creates the PR with `gh pr create`. Use this whenever the user says anything along the lines of "open a PR to staging", "ship this branch", "PR this feature", "submit this", "merge this into staging", "open a feature PR", "create the staging PR for this", or any variant of opening a PR from a feature branch into staging. Prefer this skill over running `gh pr create` directly — the manual flow misses Linear references and reviewer conventions.
4
- ---
5
-
6
- # Feature → Staging PR
7
-
8
- Use this when the user wants to open a PR from a feature branch into `staging` in the `connectedxm/admin-sdk` repo (npm package `@connectedxm/admin`). Typical case: one Linear ticket per branch, branch named like `ENG-1804` or `feat/eng-1234-cool-thing`.
9
-
10
- For the staging→main release flow, use `ship-to-prod` instead. (Production is `main` in this repo, not `prod`.)
11
-
12
- ## What you're producing
13
-
14
- A PR (after confirmation) with:
15
-
16
- 1. **Base/head**: base `staging`, head is the current feature branch — never `staging` or `main`
17
- 2. **Title** that reflects the work in the diff (usually the dominant commit's conventional-commit subject)
18
- 3. **Body** matching `.github/pull_request_template.md`, with the Linear ref harvested from the branch name and commit messages
19
- 4. **Reviewers** drawn from the repo's collaborators (excluding the PR author)
20
-
21
- The user has asked to **always confirm before creating** the PR. Show the draft, wait for the go-ahead, then push (if needed) and call `gh pr create`.
22
-
23
- ## Workflow
24
-
25
- ### 1. Identify the branch and check there's something to ship
26
-
27
- ```bash
28
- git rev-parse --abbrev-ref HEAD
29
- git fetch origin staging
30
- ```
31
-
32
- If the current branch is `staging` or `main`, stop and tell the user — they probably wanted `ship-to-prod`, or they need to check out the feature branch first.
33
-
34
- ```bash
35
- git log --oneline origin/staging..HEAD
36
- ```
37
-
38
- If the log is empty, tell the user the current branch has nothing ahead of `staging` — there's no PR to open. Stop.
39
-
40
- If the branch already has an open PR against staging, mention it (`gh pr list --head <branch> --base staging --state open`) and ask whether to add commits to that one or close it first. Don't open a duplicate.
41
-
42
- ### 2. Check push state
43
-
44
- ```bash
45
- git rev-parse --verify --quiet "origin/<branch>" && \
46
- git log --oneline "origin/<branch>..HEAD" || echo "branch not on origin"
47
- ```
48
-
49
- Three possible states — note which applies:
50
-
51
- - **Branch not on origin** — needs `git push -u origin <branch>` before `gh pr create` will work.
52
- - **Local commits ahead of `origin/<branch>`** — needs `git push` so the PR includes them.
53
- - **Up to date** — nothing to push.
54
-
55
- Don't push yet. Bundle the push with the PR-create step after the user confirms the draft (step 8).
56
-
57
- ### 3. Gather the commits
58
-
59
- ```bash
60
- git log origin/staging..HEAD --pretty=format:'%H%x09%s%x09%b%x1e'
61
- ```
62
-
63
- The `%x1e` (ASCII record separator) lets you split multi-line commit bodies cleanly. You want the subject AND the body — Linear refs like `closes ENG-1901` typically live in the body.
64
-
65
- Skip merge commits (`Merge branch 'staging'`, `Merge pull request #...`) — they're noise on a feature branch.
66
-
67
- Feature branches generally don't have squashed sub-PRs (they ARE the sub-PR), so you can skip the sub-PR resolution step that `ship-to-prod` uses.
68
-
69
- ### 4. Extract the Linear ticket reference
70
-
71
- Linear refs in this repo look like `[A-Z]{2,5}-\d+` — the dominant prefix is `ENG`. The PR template still shows `closes CXM-…` as a placeholder, but recent merged PRs and the `linear-check.yml` workflow both expect `ENG-\d+`. `CXM` and other prefixes appear occasionally; preserve whatever the source actually used. Note that branches in this repo are often named just by ticket ID (e.g. `ENG-1804`). Look in this order:
72
-
73
- 1. **Branch name** — `ENG-1804`, `fix/eng-1886-deletion`, or `feat/cxm-1234-cool-thing` → extract `ENG-1804` / `ENG-1886` / `CXM-1234`. Pattern: `([a-zA-Z]{2,5}-\d+)` (case-insensitive — uppercase it).
74
- 2. **Commit subjects and bodies** — `closes ENG-1886`, `ref CXM-1234`, or bare ticket IDs.
75
-
76
- For the verb:
77
-
78
- - If a commit explicitly used `closes ENG-XXXX` or `ref ENG-XXXX`, preserve that verb.
79
- - If the ref came only from the branch name, default to `closes` — a feature PR is the canonical place to close its ticket.
80
- - When in real doubt, `ref` is safer (doesn't change ticket state on merge).
81
-
82
- Dedupe. The common case is a single ticket; if you find more than one, list each on its own line.
83
-
84
- If you find zero refs, ask the user before proceeding — feature branches almost always have a ticket, and a missing ref usually means the branch was named differently than usual or the ticket was forgotten. Don't fabricate one.
85
-
86
- Note: `linear-check.yml` only runs on PRs targeting `main`, so a missing Linear ref won't block a staging PR from opening. Still ask — the ref needs to land somewhere on the branch before the staging→main release PR is opened.
87
-
88
- ### 5. Pick reviewers
89
-
90
- Same logic as `ship-to-prod` — there's no CODEOWNERS file:
91
-
92
- ```bash
93
- gh api repos/connectedxm/admin-sdk/collaborators \
94
- --jq '[.[] | select(.permissions.push == true) | .login]'
95
- gh api user --jq '.login' # exclude self
96
- ```
97
-
98
- Use the unfiltered `collaborators` endpoint (NOT `?affiliation=direct`, which excludes org admins like `swiftoO`). Filter by `permissions.push == true`, drop the author.
99
-
100
- Default to requesting all of them. If the user said something specific in their prompt ("just Tyler", "skip Spencer"), honor that. If only one candidate remains, just use them.
101
-
102
- ### 6. Write the title
103
-
104
- For a feature branch, the title is usually obvious — copy the dominant commit's conventional-commit subject. Examples that work well:
105
-
106
- - `feat(accounts): expose tier and tags on account responses`
107
- - `fix(events/passes): preserve query key when search arg changes`
108
- - `chore(ci): gate auto-approve on AUTO_APPROVE_USERS allowlist`
109
-
110
- If the branch has many small commits with no clear headline, fall back to a noun phrase that captures the change (`Image upload on activation`, `Activity hook cleanup`). Keep it under ~70 characters.
111
-
112
- Don't include the Linear ticket in the title — it goes in the body.
113
-
114
- ### 7. Write the body
115
-
116
- Use this exact template — it matches `.github/pull_request_template.md`:
117
-
118
- ```markdown
119
- ### Description
120
-
121
- <2-4 sentence summary of what's shipping and why. Pull from the dominant commit body where it's well-written; otherwise synthesize from the diff. Lead with the SDK-visible behavior change (new hook, new field on a response/params type, new query key, etc.), then root cause / approach if relevant.>
122
-
123
- ### Linear Issues
124
-
125
- - closes ENG-1886
126
- <one line per ticket; preserve the verb from the source (or default to `closes` for branch-only refs)>
127
-
128
- ### Testing
129
-
130
- <Generated testing plan — see "Writing the testing plan" below. Do NOT use the template's default `I have manually tested the changes / New integration tests have been added` checkboxes; replace them with concrete steps grounded in the actual diff.>
131
-
132
- ### Semantic Versioning
133
-
134
- Indicate the appropriate version bump for this PR:
135
-
136
- - [ ] Breaking changes - Major version bump
137
- - [ ] New features / improvements - Minor version bump
138
- - [ ] Bug fixes - Patch version bump
139
- ```
140
-
141
- **The Semantic Versioning section.** Keep this section in the body — the staging→main release PR re-uses the bumped version. Tick the box that matches the diff:
142
-
143
- - New required fields, removed/renamed exports, changed function signatures → **major**.
144
- - New optional fields on response/params interfaces, new hooks/queries/mutations, new WS event handlers → **minor**.
145
- - Bug fixes, internal refactors, validation tightening that doesn't break callers → **patch**.
146
-
147
- If the user has already bumped `package.json` on this branch, that decides it — match the box to the bump that's actually in the diff. The version itself is enforced on the staging→main PR by `version-check.yml`, not here.
148
-
149
- **Writing the testing plan.** A feature PR's testing plan is tighter than a release's — usually 2–5 specific items. Walk the file diff (`git diff --name-only origin/staging..HEAD`) and turn it into concrete verification steps. This is a TypeScript SDK consumed by other apps (notably `admin-web`), so most verification happens via type-check + a smoke pass from a consumer. Note: this repo also generates a second SDK in `sdks/typescript/` from `openapi.json` via `npm run generate` / `npm run generate:sdks` — interface and param changes can affect what shows up there too.
150
-
151
- - **Query files** (`src/queries/<resource>/use*.ts`) → "Confirm `useGet*` returns the new field/shape; spot-check the query key and that 401/403/404/460/461 routes through the right `onNotAuthorized` / `onNotFound` / `onModuleForbidden` handler."
152
- - **Mutation files** (`src/mutations/<resource>/use*.ts`) → "Run the mutation from a consumer app and confirm the listed query keys invalidate / `SET_*_QUERY_DATA` updates as expected; on failure confirm `onMutationError` fires."
153
- - **Interface changes** (`src/interfaces.ts`) → "Run `npm run lint` and `npx tsc` (configured `noEmit`) on the SDK; then `npm pack` and install the tarball into a consumer (`admin-web`) — confirm the new fields surface in IDE completions and `tsc` is clean. If the change should appear in the generated SDK too, run `npm run generate` and spot-check `openapi.json`."
154
- - **Param/input shape changes** (`src/params.ts`) → "Confirm callers in `admin-web` still type-check against the new params; if a field became required, flag the consumer-side update needed."
155
- - **`ConnectedXMProvider` / context changes** (`src/ConnectedXMProvider.tsx`, `src/hooks/useConnectedXM.ts`) → "Mount a consumer with the updated provider and confirm `adminApiParams`, `organizationId`, `getToken`, `getExecuteAs`, and the `onNotAuthorized` / `onModuleForbidden` / `onNotFound` / `onMutationError` callbacks still wire through."
156
- - **`AdminAPI` / axios changes** (`src/AdminAPI.ts`) → "Confirm `GetAdminAPI(params)` returns an axios instance with the expected `baseURL`, `organization`, `authorization`, `api-key`, and `executeAs` headers (when set)."
157
- - **OpenAPI generator changes** (`scripts/generate.ts`, `scripts/generate-sdks.ts`) → "Run `npm run generate` and inspect `openapi.json` for the expected diff; if the SDK output is in scope, run `npm run generate:sdks` and check `sdks/typescript/`."
158
- - **Index/barrel changes** (`src/index.ts`, per-folder `index.ts`) → "If you added or moved files, run `npm run exports` to regenerate barrels (per `.cursor/rules/index-exports.mdc` — don't hand-edit). Then `npm run build` and inspect `dist/index.d.ts` to confirm the new symbols are exported."
159
- - **CI workflow changes** (`.github/workflows/`) → "Confirm `tests.yml` / `linear-check.yml` / `version-check.yml` / `publish.yml` / `approve.yml` / `generate-openapi.yml` pass on this branch."
160
- - **Local smoke** (when changes affect runtime, not just types) → "Run `npm run local` to produce a `.tgz`, install into `admin-web` (or another consumer), and walk the affected screen."
161
-
162
- Format as a markdown checklist:
163
-
164
- ```markdown
165
- ### Testing
166
-
167
- - [ ] Run `npm run lint` and `npx tsc` and confirm both pass cleanly.
168
- - [ ] `npm pack` the SDK, install the tarball into `admin-web`, and confirm the new field surfaces on `useGet<Resource>` / `useUpdate<Resource>` types in IDE completions.
169
- - [ ] On a staging consumer, exercise the affected mutation — confirm it succeeds and the cache update / `SET_*_QUERY_DATA` reflects the new fields.
170
- - [ ] Confirm `tests.yml` passes on the next push.
171
- ```
172
-
173
- If there are zero Linear references (you flagged this in step 4 and the user proceeded anyway), write `- (none)` under the Linear Issues heading rather than deleting the section.
174
-
175
- ### 8. Show the draft and wait
176
-
177
- Print the title, body, reviewer list, AND the push state from step 2 back to the user, clearly labelled. If a push is needed, state explicitly that creating the PR will push first. Ask whether to proceed, modify, or cancel. Don't run `git push` or `gh pr create` until they've said yes.
178
-
179
- The reason for confirming: the title and body are interpretive — you're summarizing the work. The user knows things you don't (whether the description undersells the change, whether the testing plan is missing a non-obvious manual step, which Semantic Versioning box is right). Five seconds of their attention up front beats editing the PR after the fact.
180
-
181
- ### 9. Push the branch (if needed) and create the PR
182
-
183
- After confirmation:
184
-
185
- ```bash
186
- # Only if step 2 said the branch needed pushing:
187
- git push -u origin <branch> # first push
188
- # OR
189
- git push # subsequent push
190
-
191
- # Then:
192
- gh pr create \
193
- --base staging \
194
- --head <branch> \
195
- --title "<title>" \
196
- --reviewer "<comma,separated,logins>" \
197
- --body "$(cat <<'EOF'
198
- <body here>
199
- EOF
200
- )"
201
- ```
202
-
203
- `gh pr create` picks up the current branch as `--head` automatically when you're on it, but pass `--head` explicitly to be safe (avoids surprises if HEAD has moved).
204
-
205
- Return the PR URL from the command output so the user can click straight to it.
206
-
207
- ## Things to watch out for
208
-
209
- - **Don't paste `<!-- CURSOR_SUMMARY -->` blocks** from anywhere into the new PR body. Auto-generated by the Cursor Bugbot reviewer — re-including them looks weird.
210
- - **Don't include the HTML comment placeholders** from the PR template (`<!-- A brief description -->`) in your output — replace them with real content.
211
- - **Keep the Semantic Versioning section.** This repo's PR template has it for a reason — the staging→main release PR re-uses the bump that landed on staging. Don't drop it from the body.
212
- - **Don't bump `package.json` automatically.** Version bumps are landed deliberately (sometimes in their own PR, sometimes alongside a feature). If the user hasn't bumped, don't do it for them — flag it in the draft and let them decide. `version-check.yml` enforces the bump on the staging→main PR, not here.
213
- - **`closes` vs `ref`**: `closes` auto-closes the Linear ticket on merge. For a feature → staging PR, `closes` is usually correct since this branch IS the work that closes the ticket. Preserve whichever the source commit used; default to `closes` only when the ref came from the branch name alone.
214
- - **Don't fabricate Linear refs.** If the branch name and commits genuinely have no ticket, ask the user — don't guess from conversation context or memory of past tickets.
215
- - **The author isn't a reviewer.** GitHub will reject `--reviewer <self>`. Always exclude `gh api user --jq '.login'` from the list.
216
- - **Don't push without confirmation.** Pushing exposes work to the team and triggers CI (`tests.yml`). Bundle it with PR creation behind the user's go-ahead.
217
-
218
- ## Why this exists
219
-
220
- Feature → staging PRs follow the same template as release PRs but with a much simpler input — a single branch, usually a single ticket. Doing it by hand consistently misses the Linear ref (especially when it lives in the branch name only), the testing plan defaults to the empty template checkboxes, the Semantic Versioning section gets dropped, and reviewers get inconsistent. Templating the body and harvesting refs from the branch name is mechanical work that's easy to get right in a script-shaped flow.