@enyxs/wikex-components 0.11.34 → 0.11.35

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/dist/index.mjs CHANGED
@@ -4733,7 +4733,7 @@ function footerButtonField(field) {
4733
4733
  return match ? { listField: match[1], index: Number(match[3]) } : void 0;
4734
4734
  }
4735
4735
  function isCmsButtonField(field) {
4736
- return isCmsHeaderButtonField(field) || Boolean(downloadButtonField(field) || footerButtonField(field));
4736
+ return isCmsHeaderButtonField(field) || /^(vi|en)\.landing\.hero\.cta$/.test(field) || Boolean(downloadButtonField(field) || footerButtonField(field));
4737
4737
  }
4738
4738
  function safeCmsButtonHref(value4, type) {
4739
4739
  const href = safeCmsTextHref(value4);
@@ -4744,7 +4744,7 @@ function getCmsButtonLink(content, field) {
4744
4744
  const footer2 = footerButtonField(field);
4745
4745
  const item = footer2 ? parseChromeItems(content[footer2.listField])?.[footer2.index] : void 0;
4746
4746
  const key = downloadButtonField(field) ?? field;
4747
- const value4 = footer2 ? item?.href ?? "" : String(content[`${key}Href`] ?? (field.endsWith(".register") ? "/#register" : ""));
4747
+ const value4 = footer2 ? item?.href ?? "" : String(content[`${key}Href`] ?? (field.endsWith(".register") || /^(vi|en)\.landing\.hero\.cta$/.test(field) ? "/#register" : ""));
4748
4748
  const storedType = footer2 ? item?.linkType : content[`${key}LinkType`];
4749
4749
  const type = storedType === "external" || storedType !== "internal" && /^https?:\/\//i.test(value4) ? "external" : "internal";
4750
4750
  return { type, value: value4, href: item?.hrefEnabled === "false" ? void 0 : safeCmsButtonHref(value4, type) };
@@ -4761,6 +4761,30 @@ function cmsButtonLinkChanges(content, field, value4, type) {
4761
4761
  const key = downloadButtonField(field) ?? field;
4762
4762
  return { [`${key}Href`]: value4, [`${key}LinkType`]: type };
4763
4763
  }
4764
+ var cmsHeroButtonLinkFields = ["vi", "en"].flatMap((language) => {
4765
+ const field = `${language}.landing.hero.cta`;
4766
+ const group = language === "vi" ? "Ti\u1EBFng Vi\u1EC7t" : "English";
4767
+ return [
4768
+ {
4769
+ key: `${field}LinkType`,
4770
+ label: "M\u1EDF t\xE0i kho\u1EA3n \u2014 lo\u1EA1i li\xEAn k\u1EBFt",
4771
+ type: "select",
4772
+ group,
4773
+ options: [{ value: "internal", label: "Internal \u2014 trong website" }, { value: "external", label: "External \u2014 website kh\xE1c (tab m\u1EDBi)" }]
4774
+ },
4775
+ {
4776
+ key: `${field}Href`,
4777
+ label: "M\u1EDF t\xE0i kho\u1EA3n \u2014 \u0111\u01B0\u1EDDng d\u1EABn",
4778
+ type: "link",
4779
+ group,
4780
+ helperText: "Internal: /duong-dan/ ho\u1EB7c #muc. External: https://\u2026 M\u1EDF trong tab m\u1EDBi."
4781
+ }
4782
+ ];
4783
+ });
4784
+ var cmsHeroButtonLinkDefaults = Object.fromEntries(["vi", "en"].flatMap((language) => [
4785
+ [`${language}.landing.hero.ctaLinkType`, "internal"],
4786
+ [`${language}.landing.hero.ctaHref`, "/#register"]
4787
+ ]));
4764
4788
  var cmsDownloadButtonLinkFields = ["vi", "en"].flatMap(
4765
4789
  (language) => ["appStore", "googlePlay", "web"].flatMap((platform) => {
4766
4790
  const field = `${language}.landing.download.${platform}`;
@@ -15112,7 +15136,12 @@ var HeroArt_default = HeroArtBlock;
15112
15136
  // src/commodity-original/components/LandingPage/HeroSection.tsx
15113
15137
  import { jsx as jsx46, jsxs as jsxs38 } from "react/jsx-runtime";
15114
15138
  function HeroSection2() {
15115
- const { t } = useTranslation23();
15139
+ const { t, i18n } = useTranslation23();
15140
+ const language = i18n.resolvedLanguage?.startsWith("en") ? "en" : "vi";
15141
+ const ctaField = `${language}.landing.hero.cta`;
15142
+ const content = useCmsElementContent();
15143
+ const editing = useCmsElementEditing();
15144
+ const ctaLink = getCmsButtonLink(content ?? {}, ctaField);
15116
15145
  const background = useCmsImage(
15117
15146
  "heroBackgroundImage",
15118
15147
  "/landing-assets/keyvisual_bg.webp"
@@ -15151,6 +15180,21 @@ function HeroSection2() {
15151
15180
  /* @__PURE__ */ jsx46(
15152
15181
  Button_default,
15153
15182
  {
15183
+ labelField: "landing.hero.cta",
15184
+ "data-cms-button-field": ctaField,
15185
+ href: ctaLink.href,
15186
+ target: ctaLink.href && ctaLink.type === "external" ? "_blank" : void 0,
15187
+ rel: ctaLink.href && ctaLink.type === "external" ? "noopener noreferrer" : void 0,
15188
+ disabled: !ctaLink.href && !editing?.editable,
15189
+ onClick: (event) => {
15190
+ if (editing?.editable) {
15191
+ event.preventDefault();
15192
+ event.stopPropagation();
15193
+ const text2 = event.currentTarget.querySelector("[data-cms-text-field]");
15194
+ text2?.focus();
15195
+ editing.onSelectText?.({ field: ctaField, currentColor: text2?.ownerDocument.defaultView?.getComputedStyle(text2).color ?? "" });
15196
+ }
15197
+ },
15154
15198
  size: "sm",
15155
15199
  radius: 6,
15156
15200
  tint: "#F9FAFB",
@@ -16832,7 +16876,7 @@ var footer = exactBlock(
16832
16876
  FooterWithFloatingActions
16833
16877
  );
16834
16878
  var hero = exactBlock(
16835
- { type: "commodity-hero", name: "Landing \u2014 Hero g\u1ED1c", description: "Hero nguy\xEAn b\u1EA3n.", prefixes: ["landing.hero."], images: heroImages },
16879
+ { type: "commodity-hero", name: "Landing \u2014 Hero g\u1ED1c", description: "Hero nguy\xEAn b\u1EA3n.", prefixes: ["landing.hero."], images: heroImages, fields: cmsHeroButtonLinkFields, defaults: cmsHeroButtonLinkDefaults },
16836
16880
  function OriginalHero() {
16837
16881
  return /* @__PURE__ */ jsxs41(Fragment12, { children: [
16838
16882
  /* @__PURE__ */ jsx49(LandingAnimations, {}),