Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export interface CalendarMessage {
/** The title is shown close to the button that leads to open a user calendar. */
title: string;
/** The timestamp defines start of a calendar event. */
event_start: Date;
/** The timestamp defines end of a calendar event. */
event_end: Date;
/** Title of a calendar event. */
event_title: string;
/** Description of a calendar event. */
event_description?: string;
/** The URL that is opened when the user cannot open a calendar event directly or channel does not have support for this type. */
fallback_url: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type { CalendarMessage } from './calendar-message';
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { WhatsAppFlow } from '../whatsapp-flow';
import { WhatsAppPaymentOrderDetails } from '../whatsapp-payment-order-details';
import { WhatsAppPaymentOrderStatus } from '../whatsapp-payment-order-status';
import { KakaoTalkCommerceMessageContent } from '../kakaotalk-commerce-message-content';
import { KakaoTalkCarouselCommerceMessageContent } from '../kakaotalk-carousel-commerce-message-content';
import { KakaoTalkCommerce } from '../kakaotalk-commerce';
import { KakaoTalkCarouselCommerce } from '../kakaotalk-carousel-commerce';

/**
* A message containing a channel specific message (not supported by OMNI types).
Expand Down Expand Up @@ -37,13 +37,13 @@ export interface WhatsAppPaymentOrderStatusMessage {
export interface KakaoTalkCommerceMessage {
/** The type of the channel specific message. */
message_type: 'COMMERCE';
/** @see KakaoTalkCommerceMessageContent */
message: KakaoTalkCommerceMessageContent;
/** @see KakaoTalkCommerce */
message: KakaoTalkCommerce;
}

export interface KakaoTalkCarouselCommerceMessage {
/** The type of the channel specific message. */
message_type: 'CAROUSEL_COMMERCE';
/** @see KakaoTalkCarouselCommerceMessageContent */
message: KakaoTalkCarouselCommerceMessageContent;
/** @see KakaoTalkCarouselCommerce */
message: KakaoTalkCarouselCommerce;
}
54 changes: 53 additions & 1 deletion packages/conversation/src/models/v1/choice/choice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { CallMessage } from '../call-message';
import { LocationMessageItem } from '../location-message';
import { TextMessageItem } from '../text-message';
import { UrlMessage } from '../url-message';
import { CalendarMessage } from '../calendar-message';
import { ShareLocationMessage } from '../share-location-message';

/**
* A choice is an action the user can take such as buttons for quick replies or other call to actions.
Expand All @@ -10,45 +12,95 @@ export type Choice =
CallMessageChoice
| LocationMessageChoice
| TextMessageChoice
| UrlMessageChoice;
| UrlMessageChoice
| CalendarMessageChoice
| ShareLocationMessageChoice;

export interface ChoiceBase {
/** An optional field. This data will be returned in the ChoiceResponseMessage. The default is message_id_{text, title}. */
postback_data?: string;
}

/**
* Message for triggering a call.
*/
export interface CallMessageChoice extends ChoiceBase {
/** @see CallMessage */
call_message: CallMessage;
// Exclude other choice types
location_message?: never;
text_message?: never;
url_message?: never;
calendar_message?: never;
share_location_message?: never;
}

/**
* Message containing geographic location.
*/
export interface LocationMessageChoice extends ChoiceBase {
/** @see LocationMessageItem */
location_message: LocationMessageItem;
// Exclude other choice types
call_message?: never;
text_message?: never;
url_message?: never;
calendar_message?: never;
share_location_message?: never;
}

/**
* A message containing only text.
*/
export interface TextMessageChoice extends ChoiceBase {
/** @see TextMessageItem */
text_message: TextMessageItem;
// Exclude other choice types
call_message?: never;
location_message?: never;
url_message?: never;
calendar_message?: never;
share_location_message?: never;
}

/**
* A generic URL message.
*/
export interface UrlMessageChoice extends ChoiceBase {
/** @see UrlMessage */
url_message: UrlMessage;
// Exclude other choice types
call_message?: never;
location_message?: never;
text_message?: never;
calendar_message?: never;
share_location_message?: never;
}

/**
* Message containing details about a calendar event.
*/
export interface CalendarMessageChoice extends ChoiceBase {
/** @see CalendarMessage */
calendar_message?: CalendarMessage;
// Exclude other choice types
call_message?: never;
location_message?: never;
text_message?: never;
url_message?: never;
share_location_message?: never;
}

/**
* Message requesting location from a user.
*/
export interface ShareLocationMessageChoice extends ChoiceBase {
/** @see ShareLocationMessage */
share_location_message?: ShareLocationMessage;
// Exclude other choice types
call_message?: never;
location_message?: never;
text_message?: never;
url_message?: never;
calendar_message?: never;
}
7 changes: 5 additions & 2 deletions packages/conversation/src/models/v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export * from './app-response';
export * from './app-update-request';
export * from './audit-record';
export * from './audit-records-list';
export * from './calendar-message';
export * from './call-message';
export * from './callback-settings';
export * from './card-message';
Expand Down Expand Up @@ -60,11 +61,12 @@ export * from './inject-event-response';
export * from './inject-message-request';
export * from './kakaotalk-button';
export * from './kakaotalk-carousel';
export * from './kakaotalk-carousel-commerce-message-content';
export * from './kakaotalk-carousel-commerce';
export * from './kakaotalk-commerce';
export * from './kakaotalk-commerce-message-content';
export * from './kakaotalk-coupon';
export * from './kakaotalk-image';
export * from './kakaotalk-message';
export * from './kakaotalk-pricing';
export * from './list-apps-response';
export * from './list-message';
export * from './list-section';
Expand All @@ -91,6 +93,7 @@ export * from './send-event-request';
export * from './send-event-response';
export * from './send-message-request';
export * from './send-message-response';
export * from './share-location-message';
export * from './smart-conversation';
export * from './template-message';
export * from './template-reference';
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type { KakaoTalkCarouselCommerce } from './kakaotalk-carousel-commerce';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { KakaoTalkCarousel } from '../kakaotalk-carousel';
/**
* Carousel content
*/
export interface KakaoTalkCarouselCommerceMessageContent {
export interface KakaoTalkCarouselCommerce {
/** Set to `true` if a push alarm should be sent to a device. */
push_alarm?: boolean;
/** Set to `true` if a message contains adult content. Set to `false` by default. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export type {
KakaoTalkCarousel,
KakaoTalkCarouselHead,
KakaoTalkCarouselList,
KakaoTalkCarouselTail,
} from './kakaotalk-carousel';
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { KakaoTalkCommerce } from '../kakaotalk-commerce';
import { KakaoTalkButton } from '../kakaotalk-button';
import { KakaoTalkCoupon } from '../kakaotalk-coupon';
import { KakaoTalkMessage } from '../kakaotalk-message';

/**
* Carousel content
Expand All @@ -9,7 +7,7 @@ export interface KakaoTalkCarousel {
/** Carousel introduction */
head?: KakaoTalkCarouselHead;
/** List of carousel cards */
list: KakaoTalkCarouselList[];
list: KakaoTalkMessage[];
/** "More" button */
tail?: KakaoTalkCarouselTail;
}
Expand Down Expand Up @@ -41,18 +39,3 @@ export interface KakaoTalkCarouselTail {
/** App link opened on an Android device (e.g. `tel://PHONE_NUMBER`) */
scheme_android?: string;
}

export interface KakaoTalkCarouselList {
/** Additional information */
additional_content?: string;
/** URL to the product image */
image_url: string;
/** URL opened when a user clicks on the image */
image_link?: string;
/** Product information */
commerce?: KakaoTalkCommerce;
/** Buttons list */
buttons: KakaoTalkButton[];
/** Discount coupon */
coupon?: KakaoTalkCoupon;
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
export type {
KakaoTalkCommerce,
KakaoTalkRegularPriceCommerce,
KakaoTalkDiscountFixedCommerce,
KakaoTalkDiscountRateCommerce,
} from './kakaotalk-commerce';
export type { KakaoTalkCommerce } from './kakaotalk-commerce';
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
export type KakaoTalkCommerce
= KakaoTalkRegularPriceCommerce
| KakaoTalkDiscountFixedCommerce
| KakaoTalkDiscountRateCommerce;
import { KakaoTalkMessage } from '../kakaotalk-message';

export interface KakaoTalkRegularPriceCommerce {
/** Product title */
title: string;
/** Regular price of the product */
regular_price: number;
}

export interface KakaoTalkDiscountFixedCommerce {
/** Product title */
title: string;
/** Regular price of the product */
regular_price: number;
/** Discounted price of the product */
discount_price: number;
/** Fixed discount */
discount_fixed: number;
}

export interface KakaoTalkDiscountRateCommerce {
/** Product title */
title: string;
/** Regular price of the product */
regular_price: number;
/** Discounted price of the product */
discount_price: number;
/** Discount rate (%) */
discount_rate: number;
export interface KakaoTalkCommerce extends KakaoTalkMessage{
/** Set to `true` if a push alarm should be sent to a device. */
push_alarm?: boolean;
/** Set to `true` if a message contains adult content. Set to `false` by default. */
adult?: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type { KakaoTalkMessage } from './kakaotalk-message';
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { KakaoTalkImage } from '../kakaotalk-image';
import { KakaoTalkPricing } from '../kakaotalk-pricing';
import { KakaoTalkButton } from '../kakaotalk-button';
import { KakaoTalkCoupon } from '../kakaotalk-coupon';

export interface KakaoTalkMessage {
/** Additional information */
additional_content?: string;
/** @see KakaoTalkCommerceImage */
image: KakaoTalkImage;
/** Product information */
commerce?: KakaoTalkPricing;
/** Buttons list */
buttons: KakaoTalkButton[];
/** Discount coupon */
coupon?: KakaoTalkCoupon;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export type {
KakaoTalkPricing,
KakaoTalkRegularPriceCommerce,
KakaoTalkDiscountFixedCommerce,
KakaoTalkDiscountRateCommerce,
} from './kakao-talk-pricing';
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export type KakaoTalkPricing
= KakaoTalkRegularPriceCommerce
| KakaoTalkDiscountFixedCommerce
| KakaoTalkDiscountRateCommerce;

export interface KakaoTalkRegularPriceCommerce {
/** Commerce with regular price */
type: 'REGULAR_PRICE_COMMERCE';
/** Product title */
title: string;
/** Regular price of the product */
regular_price: number;
}

export interface KakaoTalkDiscountFixedCommerce {
/** Commerce with fixed discount */
type: 'FIXED_DISCOUNT_COMMERCE';
/** Product title */
title: string;
/** Regular price of the product */
regular_price: number;
/** Discounted price of the product */
discount_price: number;
/** Fixed discount */
discount_fixed: number;
}

export interface KakaoTalkDiscountRateCommerce {
/** Commerce with percentage discount */
type: 'PERCENTAGE_DISCOUNT_COMMERCE';
/** Product title */
title: string;
/** Regular price of the product */
regular_price: number;
/** Discounted price of the product */
discount_price: number;
/** Discount rate (%) */
discount_rate: number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type { ShareLocationMessage } from './share-location-message';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface ShareLocationMessage {
/** The title is shown close to the button that leads to open a map to share a location. */
title: string;
/** The URL that is opened when channel does not have support for this type. */
fallback_url: string;
}
Loading
Loading