@anker-in/headless-ui 1.3.82 → 1.3.84-alpha.1793930979098

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.
Files changed (169) hide show
  1. package/CONTRIBUTING.md +57 -0
  2. package/dist/cjs/biz-components/ActivitySchedule/index.js +1 -1
  3. package/dist/cjs/biz-components/BrandEquity/BrandEquity.d.ts +2 -0
  4. package/dist/cjs/biz-components/BrandEquity/BrandEquity.js +1 -1
  5. package/dist/cjs/biz-components/BrandEquity/types.d.ts +2 -0
  6. package/dist/cjs/biz-components/BrandEquity/types.js +1 -1
  7. package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
  8. package/dist/cjs/biz-components/Chat/action.d.ts +25 -0
  9. package/dist/cjs/biz-components/Chat/action.js +1 -0
  10. package/dist/cjs/biz-components/Chat/button.d.ts +3 -0
  11. package/dist/cjs/biz-components/Chat/button.js +1 -0
  12. package/dist/cjs/biz-components/Chat/chatContext.d.ts +101 -0
  13. package/dist/cjs/biz-components/Chat/chatContext.js +1 -0
  14. package/dist/cjs/biz-components/Chat/exports.d.ts +3 -0
  15. package/dist/cjs/biz-components/Chat/exports.js +1 -0
  16. package/dist/cjs/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
  17. package/dist/cjs/biz-components/Chat/helpers/fetchResponse.js +1 -0
  18. package/dist/cjs/biz-components/Chat/helpers/fetcher.d.ts +2 -0
  19. package/dist/cjs/biz-components/Chat/helpers/fetcher.js +1 -0
  20. package/dist/cjs/biz-components/Chat/index.d.ts +71 -0
  21. package/dist/cjs/biz-components/Chat/index.js +1 -0
  22. package/dist/cjs/biz-components/Chat/markdown.d.ts +5 -0
  23. package/dist/cjs/biz-components/Chat/markdown.js +1 -0
  24. package/dist/cjs/biz-components/Chat/messages.d.ts +3 -0
  25. package/dist/cjs/biz-components/Chat/messages.js +1 -0
  26. package/dist/cjs/biz-components/Chat/props.d.ts +43 -0
  27. package/dist/cjs/biz-components/Chat/props.js +1 -0
  28. package/dist/cjs/biz-components/Chat/response.d.ts +4 -0
  29. package/dist/cjs/biz-components/Chat/response.js +1 -0
  30. package/dist/cjs/biz-components/Chat/suggestions.d.ts +3 -0
  31. package/dist/cjs/biz-components/Chat/suggestions.js +1 -0
  32. package/dist/cjs/biz-components/Chat/utils.d.ts +3 -0
  33. package/dist/cjs/biz-components/Chat/utils.js +1 -0
  34. package/dist/cjs/biz-components/FooterNavigation/index.js +1 -1
  35. package/dist/cjs/biz-components/Graphic/index.js +1 -1
  36. package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
  37. package/dist/cjs/biz-components/ImageWithText/types.d.ts +8 -2
  38. package/dist/cjs/biz-components/ImageWithText/types.js +1 -1
  39. package/dist/cjs/biz-components/Ksp/index.d.ts +2 -0
  40. package/dist/cjs/biz-components/Ksp/index.js +1 -1
  41. package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
  42. package/dist/cjs/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  43. package/dist/cjs/biz-components/Listing/hooks/useStickyFlip.d.ts +20 -0
  44. package/dist/cjs/biz-components/Listing/hooks/useStickyFlip.js +1 -0
  45. package/dist/cjs/biz-components/MarqueeReview/index.js +1 -1
  46. package/dist/cjs/biz-components/MediaPlayerBase/index.js +1 -1
  47. package/dist/cjs/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.js +2 -2
  48. package/dist/cjs/biz-components/MiniCart/CircleProgress.js +2 -2
  49. package/dist/cjs/biz-components/MiniCart/MiniCartDialog.js +1 -1
  50. package/dist/cjs/biz-components/MiniCart/index.d.ts +6 -3
  51. package/dist/cjs/biz-components/MiniCart/index.js +1 -1
  52. package/dist/cjs/biz-components/ProductCompare/index.d.ts +1 -1
  53. package/dist/cjs/biz-components/ProductCompare/index.js +1 -1
  54. package/dist/cjs/biz-components/ProductHero/ProductHero.js +1 -1
  55. package/dist/cjs/biz-components/ProductHero/types.d.ts +2 -0
  56. package/dist/cjs/biz-components/ProductHero/types.js +1 -1
  57. package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
  58. package/dist/cjs/biz-components/SceneShelf/ProductCard.js +1 -1
  59. package/dist/cjs/biz-components/SceneShelf/ProductsPanel.js +1 -1
  60. package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
  61. package/dist/cjs/biz-components/Specs/dropdown.js +1 -2
  62. package/dist/cjs/biz-components/Specs/index.js +1 -1
  63. package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
  64. package/dist/cjs/biz-components/Title/index.js +1 -1
  65. package/dist/cjs/components/link.js +1 -1
  66. package/dist/cjs/hooks/useDraggableScroll.js +1 -1
  67. package/dist/cjs/hooks/useExposure.d.ts +1 -1
  68. package/dist/cjs/hooks/useExposure.js +1 -1
  69. package/dist/cjs/hooks/useViewItemList.d.ts +1 -1
  70. package/dist/cjs/index.d.ts +2 -0
  71. package/dist/cjs/index.js +1 -1
  72. package/dist/cjs/shared/ContainerGridContext.d.ts +20 -0
  73. package/dist/cjs/shared/ContainerGridContext.js +1 -0
  74. package/dist/cjs/shared/Styles.d.ts +2 -0
  75. package/dist/cjs/shared/Styles.js +1 -1
  76. package/dist/cjs/shared/mediaGridSpec.d.ts +87 -0
  77. package/dist/cjs/shared/mediaGridSpec.js +1 -0
  78. package/dist/esm/biz-components/ActivitySchedule/index.js +1 -1
  79. package/dist/esm/biz-components/BrandEquity/BrandEquity.d.ts +2 -0
  80. package/dist/esm/biz-components/BrandEquity/BrandEquity.js +1 -1
  81. package/dist/esm/biz-components/BrandEquity/types.d.ts +2 -0
  82. package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
  83. package/dist/esm/biz-components/Chat/action.d.ts +25 -0
  84. package/dist/esm/biz-components/Chat/action.js +1 -0
  85. package/dist/esm/biz-components/Chat/button.d.ts +3 -0
  86. package/dist/esm/biz-components/Chat/button.js +1 -0
  87. package/dist/esm/biz-components/Chat/chatContext.d.ts +101 -0
  88. package/dist/esm/biz-components/Chat/chatContext.js +1 -0
  89. package/dist/esm/biz-components/Chat/exports.d.ts +3 -0
  90. package/dist/esm/biz-components/Chat/exports.js +1 -0
  91. package/dist/esm/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
  92. package/dist/esm/biz-components/Chat/helpers/fetchResponse.js +1 -0
  93. package/dist/esm/biz-components/Chat/helpers/fetcher.d.ts +2 -0
  94. package/dist/esm/biz-components/Chat/helpers/fetcher.js +1 -0
  95. package/dist/esm/biz-components/Chat/index.d.ts +71 -0
  96. package/dist/esm/biz-components/Chat/index.js +1 -0
  97. package/dist/esm/biz-components/Chat/markdown.d.ts +5 -0
  98. package/dist/esm/biz-components/Chat/markdown.js +1 -0
  99. package/dist/esm/biz-components/Chat/messages.d.ts +3 -0
  100. package/dist/esm/biz-components/Chat/messages.js +1 -0
  101. package/dist/esm/biz-components/Chat/props.d.ts +43 -0
  102. package/dist/esm/biz-components/Chat/props.js +1 -0
  103. package/dist/esm/biz-components/Chat/response.d.ts +4 -0
  104. package/dist/esm/biz-components/Chat/response.js +1 -0
  105. package/dist/esm/biz-components/Chat/suggestions.d.ts +3 -0
  106. package/dist/esm/biz-components/Chat/suggestions.js +1 -0
  107. package/dist/esm/biz-components/Chat/utils.d.ts +3 -0
  108. package/dist/esm/biz-components/Chat/utils.js +1 -0
  109. package/dist/esm/biz-components/FooterNavigation/index.js +1 -1
  110. package/dist/esm/biz-components/Graphic/index.js +1 -1
  111. package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
  112. package/dist/esm/biz-components/ImageWithText/types.d.ts +8 -2
  113. package/dist/esm/biz-components/Ksp/index.d.ts +2 -0
  114. package/dist/esm/biz-components/Ksp/index.js +1 -1
  115. package/dist/esm/biz-components/Listing/components/ProductCard/ProductGridBox.js +1 -1
  116. package/dist/esm/biz-components/Listing/components/PurchaseBar/ProductActions/index.js +1 -1
  117. package/dist/esm/biz-components/Listing/hooks/useStickyFlip.d.ts +20 -0
  118. package/dist/esm/biz-components/Listing/hooks/useStickyFlip.js +1 -0
  119. package/dist/esm/biz-components/MarqueeReview/index.js +1 -1
  120. package/dist/esm/biz-components/MediaPlayerBase/index.js +1 -1
  121. package/dist/esm/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.js +2 -2
  122. package/dist/esm/biz-components/MiniCart/CircleProgress.js +2 -2
  123. package/dist/esm/biz-components/MiniCart/MiniCartDialog.js +1 -1
  124. package/dist/esm/biz-components/MiniCart/index.d.ts +6 -3
  125. package/dist/esm/biz-components/MiniCart/index.js +1 -1
  126. package/dist/esm/biz-components/ProductCompare/index.d.ts +1 -1
  127. package/dist/esm/biz-components/ProductCompare/index.js +1 -1
  128. package/dist/esm/biz-components/ProductHero/ProductHero.js +1 -1
  129. package/dist/esm/biz-components/ProductHero/types.d.ts +2 -0
  130. package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
  131. package/dist/esm/biz-components/SceneShelf/ProductCard.js +1 -1
  132. package/dist/esm/biz-components/SceneShelf/ProductsPanel.js +1 -1
  133. package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
  134. package/dist/esm/biz-components/Specs/dropdown.js +1 -2
  135. package/dist/esm/biz-components/Specs/index.js +1 -1
  136. package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
  137. package/dist/esm/biz-components/Title/index.js +1 -1
  138. package/dist/esm/components/link.js +1 -1
  139. package/dist/esm/hooks/useDraggableScroll.js +1 -1
  140. package/dist/esm/hooks/useExposure.d.ts +1 -1
  141. package/dist/esm/hooks/useExposure.js +1 -1
  142. package/dist/esm/hooks/useViewItemList.d.ts +1 -1
  143. package/dist/esm/index.d.ts +2 -0
  144. package/dist/esm/index.js +1 -1
  145. package/dist/esm/shared/ContainerGridContext.d.ts +20 -0
  146. package/dist/esm/shared/ContainerGridContext.js +1 -0
  147. package/dist/esm/shared/Styles.d.ts +2 -0
  148. package/dist/esm/shared/Styles.js +1 -1
  149. package/dist/esm/shared/mediaGridSpec.d.ts +87 -0
  150. package/dist/esm/shared/mediaGridSpec.js +1 -0
  151. package/package.json +54 -4
  152. package/src/biz-components/Chat/styles/chat.css +14 -0
  153. package/src/biz-components/Chat/styles/css/animations.css +35 -0
  154. package/src/biz-components/Chat/styles/css/button.css +56 -0
  155. package/src/biz-components/Chat/styles/css/colors.css +12 -0
  156. package/src/biz-components/Chat/styles/css/console.css +134 -0
  157. package/src/biz-components/Chat/styles/css/header.css +43 -0
  158. package/src/biz-components/Chat/styles/css/input.css +89 -0
  159. package/src/biz-components/Chat/styles/css/markdown.css +131 -0
  160. package/src/biz-components/Chat/styles/css/messages.css +85 -0
  161. package/src/biz-components/Chat/styles/css/panel.css +23 -0
  162. package/src/biz-components/Chat/styles/css/popup.css +44 -0
  163. package/src/biz-components/Chat/styles/css/response.css +25 -0
  164. package/src/biz-components/Chat/styles/css/sidebar.css +31 -0
  165. package/src/biz-components/Chat/styles/css/suggestions.css +36 -0
  166. package/src/biz-components/Chat/styles/css/window.css +60 -0
  167. package/src/biz-components/Chat/styles/image.png +0 -0
  168. package/style.css +271 -142
  169. package/tailwind.config.js +5 -0
package/CONTRIBUTING.md CHANGED
@@ -221,6 +221,63 @@ alert('Example of disabled line for no-alert')
221
221
 
222
222
  ❗ 在ui/目录下的代码导入的时候,要带上.js后缀,比如 import { cn } from '../helpers/index.js' 否则在使用的时候会出现 ERR_UNSUPPORTED_DIR_IMPORT 问题
223
223
 
224
+ # 媒体字段断点命名(ADR 0010,增量强制)
225
+
226
+ 业务组件中「断点族媒体字段」(承载图片/视频/海报引用、按断点区分尺寸的字段)必须遵守与 Tailwind 断点对齐的 canonical 5 端命名:
227
+
228
+ | 断点 | canonical 字段名(image 族) | video / poster 族同理 |
229
+ | ---- | ---- | ---- |
230
+ | mobile 基线(<768px) | `image`(无前缀 = 移动优先基线) | `video` / `poster` |
231
+ | tablet(≥768px) | `tabletImage` | `tabletVideo` / `tabletPoster` |
232
+ | laptop(≥1025px) | `laptopImage` | `laptopVideo` / `laptopPoster` |
233
+ | desktop(≥1440px) | `desktopImage` | `desktopVideo` / `desktopPoster` |
234
+ | lg-desktop(≥1920px) | `lgDesktopImage` | `lgDesktopVideo` / `lgDesktopPoster` |
235
+
236
+ ```tsx
237
+ // ✅ 合规
238
+ export interface MyCompItem {
239
+ image: Media
240
+ tabletImage?: Media
241
+ laptopImage?: Media
242
+ desktopImage?: Media
243
+ lgDesktopImage?: Media
244
+ }
245
+
246
+ // ❌ 违规(pad/mob/pc 前缀、后缀式、嵌套裸断点键均不合规)
247
+ export interface MyCompItem {
248
+ pcImage: Media
249
+ padImage?: Media
250
+ mobImage?: Media
251
+ imgPad?: Media
252
+ backgroundImage?: { mobile?: Media; tablet?: Media }
253
+ }
254
+ ```
255
+
256
+ **豁免**:语义媒体(`icon` / `avatar` / `logo` 等单尺寸小图)无断点概念,不需要断点前缀,保持原样即合规。
257
+
258
+ ## lint 闸门与 ratchet 快照(grandfather)
259
+
260
+ 命名检查由 `scripts/check-material-naming.mjs` 实现,已接入 `pnpm lint`(`pnpm --filter @anker-in/headless-ui run lint`),CI / pre-commit 均经此入口拦截:
261
+
262
+ - **新组件 / 新增媒体字段**不合规 → lint 红,报错信息含 canonical 写法与 `material-meta.json` 的 `fieldMap` 逃生舱指引(字段名已写进生产 PageConfig、无法改名时,用 fieldMap 显式声明字段→断点映射,这是合法终态而非临时豁免)。
263
+ - **存量不合规字段**(`imgPad` / `imageMob` / `padImage` / 嵌套 `backgroundImage.{mobile...}` 等)记录在 `scripts/material-naming-snapshot.json`,被 grandfather 不报错——不做 big-bang 迁移,存量字段名已固化在 CMS 数据里,改名 = 数据迁移。
264
+ - 快照**只减不增**:字段从源码消失后重新生成快照即自动收紧;快照中不存在的字段永远报错。
265
+
266
+ 单独运行:
267
+
268
+ ```shell
269
+ pnpm --filter @anker-in/headless-ui run lint:material-naming # 检查
270
+ pnpm --filter @anker-in/headless-ui run lint:material-naming:update # 重新生成快照
271
+ ```
272
+
273
+ ## 随 touch 迁移(touch-to-migrate)
274
+
275
+ eslint 无法感知「本次 PR 是否改动了某字段」,因此存量字段的合规化提示由 PR review 承担:
276
+
277
+ - 你的 PR 若**触及**某组件的媒体字段(新增、修改、挪动),请顺手将该字段合规化(改名 + 组件内 fallback 兼容旧名),或在该组件的 `material-meta.json` 中显式声明 `fieldMap`。
278
+ - 字段合规化后运行 `lint:material-naming:update` 收紧快照,被迁移的字段从快照中移除,之后任何人再引入该旧名都会 lint 红。
279
+ - 判定逻辑(哪个字段是媒体、哪个名字合规)全仓单点在 `src/material/breakpoints.ts`(`isMediaField` / `isCanonicalMediaFieldName`),本检查脚本直接复用,勿在别处复制第二份词表。
280
+
224
281
  # Tesing
225
282
 
226
283
  unit test 使用 [jest](https://jestjs.io/) 和 [@test-library/react](https://testing-library.com/)。
@@ -1 +1 @@
1
- "use strict";"use client";var C=Object.create;var p=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var a in t)p(e,a,{get:t[a],enumerable:!0})},g=(e,t,a,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of V(t))!I.call(e,s)&&s!==a&&p(e,s,{get:()=>t[s],enumerable:!(c=P(t,s))||c.enumerable});return e};var L=(e,t,a)=>(a=e!=null?C(z(e)):{},g(t||!e||!e.__esModule?p(a,"default",{value:e,enumerable:!0}):a,e)),E=e=>g(p({},"__esModule",{value:!0}),e);var R={};B(R,{default:()=>M});module.exports=E(R);var i=require("react/jsx-runtime"),v=L(require("react")),d=require("../../helpers/index.js"),l=require("../../components/index.js"),f=require("class-variance-authority"),h=require("swiper/react"),y=require("../../shared/Styles.js");const j=(0,f.cva)("rounded-card laptop:px-6 laptop:py-4 relative flex min-w-0 flex-col justify-between gap-2 overflow-hidden px-4 py-3",{variants:{state:{"active-light":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","active-dark":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","inactive-light":"bg-[#EAEAEC]","inactive-dark":"bg-[#1E2024]"},size:{small:"laptop:h-[160px] h-[120px]",large:"laptop:h-[240px] h-[200px]"}},defaultVariants:{state:"inactive-light",size:"small"}}),m=(0,f.cva)("font-bold leading-[1.2]",{variants:{state:{"active-light":"text-white","active-dark":"text-white","inactive-light":"text-[#080A0F]","inactive-dark":"text-white"}},defaultVariants:{state:"inactive-light"}}),w=v.memo(({item:e,theme:t="light",className:a,size:c})=>{const s=e.isActive||!1,o=`${s?"active":"inactive"}-${t}`;return(0,i.jsx)("div",{className:(0,d.cn)(j({state:o,size:c}),a),"data-ui-component-id":"ActivityScheduleCard",children:(0,i.jsxs)(l.Link,{asChild:!e?.link,href:e?.link,className:"size-full no-underline hover:text-current",children:[(s?e.activeIcon:e.inactiveIcon)&&(0,i.jsx)("div",{className:"laptop:w-[160px] aspect-1 absolute right-0 top-0 z-10 w-[120px]",children:(0,i.jsx)(l.Picture,{source:s?e.activeIcon.url:e.inactiveIcon.url,alt:s?e.activeIcon.alt:e.inactiveIcon.alt,className:"aspect-square"})}),(0,i.jsxs)("div",{className:"relative z-20 flex h-full flex-col justify-between",children:[(0,i.jsx)(l.Heading,{as:"h3",size:3,html:e.title,className:(0,d.cn)(m({state:o}))}),(0,i.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,i.jsx)("div",{className:"flex flex-col justify-end overflow-hidden",children:(0,i.jsx)(l.Heading,{as:"h4",size:2,html:e.subtitle,className:(0,d.cn)(" line-clamp-2",m({state:o}))})}),c==="large"&&e.description&&(0,i.jsx)(l.Text,{html:e.description,className:(0,d.cn)("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-3 text-[14px] leading-[1.4]",m({state:o}))})]})]})]})})});w.displayName="ActivityScheduleCard";const x=v.forwardRef(({classNames:e={},data:t,...a},c)=>{const s=t.theme||"light",o=t.size||"large",r=v.useMemo(()=>t?.scheduleList?.length||2,[t?.scheduleList]),k=v.useMemo(()=>{const n=N=>{switch(N){case"mobile":return{slidesPerView:1.17,spaceBetween:12};case"tablet":return r===2?{slidesPerView:2,spaceBetween:12}:{slidesPerView:2.4,spaceBetween:12};case"laptop":return r===2?{}:r===4?{slidesPerView:3.2,spaceBetween:16}:{slidesPerView:r,spaceBetween:16};case"desktop":return r===2?{slidesPerView:2,spaceBetween:16}:{slidesPerView:r,spaceBetween:16}}},u=n("mobile"),S=n("tablet"),b=n("laptop"),A=n("desktop");return{0:u,768:S,1024:b,1440:A}},[r]);return(0,i.jsx)(l.Container,{ref:c,className:(0,d.cn)(e?.root),childClassName:"overflow-hidden","data-ui-component-id":"ActivitySchedule",...a,children:(0,i.jsx)(h.Swiper,{breakpoints:k,className:"w-full !overflow-visible",children:t.scheduleList.map((n,u)=>(0,i.jsx)(h.SwiperSlide,{children:(0,i.jsx)(w,{item:n,theme:s,size:o,className:e?.card})},"activityScheduleCardItem"+u))})})});x.displayName="ActivitySchedule";var M=(0,y.withLayout)(x);
1
+ "use strict";"use client";var C=Object.create;var p=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var a in t)p(e,a,{get:t[a],enumerable:!0})},g=(e,t,a,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of V(t))!I.call(e,s)&&s!==a&&p(e,s,{get:()=>t[s],enumerable:!(c=P(t,s))||c.enumerable});return e};var L=(e,t,a)=>(a=e!=null?C(z(e)):{},g(t||!e||!e.__esModule?p(a,"default",{value:e,enumerable:!0}):a,e)),E=e=>g(p({},"__esModule",{value:!0}),e);var R={};B(R,{default:()=>M});module.exports=E(R);var i=require("react/jsx-runtime"),v=L(require("react")),d=require("../../helpers/index.js"),l=require("../../components/index.js"),f=require("class-variance-authority"),h=require("swiper/react"),y=require("../../shared/Styles.js");const j=(0,f.cva)("rounded-card laptop:px-6 laptop:py-4 relative flex min-w-0 flex-col justify-between gap-2 overflow-hidden px-4 py-3",{variants:{state:{"active-light":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","active-dark":"bg-gradient-to-r from-[#3555aa] to-[#6988e3]","inactive-light":"bg-[#EAEAEC]","inactive-dark":"bg-[#1E2024]"},size:{small:"laptop:h-[160px] h-[120px]",large:"laptop:h-[240px] h-[200px]"}},defaultVariants:{state:"inactive-light",size:"small"}}),m=(0,f.cva)("font-bold leading-[1.2]",{variants:{state:{"active-light":"text-white","active-dark":"text-white","inactive-light":"text-[#080A0F]","inactive-dark":"text-white"}},defaultVariants:{state:"inactive-light"}}),w=v.memo(({item:e,theme:t="light",className:a,size:c})=>{const s=e.isActive||!1,o=`${s?"active":"inactive"}-${t}`;return(0,i.jsx)("div",{className:(0,d.cn)(j({state:o,size:c}),a),"data-ui-component-id":"ActivityScheduleCard",children:(0,i.jsxs)(l.Link,{asChild:!e?.link,href:e?.link,className:"size-full no-underline hover:text-current",children:[(s?e.activeIcon:e.inactiveIcon)&&(0,i.jsx)("div",{className:"laptop:w-[160px] aspect-1 absolute right-0 top-0 z-10 w-[120px]",children:(0,i.jsx)(l.Picture,{source:s?e.activeIcon.url:e.inactiveIcon.url,alt:s?e.activeIcon.alt:e.inactiveIcon.alt,className:"aspect-square"})}),(0,i.jsxs)("div",{className:"relative z-20 flex h-full flex-col justify-between",children:[(0,i.jsx)(l.Heading,{as:"h3",size:3,html:e.title,className:(0,d.cn)(m({state:o}))}),(0,i.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,i.jsx)("div",{className:"flex flex-col justify-end overflow-hidden",children:(0,i.jsx)(l.Heading,{as:"h4",size:2,html:e.subtitle,className:(0,d.cn)(" line-clamp-2",m({state:o}))})}),c==="large"&&e.description&&(0,i.jsx)(l.Text,{html:e.description,className:(0,d.cn)("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-3 text-[14px] leading-[1.4]",m({state:o}))})]})]})]})})});w.displayName="ActivityScheduleCard";const x=v.forwardRef(({classNames:e={},data:t,...a},c)=>{const s=t.theme||"light",o=t.size||"small",r=v.useMemo(()=>t?.scheduleList?.length||2,[t?.scheduleList]),k=v.useMemo(()=>{const n=N=>{switch(N){case"mobile":return{slidesPerView:1.17,spaceBetween:12};case"tablet":return r===2?{slidesPerView:2,spaceBetween:12}:{slidesPerView:2.4,spaceBetween:12};case"laptop":return r===2?{}:r===4?{slidesPerView:3.2,spaceBetween:16}:{slidesPerView:r,spaceBetween:16};case"desktop":return r===2?{slidesPerView:2,spaceBetween:16}:{slidesPerView:r,spaceBetween:16}}},u=n("mobile"),S=n("tablet"),b=n("laptop"),A=n("desktop");return{0:u,768:S,1024:b,1440:A}},[r]);return(0,i.jsx)("div",{ref:c,className:(0,d.cn)(e?.root),"data-ui-component-id":"ActivitySchedule",...a,children:(0,i.jsx)(h.Swiper,{breakpoints:k,className:"w-full !overflow-visible",children:t?.scheduleList?.map((n,u)=>(0,i.jsx)(h.SwiperSlide,{children:(0,i.jsx)(w,{item:n,theme:s,size:o,className:e?.card})},"activityScheduleCardItem"+u))??null})})});x.displayName="ActivitySchedule";var M=(0,y.withLayout)(x);
@@ -1,4 +1,6 @@
1
1
  import type { BrandEquityProps } from './types.js';
2
+ import 'swiper/css';
3
+ import 'swiper/css/pagination';
2
4
  declare const _default: import("react").ForwardRefExoticComponent<Omit<BrandEquityProps & import("react").RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../index.js").ContainerProps & import("react").RefAttributes<unknown>> & {
3
5
  readonly $$typeof: symbol;
4
6
  };
@@ -1 +1 @@
1
- "use strict";"use client";var j=Object.create;var d=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var H=(e,r)=>{for(var i in r)d(e,i,{get:r[i],enumerable:!0})},h=(e,r,i,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of L(r))!A.call(e,o)&&o!==i&&d(e,o,{get:()=>r[o],enumerable:!(a=P(r,o))||a.enumerable});return e};var k=(e,r,i)=>(i=e!=null?j(z(e)):{},h(r||!e||!e.__esModule?d(i,"default",{value:e,enumerable:!0}):i,e)),D=e=>h(d({},"__esModule",{value:!0}),e);var F={};H(F,{default:()=>C});module.exports=D(F);var t=require("react/jsx-runtime"),s=require("react"),l=require("../../helpers/utils.js"),y=k(require("../../components/picture.js")),q=require("../../shared/Styles.js"),E=require("react-responsive"),S=require("../../hooks/useExposure.js"),c=require("swiper/react"),p=require("swiper/modules"),M=k(require("../Title/index.js"));const R="copy",Q="store_benefits",$=(e,r)=>{const i=[];for(let a=0;a<e.length;a+=r)i.push(e.slice(a,a+r));return i},N=(0,s.forwardRef)(({data:{items:e=[],itemShape:r,title:i,theme:a},className:o},u)=>{const[x,B]=(0,s.useState)(!1),v=(0,E.useMediaQuery)({query:"(max-width: 768px)"}),b=(0,s.useRef)(null),f=(0,s.useRef)(null);(0,s.useImperativeHandle)(u,()=>f.current),(0,S.useExposure)(f,{componentType:R,componentName:Q}),(0,s.useEffect)(()=>{B(v)},[v]);const T=x?$(e,3):e;return(0,t.jsxs)("div",{ref:f,className:(0,l.cn)("brand-equity-wrapper w-full",{"aiui-dark":a==="dark"},o),children:[i&&(0,t.jsx)(M.default,{data:{title:i}}),x?(0,t.jsxs)(c.Swiper,{className:(0,l.cn)(o),modules:[p.FreeMode,p.Mousewheel,p.Pagination],freeMode:!0,mousewheel:{forceToAxis:!0},pagination:{clickable:!0,el:b.current},breakpoints:{0:{spaceBetween:12}},children:[T?.map((n,m)=>(0,t.jsx)(c.SwiperSlide,{className:"!flex flex-col gap-3",children:Array.isArray(n)&&n?.map((I,g)=>(0,t.jsx)(w,{data:I,itemShape:r,index:g,theme:a},g))},"SwiperSlide"+m)),(0,t.jsx)("div",{ref:b,className:"mt-3 flex justify-center"})]}):(0,t.jsx)("div",{className:(0,l.cn)("grid grid-cols-1 gap-3","tablet:grid-cols-2","laptop:gap-4 laptop:grid-cols-10"),children:e.map((n,m)=>(0,t.jsx)(w,{data:n,itemShape:r,index:m,theme:a},m))})]})}),w=({data:e,itemShape:r,index:i,theme:a})=>(0,t.jsxs)("div",{className:(0,l.cn)("brand-equity-item",`brand-equity-item-${i+1}`,e.containerName?`brand-equity-item--${e.containerName}`:void 0,"bg-container-secondary-1 box-border flex w-full flex-col p-4","desktop:p-6 justify-between","laptop:col-span-3 lg-desktop:p-8","laptop:h-[192px] lg-desktop:h-[240px] h-[160px]",{"laptop:col-span-4":[0,5,6,11].includes(i),"bg-container-primary":a==="dark"},"rounded-box",e.className),children:[(0,t.jsxs)("div",{className:"lg-desktop:h-[36px] flex h-[30px] items-center justify-between gap-3",children:[(0,t.jsx)("h3",{className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary text-[14px] font-bold leading-[1.2] tracking-[-0.02em]",children:e.title}),e.type==="avatar"?(0,t.jsx)("div",{className:"flex shrink-0 -space-x-2",children:e?.avatarList?.map((o,u)=>(0,t.jsx)("div",{className:(0,l.cn)("border-container-primary size-[30px] overflow-hidden rounded-full border-2","relative inline-block shrink-0","lg-desktop:size-[36px]"),children:(0,t.jsx)(y.default,{source:o.avatar?.url,alt:o.avatar?.alt,className:"size-full object-cover"})},u))}):(0,t.jsx)("div",{className:"lg-desktop:size-[36px] size-[30px] shrink-0",children:(0,t.jsx)(y.default,{className:"size-full object-cover",source:e.icon?.url,alt:e.icon?.alt,imgClassName:"w-full h-full object-cover"})})]}),(0,t.jsx)("p",{className:"lg-desktop:text-[24px] text-info-primary line-clamp-3 text-[20px] font-bold leading-[1.2] tracking-[-0.04em]",children:e.description})]});N.displayName="BrandEquity";var C=(0,q.withLayout)(N);
1
+ "use strict";"use client";var j=Object.create;var u=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var D=(e,r)=>{for(var i in r)u(e,i,{get:r[i],enumerable:!0})},h=(e,r,i,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of z(r))!H.call(e,o)&&o!==i&&u(e,o,{get:()=>r[o],enumerable:!(a=L(r,o))||a.enumerable});return e};var k=(e,r,i)=>(i=e!=null?j(A(e)):{},h(r||!e||!e.__esModule?u(i,"default",{value:e,enumerable:!0}):i,e)),R=e=>h(u({},"__esModule",{value:!0}),e);var _={};D(_,{default:()=>F});module.exports=R(_);var t=require("react/jsx-runtime"),s=require("react"),l=require("../../helpers/utils.js"),x=k(require("../../components/picture.js")),E=require("../../shared/Styles.js"),q=require("react-responsive"),S=require("../../hooks/useExposure.js"),f=require("swiper/react"),n=require("swiper/modules"),J=require("swiper/css"),K=require("swiper/css/pagination"),I=k(require("../Title/index.js"));const Q="copy",$="store_benefits",C=(e,r)=>{const i=[];for(let a=0;a<e.length;a+=r)i.push(e.slice(a,a+r));return i},N=(0,s.forwardRef)(({data:{items:e=[],itemShape:r,title:i,theme:a},className:o},m)=>{const[c,M]=(0,s.useState)(!1),g=(0,q.useMediaQuery)({query:"(max-width: 767px)"}),[B,T]=(0,s.useState)(null),y=(0,s.useRef)(null);(0,s.useImperativeHandle)(m,()=>y.current),(0,S.useExposure)(y,{componentType:Q,componentName:$}),(0,s.useEffect)(()=>{M(g)},[g]);const P=c?C(e,3):e;return(0,t.jsxs)("div",{ref:y,className:(0,l.cn)("brand-equity-wrapper w-full",{"aiui-dark":a==="dark"},o),children:[i&&(0,t.jsx)(I.default,{data:{title:i}}),c?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.Swiper,{className:(0,l.cn)(o),modules:[n.FreeMode,n.Mousewheel,n.Pagination],freeMode:!0,mousewheel:{forceToAxis:!0},pagination:{clickable:!0,el:B},breakpoints:{0:{spaceBetween:12}},children:P?.map((p,d)=>(0,t.jsx)(f.SwiperSlide,{className:"!flex flex-col gap-3",children:Array.isArray(p)&&p?.map((v,b)=>(0,t.jsx)(w,{data:v,itemShape:r,index:b,theme:v.theme??a},b))},"SwiperSlide"+d))}),(0,t.jsx)("div",{ref:T,className:"brand-equity-pagination !static mt-[20px] flex justify-center"})]}):(0,t.jsx)("div",{className:(0,l.cn)("grid grid-cols-1 gap-3","tablet:grid-cols-2","laptop:gap-4 laptop:grid-cols-10"),children:e.map((p,d)=>(0,t.jsx)(w,{data:p,itemShape:r,index:d,theme:p.theme??a},d))})]})}),w=({data:e,itemShape:r,index:i,theme:a})=>{const o=a==="dark"&&e.iconImage?e.iconImage:e.icon;return(0,t.jsxs)("div",{className:(0,l.cn)("brand-equity-item",`brand-equity-item-${i+1}`,e.containerName?`brand-equity-item--${e.containerName}`:void 0,"bg-container-secondary-1 box-border flex w-full flex-col p-4","desktop:p-6 justify-between","laptop:col-span-3 lg-desktop:p-8","laptop:h-[192px] lg-desktop:h-[240px] h-[160px]",{"laptop:col-span-4":[0,5,6,11].includes(i),"bg-container-primary":a==="dark"},"rounded-box",e.className),children:[(0,t.jsxs)("div",{className:"lg-desktop:h-[36px] flex h-[32px] items-center justify-between gap-3",children:[(0,t.jsx)("h3",{className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary text-[14px] font-bold leading-[1.2] tracking-[-0.02em]",children:e.title}),e.type==="avatar"?(0,t.jsx)("div",{className:"flex shrink-0 -space-x-2",children:e?.avatarList?.map((m,c)=>(0,t.jsx)("div",{className:(0,l.cn)("border-container-primary size-[32px] overflow-hidden rounded-full border-2","relative inline-block shrink-0","lg-desktop:size-[36px]"),children:(0,t.jsx)(x.default,{source:m.avatar?.url,alt:m.avatar?.alt,className:"size-full object-cover"})},c))}):(0,t.jsx)("div",{className:"lg-desktop:size-[36px] size-[32px] shrink-0",children:(0,t.jsx)(x.default,{className:"size-full object-cover",source:o?.url,alt:o?.alt,imgClassName:"w-full h-full object-cover"})})]}),(0,t.jsx)("p",{className:"lg-desktop:text-[24px] text-info-primary line-clamp-3 text-[20px] font-bold leading-[1.2] tracking-[-0.04em]",children:e.description})]})};N.displayName="BrandEquity";var F=(0,E.withLayout)(N);
@@ -1,6 +1,8 @@
1
1
  import type { ComponentCommonProps, Img } from '../../types/props.js';
2
2
  export interface BrandEquityItemProps {
3
3
  icon?: Img;
4
+ /** 暗色主题专用图标:item 或全局 theme 为 dark 时优先于 icon 渲染(semantic-media 命名遵循 ADR 0010) */
5
+ iconImage?: Img;
4
6
  type?: 'icon' | 'avatar';
5
7
  title: string;
6
8
  description: string;
@@ -1 +1 @@
1
- "use strict";var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of s(t))!m.call(e,r)&&r!==n&&i(e,r,{get:()=>t[r],enumerable:!(a=o(t,r))||a.enumerable});return e};var g=e=>p(i({},"__esModule",{value:!0}),e);var d={};module.exports=g(d);
1
+ "use strict";var i=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var p=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of s(t))!m.call(e,r)&&r!==n&&i(e,r,{get:()=>t[r],enumerable:!(a=o(t,r))||a.enumerable});return e};var g=e=>p(i({},"__esModule",{value:!0}),e);var c={};module.exports=g(c);
@@ -1 +1 @@
1
- "use strict";"use client";var v=Object.create;var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var y=(e,r)=>{for(var i in r)d(e,i,{get:r[i],enumerable:!0})},c=(e,r,i,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of g(r))!k.call(e,s)&&s!==i&&d(e,s,{get:()=>r[s],enumerable:!(l=u(r,s))||l.enumerable});return e};var x=(e,r,i)=>(i=e!=null?v(b(e)):{},c(r||!e||!e.__esModule?d(i,"default",{value:e,enumerable:!0}):i,e)),w=e=>c(d({},"__esModule",{value:!0}),e);var G={};y(G,{default:()=>z});module.exports=w(G);var t=require("react/jsx-runtime"),F=x(require("react")),o=require("../../helpers/index.js"),B=require("../../components/badge.js"),h=x(require("../../components/picture.js")),a=require("../../components/text.js");const N=({checked:e,theme:r})=>{const i=r==="dark";return e?(0,t.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",fill:i?"#F5F6F7":"#080A0F"}),(0,t.jsx)("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:i?"#F5F6F7":"#080A0F",strokeWidth:"1.6"}),(0,t.jsx)("path",{d:"M8 11.5833L10.9474 14.5L16 9.5",stroke:i?"#1E2024":"white",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]}):(0,t.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:i?"#B5B7BB":"#2A2C32",strokeWidth:"1.6"})})},m=F.forwardRef(({gift:e,onClick:r,className:i,giftType:l,theme:s,tagBgColor:n,tagTextColor:p},f)=>(0,t.jsx)("div",{ref:f,className:(0,o.cn)("bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all",l===2?"border-brand-0 bg-container-secondary-0 cursor-default":`cursor-pointer hover:shadow-sm ${e.selected?"border-brand-0 bg-container-secondary-0":"border-lines bg-secondary-0 hover:bg-container-secondary"}`,i),onClick:()=>{l===1&&r?.(e)},children:(0,t.jsxs)("div",{className:"flex size-full flex-col",children:[(0,t.jsx)("div",{className:"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end",children:e.tag&&(0,t.jsx)("div",{className:"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] text-badge-foreground absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2]",style:{...n?{backgroundColor:n}:{},...p?{color:p}:{}},children:e.tag})}),(0,t.jsxs)("div",{className:(0,o.cn)("laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2"),children:[(0,t.jsx)("div",{className:"flex size-5 shrink-0 items-center justify-center",children:(0,t.jsx)(N,{checked:!!e.selected,theme:s})}),(0,t.jsx)("div",{className:(0,o.cn)("size-14 shrink-0","tablet:size-12"),children:(0,t.jsx)(h.default,{source:e.image,alt:e.name,className:"size-full rounded object-cover"})}),(0,t.jsxs)("div",{className:"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1",children:[(0,t.jsx)(a.Text,{size:2,html:e.name,className:(0,o.cn)("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1")}),(0,t.jsxs)("div",{className:"mt-auto flex items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(a.Text,{size:2,className:(0,o.cn)("text-info-primary desktop:text-[16px] lg-desktop:text-[18px]"),children:e.currentPrice}),e.originalPrice&&e.originalPrice!==e.currentPrice&&(0,t.jsx)(a.Text,{size:2,className:(0,o.cn)("text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through"),children:e.originalPrice})]}),e.quantity>=1&&(0,t.jsxs)(a.Text,{size:4,className:(0,o.cn)("text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]"),children:["x",e.quantity]})]})]})]})]})}));m.displayName="FreeGiftItem";var z=m;
1
+ "use strict";"use client";var g=Object.create;var n=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var w=(e,r)=>{for(var i in r)n(e,i,{get:r[i],enumerable:!0})},p=(e,r,i,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of b(r))!y.call(e,s)&&s!==i&&n(e,s,{get:()=>r[s],enumerable:!(l=v(r,s))||l.enumerable});return e};var x=(e,r,i)=>(i=e!=null?g(k(e)):{},p(r||!e||!e.__esModule?n(i,"default",{value:e,enumerable:!0}):i,e)),F=e=>p(n({},"__esModule",{value:!0}),e);var P={};w(P,{default:()=>G});module.exports=F(P);var t=require("react/jsx-runtime"),N=x(require("react")),o=require("../../helpers/index.js"),L=require("../../components/badge.js"),f=x(require("../../components/picture.js")),a=require("../../components/text.js");const z=({checked:e,theme:r})=>{const i=r==="dark";return e?(0,t.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",fill:i?"#F5F6F7":"#080A0F"}),(0,t.jsx)("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:i?"#F5F6F7":"#080A0F",strokeWidth:"1.6"}),(0,t.jsx)("path",{d:"M8 11.5833L10.9474 14.5L16 9.5",stroke:i?"#1E2024":"white",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]}):(0,t.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:i?"#B5B7BB":"#2A2C32",strokeWidth:"1.6"})})},m=N.forwardRef(({gift:e,onClick:r,className:i,giftType:l,theme:s,tagBgColor:d,tagTextColor:c},h)=>{const u=l===2||!!e.selected;return(0,t.jsx)("div",{ref:h,className:(0,o.cn)("bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all","buy-one-get-one-shelf-free-gift-item",u?"buy-one-get-one-shelf-free-gift-item-selected":"buy-one-get-one-shelf-free-gift-item-unselected",l===2?"border-brand-0 bg-container-secondary-0 cursor-default":`cursor-pointer hover:shadow-sm ${e.selected?"border-brand-0 bg-container-secondary-0":"border-lines bg-secondary-0 hover:bg-container-secondary"}`,i),onClick:()=>{l===1&&r?.(e)},children:(0,t.jsxs)("div",{className:"flex size-full flex-col",children:[(0,t.jsx)("div",{className:"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end",children:e.tag&&(0,t.jsx)("div",{className:"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] text-badge-foreground absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2]",style:{...d?{backgroundColor:d}:{},...c?{color:c}:{}},children:e.tag})}),(0,t.jsxs)("div",{className:(0,o.cn)("laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2"),children:[(0,t.jsx)("div",{className:"flex size-5 shrink-0 items-center justify-center",children:(0,t.jsx)(z,{checked:!!e.selected,theme:s})}),(0,t.jsx)("div",{className:(0,o.cn)("size-14 shrink-0","tablet:size-12"),children:(0,t.jsx)(f.default,{source:e.image,alt:e.name,className:"size-full rounded object-cover"})}),(0,t.jsxs)("div",{className:"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1",children:[(0,t.jsx)(a.Text,{size:2,html:e.name,className:(0,o.cn)("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1")}),(0,t.jsxs)("div",{className:"mt-auto flex items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(a.Text,{size:2,className:(0,o.cn)("text-info-primary desktop:text-[16px] lg-desktop:text-[18px]"),children:e.currentPrice}),e.originalPrice&&e.originalPrice!==e.currentPrice&&(0,t.jsx)(a.Text,{size:2,className:(0,o.cn)("text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through"),children:e.originalPrice})]}),e.quantity>=1&&(0,t.jsxs)(a.Text,{size:4,className:(0,o.cn)("text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]"),children:["x",e.quantity]})]})]})]})]})})});m.displayName="FreeGiftItem";var G=m;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ interface Message {
3
+ content: string;
4
+ role: string;
5
+ name?: string;
6
+ scope?: any;
7
+ arguments?: any;
8
+ }
9
+ export interface ActionProps {
10
+ start?: string;
11
+ history: Message[];
12
+ addtocartHandler?: (_args: any) => Promise<any>;
13
+ commonRender?: string | ((_props: any) => React.ReactElement);
14
+ pointsExchangeCouponRender?: string | ((_props: any) => React.ReactElement);
15
+ gotocheckoutRender?: string | ((_props: any) => React.ReactElement);
16
+ gotocartRender?: string | ((_props: any) => React.ReactElement);
17
+ addtocartRender?: string | ((_props: any) => React.ReactElement);
18
+ signupRender?: string | ((_props: any) => React.ReactElement);
19
+ shulexRender?: string | ((_props: any) => React.ReactElement);
20
+ productRender?: string | ((_props: any) => React.ReactElement);
21
+ productRenderTipMessage?: string;
22
+ children?: React.ReactNode;
23
+ }
24
+ export declare const CopilotAction: ({ start, history, addtocartHandler, commonRender, pointsExchangeCouponRender, gotocheckoutRender, gotocartRender, addtocartRender, productRender, signupRender, shulexRender, children, }: ActionProps) => import("react/jsx-runtime").JSX.Element;
25
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";var m=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var J=Object.prototype.hasOwnProperty;var O=(r,t)=>{for(var s in t)m(r,s,{get:t[s],enumerable:!0})},M=(r,t,s,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of S(t))!J.call(r,i)&&i!==s&&m(r,i,{get:()=>t[i],enumerable:!(d=x(t,i))||d.enumerable});return r};var k=r=>M(m({},"__esModule",{value:!0}),r);var C={};O(C,{CopilotAction:()=>A});module.exports=k(C);var a=require("react/jsx-runtime"),D=require("react"),l=require("react"),n=require("@copilotkit/react-core"),c=require("@copilotkit/runtime-client-gql");const A=({start:r,history:t,addtocartHandler:s,commonRender:d,pointsExchangeCouponRender:i,gotocheckoutRender:u,gotocartRender:h,addtocartRender:y,productRender:R,signupRender:f,shulexRender:_,children:N})=>{const{setMessages:v,appendMessage:w,isLoading:P}=(0,n.useCopilotChat)();return(0,l.useEffect)(()=>{const e=t?.filter(p=>p?.content||p?.arguments);if(e?.length>0){const p=e?.map(o=>{if(o?.name&&o?.arguments){const E=o?.arguments?.map(g=>g?{...g,ishistory:!0}:{});return new c.ActionExecutionMessage({name:o?.name,arguments:E,scope:o?.scope})}return new c.TextMessage({...o,role:o?.role==="user"?c.Role.User:c.Role.Assistant})});v(p)}},[t]),(0,n.useCopilotAction)({name:"go_to_checkout",description:"go to cart",parameters:[{sku:"",handle:""}],render:u||(e=>(0,a.jsx)("div",{className:"hidden",children:JSON.stringify(e)})),handler:function(){}}),(0,n.useCopilotAction)({name:"common_action",description:"common action",parameters:[{act:""}],render:d||(e=>(0,a.jsx)("div",{className:"hidden",children:JSON.stringify(e)})),handler:function(){}}),(0,n.useCopilotAction)({name:"points_exchange_coupon",description:"points exchange coupon",parameters:[{act:""}],render:i||(e=>(0,a.jsx)("div",{className:"hidden",children:JSON.stringify(e)})),handler:function(){}}),(0,n.useCopilotAction)({name:"go_to_cart",description:"go to cart",parameters:[{sku:"",handle:""}],render:h||(e=>(0,a.jsx)("div",{className:"hidden",children:JSON.stringify(e)})),handler:function(){}}),(0,n.useCopilotAction)({name:"add_to_cart",description:"add to cart",parameters:[{sku:"",handle:""}],render:y||(e=>(0,a.jsx)("div",{className:"hidden",children:JSON.stringify(e)})),handler:function(e){s&&s(e)}}),(0,n.useCopilotAction)({name:"show_product_card",description:"product card",parameters:[{sku:"",handle:""}],render:R||(e=>(0,a.jsx)("div",{className:"hidden",children:JSON.stringify(e)})),handler:function(e){}}),(0,n.useCopilotAction)({name:"signup",description:"signup",parameters:[{name:"signup"}],render:f||(e=>(0,a.jsx)("div",{className:"hidden",children:JSON.stringify(e)})),handler:function(){}}),(0,n.useCopilotAction)({name:"shulex",description:"shulex",parameters:[{name:"shulex"}],render:_||(e=>(0,a.jsx)("div",{className:"hidden",children:JSON.stringify(e)})),handler:function(){}}),(0,n.useCopilotReadable)({description:"Today's date",value:new Date().toLocaleDateString()}),(0,a.jsx)("div",{children:N})};
@@ -0,0 +1,3 @@
1
+ import type { ButtonProps } from './props.js';
2
+ declare const DefaultButton: ({ setOpen }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default DefaultButton;
@@ -0,0 +1 @@
1
+ "use strict";var p=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var r=(t,o)=>{for(var i in o)p(t,i,{get:o[i],enumerable:!0})},m=(t,o,i,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of a(o))!u.call(t,n)&&n!==i&&p(t,n,{get:()=>o[n],enumerable:!(e=l(o,n))||e.enumerable});return t};var B=t=>m(p({},"__esModule",{value:!0}),t);var f={};r(f,{default:()=>d});module.exports=B(f);var c=require("react/jsx-runtime"),K=require("react"),s=require("@copilotkit/react-ui");const I=({setOpen:t})=>{const o=(0,s.useChatContext)();return(0,c.jsxs)("button",{onClick:()=>t(),className:"copilotKitButton ","aria-label":"Open Chat",children:[(0,c.jsx)("div",{className:"copilotKitButtonIcon copilotKitButtonIconOpen",children:o.icons.openIcon}),(0,c.jsx)("div",{className:"copilotKitButtonIcon copilotKitButtonIconClose",children:o.icons.closeIcon})]})};var d=I;
@@ -0,0 +1,101 @@
1
+ import React from 'react';
2
+ /**
3
+ * Icons for CopilotChat component.
4
+ */
5
+ export interface CopilotChatIcons {
6
+ /**
7
+ * The icon to use for the open chat button.
8
+ * @default <OpenIcon />
9
+ */
10
+ openIcon?: React.ReactNode;
11
+ /**
12
+ * The icon to use for the close chat button.
13
+ * @default <CloseIcon />
14
+ */
15
+ closeIcon?: React.ReactNode;
16
+ /**
17
+ * The icon to use for the close chat button in the header.
18
+ * @default <HeaderCloseIcon />
19
+ */
20
+ headerCloseIcon?: React.ReactNode;
21
+ /**
22
+ * The icon to use for the send button.
23
+ * @default <SendIcon />
24
+ */
25
+ sendIcon?: React.ReactNode;
26
+ /**
27
+ * The icon to use for the activity indicator.
28
+ * @default <ActivityIcon />
29
+ */
30
+ activityIcon?: React.ReactNode;
31
+ /**
32
+ * The icon to use for the spinner.
33
+ * @default <SpinnerIcon />
34
+ */
35
+ spinnerIcon?: React.ReactNode;
36
+ /**
37
+ * The icon to use for the stop button.
38
+ * @default <StopIcon />
39
+ */
40
+ stopIcon?: React.ReactNode;
41
+ /**
42
+ * The icon to use for the regenerate button.
43
+ * @default <RegenerateIcon />
44
+ */
45
+ regenerateIcon?: React.ReactNode;
46
+ /**
47
+ * The icons to use for push to talk.
48
+ * @default <PushToTalkIcon />
49
+ */
50
+ pushToTalkIcon?: React.ReactNode;
51
+ }
52
+ /**
53
+ * Labels for CopilotChat component.
54
+ */
55
+ export interface CopilotChatLabels {
56
+ /**
57
+ * The initial message(s) to display in the chat window.
58
+ */
59
+ initial?: string | string[];
60
+ /**
61
+ * The title to display in the header.
62
+ * @default "CopilotKit"
63
+ */
64
+ title?: string;
65
+ /**
66
+ * The placeholder to display in the input.
67
+ * @default "Type a message..."
68
+ */
69
+ placeholder?: string;
70
+ /**
71
+ * The message to display when an error occurs.
72
+ * @default "❌ An error occurred. Please try again."
73
+ */
74
+ error?: string;
75
+ /**
76
+ * The label to display on the stop button.
77
+ * @default "Stop generating"
78
+ */
79
+ stopGenerating?: string;
80
+ /**
81
+ * The label to display on the regenerate button.
82
+ * @default "Regenerate response"
83
+ */
84
+ regenerateResponse?: string;
85
+ }
86
+ interface ChatContext {
87
+ labels: Required<CopilotChatLabels>;
88
+ icons: Required<CopilotChatIcons>;
89
+ open: boolean;
90
+ setOpen: (_open: boolean) => void;
91
+ }
92
+ export declare const ChatContext: React.Context<ChatContext | undefined>;
93
+ export declare function useChatContext(): ChatContext;
94
+ export interface ChatContextProps {
95
+ labels?: CopilotChatLabels;
96
+ icons?: CopilotChatIcons;
97
+ children?: React.ReactNode;
98
+ open: boolean;
99
+ setOpen: (_open: boolean) => void;
100
+ }
101
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";var p=Object.create;var a=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var h=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0})},i=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of d(t))!R.call(e,n)&&n!==o&&a(e,n,{get:()=>t[n],enumerable:!(r=C(t,n))||r.enumerable});return e};var x=(e,t,o)=>(o=e!=null?p(l(e)):{},i(t||!e||!e.__esModule?a(o,"default",{value:e,enumerable:!0}):o,e)),u=e=>i(a({},"__esModule",{value:!0}),e);var I={};h(I,{ChatContext:()=>s,useChatContext:()=>f});module.exports=u(I);var c=x(require("react"));const s=c.default.createContext(void 0);function f(){const e=c.default.useContext(s);if(e===void 0)throw new Error("Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?");return e}
@@ -0,0 +1,3 @@
1
+ export { default as Chat } from './index.js';
2
+ export type { ChatProps } from './index.js';
3
+ export { Role, ActionExecutionMessage, TextMessage, useCopilotChat, useCopilotAction, useCopilotReadable, } from './utils.js';
@@ -0,0 +1 @@
1
+ "use strict";var x=Object.create;var p=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty;var c=(e,t)=>{for(var s in t)p(e,s,{get:t[s],enumerable:!0})},r=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of u(t))!n.call(e,a)&&a!==s&&p(e,a,{get:()=>t[a],enumerable:!(i=C(t,a))||i.enumerable});return e};var d=(e,t,s)=>(s=e!=null?x(f(e)):{},r(t||!e||!e.__esModule?p(s,"default",{value:e,enumerable:!0}):s,e)),h=e=>r(p({},"__esModule",{value:!0}),e);var m={};c(m,{ActionExecutionMessage:()=>o.ActionExecutionMessage,Chat:()=>l.default,Role:()=>o.Role,TextMessage:()=>o.TextMessage,useCopilotAction:()=>o.useCopilotAction,useCopilotChat:()=>o.useCopilotChat,useCopilotReadable:()=>o.useCopilotReadable});module.exports=h(m);var l=d(require("./index.js")),o=require("./utils.js");
@@ -0,0 +1,14 @@
1
+ export declare function getAsyncError(res: {
2
+ json: () => any;
3
+ status: any;
4
+ statusText: any;
5
+ }): Promise<{
6
+ status: any;
7
+ statusText: any;
8
+ errors: any;
9
+ type: any;
10
+ data: any;
11
+ message: any;
12
+ } | undefined>;
13
+ declare const handleFetchResponse: (res: Response) => Promise<any>;
14
+ export default handleFetchResponse;
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(a,t)=>{for(var s in t)o(a,s,{get:t[s],enumerable:!0})},l=(a,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of c(t))!y.call(a,e)&&e!==s&&o(a,e,{get:()=>t[e],enumerable:!(n=u(t,e))||n.enumerable});return a};var g=a=>l(o({},"__esModule",{value:!0}),a);var x={};d(x,{default:()=>p,getAsyncError:()=>r});module.exports=g(x);async function r(a){try{const t=await a.json();return{status:a.status,statusText:a.statusText,errors:t?.data?.error||t?.data?.code||a.statusText||a.status,type:t?.data?.type,data:t?.data,message:t?.data?.message}}catch(t){console.log(t)}}const i=async a=>{if(a.ok)try{const t=await a.json(),{errors:s}=t;return s&&s.length?{errors:s,status:a.status}:t}catch(t){console.log(t)}return await r(a)};var p=i;
@@ -0,0 +1,2 @@
1
+ declare const fetcher: ({ locale, url, method, headers, repeatKey, body, type, timeout, }: any) => Promise<any>;
2
+ export default fetcher;
@@ -0,0 +1 @@
1
+ "use strict";var g=Object.create;var o=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var O=(e,r)=>{for(var t in r)o(e,t,{get:r[t],enumerable:!0})},f=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of b(r))!A.call(e,n)&&n!==t&&o(e,n,{get:()=>r[n],enumerable:!(a=u(r,n))||a.enumerable});return e};var T=(e,r,t)=>(t=e!=null?g(h(e)):{},f(r||!e||!e.__esModule?o(t,"default",{value:e,enumerable:!0}):t,e)),j=e=>f(o({},"__esModule",{value:!0}),e);var S={};O(S,{default:()=>F});module.exports=j(S);var y=T(require("./fetchResponse.js"));const x=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),w=async({locale:e="en",url:r,method:t="POST",headers:a={},repeatKey:n,body:s,type:p,timeout:l=9e4})=>{let c="";p==="uploadFile"?c=s:c=s?JSON.stringify(s):"";const i=new AbortController;l&&setTimeout(()=>i.abort(),l);const d=await fetch(r,{method:t,mode:"cors",headers:{"current-language":e,...a},...l&&{signal:i.signal},...t!=="GET"&&{body:c}});return(0,y.default)(d)};var F=w;
@@ -0,0 +1,71 @@
1
+ import React from 'react';
2
+ export interface ChatProps {
3
+ title: string;
4
+ runtimeUrl: string;
5
+ shopifyDomain: string;
6
+ /** GA 的 client id
7
+ */
8
+ userId: string;
9
+ /** 是否登陆用户 0 or 1
10
+ */
11
+ account?: string;
12
+ /** 用户浏览器语言
13
+ */
14
+ locale?: string;
15
+ /** 开场白
16
+ */
17
+ prologue?: string;
18
+ /** ?a=1&b=2
19
+ */
20
+ query?: string;
21
+ /** 'follow' or 'unfollow' | true or false
22
+ * follow: ResponseButton 会跟随在 messages 的后边
23
+ * unfollow: ResponseButton 在聊天框底部
24
+ */
25
+ showResponseButton?: string | boolean;
26
+ /** messages 的回调事件
27
+ * 每次生成/接受新的messages,会将 整个 messages list 传递给外部
28
+ */
29
+ messagesCallback?: (_messages: any) => void;
30
+ /** 通用 action 的触发事件
31
+ */
32
+ commonRender?: string | ((_props: any) => React.ReactElement);
33
+ /** shulex的 action 的触发事件
34
+ */
35
+ shulexRender?: string | ((_props: any) => React.ReactElement);
36
+ /** 通用 积分 换 Coupon 的触发事件
37
+ */
38
+ pointsExchangeCouponRender?: string | ((_props: any) => React.ReactElement);
39
+ /** 跳转 checkout action 卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
40
+ * 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
41
+ */
42
+ gotocheckoutRender?: string | ((_props: any) => React.ReactElement);
43
+ /** 打开购物车 action 卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
44
+ * 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
45
+ */
46
+ gotocartRender?: string | ((_props: any) => React.ReactElement);
47
+ /** 打开购物车 action 的触发事件
48
+ */
49
+ addtocartHandler?: (_args: any) => Promise<any>;
50
+ /** 加购卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
51
+ * 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
52
+ */
53
+ addtocartRender?: string | ((_props: any) => React.ReactElement);
54
+ /** 订阅卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
55
+ * 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
56
+ */
57
+ signupRender?: string | ((_props: any) => React.ReactElement);
58
+ /** 产品卡片,接受参数: {"status":"complete","args":[{"sku":["A3936031"],"handle":"space-a40-a3936031"}],"result":""}
59
+ * 后端接口文档:https://anker-in.feishu.cn/wiki/DOYJwE9oxipWmYk072ncnJNznBb
60
+ */
61
+ productRender?: string | ((_props: any) => React.ReactElement);
62
+ /** CopilotPopup 自定义参数,参考:https://docs.copilotkit.ai/reference/components/CopilotPopup */
63
+ popup?: any;
64
+ /** 文案,{"productRenderTipMessage": "","popupTip": "Hi ! Welcome to soundcore Innovations live chat!", "popupTipTimeout": [3000, 6000]} */
65
+ lang?: any;
66
+ /** 参考此文档:https://docs.copilotkit.ai/concepts/customize-look-and-feel */
67
+ style?: any;
68
+ className?: string;
69
+ }
70
+ declare const Chat: (props: ChatProps) => import("react/jsx-runtime").JSX.Element;
71
+ export default Chat;
@@ -0,0 +1 @@
1
+ "use strict";var ne=Object.create;var h=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ae=Object.getOwnPropertyNames;var ie=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var ce=(t,s)=>{for(var n in s)h(t,n,{get:s[n],enumerable:!0})},x=(t,s,n,p)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of ae(s))!pe.call(t,a)&&a!==n&&h(t,a,{get:()=>s[a],enumerable:!(p=re(s,a))||p.enumerable});return t};var g=(t,s,n)=>(n=t!=null?ne(ie(t)):{},x(s||!t||!t.__esModule?h(n,"default",{value:t,enumerable:!0}):n,t)),le=t=>x(h({},"__esModule",{value:!0}),t);var de={};ce(de,{default:()=>ge});module.exports=le(de);var o=require("react/jsx-runtime"),B=require("react"),r=require("react"),O=require("@copilotkit/react-core"),v=require("@copilotkit/react-ui"),w=g(require("./button.js")),S=g(require("./messages.js")),M=g(require("./response.js")),$=g(require("./suggestions.js")),q=require("./action.js"),E=g(require("./helpers/fetcher.js"));const ue=t=>{const{title:s,runtimeUrl:n,popup:p,shopifyDomain:a,userId:c="",account:d="",prologue:D="",locale:m="",query:l="",messagesCallback:K,showResponseButton:_,gotocheckoutRender:N,commonRender:I,shulexRender:H,pointsExchangeCouponRender:U,gotocartRender:G,addtocartRender:A,productRender:F,signupRender:L,addtocartHandler:z,style:J,className:Q="",lang:R}=t,[V,W]=R?.popupTipTimeout||[3e3,6e3],[b,f]=(0,r.useState)(!1),[y,X]=(0,r.useState)(!1),[u,Y]=(0,r.useState)(D),[Z,C]=(0,r.useState)([]),[P,j]=(0,r.useState)([]),T=(0,B.useMemo)(()=>({"x-user-id":c||"","x-shopify-domain":a,"x-member-ship":d,"x-user-locale":m}),[c,a,d,m]),ee=(0,r.useCallback)(async()=>{const e=await(0,E.default)({url:`${n}/copilotkit/start${l}`,method:"GET",headers:T});C(e?.suggested_questions?.map(i=>({message:i,title:i}))||[]),Y(e?.opening_statement||""),j(e?.history||[])},[c,a,d,m,l]),te=(0,r.useCallback)(async()=>{const e=await(0,E.default)({url:`${n}/copilotkit/suggested_questions${l}`,method:"GET",headers:T});C(e?.suggested_questions?.data?.map(i=>({message:i,title:i}))||[])},[c,a,d,m,l]),oe=()=>{b||f(!0),setTimeout(()=>{f(!1)},W)};return(0,r.useEffect)(()=>{const e=setTimeout(()=>{oe()},V);return()=>{clearTimeout(e)}},[]),(0,o.jsx)("div",{className:Q,style:J||{},children:c&&n&&(0,o.jsx)(O.CopilotKit,{runtimeUrl:`${n}/copilotkit/chat${l}`,showDevConsole:!1,headers:T,children:(0,o.jsx)(v.CopilotPopup,{...p,showResponseButton:_!=="follow",labels:{title:s||"DTC Live Chat",initial:u||""},instructions:u||"",onInProgress:e=>{y&&e&&C([]),y&&!e&&te()},Messages:({messages:e,inProgress:i})=>(0,o.jsx)(S.default,{messages:e,inProgress:i,messagesCallback:K,ResponseButton:_==="follow"?(0,o.jsx)(M.default,{messagesId:e?.[e.length-1]?.id}):void 0,children:(0,o.jsx)($.default,{currentSuggestions:Z})}),Button:({open:e,setOpen:i})=>{const se=p?.Button||w.default;(0,r.useEffect)(()=>{X(e)},[e]);const k=(0,r.useCallback)(()=>{i(!e),f(!1),(!u||!P?.length)&&ee()},[u]);return(0,o.jsxs)(o.Fragment,{children:[R?.popupTip&&b&&!y&&(0,o.jsx)("div",{className:"copilotKitPopup copilotKitPopupTip",children:(0,o.jsx)("button",{onClick:k,"aria-label":"Open Chat",className:"copilotKitPopupTipContent",children:R?.popupTip})}),(0,o.jsx)(se,{open:e,setOpen:k})]})},children:(0,o.jsx)(q.CopilotAction,{start:u,history:P,commonRender:I,shulexRender:H,pointsExchangeCouponRender:U,gotocartRender:G,gotocheckoutRender:N,addtocartRender:A,signupRender:L,productRender:F,addtocartHandler:z,productRenderTipMessage:R?.productRenderTipMessage})})})})};var ge=ue;
@@ -0,0 +1,5 @@
1
+ type MarkdownProps = {
2
+ content: string;
3
+ };
4
+ export declare const Markdown: ({ content }: MarkdownProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";var k=Object.create;var a=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var y=(o,e)=>{for(var r in e)a(o,r,{get:e[r],enumerable:!0})},i=(o,e,r,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of w(e))!u.call(o,n)&&n!==r&&a(o,n,{get:()=>e[n],enumerable:!(p=M(e,n))||p.enumerable});return o};var m=(o,e,r)=>(r=o!=null?k(f(o)):{},i(e||!o||!o.__esModule?a(r,"default",{value:o,enumerable:!0}):r,o)),C=o=>i(a({},"__esModule",{value:!0}),o);var R={};y(R,{Markdown:()=>h});module.exports=C(R);var t=require("react/jsx-runtime"),s=require("react"),c=m(require("react-markdown")),d=m(require("remark-gfm")),l=m(require("remark-math"));const g=(0,s.memo)(c.default,(o,e)=>o.children===e.children&&o.className===e.className),h=({content:o})=>(0,t.jsx)("div",{className:"copilotKitMarkdown",children:(0,t.jsx)(g,{components:N,remarkPlugins:[d.default,l.default],children:o})}),N={p({children:o}){return(0,t.jsx)("p",{children:o})},a({children:o,...e}){return(0,t.jsx)("a",{style:{color:"blue",textDecoration:"underline"},...e,target:"_blank",rel:"noopener noreferrer",children:o})}};
@@ -0,0 +1,3 @@
1
+ import type { MessagesProps } from './props.js';
2
+ declare const Messages: ({ messages, inProgress, ResponseButton, messagesCallback, children }: MessagesProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default Messages;
@@ -0,0 +1 @@
1
+ "use strict";var I=Object.create;var y=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var S=(t,s)=>{for(var i in s)y(t,i,{get:s[i],enumerable:!0})},A=(t,s,i,p)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of T(s))!H.call(t,a)&&a!==i&&y(t,a,{get:()=>s[a],enumerable:!(p=L(s,a))||p.enumerable});return t};var b=(t,s,i)=>(i=t!=null?I(w(t)):{},A(s||!t||!t.__esModule?y(i,"default",{value:t,enumerable:!0}):i,t)),B=t=>A(y({},"__esModule",{value:!0}),t);var q={};S(q,{default:()=>P});module.exports=B(q);var n=require("react/jsx-runtime"),r=b(require("react")),k=require("@copilotkit/react-ui"),K=require("./markdown.js"),x=require("@copilotkit/react-core"),o=require("@copilotkit/runtime-client-gql");const F=({messages:t,inProgress:s,ResponseButton:i,messagesCallback:p,children:a})=>{const[m,d]=(0,r.useState)(!0),{chatComponentsCache:g}=(0,x.useCopilotContext)(),u=(0,k.useChatContext)();t=[...(0,r.useMemo)(()=>D(u.labels.initial),[u.labels.initial]),...t];const h={};for(let e=0;e<t.length;e++)if(t[e]instanceof o.ActionExecutionMessage){const c=t[e].id,l=t.find(f=>f instanceof o.ResultMessage&&f.actionExecutionId===c);l&&(h[c]=o.ResultMessage.decodeResult(l.result||""))}const R=r.default.useRef(null),C=r.default.useRef(null),E=()=>{R.current&&R.current.scrollIntoView({behavior:"auto"})};return(0,r.useEffect)(()=>{E()},[t]),(0,r.useEffect)(()=>{p&&p(t)},[t]),(0,r.useEffect)(()=>{const e=document.querySelector(".copilotKitInput textarea");e&&e.addEventListener("click",function(){e.value&&document.activeElement===e?d(!1):(d(!0),E())}),e&&e.addEventListener("input",function(){e.value&&document.activeElement===e?d(!1):(d(!0),E())})},[]),(0,r.useEffect)(()=>{const e=C.current;m&&e?(e.style.maxHeight="500px",e.style.overflow="visible"):!m&&e&&(e.style.maxHeight="0",e.style.overflow="hidden")},[m]),(0,n.jsxs)("div",{className:"copilotKitMessages",children:[t.map((e,c)=>{const l=c===t.length-1;if(e instanceof o.TextMessage&&e.role==="user")return(0,n.jsx)("div",{className:"copilotKitMessage copilotKitUserMessage",children:(0,n.jsx)(K.Markdown,{content:e.content})},c);if(e instanceof o.TextMessage&&e.role=="assistant")return(0,n.jsx)("div",{className:"copilotKitMessage copilotKitAssistantMessage",children:l&&s&&!e.content?u.icons.spinnerIcon:(0,n.jsx)(K.Markdown,{content:e.content})},c);if(e instanceof o.ActionExecutionMessage)if(g.current!==null&&g.current[e.name]){const f=g.current[e.name];if(typeof f=="string")return l&&s?(0,n.jsxs)("div",{className:"copilotKitMessage copilotKitAssistantMessage",children:[u.icons.spinnerIcon," ",(0,n.jsx)("span",{className:"inProgressLabel",children:f})]},c):null;{const N=e.arguments;let M="inProgress";h[e.id]!==void 0?M="complete":e.status.code!==o.MessageStatusCode.Pending&&(M="executing");const v=f({status:M,args:N,result:h[e.id]});return!v&&M==="complete"?null:typeof v=="string"?(0,n.jsxs)("div",{className:"copilotKitMessage copilotKitAssistantMessage",children:[l&&s&&u.icons.spinnerIcon," ",v]},c):(0,n.jsx)("div",{className:"copilotKitCustomAssistantMessage",children:v},c)}}else return!s||!l?null:(0,n.jsx)("div",{className:"copilotKitMessage copilotKitAssistantMessage",children:u.icons.spinnerIcon},c)}),(0,n.jsx)("div",{className:"responseButtonBox",children:i}),(0,n.jsx)("footer",{ref:R,children:(0,n.jsx)("div",{className:"copilotKitMessagesFooter",ref:C,children:a})})]})};function D(t){let s=[];return t&&(Array.isArray(t)?s.push(...t):s.push(t)),s.map(i=>new o.TextMessage({role:o.Role.Assistant,content:i}))}var P=F;
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { Message } from '@copilotkit/runtime-client-gql';
3
+ export interface ButtonProps {
4
+ open: boolean;
5
+ setOpen: () => void;
6
+ }
7
+ export interface WindowProps {
8
+ open: boolean;
9
+ setOpen: (open: boolean) => void;
10
+ clickOutsideToClose: boolean;
11
+ hitEscapeToClose: boolean;
12
+ shortcut: string;
13
+ children?: React.ReactNode;
14
+ }
15
+ export interface HeaderProps {
16
+ open: boolean;
17
+ setOpen: (open: boolean) => void;
18
+ }
19
+ export interface ChatSuggestions {
20
+ currentSuggestions: SuggestionsProps[];
21
+ }
22
+ export interface SuggestionsProps {
23
+ title: string;
24
+ message: string;
25
+ partial?: boolean;
26
+ className?: string;
27
+ }
28
+ export interface MessagesProps {
29
+ messages: Message[];
30
+ inProgress: boolean;
31
+ ResponseButton?: React.ReactElement;
32
+ children?: React.ReactNode;
33
+ messagesCallback?: (messages: any) => void;
34
+ }
35
+ export interface InputProps {
36
+ inProgress: boolean;
37
+ onSend: (text: string) => Promise<Message>;
38
+ isVisible?: boolean;
39
+ }
40
+ export interface ResponseButtonProps {
41
+ onClick: () => void;
42
+ inProgress: boolean;
43
+ }
@@ -0,0 +1 @@
1
+ "use strict";var n=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var c=(o,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of i(e))!p.call(o,s)&&s!==r&&n(o,s,{get:()=>e[s],enumerable:!(t=a(e,s))||t.enumerable});return o};var l=o=>c(n({},"__esModule",{value:!0}),o);var g={};module.exports=l(g);var d=require("react"),m=require("@copilotkit/runtime-client-gql");
@@ -0,0 +1,4 @@
1
+ declare const ResponseButton: ({ messagesId }: {
2
+ messagesId: string;
3
+ }) => false | import("react/jsx-runtime").JSX.Element;
4
+ export default ResponseButton;
@@ -0,0 +1 @@
1
+ "use strict";var p=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(s,e)=>{for(var o in e)p(s,o,{get:e[o],enumerable:!0})},m=(s,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of l(e))!g.call(s,t)&&t!==o&&p(s,t,{get:()=>e[t],enumerable:!(n=c(e,t))||n.enumerable});return s};var d=s=>m(p({},"__esModule",{value:!0}),s);var I={};u(I,{default:()=>b});module.exports=d(I);var a=require("react/jsx-runtime"),r=require("@copilotkit/react-ui"),i=require("@copilotkit/react-core");const C=({messagesId:s})=>{const e=(0,r.useChatContext)(),{isLoading:o,reloadMessages:n,stopGeneration:t}=(0,i.useCopilotChat)();return!o&&(0,a.jsxs)("button",{onClick:()=>o?t():n(),className:"copilotKitResponseButton",children:[o?e.labels.stopGenerating:e.labels.regenerateResponse,(0,a.jsx)("span",{children:o?e.icons.stopIcon:e.icons.regenerateIcon})]})};var b=C;
@@ -0,0 +1,3 @@
1
+ import type { ChatSuggestions } from './props.js';
2
+ declare const Suggestions: ({ currentSuggestions }: ChatSuggestions) => false | import("react/jsx-runtime").JSX.Element;
3
+ export default Suggestions;
@@ -0,0 +1 @@
1
+ "use strict";var g=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var C=(o,s)=>{for(var e in s)g(o,e,{get:s[e],enumerable:!0})},b=(o,s,e,n)=>{if(s&&typeof s=="object"||typeof s=="function")for(let t of c(s))!f.call(o,t)&&t!==e&&g(o,t,{get:()=>s[t],enumerable:!(n=d(s,t))||n.enumerable});return o};var h=o=>b(g({},"__esModule",{value:!0}),o);var k={};C(k,{default:()=>v});module.exports=h(k);var p=require("react/jsx-runtime"),i=require("@copilotkit/react-core"),a=require("@copilotkit/runtime-client-gql");const S=({currentSuggestions:o})=>{const{appendMessage:s}=(0,i.useCopilotChat)();return o?.length>0&&(0,p.jsx)("div",{className:"suggestions",children:o.map(({title:e,message:n,partial:t,className:r},u)=>(0,p.jsx)("button",{disabled:t,onClick:l=>{l.preventDefault();const m=new a.TextMessage({content:n,role:a.Role.User});s(m)},className:r||"suggestion",children:(0,p.jsx)("span",{children:e})},n+u))})};var v=S;
@@ -0,0 +1,3 @@
1
+ import { useCopilotChat, useCopilotAction, useCopilotReadable } from '@copilotkit/react-core';
2
+ import { Role, ActionExecutionMessage, TextMessage } from '@copilotkit/runtime-client-gql';
3
+ export { useCopilotChat, useCopilotAction, useCopilotReadable, Role, ActionExecutionMessage, TextMessage };
@@ -0,0 +1 @@
1
+ "use strict";var a=Object.defineProperty;var r=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var C=(i,o)=>{for(var p in o)a(i,p,{get:o[p],enumerable:!0})},c=(i,o,p,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let s of m(o))!u.call(i,s)&&s!==p&&a(i,s,{get:()=>o[s],enumerable:!(l=r(o,s))||l.enumerable});return i};var n=i=>c(a({},"__esModule",{value:!0}),i);var x={};C(x,{ActionExecutionMessage:()=>t.ActionExecutionMessage,Role:()=>t.Role,TextMessage:()=>t.TextMessage,useCopilotAction:()=>e.useCopilotAction,useCopilotChat:()=>e.useCopilotChat,useCopilotReadable:()=>e.useCopilotReadable});module.exports=n(x);var e=require("@copilotkit/react-core"),t=require("@copilotkit/runtime-client-gql");