@rebuy/rebuy 3.60.3 → 3.60.4

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.
@@ -775,7 +775,7 @@ var isHTML = (html = "") => {
775
775
  }
776
776
  return html.search(HTML_TAGS_REGEX) !== -1;
777
777
  };
778
- var hasHTMLInDoc = (doc) => doc.content.some(({ content = [] }) => content.some(({ text: text2 }) => isHTML(text2)));
778
+ var hasHTMLInDoc = (doc) => doc.content.some(({ content = [] }) => content.some(({ text }) => isHTML(text)));
779
779
  var checkForHTML = (input) => !((0, import_compat2.isString)(input) && isHTML(input) || (0, import_es_toolkit2.isPlainObject)(input) && hasHTMLInDoc(input));
780
780
  var NO_HTML = { message: "HTML is not supported" };
781
781
  var isSectionType = (sectionType) => (section) => (0, import_compat2.get)(section, "sectionType") === sectionType;
@@ -2829,17 +2829,17 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source: sou
2829
2829
  var HTML_COMMENT_RE = /<!--[\s\S]*?-->/g;
2830
2830
  var STRIPPED_ELEMENT_RE = /<(script|style|iframe|object|embed|noscript|template)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/gi;
2831
2831
  var HTML_TAG_RE = /<\/?[a-zA-Z][^>]*>/g;
2832
- var stripContentBlockHtml = (text2) => text2.replace(HTML_COMMENT_RE, "").replace(STRIPPED_ELEMENT_RE, "").replace(HTML_TAG_RE, "");
2832
+ var stripContentBlockHtml = (text) => text.replace(HTML_COMMENT_RE, "").replace(STRIPPED_ELEMENT_RE, "").replace(HTML_TAG_RE, "");
2833
2833
 
2834
2834
  // src/transforms/contentBlockV1/convertTextToTiptapParagraph.ts
2835
2835
  var convertTextToTiptapParagraph = ({
2836
2836
  color,
2837
2837
  fontSize,
2838
2838
  marks: marks2 = [],
2839
- text: text2,
2839
+ text,
2840
2840
  textAlign
2841
2841
  }) => {
2842
- const sanitizedText = stripContentBlockHtml(text2);
2842
+ const sanitizedText = stripContentBlockHtml(text);
2843
2843
  return TiptapParagraph.parse({
2844
2844
  attrs: { textAlign },
2845
2845
  content: sanitizedText ? [
@@ -2913,13 +2913,13 @@ var convertContentBlockImageToV2 = (block) => {
2913
2913
  // src/transforms/normalizeTokens.ts
2914
2914
  var import_es_toolkit4 = require("es-toolkit");
2915
2915
  var DEFAULT_KNOWN_TOKENS = ["firstName", "lastName", "email"];
2916
- var normalizeTokens = (text2, knownTokens = DEFAULT_KNOWN_TOKENS) => {
2917
- if (typeof text2 !== "string") return text2;
2916
+ var normalizeTokens = (text, knownTokens = DEFAULT_KNOWN_TOKENS) => {
2917
+ if (typeof text !== "string") return text;
2918
2918
  return knownTokens.reduce((acc, token) => {
2919
2919
  const snakeTolerant = (0, import_es_toolkit4.escapeRegExp)(token).replace(/([A-Z])/g, "_?$1");
2920
2920
  const pattern = new RegExp(`\\{{1,2}\\s*${snakeTolerant}\\s*\\}{1,2}`, "gi");
2921
2921
  return acc.replace(pattern, `{{${token}}}`);
2922
- }, text2);
2922
+ }, text);
2923
2923
  };
2924
2924
 
2925
2925
  // src/transforms/contentBlockV1/convertContentBlockTextToV2.ts
@@ -2929,7 +2929,7 @@ var HEADER_PARAGRAPH_STYLES = {
2929
2929
  superTitle: { color: "base", fontSize: "extraLarge", marks: [{ type: "bold" }] },
2930
2930
  title: { color: "base", fontSize: "medium", marks: [{ type: "bold" }] }
2931
2931
  };
2932
- var convertContentBlockTextToV2 = (language3, text2 = literalText, textAlign = "center") => {
2932
+ var convertContentBlockTextToV2 = (language3, text = literalText, textAlign = "center") => {
2933
2933
  const description = language3?.description;
2934
2934
  const superTitle = language3?.superTitle;
2935
2935
  const title = language3?.title;
@@ -2938,17 +2938,17 @@ var convertContentBlockTextToV2 = (language3, text2 = literalText, textAlign = "
2938
2938
  content: [
2939
2939
  superTitle ? convertTextToTiptapParagraph({
2940
2940
  ...HEADER_PARAGRAPH_STYLES.superTitle,
2941
- text: text2("superTitle", superTitle),
2941
+ text: text("superTitle", superTitle),
2942
2942
  textAlign
2943
2943
  }) : null,
2944
2944
  title ? convertTextToTiptapParagraph({
2945
2945
  ...HEADER_PARAGRAPH_STYLES.title,
2946
- text: text2("title", title),
2946
+ text: text("title", title),
2947
2947
  textAlign
2948
2948
  }) : null,
2949
2949
  description ? convertTextToTiptapParagraph({
2950
2950
  ...HEADER_PARAGRAPH_STYLES.description,
2951
- text: text2("description", description),
2951
+ text: text("description", description),
2952
2952
  textAlign
2953
2953
  }) : null
2954
2954
  ].filter((p) => p !== null),
@@ -3596,7 +3596,7 @@ var isMonetizeV1 = isWidgetV1(WidgetType.ui_extension_ad);
3596
3596
 
3597
3597
  // src/transforms/normalizeTextContent.ts
3598
3598
  var HTML_TAG_RE2 = /<[a-zA-Z]/;
3599
- var containsHtml = (text2) => HTML_TAG_RE2.test(text2);
3599
+ var containsHtml = (text) => HTML_TAG_RE2.test(text);
3600
3600
  var isObject = (x) => x !== null && typeof x === "object" && !Array.isArray(x);
3601
3601
  var normalizeTextValue = (value, options2 = {}) => {
3602
3602
  const tokenized = normalizeTokens(value);
@@ -4544,12 +4544,12 @@ var sizes = {
4544
4544
  xlarge: "extraLarge",
4545
4545
  xsmall: "extraSmall"
4546
4546
  };
4547
- var styledTextRun = (text2, emphasized, size) => ({
4547
+ var styledTextRun = (text, emphasized, size) => ({
4548
4548
  marks: [
4549
4549
  ...emphasized ? [{ type: "bold" }] : [],
4550
4550
  { attrs: { color: "base", fontSize: sizes[size] }, type: "textStyle" }
4551
4551
  ],
4552
- text: text2,
4552
+ text,
4553
4553
  type: "text"
4554
4554
  });
4555
4555
 
@@ -4574,16 +4574,16 @@ var convertCalloutBlock = (raw, report) => {
4574
4574
  const horizontal = styled2 ? { center: "center", leading: "start", trailing: "end" }[styles2.textAlignment] : "center";
4575
4575
  const sections = values2.flatMap(({ field, result }) => {
4576
4576
  if (!result.success) return omit(`Unreadable post-purchase callout field: ${field}`);
4577
- const text2 = result.data;
4578
- if (text2 === "") return [];
4579
- const content = styled2 && typeof text2 === "string" ? {
4577
+ const text = result.data;
4578
+ if (text === "") return [];
4579
+ const content = styled2 && typeof text === "string" ? {
4580
4580
  content: [
4581
4581
  {
4582
4582
  attrs: { textAlign: horizontal },
4583
- content: [styledTextRun(text2, styles2[`${field}Emphasized`], styles2[`${field}Size`])]
4583
+ content: [styledTextRun(text, styles2[`${field}Emphasized`], styles2[`${field}Size`])]
4584
4584
  }
4585
4585
  ]
4586
- } : text2;
4586
+ } : text;
4587
4587
  const section = CABTextSection.safeParse({ content: { en: content } });
4588
4588
  return section.success ? [section.data] : omit(`Unreadable post-purchase callout field: ${field}`);
4589
4589
  });
@@ -4662,16 +4662,16 @@ var convertImageContentText = (settings, report) => {
4662
4662
  };
4663
4663
  const value = ImageContentBlock.shape.settings.shape[field].safeParse(settings[field]);
4664
4664
  if (!value.success) return omit();
4665
- const text2 = value.data;
4666
- if (text2 === null || text2 === "") return [];
4667
- const content = typeof text2 === "string" ? {
4665
+ const text = value.data;
4666
+ if (text === null || text === "") return [];
4667
+ const content = typeof text === "string" ? {
4668
4668
  content: [
4669
4669
  {
4670
4670
  attrs: { textAlign: horizontal },
4671
- content: [styledTextRun(text2, field !== "description", settings[`${field}Size`])]
4671
+ content: [styledTextRun(text, field !== "description", settings[`${field}Size`])]
4672
4672
  }
4673
4673
  ]
4674
- } : text2;
4674
+ } : text;
4675
4675
  const section = CABTextSection.safeParse({ content: { en: content } });
4676
4676
  return section.success ? [section.data] : omit();
4677
4677
  });
@@ -4712,8 +4712,8 @@ var convertImageContentBlock = (raw, report) => {
4712
4712
  }
4713
4713
  const image = convertImageFrame({ alt, image: settings.image, imageSize: settings.imageSize });
4714
4714
  if (!image) report?.({ detail: "Unreadable post-purchase image-content image", kind: "section" });
4715
- const text2 = convertImageContentText(settings, report);
4716
- const textFrame = CABLayoutSection.parse({ direction: "grid", grid: { columns: ["100%"] }, sections: [text2] });
4715
+ const text = convertImageContentText(settings, report);
4716
+ const textFrame = CABLayoutSection.parse({ direction: "grid", grid: { columns: ["100%"] }, sections: [text] });
4717
4717
  const placement = settings.imagePlacement ?? (settings.swapContent ? "right" : "left");
4718
4718
  const imageFirst = placement === "left" || placement === "top";
4719
4719
  const sections = imageFirst ? [image, textFrame] : [textFrame, image];
@@ -4788,8 +4788,8 @@ var convertPayButtonBlock = (raw, report, widgetSettings) => {
4788
4788
  if (!parsed.success) return omit();
4789
4789
  const { settings, styles: styles2 } = parsed.data;
4790
4790
  const label2 = settings.label ? `${settings.label} \xB7 {{total}}` : "{{total}}";
4791
- const text2 = CABTextSection.safeParse({ content: { en: label2 } });
4792
- if (!text2.success) return omit();
4791
+ const text = CABTextSection.safeParse({ content: { en: label2 } });
4792
+ if (!text.success) return omit();
4793
4793
  return [
4794
4794
  CABLayoutSection.parse({
4795
4795
  alignment: { horizontal: "center" },
@@ -4798,7 +4798,7 @@ var convertPayButtonBlock = (raw, report, widgetSettings) => {
4798
4798
  sections: [
4799
4799
  CABButtonSection.parse({
4800
4800
  action: "addToOrder",
4801
- sections: [text2.data, soldOutSlot(ProductCardSettings.parse(widgetSettings ?? {}))]
4801
+ sections: [text.data, soldOutSlot(ProductCardSettings.parse(widgetSettings ?? {}))]
4802
4802
  })
4803
4803
  ],
4804
4804
  width: styles2.buttonWidth
@@ -4838,8 +4838,8 @@ var productCardControls = (settings) => [
4838
4838
  ];
4839
4839
 
4840
4840
  // src/transforms/postPurchase/productCardRows.ts
4841
- var styledCopy = (text2, look) => ({
4842
- content: [{ content: [{ marks: [{ attrs: look, type: "textStyle" }], text: text2, type: "text" }], type: "paragraph" }],
4841
+ var styledCopy = (text, look) => ({
4842
+ content: [{ content: [{ marks: [{ attrs: look, type: "textStyle" }], text, type: "text" }], type: "paragraph" }],
4843
4843
  type: "doc"
4844
4844
  });
4845
4845
  var merchantLabel = (value, fallback) => localizedContent({ en: fallback }, value);
@@ -4849,7 +4849,7 @@ var boundText = (variable, content) => ({
4849
4849
  visibility: shownWhile(variable)
4850
4850
  });
4851
4851
  var earnedRow = ({ after, columns, label: label2, look, spacing, token, variable }) => {
4852
- const styled2 = (text2) => look ? styledCopy(text2, look) : text2;
4852
+ const styled2 = (text) => look ? styledCopy(text, look) : text;
4853
4853
  const value = earnedText(variable, styled2(token));
4854
4854
  return {
4855
4855
  direction: "grid",
@@ -4926,8 +4926,8 @@ var recurringSummary = (settings) => {
4926
4926
  variable: HAS_RECURRING_SHIPPING
4927
4927
  })
4928
4928
  ] : [],
4929
- ...FOOTNOTES.map((text2) => ({
4930
- content: { en: styledCopy(text2, small) },
4929
+ ...FOOTNOTES.map((text) => ({
4930
+ content: { en: styledCopy(text, small) },
4931
4931
  sectionType: "text",
4932
4932
  visibility: shownWhile(HAS_RECURRING_TOTAL)
4933
4933
  }))
@@ -5085,9 +5085,9 @@ var convertTextBlock = (raw, report) => {
5085
5085
  };
5086
5086
  const sections = values2.flatMap(({ field, result }) => {
5087
5087
  if (!result.success) return omit(field);
5088
- const text2 = result.data;
5089
- if (text2 === null || text2 === "") return [];
5090
- const content = styled2 ? { content: [{ attrs: { textAlign: horizontal }, content: [{ marks: styles[field], text: text2 }] }] } : text2;
5088
+ const text = result.data;
5089
+ if (text === null || text === "") return [];
5090
+ const content = styled2 ? { content: [{ attrs: { textAlign: horizontal }, content: [{ marks: styles[field], text }] }] } : text;
5091
5091
  const section = CABTextSection.safeParse({ content: { en: content } });
5092
5092
  return section.success ? [section.data] : omit(field);
5093
5093
  });
@@ -5122,13 +5122,13 @@ var convertTimerBlock = (raw, report) => {
5122
5122
  }
5123
5123
  ]
5124
5124
  } : withCountdown(title, countdown, horizontal);
5125
- const text2 = CABTextSection.safeParse({ content: { en: content } });
5126
- if (!text2.success) return omit();
5125
+ const text = CABTextSection.safeParse({ content: { en: content } });
5126
+ if (!text.success) return omit();
5127
5127
  return [
5128
5128
  CABBannerSection.parse({
5129
5129
  color: styles2.timerBackgroundColor,
5130
5130
  dismissible: false,
5131
- sections: [text2.data],
5131
+ sections: [text.data],
5132
5132
  width: styles2.timerWidth
5133
5133
  })
5134
5134
  ];
@@ -5831,7 +5831,7 @@ var fetchAdsEngineOffers = async (input, ctx, prefetched) => {
5831
5831
  // src/transforms/htmlToPlainText.ts
5832
5832
  var paragraphText = (paragraph) => paragraph.content.map((run) => run.text).join("");
5833
5833
  var FORCE_PARSER = { defaultTextStyle: {} };
5834
- var withoutTagShapes = (text2) => isHTML(text2) ? text2.replace(/[<>]/g, "") : text2;
5834
+ var withoutTagShapes = (text) => isHTML(text) ? text.replace(/[<>]/g, "") : text;
5835
5835
  var htmlToPlainText = (html) => withoutTagShapes(
5836
5836
  normalizeTextValue(html, FORCE_PARSER).content.map((paragraph) => paragraphText(paragraph).trim()).filter((line) => line !== "").join("\n")
5837
5837
  );
@@ -5839,12 +5839,11 @@ var htmlToPlainText = (html) => withoutTagShapes(
5839
5839
  // src/server/composeOffer.ts
5840
5840
  var ACCEPT_FALLBACK = "Accept";
5841
5841
  var DECLINE_FALLBACK = "No Thanks";
5842
- var label = (text2) => ({
5842
+ var label = (text) => ({
5843
5843
  buttonField: ButtonField.buttonLabel,
5844
- content: { en: text2 },
5844
+ content: { en: text },
5845
5845
  sectionType: SectionType.text
5846
5846
  });
5847
- var text = (content) => ({ content: { en: content }, sectionType: SectionType.text });
5848
5847
  var AS_DOC = { defaultTextStyle: {} };
5849
5848
  var safeTextValue = (raw, options2) => {
5850
5849
  const converted = normalizeTextValue(raw, options2);
@@ -5902,20 +5901,17 @@ var styled = (value, { align, bold, color, fontSize, href }) => ({
5902
5901
  sectionType: SectionType.text
5903
5902
  });
5904
5903
  var shopName = (shop, storeName) => storeName?.replace(/<[^>]*>/g, "").trim() || shop.replace(/\.myshopify\.com$/, "") || "store";
5905
- var headerSections = (input, storeName) => [
5906
- {
5907
- sections: [
5908
- styled("Congratulations!", { bold: true, fontSize: "heading" }),
5909
- styled(`Your ${shopName(input.shop, storeName)} purchase unlocked a bonus:`, {
5910
- bold: true,
5911
- fontSize: "heading"
5912
- })
5913
- ],
5914
- sectionType: SectionType.layout,
5915
- spacing: Spacing.none
5916
- },
5917
- text(input.orderName ? `Order ${input.orderName} Confirmed` : "Order Confirmed")
5918
- ];
5904
+ var headerSection = (input, storeName) => ({
5905
+ sections: [
5906
+ styled("Congratulations!", { bold: true, fontSize: "heading" }),
5907
+ styled(`Your ${shopName(input.shop, storeName)} purchase unlocked a bonus:`, {
5908
+ bold: true,
5909
+ fontSize: "heading"
5910
+ })
5911
+ ],
5912
+ sectionType: SectionType.layout,
5913
+ spacing: Spacing.none
5914
+ });
5919
5915
  var privacyHref = (offer, input) => {
5920
5916
  const href = [offer.privacy_url, input.privacyPolicyUrl].find((url) => url && isValidHref(url));
5921
5917
  return href ? { href } : {};
@@ -5927,9 +5923,9 @@ var legalCopy = (raw, visibleWhen) => ({
5927
5923
  sectionType: SectionType.text,
5928
5924
  ...visibleWhen !== void 0 && { visibility: { variable: SHOW_EXTENDED, visibleWhen } }
5929
5925
  });
5930
- var disclosureToggle = (text2, visibleWhen) => ({
5926
+ var disclosureToggle = (text, visibleWhen) => ({
5931
5927
  buttonStyle: ButtonStyle.plain,
5932
- sections: [label(text2)],
5928
+ sections: [label(text)],
5933
5929
  sectionType: SectionType.button,
5934
5930
  variableEffects: [{ effect: "toggle", variable: SHOW_EXTENDED }],
5935
5931
  visibility: { variable: SHOW_EXTENDED, visibleWhen }
@@ -5984,7 +5980,7 @@ var composeOfferCard = (offer, input, storeName) => {
5984
5980
  border: { style: BorderStyle.base },
5985
5981
  padding: Spacing.tight,
5986
5982
  sections: [
5987
- ...headerSections(input, storeName),
5983
+ headerSection(input, storeName),
5988
5984
  offer.image_url ? {
5989
5985
  alignment: { horizontal: HorizontalAlignment.start, vertical: VerticalAlignment.middle },
5990
5986
  direction: Direction.grid,
@@ -702,7 +702,7 @@ var isHTML = (html = "") => {
702
702
  }
703
703
  return html.search(HTML_TAGS_REGEX) !== -1;
704
704
  };
705
- var hasHTMLInDoc = (doc) => doc.content.some(({ content = [] }) => content.some(({ text: text2 }) => isHTML(text2)));
705
+ var hasHTMLInDoc = (doc) => doc.content.some(({ content = [] }) => content.some(({ text }) => isHTML(text)));
706
706
  var checkForHTML = (input) => !(isString(input) && isHTML(input) || isPlainObject2(input) && hasHTMLInDoc(input));
707
707
  var NO_HTML = { message: "HTML is not supported" };
708
708
  var isSectionType = (sectionType) => (section) => get(section, "sectionType") === sectionType;
@@ -2756,17 +2756,17 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source: sou
2756
2756
  var HTML_COMMENT_RE = /<!--[\s\S]*?-->/g;
2757
2757
  var STRIPPED_ELEMENT_RE = /<(script|style|iframe|object|embed|noscript|template)\b[^>]*>[\s\S]*?(?:<\/\1\s*>|$)/gi;
2758
2758
  var HTML_TAG_RE = /<\/?[a-zA-Z][^>]*>/g;
2759
- var stripContentBlockHtml = (text2) => text2.replace(HTML_COMMENT_RE, "").replace(STRIPPED_ELEMENT_RE, "").replace(HTML_TAG_RE, "");
2759
+ var stripContentBlockHtml = (text) => text.replace(HTML_COMMENT_RE, "").replace(STRIPPED_ELEMENT_RE, "").replace(HTML_TAG_RE, "");
2760
2760
 
2761
2761
  // src/transforms/contentBlockV1/convertTextToTiptapParagraph.ts
2762
2762
  var convertTextToTiptapParagraph = ({
2763
2763
  color,
2764
2764
  fontSize,
2765
2765
  marks: marks2 = [],
2766
- text: text2,
2766
+ text,
2767
2767
  textAlign
2768
2768
  }) => {
2769
- const sanitizedText = stripContentBlockHtml(text2);
2769
+ const sanitizedText = stripContentBlockHtml(text);
2770
2770
  return TiptapParagraph.parse({
2771
2771
  attrs: { textAlign },
2772
2772
  content: sanitizedText ? [
@@ -2840,13 +2840,13 @@ var convertContentBlockImageToV2 = (block) => {
2840
2840
  // src/transforms/normalizeTokens.ts
2841
2841
  import { escapeRegExp } from "es-toolkit";
2842
2842
  var DEFAULT_KNOWN_TOKENS = ["firstName", "lastName", "email"];
2843
- var normalizeTokens = (text2, knownTokens = DEFAULT_KNOWN_TOKENS) => {
2844
- if (typeof text2 !== "string") return text2;
2843
+ var normalizeTokens = (text, knownTokens = DEFAULT_KNOWN_TOKENS) => {
2844
+ if (typeof text !== "string") return text;
2845
2845
  return knownTokens.reduce((acc, token) => {
2846
2846
  const snakeTolerant = escapeRegExp(token).replace(/([A-Z])/g, "_?$1");
2847
2847
  const pattern = new RegExp(`\\{{1,2}\\s*${snakeTolerant}\\s*\\}{1,2}`, "gi");
2848
2848
  return acc.replace(pattern, `{{${token}}}`);
2849
- }, text2);
2849
+ }, text);
2850
2850
  };
2851
2851
 
2852
2852
  // src/transforms/contentBlockV1/convertContentBlockTextToV2.ts
@@ -2856,7 +2856,7 @@ var HEADER_PARAGRAPH_STYLES = {
2856
2856
  superTitle: { color: "base", fontSize: "extraLarge", marks: [{ type: "bold" }] },
2857
2857
  title: { color: "base", fontSize: "medium", marks: [{ type: "bold" }] }
2858
2858
  };
2859
- var convertContentBlockTextToV2 = (language3, text2 = literalText, textAlign = "center") => {
2859
+ var convertContentBlockTextToV2 = (language3, text = literalText, textAlign = "center") => {
2860
2860
  const description = language3?.description;
2861
2861
  const superTitle = language3?.superTitle;
2862
2862
  const title = language3?.title;
@@ -2865,17 +2865,17 @@ var convertContentBlockTextToV2 = (language3, text2 = literalText, textAlign = "
2865
2865
  content: [
2866
2866
  superTitle ? convertTextToTiptapParagraph({
2867
2867
  ...HEADER_PARAGRAPH_STYLES.superTitle,
2868
- text: text2("superTitle", superTitle),
2868
+ text: text("superTitle", superTitle),
2869
2869
  textAlign
2870
2870
  }) : null,
2871
2871
  title ? convertTextToTiptapParagraph({
2872
2872
  ...HEADER_PARAGRAPH_STYLES.title,
2873
- text: text2("title", title),
2873
+ text: text("title", title),
2874
2874
  textAlign
2875
2875
  }) : null,
2876
2876
  description ? convertTextToTiptapParagraph({
2877
2877
  ...HEADER_PARAGRAPH_STYLES.description,
2878
- text: text2("description", description),
2878
+ text: text("description", description),
2879
2879
  textAlign
2880
2880
  }) : null
2881
2881
  ].filter((p) => p !== null),
@@ -3523,7 +3523,7 @@ var isMonetizeV1 = isWidgetV1(WidgetType.ui_extension_ad);
3523
3523
 
3524
3524
  // src/transforms/normalizeTextContent.ts
3525
3525
  var HTML_TAG_RE2 = /<[a-zA-Z]/;
3526
- var containsHtml = (text2) => HTML_TAG_RE2.test(text2);
3526
+ var containsHtml = (text) => HTML_TAG_RE2.test(text);
3527
3527
  var isObject = (x) => x !== null && typeof x === "object" && !Array.isArray(x);
3528
3528
  var normalizeTextValue = (value, options2 = {}) => {
3529
3529
  const tokenized = normalizeTokens(value);
@@ -4471,12 +4471,12 @@ var sizes = {
4471
4471
  xlarge: "extraLarge",
4472
4472
  xsmall: "extraSmall"
4473
4473
  };
4474
- var styledTextRun = (text2, emphasized, size) => ({
4474
+ var styledTextRun = (text, emphasized, size) => ({
4475
4475
  marks: [
4476
4476
  ...emphasized ? [{ type: "bold" }] : [],
4477
4477
  { attrs: { color: "base", fontSize: sizes[size] }, type: "textStyle" }
4478
4478
  ],
4479
- text: text2,
4479
+ text,
4480
4480
  type: "text"
4481
4481
  });
4482
4482
 
@@ -4501,16 +4501,16 @@ var convertCalloutBlock = (raw, report) => {
4501
4501
  const horizontal = styled2 ? { center: "center", leading: "start", trailing: "end" }[styles2.textAlignment] : "center";
4502
4502
  const sections = values2.flatMap(({ field, result }) => {
4503
4503
  if (!result.success) return omit(`Unreadable post-purchase callout field: ${field}`);
4504
- const text2 = result.data;
4505
- if (text2 === "") return [];
4506
- const content = styled2 && typeof text2 === "string" ? {
4504
+ const text = result.data;
4505
+ if (text === "") return [];
4506
+ const content = styled2 && typeof text === "string" ? {
4507
4507
  content: [
4508
4508
  {
4509
4509
  attrs: { textAlign: horizontal },
4510
- content: [styledTextRun(text2, styles2[`${field}Emphasized`], styles2[`${field}Size`])]
4510
+ content: [styledTextRun(text, styles2[`${field}Emphasized`], styles2[`${field}Size`])]
4511
4511
  }
4512
4512
  ]
4513
- } : text2;
4513
+ } : text;
4514
4514
  const section = CABTextSection.safeParse({ content: { en: content } });
4515
4515
  return section.success ? [section.data] : omit(`Unreadable post-purchase callout field: ${field}`);
4516
4516
  });
@@ -4589,16 +4589,16 @@ var convertImageContentText = (settings, report) => {
4589
4589
  };
4590
4590
  const value = ImageContentBlock.shape.settings.shape[field].safeParse(settings[field]);
4591
4591
  if (!value.success) return omit();
4592
- const text2 = value.data;
4593
- if (text2 === null || text2 === "") return [];
4594
- const content = typeof text2 === "string" ? {
4592
+ const text = value.data;
4593
+ if (text === null || text === "") return [];
4594
+ const content = typeof text === "string" ? {
4595
4595
  content: [
4596
4596
  {
4597
4597
  attrs: { textAlign: horizontal },
4598
- content: [styledTextRun(text2, field !== "description", settings[`${field}Size`])]
4598
+ content: [styledTextRun(text, field !== "description", settings[`${field}Size`])]
4599
4599
  }
4600
4600
  ]
4601
- } : text2;
4601
+ } : text;
4602
4602
  const section = CABTextSection.safeParse({ content: { en: content } });
4603
4603
  return section.success ? [section.data] : omit();
4604
4604
  });
@@ -4639,8 +4639,8 @@ var convertImageContentBlock = (raw, report) => {
4639
4639
  }
4640
4640
  const image = convertImageFrame({ alt, image: settings.image, imageSize: settings.imageSize });
4641
4641
  if (!image) report?.({ detail: "Unreadable post-purchase image-content image", kind: "section" });
4642
- const text2 = convertImageContentText(settings, report);
4643
- const textFrame = CABLayoutSection.parse({ direction: "grid", grid: { columns: ["100%"] }, sections: [text2] });
4642
+ const text = convertImageContentText(settings, report);
4643
+ const textFrame = CABLayoutSection.parse({ direction: "grid", grid: { columns: ["100%"] }, sections: [text] });
4644
4644
  const placement = settings.imagePlacement ?? (settings.swapContent ? "right" : "left");
4645
4645
  const imageFirst = placement === "left" || placement === "top";
4646
4646
  const sections = imageFirst ? [image, textFrame] : [textFrame, image];
@@ -4715,8 +4715,8 @@ var convertPayButtonBlock = (raw, report, widgetSettings) => {
4715
4715
  if (!parsed.success) return omit();
4716
4716
  const { settings, styles: styles2 } = parsed.data;
4717
4717
  const label2 = settings.label ? `${settings.label} \xB7 {{total}}` : "{{total}}";
4718
- const text2 = CABTextSection.safeParse({ content: { en: label2 } });
4719
- if (!text2.success) return omit();
4718
+ const text = CABTextSection.safeParse({ content: { en: label2 } });
4719
+ if (!text.success) return omit();
4720
4720
  return [
4721
4721
  CABLayoutSection.parse({
4722
4722
  alignment: { horizontal: "center" },
@@ -4725,7 +4725,7 @@ var convertPayButtonBlock = (raw, report, widgetSettings) => {
4725
4725
  sections: [
4726
4726
  CABButtonSection.parse({
4727
4727
  action: "addToOrder",
4728
- sections: [text2.data, soldOutSlot(ProductCardSettings.parse(widgetSettings ?? {}))]
4728
+ sections: [text.data, soldOutSlot(ProductCardSettings.parse(widgetSettings ?? {}))]
4729
4729
  })
4730
4730
  ],
4731
4731
  width: styles2.buttonWidth
@@ -4765,8 +4765,8 @@ var productCardControls = (settings) => [
4765
4765
  ];
4766
4766
 
4767
4767
  // src/transforms/postPurchase/productCardRows.ts
4768
- var styledCopy = (text2, look) => ({
4769
- content: [{ content: [{ marks: [{ attrs: look, type: "textStyle" }], text: text2, type: "text" }], type: "paragraph" }],
4768
+ var styledCopy = (text, look) => ({
4769
+ content: [{ content: [{ marks: [{ attrs: look, type: "textStyle" }], text, type: "text" }], type: "paragraph" }],
4770
4770
  type: "doc"
4771
4771
  });
4772
4772
  var merchantLabel = (value, fallback) => localizedContent({ en: fallback }, value);
@@ -4776,7 +4776,7 @@ var boundText = (variable, content) => ({
4776
4776
  visibility: shownWhile(variable)
4777
4777
  });
4778
4778
  var earnedRow = ({ after, columns, label: label2, look, spacing, token, variable }) => {
4779
- const styled2 = (text2) => look ? styledCopy(text2, look) : text2;
4779
+ const styled2 = (text) => look ? styledCopy(text, look) : text;
4780
4780
  const value = earnedText(variable, styled2(token));
4781
4781
  return {
4782
4782
  direction: "grid",
@@ -4853,8 +4853,8 @@ var recurringSummary = (settings) => {
4853
4853
  variable: HAS_RECURRING_SHIPPING
4854
4854
  })
4855
4855
  ] : [],
4856
- ...FOOTNOTES.map((text2) => ({
4857
- content: { en: styledCopy(text2, small) },
4856
+ ...FOOTNOTES.map((text) => ({
4857
+ content: { en: styledCopy(text, small) },
4858
4858
  sectionType: "text",
4859
4859
  visibility: shownWhile(HAS_RECURRING_TOTAL)
4860
4860
  }))
@@ -5012,9 +5012,9 @@ var convertTextBlock = (raw, report) => {
5012
5012
  };
5013
5013
  const sections = values2.flatMap(({ field, result }) => {
5014
5014
  if (!result.success) return omit(field);
5015
- const text2 = result.data;
5016
- if (text2 === null || text2 === "") return [];
5017
- const content = styled2 ? { content: [{ attrs: { textAlign: horizontal }, content: [{ marks: styles[field], text: text2 }] }] } : text2;
5015
+ const text = result.data;
5016
+ if (text === null || text === "") return [];
5017
+ const content = styled2 ? { content: [{ attrs: { textAlign: horizontal }, content: [{ marks: styles[field], text }] }] } : text;
5018
5018
  const section = CABTextSection.safeParse({ content: { en: content } });
5019
5019
  return section.success ? [section.data] : omit(field);
5020
5020
  });
@@ -5049,13 +5049,13 @@ var convertTimerBlock = (raw, report) => {
5049
5049
  }
5050
5050
  ]
5051
5051
  } : withCountdown(title, countdown, horizontal);
5052
- const text2 = CABTextSection.safeParse({ content: { en: content } });
5053
- if (!text2.success) return omit();
5052
+ const text = CABTextSection.safeParse({ content: { en: content } });
5053
+ if (!text.success) return omit();
5054
5054
  return [
5055
5055
  CABBannerSection.parse({
5056
5056
  color: styles2.timerBackgroundColor,
5057
5057
  dismissible: false,
5058
- sections: [text2.data],
5058
+ sections: [text.data],
5059
5059
  width: styles2.timerWidth
5060
5060
  })
5061
5061
  ];
@@ -5758,7 +5758,7 @@ var fetchAdsEngineOffers = async (input, ctx, prefetched) => {
5758
5758
  // src/transforms/htmlToPlainText.ts
5759
5759
  var paragraphText = (paragraph) => paragraph.content.map((run) => run.text).join("");
5760
5760
  var FORCE_PARSER = { defaultTextStyle: {} };
5761
- var withoutTagShapes = (text2) => isHTML(text2) ? text2.replace(/[<>]/g, "") : text2;
5761
+ var withoutTagShapes = (text) => isHTML(text) ? text.replace(/[<>]/g, "") : text;
5762
5762
  var htmlToPlainText = (html) => withoutTagShapes(
5763
5763
  normalizeTextValue(html, FORCE_PARSER).content.map((paragraph) => paragraphText(paragraph).trim()).filter((line) => line !== "").join("\n")
5764
5764
  );
@@ -5766,12 +5766,11 @@ var htmlToPlainText = (html) => withoutTagShapes(
5766
5766
  // src/server/composeOffer.ts
5767
5767
  var ACCEPT_FALLBACK = "Accept";
5768
5768
  var DECLINE_FALLBACK = "No Thanks";
5769
- var label = (text2) => ({
5769
+ var label = (text) => ({
5770
5770
  buttonField: ButtonField.buttonLabel,
5771
- content: { en: text2 },
5771
+ content: { en: text },
5772
5772
  sectionType: SectionType.text
5773
5773
  });
5774
- var text = (content) => ({ content: { en: content }, sectionType: SectionType.text });
5775
5774
  var AS_DOC = { defaultTextStyle: {} };
5776
5775
  var safeTextValue = (raw, options2) => {
5777
5776
  const converted = normalizeTextValue(raw, options2);
@@ -5829,20 +5828,17 @@ var styled = (value, { align, bold, color, fontSize, href }) => ({
5829
5828
  sectionType: SectionType.text
5830
5829
  });
5831
5830
  var shopName = (shop, storeName) => storeName?.replace(/<[^>]*>/g, "").trim() || shop.replace(/\.myshopify\.com$/, "") || "store";
5832
- var headerSections = (input, storeName) => [
5833
- {
5834
- sections: [
5835
- styled("Congratulations!", { bold: true, fontSize: "heading" }),
5836
- styled(`Your ${shopName(input.shop, storeName)} purchase unlocked a bonus:`, {
5837
- bold: true,
5838
- fontSize: "heading"
5839
- })
5840
- ],
5841
- sectionType: SectionType.layout,
5842
- spacing: Spacing.none
5843
- },
5844
- text(input.orderName ? `Order ${input.orderName} Confirmed` : "Order Confirmed")
5845
- ];
5831
+ var headerSection = (input, storeName) => ({
5832
+ sections: [
5833
+ styled("Congratulations!", { bold: true, fontSize: "heading" }),
5834
+ styled(`Your ${shopName(input.shop, storeName)} purchase unlocked a bonus:`, {
5835
+ bold: true,
5836
+ fontSize: "heading"
5837
+ })
5838
+ ],
5839
+ sectionType: SectionType.layout,
5840
+ spacing: Spacing.none
5841
+ });
5846
5842
  var privacyHref = (offer, input) => {
5847
5843
  const href = [offer.privacy_url, input.privacyPolicyUrl].find((url) => url && isValidHref(url));
5848
5844
  return href ? { href } : {};
@@ -5854,9 +5850,9 @@ var legalCopy = (raw, visibleWhen) => ({
5854
5850
  sectionType: SectionType.text,
5855
5851
  ...visibleWhen !== void 0 && { visibility: { variable: SHOW_EXTENDED, visibleWhen } }
5856
5852
  });
5857
- var disclosureToggle = (text2, visibleWhen) => ({
5853
+ var disclosureToggle = (text, visibleWhen) => ({
5858
5854
  buttonStyle: ButtonStyle.plain,
5859
- sections: [label(text2)],
5855
+ sections: [label(text)],
5860
5856
  sectionType: SectionType.button,
5861
5857
  variableEffects: [{ effect: "toggle", variable: SHOW_EXTENDED }],
5862
5858
  visibility: { variable: SHOW_EXTENDED, visibleWhen }
@@ -5911,7 +5907,7 @@ var composeOfferCard = (offer, input, storeName) => {
5911
5907
  border: { style: BorderStyle.base },
5912
5908
  padding: Spacing.tight,
5913
5909
  sections: [
5914
- ...headerSections(input, storeName),
5910
+ headerSection(input, storeName),
5915
5911
  offer.image_url ? {
5916
5912
  alignment: { horizontal: HorizontalAlignment.start, vertical: VerticalAlignment.middle },
5917
5913
  direction: Direction.grid,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebuy/rebuy",
3
- "version": "3.60.3",
3
+ "version": "3.60.4",
4
4
  "description": "Shared zod schemas, legacy-to-CAB widget transforms, and server orchestrators for Rebuy's Shopify consumers (rebuy-api, admin-nextjs, rebuy-shopify-extensions)",
5
5
  "license": "MIT",
6
6
  "author": "Rebuy, Inc.",