palbase 0.73.0 → 0.74.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/README.md +1 -1
- package/dist/ai/index.js +2 -2
- package/dist/ai-sdk/index.js +2 -2
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +3 -3
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/4DNFXRTX.js +2 -0
- package/dist/chunks/{LCDNCPQW.js → 53XWB3UV.js} +1 -1
- package/dist/chunks/{J7ZNBBRN.js → 5NLCEWSD.js} +1 -1
- package/dist/chunks/{3DUDNEMM.js → 7HDSHHGM.js} +2 -2
- package/dist/chunks/{5OOA4R4H.js → AFO74GQQ.js} +1 -1
- package/dist/chunks/{P4NZ4NZD.js → AKM627JB.js} +2 -2
- package/dist/chunks/{IICQMY2Z.js → BBXGUP7G.js} +2 -2
- package/dist/chunks/{EKOEK6LR.js → CVBLXV6M.js} +2 -2
- package/dist/chunks/{YMIK6HLK.js → DFIAGTHU.js} +2 -2
- package/dist/chunks/FKDQMWI7.js +23 -0
- package/dist/chunks/{757A6AR6.js → FYZAVXD4.js} +2 -2
- package/dist/chunks/{P36C47FS.js → IIQ6QEL2.js} +1 -1
- package/dist/chunks/{25HECIZY.js → IJBBBAXY.js} +1 -1
- package/dist/chunks/{DIQMCEMJ.js → MKKBGO2H.js} +2 -2
- package/dist/chunks/OS567PDL.js +2 -0
- package/dist/chunks/{CY6KUFZW.js → PF52QMPW.js} +2 -2
- package/dist/chunks/{MVKZWEHL.js → QJPQVLNV.js} +2 -2
- package/dist/chunks/{VEL7X2G3.js → RK4CTF2F.js} +2 -2
- package/dist/chunks/{JG4V6LNY.js → SS3YF6MP.js} +2 -2
- package/dist/chunks/{PAQCJT7M.js → U5LDOZB5.js} +2 -2
- package/dist/chunks/{J7Z2PYL4.js → WNPRCDLR.js} +1 -1
- package/dist/chunks/{4XSSQAES.js → YDHRQOAN.js} +1 -1
- package/dist/chunks/{SRN7N2WX.js → YOCX3MXN.js} +2 -2
- package/dist/chunks/{PEQZDT6P.js → ZRNXABQJ.js} +2 -2
- package/dist/cli.js +162 -162
- package/dist/cloud/index.js +2 -2
- package/dist/refuse/ai-sdk.js +1 -1
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.js +1 -1
- package/dist/refuse/cloud.js +1 -1
- package/dist/refuse/server.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/testing.js +2 -2
- package/dist/web/index.js +2 -2
- package/dist/web/message.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/payments-ui.js +2 -2
- package/dist/web/paywall.js +2 -2
- package/dist/web/push-sw.js +1 -1
- package/dist/web/ssr.js +2 -2
- package/dist/web/vite.js +2 -2
- package/package.json +2 -2
- package/types/cloud/src/generated/project.d.ts +1 -1
- package/types/internal/src/modules/commerce.d.ts +2810 -533
- package/types/internal/src/modules/events.d.ts +2 -2
- package/types/server/src/commerce.d.ts +172 -3
- package/types/server/src/index.d.ts +1 -1
- package/types/web/src/commerce.d.ts +460 -20
- package/types/web/src/index.d.ts +1 -1
- package/types/web/src/session.d.ts +15 -1
- package/types/web/src/ssr.d.ts +1 -1
- package/dist/chunks/76W5ZO2L.js +0 -2
- package/dist/chunks/SMECWMF7.js +0 -2
- package/dist/chunks/UFP6GLLW.js +0 -23
|
@@ -20,11 +20,11 @@ export interface PlatformEvents extends AiEvents, AnalyticsEvents, AuthEvents, C
|
|
|
20
20
|
/** A platform event's type: one a module's contract declares. */
|
|
21
21
|
export type EventType = keyof PlatformEvents;
|
|
22
22
|
/** Every platform event's type, as the contracts declare them. */
|
|
23
|
-
export declare const EVENT_TYPES: readonly ["ai.goal.updated", "ai.mcp.auth_completed", "ai.mcp.auth_required", "ai.response.completed", "ai.response.failed", "ai.response.started", "ai.secret_host_requested", "ai.trigger.fired", "ai.voice.closed", "ai.voice.delegated", "ai.voice.started", "ai.wait.created", "ai.wait.resumed", "ai.wait.timed_out", "ai.workflow.completed", "ai.workflow.failed", "audience.entered", "audience.exited", "calls.call.ended", "calls.call.started", "calls.participant.joined", "calls.participant.left", "calls.transcript.completed", "calls.transcript.segment", "campaigns.broadcast.canceled", "campaigns.broadcast.completed", "campaigns.broadcast.started", "campaigns.onsite.clicked", "campaigns.onsite.converted", "campaigns.onsite.shown", "commerce.buybox.changed", "commerce.cart.abandoned", "commerce.cart.merged", "commerce.fulfillment.created", "commerce.fulfillment.delivered", "commerce.inventory.restocked", "commerce.listing.price_dropped", "commerce.order.created", "commerce.order.paid", "commerce.order.refunded", "commerce.product.created", "commerce.return.requested", "commerce.store.created", "commerce.store_order.canceled", "consent.changed", "device.revoked", "file.deleted", "file.moved", "file.uploaded", "flag.changed", "flag.override_changed", "iap.catalog.applied", "iap.catalog.changed", "iap.coupon.redeemed", "iap.credits.depleted", "iap.credits.low", "iap.customer.changed", "iap.customer.erased", "iap.customer.merged", "iap.entitlement.changed", "iap.offer.redeemed", "iap.ownership.transferred", "iap.paywall.published", "iap.purchase.completed", "iap.quota.exhausted", "iap.quota.threshold", "iap.refund.changed", "iap.store.changed", "iap.subscription.changed", "journey.converted", "journey.ended", "journey.entered", "journey.event", "journey.step", "messaging.conversation.created", "messaging.conversation.deleted", "messaging.conversation.read", "messaging.message.created", "messaging.report.created", "notification.action", "notification.bounced", "notification.complained", "notification.delivered", "notification.dismissed", "notification.expired", "notification.failed", "notification.not_shown", "notification.opened", "notification.push_failing", "notification.read", "notification.received", "notification.rejected", "notification.sent", "notification.shared_paused", "notification.unconfirmed", "notification.undelivered", "notification.uninstalled", "payments.dispute.closed", "payments.dispute.opened", "payments.payment.canceled", "payments.payment.failed", "payments.payment.requires_capture", "payments.payment.succeeded", "payments.refund.succeeded", "payments.split.approved", "payments.split.refunded", "payments.sub_merchant.updated", "payments.subscription.canceled", "payments.subscription.changed", "payments.wallet.balance_changed", "payments.wallet.hold_changed", "payments.wallet.vested", "promotions.rule.created", "session.ended", "stores.action.changed", "stores.app.changed", "stores.apple.changed", "stores.apple.key.made", "stores.apple.key.revoked", "stores.apple.session.changed", "stores.apple.session.ended", "stores.apple.session.expired", "stores.beta_review.changed", "stores.build.changed", "stores.delivery.changed", "stores.delivery.requested", "stores.device.changed", "stores.feedback.received", "stores.google.changed", "stores.group.changed", "stores.invitation.changed", "stores.package.changed", "stores.play_release.changed", "stores.product.changed", "stores.review.message", "stores.version.changed", "stores.version.reviewed", "stores.vitals.changed", "stores.webhook.changed", "user.converted", "user.deleted", "user.locale_changed", "user.password_changed", "user.permissions_changed", "workspace.conflict", "workspace.deleted", "workspace.published"];
|
|
23
|
+
export declare const EVENT_TYPES: readonly ["ai.goal.updated", "ai.mcp.auth_completed", "ai.mcp.auth_required", "ai.response.completed", "ai.response.failed", "ai.response.started", "ai.secret_host_requested", "ai.trigger.fired", "ai.voice.closed", "ai.voice.delegated", "ai.voice.started", "ai.wait.created", "ai.wait.resumed", "ai.wait.timed_out", "ai.workflow.completed", "ai.workflow.failed", "audience.entered", "audience.exited", "calls.call.ended", "calls.call.started", "calls.participant.joined", "calls.participant.left", "calls.transcript.completed", "calls.transcript.segment", "campaigns.broadcast.canceled", "campaigns.broadcast.completed", "campaigns.broadcast.started", "campaigns.onsite.clicked", "campaigns.onsite.converted", "campaigns.onsite.shown", "commerce.buybox.changed", "commerce.cart.abandoned", "commerce.cart.merged", "commerce.fulfillment.created", "commerce.fulfillment.delivered", "commerce.inventory.restocked", "commerce.listing.price_dropped", "commerce.order.created", "commerce.order.paid", "commerce.order.refunded", "commerce.product.created", "commerce.return.requested", "commerce.review.created", "commerce.store.created", "commerce.store_order.canceled", "consent.changed", "device.revoked", "file.deleted", "file.moved", "file.uploaded", "flag.changed", "flag.override_changed", "iap.catalog.applied", "iap.catalog.changed", "iap.coupon.redeemed", "iap.credits.depleted", "iap.credits.low", "iap.customer.changed", "iap.customer.erased", "iap.customer.merged", "iap.entitlement.changed", "iap.offer.redeemed", "iap.ownership.transferred", "iap.paywall.published", "iap.purchase.completed", "iap.quota.exhausted", "iap.quota.threshold", "iap.refund.changed", "iap.store.changed", "iap.subscription.changed", "journey.converted", "journey.ended", "journey.entered", "journey.event", "journey.step", "messaging.conversation.created", "messaging.conversation.deleted", "messaging.conversation.read", "messaging.message.created", "messaging.report.created", "notification.action", "notification.bounced", "notification.complained", "notification.delivered", "notification.dismissed", "notification.expired", "notification.failed", "notification.not_shown", "notification.opened", "notification.push_failing", "notification.read", "notification.received", "notification.rejected", "notification.sent", "notification.shared_paused", "notification.unconfirmed", "notification.undelivered", "notification.uninstalled", "payments.dispute.closed", "payments.dispute.opened", "payments.payment.canceled", "payments.payment.failed", "payments.payment.requires_capture", "payments.payment.succeeded", "payments.refund.succeeded", "payments.split.approved", "payments.split.refunded", "payments.sub_merchant.updated", "payments.subscription.canceled", "payments.subscription.changed", "payments.wallet.balance_changed", "payments.wallet.hold_changed", "payments.wallet.vested", "promotions.rule.created", "session.ended", "stores.action.changed", "stores.app.changed", "stores.apple.changed", "stores.apple.key.made", "stores.apple.key.revoked", "stores.apple.session.changed", "stores.apple.session.ended", "stores.apple.session.expired", "stores.beta_review.changed", "stores.build.changed", "stores.delivery.changed", "stores.delivery.requested", "stores.device.changed", "stores.feedback.received", "stores.google.changed", "stores.group.changed", "stores.invitation.changed", "stores.package.changed", "stores.play_release.changed", "stores.product.changed", "stores.review.message", "stores.version.changed", "stores.version.reviewed", "stores.vitals.changed", "stores.webhook.changed", "user.converted", "user.deleted", "user.locale_changed", "user.password_changed", "user.permissions_changed", "workspace.conflict", "workspace.deleted", "workspace.published"];
|
|
24
24
|
/**
|
|
25
25
|
* A platform event as delivered: one member per type the contracts declare,
|
|
26
26
|
* its data that type's payload, so a switch on its type narrows it. An
|
|
27
27
|
* event of a type none of them declares (one a newer platform sends) is no
|
|
28
28
|
* member: at run time it reaches the switch's default, which takes it.
|
|
29
29
|
*/
|
|
30
|
-
export type PalbaseEvent = WebhookEvent<PlatformEvents["ai.goal.updated"], "ai.goal.updated"> | WebhookEvent<PlatformEvents["ai.mcp.auth_completed"], "ai.mcp.auth_completed"> | WebhookEvent<PlatformEvents["ai.mcp.auth_required"], "ai.mcp.auth_required"> | WebhookEvent<PlatformEvents["ai.response.completed"], "ai.response.completed"> | WebhookEvent<PlatformEvents["ai.response.failed"], "ai.response.failed"> | WebhookEvent<PlatformEvents["ai.response.started"], "ai.response.started"> | WebhookEvent<PlatformEvents["ai.secret_host_requested"], "ai.secret_host_requested"> | WebhookEvent<PlatformEvents["ai.trigger.fired"], "ai.trigger.fired"> | WebhookEvent<PlatformEvents["ai.voice.closed"], "ai.voice.closed"> | WebhookEvent<PlatformEvents["ai.voice.delegated"], "ai.voice.delegated"> | WebhookEvent<PlatformEvents["ai.voice.started"], "ai.voice.started"> | WebhookEvent<PlatformEvents["ai.wait.created"], "ai.wait.created"> | WebhookEvent<PlatformEvents["ai.wait.resumed"], "ai.wait.resumed"> | WebhookEvent<PlatformEvents["ai.wait.timed_out"], "ai.wait.timed_out"> | WebhookEvent<PlatformEvents["ai.workflow.completed"], "ai.workflow.completed"> | WebhookEvent<PlatformEvents["ai.workflow.failed"], "ai.workflow.failed"> | WebhookEvent<PlatformEvents["audience.entered"], "audience.entered"> | WebhookEvent<PlatformEvents["audience.exited"], "audience.exited"> | WebhookEvent<PlatformEvents["calls.call.ended"], "calls.call.ended"> | WebhookEvent<PlatformEvents["calls.call.started"], "calls.call.started"> | WebhookEvent<PlatformEvents["calls.participant.joined"], "calls.participant.joined"> | WebhookEvent<PlatformEvents["calls.participant.left"], "calls.participant.left"> | WebhookEvent<PlatformEvents["calls.transcript.completed"], "calls.transcript.completed"> | WebhookEvent<PlatformEvents["calls.transcript.segment"], "calls.transcript.segment"> | WebhookEvent<PlatformEvents["campaigns.broadcast.canceled"], "campaigns.broadcast.canceled"> | WebhookEvent<PlatformEvents["campaigns.broadcast.completed"], "campaigns.broadcast.completed"> | WebhookEvent<PlatformEvents["campaigns.broadcast.started"], "campaigns.broadcast.started"> | WebhookEvent<PlatformEvents["campaigns.onsite.clicked"], "campaigns.onsite.clicked"> | WebhookEvent<PlatformEvents["campaigns.onsite.converted"], "campaigns.onsite.converted"> | WebhookEvent<PlatformEvents["campaigns.onsite.shown"], "campaigns.onsite.shown"> | WebhookEvent<PlatformEvents["commerce.buybox.changed"], "commerce.buybox.changed"> | WebhookEvent<PlatformEvents["commerce.cart.abandoned"], "commerce.cart.abandoned"> | WebhookEvent<PlatformEvents["commerce.cart.merged"], "commerce.cart.merged"> | WebhookEvent<PlatformEvents["commerce.fulfillment.created"], "commerce.fulfillment.created"> | WebhookEvent<PlatformEvents["commerce.fulfillment.delivered"], "commerce.fulfillment.delivered"> | WebhookEvent<PlatformEvents["commerce.inventory.restocked"], "commerce.inventory.restocked"> | WebhookEvent<PlatformEvents["commerce.listing.price_dropped"], "commerce.listing.price_dropped"> | WebhookEvent<PlatformEvents["commerce.order.created"], "commerce.order.created"> | WebhookEvent<PlatformEvents["commerce.order.paid"], "commerce.order.paid"> | WebhookEvent<PlatformEvents["commerce.order.refunded"], "commerce.order.refunded"> | WebhookEvent<PlatformEvents["commerce.product.created"], "commerce.product.created"> | WebhookEvent<PlatformEvents["commerce.return.requested"], "commerce.return.requested"> | WebhookEvent<PlatformEvents["commerce.store.created"], "commerce.store.created"> | WebhookEvent<PlatformEvents["commerce.store_order.canceled"], "commerce.store_order.canceled"> | WebhookEvent<PlatformEvents["consent.changed"], "consent.changed"> | WebhookEvent<PlatformEvents["device.revoked"], "device.revoked"> | WebhookEvent<PlatformEvents["file.deleted"], "file.deleted"> | WebhookEvent<PlatformEvents["file.moved"], "file.moved"> | WebhookEvent<PlatformEvents["file.uploaded"], "file.uploaded"> | WebhookEvent<PlatformEvents["flag.changed"], "flag.changed"> | WebhookEvent<PlatformEvents["flag.override_changed"], "flag.override_changed"> | WebhookEvent<PlatformEvents["iap.catalog.applied"], "iap.catalog.applied"> | WebhookEvent<PlatformEvents["iap.catalog.changed"], "iap.catalog.changed"> | WebhookEvent<PlatformEvents["iap.coupon.redeemed"], "iap.coupon.redeemed"> | WebhookEvent<PlatformEvents["iap.credits.depleted"], "iap.credits.depleted"> | WebhookEvent<PlatformEvents["iap.credits.low"], "iap.credits.low"> | WebhookEvent<PlatformEvents["iap.customer.changed"], "iap.customer.changed"> | WebhookEvent<PlatformEvents["iap.customer.erased"], "iap.customer.erased"> | WebhookEvent<PlatformEvents["iap.customer.merged"], "iap.customer.merged"> | WebhookEvent<PlatformEvents["iap.entitlement.changed"], "iap.entitlement.changed"> | WebhookEvent<PlatformEvents["iap.offer.redeemed"], "iap.offer.redeemed"> | WebhookEvent<PlatformEvents["iap.ownership.transferred"], "iap.ownership.transferred"> | WebhookEvent<PlatformEvents["iap.paywall.published"], "iap.paywall.published"> | WebhookEvent<PlatformEvents["iap.purchase.completed"], "iap.purchase.completed"> | WebhookEvent<PlatformEvents["iap.quota.exhausted"], "iap.quota.exhausted"> | WebhookEvent<PlatformEvents["iap.quota.threshold"], "iap.quota.threshold"> | WebhookEvent<PlatformEvents["iap.refund.changed"], "iap.refund.changed"> | WebhookEvent<PlatformEvents["iap.store.changed"], "iap.store.changed"> | WebhookEvent<PlatformEvents["iap.subscription.changed"], "iap.subscription.changed"> | WebhookEvent<PlatformEvents["journey.converted"], "journey.converted"> | WebhookEvent<PlatformEvents["journey.ended"], "journey.ended"> | WebhookEvent<PlatformEvents["journey.entered"], "journey.entered"> | WebhookEvent<PlatformEvents["journey.event"], "journey.event"> | WebhookEvent<PlatformEvents["journey.step"], "journey.step"> | WebhookEvent<PlatformEvents["messaging.conversation.created"], "messaging.conversation.created"> | WebhookEvent<PlatformEvents["messaging.conversation.deleted"], "messaging.conversation.deleted"> | WebhookEvent<PlatformEvents["messaging.conversation.read"], "messaging.conversation.read"> | WebhookEvent<PlatformEvents["messaging.message.created"], "messaging.message.created"> | WebhookEvent<PlatformEvents["messaging.report.created"], "messaging.report.created"> | WebhookEvent<PlatformEvents["notification.action"], "notification.action"> | WebhookEvent<PlatformEvents["notification.bounced"], "notification.bounced"> | WebhookEvent<PlatformEvents["notification.complained"], "notification.complained"> | WebhookEvent<PlatformEvents["notification.delivered"], "notification.delivered"> | WebhookEvent<PlatformEvents["notification.dismissed"], "notification.dismissed"> | WebhookEvent<PlatformEvents["notification.expired"], "notification.expired"> | WebhookEvent<PlatformEvents["notification.failed"], "notification.failed"> | WebhookEvent<PlatformEvents["notification.not_shown"], "notification.not_shown"> | WebhookEvent<PlatformEvents["notification.opened"], "notification.opened"> | WebhookEvent<PlatformEvents["notification.push_failing"], "notification.push_failing"> | WebhookEvent<PlatformEvents["notification.read"], "notification.read"> | WebhookEvent<PlatformEvents["notification.received"], "notification.received"> | WebhookEvent<PlatformEvents["notification.rejected"], "notification.rejected"> | WebhookEvent<PlatformEvents["notification.sent"], "notification.sent"> | WebhookEvent<PlatformEvents["notification.shared_paused"], "notification.shared_paused"> | WebhookEvent<PlatformEvents["notification.unconfirmed"], "notification.unconfirmed"> | WebhookEvent<PlatformEvents["notification.undelivered"], "notification.undelivered"> | WebhookEvent<PlatformEvents["notification.uninstalled"], "notification.uninstalled"> | WebhookEvent<PlatformEvents["payments.dispute.closed"], "payments.dispute.closed"> | WebhookEvent<PlatformEvents["payments.dispute.opened"], "payments.dispute.opened"> | WebhookEvent<PlatformEvents["payments.payment.canceled"], "payments.payment.canceled"> | WebhookEvent<PlatformEvents["payments.payment.failed"], "payments.payment.failed"> | WebhookEvent<PlatformEvents["payments.payment.requires_capture"], "payments.payment.requires_capture"> | WebhookEvent<PlatformEvents["payments.payment.succeeded"], "payments.payment.succeeded"> | WebhookEvent<PlatformEvents["payments.refund.succeeded"], "payments.refund.succeeded"> | WebhookEvent<PlatformEvents["payments.split.approved"], "payments.split.approved"> | WebhookEvent<PlatformEvents["payments.split.refunded"], "payments.split.refunded"> | WebhookEvent<PlatformEvents["payments.sub_merchant.updated"], "payments.sub_merchant.updated"> | WebhookEvent<PlatformEvents["payments.subscription.canceled"], "payments.subscription.canceled"> | WebhookEvent<PlatformEvents["payments.subscription.changed"], "payments.subscription.changed"> | WebhookEvent<PlatformEvents["payments.wallet.balance_changed"], "payments.wallet.balance_changed"> | WebhookEvent<PlatformEvents["payments.wallet.hold_changed"], "payments.wallet.hold_changed"> | WebhookEvent<PlatformEvents["payments.wallet.vested"], "payments.wallet.vested"> | WebhookEvent<PlatformEvents["promotions.rule.created"], "promotions.rule.created"> | WebhookEvent<PlatformEvents["session.ended"], "session.ended"> | WebhookEvent<PlatformEvents["stores.action.changed"], "stores.action.changed"> | WebhookEvent<PlatformEvents["stores.app.changed"], "stores.app.changed"> | WebhookEvent<PlatformEvents["stores.apple.changed"], "stores.apple.changed"> | WebhookEvent<PlatformEvents["stores.apple.key.made"], "stores.apple.key.made"> | WebhookEvent<PlatformEvents["stores.apple.key.revoked"], "stores.apple.key.revoked"> | WebhookEvent<PlatformEvents["stores.apple.session.changed"], "stores.apple.session.changed"> | WebhookEvent<PlatformEvents["stores.apple.session.ended"], "stores.apple.session.ended"> | WebhookEvent<PlatformEvents["stores.apple.session.expired"], "stores.apple.session.expired"> | WebhookEvent<PlatformEvents["stores.beta_review.changed"], "stores.beta_review.changed"> | WebhookEvent<PlatformEvents["stores.build.changed"], "stores.build.changed"> | WebhookEvent<PlatformEvents["stores.delivery.changed"], "stores.delivery.changed"> | WebhookEvent<PlatformEvents["stores.delivery.requested"], "stores.delivery.requested"> | WebhookEvent<PlatformEvents["stores.device.changed"], "stores.device.changed"> | WebhookEvent<PlatformEvents["stores.feedback.received"], "stores.feedback.received"> | WebhookEvent<PlatformEvents["stores.google.changed"], "stores.google.changed"> | WebhookEvent<PlatformEvents["stores.group.changed"], "stores.group.changed"> | WebhookEvent<PlatformEvents["stores.invitation.changed"], "stores.invitation.changed"> | WebhookEvent<PlatformEvents["stores.package.changed"], "stores.package.changed"> | WebhookEvent<PlatformEvents["stores.play_release.changed"], "stores.play_release.changed"> | WebhookEvent<PlatformEvents["stores.product.changed"], "stores.product.changed"> | WebhookEvent<PlatformEvents["stores.review.message"], "stores.review.message"> | WebhookEvent<PlatformEvents["stores.version.changed"], "stores.version.changed"> | WebhookEvent<PlatformEvents["stores.version.reviewed"], "stores.version.reviewed"> | WebhookEvent<PlatformEvents["stores.vitals.changed"], "stores.vitals.changed"> | WebhookEvent<PlatformEvents["stores.webhook.changed"], "stores.webhook.changed"> | WebhookEvent<PlatformEvents["user.converted"], "user.converted"> | WebhookEvent<PlatformEvents["user.deleted"], "user.deleted"> | WebhookEvent<PlatformEvents["user.locale_changed"], "user.locale_changed"> | WebhookEvent<PlatformEvents["user.password_changed"], "user.password_changed"> | WebhookEvent<PlatformEvents["user.permissions_changed"], "user.permissions_changed"> | WebhookEvent<PlatformEvents["workspace.conflict"], "workspace.conflict"> | WebhookEvent<PlatformEvents["workspace.deleted"], "workspace.deleted"> | WebhookEvent<PlatformEvents["workspace.published"], "workspace.published">;
|
|
30
|
+
export type PalbaseEvent = WebhookEvent<PlatformEvents["ai.goal.updated"], "ai.goal.updated"> | WebhookEvent<PlatformEvents["ai.mcp.auth_completed"], "ai.mcp.auth_completed"> | WebhookEvent<PlatformEvents["ai.mcp.auth_required"], "ai.mcp.auth_required"> | WebhookEvent<PlatformEvents["ai.response.completed"], "ai.response.completed"> | WebhookEvent<PlatformEvents["ai.response.failed"], "ai.response.failed"> | WebhookEvent<PlatformEvents["ai.response.started"], "ai.response.started"> | WebhookEvent<PlatformEvents["ai.secret_host_requested"], "ai.secret_host_requested"> | WebhookEvent<PlatformEvents["ai.trigger.fired"], "ai.trigger.fired"> | WebhookEvent<PlatformEvents["ai.voice.closed"], "ai.voice.closed"> | WebhookEvent<PlatformEvents["ai.voice.delegated"], "ai.voice.delegated"> | WebhookEvent<PlatformEvents["ai.voice.started"], "ai.voice.started"> | WebhookEvent<PlatformEvents["ai.wait.created"], "ai.wait.created"> | WebhookEvent<PlatformEvents["ai.wait.resumed"], "ai.wait.resumed"> | WebhookEvent<PlatformEvents["ai.wait.timed_out"], "ai.wait.timed_out"> | WebhookEvent<PlatformEvents["ai.workflow.completed"], "ai.workflow.completed"> | WebhookEvent<PlatformEvents["ai.workflow.failed"], "ai.workflow.failed"> | WebhookEvent<PlatformEvents["audience.entered"], "audience.entered"> | WebhookEvent<PlatformEvents["audience.exited"], "audience.exited"> | WebhookEvent<PlatformEvents["calls.call.ended"], "calls.call.ended"> | WebhookEvent<PlatformEvents["calls.call.started"], "calls.call.started"> | WebhookEvent<PlatformEvents["calls.participant.joined"], "calls.participant.joined"> | WebhookEvent<PlatformEvents["calls.participant.left"], "calls.participant.left"> | WebhookEvent<PlatformEvents["calls.transcript.completed"], "calls.transcript.completed"> | WebhookEvent<PlatformEvents["calls.transcript.segment"], "calls.transcript.segment"> | WebhookEvent<PlatformEvents["campaigns.broadcast.canceled"], "campaigns.broadcast.canceled"> | WebhookEvent<PlatformEvents["campaigns.broadcast.completed"], "campaigns.broadcast.completed"> | WebhookEvent<PlatformEvents["campaigns.broadcast.started"], "campaigns.broadcast.started"> | WebhookEvent<PlatformEvents["campaigns.onsite.clicked"], "campaigns.onsite.clicked"> | WebhookEvent<PlatformEvents["campaigns.onsite.converted"], "campaigns.onsite.converted"> | WebhookEvent<PlatformEvents["campaigns.onsite.shown"], "campaigns.onsite.shown"> | WebhookEvent<PlatformEvents["commerce.buybox.changed"], "commerce.buybox.changed"> | WebhookEvent<PlatformEvents["commerce.cart.abandoned"], "commerce.cart.abandoned"> | WebhookEvent<PlatformEvents["commerce.cart.merged"], "commerce.cart.merged"> | WebhookEvent<PlatformEvents["commerce.fulfillment.created"], "commerce.fulfillment.created"> | WebhookEvent<PlatformEvents["commerce.fulfillment.delivered"], "commerce.fulfillment.delivered"> | WebhookEvent<PlatformEvents["commerce.inventory.restocked"], "commerce.inventory.restocked"> | WebhookEvent<PlatformEvents["commerce.listing.price_dropped"], "commerce.listing.price_dropped"> | WebhookEvent<PlatformEvents["commerce.order.created"], "commerce.order.created"> | WebhookEvent<PlatformEvents["commerce.order.paid"], "commerce.order.paid"> | WebhookEvent<PlatformEvents["commerce.order.refunded"], "commerce.order.refunded"> | WebhookEvent<PlatformEvents["commerce.product.created"], "commerce.product.created"> | WebhookEvent<PlatformEvents["commerce.return.requested"], "commerce.return.requested"> | WebhookEvent<PlatformEvents["commerce.review.created"], "commerce.review.created"> | WebhookEvent<PlatformEvents["commerce.store.created"], "commerce.store.created"> | WebhookEvent<PlatformEvents["commerce.store_order.canceled"], "commerce.store_order.canceled"> | WebhookEvent<PlatformEvents["consent.changed"], "consent.changed"> | WebhookEvent<PlatformEvents["device.revoked"], "device.revoked"> | WebhookEvent<PlatformEvents["file.deleted"], "file.deleted"> | WebhookEvent<PlatformEvents["file.moved"], "file.moved"> | WebhookEvent<PlatformEvents["file.uploaded"], "file.uploaded"> | WebhookEvent<PlatformEvents["flag.changed"], "flag.changed"> | WebhookEvent<PlatformEvents["flag.override_changed"], "flag.override_changed"> | WebhookEvent<PlatformEvents["iap.catalog.applied"], "iap.catalog.applied"> | WebhookEvent<PlatformEvents["iap.catalog.changed"], "iap.catalog.changed"> | WebhookEvent<PlatformEvents["iap.coupon.redeemed"], "iap.coupon.redeemed"> | WebhookEvent<PlatformEvents["iap.credits.depleted"], "iap.credits.depleted"> | WebhookEvent<PlatformEvents["iap.credits.low"], "iap.credits.low"> | WebhookEvent<PlatformEvents["iap.customer.changed"], "iap.customer.changed"> | WebhookEvent<PlatformEvents["iap.customer.erased"], "iap.customer.erased"> | WebhookEvent<PlatformEvents["iap.customer.merged"], "iap.customer.merged"> | WebhookEvent<PlatformEvents["iap.entitlement.changed"], "iap.entitlement.changed"> | WebhookEvent<PlatformEvents["iap.offer.redeemed"], "iap.offer.redeemed"> | WebhookEvent<PlatformEvents["iap.ownership.transferred"], "iap.ownership.transferred"> | WebhookEvent<PlatformEvents["iap.paywall.published"], "iap.paywall.published"> | WebhookEvent<PlatformEvents["iap.purchase.completed"], "iap.purchase.completed"> | WebhookEvent<PlatformEvents["iap.quota.exhausted"], "iap.quota.exhausted"> | WebhookEvent<PlatformEvents["iap.quota.threshold"], "iap.quota.threshold"> | WebhookEvent<PlatformEvents["iap.refund.changed"], "iap.refund.changed"> | WebhookEvent<PlatformEvents["iap.store.changed"], "iap.store.changed"> | WebhookEvent<PlatformEvents["iap.subscription.changed"], "iap.subscription.changed"> | WebhookEvent<PlatformEvents["journey.converted"], "journey.converted"> | WebhookEvent<PlatformEvents["journey.ended"], "journey.ended"> | WebhookEvent<PlatformEvents["journey.entered"], "journey.entered"> | WebhookEvent<PlatformEvents["journey.event"], "journey.event"> | WebhookEvent<PlatformEvents["journey.step"], "journey.step"> | WebhookEvent<PlatformEvents["messaging.conversation.created"], "messaging.conversation.created"> | WebhookEvent<PlatformEvents["messaging.conversation.deleted"], "messaging.conversation.deleted"> | WebhookEvent<PlatformEvents["messaging.conversation.read"], "messaging.conversation.read"> | WebhookEvent<PlatformEvents["messaging.message.created"], "messaging.message.created"> | WebhookEvent<PlatformEvents["messaging.report.created"], "messaging.report.created"> | WebhookEvent<PlatformEvents["notification.action"], "notification.action"> | WebhookEvent<PlatformEvents["notification.bounced"], "notification.bounced"> | WebhookEvent<PlatformEvents["notification.complained"], "notification.complained"> | WebhookEvent<PlatformEvents["notification.delivered"], "notification.delivered"> | WebhookEvent<PlatformEvents["notification.dismissed"], "notification.dismissed"> | WebhookEvent<PlatformEvents["notification.expired"], "notification.expired"> | WebhookEvent<PlatformEvents["notification.failed"], "notification.failed"> | WebhookEvent<PlatformEvents["notification.not_shown"], "notification.not_shown"> | WebhookEvent<PlatformEvents["notification.opened"], "notification.opened"> | WebhookEvent<PlatformEvents["notification.push_failing"], "notification.push_failing"> | WebhookEvent<PlatformEvents["notification.read"], "notification.read"> | WebhookEvent<PlatformEvents["notification.received"], "notification.received"> | WebhookEvent<PlatformEvents["notification.rejected"], "notification.rejected"> | WebhookEvent<PlatformEvents["notification.sent"], "notification.sent"> | WebhookEvent<PlatformEvents["notification.shared_paused"], "notification.shared_paused"> | WebhookEvent<PlatformEvents["notification.unconfirmed"], "notification.unconfirmed"> | WebhookEvent<PlatformEvents["notification.undelivered"], "notification.undelivered"> | WebhookEvent<PlatformEvents["notification.uninstalled"], "notification.uninstalled"> | WebhookEvent<PlatformEvents["payments.dispute.closed"], "payments.dispute.closed"> | WebhookEvent<PlatformEvents["payments.dispute.opened"], "payments.dispute.opened"> | WebhookEvent<PlatformEvents["payments.payment.canceled"], "payments.payment.canceled"> | WebhookEvent<PlatformEvents["payments.payment.failed"], "payments.payment.failed"> | WebhookEvent<PlatformEvents["payments.payment.requires_capture"], "payments.payment.requires_capture"> | WebhookEvent<PlatformEvents["payments.payment.succeeded"], "payments.payment.succeeded"> | WebhookEvent<PlatformEvents["payments.refund.succeeded"], "payments.refund.succeeded"> | WebhookEvent<PlatformEvents["payments.split.approved"], "payments.split.approved"> | WebhookEvent<PlatformEvents["payments.split.refunded"], "payments.split.refunded"> | WebhookEvent<PlatformEvents["payments.sub_merchant.updated"], "payments.sub_merchant.updated"> | WebhookEvent<PlatformEvents["payments.subscription.canceled"], "payments.subscription.canceled"> | WebhookEvent<PlatformEvents["payments.subscription.changed"], "payments.subscription.changed"> | WebhookEvent<PlatformEvents["payments.wallet.balance_changed"], "payments.wallet.balance_changed"> | WebhookEvent<PlatformEvents["payments.wallet.hold_changed"], "payments.wallet.hold_changed"> | WebhookEvent<PlatformEvents["payments.wallet.vested"], "payments.wallet.vested"> | WebhookEvent<PlatformEvents["promotions.rule.created"], "promotions.rule.created"> | WebhookEvent<PlatformEvents["session.ended"], "session.ended"> | WebhookEvent<PlatformEvents["stores.action.changed"], "stores.action.changed"> | WebhookEvent<PlatformEvents["stores.app.changed"], "stores.app.changed"> | WebhookEvent<PlatformEvents["stores.apple.changed"], "stores.apple.changed"> | WebhookEvent<PlatformEvents["stores.apple.key.made"], "stores.apple.key.made"> | WebhookEvent<PlatformEvents["stores.apple.key.revoked"], "stores.apple.key.revoked"> | WebhookEvent<PlatformEvents["stores.apple.session.changed"], "stores.apple.session.changed"> | WebhookEvent<PlatformEvents["stores.apple.session.ended"], "stores.apple.session.ended"> | WebhookEvent<PlatformEvents["stores.apple.session.expired"], "stores.apple.session.expired"> | WebhookEvent<PlatformEvents["stores.beta_review.changed"], "stores.beta_review.changed"> | WebhookEvent<PlatformEvents["stores.build.changed"], "stores.build.changed"> | WebhookEvent<PlatformEvents["stores.delivery.changed"], "stores.delivery.changed"> | WebhookEvent<PlatformEvents["stores.delivery.requested"], "stores.delivery.requested"> | WebhookEvent<PlatformEvents["stores.device.changed"], "stores.device.changed"> | WebhookEvent<PlatformEvents["stores.feedback.received"], "stores.feedback.received"> | WebhookEvent<PlatformEvents["stores.google.changed"], "stores.google.changed"> | WebhookEvent<PlatformEvents["stores.group.changed"], "stores.group.changed"> | WebhookEvent<PlatformEvents["stores.invitation.changed"], "stores.invitation.changed"> | WebhookEvent<PlatformEvents["stores.package.changed"], "stores.package.changed"> | WebhookEvent<PlatformEvents["stores.play_release.changed"], "stores.play_release.changed"> | WebhookEvent<PlatformEvents["stores.product.changed"], "stores.product.changed"> | WebhookEvent<PlatformEvents["stores.review.message"], "stores.review.message"> | WebhookEvent<PlatformEvents["stores.version.changed"], "stores.version.changed"> | WebhookEvent<PlatformEvents["stores.version.reviewed"], "stores.version.reviewed"> | WebhookEvent<PlatformEvents["stores.vitals.changed"], "stores.vitals.changed"> | WebhookEvent<PlatformEvents["stores.webhook.changed"], "stores.webhook.changed"> | WebhookEvent<PlatformEvents["user.converted"], "user.converted"> | WebhookEvent<PlatformEvents["user.deleted"], "user.deleted"> | WebhookEvent<PlatformEvents["user.locale_changed"], "user.locale_changed"> | WebhookEvent<PlatformEvents["user.password_changed"], "user.password_changed"> | WebhookEvent<PlatformEvents["user.permissions_changed"], "user.permissions_changed"> | WebhookEvent<PlatformEvents["workspace.conflict"], "workspace.conflict"> | WebhookEvent<PlatformEvents["workspace.deleted"], "workspace.deleted"> | WebhookEvent<PlatformEvents["workspace.published"], "workspace.published">;
|
|
@@ -1,3 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commerce, Discovery, Reviews & Promotions server helpers: typed views, event
|
|
3
|
+
* guards, Standard Webhooks HMAC-SHA256 blocking hook verification/handling
|
|
4
|
+
* (including `discovery.rank`), and JSDoc guides for server-side discovery
|
|
5
|
+
* administration (`server.commerce`).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Custom discovery ranking hook handler (Standard Webhooks verified)
|
|
9
|
+
* import { createDiscoveryRankHookHandler } from '@palbase/server';
|
|
10
|
+
*
|
|
11
|
+
* export const POST = createDiscoveryRankHookHandler({
|
|
12
|
+
* secret: process.env.COMMERCE_DISCOVERY_HOOK_SECRET!,
|
|
13
|
+
* handle: async ({ payload }) => {
|
|
14
|
+
* const boosted = [...payload.candidates].sort((a, b) => b.base_score - a.base_score);
|
|
15
|
+
* return {
|
|
16
|
+
* ranked_product_ids: boosted.map((c) => c.product_id),
|
|
17
|
+
* scores: Object.fromEntries(boosted.map((c) => [c.product_id, c.base_score])),
|
|
18
|
+
* };
|
|
19
|
+
* },
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Managing custom discovery strategies, rules, synonyms, signals, and reviews
|
|
24
|
+
* const pb = createServer({ url: process.env.PALBASE_URL!, secretKey: process.env.PALBASE_SECRET_KEY! });
|
|
25
|
+
* const strategies = await pb.commerce.listDiscoveryStrategies();
|
|
26
|
+
* const created = await pb.commerce.createDiscoveryStrategy({
|
|
27
|
+
* body: {
|
|
28
|
+
* key: 'spring-featured',
|
|
29
|
+
* name: 'Spring Featured',
|
|
30
|
+
* base_algorithm: 'hybrid',
|
|
31
|
+
* weights: { w_text: 1.0, w_popularity: 0.4, w_conversion: 0.6, in_stock_boost: 0.5 },
|
|
32
|
+
* },
|
|
33
|
+
* });
|
|
34
|
+
* // Pass hook_id: "" to clear a previously bound hook_id to null
|
|
35
|
+
* await pb.commerce.updateDiscoveryStrategy({
|
|
36
|
+
* path: { strategy_id: created.data.id },
|
|
37
|
+
* body: { hook_id: '' },
|
|
38
|
+
* });
|
|
39
|
+
* await pb.commerce.createMerchandisingRule({
|
|
40
|
+
* body: {
|
|
41
|
+
* name: 'Pin Flagship',
|
|
42
|
+
* conditions: { all: [{ field: 'query', op: 'eq', value: 'headphones' }] },
|
|
43
|
+
* actions: [{ type: 'pin', product_ids: ['prod_1'], position: 0 }],
|
|
44
|
+
* },
|
|
45
|
+
* });
|
|
46
|
+
* await pb.commerce.createSearchSynonym({
|
|
47
|
+
* body: { kind: 'two_way', source_term: 'earbuds', target_terms: ['earphones', 'in-ear'] },
|
|
48
|
+
* });
|
|
49
|
+
* await pb.commerce.refreshDiscoverySignals();
|
|
50
|
+
* await pb.commerce.adminModerateReview({
|
|
51
|
+
* path: { review_id: 'rev_1' },
|
|
52
|
+
* body: { review_kind: 'product', status: 'published' },
|
|
53
|
+
* });
|
|
54
|
+
*/
|
|
1
55
|
import type { commerce as commerceModule, PalbaseEvent } from '../../internal/src/modules/index.js';
|
|
2
56
|
export type CommerceSettings = commerceModule.CommerceSettings;
|
|
3
57
|
export type Region = commerceModule.Region;
|
|
@@ -25,7 +79,104 @@ export type PromotionRule = commerceModule.PromotionRule;
|
|
|
25
79
|
export type PromotionCode = commerceModule.PromotionCode;
|
|
26
80
|
export type PromotionEvalResult = commerceModule.PromotionEvalResult;
|
|
27
81
|
export type PromotionRedemption = commerceModule.PromotionRedemption;
|
|
28
|
-
export type
|
|
82
|
+
export type AppliedRuleSummary = commerceModule.AppliedRuleSummary;
|
|
83
|
+
export type AttributeFacetBucketList = commerceModule.AttributeFacetBucketList;
|
|
84
|
+
export type AttributeFacetMap = commerceModule.AttributeFacetMap;
|
|
85
|
+
export type BrandFacetBucket = commerceModule.BrandFacetBucket;
|
|
86
|
+
export type BrandSummary = commerceModule.BrandSummary;
|
|
87
|
+
export type BuyBoxSummary = commerceModule.BuyBoxSummary;
|
|
88
|
+
export type CategoryFacetBucket = commerceModule.CategoryFacetBucket;
|
|
89
|
+
export type CategorySummary = commerceModule.CategorySummary;
|
|
90
|
+
export type CreateDiscoveryStrategyRequest = commerceModule.CreateDiscoveryStrategyRequest;
|
|
91
|
+
export type CreateMerchandisingRuleRequest = commerceModule.CreateMerchandisingRuleRequest;
|
|
92
|
+
export type CreateSearchSynonymRequest = commerceModule.CreateSearchSynonymRequest;
|
|
93
|
+
export type DiscoveryFilterSpec = commerceModule.DiscoveryFilterSpec;
|
|
94
|
+
export type DiscoveryPinItem = commerceModule.DiscoveryPinItem;
|
|
95
|
+
export type DiscoverySignalRefreshResponse = commerceModule.DiscoverySignalRefreshResponse;
|
|
96
|
+
export type DiscoveryStrategy = commerceModule.DiscoveryStrategy;
|
|
97
|
+
export type DiscoveryStrategyList = commerceModule.DiscoveryStrategyList;
|
|
98
|
+
export type DiscoveryWeights = commerceModule.DiscoveryWeights;
|
|
99
|
+
export type ExperimentAssignment = commerceModule.ExperimentAssignment;
|
|
100
|
+
export type MerchandisingRule = commerceModule.MerchandisingRule;
|
|
101
|
+
export type MerchandisingRuleAction = commerceModule.MerchandisingRuleAction;
|
|
102
|
+
export type MerchandisingRuleList = commerceModule.MerchandisingRuleList;
|
|
103
|
+
export type PriceRangeFacet = commerceModule.PriceRangeFacet;
|
|
104
|
+
export type PrimaryMedia = commerceModule.PrimaryMedia;
|
|
105
|
+
export type ProductSearchHit = commerceModule.ProductSearchHit;
|
|
106
|
+
export type ProductSearchRequest = commerceModule.ProductSearchRequest;
|
|
107
|
+
export type ProductSearchResponse = commerceModule.ProductSearchResponse;
|
|
108
|
+
export type RatingFacetBucket = commerceModule.RatingFacetBucket;
|
|
109
|
+
export type RecommendRequest = commerceModule.RecommendRequest;
|
|
110
|
+
export type RecommendResponse = commerceModule.RecommendResponse;
|
|
111
|
+
export type SearchFacets = commerceModule.SearchFacets;
|
|
112
|
+
export type SearchSynonym = commerceModule.SearchSynonym;
|
|
113
|
+
export type SearchSynonymList = commerceModule.SearchSynonymList;
|
|
114
|
+
export type SuggestProductHit = commerceModule.SuggestProductHit;
|
|
115
|
+
export type SuggestResponse = commerceModule.SuggestResponse;
|
|
116
|
+
export type TermFacetBucket = commerceModule.TermFacetBucket;
|
|
117
|
+
export type UpdateDiscoveryStrategyRequest = commerceModule.UpdateDiscoveryStrategyRequest;
|
|
118
|
+
export type UpdateMerchandisingRuleRequest = commerceModule.UpdateMerchandisingRuleRequest;
|
|
119
|
+
export type CommerceReviewCreatedEvent = commerceModule.CommerceReviewCreatedEvent;
|
|
120
|
+
export type ProductReview = commerceModule.ProductReview;
|
|
121
|
+
export type ProductReviewListResponse = commerceModule.ProductReviewListResponse;
|
|
122
|
+
export type ProductReviewSummary = commerceModule.ProductReviewSummary;
|
|
123
|
+
export type ReviewDeleteResponse = commerceModule.ReviewDeleteResponse;
|
|
124
|
+
export type ReviewMedia = commerceModule.ReviewMedia;
|
|
125
|
+
export type ReviewModerationResponse = commerceModule.ReviewModerationResponse;
|
|
126
|
+
export type ReviewReplyResponse = commerceModule.ReviewReplyResponse;
|
|
127
|
+
export type ReviewUploadURLResponse = commerceModule.ReviewUploadURLResponse;
|
|
128
|
+
export type ReviewVoteResponse = commerceModule.ReviewVoteResponse;
|
|
129
|
+
export type ReviewsBundle = commerceModule.ReviewsBundle;
|
|
130
|
+
export type StoreReview = commerceModule.StoreReview;
|
|
131
|
+
export type StoreReviewListResponse = commerceModule.StoreReviewListResponse;
|
|
132
|
+
export type StoreReviewSummary = commerceModule.StoreReviewSummary;
|
|
133
|
+
export type CommerceHookPoint = 'shipping.calculate' | 'tax.calculate' | 'checkout.validate' | 'buybox.rank' | 'discovery.rank';
|
|
134
|
+
export interface DiscoveryRankContext {
|
|
135
|
+
channel?: string;
|
|
136
|
+
region?: string;
|
|
137
|
+
currency?: string;
|
|
138
|
+
user_id?: string;
|
|
139
|
+
store_id?: string;
|
|
140
|
+
category_id?: string;
|
|
141
|
+
cart_id?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface DiscoveryRankSignals {
|
|
144
|
+
views_7d: number;
|
|
145
|
+
clicks_7d: number;
|
|
146
|
+
atc_7d: number;
|
|
147
|
+
orders_30d: number;
|
|
148
|
+
bestseller_score: number;
|
|
149
|
+
trending_score: number;
|
|
150
|
+
}
|
|
151
|
+
export interface DiscoveryRankCandidate {
|
|
152
|
+
product_id: string;
|
|
153
|
+
handle: string;
|
|
154
|
+
title: string;
|
|
155
|
+
brand_id?: string | null;
|
|
156
|
+
category_id?: string | null;
|
|
157
|
+
base_score: number;
|
|
158
|
+
buybox_unit_amount?: number | null;
|
|
159
|
+
in_stock: boolean;
|
|
160
|
+
available_stock: number;
|
|
161
|
+
offer_count: number;
|
|
162
|
+
rating_avg_bps?: number | null;
|
|
163
|
+
rating_count: number;
|
|
164
|
+
signals?: DiscoveryRankSignals;
|
|
165
|
+
}
|
|
166
|
+
export interface DiscoveryRankHookRequest {
|
|
167
|
+
hook_point: 'discovery.rank';
|
|
168
|
+
project_id: string;
|
|
169
|
+
strategy: string;
|
|
170
|
+
query?: string;
|
|
171
|
+
context: DiscoveryRankContext;
|
|
172
|
+
candidates: DiscoveryRankCandidate[];
|
|
173
|
+
}
|
|
174
|
+
export interface DiscoveryRankHookResponse {
|
|
175
|
+
ranked_product_ids?: string[];
|
|
176
|
+
scores?: Record<string, number>;
|
|
177
|
+
exclude_product_ids?: string[];
|
|
178
|
+
pinned_product_ids?: string[];
|
|
179
|
+
}
|
|
29
180
|
export type CommerceWebhookEvent = Extract<PalbaseEvent, {
|
|
30
181
|
type: `commerce.${string}`;
|
|
31
182
|
}>;
|
|
@@ -72,7 +223,25 @@ export interface CommerceHookHandlerOptions<TReq = Record<string, unknown>, TRes
|
|
|
72
223
|
/**
|
|
73
224
|
* Builds a Web-standard `(request: Request) => Promise<Response>` handler for a
|
|
74
225
|
* Palbase blocking commerce extension hook (`shipping.calculate`, `tax.calculate`,
|
|
75
|
-
* `checkout.validate`, `buybox.rank`). Verifies Standard Webhooks
|
|
76
|
-
* invoking `handle` and responds with JSON.
|
|
226
|
+
* `checkout.validate`, `buybox.rank`, `discovery.rank`). Verifies Standard Webhooks
|
|
227
|
+
* signatures before invoking `handle` and responds with JSON.
|
|
77
228
|
*/
|
|
78
229
|
export declare function createCommerceHookHandler<TReq = Record<string, unknown>, TRes = Record<string, unknown>>(opts: CommerceHookHandlerOptions<TReq, TRes>): (request: Request) => Promise<Response>;
|
|
230
|
+
/**
|
|
231
|
+
* Builds a typed Web-standard `(request: Request) => Promise<Response>` handler
|
|
232
|
+
* specifically for the `discovery.rank` blocking commerce hook. Verifies Standard
|
|
233
|
+
* Webhooks HMAC-SHA256 signatures via `createCommerceHookHandler` and rejects
|
|
234
|
+
* requests carrying a mismatched `x-palbase-hook-point` header with HTTP 400
|
|
235
|
+
* (`invalid_hook_point`).
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* export const POST = createDiscoveryRankHookHandler({
|
|
239
|
+
* secret: process.env.COMMERCE_DISCOVERY_HOOK_SECRET!,
|
|
240
|
+
* handle: ({ payload }) => ({
|
|
241
|
+
* ranked_product_ids: [...payload.candidates]
|
|
242
|
+
* .sort((a, b) => (b.signals?.trending_score ?? 0) - (a.signals?.trending_score ?? 0))
|
|
243
|
+
* .map((c) => c.product_id),
|
|
244
|
+
* }),
|
|
245
|
+
* });
|
|
246
|
+
*/
|
|
247
|
+
export declare function createDiscoveryRankHookHandler(opts: CommerceHookHandlerOptions<DiscoveryRankHookRequest, DiscoveryRankHookResponse>): (request: Request) => Promise<Response>;
|
|
@@ -5,7 +5,7 @@ export { EVENT_TYPES, signatureHeader, verifySignature, verifyWebhook, verifyWeb
|
|
|
5
5
|
export { AuthUnavailable, requestAddress, sessionStanding, TokenError, TokenVerifier, type ProofContext, type RequestLike, type SessionStanding, type TokenRefusal, type TokenUser, type VerifierOptions, } from './auth/jwt.js';
|
|
6
6
|
export { isEntitled, ReservationSettled, withReservation, type CustomerInfo, type Reservation, type SpendReceipt } from './iap.js';
|
|
7
7
|
export { isPaymentsEvent, isRetryableDecline, settleWalletHold, WalletHoldSettled, withWalletHold, type DeclineCode, type PaymentChannel, type PaymentIntent, type PaymentSplit, type PaymentSubscription, type PaymentsWebhookEvent, type SavedPaymentMethod, type SellerAccount, type SellerBalance, type SplitInput, type SplitRefundInput, type SubMerchant, type WalletBalance, type WalletHold, type WalletHoldReservation, type WalletHoldSettlement, } from './payments.js';
|
|
8
|
-
export { createCommerceHookHandler, isCommerceEvent, isPromotionsEvent, verifyCommerceHookSignature, type Cart, type Channel, type CheckoutResponse, type CommerceHookContext, type CommerceHookHandlerOptions, type CommerceHookPoint, type CommerceHookVerifyOptions, type CommerceSettings, type CommerceWebhookEvent, type HookCreated, type HookView, type InventoryLevel, type Invoice, type Listing, type Order, type OrderDetail, type Price, type Product, type ProductDetail, type PromotionCode, type PromotionEvalResult, type PromotionRedemption, type PromotionRule, type PromotionsWebhookEvent, type Region, type ReturnRecord, type Settlement, type StockLocation, type Store, type StoreMetrics, type StoreOrder, type Variant, } from './commerce.js';
|
|
8
|
+
export { createCommerceHookHandler, createDiscoveryRankHookHandler, isCommerceEvent, isPromotionsEvent, verifyCommerceHookSignature, type AppliedRuleSummary, type AttributeFacetBucketList, type AttributeFacetMap, type BrandFacetBucket, type BrandSummary, type BuyBoxSummary, type Cart, type CategoryFacetBucket, type CategorySummary, type Channel, type CheckoutResponse, type CommerceHookContext, type CommerceHookHandlerOptions, type CommerceHookPoint, type CommerceHookVerifyOptions, type CommerceReviewCreatedEvent, type CommerceSettings, type CommerceWebhookEvent, type CreateDiscoveryStrategyRequest, type CreateMerchandisingRuleRequest, type CreateSearchSynonymRequest, type DiscoveryFilterSpec, type DiscoveryPinItem, type DiscoveryRankCandidate, type DiscoveryRankContext, type DiscoveryRankHookRequest, type DiscoveryRankHookResponse, type DiscoveryRankSignals, type DiscoverySignalRefreshResponse, type DiscoveryStrategy, type DiscoveryStrategyList, type DiscoveryWeights, type ExperimentAssignment, type HookCreated, type HookView, type InventoryLevel, type Invoice, type Listing, type MerchandisingRule, type MerchandisingRuleAction, type MerchandisingRuleList, type Order, type OrderDetail, type Price, type PriceRangeFacet, type PrimaryMedia, type Product, type ProductDetail, type ProductReview, type ProductReviewListResponse, type ProductReviewSummary, type ProductSearchHit, type ProductSearchRequest, type ProductSearchResponse, type PromotionCode, type PromotionEvalResult, type PromotionRedemption, type PromotionRule, type PromotionsWebhookEvent, type RatingFacetBucket, type RecommendRequest, type RecommendResponse, type Region, type ReturnRecord, type ReviewDeleteResponse, type ReviewMedia, type ReviewModerationResponse, type ReviewReplyResponse, type ReviewUploadURLResponse, type ReviewVoteResponse, type ReviewsBundle, type SearchFacets, type SearchSynonym, type SearchSynonymList, type Settlement, type StockLocation, type Store, type StoreMetrics, type StoreOrder, type StoreReview, type StoreReviewListResponse, type StoreReviewSummary, type SuggestProductHit, type SuggestResponse, type TermFacetBucket, type UpdateDiscoveryStrategyRequest, type UpdateMerchandisingRuleRequest, type Variant, } from './commerce.js';
|
|
9
9
|
export { isCampaignsEvent, isJourneysEvent, type Broadcast, type BroadcastArmStats, type BroadcastConversionResult, type BroadcastConversionWrite, type BroadcastStats, type BroadcastVariant, type BroadcastWrite, type CampaignIncentive, type CampaignsWebhookEvent, type JourneysWebhookEvent, type LinkAttributeResult, type LinkAttributeWrite, type OnSiteCampaign, type OnSiteCampaignWrite, type OnSiteSettings, type OnSiteStats, type SellerBlueprint, type StoreBlueprintActivate, type StoreBlueprintJourney, type TrackingLink, type TrackingLinkStats, type TrackingLinkWrite, } from './campaigns.js';
|
|
10
10
|
export { pages } from './pages.js';
|
|
11
11
|
export { PalbaseError } from '../../internal/src/transport.js';
|