@waffo/pancake-ts 0.3.3 → 0.4.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/CHANGELOG.md +25 -0
- package/README.md +8 -4
- package/dist/index.cjs +32 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -61
- package/dist/index.d.ts +72 -61
- package/dist/index.js +32 -15
- package/dist/index.js.map +1 -1
- package/docs/api-reference.md +19 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@ All notable changes to `@waffo/pancake-ts` will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.4.0] - 2026-04-15
|
|
8
|
+
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
|
|
11
|
+
- **`buyerEmail` no longer falls back to `buyerIdentity`** — `checkout.authenticated.create({ buyerIdentity, ... })` used to silently copy `buyerIdentity` into the outgoing `buyerEmail` when the caller omitted `buyerEmail`. It no longer does. `buyerIdentity` is for the JWT (merchant-side buyer identification) and `buyerEmail` is for pre-filling the checkout page's email input; the two fields are fully independent. Migration: if you were passing a non-email `buyerIdentity` (e.g. an internal user ID) and relying on the email input being pre-filled, pass `buyerEmail: user.email` explicitly alongside `buyerIdentity`.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **`AnonymousCheckoutParams` widened to full session params** — now accepts `buyerEmail` and `billingDetail` so merchants can pre-fill the checkout page without issuing a session token. Equivalent to `CreateCheckoutSessionParams`.
|
|
16
|
+
- **`AuthenticatedCheckoutParams` restructured** — now extends `CreateCheckoutSessionParams` with a single extra field `buyerIdentity`. Implementation uses destructure-and-forward so `buyerIdentity` can never leak into the create-session payload.
|
|
17
|
+
|
|
18
|
+
### Documentation
|
|
19
|
+
|
|
20
|
+
- **JSDoc rewrites** — `IssueSessionTokenParams.buyerIdentity`, `AuthenticatedCheckoutParams.buyerIdentity`, and both checkout wrappers now clearly state that `buyerIdentity` is JWT-only and is never rendered on the checkout page.
|
|
21
|
+
|
|
22
|
+
## [0.3.4] - 2026-04-14
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- **Store settings partial update types** — `UpdateStoreParams.webhookSettings`, `notificationSettings`, and `checkoutSettings` now use `Partial<>` types, allowing individual sub-fields to be omitted (kept unchanged) or set to `null` (cleared). Previously all sub-fields were required when passing a settings object.
|
|
27
|
+
|
|
28
|
+
### Documentation
|
|
29
|
+
|
|
30
|
+
- **`stores.update()` JSDoc** — Added partial update semantics explanation and example for clearing individual webhook URLs.
|
|
31
|
+
|
|
7
32
|
## [0.3.2] - 2026-04-10
|
|
8
33
|
|
|
9
34
|
### Fixed
|
package/README.md
CHANGED
|
@@ -80,19 +80,22 @@ Both modes support **dynamic pricing** and **trial control** at checkout time:
|
|
|
80
80
|
|
|
81
81
|
The merchant provides buyer identity — the SDK issues a session token, creates a checkout session, and returns a checkout URL with the token appended as a URL fragment. One call does everything.
|
|
82
82
|
|
|
83
|
+
`buyerIdentity` is for order attribution and trial tracking only — it is not rendered on the checkout page. To pre-fill the email field on the checkout form, pass `buyerEmail` explicitly.
|
|
84
|
+
|
|
83
85
|
```typescript
|
|
84
|
-
// Basic — buyer identity only
|
|
86
|
+
// Basic — buyer identity only (checkout page email field stays empty)
|
|
85
87
|
const result = await client.checkout.authenticated.create({
|
|
86
88
|
productId: "PROD_xxx",
|
|
87
89
|
currency: "USD",
|
|
88
|
-
buyerIdentity: "
|
|
90
|
+
buyerIdentity: "userIdInYourSystem",
|
|
89
91
|
});
|
|
90
92
|
|
|
91
93
|
// With dynamic pricing — override stored price (e.g., coupon, volume discount)
|
|
92
94
|
const result = await client.checkout.authenticated.create({
|
|
93
95
|
productId: "PROD_xxx",
|
|
94
96
|
currency: "USD",
|
|
95
|
-
buyerIdentity: "
|
|
97
|
+
buyerIdentity: "userIdInYourSystem",
|
|
98
|
+
buyerEmail: "customer@example.com",
|
|
96
99
|
priceSnapshot: { amount: "19.99", taxCategory: "digital_goods" },
|
|
97
100
|
});
|
|
98
101
|
|
|
@@ -100,7 +103,8 @@ const result = await client.checkout.authenticated.create({
|
|
|
100
103
|
const result = await client.checkout.authenticated.create({
|
|
101
104
|
productId: "PROD_xxx",
|
|
102
105
|
currency: "USD",
|
|
103
|
-
buyerIdentity: "
|
|
106
|
+
buyerIdentity: "userIdInYourSystem",
|
|
107
|
+
buyerEmail: "customer@example.com",
|
|
104
108
|
withTrial: true, // force enable trial (false = skip, omit = default rules)
|
|
105
109
|
billingDetail: { country: "US", isBusiness: false },
|
|
106
110
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -506,11 +506,20 @@ var CheckoutAnonymousResource = class {
|
|
|
506
506
|
* @returns Session ID, checkout URL, and expiration
|
|
507
507
|
*
|
|
508
508
|
* @example
|
|
509
|
+
* // Minimal — buyer fills everything on the page
|
|
509
510
|
* const result = await client.checkout.anonymous.create({
|
|
510
511
|
* productId: "PROD_xxx",
|
|
511
512
|
* currency: "USD",
|
|
512
513
|
* });
|
|
513
|
-
*
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* // Pre-fill email and billing without issuing a session token
|
|
517
|
+
* const result = await client.checkout.anonymous.create({
|
|
518
|
+
* productId: "PROD_xxx",
|
|
519
|
+
* currency: "USD",
|
|
520
|
+
* buyerEmail: "customer@example.com",
|
|
521
|
+
* billingDetail: { country: "US", isBusiness: false, postcode: "10001" },
|
|
522
|
+
* });
|
|
514
523
|
*/
|
|
515
524
|
async create(params) {
|
|
516
525
|
validateCheckoutCommon(params);
|
|
@@ -527,10 +536,12 @@ var CheckoutAuthenticatedResource = class {
|
|
|
527
536
|
* Create an authenticated checkout session.
|
|
528
537
|
*
|
|
529
538
|
* Behavior:
|
|
530
|
-
* - Issues a session token via `issue-session-token`
|
|
531
|
-
* - Creates a checkout session via `create-session`
|
|
532
|
-
* - Appends the token to the checkout URL as a URL fragment
|
|
533
|
-
*
|
|
539
|
+
* - Issues a session token via `issue-session-token` (receives `buyerIdentity` + `productId` only)
|
|
540
|
+
* - Creates a checkout session via `create-session` (receives every other field unchanged)
|
|
541
|
+
* - Appends the token to the checkout URL as a URL fragment (`#token=...`)
|
|
542
|
+
*
|
|
543
|
+
* `buyerIdentity` and `buyerEmail` are independent inputs: identity is for the JWT,
|
|
544
|
+
* email is for pre-filling the checkout page. The SDK forwards each to its own endpoint.
|
|
534
545
|
*
|
|
535
546
|
* @param params - Checkout parameters including buyer identity
|
|
536
547
|
* @returns Session details with token-appended checkout URL
|
|
@@ -539,14 +550,15 @@ var CheckoutAuthenticatedResource = class {
|
|
|
539
550
|
* const result = await client.checkout.authenticated.create({
|
|
540
551
|
* productId: "PROD_xxx",
|
|
541
552
|
* currency: "USD",
|
|
542
|
-
* buyerIdentity: "
|
|
553
|
+
* buyerIdentity: "user-123",
|
|
554
|
+
* buyerEmail: "customer@example.com",
|
|
543
555
|
* });
|
|
544
556
|
* // Redirect to result.checkoutUrl (includes #token=...)
|
|
545
557
|
*/
|
|
546
558
|
async create(params) {
|
|
547
559
|
validateCheckoutCommon(params);
|
|
548
560
|
validateRequired("buyerIdentity", params.buyerIdentity);
|
|
549
|
-
const { buyerIdentity,
|
|
561
|
+
const { buyerIdentity, ...sessionParams } = params;
|
|
550
562
|
const [tokenResult, sessionResult] = await Promise.all([
|
|
551
563
|
this.http.post(
|
|
552
564
|
"/v1/actions/auth/issue-session-token",
|
|
@@ -556,14 +568,7 @@ var CheckoutAuthenticatedResource = class {
|
|
|
556
568
|
},
|
|
557
569
|
{ idempotencyWindow: 60 }
|
|
558
570
|
),
|
|
559
|
-
this.http.post(
|
|
560
|
-
"/v1/actions/checkout/create-session",
|
|
561
|
-
{
|
|
562
|
-
...sessionFields,
|
|
563
|
-
buyerEmail: buyerEmail ?? buyerIdentity
|
|
564
|
-
},
|
|
565
|
-
{ idempotencyWindow: 60 }
|
|
566
|
-
)
|
|
571
|
+
this.http.post("/v1/actions/checkout/create-session", sessionParams, { idempotencyWindow: 60 })
|
|
567
572
|
]);
|
|
568
573
|
return {
|
|
569
574
|
sessionId: sessionResult.sessionId,
|
|
@@ -828,14 +833,26 @@ var StoresResource = class {
|
|
|
828
833
|
/**
|
|
829
834
|
* Update an existing store's settings.
|
|
830
835
|
*
|
|
836
|
+
* Settings objects (`webhookSettings`, `notificationSettings`, `checkoutSettings`)
|
|
837
|
+
* support partial updates: omitted sub-fields keep existing values, `null` clears
|
|
838
|
+
* a field. Pass the entire settings object as `null` to clear all fields.
|
|
839
|
+
*
|
|
831
840
|
* @param params - Fields to update (only provided fields are changed)
|
|
832
841
|
* @returns Updated store entity
|
|
833
842
|
*
|
|
834
843
|
* @example
|
|
844
|
+
* // Update name
|
|
835
845
|
* const { store } = await client.stores.update({
|
|
836
846
|
* id: "STO_xxx",
|
|
837
847
|
* name: "Updated Name",
|
|
838
848
|
* });
|
|
849
|
+
*
|
|
850
|
+
* @example
|
|
851
|
+
* // Clear test webhook URL while keeping other webhook settings
|
|
852
|
+
* const { store } = await client.stores.update({
|
|
853
|
+
* id: "STO_xxx",
|
|
854
|
+
* webhookSettings: { testWebhookUrl: null },
|
|
855
|
+
* });
|
|
839
856
|
*/
|
|
840
857
|
async update(params) {
|
|
841
858
|
validateShortId("id", params.id, "STO");
|