@waffo/pancake-ts 0.12.0 → 0.14.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 +18 -0
- package/README.md +14 -1
- package/dist/index.cjs +79 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +151 -37
- package/dist/index.d.ts +151 -37
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -1
- package/docs/api-reference.md +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,24 @@ 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.14.0] - 2026-07-18
|
|
8
|
+
|
|
9
|
+
Adds content-safety prompt scanning for AIGC generation.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- `client.contentSafety.scanPrompt(params)` — scan a user prompt before AIGC generation; returns a redacted verdict (`action` = allow / review / block, continue only when `allow`). Stateless (prompt text never stored); fails closed to `review` if the safety service is briefly unavailable.
|
|
14
|
+
- Types: `ScanPromptParams`, `ScanResult`; enums `ScanAction`, `ScanReasonCode`, `ScanPolicyCategory`, `ScanSemanticMode`, `ScanSemanticStatus`.
|
|
15
|
+
|
|
16
|
+
## [0.13.0] - 2026-07-17
|
|
17
|
+
|
|
18
|
+
Adds cashier language selection to checkout sessions.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **`CashierLanguage`** — exported union type of the 22 supported checkout cashier languages (IETF BCP 47, e.g. `"en"`, `"pt-BR"`, `"zh-Hant-TW"`).
|
|
23
|
+
- **`CreateCheckoutSessionParams.language`** — optional cashier language, forwarded to `create-session`. Sets the hosted checkout page's default language; the customer can still switch it on the page. Omit to let the payment provider infer.
|
|
24
|
+
|
|
7
25
|
## [0.12.0] - 2026-07-14
|
|
8
26
|
|
|
9
27
|
Renames the "buyer" persona to "customer" across the SDK's public API — "customer" is the Waffo term for the merchant's end consumer (the session-token JWT role). Old names remain available as deprecated aliases. Wire-level request and webhook field names (`buyerIdentity`, `buyerEmail`, `merchantProvidedBuyerIdentity`) are part of the server contract and are unchanged.
|
package/README.md
CHANGED
|
@@ -133,6 +133,7 @@ const result = await client.checkout.anonymous.create({
|
|
|
133
133
|
priceSnapshot: { amount: "4.99", taxCategory: "saas" },
|
|
134
134
|
withTrial: false, // skip trial for this session
|
|
135
135
|
orderMerchantExternalId: "ORDER-2026-00891", // optional, API Key auth only
|
|
136
|
+
language: "pt-BR", // optional, sets the default checkout language (IETF BCP 47)
|
|
136
137
|
});
|
|
137
138
|
|
|
138
139
|
window.open(result.checkoutUrl, "_blank", "noopener,noreferrer");
|
|
@@ -506,6 +507,17 @@ const { orderId, status } = await client.orders.cancelSubscription({
|
|
|
506
507
|
// status: "canceled" (was pending) or "canceling" (was active, PSP notified)
|
|
507
508
|
```
|
|
508
509
|
|
|
510
|
+
### Content Safety
|
|
511
|
+
|
|
512
|
+
Scan a user's prompt for content-safety compliance before AIGC generation — continue only when `action` is `allow`. Stateless (prompt text is never stored); fails closed to `review` if the safety service is briefly unavailable.
|
|
513
|
+
|
|
514
|
+
```typescript
|
|
515
|
+
const verdict = await client.contentSafety.scanPrompt({ prompt: "a cat riding a bike" });
|
|
516
|
+
if (verdict.action !== "allow") {
|
|
517
|
+
// do not generate — verdict.action is "review" or "block"
|
|
518
|
+
}
|
|
519
|
+
```
|
|
520
|
+
|
|
509
521
|
## Error Handling
|
|
510
522
|
|
|
511
523
|
API errors throw `WaffoPancakeError` with the HTTP status code and a call-stack-ordered errors array.
|
|
@@ -542,6 +554,7 @@ try {
|
|
|
542
554
|
| `client.subscriptionProducts` | `create()` `update()` `publish()` `updateStatus()` | Subscription products |
|
|
543
555
|
| `client.subscriptionProductGroups` | `create()` `update()` `delete()` `publish()` | Product groups |
|
|
544
556
|
| `client.orders` | `cancelSubscription()` | Order management |
|
|
557
|
+
| `client.contentSafety` | `scanPrompt()` | AIGC prompt content-safety scan |
|
|
545
558
|
|
|
546
559
|
## Documentation
|
|
547
560
|
|
|
@@ -584,7 +597,7 @@ try {
|
|
|
584
597
|
|
|
585
598
|
### Types
|
|
586
599
|
|
|
587
|
-
Key types: `WaffoPancakeConfig`, `AuthenticatedCheckoutParams`, `AuthenticatedCheckoutResult`, `AnonymousCheckoutParams`, `CheckoutSessionResult`, `Store`, `OnetimeProductDetail`, `SubscriptionProductDetail`, `WebhookEvent<T>`, `WebhookEventData`, `GraphQLResponse<T>`, and 30+ more. `WebhookEventData` includes rich fields organized by section: order info, amounts, product, payment, subscription, and refund (conditional by event type). See [API Reference](docs/api-reference.md#types) for the full list.
|
|
600
|
+
Key types: `WaffoPancakeConfig`, `AuthenticatedCheckoutParams`, `AuthenticatedCheckoutResult`, `AnonymousCheckoutParams`, `CheckoutSessionResult`, `CashierLanguage`, `Store`, `OnetimeProductDetail`, `SubscriptionProductDetail`, `WebhookEvent<T>`, `WebhookEventData`, `GraphQLResponse<T>`, and 30+ more. `WebhookEventData` includes rich fields organized by section: order info, amounts, product, payment, subscription, and refund (conditional by event type). See [API Reference](docs/api-reference.md#types) for the full list.
|
|
588
601
|
|
|
589
602
|
## Development
|
|
590
603
|
|
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,11 @@ __export(index_exports, {
|
|
|
30
30
|
ProductVersionStatus: () => ProductVersionStatus,
|
|
31
31
|
RefundStatus: () => RefundStatus,
|
|
32
32
|
RefundTicketStatus: () => RefundTicketStatus,
|
|
33
|
+
ScanAction: () => ScanAction,
|
|
34
|
+
ScanPolicyCategory: () => ScanPolicyCategory,
|
|
35
|
+
ScanReasonCode: () => ScanReasonCode,
|
|
36
|
+
ScanSemanticMode: () => ScanSemanticMode,
|
|
37
|
+
ScanSemanticStatus: () => ScanSemanticStatus,
|
|
33
38
|
StoreRole: () => StoreRole,
|
|
34
39
|
SubscriptionOrderStatus: () => SubscriptionOrderStatus,
|
|
35
40
|
TaxCategory: () => TaxCategory,
|
|
@@ -532,6 +537,35 @@ var CheckoutResource = class {
|
|
|
532
537
|
}
|
|
533
538
|
};
|
|
534
539
|
|
|
540
|
+
// src/resources/content-safety.ts
|
|
541
|
+
var ContentSafetyResource = class {
|
|
542
|
+
constructor(http) {
|
|
543
|
+
this.http = http;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Scan a user's text prompt for content-safety compliance before AIGC
|
|
547
|
+
* generation. Call this before invoking your image/video model and continue
|
|
548
|
+
* only when `action` is `allow`.
|
|
549
|
+
*
|
|
550
|
+
* Stateless — the check never stores prompt text. If the safety service is
|
|
551
|
+
* briefly unavailable, the verdict fails closed to `review` so an
|
|
552
|
+
* unmoderated prompt is never let through.
|
|
553
|
+
*
|
|
554
|
+
* @param params - Scan parameters (prompt required; locale / semantic optional)
|
|
555
|
+
* @returns Redacted scan verdict
|
|
556
|
+
*
|
|
557
|
+
* @example
|
|
558
|
+
* const verdict = await client.contentSafety.scanPrompt({ prompt: "a cat riding a bike" });
|
|
559
|
+
* if (verdict.action !== "allow") {
|
|
560
|
+
* // do not generate
|
|
561
|
+
* }
|
|
562
|
+
*/
|
|
563
|
+
async scanPrompt(params) {
|
|
564
|
+
validateRequired("prompt", params.prompt);
|
|
565
|
+
return unwrapAction(await this.http.post("/v1/actions/verification/scan-prompt", params));
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
|
|
535
569
|
// src/resources/customer.ts
|
|
536
570
|
var CustomerSession = class {
|
|
537
571
|
constructor(http) {
|
|
@@ -1323,6 +1357,7 @@ var WaffoPancake = class {
|
|
|
1323
1357
|
checkout;
|
|
1324
1358
|
graphql;
|
|
1325
1359
|
webhooks;
|
|
1360
|
+
contentSafety;
|
|
1326
1361
|
constructor(config) {
|
|
1327
1362
|
validateShortId("merchantId", config.merchantId, "MER");
|
|
1328
1363
|
this.config = config;
|
|
@@ -1337,6 +1372,7 @@ var WaffoPancake = class {
|
|
|
1337
1372
|
this.checkout = new CheckoutResource(this.http);
|
|
1338
1373
|
this.graphql = new GraphQLResource(this.http);
|
|
1339
1374
|
this.webhooks = new WebhooksResource(this.http, config.webhookPublicKey);
|
|
1375
|
+
this.contentSafety = new ContentSafetyResource(this.http);
|
|
1340
1376
|
}
|
|
1341
1377
|
/**
|
|
1342
1378
|
* Create a customer session for self-service operations.
|
|
@@ -1492,6 +1528,44 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
|
|
|
1492
1528
|
WebhookEventType2["RefundFailed"] = "refund.failed";
|
|
1493
1529
|
return WebhookEventType2;
|
|
1494
1530
|
})(WebhookEventType || {});
|
|
1531
|
+
var ScanAction = /* @__PURE__ */ ((ScanAction2) => {
|
|
1532
|
+
ScanAction2["Allow"] = "allow";
|
|
1533
|
+
ScanAction2["Review"] = "review";
|
|
1534
|
+
ScanAction2["Block"] = "block";
|
|
1535
|
+
return ScanAction2;
|
|
1536
|
+
})(ScanAction || {});
|
|
1537
|
+
var ScanReasonCode = /* @__PURE__ */ ((ScanReasonCode2) => {
|
|
1538
|
+
ScanReasonCode2["Allowed"] = "allowed";
|
|
1539
|
+
ScanReasonCode2["ReviewRequired"] = "review_required";
|
|
1540
|
+
ScanReasonCode2["RestrictedContent"] = "restricted_content";
|
|
1541
|
+
ScanReasonCode2["ServiceDegraded"] = "service_degraded";
|
|
1542
|
+
return ScanReasonCode2;
|
|
1543
|
+
})(ScanReasonCode || {});
|
|
1544
|
+
var ScanPolicyCategory = /* @__PURE__ */ ((ScanPolicyCategory2) => {
|
|
1545
|
+
ScanPolicyCategory2["CsamMinor"] = "csam_minor";
|
|
1546
|
+
ScanPolicyCategory2["SexualViolenceNonconsensual"] = "sexual_violence_nonconsensual";
|
|
1547
|
+
ScanPolicyCategory2["UndressTransform"] = "undress_transform";
|
|
1548
|
+
ScanPolicyCategory2["FaceSwapIdentity"] = "face_swap_identity";
|
|
1549
|
+
ScanPolicyCategory2["BestialityRestricted"] = "bestiality_restricted";
|
|
1550
|
+
ScanPolicyCategory2["AdultNsfw"] = "adult_nsfw";
|
|
1551
|
+
return ScanPolicyCategory2;
|
|
1552
|
+
})(ScanPolicyCategory || {});
|
|
1553
|
+
var ScanSemanticMode = /* @__PURE__ */ ((ScanSemanticMode2) => {
|
|
1554
|
+
ScanSemanticMode2["Off"] = "off";
|
|
1555
|
+
ScanSemanticMode2["Shadow"] = "shadow";
|
|
1556
|
+
ScanSemanticMode2["Enforce"] = "enforce";
|
|
1557
|
+
return ScanSemanticMode2;
|
|
1558
|
+
})(ScanSemanticMode || {});
|
|
1559
|
+
var ScanSemanticStatus = /* @__PURE__ */ ((ScanSemanticStatus2) => {
|
|
1560
|
+
ScanSemanticStatus2["Disabled"] = "disabled";
|
|
1561
|
+
ScanSemanticStatus2["Scored"] = "scored";
|
|
1562
|
+
ScanSemanticStatus2["ShadowScored"] = "shadow_scored";
|
|
1563
|
+
ScanSemanticStatus2["SkippedRulesBlock"] = "skipped_rules_block";
|
|
1564
|
+
ScanSemanticStatus2["SkippedBudget"] = "skipped_budget";
|
|
1565
|
+
ScanSemanticStatus2["ProviderTimeout"] = "provider_timeout";
|
|
1566
|
+
ScanSemanticStatus2["ProviderError"] = "provider_error";
|
|
1567
|
+
return ScanSemanticStatus2;
|
|
1568
|
+
})(ScanSemanticStatus || {});
|
|
1495
1569
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1496
1570
|
0 && (module.exports = {
|
|
1497
1571
|
BillingPeriod,
|
|
@@ -1504,6 +1578,11 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
|
|
|
1504
1578
|
ProductVersionStatus,
|
|
1505
1579
|
RefundStatus,
|
|
1506
1580
|
RefundTicketStatus,
|
|
1581
|
+
ScanAction,
|
|
1582
|
+
ScanPolicyCategory,
|
|
1583
|
+
ScanReasonCode,
|
|
1584
|
+
ScanSemanticMode,
|
|
1585
|
+
ScanSemanticStatus,
|
|
1507
1586
|
StoreRole,
|
|
1508
1587
|
SubscriptionOrderStatus,
|
|
1509
1588
|
TaxCategory,
|