@anker-in/headless-ui 1.3.83 → 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.
- package/CONTRIBUTING.md +57 -0
- package/dist/cjs/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/cjs/biz-components/BrandEquity/BrandEquity.d.ts +2 -0
- package/dist/cjs/biz-components/BrandEquity/BrandEquity.js +1 -1
- package/dist/cjs/biz-components/BrandEquity/types.d.ts +2 -0
- package/dist/cjs/biz-components/BrandEquity/types.js +1 -1
- package/dist/cjs/biz-components/Chat/action.d.ts +25 -0
- package/dist/cjs/biz-components/Chat/action.js +1 -0
- package/dist/cjs/biz-components/Chat/button.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/button.js +1 -0
- package/dist/cjs/biz-components/Chat/chatContext.d.ts +101 -0
- package/dist/cjs/biz-components/Chat/chatContext.js +1 -0
- package/dist/cjs/biz-components/Chat/exports.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/exports.js +1 -0
- package/dist/cjs/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
- package/dist/cjs/biz-components/Chat/helpers/fetchResponse.js +1 -0
- package/dist/cjs/biz-components/Chat/helpers/fetcher.d.ts +2 -0
- package/dist/cjs/biz-components/Chat/helpers/fetcher.js +1 -0
- package/dist/cjs/biz-components/Chat/index.d.ts +71 -0
- package/dist/cjs/biz-components/Chat/index.js +1 -0
- package/dist/cjs/biz-components/Chat/markdown.d.ts +5 -0
- package/dist/cjs/biz-components/Chat/markdown.js +1 -0
- package/dist/cjs/biz-components/Chat/messages.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/messages.js +1 -0
- package/dist/cjs/biz-components/Chat/props.d.ts +43 -0
- package/dist/cjs/biz-components/Chat/props.js +1 -0
- package/dist/cjs/biz-components/Chat/response.d.ts +4 -0
- package/dist/cjs/biz-components/Chat/response.js +1 -0
- package/dist/cjs/biz-components/Chat/suggestions.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/suggestions.js +1 -0
- package/dist/cjs/biz-components/Chat/utils.d.ts +3 -0
- package/dist/cjs/biz-components/Chat/utils.js +1 -0
- package/dist/cjs/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/cjs/biz-components/ImageWithText/types.d.ts +8 -2
- package/dist/cjs/biz-components/ImageWithText/types.js +1 -1
- package/dist/cjs/biz-components/Ksp/index.d.ts +2 -0
- package/dist/cjs/biz-components/Ksp/index.js +1 -1
- package/dist/cjs/biz-components/MarqueeReview/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/cjs/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.js +2 -2
- package/dist/cjs/biz-components/MiniCart/CircleProgress.js +2 -2
- package/dist/cjs/biz-components/MiniCart/MiniCartDialog.js +1 -1
- package/dist/cjs/biz-components/MiniCart/index.d.ts +6 -3
- package/dist/cjs/biz-components/MiniCart/index.js +1 -1
- package/dist/cjs/biz-components/ProductCompare/index.d.ts +1 -1
- package/dist/cjs/biz-components/ProductCompare/index.js +1 -1
- package/dist/cjs/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/cjs/biz-components/ProductHero/types.d.ts +2 -0
- package/dist/cjs/biz-components/ProductHero/types.js +1 -1
- package/dist/cjs/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/cjs/biz-components/Specs/dropdown.js +1 -2
- package/dist/cjs/biz-components/Specs/index.js +1 -1
- package/dist/cjs/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/cjs/components/link.js +1 -1
- package/dist/cjs/hooks/useDraggableScroll.js +1 -1
- package/dist/cjs/hooks/useExposure.d.ts +1 -1
- package/dist/cjs/hooks/useExposure.js +1 -1
- package/dist/cjs/hooks/useViewItemList.d.ts +1 -1
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/shared/ContainerGridContext.d.ts +20 -0
- package/dist/cjs/shared/ContainerGridContext.js +1 -0
- package/dist/cjs/shared/Styles.d.ts +2 -0
- package/dist/cjs/shared/Styles.js +1 -1
- package/dist/cjs/shared/mediaGridSpec.d.ts +87 -0
- package/dist/cjs/shared/mediaGridSpec.js +1 -0
- package/dist/esm/biz-components/ActivitySchedule/index.js +1 -1
- package/dist/esm/biz-components/BrandEquity/BrandEquity.d.ts +2 -0
- package/dist/esm/biz-components/BrandEquity/BrandEquity.js +1 -1
- package/dist/esm/biz-components/BrandEquity/types.d.ts +2 -0
- package/dist/esm/biz-components/Chat/action.d.ts +25 -0
- package/dist/esm/biz-components/Chat/action.js +1 -0
- package/dist/esm/biz-components/Chat/button.d.ts +3 -0
- package/dist/esm/biz-components/Chat/button.js +1 -0
- package/dist/esm/biz-components/Chat/chatContext.d.ts +101 -0
- package/dist/esm/biz-components/Chat/chatContext.js +1 -0
- package/dist/esm/biz-components/Chat/exports.d.ts +3 -0
- package/dist/esm/biz-components/Chat/exports.js +1 -0
- package/dist/esm/biz-components/Chat/helpers/fetchResponse.d.ts +14 -0
- package/dist/esm/biz-components/Chat/helpers/fetchResponse.js +1 -0
- package/dist/esm/biz-components/Chat/helpers/fetcher.d.ts +2 -0
- package/dist/esm/biz-components/Chat/helpers/fetcher.js +1 -0
- package/dist/esm/biz-components/Chat/index.d.ts +71 -0
- package/dist/esm/biz-components/Chat/index.js +1 -0
- package/dist/esm/biz-components/Chat/markdown.d.ts +5 -0
- package/dist/esm/biz-components/Chat/markdown.js +1 -0
- package/dist/esm/biz-components/Chat/messages.d.ts +3 -0
- package/dist/esm/biz-components/Chat/messages.js +1 -0
- package/dist/esm/biz-components/Chat/props.d.ts +43 -0
- package/dist/esm/biz-components/Chat/props.js +1 -0
- package/dist/esm/biz-components/Chat/response.d.ts +4 -0
- package/dist/esm/biz-components/Chat/response.js +1 -0
- package/dist/esm/biz-components/Chat/suggestions.d.ts +3 -0
- package/dist/esm/biz-components/Chat/suggestions.js +1 -0
- package/dist/esm/biz-components/Chat/utils.d.ts +3 -0
- package/dist/esm/biz-components/Chat/utils.js +1 -0
- package/dist/esm/biz-components/ImageWithText/ImageWithText.js +1 -1
- package/dist/esm/biz-components/ImageWithText/types.d.ts +8 -2
- package/dist/esm/biz-components/Ksp/index.d.ts +2 -0
- package/dist/esm/biz-components/Ksp/index.js +1 -1
- package/dist/esm/biz-components/MarqueeReview/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/esm/biz-components/MediaSceneSwitcher/MediaSceneSwitcher.js +2 -2
- package/dist/esm/biz-components/MiniCart/CircleProgress.js +2 -2
- package/dist/esm/biz-components/MiniCart/MiniCartDialog.js +1 -1
- package/dist/esm/biz-components/MiniCart/index.d.ts +6 -3
- package/dist/esm/biz-components/MiniCart/index.js +1 -1
- package/dist/esm/biz-components/ProductCompare/index.d.ts +1 -1
- package/dist/esm/biz-components/ProductCompare/index.js +1 -1
- package/dist/esm/biz-components/ProductHero/ProductHero.js +1 -1
- package/dist/esm/biz-components/ProductHero/types.d.ts +2 -0
- package/dist/esm/biz-components/ProductNav/ProductNav.js +1 -1
- package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/esm/biz-components/Specs/dropdown.js +1 -2
- package/dist/esm/biz-components/Specs/index.js +1 -1
- package/dist/esm/biz-components/ThreeDCarousel/ThreeDCarousel.js +1 -1
- package/dist/esm/components/link.js +1 -1
- package/dist/esm/hooks/useDraggableScroll.js +1 -1
- package/dist/esm/hooks/useExposure.d.ts +1 -1
- package/dist/esm/hooks/useExposure.js +1 -1
- package/dist/esm/hooks/useViewItemList.d.ts +1 -1
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/shared/ContainerGridContext.d.ts +20 -0
- package/dist/esm/shared/ContainerGridContext.js +1 -0
- package/dist/esm/shared/Styles.d.ts +2 -0
- package/dist/esm/shared/Styles.js +1 -1
- package/dist/esm/shared/mediaGridSpec.d.ts +87 -0
- package/dist/esm/shared/mediaGridSpec.js +1 -0
- package/package.json +54 -4
- package/src/biz-components/Chat/styles/chat.css +14 -0
- package/src/biz-components/Chat/styles/css/animations.css +35 -0
- package/src/biz-components/Chat/styles/css/button.css +56 -0
- package/src/biz-components/Chat/styles/css/colors.css +12 -0
- package/src/biz-components/Chat/styles/css/console.css +134 -0
- package/src/biz-components/Chat/styles/css/header.css +43 -0
- package/src/biz-components/Chat/styles/css/input.css +89 -0
- package/src/biz-components/Chat/styles/css/markdown.css +131 -0
- package/src/biz-components/Chat/styles/css/messages.css +85 -0
- package/src/biz-components/Chat/styles/css/panel.css +23 -0
- package/src/biz-components/Chat/styles/css/popup.css +44 -0
- package/src/biz-components/Chat/styles/css/response.css +25 -0
- package/src/biz-components/Chat/styles/css/sidebar.css +31 -0
- package/src/biz-components/Chat/styles/css/suggestions.css +36 -0
- package/src/biz-components/Chat/styles/css/window.css +60 -0
- package/src/biz-components/Chat/styles/image.png +0 -0
- package/style.css +268 -136
- 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||"
|
|
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
|
|
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
|
|
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);
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var fe=Object.create;var S=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var ve=Object.getPrototypeOf,be=Object.prototype.hasOwnProperty;var we=(n,p)=>{for(var g in p)S(n,g,{get:p[g],enumerable:!0})},U=(n,p,g,b)=>{if(p&&typeof p=="object"||typeof p=="function")for(let v of ge(p))!be.call(n,v)&&v!==g&&S(n,v,{get:()=>p[v],enumerable:!(b=he(p,v))||b.enumerable});return n};var _e=(n,p,g)=>(g=n!=null?fe(ve(n)):{},U(p||!n||!n.__esModule?S(g,"default",{value:n,enumerable:!0}):g,n)),ye=n=>U(S({},"__esModule",{value:!0}),n);var Ie={};we(Ie,{default:()=>Te});module.exports=ye(Ie);var e=require("react/jsx-runtime"),a=_e(require("react")),r=require("../../components/index.js"),l=require("../../helpers/utils.js"),ee=require("../../shared/Styles.js"),te=require("../../hooks/useExposure.js"),ie=require("../../hooks/useIntersectionObserver.js"),ae=require("../AiuiProvider/index.js"),k=require("framer-motion");const ke="image",Ne="image_with_text",X=(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,e.jsx)("path",{d:"M6.91009 4.41058C7.23553 4.08514 7.76304 4.08514 8.08848 4.41058L13.0885 9.41058C13.4139 9.73602 13.4139 10.2635 13.0885 10.589L8.08848 15.589C7.76304 15.9144 7.23553 15.9144 6.91009 15.589C6.58466 15.2635 6.58466 14.736 6.91009 14.4106L11.3209 9.99977L6.91009 5.58897C6.58466 5.26353 6.58466 4.73602 6.91009 4.41058Z",fill:"currentColor"})}),Y=a.default.forwardRef(({data:n,className:p},g)=>{const{title:b,subtitle:v,desc:_,descIcon:M,image:N,padImage:z,mobileImage:E,theme:oe="dark",items:H=[],layout:le="left",mediaType:se="image",datalist:d=[],video:j,padVideo:R,mobVideo:W,button:w,textAlign:m="left",titleTag:re}=n,i=le,{locale:C="us"}=(0,ae.useAiuiContext)(),D=(0,a.useRef)(null),I=(0,a.useRef)(null),L=(0,a.useRef)(null),P=(0,a.useRef)(null),A=(0,a.useRef)(null),[u,ne]=(0,a.useState)(0),q=(0,a.useRef)([]),[$,me]=(0,a.useState)({left:0,width:0}),[y,B]=(0,a.useState)(""),[F,O]=(0,a.useState)(""),[Z,G]=(0,a.useState)(""),c=d.length>0,T=se==="video";(0,te.useExposure)(D,{componentType:ke,componentName:Ne,componentTitle:b,componentDescription:v}),(0,a.useImperativeHandle)(g,()=>D.current),(0,a.useEffect)(()=>{if(d.length>0){const t=q.current[u];if(t){const{offsetLeft:s,offsetWidth:o}=t;me({left:s,width:o})}}},[u,d.length]);const[J,de]=(0,a.useState)(!1);(0,ie.useIntersectionObserverDelay)(A,{once:!0,threshold:.01,callback:()=>{de(!0)}}),(0,a.useEffect)(()=>{if(!J||!T)return;let t="",s="",o="";if(c&&d[u]){const f=d[u];t=f.video?.url||"",s=f.padVideo?.url||t,o=f.mobVideo?.url||t}else t=j?.url||"",s=R?.url||t,o=W?.url||t;t&&B(t),s&&O(s),o&&G(o),setTimeout(()=>{[I.current?.querySelector("video"),L.current?.querySelector("video"),P.current?.querySelector("video")].forEach(h=>{h&&(h.load(),h.play().catch(()=>{}))})},200)},[J,T,c,u,d,j?.url,R?.url,W?.url]);const pe=(t,s)=>{if(ne(t),s.target.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"}),T&&c&&d[t]){const o=d[t];o.video?.url&&B(o.video.url),o.padVideo?.url&&O(o.padVideo.url),o.mobVideo?.url&&G(o.mobVideo.url),setTimeout(()=>{[I.current?.querySelector("video"),L.current?.querySelector("video"),P.current?.querySelector("video")].forEach(h=>{h&&(h.load(),h.play().catch(()=>{}))})},300)}},ce=()=>!V||!w?.text||i==="top"||i==="bottom"?null:(0,e.jsx)("div",{className:(0,l.cn)("image-with-text__button-wrapper laptop:mt-[32px] mt-[24px]",{"flex justify-center":m==="center","flex justify-start":m==="left"}),children:(0,e.jsx)(r.Link,{href:(0,l.getLocalizedPath)(w.link||"",C),className:"image-with-text__button whitespace-nowrap no-underline",suffixIcon:X,children:w.text})}),x=H.length>0,V=!!w,K=()=>{if(c&&d[u]){const t=d[u];return`${t.image?.url} ,${t.imgPad?.url||t.image?.url} 1440, ${t.imageMob?.url||t.image?.url} 767`}return N?`${N?.url},${z?.url||N?.url} 1024, ${E?.url||N?.url} 768`:""},Q=()=>{if(c){const f=d[u],h=f.image?.url,xe=f.imgPad?.url||h,ue=f.imageMob?.url||h;return(0,e.jsx)(k.AnimatePresence,{mode:"wait",children:(0,e.jsx)(k.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__video-motion absolute left-0 top-0 w-full",children:(0,e.jsxs)("div",{className:"image-with-text__video-wrapper rounded-box overflow-hidden",children:[(0,e.jsx)("div",{ref:I,className:"image-with-text__desktop-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:h,src:y,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),(0,e.jsx)("div",{ref:L,className:"image-with-text__tablet-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:xe,src:F||y,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),(0,e.jsx)("div",{ref:P,className:"image-with-text__mobile-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:ue,src:Z||y,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})},f.video?.url||f.image?.url)})}const t=N?.url,s=z?.url||t,o=E?.url||t;return(0,e.jsxs)("div",{className:"image-with-text__video-wrapper rounded-box laptop:rounded-box overflow-hidden",children:[(0,e.jsx)("div",{ref:I,className:"image-with-text__desktop-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:t,src:y,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),(0,e.jsx)("div",{ref:L,className:"image-with-text__tablet-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:s,src:F||y,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),(0,e.jsx)("div",{ref:P,className:"image-with-text__mobile-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:o,src:Z||y,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})};return(0,e.jsxs)("section",{ref:D,"data-ui-component-id":"ImageWithText",className:(0,l.cn)("image-with-text text-info-primary",{"flex gap-[24px] laptop:gap-[48px] lg-desktop:gap-[64px]":!c,"flex-col":!c&&(i==="top"||i==="bottom"),"items-center":i==="left"||i==="right","flex-col laptop:flex-row":!c&&(i==="left"||i==="right"),"flex l:gap-[24px] xl:flex-col min-md:justify-between min-l:gap-[20px]":c,"aiui-dark":oe==="dark"},p),children:[c&&(b||_||d.length>0)&&(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__tab-content min-md:gap-[24px] laptop:basis-[36%] inline-flex flex-col justify-center",{"text-left":m==="left","text-center":m==="center"}),children:[(0,e.jsxs)("div",{className:"image-with-text__header",children:[(0,e.jsx)(r.Heading,{as:"h3",size:4,html:b,className:"image-with-text__title"}),(0,e.jsx)(r.Text,{as:"p",size:1,html:_,className:"image-with-text__description tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-[14px]"})]}),(0,e.jsx)("div",{className:(0,l.cn)("image-with-text__tabs-wrapper md:scrollbar-hidden relative md:overflow-hidden md:overflow-x-scroll",{"flex justify-center":m==="center"}),children:(0,e.jsxs)("div",{className:"image-with-text__tabs rounded-btn relative inline-flex bg-[#1D1D1F] px-[4px] md:my-[24px]",children:[(0,e.jsx)("div",{className:"image-with-text__slider rounded-btn absolute inset-y-0 bg-white transition-all duration-300 ease-in-out",style:{left:$.left,width:$.width}}),d.map((t,s)=>(0,e.jsx)("div",{ref:o=>{q.current[s]=o},onClick:o=>pe(s,o),className:(0,l.cn)("image-with-text__tab rounded-btn min-xxl:px-[28px] min-xxl:py-[15px] relative z-10 cursor-pointer px-[20px] py-[10px] text-center text-[12px] font-medium transition-colors duration-300 md:px-[20px] md:py-[10px]",u===s?"image-with-text__tab--active text-black":"text-white"),children:(0,e.jsx)(r.Heading,{as:re??"h3",size:1,html:t?.title,className:"image-with-text__tab-title text-balance-normal !whitespace-nowrap md:text-[14px]"})},s))]})})]}),!c&&(b||v||_)&&(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__content flex w-full flex-col",{"justify-center":!V,"justify-between":V,"items-start":m==="left"&&x,"items-center":m==="center"&&x,"text-left":m==="left","text-center":m==="center","laptop:order-1":i==="left"}),children:[(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__main-content",{"flex flex-col":V}),children:[(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__header",{"laptop:flex laptop:items-end laptop:justify-between laptop:gap-16":(i==="top"||i==="bottom")&&w?.text}),children:[(0,e.jsxs)("div",{className:"image-with-text__title-wrapper flex min-w-0 flex-1 flex-col",children:[(0,e.jsx)(r.Heading,{as:"h2",size:4,html:b,className:(0,l.cn)("image-with-text__title",{"text-left":x&&m==="left","text-center":x&&m==="center"})}),v&&(0,e.jsx)(r.Text,{as:"p",size:x?4:3,html:v,className:(0,l.cn)("image-with-text__subtitle tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-[14px]",{"laptop:mt-[16px]":!x,"min-xxl:mt-[8px] laptop:text-[16px] lg-desktop:text-[18px]":x,"text-left":x&&m==="left","text-center":x&&m==="center"})})]}),(i==="top"||i==="bottom")&&w?.text&&(0,e.jsx)(r.Link,{href:(0,l.getLocalizedPath)(w.link||"",C),className:"laptop:flex hidden whitespace-nowrap no-underline",suffixIcon:X,children:w.text})]}),!x&&(_||M)&&(0,e.jsxs)("div",{className:"image-with-text__description flex flex-row gap-[8px]",children:[M&&(0,e.jsx)("img",{src:M,alt:"icon",className:"image-with-text__description-icon desktop:size-[48px] size-[36px]"}),_&&(0,e.jsx)(r.Heading,{as:"h4",size:5,html:_,className:"image-with-text__description-text min-md:text-[40px] min-l:text-[40px] min-xl:text-[56px] min-xxl:text-[64px] text-[#3AD1FF] md:text-[40px]"})]}),x&&(0,e.jsx)("div",{className:(0,l.cn)("image-with-text__items laptop:mt-[32px] desktop:mt-[48px] mt-[24px] grid w-full gap-6",{"!mt-6":i==="top"||i==="bottom","grid-cols-2 tablet:grid-cols-4":i==="top"||i==="bottom","grid-cols-2 tablet:grid-cols-4 laptop:grid-cols-2":i==="left"||i==="right"}),children:H.map((t,s)=>(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__item",{"text-center":m==="center"}),children:[(0,e.jsxs)("div",{className:(0,l.cn)("image-with-text__item-header flex flex-row items-center gap-[8px]",{"justify-center":m==="center","justify-start":m==="left"}),children:[t.icon?.url&&(0,e.jsx)(r.Picture,{source:t.icon.url,alt:t.icon?.alt,className:"image-with-text__item-icon min-md:text-[40px] min-l:text-[40px] min-xl:text-[56px] min-xxl:text-[64px] desktop:h-[44px] lg-desktop:h-[52px] h-[28px] translate-y-[-12%] md:text-[40px]",imgClassName:"h-full !w-full"}),(0,e.jsx)(r.Heading,{size:4,as:"h6",className:"image-with-text__item-text bg-gradient-to-r from-[#3ad1ff] to-[#008cd6] bg-clip-text text-transparent",children:t.text})]}),(0,e.jsx)(r.Text,{size:4,as:"p",html:t.desc,className:"image-with-text__item-desc tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[-2px] text-[14px]"})]},s))})]}),ce()]}),(0,e.jsx)("div",{ref:A,className:(0,l.cn)("image-with-text__media-wrapper",{"laptop:w-[60%] w-full shrink-0":i==="left"||i==="right","aspect-[716/720] max-h-[560px] max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[824/560] shrink-0":x,"laptop:basis-[63%] desktop:basis-[57%]":x&&i==="left","relative w-full shrink md:aspect-[358/360] min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] laptop:basis-[64%] desktop:aspect-[648/448]":c,"!max-w-none !max-h-none aspect-auto":i==="top"||i==="bottom"}),children:c?T?Q():(0,e.jsx)(k.AnimatePresence,{mode:"wait",children:(0,e.jsx)(k.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__image-motion absolute left-0 top-0 w-full",children:(0,e.jsx)(r.Picture,{source:K(),alt:d[u].image?.alt,className:"image-with-text__image rounded-box min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] desktop:aspect-[648/448] md:aspect-[358/360]"})},d[u].image?.url)}):T?Q():(0,e.jsx)(r.Picture,{source:K(),className:(0,l.cn)("image-with-text__image rounded-box laptop:rounded-box")})})]})});Y.displayName="ImageWithText";var Te=(0,ee.withLayout)(Y);
|
|
1
|
+
"use strict";"use client";var Te=Object.create;var E=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var Le=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty;var Pe=(d,p)=>{for(var f in p)E(d,f,{get:p[f],enumerable:!0})},ie=(d,p,f,w)=>{if(p&&typeof p=="object"||typeof p=="function")for(let v of Se(p))!Me.call(d,v)&&v!==f&&E(d,v,{get:()=>p[v],enumerable:!(w=Ie(p,v))||w.enumerable});return d};var Ve=(d,p,f)=>(f=d!=null?Te(Le(d)):{},ie(p||!d||!d.__esModule?E(f,"default",{value:d,enumerable:!0}):f,d)),Ce=d=>ie(E({},"__esModule",{value:!0}),d);var Ae={};Pe(Ae,{default:()=>He});module.exports=Ce(Ae);var e=require("react/jsx-runtime"),o=Ve(require("react")),s=require("../../components/index.js"),a=require("../../helpers/utils.js"),le=require("../../shared/Styles.js"),D=require("../../shared/mediaGridSpec.js"),se=require("../../shared/ContainerGridContext.js"),re=require("../../hooks/useExposure.js"),ne=require("../../hooks/useIntersectionObserver.js"),me=require("../AiuiProvider/index.js"),N=require("framer-motion");const Ee="image",De="image_with_text",ze={1:"grid-cols-1",2:"grid-cols-2"},Re={1:"tablet:grid-cols-1",2:"tablet:grid-cols-2",3:"tablet:grid-cols-3",4:"tablet:grid-cols-4"},je={1:"laptop:grid-cols-1",2:"laptop:grid-cols-2"},ae=(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:(0,e.jsx)("path",{d:"M6.91009 4.41058C7.23553 4.08514 7.76304 4.08514 8.08848 4.41058L13.0885 9.41058C13.4139 9.73602 13.4139 10.2635 13.0885 10.589L8.08848 15.589C7.76304 15.9144 7.23553 15.9144 6.91009 15.589C6.58466 15.2635 6.58466 14.736 6.91009 14.4106L11.3209 9.99977L6.91009 5.58897C6.58466 5.26353 6.58466 4.73602 6.91009 4.41058Z",fill:"currentColor"})}),oe=o.default.forwardRef(({data:d,className:p},f)=>{const{title:w,subtitle:v,desc:_,descIcon:z,image:T,padImage:j,mobileImage:H,theme:de="dark",items:I=[],layout:ce="left",mediaType:pe="image",datalist:c=[],video:A,padVideo:W,mobVideo:$,button:b,textAlign:r="left",titleTag:xe,caption:L}=d,i=ce,{locale:q="us"}=(0,me.useAiuiContext)(),R=(0,o.useRef)(null),M=(0,o.useRef)(null),P=(0,o.useRef)(null),V=(0,o.useRef)(null),B=(0,o.useRef)(null),[x,ue]=(0,o.useState)(0),O=(0,o.useRef)([]),[F,he]=(0,o.useState)({left:0,width:0}),[k,G]=(0,o.useState)(""),[Z,J]=(0,o.useState)(""),[K,Q]=(0,o.useState)(""),n=c.length>0,S=pe==="video",U=(0,se.useContainerGrid)(),X=i==="bottom"?"bottom":"left-right",y=!n&&U?(0,D.resolveMediaGridSpec)(U.gridColumns,X):void 0,ge=y?{...(0,D.mediaGridSpecToCssVars)(y),"--mw-l":`${y.laptop.w}px`,"--mw-d":`${y.desktop.w}px`,"--mw-x":`${y.lgDesktop.w}px`}:void 0,fe=ze[Math.min(I.length,2)],ve=Re[Math.min(I.length,4)],we=je[Math.min(I.length,2)];(0,re.useExposure)(R,{componentType:Ee,componentName:De,componentTitle:w,componentDescription:v}),(0,o.useImperativeHandle)(f,()=>R.current),(0,o.useEffect)(()=>{if(c.length>0){const t=O.current[x];if(t){const{offsetLeft:m,offsetWidth:l}=t;he({left:m,width:l})}}},[x,c.length]);const[Y,be]=(0,o.useState)(!1);(0,ne.useIntersectionObserverDelay)(B,{once:!0,threshold:.01,callback:()=>{be(!0)}}),(0,o.useEffect)(()=>{if(!Y||!S)return;let t="",m="",l="";if(n&&c[x]){const h=c[x];t=h.video?.url||"",m=h.padVideo?.url||t,l=h.mobVideo?.url||t}else t=A?.url||"",m=W?.url||t,l=$?.url||t;t&&G(t),m&&J(m),l&&Q(l),setTimeout(()=>{[M.current?.querySelector("video"),P.current?.querySelector("video"),V.current?.querySelector("video")].forEach(g=>{g&&(g.load(),g.play().catch(()=>{}))})},200)},[Y,S,n,x,c,A?.url,W?.url,$?.url]);const _e=(t,m)=>{if(ue(t),m.target.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"}),S&&n&&c[t]){const l=c[t];l.video?.url&&G(l.video.url),l.padVideo?.url&&J(l.padVideo.url),l.mobVideo?.url&&Q(l.mobVideo.url),setTimeout(()=>{[M.current?.querySelector("video"),P.current?.querySelector("video"),V.current?.querySelector("video")].forEach(g=>{g&&(g.load(),g.play().catch(()=>{}))})},300)}},ke=()=>!C||!b?.text||i==="bottom"?null:(0,e.jsx)("div",{className:(0,a.cn)("image-with-text__button-wrapper mt-[24px]",{"flex justify-center":r==="center","flex justify-start":r==="left"}),children:(0,e.jsx)(s.Link,{href:(0,a.getLocalizedPath)(b.link||"",q),className:"image-with-text__button lg-desktop:text-[16px] whitespace-nowrap text-[14px] no-underline",suffixIcon:ae,children:b.text})}),u=I.length>0,C=!!b,ee=()=>{if(n&&c[x]){const t=c[x];return`${t.image?.url} ,${t.imgPad?.url||t.image?.url} 1440, ${t.imageMob?.url||t.image?.url} 767`}return T?`${T?.url},${j?.url||T?.url} 1024, ${H?.url||T?.url} 768`:""},te=()=>{if(n){const h=c[x],g=h.image?.url,ye=h.imgPad?.url||g,Ne=h.imageMob?.url||g;return(0,e.jsx)(N.AnimatePresence,{mode:"wait",children:(0,e.jsx)(N.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__video-motion absolute left-0 top-0 w-full",children:(0,e.jsxs)("div",{className:"image-with-text__video-wrapper rounded-box overflow-hidden",children:[(0,e.jsx)("div",{ref:M,className:"image-with-text__desktop-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:g,src:k,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),(0,e.jsx)("div",{ref:P,className:"image-with-text__tablet-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:ye,src:Z||k,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),(0,e.jsx)("div",{ref:V,className:"image-with-text__mobile-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:Ne,src:K||k,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})},h.video?.url||h.image?.url)})}const t=T?.url,m=j?.url||t,l=H?.url||t;return(0,e.jsxs)("div",{className:"image-with-text__video-wrapper rounded-box laptop:rounded-box overflow-hidden",children:[(0,e.jsx)("div",{ref:M,className:"image-with-text__desktop-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:t,src:k,loop:!0,className:"image-with-text__video image-with-text__video--desktop lg-desktop:block hidden size-full object-cover"})}),(0,e.jsx)("div",{ref:P,className:"image-with-text__tablet-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:m,src:Z||k,loop:!0,className:"image-with-text__video image-with-text__video--tablet tablet:block lg-desktop:hidden hidden"})}),(0,e.jsx)("div",{ref:V,className:"image-with-text__mobile-video-container",children:(0,e.jsx)("video",{playsInline:!0,autoPlay:!0,muted:!0,poster:l,src:K||k,loop:!0,className:"image-with-text__video image-with-text__video--mobile tablet:hidden block"})})]})};return(0,e.jsxs)("section",{ref:R,"data-ui-component-id":"ImageWithText",className:(0,a.cn)("image-with-text text-info-primary",{flex:!n,"gap-[24px]":!n&&i==="bottom","gap-[24px] laptop:gap-[48px] lg-desktop:gap-[64px]":!n&&i!=="bottom","flex-col":!n&&i==="bottom","items-center":i==="left"||i==="right","flex-col laptop:flex-row":!n&&(i==="left"||i==="right"),"flex l:gap-[24px] xl:flex-col min-md:justify-between min-l:gap-[20px]":n,"aiui-dark":de==="dark"},p),children:[n&&(w||_||c.length>0)&&(0,e.jsxs)("div",{className:(0,a.cn)("image-with-text__tab-content min-md:gap-[24px] laptop:basis-[36%] inline-flex flex-col justify-center",{"text-left":r==="left","text-center":r==="center"}),children:[(0,e.jsxs)("div",{className:"image-with-text__header",children:[(0,e.jsx)(s.Heading,{as:"h3",size:4,html:w,className:"image-with-text__title"}),(0,e.jsx)(s.Text,{as:"p",size:1,html:_,className:"image-with-text__description tablet:text-[14px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px] mt-[4px] text-[14px]"})]}),(0,e.jsx)("div",{className:(0,a.cn)("image-with-text__tabs-wrapper md:scrollbar-hidden relative md:overflow-hidden md:overflow-x-scroll",{"flex justify-center":r==="center"}),children:(0,e.jsxs)("div",{className:"image-with-text__tabs rounded-btn relative inline-flex bg-[#1D1D1F] px-[4px] md:my-[24px]",children:[(0,e.jsx)("div",{className:"image-with-text__slider rounded-btn absolute inset-y-0 bg-white transition-all duration-300 ease-in-out",style:{left:F.left,width:F.width}}),c.map((t,m)=>(0,e.jsx)("div",{ref:l=>{O.current[m]=l},onClick:l=>_e(m,l),className:(0,a.cn)("image-with-text__tab rounded-btn min-xxl:px-[28px] min-xxl:py-[15px] relative z-10 cursor-pointer px-[20px] py-[10px] text-center text-[12px] font-medium transition-colors duration-300 md:px-[20px] md:py-[10px]",x===m?"image-with-text__tab--active text-black":"text-white"),children:(0,e.jsx)(s.Heading,{as:xe??"h3",size:1,html:t?.title,className:"image-with-text__tab-title text-balance-normal !whitespace-nowrap md:text-[14px]"})},m))]})})]}),!n&&(w||v||_)&&(0,e.jsxs)("div",{className:(0,a.cn)("image-with-text__content flex w-full flex-col",{"justify-center":!C,"justify-between":C,"items-start":r==="left"&&u,"items-center":r==="center"&&u,"text-left":r==="left","text-center":r==="center","laptop:order-1":i==="left"}),children:[(0,e.jsxs)("div",{className:(0,a.cn)("image-with-text__main-content",{"flex flex-col":C}),children:[(0,e.jsxs)("div",{className:(0,a.cn)("image-with-text__header",{"laptop:flex laptop:items-end laptop:justify-between laptop:gap-16":i==="bottom"&&b?.text}),children:[(0,e.jsxs)("div",{className:"image-with-text__title-wrapper flex min-w-0 flex-1 flex-col",children:[(0,e.jsx)(s.Heading,{as:"h2",size:4,html:w,className:(0,a.cn)("image-with-text__title",{"text-left":u&&r==="left","text-center":u&&r==="center"})}),v&&(0,e.jsx)(s.Text,{as:"p",size:u?4:3,html:v,className:(0,a.cn)("image-with-text__subtitle tablet:mt-[8px] lg-desktop:text-[16px] mt-[4px] text-[14px]",{"text-left":u&&r==="left","text-center":u&&r==="center"})})]}),i==="bottom"&&b?.text&&(0,e.jsx)(s.Link,{href:(0,a.getLocalizedPath)(b.link||"",q),className:"laptop:flex lg-desktop:text-[16px] hidden whitespace-nowrap text-[14px] no-underline",suffixIcon:ae,children:b.text})]}),!u&&(_||z)&&(0,e.jsxs)("div",{className:"image-with-text__description flex flex-row gap-[8px]",children:[z&&(0,e.jsx)("img",{src:z,alt:"icon",className:"image-with-text__description-icon desktop:size-[48px] size-[36px]"}),_&&(0,e.jsx)(s.Heading,{as:"h4",size:5,html:_,className:"image-with-text__description-text min-md:text-[40px] min-l:text-[40px] min-xl:text-[56px] min-xxl:text-[64px] text-[#3AD1FF] md:text-[40px]"})]}),u&&(0,e.jsx)("div",{className:(0,a.cn)("image-with-text__items laptop:mt-[32px] desktop:mt-[24px] mt-[16px] grid w-full gap-6",fe,ve,{"!mt-6":i==="bottom",[we]:i==="left"||i==="right"}),children:I.map((t,m)=>(0,e.jsxs)("div",{className:(0,a.cn)("image-with-text__item",{"text-center":r==="center"}),children:[(0,e.jsxs)("div",{className:(0,a.cn)("image-with-text__item-header flex flex-row items-center gap-[8px]",{"justify-center":r==="center","justify-start":r==="left"}),children:[t.icon?.url&&(0,e.jsx)(s.Picture,{source:t.icon.url,alt:t.icon?.alt,className:"image-with-text__item-icon desktop:h-[32px] lg-desktop:h-[40px] h-[24px]",imgClassName:"h-full !w-full"}),(0,e.jsx)(s.Heading,{size:4,as:"h6",className:"image-with-text__item-text bg-gradient-to-r from-[#3ad1ff] to-[#008cd6] bg-clip-text text-transparent",children:t.text})]}),(0,e.jsx)(s.Text,{size:4,as:"p",html:t.desc,className:"image-with-text__item-desc laptop:mt-[16px] lg-desktop:text-[16px] mt-[16px] line-clamp-2 text-[14px]"})]},m))}),L&&(i==="left"||i==="right")&&(0,e.jsx)(s.Text,{as:"p",size:1,weight:"medium",html:L,className:(0,a.cn)("image-with-text__caption tablet:block text-info-secondary mt-[24px] hidden",{"text-center":r==="center"})})]}),ke()]}),(0,e.jsx)("div",{ref:B,style:ge,className:(0,a.cn)("image-with-text__media-wrapper",y?X==="bottom"?"tablet:h-[360px] laptop:h-auto laptop:aspect-[var(--ar-l)] desktop:aspect-[var(--ar-d)] lg-desktop:aspect-[var(--ar-x)] h-[var(--mh-m)] w-full shrink-0":"tablet:h-[360px] laptop:h-auto laptop:w-[var(--mw-l)] laptop:aspect-[var(--ar-l)] desktop:w-[var(--mw-d)] desktop:aspect-[var(--ar-d)] lg-desktop:w-[var(--mw-x)] lg-desktop:aspect-[var(--ar-x)] h-[var(--mh-m)] w-full shrink-0":{"laptop:w-[60%] w-full shrink-0":i==="left"||i==="right","aspect-[716/720] max-h-[560px] max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[824/560] shrink-0":u&&i!=="bottom","laptop:basis-[63%] desktop:basis-[57%]":u&&i==="left","relative w-full shrink md:aspect-[358/360] min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] laptop:basis-[64%] desktop:aspect-[648/448]":n,"!max-w-none !max-h-none aspect-auto":i==="bottom"}),children:n?S?te():(0,e.jsx)(N.AnimatePresence,{mode:"wait",children:(0,e.jsx)(N.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"image-with-text__image-motion absolute left-0 top-0 w-full",children:(0,e.jsx)(s.Picture,{source:ee(),alt:c[x].image?.alt,className:"image-with-text__image rounded-box min-xxl:aspect-[824/560] min-xxl:max-w-[824px] tablet:aspect-[704/360] laptop:aspect-[744/336] desktop:aspect-[648/448] md:aspect-[358/360]"})},c[x].image?.url)}):S?te():(0,e.jsx)(s.Picture,{source:ee(),className:(0,a.cn)("image-with-text__image rounded-box laptop:rounded-box size-full"),imgClassName:"h-full object-cover"})}),L&&!n&&(0,e.jsx)(s.Text,{as:"p",size:1,weight:"medium",html:L,className:(0,a.cn)("image-with-text__caption text-info-secondary mt-[-16px] w-full",{"tablet:hidden":i==="left"||i==="right","text-center":r==="center"})})]})});oe.displayName="ImageWithText";var He=(0,le.withLayout)(oe);
|