@benshi.ai/js-sdk
Version:
Benshi SDK
51 lines (45 loc) • 982 B
text/typescript
export enum CTAType {
None = '',
Redirect = 'redirect',
AddToCart = 'add_to_cart'
}
export interface CTA {
type: CTAType,
cta_resource: CTAResource,
}
export interface CTADefinition {
title: string,
body: string
}
export interface CTAAction {
id: number,
org_proj: string,
name: string,
description: string,
tags: string[],
type: string,
uses: number,
target_cohort_ids: number[],
created_by: string,
created_at: string,
resolve_detail: any,
call_to_action: CTA,
definition: CTADefinition
}
export interface CTAResource {
type: string,
id: string
}
export interface Nudge {
id: number,
dispatched_at: string,
expire_at: string,
action: CTAAction,
ref_type: string,
ref_id: number
}
export interface INudgesRepository {
getNudges(userId: string): Promise<Nudge[]>
markNudgeAsShown(nudgeId: string): void
haveBeenAlreadyShown(nudgeId: string): boolean
}