@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.js CHANGED
@@ -4801,7 +4801,7 @@ function footerButtonField(field) {
4801
4801
  return match ? { listField: match[1], index: Number(match[3]) } : void 0;
4802
4802
  }
4803
4803
  function isCmsButtonField(field) {
4804
- return isCmsHeaderButtonField(field) || Boolean(downloadButtonField(field) || footerButtonField(field));
4804
+ return isCmsHeaderButtonField(field) || /^(vi|en)\.landing\.hero\.cta$/.test(field) || Boolean(downloadButtonField(field) || footerButtonField(field));
4805
4805
  }
4806
4806
  function safeCmsButtonHref(value4, type) {
4807
4807
  const href = safeCmsTextHref(value4);
@@ -4812,7 +4812,7 @@ function getCmsButtonLink(content, field) {
4812
4812
  const footer2 = footerButtonField(field);
4813
4813
  const item = footer2 ? parseChromeItems(content[footer2.listField])?.[footer2.index] : void 0;
4814
4814
  const key = downloadButtonField(field) ?? field;
4815
- const value4 = footer2 ? item?.href ?? "" : String(content[`${key}Href`] ?? (field.endsWith(".register") ? "/#register" : ""));
4815
+ const value4 = footer2 ? item?.href ?? "" : String(content[`${key}Href`] ?? (field.endsWith(".register") || /^(vi|en)\.landing\.hero\.cta$/.test(field) ? "/#register" : ""));
4816
4816
  const storedType = footer2 ? item?.linkType : content[`${key}LinkType`];
4817
4817
  const type = storedType === "external" || storedType !== "internal" && /^https?:\/\//i.test(value4) ? "external" : "internal";
4818
4818
  return { type, value: value4, href: item?.hrefEnabled === "false" ? void 0 : safeCmsButtonHref(value4, type) };
@@ -4829,6 +4829,30 @@ function cmsButtonLinkChanges(content, field, value4, type) {
4829
4829
  const key = downloadButtonField(field) ?? field;
4830
4830
  return { [`${key}Href`]: value4, [`${key}LinkType`]: type };
4831
4831
  }
4832
+ var cmsHeroButtonLinkFields = ["vi", "en"].flatMap((language) => {
4833
+ const field = `${language}.landing.hero.cta`;
4834
+ const group = language === "vi" ? "Ti\u1EBFng Vi\u1EC7t" : "English";
4835
+ return [
4836
+ {
4837
+ key: `${field}LinkType`,
4838
+ label: "M\u1EDF t\xE0i kho\u1EA3n \u2014 lo\u1EA1i li\xEAn k\u1EBFt",
4839
+ type: "select",
4840
+ group,
4841
+ options: [{ value: "internal", label: "Internal \u2014 trong website" }, { value: "external", label: "External \u2014 website kh\xE1c (tab m\u1EDBi)" }]
4842
+ },
4843
+ {
4844
+ key: `${field}Href`,
4845
+ label: "M\u1EDF t\xE0i kho\u1EA3n \u2014 \u0111\u01B0\u1EDDng d\u1EABn",
4846
+ type: "link",
4847
+ group,
4848
+ helperText: "Internal: /duong-dan/ ho\u1EB7c #muc. External: https://\u2026 M\u1EDF trong tab m\u1EDBi."
4849
+ }
4850
+ ];
4851
+ });
4852
+ var cmsHeroButtonLinkDefaults = Object.fromEntries(["vi", "en"].flatMap((language) => [
4853
+ [`${language}.landing.hero.ctaLinkType`, "internal"],
4854
+ [`${language}.landing.hero.ctaHref`, "/#register"]
4855
+ ]));
4832
4856
  var cmsDownloadButtonLinkFields = ["vi", "en"].flatMap(
4833
4857
  (language) => ["appStore", "googlePlay", "web"].flatMap((platform) => {
4834
4858
  const field = `${language}.landing.download.${platform}`;
@@ -15167,7 +15191,12 @@ var HeroArt_default = HeroArtBlock;
15167
15191
  // src/commodity-original/components/LandingPage/HeroSection.tsx
15168
15192
  var import_jsx_runtime54 = require("react/jsx-runtime");
15169
15193
  function HeroSection2() {
15170
- const { t } = (0, import_react_i18next23.useTranslation)();
15194
+ const { t, i18n } = (0, import_react_i18next23.useTranslation)();
15195
+ const language = i18n.resolvedLanguage?.startsWith("en") ? "en" : "vi";
15196
+ const ctaField = `${language}.landing.hero.cta`;
15197
+ const content = useCmsElementContent();
15198
+ const editing = useCmsElementEditing();
15199
+ const ctaLink = getCmsButtonLink(content ?? {}, ctaField);
15171
15200
  const background = useCmsImage(
15172
15201
  "heroBackgroundImage",
15173
15202
  "/landing-assets/keyvisual_bg.webp"
@@ -15206,6 +15235,21 @@ function HeroSection2() {
15206
15235
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
15207
15236
  Button_default,
15208
15237
  {
15238
+ labelField: "landing.hero.cta",
15239
+ "data-cms-button-field": ctaField,
15240
+ href: ctaLink.href,
15241
+ target: ctaLink.href && ctaLink.type === "external" ? "_blank" : void 0,
15242
+ rel: ctaLink.href && ctaLink.type === "external" ? "noopener noreferrer" : void 0,
15243
+ disabled: !ctaLink.href && !editing?.editable,
15244
+ onClick: (event) => {
15245
+ if (editing?.editable) {
15246
+ event.preventDefault();
15247
+ event.stopPropagation();
15248
+ const text2 = event.currentTarget.querySelector("[data-cms-text-field]");
15249
+ text2?.focus();
15250
+ editing.onSelectText?.({ field: ctaField, currentColor: text2?.ownerDocument.defaultView?.getComputedStyle(text2).color ?? "" });
15251
+ }
15252
+ },
15209
15253
  size: "sm",
15210
15254
  radius: 6,
15211
15255
  tint: "#F9FAFB",
@@ -16887,7 +16931,7 @@ var footer = exactBlock(
16887
16931
  FooterWithFloatingActions
16888
16932
  );
16889
16933
  var hero = exactBlock(
16890
- { type: "commodity-hero", name: "Landing \u2014 Hero g\u1ED1c", description: "Hero nguy\xEAn b\u1EA3n.", prefixes: ["landing.hero."], images: heroImages },
16934
+ { type: "commodity-hero", name: "Landing \u2014 Hero g\u1ED1c", description: "Hero nguy\xEAn b\u1EA3n.", prefixes: ["landing.hero."], images: heroImages, fields: cmsHeroButtonLinkFields, defaults: cmsHeroButtonLinkDefaults },
16891
16935
  function OriginalHero() {
16892
16936
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
16893
16937
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(LandingAnimations, {}),