diff --git a/packages/conversation/src/models/v1/calendar-message/calendar-message.ts b/packages/conversation/src/models/v1/calendar-message/calendar-message.ts new file mode 100644 index 00000000..0e6d24a6 --- /dev/null +++ b/packages/conversation/src/models/v1/calendar-message/calendar-message.ts @@ -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; +} diff --git a/packages/conversation/src/models/v1/calendar-message/index.ts b/packages/conversation/src/models/v1/calendar-message/index.ts new file mode 100644 index 00000000..52edd12a --- /dev/null +++ b/packages/conversation/src/models/v1/calendar-message/index.ts @@ -0,0 +1 @@ +export type { CalendarMessage } from './calendar-message'; diff --git a/packages/conversation/src/models/v1/channel-specific-message/channel-specific-message.ts b/packages/conversation/src/models/v1/channel-specific-message/channel-specific-message.ts index e43e3514..cfa37db8 100644 --- a/packages/conversation/src/models/v1/channel-specific-message/channel-specific-message.ts +++ b/packages/conversation/src/models/v1/channel-specific-message/channel-specific-message.ts @@ -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). @@ -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; } diff --git a/packages/conversation/src/models/v1/choice/choice.ts b/packages/conversation/src/models/v1/choice/choice.ts index 5d20ce6c..eae86182 100644 --- a/packages/conversation/src/models/v1/choice/choice.ts +++ b/packages/conversation/src/models/v1/choice/choice.ts @@ -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. @@ -10,13 +12,18 @@ 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; @@ -24,8 +31,13 @@ export interface CallMessageChoice extends ChoiceBase { 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; @@ -33,8 +45,13 @@ export interface LocationMessageChoice extends ChoiceBase { 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; @@ -42,8 +59,13 @@ export interface TextMessageChoice extends ChoiceBase { 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; @@ -51,4 +73,34 @@ export interface UrlMessageChoice extends ChoiceBase { 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; } diff --git a/packages/conversation/src/models/v1/index.ts b/packages/conversation/src/models/v1/index.ts index 0ca1f7ab..0cb2b4fa 100644 --- a/packages/conversation/src/models/v1/index.ts +++ b/packages/conversation/src/models/v1/index.ts @@ -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'; @@ -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'; @@ -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'; diff --git a/packages/conversation/src/models/v1/kakaotalk-carousel-commerce-message-content/index.ts b/packages/conversation/src/models/v1/kakaotalk-carousel-commerce-message-content/index.ts deleted file mode 100644 index 0c438272..00000000 --- a/packages/conversation/src/models/v1/kakaotalk-carousel-commerce-message-content/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { KakaoTalkCarouselCommerceMessageContent } from './kakaotalk-carousel-commerce-message-content'; diff --git a/packages/conversation/src/models/v1/kakaotalk-carousel-commerce/index.ts b/packages/conversation/src/models/v1/kakaotalk-carousel-commerce/index.ts new file mode 100644 index 00000000..2c90acd4 --- /dev/null +++ b/packages/conversation/src/models/v1/kakaotalk-carousel-commerce/index.ts @@ -0,0 +1 @@ +export type { KakaoTalkCarouselCommerce } from './kakaotalk-carousel-commerce'; diff --git a/packages/conversation/src/models/v1/kakaotalk-carousel-commerce-message-content/kakaotalk-carousel-commerce-message-content.ts b/packages/conversation/src/models/v1/kakaotalk-carousel-commerce/kakaotalk-carousel-commerce.ts similarity index 85% rename from packages/conversation/src/models/v1/kakaotalk-carousel-commerce-message-content/kakaotalk-carousel-commerce-message-content.ts rename to packages/conversation/src/models/v1/kakaotalk-carousel-commerce/kakaotalk-carousel-commerce.ts index 78a5b40f..1e2959d8 100644 --- a/packages/conversation/src/models/v1/kakaotalk-carousel-commerce-message-content/kakaotalk-carousel-commerce-message-content.ts +++ b/packages/conversation/src/models/v1/kakaotalk-carousel-commerce/kakaotalk-carousel-commerce.ts @@ -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. */ diff --git a/packages/conversation/src/models/v1/kakaotalk-carousel/index.ts b/packages/conversation/src/models/v1/kakaotalk-carousel/index.ts index 87c02308..41fde1c6 100644 --- a/packages/conversation/src/models/v1/kakaotalk-carousel/index.ts +++ b/packages/conversation/src/models/v1/kakaotalk-carousel/index.ts @@ -1,6 +1,5 @@ export type { KakaoTalkCarousel, KakaoTalkCarouselHead, - KakaoTalkCarouselList, KakaoTalkCarouselTail, } from './kakaotalk-carousel'; diff --git a/packages/conversation/src/models/v1/kakaotalk-carousel/kakaotalk-carousel.ts b/packages/conversation/src/models/v1/kakaotalk-carousel/kakaotalk-carousel.ts index 1b29e73d..84248263 100644 --- a/packages/conversation/src/models/v1/kakaotalk-carousel/kakaotalk-carousel.ts +++ b/packages/conversation/src/models/v1/kakaotalk-carousel/kakaotalk-carousel.ts @@ -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 @@ -9,7 +7,7 @@ export interface KakaoTalkCarousel { /** Carousel introduction */ head?: KakaoTalkCarouselHead; /** List of carousel cards */ - list: KakaoTalkCarouselList[]; + list: KakaoTalkMessage[]; /** "More" button */ tail?: KakaoTalkCarouselTail; } @@ -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; -} diff --git a/packages/conversation/src/models/v1/kakaotalk-commerce-message-content/index.ts b/packages/conversation/src/models/v1/kakaotalk-commerce-message-content/index.ts deleted file mode 100644 index 2e0b779c..00000000 --- a/packages/conversation/src/models/v1/kakaotalk-commerce-message-content/index.ts +++ /dev/null @@ -1 +0,0 @@ -export type { KakaoTalkCommerceMessageContent } from './kakaotalk-commerce-message-content'; diff --git a/packages/conversation/src/models/v1/kakaotalk-commerce-message-content/kakaotalk-commerce-message-content.ts b/packages/conversation/src/models/v1/kakaotalk-commerce-message-content/kakaotalk-commerce-message-content.ts deleted file mode 100644 index 39a19d3c..00000000 --- a/packages/conversation/src/models/v1/kakaotalk-commerce-message-content/kakaotalk-commerce-message-content.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { KakaoTalkButton } from '../kakaotalk-button'; -import { KakaoTalkImage } from '../kakaotalk-image'; -import { KakaoTalkCommerce } from '../kakaotalk-commerce'; -import { KakaoTalkCoupon } from '../kakaotalk-coupon'; - -export interface KakaoTalkCommerceMessageContent { - /** 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; - /** Buttons list */ - buttons: KakaoTalkButton[]; - /** Additional information */ - additional_content?: string; - /** @see KakaoTalkCommerceImage */ - image: KakaoTalkImage; - /** @see KakaoTalkCommerceCommerce */ - commerce: KakaoTalkCommerce; - /** @see KakaoTalkCommerceCoupon */ - coupon?: KakaoTalkCoupon; -} diff --git a/packages/conversation/src/models/v1/kakaotalk-commerce/index.ts b/packages/conversation/src/models/v1/kakaotalk-commerce/index.ts index 1661da18..3039de30 100644 --- a/packages/conversation/src/models/v1/kakaotalk-commerce/index.ts +++ b/packages/conversation/src/models/v1/kakaotalk-commerce/index.ts @@ -1,6 +1 @@ -export type { - KakaoTalkCommerce, - KakaoTalkRegularPriceCommerce, - KakaoTalkDiscountFixedCommerce, - KakaoTalkDiscountRateCommerce, -} from './kakaotalk-commerce'; +export type { KakaoTalkCommerce } from './kakaotalk-commerce'; diff --git a/packages/conversation/src/models/v1/kakaotalk-commerce/kakaotalk-commerce.ts b/packages/conversation/src/models/v1/kakaotalk-commerce/kakaotalk-commerce.ts index 584f944e..fc328896 100644 --- a/packages/conversation/src/models/v1/kakaotalk-commerce/kakaotalk-commerce.ts +++ b/packages/conversation/src/models/v1/kakaotalk-commerce/kakaotalk-commerce.ts @@ -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; } diff --git a/packages/conversation/src/models/v1/kakaotalk-message/index.ts b/packages/conversation/src/models/v1/kakaotalk-message/index.ts new file mode 100644 index 00000000..01465aa2 --- /dev/null +++ b/packages/conversation/src/models/v1/kakaotalk-message/index.ts @@ -0,0 +1 @@ +export type { KakaoTalkMessage } from './kakaotalk-message'; diff --git a/packages/conversation/src/models/v1/kakaotalk-message/kakaotalk-message.ts b/packages/conversation/src/models/v1/kakaotalk-message/kakaotalk-message.ts new file mode 100644 index 00000000..b7cb992e --- /dev/null +++ b/packages/conversation/src/models/v1/kakaotalk-message/kakaotalk-message.ts @@ -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; +} diff --git a/packages/conversation/src/models/v1/kakaotalk-pricing/index.ts b/packages/conversation/src/models/v1/kakaotalk-pricing/index.ts new file mode 100644 index 00000000..53d25968 --- /dev/null +++ b/packages/conversation/src/models/v1/kakaotalk-pricing/index.ts @@ -0,0 +1,6 @@ +export type { + KakaoTalkPricing, + KakaoTalkRegularPriceCommerce, + KakaoTalkDiscountFixedCommerce, + KakaoTalkDiscountRateCommerce, +} from './kakao-talk-pricing'; diff --git a/packages/conversation/src/models/v1/kakaotalk-pricing/kakao-talk-pricing.ts b/packages/conversation/src/models/v1/kakaotalk-pricing/kakao-talk-pricing.ts new file mode 100644 index 00000000..66be5265 --- /dev/null +++ b/packages/conversation/src/models/v1/kakaotalk-pricing/kakao-talk-pricing.ts @@ -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; +} diff --git a/packages/conversation/src/models/v1/share-location-message/index.ts b/packages/conversation/src/models/v1/share-location-message/index.ts new file mode 100644 index 00000000..fe4d0961 --- /dev/null +++ b/packages/conversation/src/models/v1/share-location-message/index.ts @@ -0,0 +1 @@ +export type { ShareLocationMessage } from './share-location-message'; diff --git a/packages/conversation/src/models/v1/share-location-message/share-location-message.ts b/packages/conversation/src/models/v1/share-location-message/share-location-message.ts new file mode 100644 index 00000000..4c470196 --- /dev/null +++ b/packages/conversation/src/models/v1/share-location-message/share-location-message.ts @@ -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; +} diff --git a/packages/conversation/tests/models/v1/channel-specific-message.ts b/packages/conversation/tests/models/v1/channel-specific-message.ts index 9869f3d3..b7c89279 100644 --- a/packages/conversation/tests/models/v1/channel-specific-message.ts +++ b/packages/conversation/tests/models/v1/channel-specific-message.ts @@ -94,11 +94,9 @@ export const kakaoTalkCommerceMessage = { image_link: 'https://example.com', }, commerce: { + type: 'REGULAR_PRICE_COMMERCE', title: 'Product 1', regular_price: 10000, - discount_price: 5000, - discount_fixed: 1000, - discount_rate: 10, }, buttons: [ { @@ -126,7 +124,9 @@ export const kakaoTalkCarouselCommerceMessage = { carousel: { list: [ { - image_url: 'https://example.com/image.jpg', + image: { + image_url: 'https://example.com/image.jpg', + }, buttons: [ { type: 'WL', diff --git a/packages/conversation/tests/models/v1/choice.ts b/packages/conversation/tests/models/v1/choice.ts new file mode 100644 index 00000000..9dc06304 --- /dev/null +++ b/packages/conversation/tests/models/v1/choice.ts @@ -0,0 +1,57 @@ +import { CallMessageChoice, LocationMessageChoice, TextMessageChoice, UrlMessageChoice } from '../../../src/models'; +import { CalendarMessageChoice, ShareLocationMessageChoice } from '../../../src/models/v1/choice/choice'; + +export const callMessageChoice = { + call_message: { + title: 'Call me', + phone_number: '+1234567890', + }, + postback_data: 'call_postback_123', +} satisfies CallMessageChoice; + +export const locationMessageChoice = { + location_message: { + title: 'Send my location', + coordinates: { + latitude: 48.0378283, + longitude: -4.751659, + }, + label: 'Send my location', + }, + postback_data: 'location_postback_123', +} satisfies LocationMessageChoice; + +export const textMessageChoice = { + text_message: { + text: 'Hello, this is a text message choice!', + }, + postback_data: 'text_postback_123', +} satisfies TextMessageChoice; + +export const urlMessageChoice = { + url_message: { + url: 'https://example.com', + title: 'Visit our website', + }, + postback_data: 'url_postback_123', +} satisfies UrlMessageChoice; + +export const calendarMessageChoice = { + calendar_message: { + title: 'Schedule a meeting', + event_title: 'Meeting with Team', + event_description: 'Discuss project updates and next steps.', + event_start: new Date('2026-01-15T10:00:00Z'), + event_end: new Date('2026-01-15T11:00:00Z'), + fallback_url: 'https://example.com/calendar', + }, + postback_data: 'calendar_postback_123', +} satisfies CalendarMessageChoice; + +export const shareLocationMessageChoice = { + share_location_message: { + title: 'Share my location', + fallback_url: 'https://example.com/share-location', + }, + postback_data: 'share_location_postback_123', +} satisfies ShareLocationMessageChoice; diff --git a/packages/conversation/tests/models/v1/kakaotalk-carousel-commerce-message-content.ts b/packages/conversation/tests/models/v1/kakaotalk-carousel-commerce.ts similarity index 58% rename from packages/conversation/tests/models/v1/kakaotalk-carousel-commerce-message-content.ts rename to packages/conversation/tests/models/v1/kakaotalk-carousel-commerce.ts index 50efdee1..d7b6378c 100644 --- a/packages/conversation/tests/models/v1/kakaotalk-carousel-commerce-message-content.ts +++ b/packages/conversation/tests/models/v1/kakaotalk-carousel-commerce.ts @@ -1,8 +1,8 @@ -import { KakaoTalkCarouselCommerceMessageContent } from '../../../src/models'; +import { KakaoTalkCarouselCommerce } from '../../../src/models'; import { kakaotalkCarousel } from './kakaotalk-carousel'; export const kakaotalkCarouselCommerceMessageContent = { push_alarm: false, adult: false, carousel: kakaotalkCarousel, -} satisfies KakaoTalkCarouselCommerceMessageContent; +} satisfies KakaoTalkCarouselCommerce; diff --git a/packages/conversation/tests/models/v1/kakaotalk-carousel.ts b/packages/conversation/tests/models/v1/kakaotalk-carousel.ts index e0ed877f..92944300 100644 --- a/packages/conversation/tests/models/v1/kakaotalk-carousel.ts +++ b/packages/conversation/tests/models/v1/kakaotalk-carousel.ts @@ -1,11 +1,11 @@ import { KakaoTalkCarousel, KakaoTalkCarouselHead, - KakaoTalkCarouselList, KakaoTalkCarouselTail, + KakaoTalkMessage, } from '../../../src/models'; import { kakaotalkAppLinkButton, kakaotalkWebLinkButton } from './kakaotalk-button'; -import { kakaoTalkRegularPriceCommerce } from './kakaotalk-commerce'; +import { kakaoTalkRegularPriceCommerce } from './kakaotalk-pricing'; import { kakaoTalkFixedDiscountCoupon } from './kakaotalk-coupon'; export const kakaoTalkCarouselHead = { @@ -27,15 +27,17 @@ export const kakaotalkCarouselTail = { export const kakaotalkCarouselListItem1 = { additional_content: 'additional content', - image_url: 'https://example.com/image.png', - image_link: 'https://example.com', + image: { + image_url: 'https://example.com/image.png', + image_link: 'https://example.com', + }, commerce: kakaoTalkRegularPriceCommerce, buttons: [ kakaotalkWebLinkButton, kakaotalkAppLinkButton, ], coupon: kakaoTalkFixedDiscountCoupon, -} satisfies KakaoTalkCarouselList; +} satisfies KakaoTalkMessage; export const kakaotalkCarousel = { head: kakaoTalkCarouselHead, diff --git a/packages/conversation/tests/models/v1/kakaotalk-commerce-message-content.ts b/packages/conversation/tests/models/v1/kakaotalk-commerce-message-content.ts deleted file mode 100644 index d5ca4cce..00000000 --- a/packages/conversation/tests/models/v1/kakaotalk-commerce-message-content.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { KakaoTalkCommerceMessageContent } from '../../../src/models'; -import { kakaotalkAppLinkButton, kakaotalkWebLinkButton } from './kakaotalk-button'; -import { kakaoTalkDiscountFixedCommerce } from './kakaotalk-commerce'; -import { kakaoTalkDiscountRateCoupon } from './kakaotalk-coupon'; -import { kakaoTalkImage } from './kakaotalk-image'; - -export const kakaotalkCommerceMessageContent = { - push_alarm: false, - adult: false, - buttons: [ - kakaotalkWebLinkButton, - kakaotalkAppLinkButton, - ], - additional_content: 'additional content', - image: kakaoTalkImage, - commerce: kakaoTalkDiscountFixedCommerce, - coupon: kakaoTalkDiscountRateCoupon, -} satisfies KakaoTalkCommerceMessageContent; diff --git a/packages/conversation/tests/models/v1/kakaotalk-commerce.ts b/packages/conversation/tests/models/v1/kakaotalk-commerce.ts index c0701609..651dba3d 100644 --- a/packages/conversation/tests/models/v1/kakaotalk-commerce.ts +++ b/packages/conversation/tests/models/v1/kakaotalk-commerce.ts @@ -1,24 +1,18 @@ -import { - KakaoTalkRegularPriceCommerce, - KakaoTalkDiscountFixedCommerce, - KakaoTalkDiscountRateCommerce, -} from '../../../src/models'; +import { KakaoTalkCommerce } from '../../../src/models'; +import { kakaotalkAppLinkButton, kakaotalkWebLinkButton } from './kakaotalk-button'; +import { kakaoTalkDiscountFixedCommerce } from './kakaotalk-pricing'; +import { kakaoTalkDiscountRateCoupon } from './kakaotalk-coupon'; +import { kakaoTalkImage } from './kakaotalk-image'; -export const kakaoTalkRegularPriceCommerce = { - title: 'title', - regular_price: 1000, -} satisfies KakaoTalkRegularPriceCommerce; - -export const kakaoTalkDiscountFixedCommerce = { - title: 'title', - regular_price: 1000, - discount_price: 500, - discount_fixed: 500, -} satisfies KakaoTalkDiscountFixedCommerce; - -export const kakaoTalkDiscountRateCommerce = { - title: 'title', - regular_price: 1000, - discount_price: 500, - discount_rate: 50, -} satisfies KakaoTalkDiscountRateCommerce; +export const kakaotalkCommerceMessageContent = { + push_alarm: false, + adult: false, + buttons: [ + kakaotalkWebLinkButton, + kakaotalkAppLinkButton, + ], + additional_content: 'additional content', + image: kakaoTalkImage, + commerce: kakaoTalkDiscountFixedCommerce, + coupon: kakaoTalkDiscountRateCoupon, +} satisfies KakaoTalkCommerce; diff --git a/packages/conversation/tests/models/v1/kakaotalk-pricing.ts b/packages/conversation/tests/models/v1/kakaotalk-pricing.ts new file mode 100644 index 00000000..5a184356 --- /dev/null +++ b/packages/conversation/tests/models/v1/kakaotalk-pricing.ts @@ -0,0 +1,27 @@ +import { + KakaoTalkRegularPriceCommerce, + KakaoTalkDiscountFixedCommerce, + KakaoTalkDiscountRateCommerce, +} from '../../../src/models'; + +export const kakaoTalkRegularPriceCommerce = { + type: 'REGULAR_PRICE_COMMERCE', + title: 'title', + regular_price: 1000, +} satisfies KakaoTalkRegularPriceCommerce; + +export const kakaoTalkDiscountFixedCommerce = { + type: 'FIXED_DISCOUNT_COMMERCE', + title: 'title', + regular_price: 1000, + discount_price: 500, + discount_fixed: 500, +} satisfies KakaoTalkDiscountFixedCommerce; + +export const kakaoTalkDiscountRateCommerce = { + type: 'PERCENTAGE_DISCOUNT_COMMERCE', + title: 'title', + regular_price: 1000, + discount_price: 500, + discount_rate: 50, +} satisfies KakaoTalkDiscountRateCommerce;